On 05/08/2015 at 17:59, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 15+
Platform:
Language(s) : C++ ;
---------
I want to get all descriptions of any node, hidden or not, my current code works to some extent, but it misses some descriptions!!
here is the code:
Bool checkContainers(BaseObject *op)
{
AutoAlloc<Description> desc;
if(!desc) return FALSE;
if(!op->GetDescription(desc, DESCFLAGS_DESC_0)) return FALSE;
void *bh = NULL;
bh = desc->BrowseInit();
if(!bh) return FALSE;
const BaseContainer *bc = NULL;
DescID id, groupid;
GeData data;
while(desc->GetNext(bh, &bc, id, groupid))
{
const BaseContainer *dbc = desc->GetParameterI(id,NULL);
if(dbc) GePrint("Name: "+dbc->GetString(DESC_NAME));
if(op->GetParameter(id, data, DESCFLAGS_GET_0))
{
//data is the description data
GePrint("Type: "+String::IntToString(data.GetType()));
}
}
desc->BrowseFree(bh);
return TRUE;
}
Bool checkDynamicContainers(BaseObject *op)
{
DynamicDescription *userdata = NULL;
userdata = op->GetDynamicDescription();
if (userdata)
{
GePrint("DynamicDescription: " + op->GetName());
void *handle = NULL;
handle = userdata->BrowseInit();
LONG cnt = 0;
DescID descid;
GeData data;
const BaseContainer *dbc = NULL;
while (userdata->BrowseGetNext(handle, &descid, &dbc))
{
GePrint("Name: "+dbc->GetString(DESC_NAME));
if(op->GetParameter(descid, data, DESCFLAGS_GET_0))
{
//data is the description data
GePrint("Type: "+String::IntToString(data.GetType()));
}
}
userdata->BrowseFree(handle);
//userdata found
if (cnt > 0) return 1.0;
}
return TRUE;
}
so far when I use this with RayObject->link->""GetUp()/GetCacheParent()"", it works fine to some extent, it gives me all containers that I see in AM.
what I miss here, getting hidden stuff, for example:
BaseObject * cacheParent = rayObject->link->GetCacheParent();
if(cacheParent)
{
BaseContainer * bc = cacheParent->GetDataInstance();
const Int32 index = bc->GetInt32(BC_ID_MODATAINDEX,NOTOK);
if(index != NOTOK)
{
GePrint("index: "+String::IntToString(index));
}
}
this code works if the generated RayObject is from a mograph clone, but here I access the container directly from BC_ID_MODATAINDEX, how to get this container using BrowseInit().... "or any other automated way to get all of these hidden stuff"