Menu State for Python Scripts? [LIMITATION]



  • On 04/06/2015 at 03:46, xxxxxxxx wrote:

    Hello, with COFFEE-Scripts you can set a menustate to grey out the Script-Icon when no Object is selected. Is there a Way to do so with Python?
    Thanks for any help.
    Holger



  • On 04/06/2015 at 07:13, xxxxxxxx wrote:

    Hi Holger,

    It seems the ENABLE Menu State doesn't dynamically enable/disable a COFFEE script icon/menu depending on the active selection state. How are you doing this in COFFEE?



  • On 04/06/2015 at 11:11, xxxxxxxx wrote:

    As far as I understand, it's only possible to set an enable/disable state with a CommandPlugin, not with a Python Script.



  • On 04/06/2015 at 11:16, xxxxxxxx wrote:

    To do this in COFFEE, you would include the following in the Menu State field of the COFFEE Script Editor:

      
    if(op){   
    ENABLE=TRUE;        
    }   
    else{   
         ENABLE=FALSE;        
    }   
    


  • On 05/06/2015 at 00:34, xxxxxxxx wrote:

    Hi Donovan,

    Thanks for the code and explanation.
    And as you've already stated it is not possible to do such thing for a Python script, only for a Python CommanData plugin with CommandData.GetState(). There's no support of Menu State ENABLE/CHECKED for Python scripts.



  • On 05/06/2015 at 00:37, xxxxxxxx wrote:

    Hello Guys. Thanks for your answers.
    In coffee-scripts I enter this code into the menustate-Field:

    if (!op) { ENABLE=FALSE; return FALSE; }
    ENABLE=TRUE;

    That is working. In python we dont have a menu-state Field. I thought maybe there is another way to grey out Icons. I saw that with Python-Plugins so I thought there is a way for pythonscripts as well.

    To bad this is not implemented. Maybe I post an Idea. Cu arround. Holger


Log in to reply