Pointcount of TpolySelection?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/02/2012 at 01:55, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:    
    Platform:      
    Language(s) :

    ---------
    Hi,
    I am trying to get the pointscount of a polygonselection, which is stored in a polygonselectionTag.
    I tried

    int points = op->GetTagDataCount(Tpoint);
    

    before that i set the selection tag as active. All i get is the full amount of points from the Object. If i use a Cube it gives me 8 Points becuase a Cube got only 8. But the right value would be 4 if i've selected only one face.
    I need the pointcount to set a weightmap. If I am not mistaken i can make weightmap for my joints with the function "setWeightMap(Joint_index,map(float number),Pointcount)
    So the Question is do I have to use this way:

    BaseDocument *doc = GetActiveDocument();
        BaseObject *obj = doc->GetActiveObject();   
        PolygonObject *pobj = ToPoly(obj);        
      
        AutoAlloc<SelectionTag> st(Tpolygonselection); 
      
       
      if(newpolytag->GetType() &Tpolygonselection)
        {
          BaseSelect *select= static_cast<SelectionTag*>(newpolytag)->GetBaseSelect(); 
          sel->CopyTo(select);      
        }
    LONG count = pobj->GetPolygonCount(); 
    

    To work my way through the number of points? Or is there an easier way, to get the points amount of the selection?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/02/2012 at 04:32, xxxxxxxx wrote:

    You need to convert your polygon selection into a point selection. Take a look at the SelectionChanger class.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/02/2012 at 04:59, xxxxxxxx wrote:

    hm ok since this only converts it into a pointselection. So I've to convert it afterwards into a pointObject. And then get the pointscount();

    The other thing what make me wonder is how to set the weight map on those points in the pointselection area.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/02/2012 at 05:52, xxxxxxxx wrote:

    Once you've got the point selection

    I think you can do the rest by

    count = obj.GetPointS().GetCount()



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/02/2012 at 05:58, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    hm ok since this only converts it into a pointselection. So I've to convert it afterwards into a pointObject. And then get the pointscount();

    Once you have a BaseSelect returned by the SelectionChanger, just do BaseSelect::GetCount(). To access those points, of course you will need to get the object's points array. You can use:

      
    Vector *padr = ToPoint(yourobject)->GetPointR();   
    

    The SDK docs for BaseSelect shows you how to get the selected points (look for BaseSelect::IsSelected())

    Steve


Log in to reply