![]() |
|||||||||||
|
|
|||||||||||
|
January 22nd, 2009
abScriptMenu 1.5![]() This script allows you to create a menu item in the Maya UI that contains all of your scripts, organized however you want. Initial SetupOnce you've copied the script to your scripts folder, open up your userSetup.mel file and add the following line:
This will automatically add the menu item to Maya main menu bar on startup. It won't show up until you add some scripts to it and build a menu, though. Add Some ScriptsYou can add scripts to your menu in two ways. The first is to click the "Add Script Folder" button and select a directory that contains .mel or .py scripts. The directory will be scanned and any scripts that are found will appear in the "Scripts" textScrollList. Note that scripts ending in "template" are ignored. You can also add scipts individually by clicking the "Add A Single Script" button. Fill in the name for the menu item (eg: "my script"; how you want it to appear in the menu), the name of the script file (eg: "myScript.mel"; don't include the path), and the procedure in the script that you want to call (eg: "myScript"; most times this will be the name of the script minus the extension). Note that your script menu won't be updated automatically when you add new scripts to one of the specified script paths, even when you restart Maya. You have to first open the abScriptMenu UI (accessible from the menu), click "Rescan Folders", and then click the "Save And Build Menu" button. And Build A MenuOnce you've got some scripts in the scripts list you can build your menu. Click the "Save And Build Menu" button and you should see a new menu named "Scripts" on your Maya menu bar. Open it and you'll see all of the scripts that you've loaded into the UI. Changes that you make to items in the scriptMenu UI won't show up or be saved until you click the "Save and Build" button. If you've made a bunch of changes without saving and you want to revert to your current menu configuration you can click the "Load Menu" button and the last saved state will be loaded into the UI. GroupsIt's nice to have scripts in a menu, but eventually you accumulate enough of them that you need some organization, and that's where groups come in. Groups are basically submenus in your script menu that contain any scripts that you associate with them. You create groups with the "New Group" button and remove them with either the "Remove Group" button or by selecting one and hitting the delete key. You can assign scripts to groups in two ways. The first is by selecting a group in the group list. Once selected, all of its member scripts will be highlighted in the script list. As long as there is a selection in the group list, any selection changes you make in the script list will either assign or remove those scripts from that selected group. Note that you can hold down the control, shift or alt keys to modify the selection style. You can also add scripts to a group using the popup menu in the script list. First make sure nothing is selected in the group list (otherwise any selection that you make in the script list will assign those scripts to the selected group). Then select one or more scripts in the script list, right-click and choose a group from the menu. Note that the "Ignored" group is a special group which can't be deleted. Any scripts assigned to it won't appear on the menu. Script PropertiesBeneath the script list are four textFields that are enabled when you have a single script selected. The display name is the unique name for the script as it will show up in the menu. The script textField indicates the name of the script file associated with this entry, and the group is the group that the script a member of, if any. The "Proc To Call" field specifies which procedure in the script will be called. Usually this is the name of the script minus the extension, but not always. Sometimes you might need to run the entire script file, and not just a procedure withing it. In that case, you can include the source statement in the field, like so:
Modifier KeysClicking on menu items in the main script menu with the different modifier keys performs different functions. Control+Click: Will source your script before running. Note that scripts will be sourced automatically if the procedure doesn't currently exist in Maya's mighty memory. Alt+Click: Will open Mel scripts in your default editor. Python files open in notepad (I know, it sucks, but they would be run if they were just loaded). This feature is Windows only at the moment, but if you send me the system commands for your OS I'll include them. Control+Alt+Click: Creates a UI for each individual argument of a Mel procedure call. If the procedure doesn't have any arguments it will be run and the UI will be skipped. You can specify the names of the arguments by adding them in brackets immediately after the closing parenthesis of the procedure. Separate them with commas and don't include quotes. Here's an example of how the "Proc To Call" syntax might look:
Oh, And Uh...Double clicking a script folder path in the script list will open that folder. Double clicking a script in the script list will run it and alt+clicking it will open it in your text editor. Scripts added with the "Add Single Script" button can be deleted from the script list by selecting them and hitting the delete key. You have to hit it really hard, though. Scripts added with the "Add Script Folder" button can only be removed from the script list by removing their directory from the import list with the "Remove Folder" button. That's it. I hope you find it useful, and, as always, feedback is super fine. Updates
01.31.09: v1.3: Fixed python script launching; fixed spaces in names selection issue; single strings are now stripped of quotes in custom UI. 02.03.09: v1.4: Fixed issue where python scripts would show up twice in script list. 03.10.09: v1.4.1: "Load Menu" button will now respect user added scripts. Added script group optionMenu to Add Script UI. This is a maintenance update. The next version (with lots of changes and new features) is sitting half completed on my hard drive. I hope to soon get some time to finish it. 09.24.09: Still not the new version, but improved nonetheless. Now if you add an "*" in front of the procedure in the "Proc To Call" field (in the config UI) the selected script will always open with the prebuilt UI. Also added "Script Quick Search" to the main scriptMenu. Use it to search for scripts with a text string. You can click a script in the result list to launch it, or, if there's only one script result, hit enter (from the search text field) and it will launch. about this post
"abScriptMenu 1.5" was posted on January 22nd, 2009 under Mel Scripts. It was created using Maya.
This entry was last updated on September 24th, 2009. next entryprevious entry |
|||||||||||
comments
Hi!! Thank you for sharing this scripts!!! For year I used ClipFX (with some modifications) but I think abScriptMenu is going to be the "New One" I only have 2 little suggestions: -Reorder (groups and scripts, to organize them not only alphabetically) -Separators (to organize them even more) Thanx again.
Hey Ruben,
Thanks, those are both good ideas. I'll see what I can do.
Really a versatilit\y script,thx!
wow, this is nifty...
I'm a big fan of your scripts. If I can suggest something that would be checkboxes to swap modifiers (ctrl/alt) - but more so everyone knows there are shortcuts to source/open the script and list all available folders in MAYA_SCRIPT_PATH to choose from. Thank you
That's a good idea, ft. I'll add an option to configure the modifiers in the next version.
Another very handy script. Thankyou.
What if we have a mel that contains different procs that we need to run? eg I have a parentShape script that contains a parentShapePreservePos() and a parentShapeMoveToPos(). The two procs work like a front end for the main code and save me having to use cmd-line aguments. Can I have more than one instance of a script in abScriptMenu, so that I can differenciate the Proc To Call?
thanks again.
djx,
Yes, you can have multiple procs in the script list for a given mel file, they just have to have unique display names.
In your case you'll get the first entry automatically when the script scans your script directories. You'll want to change the default proc to whichever procedure you want to call (e.g. parentShapePreservePos()), and update the display name to reflect that. Once that's done, you can add the second proc (parentShapeMoveToPos()) using the "Add Single Script" button.
Excellent. Thankyou.
its should be located in the main menu bar? is that right? main menu bar is where i have window, display, select ...?
Yes, it should appear near the right side of your main menu bar. If it doesn't, try running the following in your command line:
source abScriptMenu.mel;abSMbuildMenu();
which should add a new menu item to your main menu bar (called "Scripts"). Let me know if that doesn't work.
it does not work. there is no new menu called scripts. os vista 64 max 64 icq:223429090
ops i wrote max. i mean maya
Hey Marco,
I don't know why it's not working for you. I actually just set up a vista 64 machine with Maya 2008 and the script works without a hitch.
Make sure the script is in your script path, and that you run the source statement (that I gave two posts above this one) in the command line or script editor as mel (not python).
If you're doing all of that and it still doesn't work, I don't know...
This is brilliant. It helped me overcome Maya's disability to understand my problem in mirroring weights. Thanks a ton.
hey thanks for the script. where do i creat userSetup.mel?? I dont see one and i know how to make the file but just totally forgot where i should put.
thanks
Hey Sean,
My userSetup.mel is in my mayaVersion\scripts directory. I think it can go anywhere in your scriptPath, though.
hey crumbly, i always have problems with this userSetup.mel for years...maybe i am really that good with mel scripts. What i did was that i created userSetup.mel and wrote "source abScriptMenu.mel;abSMbuildMenu();" in it. still not working...
is there a way to make this menu script to work when i put mel scripts in each folders? not just dump them all to the "scripts" folder? (ex. maya\2009-x64\scripts\cometScript)
the only script that i put in 2009\scripts\ is your abScriptMenu, and rest of other scripts....i put them in separate folders which are also in the same scripts folder..
thanks..this is a really good script to get organized :)
Hmmm, I'm not sure what the problem is with your userSetup.mel. Have you installed bonusTools? It writes to the userSetup.mel too. Maybe that's why I have one (not sure).
The script will work with mel scripts in folders in your scripts directory. The problem is that you'll have to specify each one in the scripts text window, so it's sort of a pain. I generally throw all my scripts into a couple of different folders -- when I wrote the script I didn't account for scanning sub directories.
waaaaahhhh nice script you got here very usable, thanks
PS would it be possible to add an icon button(would asign an icon to the shelf and or an add to shelf button.
Hey Bertmac,
Maybe I'm not understanding, but if you hold control+alt+shift and click on a script in the menu it should be assigned to your shelf. Is it not working that way for you?
go on, say it