On 17/11/2016 at 04:37, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 16.051
Platform: Windows ;
Language(s) : C++ ;
---------
Hi there,
I'm actually working on my first object plugin, which uses some static GUI elements (defined in the description resources) and additional dynamic elements, created by the user on the fly through button interaction.
Both parts of the description are located in the same parent group and are using layoutgroups.
In the static part of the description everything works like expected. But in the dynamic part (realized in GetDDescription) the DESC_LAYOUTGROUP don't take effect. Instead this group is shown in the common manner.
Here the appropiate part of the script:
Bool Rt::GetDDescription(GeListNode* node, Description* description, DESCFLAGS_DESC& flags)
{
if (!node || !description)
return false;
if(!description->LoadDescription(node->GetType()))
return false;
// important to check for speedup c4d!
const DescID* updatedDesc = description->GetSingleDescID();
Int32 index = 12000; //set for testing purpose
BaseContainer bc_baseLink;
BaseContainer bc_optionInterface;
BaseContainer bc_optionSet1;
BaseContainer bc_optionSet2;
Bool initbc = false;
while(true)
{
for(Int32 i=0; i<additionalObject.size(); i++) //variable is set in extern function
{
DescID baseLink_object = DescLevel(index++, DTYPE_BASELISTLINK, 0);
DescID group_optionInterface = DescLevel(index++, DTYPE_GROUP, 0);
DescID long_optionSet1 = DescLevel(index++, DTYPE_LONG, 0);
DescID long_optionSet2 = DescLevel(index++, DTYPE_LONG, 0);
if (updatedDesc && !baseLink_object.IsPartOf(*updatedDesc, nullptr)) // important to check for speedup c4d!
{
break;
}
if (updatedDesc && !group_optionInterface.IsPartOf(*updatedDesc, nullptr)) // important to check for speedup c4d!
{
break;
}
if (updatedDesc && !long_optionSet1.IsPartOf(*updatedDesc, nullptr)) // important to check for speedup c4d!
{
break;
}
if (updatedDesc && !long_optionSet2.IsPartOf(*updatedDesc, nullptr)) // important to check for speedup c4d!
{
break;
}
if (!initbc)
{
//set Properties
initbc = true;
//set linkField properties
bc_baseLink = GetCustomDataTypeDefault(DTYPE_BASELISTLINK);
bc_baseLink.SetString(DESC_NAME, "Object");
bc_baseLink.SetString(DESC_SHORT_NAME, "Object");
//set group properties
bc_optionInterface = GetCustomDataTypeDefault(DTYPE_GROUP);
bc_optionInterface.SetBool(DESC_LAYOUTGROUP, TRUE);
//bc_optionInterface.SetInt32(DESC_DEFAULT, 1);
bc_optionInterface.SetInt32(DESC_COLUMNS, 2);
bc_optionInterface.SetString(DESC_NAME, "Options");
//set cycleButton properties
bc_optionSet1 = GetCustomDataTypeDefault(DTYPE_LONG);
bc_optionSet1.SetBool(DESC_ANIMATE, DESC_ANIMATE_OFF);
bc_optionSet1.SetString(DESC_NAME, "Lage");
bc_optionSet1.SetString(DESC_SHORT_NAME, "Lage der Tangente");
bc_optionSet1.SetBool(DESC_SCALEH, FALSE);
//bc_optionSet1.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_SUBDESCRIPTION);
//set BaseContainer for cycleButton entries
BaseContainer bco1_entries;
bco1_entries.SetString(0,"A");
bco1_entries.SetString(1,"B");
//set cycleButton entries
bc_optionSet1.SetContainer(DESC_CYCLE, bco1_entries);
//Create Cycle Button
bc_optionSet2 = GetCustomDataTypeDefault(DTYPE_LONG);
bc_optionSet2.SetBool(DESC_ANIMATE, DESC_ANIMATE_OFF);
bc_optionSet2.SetString(DESC_NAME, "Auswahl");
bc_optionSet2.SetString(DESC_SHORT_NAME, "Tangentenauswahl");
bc_optionSet2.SetBool(DESC_SCALEH, FALSE);
//bc_optionSet2.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_SUBDESCRIPTION);
//Create BaseContainer for Cycle-Button entries
BaseContainer bco2_entries;
bco2_entries.SetString(0,"1");
bco2_entries.SetString(1,"2");
//Set Cycle Button entries
bc_optionSet2.SetContainer(DESC_CYCLE, bco2_entries);
}
//create Description-Entries
//add link
description->SetParameter(baseLink_object, bc_baseLink, DescLevel(UPPER_GROUP));
//add group
description->SetParameter(group_optionInterface, bc_optionInterface, DescLevel(UPPER_GROUP));
//add cycles to option group
description->SetParameter(long_optionSet1, bc_optionSet1, group_optionInterface);
description->SetParameter(long_optionSet2, bc_optionSet2, group_optionInterface);
}
break;
}
flags |= DESCFLAGS_DESC_LOADED;
return SUPER::GetDDescription(node, description, flags);
}
In other threads I've found the information, that DESC_CUSTOMGUI must be set with the flag CUSTOMGUI_SUBDESCRIPTION. But by setting this for the children, they disappear completely.
And even using DESC_DEFAULT for the group (so it's open/shown by default) is causing the children to disappear.
Any suggestions or hints would be welcome.
Cheers,
Sven