Hi, everyone,
I can't get to make .SetContainer work.
I'm doing this through a python tag, file attached.
I looked everywhere, and I've seen the code on a few websites, I don't understand why it's not working.
Is there a change I've missed?
custom-gui.c4d
My goal is to make the element selected so that I can use this component to make a sort of quick selector between objects.
import c4d
from c4d import gui
from c4d import documents
def MkUD(Object):
children = Object.GetChildren()
count = len(children)
bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_LONG)
bc.SetString(c4d.DESC_NAME, 'Objects')
bc.SetInt32(c4d.DESC_CUSTOMGUI, c4d.CUSTOMGUI_CYCLE)
cycle = c4d.BaseContainer()
cycle.SetString(0, 'si')
cycle.SetString(1, 'sai')
print (cycle)
bc.SetContainer(c4d.DESC_CYCLE, cycle) # I can see the UD when I comment this line
Object.SetUserDataContainer([c4d.ID_USERDATA, 1], bc) # but nothing inside...
def main():
obj = doc.SearchObject("Null")
MkUD(obj)
c4d.EventAdd()
I get:
<c4d.BaseContainer object at 0x000001DF3FF609C0>
Traceback (most recent call last):
File "Python", line 20, in main
File "Python", line 15, in MkUD
TypeError: an integer is required (got type set)
>>>
I'm on R25
Thanks for your help, so frustrating.