On 06/05/2015 at 19:39, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 15+
Platform: Windows ;
Language(s) : C++ ;
---------
this problem "can be solved" , but I don't know how
I have a MaterialData plugin, most of its description are dynamic "using GetDDescription"
it is a node based Material "CustomDataType" , with its GeUserArea.
each node "from my custom nodes" , got its own attributes, stored inside its class, like data type, data name, data value, connections , ....
when the user selects a node, I mark this node.
in GetDDescription() , I get the marked node, loop over its data, check their type, add the Descriptions dynamically.
when I modify any value from the node, it is stored in the class, restored also using Set/GetDParameter()
so far so good, dynamic descriptions, values are fine, and here comes a nightmare problem!!
if I animate any description "for example in node 1" , it also animates the same description in all other nodes "the index of the description"
note: kndData is a CustomDataType subclass
here is the stripped portion of GetDDescription:
for(Int32 i = 0; i < kndData->nodes[kndData->selectedNode].getInputCount(); ++i)
{
++ids;
//wire connected
if(kndData->nodes[kndData->selectedNode].getInputWireId(i) >= 0)
continue;
Int32 idt = kndData->nodes[kndData->selectedNode].getInputDataType(i);
switch(idt)
{
case NODE_BOOL:
cid = DescLevel(ids, DTYPE_BOOL, 0);
if (!singleid || cid.IsPartOf(*singleid, nullptr))// important to check for speedup c4d!
{
BaseContainer dt = GetCustomDataTypeDefault(DTYPE_BOOL);
std::string dName = kndData->nodes[kndData->selectedNode].getInputDataName(i);
String dtName(dName.c_str());
dt.SetString(DESC_SHORT_NAME, dtName);
dt.SetString(DESC_NAME, dtName);
dt.SetBool(DESC_ANIMATE, DESC_ANIMATE_ON);
if (!description->SetParameter(cid, dt, DescLevel(Tbaselist2d)))
return true;
}
break;
case NODE_FLOAT:
cid = DescLevel(ids, DTYPE_REAL, 0);
if (!singleid || cid.IsPartOf(*singleid, nullptr))// important to check for speedup c4d!
{
BaseContainer dt = GetCustomDataTypeDefault(DTYPE_REAL);
std::string dName = kndData->nodes[kndData->selectedNode].getInputDataName(i);
String dtName(dName.c_str());
dt.SetString(DESC_SHORT_NAME, dtName);
dt.SetString(DESC_NAME, dtName);
dt.SetBool(DESC_ANIMATE, DESC_ANIMATE_ON);
if (!description->SetParameter(cid, dt, DescLevel(Tbaselist2d)))
return true;
}
break;
case NODE_INT:
cid = DescLevel(ids, DTYPE_LONG, 0);
if (!singleid || cid.IsPartOf(*singleid, nullptr))// important to check for speedup c4d!
{
BaseContainer dt = GetCustomDataTypeDefault(DTYPE_LONG);
std::string dName = kndData->nodes[kndData->selectedNode].getInputDataName(i);
String dtName(dName.c_str());
dt.SetString(DESC_SHORT_NAME, dtName);
dt.SetString(DESC_NAME, dtName);
dt.SetBool(DESC_ANIMATE, DESC_ANIMATE_ON);
if (!description->SetParameter(cid, dt, DescLevel(Tbaselist2d)))
return true;
}
break;
case NODE_COLOR:
cid = DescLevel(ids, DTYPE_COLOR, 0);
if (!singleid || cid.IsPartOf(*singleid, nullptr))// important to check for speedup c4d!
{
BaseContainer dt = GetCustomDataTypeDefault(DTYPE_COLOR);
std::string dName = kndData->nodes[kndData->selectedNode].getInputDataName(i);
String dtName(dName.c_str());
dt.SetString(DESC_SHORT_NAME, dtName);
dt.SetString(DESC_NAME, dtName);
dt.SetBool(DESC_ANIMATE, DESC_ANIMATE_ON);
dt.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_COLOR);
if (!description->SetParameter(cid, dt, DescLevel(Tbaselist2d)))
return true;
}
break;
case NODE_VECTOR:
case NODE_POINT:
case NODE_NORMAL:
cid = DescLevel(ids, DTYPE_VECTOR, 0);
if (!singleid || cid.IsPartOf(*singleid, nullptr))// important to check for speedup c4d!
{
BaseContainer dt = GetCustomDataTypeDefault(DTYPE_VECTOR);
std::string dName = kndData->nodes[kndData->selectedNode].getInputDataName(i);
String dtName(dName.c_str());
dt.SetString(DESC_SHORT_NAME, dtName);
dt.SetString(DESC_NAME, dtName);
dt.SetBool(DESC_ANIMATE, DESC_ANIMATE_ON);
dt.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_VECTOR);
if (!description->SetParameter(cid, dt, DescLevel(Tbaselist2d)))
return true;
}
break;
case NODE_CLOSURE:
case NODE_VOLUME:
continue;
break;
case NODE_STRING:
cid = DescLevel(ids, DTYPE_STRING, 0);
if (!singleid || cid.IsPartOf(*singleid, nullptr))// important to check for speedup c4d!
{
BaseContainer dt = GetCustomDataTypeDefault(DTYPE_STRING);
std::string dName = kndData->nodes[kndData->selectedNode].getInputDataName(i);
String dtName(dName.c_str());
dt.SetString(DESC_SHORT_NAME, dtName);
dt.SetString(DESC_NAME, dtName);
dt.SetBool(DESC_ANIMATE, DESC_ANIMATE_ON);
dt.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_STRING);
if (!description->SetParameter(cid, dt, DescLevel(Tbaselist2d)))
return true;
}
break;
default:
break;
}
}