Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Admin
    • Login

    UserData Unique Parameter Group

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 433 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

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

            Thanks Yannick.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post