XPresso: enable/disable user data
-
Hi all
Is it possible to deactivate user data or a tab from xpresso?
-
Hi,
@Passion3D said in XPresso: enable/disable user data:
Is it possible to deactivate user data or a tab from xpresso?
- Using a Xpresso Python node, you can do anything a Python script could do.
- Modifying the GUI of a node means modifying its description in Cinema. You should take a look at Descriptions. Note that Cinema will not evaluate all description fields for all node attribute types and also will ignore/overwrite some fields in the case of user data descriptions. Depending on what you do mean by "deactivate", the description fields
DESC_HIDE
andDESC_EDITABLE
might be what you are looking for. - But you cannot modify the description of a node in a scripting environment, which rules out deactivating "a tab", but you can modify the user data description with
BaseList2D.GetUserDataContainer
and.SetUserDataContainer
.
Cheers,
zipit -
Here's the test I took. By putting my script in a python tag on my object, it works. But in an xpresso python node, nothing happens.
Test.c4dIf you delete the tag, keeping only the xpresso node, it doesn't work.
-
hi,
you almost have everything. You could simply create some port to ease your life. Here, I've added an input port for the object, a bool and an integer. Output port is replaced by a bool.
you can use GetDepth to be sure you can access a subdescid or your code could stop working.
You don't need the two "If" you can simply pass the value of the flag. (or in this case the inverse)
I'm not using the ouput port here. But you should.import c4d def main(): global Output1 Output1 = True h1 = obj.GetUserDataContainer() for descID, container in h1: if descID.GetDepth() < 2: continue if descID[1].id == UserDataID: container[c4d.DESC_HIDE] = not Flag obj.SetUserDataContainer(descID,container)
Cheers,
Manuel -
Work fine
Thanks a lot Manuel