UserData issues
-
On 06/05/2014 at 06:03, xxxxxxxx wrote:
I can understand how to create a UserData tab in my ObjectPlugin.
However, I don't know how to do a couple of things.
First, how can I rename the UserData tab into anything different from "UserData"?
How do I create a UserData entry that is a dropdown list of values?
I know it should be of type LONG, set to CYCLE.
But, how to create that? And how can I add items to that list? -
On 06/05/2014 at 06:31, xxxxxxxx wrote:
Take a look at the C++ docs
here
[URL-REMOVED]. DESC_CYCLE must be a BaseContainer that maps the ID of
each item to its name in the UI.-Niklas
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
On 06/05/2014 at 07:20, xxxxxxxx wrote:
I finally managed to do it
Now I just need to know how to change the name of the UserData tab from "UserData" to something else. -
On 06/05/2014 at 08:00, xxxxxxxx wrote:
To make your own tab show up without showing the default "UserData" tab. You have to create a new group and place it below the default built-in group.
It should look like this in the UD manager:
|_ UserData (default)
|_MY_GROUP #The tab that shows up in the AM
|_Data #Your UD gizmo
|_etc.....-ScottA
-
On 06/05/2014 at 08:07, xxxxxxxx wrote:
I know how to that by hand, in the UD manager.
I just don't know how to do it in commands, inside my ObjectPlugin. -
On 07/05/2014 at 12:49, xxxxxxxx wrote:
I hate to say this to you Rui. Because I know how many times you've hit dead ends and started over using a different method to get around SDK limitations.
But I'm pretty sure that this is not possible to do with code.It has to do with a long standing pet peeve of mine...Crippled TreeGUIs.
The UD gizmo is a TreeGUI gizmo. And whenever Maxon uses a treeGUI for something. They never fully expose all of it's options. So we hit a brick wall when trying to access it with code.
The OM and the timeline are the only exceptions I know of where the treeGUI is fully exposed to us.You guys have to complain about this to Maxon. Or it will never change.
-ScottA
-
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? -
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 columnsThe 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
-
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 -
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
-
On 07/05/2014 at 15:43, xxxxxxxx wrote:
Thank you, Scott.
The documentation is not very clear in how to achieve that. -
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
-
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
-
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. -
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]=0ud2=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]=Falseud3=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]=FalseIt creates a 3 column parent group, that also changes the same of the UserData tab.
-
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.