Special Options - creating UserData with Python



  • On 19/06/2013 at 06:41, xxxxxxxx wrote:

    Hello everyboy,

    I just have a little question:
    I whant to create Userdata with Python and therefore read throu the documentation of the python sdk. After some work, I came up with this code:

        pyTag = c4d.BaseTag(5612)  
        
      bc = c4d.GetCustomDatatypeDefault(c4d.DTYPE_GROUP)  
      name = "group name"  
      myID = 100  
      bc[c4d.DESC_NAME] = name  
      bc[c4d.DESC_SHORT_NAME] = name  
      did = c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA), c4d.DescLevel(myID))  
      did = [c4d.ID_USERDATA, myID]  
      pyTag.SetUserDataContainer(did, bc)  
        
      #A string type UD entry for this group  
      childGrp_Item1 = c4d.GetCustomDatatypeDefault(c4d.DTYPE_STRING)  
      name = "test"  
      myID = 101  
      inhalt = "fasdfi"  
      childGrp_Item1[c4d.DESC_NAME] = name  
      childGrp_Item1[c4d.DESC_ANIMATE] = 0  
      childGrp_Item1[c4d.DESC_PARENTGROUP] = pyTag.GetUserDataContainer()[0][0]  
      did2 = c4d.DescID(c4d.DescLevel(c4d.ID_USERDATA), c4d.DescLevel(myID))  
      did2 = [c4d.ID_USERDATA, myID]  
      pyTag.SetUserDataContainer(did2, childGrp_Item1)
    

    Now I have two options, I can't change. Therefore I made this picture.
    The red line means, I whant to access this option.
    and the green line means, I whant to change it on this value (in this example).
    normaly, the top option in the list is selectet (on the string type, it is a "normal, editable" sting. But there are also the "statig string" and the "more lines string")

    So how can I access these options?

    I know that there id also the command

    childGrp_Item1 = c4d.GetCustomDatatypeDefault(c4d.DTYPE_STATICTEXT)
    

    to create a static string/text. But it seems not the right one. So what command should I use?

    thanks for help and have a nice day!

    greetings,
    Christopher



  • On 19/06/2013 at 09:03, xxxxxxxx wrote:

    the interface drop down is referring to the descriptions customgui flag. be sure to pass valid 
    data, you can crash c4d with invalid description elements. about the open button - i am not 
    sure, but i guess it does reflect the open desciption flag, which seems to be DESC_GUIOPEN.

    the description flags from the c++ sdk:

    > _<_t_>_
    >
    > DESC_NAME
    >
    > |
    >
    > String
    >
    > |
    >
    > Name for standalone use.
    >
    > ---|---|---
    >
    > DESC_SHORT_NAME
    >
    > |
    >
    > String
    >
    > |
    >
    > Short name, for attributes dialog.
    >
    > DESC_VERSION
    >
    > |
    >
    > LONG
    >
    > |
    >
    > Show in versions:
    >
    >> > _>|
    >>>
    >>> DESC_VERSION_DEMO
    >>>
    >>> |
    >>>
    >>> Demo versions.
    >>>
    >>> ---|---
    >>>
    >>> DESC_VERSION_XL
    >>>
    >>> |
    >>>
    >>> XL versions.
    >>>
    >>> DESC_VERSION_ALL
    >>>
    >>> |
    >>>
    >>> All versions.
    >>>
    >>> _/tr>
    >
    > DESC_CHILDREN
    >
    > |
    >
    > BaseContainer
    >
    > |
    >
    > Internal.
    >
    > DESC_MIN
    >
    > |
    >
    > T
    >
    > |
    >
    > The minimum value.
    >
    > DESC_MAX
    >
    > |
    >
    > T
    >
    > |
    >
    > The maximum value.
    >
    > DESC_MINEX
    >
    > |
    >
    > Bool
    >
    > |
    >
    > [TRUE](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/ge_sys_math/enum_BoolConstants150.html#TRUE0) if [DESC_MIN](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/lib_description/cid_DESC_Items419.html#desc_min4) is exclusive, otherwise it is inclusive.
    >
    > DESC_MAXEX
    >
    > |
    >
    > Bool
    >
    > |
    >
    > [TRUE](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/ge_sys_math/enum_BoolConstants150.html#TRUE0) if [DESC_MAX](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/lib_description/cid_DESC_Items419.html#desc_max5) is exclusive, otherwise it is inclusive.
    >
    > DESC_STEP
    >
    > |
    >
    > T
    >
    > |
    >
    > The step for the edit field arrows.
    >
    > DESC_ANIMATE
    >
    > |
    >
    > LONG
    >
    > |
    >
    > Animation mode:
    >
    >> > _ing="6">|
    >>>
    >>> DESC_ANIMATE_OFF
    >>>
    >>> |
    >>>
    >>> See [OFF](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/description_resource/doc_DescriptionResou449.html#elementflags8).
    >>>
    >>> ---|---
    >>>
    >>> DESC_ANIMATE_ON
    >>>
    >>> |
    >>>
    >>> See [ON](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/description_resource/doc_DescriptionResou449.html#elementflags8).
    >>>
    >>> DESC_ANIMATE_MIX
    >>>
    >>> |
    >>>
    >>> See [MIX](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/description_resource/doc_DescriptionResou449.html#elementflags8)_<_t_>_>
    >
    > DESC_ASKOBJECT
    >
    > |
    >
    > Bool
    >
    > |
    >
    > [TRUE](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/ge_sys_math/enum_BoolConstants150.html#TRUE0) means ask object for this parameter, [FALSE](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/ge_sys_math/enum_BoolConstants150.html#FALSE1) meand look in container.
    >
    > DESC_UNIT
    >
    > |
    >
    > LONG
    >
    > |
    >
    > Unit:
    >
    >> > _ellspacing="6">|
    >>>
    >>> DESC_UNIT_REAL
    >>>
    >>> |
    >>>
    >>> [FORMAT_REAL](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/c4d_gui/enum_FORMAT_Units564.html#format_real0)
    >>>
    >>> DESC_UNIT_LONG
    >>>
    >>> |
    >>>
    >>> [FORMAT_LONG](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/c4d_gui/enum_FORMAT_Units564.html#format_long1)
    >>>
    >>> DESC_UNIT_PERCENT
    >>>
    >>> |
    >>>
    >>> [FORMAT_PERCENT](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/c4d_gui/enum_FORMAT_Units564.html#format_percent2)
    >>>
    >>> DESC_UNIT_DEGREE
    >>>
    >>> |
    >>>
    >>> [FORMAT_DEGREE](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/c4d_gui/enum_FORMAT_Units564.html#format_degree3)
    >>>
    >>> DESC_UNIT_METER
    >>>
    >>> |
    >>>
    >>> [FORMAT_METER_](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/c4d_gui/enum_FORMAT_Units564.html#format_meter4)
    >
    > DESC_PARENTGROUP
    >
    > |
    >
    > LONG
    >
    > |
    >
    > Parent ID ([DescID](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/lib_description/class_DescID426.html)).
    >
    > DESC_CYCLE
    >
    > |
    >
    > BaseContainer
    >
    > |
    >
    > Contains the members of cycle as strings. (E.g. GetString(10041) == "-X".)
    >
    > DESC_HIDE
    >
    > |
    >
    > Bool
    >
    > |
    >
    > Indicates whether the property is hidden or not.
    >
    > DESC_DEFAULT
    >
    > |
    >
    > T
    >
    > |
    >
    > Default numeric value.
    >
    > DESC_ACCEPT
    >
    > |
    >
    > BaseContainer
    >
    > |
    >
    > Contains the accepted IDs as strings. (E.g. GetString(5155) == "Obase".)
    >
    > DESC_SEPARATORLINE
    >
    > |
    >
    > Bool
    >
    > |
    >
    > [TRUE](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/ge_sys_math/enum_BoolConstants150.html#TRUE0) if separators should have a visible line.
    >
    > DESC_REFUSE
    >
    > |
    >
    > BaseContainer
    >
    > |
    >
    > Contains the refused IDs as strings. (E.g. GetString(5155) == "Obase".)
    >
    > DESC_PARENTID
    >
    > |
    >
    > LONG
    >
    > |
    >
    > The ID of the parent element used for indentation.
    >
    > DESC_CUSTOMGUI
    >
    > |
    >
    > LONG
    >
    > |
    >
    > The ID of the GUI for this element. Either a custom ID or one of:
    >
    >> > |
    >>>
    >>> CUSTOMGUI_REAL
    >>>
    >>> |
    >>>
    >>> [Real](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/ge_sys_math/typedef_ge_sys_math_584.html#Real15) edit field.
    >>>
    >>> CUSTOMGUI_REALSLIDER
    >>>
    >>> |
    >>>
    >>> [Real](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/ge_sys_math/typedef_ge_sys_math_584.html#Real15) edit field with slider.
    >>>
    >>> CUSTOMGUI_REALSLIDERONLY
    >>>
    >>> |
    >>>
    >>> [Real](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/ge_sys_math/typedef_ge_sys_math_584.html#Real15) slider only.
    >>>
    >>> CUSTOMGUI_VECTOR
    >>>
    >>> |
    >>>
    >>> Vector.
    >>>
    >>> CUSTOMGUI_STRING
    >>>
    >>> |
    >>>
    >>> String field.
    >>>
    >>> CUSTOMGUI_STRINGMULTI
    >>>
    >>> |
    >>>
    >>> Multiple line string field.
    >>>
    >>> CUSTOMGUI_STATICTEXT
    >>>
    >>> |
    >>>
    >>> Static text field.
    >>>
    >>> CUSTOMGUI_CYCLE
    >>>
    >>> |
    >>>
    >>> Selection list field.
    >>>
    >>> CUSTOMGUI_CYCLEBUTTON
    >>>
    >>> |
    >>>
    >>> Selection field list with button functionality, e.g. the function of a button can be changed through a selection field list.
    >>>
    >>> CUSTOMGUI_LONG
    >>>
    >>> |
    >>>
    >>> Long edit field.
    >>>
    >>> CUSTOMGUI_LONGSLIDER
    >>>
    >>> |
    >>>
    >>> Long edit field with slider.
    >>>
    >>> CUSTOMGUI_BOOL
    >>>
    >>> |
    >>>
    >>> Checkbox.
    >>>
    >>> CUSTOMGUI_TIME
    >>>
    >>> |
    >>>
    >>> Time edit field.
    >>>
    >>> CUSTOMGUI_COLOR
    >>>
    >>> |
    >>>
    >>> Color chooser.
    >>>
    >>> CUSTOMGUI_MATRIX
    >>>
    >>> |
    >>>
    >>> Matrix edit fields.
    >>>
    >>> CUSTOMGUI_BUTTON
    >>>
    >>> |
    >>>
    >>> Button.
    >>>
    >>> CUSTOMGUI_POPUP
    >>>
    >>> |
    >>>
    >>> Popup field.
    >>>
    >>> CUSTOMGUI_SEPARATOR
    >>>
    >>> |
    >>>
    >>> Separator.
    >>>
    >>> CUSTOMGUI_SUBDESCRIPTION
    >>>
    >>> |
    >>>
    >>> Subdescription.
    >>>
    >>> CUSTOMGUI_PROGRESSBAR
    >>>
    >>> |
    >>>
    >>> DESC_COLUMNS
    >>>
    >>> |
    >>>
    >>> LONG
    >>>
    >>> |
    >>>
    >>> Number of columns for layout groups.
    >>>
    >>> DESC_LAYOUTGROUP
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> [TRUE](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/ge_sys_math/enum_BoolConstants150.html#TRUE0) if this is a [LAYOUTGROUP (descriptions)](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/description_resource/doc_LAYOUTGROUP890.html)
    >>>
    >>> DESC_REMOVEABLE
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> [TRUE](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/ge_sys_math/enum_BoolConstants150.html#TRUE0) if this entry is removable.
    >>>
    >>> DESC_GUIOPEN
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> [TRUE](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/ge_sys_math/enum_BoolConstants150.html#TRUE0) if the maximized GUI is shown by default.
    >>>
    >>> DESC_EDITABLE
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> [TRUE](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/ge_sys_math/enum_BoolConstants150.html#TRUE0) if this entry is editable.
    >>>
    >>> DESC_MINSLIDER
    >>>
    >>> |
    >>>
    >>> T
    >>>
    >>> |
    >>>
    >>> The minimum value for the slider.
    >>>
    >>> DESC_MAXSLIDER
    >>>
    >>> |
    >>>
    >>> T
    >>>
    >>> |
    >>>
    >>> The maximum value for the slider.
    >>>
    >>> DESC_GROUPSCALEV
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> Allow the group height to be scaled.
    >>>
    >>> DESC_SCALEH
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> Scale element horizontally.
    >>>
    >>> DESC_LAYOUTVERSION
    >>>
    >>> |
    >>>
    >>> LONG
    >>>
    >>> |
    >>>
    >>> Layout version.
    >>>
    >>> DESC_ALIGNLEFT
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> Align element left.
    >>>
    >>> DESC_FITH
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> Fit element.
    >>>
    >>> DESC_NEWLINE
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> Line break.
    >>>
    >>> DESC_TITLEBAR
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> Main group title bar.
    >>>
    >>> DESC_CYCLEICONS
    >>>
    >>> |
    >>>
    >>> BaseContainer
    >>>
    >>> |
    >>>
    >>> [LONG](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/ge_sys_math/typedef_ge_sys_math_584.html#LONG2) icon IDs for cycle.
    >>>
    >>> DESC_CYCLESYMBOLS
    >>>
    >>> |
    >>>
    >>> BaseContainer
    >>>
    >>> |
    >>>
    >>> String identifiers for helpsymbol export.
    >>>
    >>> DESC_PARENT_COLLAPSE
    >>>
    >>> |
    >>>
    >>> LONG
    >>>
    >>> |
    >>>
    >>> Parent collapse ID.
    >>>
    >>> DESC_FORBID_INLINE_FOLDING
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> Instruct the AM to not to allow expanding inline objects for this property.
    >>>
    >>> DESC_FORBID_SCALING
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> Prevents auto-scaling of the parameter with the scale tool (for [DESC_UNIT_METER](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/lib_description/enum_DESC_UNIT_Types420.html#desc_unit_meter4)).
    >>>
    >>> DESC_ANGULAR_XYZ
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> [TRUE](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/ge_sys_math/enum_BoolConstants150.html#TRUE0) for XYZ as angular representation, or [FALSE](file:///E:/Misc/SDK%20Help/C4d%20SDK%20Documentation%20C++/help/pages/ge_sys_math/enum_BoolConstants150.html#FALSE1) for HPB.
    >>>
    >>> DESC_INPORT
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> GV in port.
    >>>
    >>> DESC_OUTPORT
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> GV out port.
    >>>
    >>> DESC_STATICPORT
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> GV static port.
    >>>
    >>> DESC_NEEDCONNECTION
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> GV needs connection.
    >>>
    >>> DESC_MULTIPLE
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> GV multiple ports allowed.
    >>>
    >>> DESC_PORTONLY
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> GV port only.
    >>>
    >>> DESC_CREATEPORT
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> GV create port.
    >>>
    >>> DESC_PORTSMIN
    >>>
    >>> |
    >>>
    >>> LONG
    >>>
    >>> |
    >>>
    >>> GV minimum number of ports.
    >>>
    >>> DESC_PORTSMAX
    >>>
    >>> |
    >>>
    >>> LONG
    >>>
    >>> |
    >>>
    >>> GV maximum number of ports.
    >>>
    >>> DESC_NOTMOVABLE
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> GV not movable.
    >>>
    >>> DESC_EDITPORT
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> GV editable.
    >>>
    >>> DESC_ITERATOR
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> GV iterator port.
    >>>
    >>> DESC_PARENTMSG
    >>>
    >>> |
    >>>
    >>> LONG
    >>>
    >>> |
    >>>
    >>> Used in the Material Editor on the boolean tabs to specifiy which section to open.
    >>>
    >>> DESC_MATEDNOTEXT
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> No text in Material Editor window.
    >>>
    >>> DESC_COLUMNSMATED
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> Number of columns in left Material Editor window.
    >>>
    >>> DESC_SHADERLINKFLAG
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> Specifies that this element is a shader link. (Only if datatype == DTYPE_LINK.)
    >>>
    >>> DESC_NOGUISWITCH
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> Disables GUI switching for this description element.
    >>>
    >>> DESC_TEMPDESCID
    >>>
    >>> |
    >>>
    >>> T
    >>>
    >>> |
    >>>
    >>> Private. Used internally to store the prefered description ID.
    >>>
    >>> DESC_IDENT
    >>>
    >>> |
    >>>
    >>> String
    >>>
    >>> |
    >>>
    >>> Resource identifier, e.g. ID_BASEO\_<\_t\_>\_T_NAME.
    >>
    >>
    >
    >>
    >>
    >
    >>
    >>> Constant| Description
    >>> ---|---
    >>>
    >>> DESCID_ROOT
    >>>
    >>> |
    >>>
    >>> Root.
    >>>
    >>> ID_USERDATA
    >>>
    >>> |
    >>>
    >>> Private.
    >>>
    >>> DESCID_DYNAMICSUB
    >>>
    >>> |
    >>>
    >>> Private.
    >>
    >>
    >
    >>
    >>
    >
    >>
    >>> Container ID| Type| Description
    >>> ---|---|---
    >>>
    >>> BOOL_PAGEMODE
    >>>
    >>> |
    >>>
    >>> Bool
    >>>
    >>> |
    >>>
    >>> Page mode for boolean elements. If set it means that this boolean will have no checkbox. (It is used for _<_t_>_Material Editor navigation.)
    >>
    >>
    >



  • On 19/06/2013 at 10:31, xxxxxxxx wrote:

    hi,

    first thanks for the fast reply. but none of this seems to work :(

    The DESC_GUIOPEN was also a commant, I found myself in this board. but when I set it on "True" or on "1", nothing is changing. but also no error!

    and the other thing is the interface.
    this one is tricky, because i have no idea how to use it.
    It sais, that you need a long as input. so something linke:

    childGrp_Item1[c4d.DESC_CUSTOMGUI] = 1.0
    

    but this will not work. also this does have no effekt:

    childGrp_Item1[c4d.DESC_CUSTOMGUI] = CUSTOMGUI_STATICTEXT
    

    so what command would it be here? what is the input I need?

    greetings,
    Christopher



  • On 19/06/2013 at 11:01, xxxxxxxx wrote:

    You can change any UD option. But to do that you first have to understand how UD works.
    You have to understand how the sub containers work in the UserData master container object.
    Once you understand how to get at the sub containers. And understand what's inside of them. You can change pretty much any UD option there is.

    I've already explained how to do this in this thread:https://plugincafe.maxon.net/topic/7119/8084_add-userdata-with-details

    Here is an example of how to set the string option to STRINGMULTI mode on your first UserData item.

    import c4d  
    def main() :  
        
      obj = doc.GetActiveObject()      #The object hosting the UD    
      ud = obj.GetUserDataContainer() #The master UD container  
         
      first = ud[0]                   #The first UD entry on the stack (not it's ID#)  
      bc0 = first[0]                  #The first tuple container of options(DescID stuff)   
      bc1 = first[1]                  #The second tuple container of options(UD options)  
       
      for i in bc1: print i           #Shows you all the options you can change by their ID#           
      
      #You have two ways to change the UD's options  
      #By using it's ID# found in the lib_description.h file like this:  
      #first[1][21] = 200000007       #Sets the STRINGMULTI option  
        
      #Or by using the text based name for the ID#(preferred by Maxon) :  
      bc1.SetLong(c4d.DESC_CUSTOMGUI,c4d.CUSTOMGUI_STRINGMULTI)    #Sets the STRINGMULTI option  
      
      obj.SetUserDataContainer(bc0, bc1) #Set the container changes  
        
      c4d.EventAdd()  
      
    if __name__=='__main__':  
      main()
    

    The first time you look through those UD sub containers it will probably feel rather confusing.
    I've tried to spell out what they do as much as I could. But each type of UD gizmo has it's own set of container data. So you'll have to take some time and experiment with them to try and get comfortable with finding, and changing them.

    -ScottA



  • On 19/06/2013 at 12:03, xxxxxxxx wrote:

    @ scott using plain ids is not a good advice imho. also your code example is very
    cppish imho, no offense.

    @ op your fault seemed to be that you did not pass the id properly.

    import c4d
        from c4d import gui
        #Welcome to the world of Python
        
        def main() :
            if op:
                nextID = len(op.GetUserDataContainer()) - 1
                bc = c4d.GetCustomDatatypeDefault(c4d.DTYPE_STRING)
                bc[c4d.DESC_NAME] = 'Static string'
                bc[c4d.DESC_CUSTOMGUI] = c4d.CUSTOMGUI_STATICTEXT
                op.SetUserDataContainer([c4d.ID_USERDATA, nextID], bc)
                c4d.EventAdd()
                
        if __name__=='__main__':
            main()
    


  • On 19/06/2013 at 13:22, xxxxxxxx wrote:

    hello,

    absolute great! thanks a lot! the problem with the special type is working great :)

    The only thing remaining is the problem with the default open group :(
    Do you maybe have an other idea how to solve it?

    bc[c4d.DESC_GUIOPEN] = True
    

    does not work :(

    greetings,
    Christopher



  • On 19/06/2013 at 14:15, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    @ scott using plain ids is not a good advice imho. also your code example is very
    cppish imho, no offense.

    Actually. I do take offense to that comment. Because I also showed how to write it with text based descriptions. And I even went as far putting a comment that it's the Maxon recommended way.
    So I can't think of any reason why you would even bring that up.  Other than personal reasons.

    And as for your cppish remark.
    IMO. It's very important to understand how UD works. And that requires seeing the containers in their raw form without any python covering them up.
    Once you know how the containers work. Then the users can write code in a more pythonic manner if they wish. But they need to know how it works first.

    -ScottA



  • On 19/06/2013 at 14:48, xxxxxxxx wrote:

    yea, you are absolutly right! the main issue is, to understand the tools and objects, that are used!
    It is much better then just to get the solution without understanding, what is happening there.

    But still, in my case the command (two posts aboph) is not working :(

    greetings,
    Chriss



  • On 19/06/2013 at 16:36, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    yea, you are absolutly right! the main issue is, to understand the tools and objects, that are used!
    It is much better then just to get the solution without understanding, what is happening there.

    But still, in my case the command (two posts aboph) is not working :(

    greetings,
    Chriss

    yeah, now that you wrote it ... the OPEN flag in descriptions is used to toggle the state of 
    things like color fields or spline guis. Groups are set with DEFAULT 0|1. So my guess was kind
    of pretty wrong ;) You might want to try your luck with the ID for the default value.



  • On 19/06/2013 at 19:30, xxxxxxxx wrote:

    If you are referring to the "Default Open" option for UD groups.

    The ID for that one isn't: c4d.DESC_GUIOPEN
    It's: c4d.DESC_DEFAULT

    -ScottA



  • On 24/06/2013 at 15:31, xxxxxxxx wrote:

    you are all my absolute heroes. Thanks a lot!
    Everything is now working just fine ... most of the tings :P
    Only one last little question:

    the command

    bc[c4d.DESC_COLUMNS] = 3
    

    does not change the amount of colums in a group.
    Because of that, I searched a littlebit in this board and came up with this solution:

    bc[22] = 3
    

    it is now working! My group now has tree columns.
    But I wondered, what command is behind the "22"?
    is there a other way to write the "bc[22]"? maybe something like "bc[DESC_xxxxxx]"?

    greetings,
    Chriss



  • On 24/06/2013 at 15:59, xxxxxxxx wrote:

    I don't  know if this was a typo on your part. But you forgot the c4d. prefix in your DESC_COLUMNS example.
    But it's possible that it doesn't work even with the c4d prefix(I haven't tested it myself to see).
    There are still some things that have not been linked to a text based symbol ID# yet.  And you'll have no choice but to use the numeric ID#.

    Most of the UD ID#s can be found in the file: C:\Program Files\MAXON\CINEMA 4D R13\resource\_api\c4d_libs\lib_description.h

    In that file. There is an entry:  DESC_COLUMNS = 22
    If Sebastien hasn't linked the text based name to that ID number. Then you'll have to use the actual number until he sets it up to use the text based ID's.

    -ScottA



  • On 24/06/2013 at 16:48, xxxxxxxx wrote:

    hey,

    thanks a lot for the fast reply!
    And yes, you are right, I forgot the "c4d." in front of the tag^^
    This can happen if you write the code without copy&past :P

    The interesting fact here is, that the id 22 seems to be linked to "DESC_COLUMNS" but will not work. maybe it is more a bug, then a missing connection. But whatever the case is, it only works with the id.
    But thanks also for the c++ header file. this one was new to me, so now I know where you guys get all the text based sybols :P

    But in this case I have an other little question:

    I found this userdata in an project and thought this is very interesting, because there is no actual data type and this is only a kind of "dummy" in order to seperate two userdatas.
    So two of this userdatas can make a "space"/"gap" in a group in order to sort the things a little better.
    _<_img src="http://weltderpixel.com/dd/c4d board.jpg" border="0" /_>_

    But how can I create such an userdata with python?
    And how can I create it without python?

    I have really no idea how to create this userdata. Not with the normal c4d method and also not with python. Maybe someone can help me with this one.
    It would be really nice!

    greetings,
    Chriss

    [EDIT] ah, sry, I now see that the image is not 100% in english. But I think, that you all know, what the names stand for :P ... and if not, then tell me and I will change it!



  • On 24/06/2013 at 17:05, xxxxxxxx wrote:

    The only time I've seen something like that is when I accidentally created a UD entry with an ID# of zero.
    UserData entries are supposed to start at 1. And C4D doesn't like it when a zero ID is used.
    But since the ID# is 30 in your example. I can't really say what's going on in that one.

    UserData is basically a tree with invisible branches. And the actual UD gizmos themselves are like leaves on the branches.
    Using things like PopId() & PushId() you can build a UserData tree with empty branches in it that don't have a UD gizmo on it/them. And this can possibly be used to do some special tricks like what you're got there.

    -ScottA


Log in to reply