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. DESC_CYCLE must be a BaseContainer that maps the ID of
each item to its name in the UI.
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
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.
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 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.
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.
#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() 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() 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() obj[obj.AddUserData(childGrp_Item2)] = 55.6 c4d.EventAdd()
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!!! :-D
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()
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.
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 = 3
rootGroup[c4d.DESC_PARENTGROUP] = c4d.DescID(0)
ud_preset[c4d.DESC_NAME] = "Presets"
ud_preset[c4d.DESC_CUSTOMGUI] = c4d.CUSTOMGUI_CYCLE
ud_preset[c4d.DESC_PARENTGROUP] = node.GetUserDataContainer()
for i,f in enumerate(file_list) :
ud_preset[c4d.DESC_CYCLE] = datalist
ud2[c4d.DESC_NAME] = "Use preset"
ud2[c4d.DESC_CUSTOMGUI] = c4d.CUSTOMGUI_BUTTON
ud2[c4d.DESC_PARENTGROUP] = node.GetUserDataContainer()
ud3[c4d.DESC_NAME] = "Store new preset"
ud3[c4d.DESC_CUSTOMGUI] = c4d.CUSTOMGUI_BUTTON
ud3[c4d.DESC_PARENTGROUP] = node.GetUserDataContainer()
It creates a 3 column parent group, that also changes the same of the UserData tab.
On 08/05/2014 at 19:20, xxxxxxxx wrote:
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.