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

    GetActiveObjects

    SDK Help
    0
    4
    360
    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 11/11/2004 at 17:27, xxxxxxxx wrote:

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

      ---------
      Hi Guys,
      Really new to C++ and the Cinema SDK. But I want to get all the selected objects in the document. This I belive can be done by doing this:

          
          
           
          
          
          
          
          AutoAlloc<AtomArray> objects; if (!objects) break;
          
          
          
          
          GetActiveDocument()->GetActiveObjects(objects, TRUE);
          
          
          
          
          
      
      To me this means that all the selected elements will be stored in 'objects'. My question is how can I access the individual elements of the AtomArray so I can get the position of each object in the selection? Thanks in advance for any help
      
      
      
      
       
      
      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 11/11/2004 at 19:03, xxxxxxxx wrote:

        Hi, try this: 
        cnt= objects->GetCount(); // To get selected objects count
        for(i=0;i<cnt;i++)
        {
          Obj =(BaseObject* )objects->GetIndex(i); // Get the first object
         // you can proceed with 'Obj' to get position 
        }

        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 12/11/2004 at 13:14, xxxxxxxx wrote:

          Thanks for the reply Charles, it helped a lot. My other question now is the GetIndex() returns the index of type long for each object. So Obj would have to be declared as a long such as:

              
              
              
              
              for(int i=0; i<cnt; i++)
              
              
              
              
              {
              
              
              
              
              long Obj=(BaseObject* )objects->GetIndex(i);
              
              
              
              
              }
              
              
              
              
              How could I return each object to Obj from the provided index in the for loop? Thanks in advance.
              
              
              
              
              -Josh-
          
          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 12/11/2004 at 13:20, xxxxxxxx wrote:

            Hi Josh,

            no GetIndex(i) returns already the object (pointer) and not a LONG value. That´s why the old cast is there.

            BaseObject* Obj = static_cast<BaseObject*>(objects->GetIndex(i));
            
            1 Reply Last reply Reply Quote 0
            • First post
              Last post