View Full Version : move tool (local world) mel script
I want a tool that switches between local and world space
At the moment I have two buttons....and now I want one :)
the commands are:
manipMoveContext -e -mode 2 Move;
and
anipMoveContext -e -mode 0 Move;
My problem is that I don't know how to control which option is actually used.
Anybody knows how I can do this? I want one button on my shelf, if I press it and it is local on it should switch to world, if world is on it should switch to local
|
|
svenip
06-07-2002, 01:44 PM
make an if statement where you question the mode
float $test;
$test = manipMoveContext -q -mode;
if($test == 2)
....
if($test == 0)
....
or put the question right into the if
---=== edited ===---
the help actually says that you must specify one
manipMoveContext -q -mode manipMoveContext1;
Originally posted by svenip
the help actually says that you must specify one
manipMoveContext -q -mode manipMoveContext1; [/B]
and this does mean what?
svenip
06-07-2002, 03:56 PM
manipMoveContext -q -mode Move; this one asks for the Move Tool and so on. it means you have to specify which transformation tool.
bigfatMELon
06-07-2002, 06:10 PM
Since you are toggling (and hense, testing for) values that are either zero or something greater than zero, the following works.
if(`manipMoveContext -q -mode Move`)
manipMoveContext -e -mode 0 Move;
else
manipMoveContext -e -mode 2 Move;
This is because true, on, 1 and false, off, 0 are equal boolean constants within each of their respective sets (ie: they mean the same thing). It also happens that any value greater than 1 also equates to boolean true.
Specifying the context name as Move appears to work perfectly as well.
-jl
thx very much to both, works fine :):thumbsup:
bigfatMELon
06-07-2002, 10:15 PM
After goofing around with this I find that I like the following script the most:
int $test = `manipMoveContext -q -mode Move`;
switch ($test){
case 0:
manipMoveContext -e -mode 1 Move;
break;
case 1:
manipMoveContext -e -mode 2 Move;
break;
case 2:
manipMoveContext -e -mode 3 Move;
break;
case 3:
manipMoveContext -e -mode 0 Move;
break;
}
It will increment the state of the move tool through each of it's contexts.
-jl
CGTalk Moderation
01-13-2006, 07:00 AM
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.