InExclude CustomGUI in Python-Plugin
-
On 03/05/2018 at 08:14, xxxxxxxx wrote:
Hey guys,
I'm running into this problem again, where I want to make use of the In-Exclude CustomGUI inside of a plugin. (see attached picture.)
(Dialog is created using a *.res file via ResEdit v1.3)I don't fully understand how I have to setup the Dialog to accept Drag and Drop of Objects.
Sadly, there is a lot of convoluted Information online...In the end I want to have a unqiue collection of Objects which are stored within my PLUGINID with every Scene.
Hope you understand what I'm trying to achieve.
Can someone give me some advice..?Thanks & Cheers,
Lasse -
On 04/05/2018 at 04:37, xxxxxxxx wrote:
Hi Lasse,
It's not possible to get an In-/Exclude GUI working with a loaded dialog because there's no way to set the accepted types by the list.
The solution is to manually add the In-Exclude list to the dialog in CreateLayout().For instance to setup an In-/Exclude list that expects all kind of objects:
def CreateLayout(self) : ... # Build accepted object types accepted = c4d.BaseContainer() accepted.InsData(c4d.Obase, "") settings = c4d.BaseContainer() # Set accepted object types into InExclude custom GUI settings settings[c4d.DESC_ACCEPT] = accepted objectsList = self.AddCustomGui(IDC_OBJECTSLIST, c4d.CUSTOMGUI_INEXCLUDE_LIST, "", c4d.BFH_SCALEFIT|c4d.BFV_SCALEFIT, 0, 0, settings) ...
About saving the objects list, the In-/Exclude cannot do this as it is a control inside a dialog and cannot store persistent data.
But you can save the data from the list. Call GetData() on the custom GUI, then set the obtained InExcludeData into the document's data with doc[PLUGIN_ID], where PLUGIN_ID is a unique plugin ID.