hello,
You can set the default value you want in your Init function.
In any case, the Cycle will show the value corresponding to the value of the parameter.
#define MY_CYCLE_ID 1000
class DefaultCycleValue : public ObjectData
{
INSTANCEOF(DefaultCycleValue, ObjectData)
public:
virtual Bool Init(GeListNode *node)
{
// set the parameter the value we want, the Custom GUI will show the corresponding line in the box.
node->SetParameter(DescID(MY_CYCLE_ID), GeData(1), DESCFLAGS_SET::NONE);
return true;
};
virtual Bool GetDDescription(GeListNode* node, Description* description, DESCFLAGS_DESC& flags) override
{
if (!description->LoadDescription(node->GetType()))
return false;
const DescID* singleid = description->GetSingleDescID();
const DescID cid = DescLevel(MY_CYCLE_ID, DTYPE_LONG, 0);
if (!singleid || cid.IsPartOf(*singleid, nullptr))
{
// add the parameter as long
BaseContainer bc = GetCustomDataTypeDefault(DTYPE_LONG);
// set the custom GUI to a cycle.
bc.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_CYCLE);
bc.SetString(DESC_NAME, "Long Cycle"_s);
bc.SetInt32(DESC_SCALEH, 1);
// cycle elements
BaseContainer items;
items.SetString(0, String("Item 0"));
items.SetString(1, String("Item 1"));
items.SetString(2, String("Item 2"));
bc.SetContainer(DESC_CYCLE, items);
// icons
BaseContainer icons;
icons.SetInt32(0, IDM_COPY);
icons.SetInt32(1, IDM_CUT);
icons.SetInt32(2, IDM_DELETE);
bc.SetContainer(DESC_CYCLEICONS, icons);
description->SetParameter(cid, bc, ID_OBJECTPROPERTIES);
}
flags |= DESCFLAGS_DESC::LOADED;
return SUPER::GetDDescription(node, description, flags);
};
static NodeData *Alloc() { return NewObjClear(DefaultCycleValue); }
};
Cheers
Manuel