Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hi folks,
I am to stupid for this I guess
I created an Object Plugin and so the res, header and str files. The plugin works fine so far. But now I want to make some parameters uneditable, when the user switches a LONG with some Quicktabradio buttons, because some parameters have no impact when a specific mode is entered.
I was able to hide the parameters successfully in my nodedata.GedDescription(self, node, id......) function with setBool... But when the plugin is getting started for the first time, it looks odd when some parameters suddenly appear once the user clicked some buttons. It is confusing.
But as I have read in the forum it doesn´t work with the c4d.DESC_EDITABLE Description.
So do I have to use the NodeData.GetDEnabling Method?
so do I have to overload this function in my class with and what do I have to write in this class:
def GetDEnabling(self, node, id, t_data, flags, itemdesc): pass
. so for clarifying?? node = op id = c4d.PY_LED_ANIMATION_DISTANCE t_data = c4d.DESC_EDITABLE
what is itemdesc????**
the itemdesc argument do I get the container with **```
decription.GetParameterI(c4d.PY_LED_ANIMATION_DISTANCE, ar=None)
I do not really understand some things here.
===============================================
ok in the following figure you can see the entry
once the user checks Modus/dynamisch the parameter 2. and 3. should turn to Not-Editable. If he checks Modus/fest and Modus/Buchstaben Ticker it should be editable
Best Regards Tom
Hello @thomasb,
thank you for reaching out to us. I assume when you say that you want to make a parameter 'uneditable', you mean that you want it to be disabled, greyed out as the X.Max parameter is in the screen below. It is not possible to make an element uneditable, read only, without changing its appearance in this manner (there are some exceptions as edit fields which can be made read only without being greyed out, but this is then handled on a per gadget-basis flag level and usually not something you always can or should mess around with in descriptions).
X.Max
To take the grey-out route, you indeed must use NodeData.GetDEnabling. This is, however, not a function you must call, but one you must overwrite. Cinema 4D will call the method for each parameter in a node each time its description is evaluated. You can then return True to keep the parameter enabled, and False to disable it. If this is not what you want, the other common approach is to hide elements, typically whole groups, by setting c4d.DESC_HIDE to True on that element. To do that, you must overwrite NodeData.GetDDescription and the whole endeavor is considerably more complicated than en- or disabling elements.
True
False
c4d.DESC_HIDE
NodeData.GetDDescription
So, when you have this description resource:
// The description defintion of the tag Tmmover. CONTAINER Tmmover { NAME Tmmover; INCLUDE Texpression; // The main "Tag" tab of the tag. GROUP ID_TAGPROPERTIES { // The tag can either bake an animation into a track or do what tags are actually meant to do, // drive the animation procedurally. LONG ID_MMOVER_MODE { CYCLE { ID_MMOVER_MODE_PROCEDURAL; ID_MMOVER_MODE_TRACK; } } // A subcontainer to place parameters in a two column layout. GROUP { COLUMNS 2; // The minimum and maxium time for the animation. BASETIME ID_MMOVER_ANIMATION_MIN { ANIM OFF; MIN 0; } BASETIME ID_MMOVER_ANIMATION_MAX { ANIM OFF; MIN 0; } // The minimum and maximum offset of an x-axis offset animation of the host object. REAL ID_MMOVER_AXIS_X_MIN { UNIT METER; STEP 0.1; } REAL ID_MMOVER_AXIS_X_MAX { UNIT METER; STEP 0.1; } } } }
And then implement GetDEnabling for the tag like this:
GetDEnabling
def GetDEnabling(self, node: c4d.GeListNode, did: c4d.DescID, t_data: object, flags: int, itemdesc: c4d.BaseContainer) -> bool: """Called by Cinema 4D to enable or disable the parameter with the ID #did. """ # When the polled parameter is the maximum x-value parameter and the mode drop-down is # set to track, disable the parameter. if (did[0].id == c4d.ID_MMOVER_AXIS_X_MAX and node[c4d.ID_MMOVER_MODE] == c4d.ID_MMOVER_MODE_TRACK): return False # All other parameters and cases should be enabled. return True
The tag will behave as follows in the Attribute Manager:
There are also multiple GetDEnabling examples to be found on our GitHub, both for Python and C++.
Cheers, Ferdinand
@ferdinand As always thank you very much Ferdinand, it works as expected