THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/06/2011 at 22:57, xxxxxxxx wrote:
Hey Niklas! Sure thing brosky...
Basically, you have to first get the user data container of your object. for example...
#----------------------------------------
UD = op.GetUserDataContainer()
#----------------------------------------
then you need to run a for..in statement on the user data container in order to find the user data you want to affect.
#----------------------------------------
for descId, container in UD:
#----------------------------------------
then you must specify what user data entry you are trying to access(by ID)...
#----------------------------------------
if descId[1].id == 8:
#----------------------------------------
then you need to specify what event is going to turn the user data entry's visibility on/off. In this case i have a user data entry(an integer cycle menu), called colType, and i am testing to see what number it is set to...
#-----------------------------------------
if coltype==1:
#-----------------------------------------
then you need to get the container entry that you want to set. In this case, the ID 15 in order to set the visibility. and we need to run the SetUserDataContainer(descId, container), and finally update the viewport!
#-----------------------------------------
container[15] = False
op.SetUserDataContainer(descId, container)
c4d.EventAdd()
#-----------------------------------------
so the whole so far code looks something like this...
#-----------------------------------------
UD = op.GetUserDataContainer()
for descId, container in UD:
if descId[1].id == 8:
if coltype==1:
container[15] = False
op.SetUserDataContainer(descId, container)
c4d.EventAdd()
#-----------------------------------------
finally, if you want the data entry to be off otherwise, make sure to run a else: statement and just reverse the container[15]'s value to True and the data entry will dissapear unless the first if statment is reached.
so everything altogether
#-----------------------------------------
UD = op.GetUserDataContainer()
for descId, container in UD:
if descId[1].id == 8:
if coltype==1:
container[15] = False
op.SetUserDataContainer(descId, container)
c4d.EventAdd()
else:
container[15] = True
op.SetUserDataContainer(descId, container)
c4d.EventAdd()
#-----------------------------------------
hope that helps! let me know if it still just don't make sense.
Edited: messed up some of the explanation.