Hide or Show Userdata via Python Script
This post has already been read 2154 times!
Today’s quick tip is hiding or showing specific userdata according to selections via Python Script in Cinema 4D…
For example we want to hide some of our user data fields according to previous let’s say checkbox is inactive. In this case unfortunately C.O.F.F.E.E. does not help us. It has some limitations as Maxon says. So I have checked Python to do that and found one script...Let’s take a look at script…
from c4d import gui
obj = doc.SearchObject("Controls") #"Controls" Our object's name which contains user data.
UD = obj.GetUserDataContainer()
for descId, container in UD:
if descId.id == 3: # ID Number of userdata which we want to hide
if obj[c4d.ID_USERDATA,2] == 0:
container[c4d.DESC_HIDE] = True # If Userdata with ID 2 is not enabled Hide my userdata with ID 3.
if obj[c4d.ID_USERDATA,2] == 1:
container[c4d.DESC_HIDE] = False If Userdata with ID 2 is enabled Show my userdata with ID 3.