multiple function in one hotkey


#1

i dunno if thats right… but it believe i saw it before ina post… someone saing that used the same hotkey for multiple funcions… like when pols selected extrude polygons… when edges selected extrude edges. that 2 both with the same hotkey, i tried to do this but i cant…i supose it needs a mel script for that, is there anyway, or can anyone mel an exemple of this pls?
thx


#2

Hmm. Well, I can think of how it could be done, though it is beyond my meager scripting skills to do it.

First, only one mel script can be assigned to a hotkey, so everytime it is pressed it runs the same script. However, if that script first checked to see what was selected, it could then perfom different functions based on the selection.

I just don’t know how to have the script check to see what is selected.:shrug:


#3

I have 4 keys that do about 20 diffrent things based on whats selected.

here’s the script:

if ( size(filterExpand -sm X) > 0 )
{
COMMAND
}

where X is a number which define different selection. See the “Help > MEL Command References” and look for “filterExpand”. Theres a list of numbers you can replace with X.
And COMMAND is the command you want to execute.


#4

thanks ALOT MJ:D
it works so sweetly now;)


#5

Originally posted by pearson
First, only one mel script can be assigned to a hotkey

Actually just yesterday I made a hotkey that brings up the hotbox and toggles the Status Line on at the same time, and all I did was write:

hotBox;
ToggleStatusLine;

in the hotkey editor. So that’s running two scripts with one hotkey.


#6

@ Mikkel - Wow! That is very cool, and so simple, too. I’m going to have to try it. Thanks!

@ Jozvex - Well, technically, what you did was write a single mel script with two lines in it and then assigned that single script to a hotkey. The fact that your script calls other scripts when it executes just shows the power of mel.


#7

thaaaaaaaanks Mikkel :slight_smile:

bjoern


#8

Stupid but related question for setting up hotkeys, what would be the syntax for a command to access individual functions within MJ Poly Tools, like for example, the Select Ring function?

Jay


#9

So, does anyone know how to call a marking menu through mel? I can set the marking menu to a key, but I can’t seem to do it with mel (I have to use the Hotkey window).

I would really like to have a different Marking Menu pop up depending on what is selected.

Can anybody help with this?


#10

I had axactly the same question before the forums went down for a while. This would be a great addition to maya for any user.
Any help would be greatly appricated.

thanks

take care

Kiril


#11

Nice script Mikkel Jans

But I like it to select the new history node too.
How do I do that?

/Vaniljus|Noice

EDIT:

Nevermind, I think I got it to work

if ( size(filterExpand -sm X) > 0 )
{
COMMAND
string $sel[]=ls -sl;

string $buffer[];
	$numTokens = `tokenize $sel[0] "." $buffer`;
print($buffer[0]);
select -r $buffer[0];

string $sel[]=`ls -sl`;
string $shape[]=`listRelatives -s $sel[0]`;
string $input[]=`listConnections -s true -d false $shape[0]`;
select -r $input[0];

}


#12

Is anybody still interested in this? I figured out how to get different marking menus to pop up based on what is selected.


#13

sure, I like to know how it is done…


#14

OK. Make the marking menus you want, say one for faces, one for edges, etc. For all of these menus, where it says “Use marking menu in:” leave it on “not set”.

The trick is to make another MM and set it to work in the hotkey editor. Don’t put any functions in it. Then, in the hotkey editor, underneath “user”, there will be “userMarkingMenus”. Edit the [yourmenuname]press and delete the 3rd line, which should say: source "menu[yourmenuname]";

This is where you put your check for what is selected:


if ( size(`filterExpand -sm X`) > 0 )
   source "menu_[facesmenuname]";

else if ( size(`filterExpand -sm Y`) > 0 )
   source "menu_[edgesmenuname]";

Here you can set a MM to display if you have nothing (or anything other than “X” or “Y”) selected:


else
   source "menu_[defaultmenuname]";

or you could have it do nothing:


else
   deleteUI tempMM;

Now just set [yourmenuname]_press to a hotkey, and let it hook up the release for you, and you’re all set!


#15

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.