Apologize in advance that this is non-python related question but it is still related to maya though.. But I need some help in mel commands for this shelving of mine..
Say I have this shelf_funcs.mel that contains the setup or initialization of those shelf buttons..
One of its functions is as follows:
global proc shelfFuncs_paint()
{
shelfButton
-enableCommandRepeat 1
-enable 1
-width 34
-height 34
-manage 1
-visible 1
-annotation "spPaint tool for SITE"
-label "spPaint"
-image1 "iconTest.png"
-style "iconOnly"
-stp "python"
-command "import paintGUI;reload(paintGUI);paintGUI.paintGUIWin()"
;
}
Then I have another file - let's called it shelf_misc.mel that was called in Maya startup in which it then calls for shelf_funcs.mel
Pertaining to the above function, this is how it looks like in the shelf_misc.mel
global proc shelf_miscTools()
{
eval( "source shelf_funcs.mel" );
...
...
shelfFuncs_paint();
...
...
}
So if this paintGUI script exists within the python directory of Maya, it will creates its own icon and be present in the shelf. Now my question is, how do I make it conditional in the shelf_misc.mel such that if the paintGUI.py does not in the directory, it should not create the icon?
Currently the icon is still present and unless if I click on it, an error will occurs stating '# ImportError: No module named paintGUI # '