Hi everyone,
Trying to create a functionality, when parameter's unit would be changed based on selected mode - either real unit, either percentage.
I'm pretty sure it has to be handled within the GetDDescription method, but I can't find related example or doc.
Here's what I need, I have integer parameter TESTPLUGIN_MODE, which might be one of the TESTPLUGIN_DISTANCE or TESTPLUGIN_PERCENTAGE values.
And I have float offset parameter TESTPLUGIN_OFFSET
So if TESTPLUGIN_MODE equals to TESTPLUGIN_DISTANCE, then TESTPLUGIN_OFFSET unit should be METER
else unit should be PERCENT;
Below is my res file "testplugin.res":
CONTAINER Otestplugin {
NAME Otestplugin;
INCLUDE Obase;
GROUP ID_OBJECTPROPERTIES {
DEFAULT 1;
GROUP {
LONG TESTPLUGIN_MODE {
CYCLE {
TESTPLUGIN_DISTANCE;
TESTPLUGIN_PERCENTAGE;
};
DEFAULT TESTPLUGIN_DISTANCE;
}
REAL TESTPLUGIN_OFFSET {
CUSTOMGUI LONGSLIDER;
MINSLIDER -1000; MAXSLIDER 1000;
DEFAULT 0;
}
}
}
}
And Otestplugin.pyp part (actually nothing):
def GetDDescription(self, node, description, flags):
if not description.LoadDescription(node.GetType()): return False
data = node.GetDataInstance()
return (True, flags | c4d.DESCFLAGS_DESC_LOADED)