Layoutgroup have no effect on dynamic description
-
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 -
On 18/11/2016 at 02:28, xxxxxxxx wrote:
Hello,
it looks like a layout group itself does not contain content and only exist to layout the groups. So the actual parameters are organized in sub-groups. You can see this in various *.res files that use the LAYOUTGROUP element.
// parent group { const DescID groupID = DescLevel(10000, DTYPE_GROUP, 0); BaseContainer settings = GetCustomDataTypeDefault(DTYPE_GROUP); settings.SetString(DESC_NAME, "Parent Group"); settings.SetInt32(DESC_DEFAULT, 1); // group is unfolded by default desc->SetParameter(groupID, settings, 0); } // layout group { const DescID groupID = DescLevel(10100, DTYPE_GROUP, 0); BaseContainer settings = GetCustomDataTypeDefault(DTYPE_GROUP); settings.SetInt32(DESC_COLUMNS, 2); // group has two columns settings.SetInt32(DESC_LAYOUTGROUP, true); desc->SetParameter(groupID, settings, 10000); } // left sub-group { const DescID groupID = DescLevel(10200, DTYPE_GROUP, 0); BaseContainer settings = GetCustomDataTypeDefault(DTYPE_GROUP); desc->SetParameter(groupID, settings, 10100); } // left sub-group content { const DescID cid = DescID(DescLevel(10201, DTYPE_STRING, 0)); BaseContainer settings = GetCustomDataTypeDefault(DTYPE_STRING); settings.SetString(DESC_NAME, "Parameter A"); desc->SetParameter(cid, settings, 10200); } // right sub-group { const DescID groupID = DescLevel(10300, DTYPE_GROUP, 0); BaseContainer settings = GetCustomDataTypeDefault(DTYPE_GROUP); desc->SetParameter(groupID, settings, 10100); } // right sub-group content { const DescID cid = DescID(DescLevel(10301, DTYPE_STRING, 0)); BaseContainer settings = GetCustomDataTypeDefault(DTYPE_STRING); settings.SetString(DESC_NAME, "Parameter B"); desc->SetParameter(cid, settings, 10300); }
best wishes,
Sebastian -
On 18/11/2016 at 04:53, xxxxxxxx wrote:
Hi Sebastian,
you've saved my day. Finally it works like expected.
I don't know how I could miss that fact.
In my own .res file I use this too. But by unknown reason I overlooked the subgroups when I compared the static description with the dynamic description.Thank you very much for your help.
Best wishes,
Sven