• 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....


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


    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.


  • 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.


Log in to reply