UserData Unique Parameter Group

  • On 05/05/2016 at 12:05, xxxxxxxx wrote:

    Hello Forum,

    I would like to create User Data with a custom Parameter Group that looks like this:

    Attributes Manager

    I can do it using Manage User Data:

    Manage User Data

    But I would like to do it with Python.

    This code:

    group_bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_GROUP)
    group_bc[c4d.DESC_NAME] = "My Data"
    groupID = op.AddUserData(group_bc)
    id_bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_LONG)
    id_bc[c4d.DESC_NAME] = "ID"
    id_bc[c4d.DESC_ANIMATE] = c4d.DESC_ANIMATE_OFF
    id_bc[c4d.DESC_PARENTGROUP] = groupID
    id_udid = op.AddUserData(id_bc)
    op[id_udid] = 2048

    Produces this:

    User Data Default

    How do I create a unique/custom Parameter Group with Python?

    Thank you,

    Joe Buck

  • On 05/05/2016 at 13:41, xxxxxxxx wrote:

    I might have figured it out but I would like to check with Support to see if my solution is ok...

    # create the group
    group_bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_GROUP)
    group_bc[c4d.DESC_NAME] = "Unique UserData Group"
    group_bc[c4d.DESC_SHORT_NAME] = "Unique UserData Group"
    group_bc[c4d.DESC_VERSION] = 3
    group_bc[c4d.DESC_ANIMATE] = 0
    group_bc[c4d.DESC_COLUMNS] = 1
    group_bc[c4d.DESC_TITLEBAR] = True
    group_bc[c4d.DESC_DEFAULT] = 1
    # pass empty DescID
    group_bc[c4d.DESC_PARENTGROUP] = c4d.DescID()
    groupID = op.AddUserData(group_bc)
    # create integer parameter
    int_bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_LONG)
    int_bc[c4d.DESC_NAME] = "Some Integer"
    int_bc[c4d.DESC_ANIMATE] = c4d.DESC_ANIMATE_OFF
    int_bc[c4d.DESC_PARENTGROUP] = groupID
    int_udid = op.AddUserData(int_bc)
    op[int_udid] = 2048

    I passed an empty DescID to DESC_PARENTGROUP in the group BaseContainer.  This seems like a hack that could cause other problems.  Is my soloution ok?

    Thank you,

    Joe Buck

  • On 06/05/2016 at 01:39, xxxxxxxx wrote:

    Hi Joe,

    Your solution is fine. Setting an empty DescID for DESC_PARENTGROUP adds the User Data group at top level i.e as a tab group.

  • On 06/05/2016 at 11:40, xxxxxxxx wrote:

    Thanks Yannick.

Log in to reply