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?
DESC_HIDE
and DESC_EDITABLE
might be what you are looking for.BaseList2D.GetUserDataContainer
and .SetUserDataContainer
.Cheers,
zipit
MAXON SDK Specialist
developers.maxon.net
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.c4d
If 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
MAXON SDK Specialist