Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Python script runs twice from Menu or Hotkey (https://simplymaya.com/forum/showthread.php?t=31314)

thurman 09-11-2008 03:31 PM

Python script runs twice from Menu or Hotkey
 
1 Attachment(s)
I have written a python save increment script for Maya to make the saves compatible with our pipeline. The script itself runs fine, and if run from the script editor, only runs once. When I attach a hotkey and a menu list, the script will run twice, the first time you use it. But only when Maya first starts. After that, it will just run once.

Below are the files I altered to make the scripts run:

userSetup.mel (all on one line):

Quote:

menuItem -p "mainFileMenu" -l "EXC IncSave" -ia "" -c "python(\"import maya_incsave\"); python(\"maya_incsave.IncSave_Execute()\");";
userHotkeys.mel:

Quote:

//Maya Preference 8.50 (Release 1)
//
//

hotkey -keyShortcut "0" -releaseName ("HfAttrSelect_Menu_revert");
hotkey -keyShortcut "s" -ctl -name ("EXC_SaveIncNameCommand");
userNamedCommands.mel:

Quote:

//Maya Preference 8.50 (Release 1)
//
//

nameCommand
TAB-annotation "EXC_SaveIncNameCommand"
TAB-command ("EXC_SaveInc")
TABEXC_SaveIncNameCommand;
UserRunTimeCommands.mel:


Quote:

//Maya Preference 8.50 (Release 1)
//
//

runTimeCommand
TAB-annotation "EXC Save Increment"
TAB-category "File"
TAB-command ("python(\"import maya_incsave\");\r\npython(\"maya_incsave.IncSave_ Execute()\");")
TABEXC_SaveInc;
and finally, attached is the python script, maya_incsave.py: It is called .mel, because I cannot upload a .py file! Please rename it to .py.

Can anyone tell me why this is running twice when Maya 2008 first starts, and then running once every time after?

Thanks.


All times are GMT. The time now is 08:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018