Enable / Disable GUI from res file

On 19/09/2016 at 00:16, xxxxxxxx wrote:

Hi All,

I'm working on a plugin where i would like to enable/disable a piece of the gui generated by the .res file.
Is there a way to do this?

Thanx in advance

On 19/09/2016 at 06:13, xxxxxxxx wrote:

Hi,

welcome to the Plugin Café forums 🙂

From within a resource file this is not possible.

Via code it is possible, but it depends whether you are working with a description or a dialog.

For a description resource of a NodeData (and derived) or ToolData based plugin you need to implement GetDEnabling(). Check the Py-DoubleCircle or Py-DynamicParametersObject examples to see GetDEnabling() in action.

In a GeDialog you use Enable(). See the Py-TextureBaker example.

On 19/09/2016 at 09:09, xxxxxxxx wrote:

Thanx Andreas,

This is a real though one and if i should believe the forums i'm not the only one struggling with this problem :D.
It is used in a python ObjectPlugin

This is my code so far

def GetDEnabling(self, node, id, t_data, flags, itemdesc) :
      data = node.GetDataInstance()
        if data is None:
            return
        if data.GetBool(ONOFF_ENABLED) :

My question is what should come next to gray out the item MY_SUBBOX

On 19/09/2016 at 10:20, xxxxxxxx wrote:

I know it's a tiny bit confusing, but did you look at the DoubleCircle example?  
In your case

...
if data.GetBool(ONOFF_ENABLED) :
	if id[0].id == MY_SUBBOX:
		return False

would disable MY_SUBBOX if ONOFF_ENABLED, assuming you assigned its id properly.  I also gave you an example when you posted on the other cafe...

On 20/09/2016 at 01:10, xxxxxxxx wrote:

I saw your post on the other forum. I know it was the same question but this gives me the possibility to call you a hero twice 😉