newbie: retrieve poly-selection from link



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

    On 09/06/2004 at 07:58, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.100 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi all,

    im just starting with my first plugin and i have a problem i cant seem to solve on my own.

    I wrote a tag plugin, which can be attached as an expression and which has a link field that accepts polygon selections.

    My question now is, how do i access the polygon selection in my functions?

    i tried it like this:

    BaseList2D* polySelection = tag->GetData().GetLink(1001,doc); 
    

    but i still dont know how to access the polys
    and besides, cinema crashes when i clear the link field.. :(

    thanks in advance,
    devel



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

    On 09/06/2004 at 15:20, xxxxxxxx wrote:

    You should cast the return object into a SelectionTag, you should then check that its non NULL, this will avoid the crashes.
    Use the SelectionTag to get the selection

        
        
        
        
        SelectionTag *polySelection = static_cast<SelectionTag*>(tag->GetData().GetLink(1001,doc));
        
        
        
        
        if(!polySelection) return FALSE;
        
        
        
        
         
        
        
        
        
        BaseSelect *selectedpolies = polySelection->GetBaseSelect();
        
        
        
        
         
        
        
        
        
        // Unefficiently check for selected polies
        
        
        
        
        for(LONG i=0; i < selectedpolies->GetCount();i++)
        
        
        
        
        {
        
        
        
        
          if(selectedpolies->IsSelected(i))
        
        
        
        
          {
        
        
        
        
            GePrint("Polygon Selected :" + LongToString(i));
        
        
        
        
          }
        
        
        
        
        }
        
        
        
        
         
        
        
        
    

    Look in the docs BaseSelect::IsSelected for an efficient algorithm



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

    On 09/06/2004 at 16:32, xxxxxxxx wrote:

    alright, that does it!

    thanks for your help,
    devel


Log in to reply