restore selection object

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 29/11/2002 at 01:14, xxxxxxxx wrote:

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

---------
ive got an object
  BaseObject *x
its of type
  Oselection
so I want to restore this selection.
I start looking for some ways to do this , but this seems  very cloudy.
I look in the Oselection.h for some clues and find
 SELECTIONOBJECT_LIST   = 1000,
 SELECTIONOBJECT_RESTORE  = 1001 // virtual ID
then I look in the Oselection.res and find
 BUTTON SELECTIONOBJECT_RESTORE { }
 IN_EXCLUDE SELECTIONOBJECT_LIST {bla bla}
it would be nice if i could send a message to click the button 🙂 but i soubt this very much.
so im left with IN_EXCLUDE   data type.
I look in SDK help for some clue how top extract the list of  object from this data type and there is no clue.
 
so I ask here  , how can i get activate an Oselection and its contents , as if i had pressed its restore selection button.or at least get the list of object so i can activate them by hand.
 
cheers
 
Paul

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 29/11/2002 at 07:48, xxxxxxxx wrote:

Shouldn´t it work like this to restore the selection:

BaseContainer \*bc = so->GetDataInstance();  
bc->SetBool(1002,1);


 

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 29/11/2002 at 15:18, xxxxxxxx wrote:

Shouldn´t it work like this to restore the selection:

>BaseContainer \*bc = so->GetDataInstance();


>bc->SetBool(1002,1);


 


it would be nice if that worked , but it doesnt :/


  
Paul


 

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 29/11/2002 at 19:10, xxxxxxxx wrote:

Hmm, you are right, I just tried it out. I tried to get the GeDataType of it but that didn´t work either. I receive DA_NIL when using SELECTIONOBJECT_RESTORE and the default case appears when using the SELECTIONOBJECT_LIST data:

    
    
    BaseContainer *bc = so->GetDataInstance();  
      GeDataType p = bc->GetType(SELECTIONOBJECT_LIST);   
     
    
    
    
    
      switch(p)  
      {  
       case DA_NIL: GePrint("NULL");  
        break;  
       case DA_LONG: GePrint("long");  
        break;  
       case DA_REAL: GePrint("real");  
        break;  
       case DA_VECTOR: GePrint("vector");  
        break;  
       case DA_MATRIX: GePrint("matrix");  
        break;  
       case DA_BYTEARRAY: GePrint("bytearray");  
        break;  
       case DA_STRING: GePrint("string");  
        break;  
       case DA_FILENAME: GePrint("filename");  
        break;  
       case DA_CONTAINER: GePrint("container");  
        break;  
       case DA_ALIASLINK: GePrint("aliaslink");  
        break;  
       case DA_MARKER: GePrint("marker");  
        break;  
       case DA_MISSINGPLUG: GePrint("missingplug");  
        break;  
       case DA_CUSTOMDATATYPE: GePrint("customdatatype");  
        break;  
       default: GePrint("nothing");  
        break;  
      }

But I guess this is all wrong too. I guess maybe creating an inclusion table and using it to get the objects from the list could work. But I haven´t been useing it yet.
InclusionTable *BuildInclusionTable(BaseDocument *doc, LONG hierarchy_bit = NOTOK);
I would really like to know too how to use it. Hopefully Mikael will clear this out tommorrow.
Best
Samir

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 30/11/2002 at 06:11, xxxxxxxx wrote:

ok all sorted.
I just needed to extract the custom data type from the container
 
cheers

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 30/11/2002 at 06:50, xxxxxxxx wrote:

could you tell me how you did at last?
thx
Samir

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 01/12/2002 at 02:42, xxxxxxxx wrote:

Glad you worked it out. Otherwise this is the way to push a button:

    
    
      BaseObject* obj = doc->GetFirstObject();  
      if (!obj || obj->GetType() != Oselection) return FALSE;
    
    
    
    
      DescriptionCommand dc;  
      dc.id = DescLevel(SELECTIONOBJECT_RESTORE);  
      obj->Message(MSG_DESCRIPTION_COMMAND, &dc);
    
    
    
    
      EventAdd();

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 01/12/2002 at 04:29, xxxxxxxx wrote:

hey , great stuff Mikael 🙂
 
to extract the selection  from the the container i made this little function
it assumes that your sending a valid Oselection type to it.
void DoMultiSelect(BaseObject *oplink)
{
BaseContainer *data=oplink->GetDataInstance();
InExcludeData *list=(InExcludeData* )data->GetCustomDataType(SELECTIONOBJECT_LIST,CUSTOMDATATYPE_INEXCLUDE_LIST);
 LONG list_cnt=list->GetObjectCount();
 BaseObject *listop=NULL;
 if (list_cnt)
 {
  oplink->DelBit(BIT_ACTIVE);
  for (LONG lc=0;lc<list_cnt;lc++)
  {
  listop=(BaseObject* )list->ObjectFromIndex(oplink->GetDocument(),lc);
  listop->SetBit(BIT_ACTIVE);
  }
 }
else oplink->SetBit(BIT_ACTIVE);
EventAdd(EVMSG_BROWSERCHANGE);
}
 
the new customdatatype in basecontainer seems to be the key to lots of interesting things!!!
 
cheers
 
Paul

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 01/12/2002 at 04:36, xxxxxxxx wrote:

Great. Thanks for explaining Paul! And thanks to Mikael for the button thing. 🙂
Best Samir