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

    AtomArray->C4DAtom->BaseObject

    SDK Help
    0
    3
    309
    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

      On 17/04/2013 at 20:10, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   12 
      Platform:      Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      This seems to be an absolutely trivial task - but after hours of hunting I am giving up:

      How do I find the first selected object in a document?
      First I thought about using GetFirstObject(), GetNext(), etc. while checking if the object is selected. But I can't find anything that lets me test if a given BaseObject is selected.

      Then I thought I use GetActiveObjects() which puts all selected objects into an AtomArray through which I can step and get the C4DAtoms. But how can I get an actual BaseObject from from a C4DAtom?

      I am probably looking at the wrong end since this must be utterly common....

      Thanks

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

        On 17/04/2013 at 21:01, xxxxxxxx wrote:

        Hi,

        use GetBit(BIT_ACTIVE) to check if an object is selected. You can simply
        cast an item from C4DAtom (as returned by AtomArray::GetIndex) to BaseObject.

        -Niklas

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

          On 22/04/2013 at 10:35, xxxxxxxx wrote:

          Hi Niklas
          Ah, yes, I thought it would be obvious. Just not to a rookie like me.

          Thanks a bunch.

          Peter

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