fill quicktab in userdata

On 06/05/2015 at 09:38, xxxxxxxx wrote:

Hello there,

I am trying to modify existing quicktab radio buttons in userdata with Python.
Example: There is a varying number of objects in a parent. The number of tabs in the quicktab should correspond to the number of children and the captions should at least show their index/number of the child .

I 'm familiar with the basics of getting and setting userdata, appending items to lists, etc. Have been trying hard to do this for quite a while and any hint is greatly appreciated.


On 07/05/2015 at 00:12, xxxxxxxx wrote:


To fill the cycle options for the quick tab user data you need to retrieve its description container and change DESC_CYCLE entry. It is a container with the entry integer value and string caption:

data = op.GetUserDataContainer()
# Get user data description id and data container
descid = data[0][0]
bc = data[0][1]
# Build new cycle options container
cycle = c4d.BaseContainer()
cycle[0] = "Tab 1"
cycle[1] = "Tab 2"
cycle[2] = "Tab 3"
cycle[3] = "Tab 4"
cycle[4] = "Tab 5"
bc[c4d.DESC_CYCLE] = cycle
# Set modified description data container
op.SetUserDataContainer(descid, bc)
# Notify Cinema 4D for changes

On 07/05/2015 at 03:16, xxxxxxxx wrote:

Thank you Yannick!!!

I am having a hard time understanding that description id stuff. It's about items in the baselist containers, I know. Just can't REALLY figure it out from the SDK, so far. Can you give me a hint, where I find a comprehensive explanation?

Anyway - your help is much appreciated and I will keep learning.

Cheers, Wolf

On 07/05/2015 at 07:23, xxxxxxxx wrote:

Quicktab dynamically filled:

Got it to work and thought, I share...
I call this as a user script and not inside a Python tag since the number of children does not change often during projects. I'll eventually use a button and the message() function in the userdata but that seems to be too much of a distraction here.

Thanks again for the input.


import c4d
from c4d import gui
def setQuickTab(obj, data) :
    descid = data[0][0]
    bc = data[0][1]
    # Build new cycle options container static
    #cycle = c4d.BaseContainer()
    #cycle[0] = "Tab 1"
    #cycle[1] = "Tab 2"
    #cycle[2] = "Tab 3"
    #cycle[3] = "Tab 4"
    #cycle[4] = "Tab 5"
    # Get the number of child objects
    parent = doc.SearchObject("UD container") # could be any different object
    count = len(parent.GetChildren())
    print "count: ", count
    # Build new cycle options container dynamically
    cycle = c4d.BaseContainer()
    for i in range (0,count) :
        caption = "child " + str(i+1)
        cycle.SetData(i, caption)
    bc[c4d.DESC_CYCLE] = cycle
    # Set modified description data container
    obj.SetUserDataContainer(descid, bc)
    # Notify Cinema 4D for changes
def main() :
    obj = doc.SearchObject("UD container")
    data = obj.GetUserDataContainer()
    setQuickTab(obj, data)
if __name__=='__main__':

On 07/05/2015 at 07:42, xxxxxxxx wrote:

Thanks for sharing your final working script.

A parameter description or user data description container for objects holds all the information for the display of these parameters in the Attribute Manager. The IDs of the entries in this description container are defined in DESC values.

Python currently only supports the modification of user data description with BaseList2D.GetUserDataContainer()/BaseList2D.SetUserDataContainer().
And it returns a read-only Description object for a base list allowing to browse through all of its parameters.