get more than 1 active object



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



  • 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



  • 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



  • 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



  • 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");


Log in to reply