Wednesday, June 25, 2008

Unhide those Controllers!!

Was doing a bouncing ball for the warm up, so had all the keys in and the timing laid, was abt to do a playblast. When my brain had a delusion that i had a script or knew a shortcut to hide n unhide the controllers on the characters. Looked for it but not a script of that sort on the Shelf so Opened the Hotkey Editor n went through all the shortcuts. Nothing here either.




I thought what the heck, lets make a new shortcut, so under Display in the Hotkey Editor, i found HideNurbsCurvs n to my surprise it didnt have a shortcut assigned, haha how silly of me, so i assigned a shortcut n voila!!
Time to test the shortcut. So i selected the control curves on my character, not that it matters, n used the shortcut. Strangely not only the Nurbs Curves but the Surfaces also disappear. I thought i had done something wrong, opened the hotkey editor once again, checked everything, tried it again. Still the same. So then i thought ild open up the Script Editor and copy the command that comes up in the GREY area of the script editor when i click on the Hide NURBS Curves under the Show Menu. But the command doesnt come up when i click on Hide NURBS Curves.
So i searched in google, on various blogs n asked my friends, if there was a script or any other way to get this done. So then Ratul pointed out that i can used the command that comes on the command line n then add it to the shelf. Been there done that, didnt work. Told him why. Thats when he pointed out somethin called Echo All Commands under the History Menu in the Script Editor. What this baby does is give out codes for any thing we do on the Maya Screen, even a single click anywhere. So with this turned on i got the command
modelEditor -e -nurbsCurves 0 modelPanel4;
This is the code that runs in the background each time we open up the Show Menu n uncheck NURBS Curves.
So i added this to the shelf editor simply by turning of the Echo All Commands option n then highlighting it in the Grey Area and choosing the option Save Script to Shelf under the File Menu of the Script Editor and named it Hide Controllers.
Now to turn the Controllers back on the code is
modelEditor -e -nurbsCurves 1 modelPanel4;
Added this to the Shelf and named it Unhide Controllers.
Now to give the shortcut what we can do is open up the Hotkey Editor, n click ont the NEW button down on the right side and then paste the command n give it a name. Now click on Accept n it comes up at the top. NOw we can assign it a shortcut we like.
But since most of the keys are already reserved for shortcuts for various commands, what i did was make a Marking Menu. Here's how
Since we already have the two Scripts on the Shelf, we open the Marking Menu Editor

Now when the Marking Menu comes up, we click on Create Marking Menu in the middle. We'ld get a big popup called Create Marking Menu window. Now at the top part of the window there are 9 squares arranged like the Hotkey option we get on pressing space. Those squares are the positions where the commands we want wud come.So i middle click on the Hide Controllers script n drag it on the the position i want it in n let go. Same for the Unhide Controllers.And name the menu as Hide_Unhide_Controllers.CLick Save and close the window.When we click on close, the name Hide_Unhide_Controllers comes in the list of Marking Menus. Over there at the bottom under Settings Use Marking Menu In Hotkey Editor. This is important, so make sure you dont miss it.The other option being Hotbox, which wud get these options coming up when u press the space key n the mouse button in the region u select.Now click on Apply Settings.Now lets go back to the Hotkey Editor to add a shortcut to tell Maya to bring up the options.Once you've the Hotkey Editor open, scroll to the bottom under Categories,
uld see User Marking Menu. If u dont have any other marking menu created before then uld get 2 commands, unlike mine, one for the "Name u gave to the Markin Menu" Press and the "Name u gave to the Marking Menu" Release.Select the Press command and assign a shortcut. Uld get a popup which maya will ask to confirm for the Release, just press Accept. Then click on Save n Close the Hotkey Editor.Now press the shortcut key u assigned n the left mouse button,n voila! The two options to help u. This way u can add watever commands or scripts u like n increase ur speed n reduce the no of clicks.

Hope i was clear enough n helpful.Lemme know if u find anythin wrong..
Back to the drawing board..
cheers n adios!!

0 comments: