Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    newbie: retrieve poly-selection from link

    SDK Help
    0
    3
    275
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post