On 25/02/2013 at 17:37, xxxxxxxx wrote:
Hey there python peeps!
I have currently run into a wall and would appreciate any help.
I have been trying to figure out how to access the Base Container Description of a group. I wish to set the DESC_HIDE dynamically, but i cant seem to access my plugin's groups when i use op.GetData(). How would you guys go about trying to dynamically hide a group within your plugin. I have been able to do it with User Data, but it seems as though the plugin Object's Description-Based data is not showing groups when GetData() is called on it. I can see all my other data, but not the groups... thanks for taking the time to read this!
On 25/02/2013 at 21:35, xxxxxxxx wrote:
GetData() returns the BaseContainer that stores the.parameters values, not the
description. You have to override GetDEnabling() and use the itemdesc parameter.
But be warned: The container is not intended to be modified in this context
among the C++ SDK (the parameter is passed const), I don't know if it
will actually work or result in unpredictable behavior.
On 26/02/2013 at 04:22, xxxxxxxx wrote:
The description container provided by GetDEnabling is a reference, so you can overwrite it
and the results will be somewhat the expected. But c4d will start crashing when you mess
with an objects description via GetDEnabling and also all instances share the same the same
function parameter variable (so when you hide an element for one instance it is hidden for all
instances). This at least are my experiences (R13).
If you want dynamic descriptions in python, please send a suggestion / feature wish to maxon
to wrap GetDDescription for python.
On 26/02/2013 at 12:24, xxxxxxxx wrote:
thanks so much for the great responses. i think i finally got GetDEnabling() to work! but it doesn't hide things (only greys them out) and it doent seem to recieve/work on groups... any ideas?
On 26/02/2013 at 13:13, xxxxxxxx wrote:
What the guys are trying to tell you is you can't.
Hiding things using descriptions requires using the GetDDescription() method. And that method is currently not supported in python.
If you want to hide & unhide GUI stuff using Python. Using UserData is currently the only option.
On 28/02/2013 at 18:23, xxxxxxxx wrote:
Thanks scott, i finally for GetDEnabling to work, but it obviously is not hiding things, it is just greying it out. i have sent a request to maxxon for them to add GetDDescription support in the next python version, so i hope they do! thanks to everybody for the help. it looks like i might have to construct a user data interface at the time of the creation of the plugin, which is going to be a b**ch... i think. if anyone knows of a good way to load a description file into user data, that would be rad, otherwise... im heading back to the dungeon to figure it out!
On 01/03/2013 at 14:44, xxxxxxxx wrote:
Here's two methods from a UI controller class I made. Maybe you can pick apart some stuff:
(I will add with MASSIVE support from Rick Barrett)
def createPresetMenuItems(self) :
# Create BC that represents the items in the DropDown
if not (self.__presetsDropDown) : self.__presetsDropDown = c4d.BaseContainer()
#Fill the Cycle BC with menu items
self._presetsDropDown.SetString(0, 'None') #0 will always be 'None'
for i in xrange(len(self._presetFiles)) :
self._presetsDropDown.SetString(i+1, self._presetFiles [:-4])
_ self._UDBC[c4d.DESC_CYCLE] = self._presetsDropDown
_ self._UDBC[c4d.DESC_TITLEBAR] = False
_ def createPresetMenu(self, menuID) : _
_ """Takes amount of presets and builds the USERDATA preset menu"""
_ #Get BC for UD type data
_ self._UDBC = c4d.GetCustomDatatypeDefault(c4d.DTYPE_LONG) #create default container
_ self._UDBC[c4d.DESC_NAME] = "Presets" #rename the entry
_ self._UDBC[c4d.DESC_CUSTOMGUI] = c4d.CUSTOMGUI_CYCLE
_ self._UDBC[c4d.DESC_PARENTGROUP] = c4d.DescID(c4d.MASTERGROUP)
_ #Set the Cycle item BC as the contents of the Cycle
_ self._presetMenuID = self._op.AddUserData(self._UDBC)
_ #Set the default value
_ self._op[self._presetMenuID] = menuID
_ #Force redraw