Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    get more than 1 active object

    SDK Help
    0
    5
    473
    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 30/11/2006 at 03:05, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:    
      Platform:    Mac  ;  
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      maybe a simple one, but i didnt get it...

      i can get the active obj with
      obj=doc->GetActiveObject();

      but what if i select more than one object.
      obj=doc->GetActiveObject();
      seems to return nil then !

      ...? any inputs ?

      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 30/11/2006 at 04:50, xxxxxxxx wrote:

        You then first need to loop the document, searching for the active ones.
        If you do a search for "hierarchy" here at SDK you'll find example code, including finding specific tags as well.

        Cheers
        Lennart

        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 30/11/2006 at 18:13, xxxxxxxx wrote:

          Hi zeorge ...

          I used to do it like below ...

          AtomArray *atm=AtomArray::Alloc();
          BaseDocument *doc=GetActiveDocument();
          doc->GetActiveObjects(*atm,FALSE);
          LONG lObjCnt=atm->GetCount();//Taking the selected object count ...
          MessageDialog(LongToString(lObjCnt) + " objects are selected!");
          //If you want to take the first object
          BaseObject *obj=(BaseObject* )atm->GetIndex(0);
          MessageDialog("The first object is " + obj->GetName());

          I hope the above code block can help you ...
          Take care the function is GetActiveOjbect s not GetActiveObject ...

          Wishing you all the best ...
          Zaw Min Tun

          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 30/11/2006 at 18:46, xxxxxxxx wrote:

            Sorry ...
            You're talking about Coffee ...

            I found a forum link here ...
            http://forums.cgsociety.org/showpost.php?p=2776293&postcount;=4

            Wishing you all the best ...
            Zaw Min Tun

            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 06/12/2006 at 04:17, xxxxxxxx wrote:

              OK,
              I GOT THE SOLUTION NOW BY MYSELF .... AND SHARE IT HERE FOR OTHERS :

              this code counts the active objects...

              var obj=GetActiveDocument()->GetFirstObject(), active_objects;
              if(obj->GetBit(BIT_AOBJ)) { active_objects=0; } else { active_objects=-1; }
              while(obj) { active_objects++; obj=obj->SearchNext(BIT_AOBJ); }
              println(active_objects, " active objects");

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