On 27/02/2013 at 13:14, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) : C++ ;
---------
Hi,
I'm adding and deleting UserData items in my plugin. But the way the ID#s stay local to each UD item. That is throwing everything out of sync when I delete them.
In order to keep everything in sync in my plugin. I need to force the UserData items ID#s to always be in numerical order as they exist in the stack.
How do we change the DescLevel() values of UserData items?
BaseObject *obj = doc->GetActiveObject();
DynamicDescription *ud = obj->GetDynamicDescription();
DescID udEntry(DescLevel(ID_USERDATA, DTYPE_SUBCONTAINER, 0), DescLevel(3)); //<----I want to change this value from 3 to 2
Also.
What's the deal with GetDepth()?
Instead of returning the stack position of each UD item. It gets stuck at 2. :angry:
DescID dscID;
const BaseContainer *bc;
void *dscHnd = ud->BrowseInit(); //Initialize the Browse function
counter = 1;
while(ud->BrowseGetNext(dscHnd, &dscID, &bc)) //Loop through the UserData entries
{
DescID udEntry(DescLevel(ID_USERDATA, DTYPE_SUBCONTAINER, 0), DescLevel(counter));
LONG level = udEntry.GetDepth();
GePrint(LongToString(level)); <---- Prints 1, 2, 2, 2, 2, etc...
counter ++;
}
ud->BrowseFree(dscHnd);
ScottA