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
    • Login

    UserData issues

    Scheduled Pinned Locked Moved PYTHON Development
    16 Posts 0 Posters 1.3k 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 07/05/2014 at 13:17, xxxxxxxx wrote:

      I will, Scott. Thank you for giving me that information.

      So, it is not possible to change the name of the UserData tab.
      And is that also true about being possible to group userdata gizmos in multi-colums?

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

        On 07/05/2014 at 14:24, xxxxxxxx wrote:

        1.) AFAIK there's no way to change the name of the UserData tab.
        2.) AFAIK there's no way to have multiple columns

        The columns you see in certain UD gizmos like the Latitude/Longitude option are laid out in the gizmo's CustomDataType code. And not by the UD manager.

        The UD manager itself is fairly weak. Which is baffling to me. Because UserData is one of the most heavily used features in C4D.
        I was stunned that I had to write my own UD sort function for them.
        We get a lot more control using descriptions in .res files for laying out our gizmos. But descriptions have problems too. Like not being able to delete them, and not being supported in Python.
        So either way you turn. You will hit a wall.

        -ScottA

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

          On 07/05/2014 at 14:32, xxxxxxxx wrote:

          It is so strange that we have attributes like DESC_COLUMNS but we can't use it for anything.
          Also, we have DTYPE_GROUP but we can't set any groups.

          I love using .res files but I can't change their content dynamically. For example, I can create a LONG field set to CYCLE go create a dropdown list. But I have to set the content of the CYCLE inside the .res file and I can't change it using code.
          This is quite limiting 😞

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

            On 07/05/2014 at 15:37, xxxxxxxx wrote:

            We can make UD groups.
            That one is possible.

            Example:

            #This example adds a UD group that has a child group of it's own  
              
            import c4d  
            def main() :  
              
              obj = doc.GetActiveObject()   
              if not obj: return False  
                
              #The top most parent group  
              rootGroup = c4d.GetCustomDatatypeDefault(c4d.DTYPE_GROUP)  
              rootGroup[c4d.DESC_NAME] = "Root"  
              rootGroup[c4d.DESC_TITLEBAR] = False  
              rootGroup[c4d.DESC_LAYOUTGROUP] = True  
              rootGroup[c4d.DESC_COLUMNS] = 3  
              obj.AddUserData(rootGroup)  
              
              #A group that's a child of the root group  
              childGroup = c4d.GetCustomDatatypeDefault(c4d.DTYPE_GROUP)  
              childGroup[c4d.DESC_NAME] = "childGroup"  
              childGroup[c4d.DESC_TITLEBAR] = True  
              childGroup[c4d.DESC_DEFAULT] = True   #The Default Open option  
              childGroup[c4d.DESC_PARENTGROUP] = obj.GetUserDataContainer()[0][0]  
              obj.AddUserData(childGroup)  
              
               
              #A string type UD entry for this group  
              childGrp_Item1 = c4d.GetCustomDatatypeDefault(c4d.DTYPE_STRING)  
              childGrp_Item1[c4d.DESC_NAME] = "Item1"  
              childGrp_Item1[c4d.DESC_PARENTGROUP] = obj.GetUserDataContainer()[1][0]  
              obj[obj.AddUserData(childGrp_Item1)] ="Hello World"  
              
              
              #A Real type UD entry for this group  
              childGrp_Item2 = c4d.GetCustomDatatypeDefault(c4d.DTYPE_REAL)  
              childGrp_Item2[c4d.DESC_NAME] = "Item2"  
              childGrp_Item2[c4d.DESC_PARENTGROUP] = obj.GetUserDataContainer()[1][0]  
              obj[obj.AddUserData(childGrp_Item2)] = 55.6  
                
              c4d.EventAdd()
            

            -ScottA

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

              On 07/05/2014 at 15:43, xxxxxxxx wrote:

              Thank you, Scott.
              The documentation is not very clear in how to achieve that.

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

                On 08/05/2014 at 11:56, xxxxxxxx wrote:

                I finally managed to be able to change the name of the UserData tab!!! 😄

                I contacted Maxon and I was told to create a group and set DESC_PARENTGROUP = c4d.DescID(0)
                Then, all my interface elements need to be set to DESC_PARENTGROUP] = obj.GetUserDataContainer()[0][0]
                Also, it seems that the c4d.DESC_COLUMNS constant is not set properly in the coffeesymbols.h file. However, it is correct (value of 22) in the lib_description.h file.

                Thank you Rick Barret 🙂

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

                  On 08/05/2014 at 16:23, xxxxxxxx wrote:

                  Do you have a small example of using c4d.DESC_COLUMNS Rui?
                  I'm not sure how to use that one.

                  -ScottA

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

                    On 08/05/2014 at 17:34, xxxxxxxx wrote:

                    Actually, I didn't used multi-columns after all.
                    But I may try to make it work with my plugin.

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

                      On 08/05/2014 at 18:35, xxxxxxxx wrote:

                      Here is the code I used:

                      rootGroup = c4d.GetCustomDatatypeDefault(c4d.DTYPE_GROUP)
                      rootGroup[c4d.DESC_NAME] = "Presets"
                      rootGroup[22] = 3
                      rootGroup[c4d.DESC_PARENTGROUP] = c4d.DescID(0)
                      node.AddUserData(rootGroup)

                      ud_presets=c4d.GetCustomDataTypeDefault(c4d.DTYPE_LONG)
                      ud_preset[c4d.DESC_NAME] = "Presets"
                      ud_preset[c4d.DESC_CUSTOMGUI] = c4d.CUSTOMGUI_CYCLE
                      ud_preset[c4d.DESC_PARENTGROUP] = node.GetUserDataContainer()[0][0]
                      file_list=get_file_list()
                      datalist=c4d.BaseContainer()
                      for i,f in enumerate(file_list) :
                           datalist.SetData(i,f[:-4])

                      ud_preset[c4d.DESC_CYCLE] = datalist

                      presets=node.AddUserData(ud_preset)
                      node[presets]=0

                      ud2=c4d.GetCustomDataTypeDefault(c4d.DTYPE_BOOL)
                      ud2[c4d.DESC_NAME] = "Use preset"
                      ud2[c4d.DESC_CUSTOMGUI] = c4d.CUSTOMGUI_BUTTON
                      ud2[c4d.DESC_PARENTGROUP] = node.GetUserDataContainer()[0][0]
                      button1=node.AddUserData(ud2)
                      node[button1]=False

                      ud3=c4d.GetCustomDataTypeDefault(c4d.DTYPE_BOOL)
                      ud3[c4d.DESC_NAME] = "Store new preset"
                      ud3[c4d.DESC_CUSTOMGUI] = c4d.CUSTOMGUI_BUTTON
                      ud3[c4d.DESC_PARENTGROUP] = node.GetUserDataContainer()[0][0]
                      button2=node.AddUserData(ud3)
                      node[button2]=False

                      It creates a 3 column parent group, that also changes the same of the UserData tab.

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

                        On 08/05/2014 at 19:20, xxxxxxxx wrote:

                        Thanks Rui. !Beer[URL-REMOVED]
                        Added these to my notes.

                        Now I just have to figure out how to do these in C++.
                        That's going to be another wonderful adventure. 🤢

                        -ScottA


                        [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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