On 05/12/2014 at 22:01, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 16
Platform: Windows ;
Language(s) : C++ ;
---------
Hi guys,
I'm trying to do this behavior for my object plugin's object creation:
1. Select input objects in the Object Manager.
2. Create new object (OBJ).
3. place input objects in OBJ's InExcludeList (INEX).
Bool OBJ::Init(GeListNode *node){
BaseContainer *bc = ((BaseObject* )node)->GetDataInstance();
BaseDocument *doc = GetActiveDocument();
if(!doc){
return TRUE;
}
AutoAlloc<AtomArray> selection;
if(!selection){
return TRUE;
}
doc->GetActiveObjects(*selection, GETACTIVEOBJECTFLAGS_SELECTIONORDER);
if(selection->GetCount()){
Int64 i, k;
k = selection->GetCount();
InExcludeData *inex;
inex = (InExcludeData* )bc->GetCustomDataType(INEX, CUSTOMDATATYPE_INEXCLUDE_LIST);
for(i = 0; i < k; i++){
inex->InsertObject((BaseList2D* )selection->GetIndex(i), 0);
}
}
return TRUE;
}
The problem I'm having is that during the Init() call of OBJ, using (InExcludeData* )data->GetCustomDataType(INEX, CUSTOMDATATYPE_INEXCLUDE_LIST) returns nullptr.
Is there a way to do this inside an object plugin's Init, or is my only option to create a command plugin that creates OBJ and populates INEX after?