Thread: Shortcuts?
View Single Post
# 2 31-12-2006 , 09:39 AM
enhzflep's Avatar
Subscriber
Join Date: Oct 2006
Location: Melbourne
Posts: 313
Thanx for the tip about the track tool - my mate with a laptop will be thrilled..

As for the shelves, if you goto Window->Settings/Prefferences->Shelves you'll get the shelf editor. The currently selected shelf is open in the window as defalt.

If you want to clear out the general tab of all the unnecessary stuff then just delete what you don't want.

On the other hand, if you want to add the button to your own shelf there's a number of ways you can go about this.
In any case, you should select the shelf you want to use first.

1) In the case of the command having a menu option you can hold ctrl-shift while you select the menu option. This will even give you an icon in most cases..

2) In the event that there doesn't seem to be a menu option, or for custom code (like the Xray script) you need to get the commands up to the shelf using the script editor. Open the script editor, and if you know the name of the command, type it in, highlight it, an then middle-mouse drag it up to the shelf - note that LMB+RMB wil work for dragging and dropping in many cases in Maya.

Another thing that's handy to know is that everytime you press a button, you can have the command echoed in the top panel of the script editor. Great for creating shelf icons for obscure commands hidden several menus deep.

As for the XRay stuff, I use two different scripts myself. One to toggle xray for everything, another to toggle xray for the selected objects only. Each has it's advantages. Just drag each to the shelf from the script editor.

Code:
///////////////////////////////////
// Xray selected obects only
///////////////////////////////////
string $sel[];
int $temp_var[];
int $value;

	$sel = `ls -sl -dag -ap -typ surfaceShape`;
	
	for ($obj in $sel)
	{
		$temp_var = `displaySurface -q -xRay $obj`;
		$value = $temp_var[0];
		if ($value == 1)
			displaySurface -xRay 0 $obj;
		else
			displaySurface -xRay 1 $obj;
	}

///////////////////////////////////
// Xray everything
///////////////////////////////////
int $xraystat;
$xraystat = eval("modelEditor -q -xray modelPanel4");
if ($xraystat == 1) $xraystat=0;
	else $xraystat=1;
modelEditor -e -xray $xraystat modelPanel1;
modelEditor -e -xray $xraystat modelPanel2;
modelEditor -e -xray $xraystat modelPanel3;
modelEditor -e -xray $xraystat modelPanel4;
As for the icons, I just made some red cubes up and then did screen shots first with one and then with all objects xrayed. Resized to 32x32 and saved with photoshop as bmps. Copy to your icon directory then tell the shelf editor where these icons are, and voila! The grey button with mel dissapears and you've got something positively more descriptive.

Anyway, here's the icons I'm using.
Simon.

Attached Files
File Type: zip xray icons.zip (3.5 KB, 217 views)