View Full Version : Trying to make xray on/off hotkey, need help
4dartist 10-30-2002, 01:22 AM I tried copying the command from the script window when i turned on and off the xray mode but it had stuff about the current camera in it and wouldn't work right. This is the short of what i tried lol, but all in all i couldn't get it to work.
I guess ultimatly i would like a hotkey to toggle on and off xray OR one key to turn on and one to turn off xray mode. i would rather not use a shelf button but if i have too i can do that too.
Bonus question: hey if any of you know lightwave, is there anyway i could make a button like lightwave's tab? Toggles on and off , subD
I almost had it but it would leave the poly version under my subD when i hit the hotkey.
Thanks for anyhelp, not to good with mel stuff yet. thanks!!!
|
|
Heinrich
10-30-2002, 01:33 AM
http://forum.simplymaya.com/showthread.php?s=&threadid=1735
Try going to SimplyMaya .co.uk. They know everything(almost)!
4dartist
10-30-2002, 01:42 AM
Holy cow!!! damn your fast hehe, thanks so much, i made the keys and they work like a charm!!!
THanks again !
dmcgrath
10-30-2002, 06:48 AM
This is what I use, I actually make shelf buttons all over the place. But the hotkey editor works as well.
I just made it so it turns all the model panels Xray on and then Xray off with diferent buttons.
you can copy and paste to make a shelf button:
//Xray off
modelEditor -e -xray 0 modelPanel1;
modelEditor -e -xray 0 modelPanel2;
modelEditor -e -xray 0 modelPanel3;
modelEditor -e -xray 0 modelPanel4;
//Xray on
modelEditor -e -xray 1 modelPanel1;
modelEditor -e -xray 1 modelPanel2;
modelEditor -e -xray 1 modelPanel3;
modelEditor -e -xray 1 modelPanel4;
if you ever need to know anything that is happening in the background, you can turn on "Echo all commands" in the script editor. But dont run maya all the time with this on, because you will eventually notice things slowing down.
dwalden74
10-30-2002, 09:05 AM
Perhaps a better way would be first to query the active viewport:
string $currentPanel = `getPanel -wf `;
..then toggle xRay in that viewport. IŽve got this same script mapped to my alt+x keys...very useful.
:beer:
david
dmcgrath
10-30-2002, 08:28 PM
It is certianly cleaner mel scripting that way. I did mine so it would turn them all on or off accordingly. I switch views so much that this way the better way for me. Now we have like three or four different ways to do this. That's one of the reasons I like Maya so much.
bigfatMELon
10-31-2002, 03:22 AM
Make it 5 and this one I guarantee is the easiest.
Download togglemania from highend3d, run it, and pick the toggle you'd like to have created for you from the list.
-jl
MasonDoran
10-31-2002, 11:12 AM
dwalden, so how does the script look like if you want to toggle between view modes? what is the script for toggling...i dont have any more shelf space and i am already using lots of hotkeys....and i would like to toggle isolate select. toggleMania doesnt support isolateSelect.....
dwalden74
10-31-2002, 11:27 AM
so how does the script look like if you want to toggle between view modes?
..not sure I understand what you mean here. Anyway, the script I use is:
global proc dwXray()
{
string $panel = `getPanel -wf`;
//use this next line to be sure it's a model panel and not a outliner orother panel
if ( "modelPanel" == `getPanel -to $panel` )
if (`modelEditor -q -xray $panel` == 1)
modelEditor -e -xray 0 $panel;
else
modelEditor -e -xray 1 $panel;
}
enjoy-
david
webster
10-31-2002, 11:31 AM
Hi,
try toggletools on www.highend3d.com ,
YouŽll download a text-file with different very (for me) useful commands (toggle: grid, nurbs curve vis, nurbs vis, poly vis, template etc.
is it what You want ?
IMPORTANT: I donŽt remember where the scripts are from, IŽve just adaptet it.
There are also a lot of tools on highend about hotkey-toggles
Here i got it for You:
Name: Toggle_Template
Description: Toggle_Template
Category: User
Command: toggle -te
Pref. Hotkey: CTRL - <
Name: Toggle_Grid
Description: Toggle_Grid
Category: User
Command: $currentPanel = `getPanel -withFocus`;
string $panelType = `getPanel -to $currentPanel`; if ($panelType == "modelPanel") {
modelEditor -e -grid ( !`modelEditor -q -grid $currentPanel` ) $currentPanel; }
Pref. Hotkey: CTRL - y
Name: Toggle__X_Ray
Description: Toggle__X_Ray
Category: User
Command: $currentPanel = `getPanel -withFocus`;
string $panelType = `getPanel -to $currentPanel`; if ($panelType == "modelPanel") {
modelEditor -e -xray ( !`modelEditor -q -xray $currentPanel` ) $currentPanel; }
Pref. Hotkey: CTRL - x
Name: Toggle_Visibility_NURBS_Curves
Description: Toggle_Visibility_NURBS_Curves
Category: User
Command: $currentPanel = `getPanel -withFocus`;
string $panelType = `getPanel -to $currentPanel`; if ($panelType == "modelPanel") {
modelEditor -e -nurbsCurves ( !`modelEditor -q -nurbsCurves $currentPanel` ) $currentPanel; } ;
Pref. Hotkey: CTRL - c
Name: Toggle_Visibility_NURBS_Surface
Description: Toggle_Visibility_NURBS_Surface
Category: User
Command: $currentPanel = `getPanel -withFocus`;
string $panelType = `getPanel -to $currentPanel`; if ($panelType == "modelPanel") {
modelEditor -e -nurbsSurfaces ( !`modelEditor -q -nurbsSurfaces $currentPanel` ) $currentPanel; } ;rrentPanel` ) $currentPanel; } ;
Pref. Hotkey: CTRL - v
Name: Toggle_Visibility_PolyMeshes
Description: Toggle_Visibility_PolyMeshes
Category: User
Command: $currentPanel = `getPanel -withFocus`;
string $panelType = `getPanel -to $currentPanel`; if ($panelType == "modelPanel") {
modelEditor -e -polymeshes ( !`modelEditor -q -polymeshes $currentPanel` ) $currentPanel; } ;
Pref. Hotkey: CTRL - b
Name: Reveal_Selected_in_Outliner
Description: Reveal_Selected_in_Outliner
Function: Opens all the hierarchy in a Group until the selected Objects
All other Groups remain closed
Category: User
Command: outlinerEditor -e -sc 1 outlinerPanel1;
Pref. Hotkey: Alt - y
dwalden74
10-31-2002, 11:32 AM
oops, sorry. I forgot the extra brackets after the first "if" statement, but you get the idea...
:beer:
david
MasonDoran
10-31-2002, 11:45 AM
how does one toggle Isolate Select?
dwalden74
10-31-2002, 12:02 PM
Looks pretty simple. Turns on showAllCommands in the script editor, and go from there!
:beer:
-david
Originally posted by 2byts
how does one toggle Isolate Select?
This was a bit trickier than the other ones (Yup, I've made all those toggle's too ;)), but here are the few lines to add to a button or anything.
string $theNameOfTheCurrentPanel = `getPanel -wf`;
if (`isolateSelect -q -state $theNameOfTheCurrentPanel`)
{
enableIsolateSelect $theNameOfTheCurrentPanel 0;
isolateSelect -state 0 $theNameOfTheCurrentPanel;
}
else
{
isolateSelect -state 1 $theNameOfTheCurrentPanel;
enableIsolateSelect $theNameOfTheCurrentPanel 1;
}
MasonDoran
10-31-2002, 03:23 PM
:applause:
awesome!!...i tried it myself...but i dont so much about mel
:applause:
k2skier
11-04-2002, 10:29 PM
you can make hot keys for just about anything, a great way to find out the syntax or verbage for what you want to do is to do it with the menu's then look at the script editor and it should have all you need. Then you just go into the pref's and hot keys and set up a new one.
CGTalk Moderation
01-13-2006, 08:01 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.