View Full Version : multiple function in one hotkey
InnerVortex 11-29-2002, 01:35 AM 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
|
|
pearson
11-29-2002, 07:50 AM
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:
Mikkel Jans
11-29-2002, 12:18 PM
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.
InnerVortex
11-29-2002, 09:32 PM
thanks ALOT MJ:D
it works so sweetly now;)
Jozvex
11-29-2002, 11:34 PM
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.
pearson
11-30-2002, 11:56 AM
@ 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.
bjoern
12-01-2002, 10:48 PM
thaaaaaaaanks Mikkel :)
bjoern
tropistic
12-17-2002, 01:01 AM
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
pearson
12-17-2002, 03:22 AM
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?
kpalazov
12-17-2002, 08:21 AM
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
vaniljus
12-17-2002, 02:25 PM
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];
}
pearson
05-01-2003, 08:24 AM
Is anybody still interested in this? I figured out how to get different marking menus to pop up based on what is selected.
vaniljus
05-01-2003, 11:55 AM
sure, I like to know how it is done..
pearson
05-01-2003, 08:40 PM
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!
CGTalk Moderation
01-13-2006, 10:00 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.