PDA

View Full Version : easy one: controlling tools through Mel


mynewcat
01-05-2011, 03:58 PM
Coming from Max, I have set up a little script that lets me move through the coordinate systems

eg. move along an object's local axis or the world axis etc.

I have these set to keys alt-1 through 3 - in Max it's pretty simple, as you can bind these directly to a key.

The only way II could think to do it in Maya was to make some Mel script that goes a little like this

manipMoveContext -e -mode 1 Move;
// Result: Move //
manipMoveValues Move;
manipRotateContext -e -mode 0 Rotate;
// Result: Rotate //
manipRotateValues Rotate;
print ("LOCAL COORDINATES");

The only thing is, this only works when the tool settings are open - I can make that happen, but I don't want to display the tool settings window every time I change my coordinate system.

Can anyone help me out?

cheers

NaughtyNathan
01-05-2011, 04:07 PM
don't bother. use Maya's marking menus, they are much better and more fluid than binding endless hotkeys once you get used to using them.

simply hold down the appropriate key for the tool you want to adjust (i.e. w key for the move tool) then hold down the LMB to open the Move options Marking Menu. the thing is, once you know the direction of the item you want, you can just LMB-stroke in that direction, you don't need to wait for the MM to appear. for changing axis system you want: stroke-downleft/southwest

:nathaN

goleafsgo
01-05-2011, 09:03 PM
I agree with what Nathan said but wanted to add one thing...

For what you are actually trying to do you shouldn't need the tool settings window open. I'm guessing that you copy/pasted some stuff from the script editor and picked up some lines that were specific to the tool settings window...but when you make the manipMoveContext call to edit the move tool the settings window will pick up the change without you have to call manipMoveValues.

mynewcat
01-06-2011, 11:57 AM
don't bother. use Maya's marking menus, they are much better and more fluid than binding endless hotkeys once you get used to using them.

simply hold down the appropriate key for the tool you want to adjust (i.e. w key for the move tool) then hold down the LMB to open the Move options Marking Menu. the thing is, once you know the direction of the item you want, you can just LMB-stroke in that direction, you don't need to wait for the MM to appear. for changing axis system you want: stroke-downleft/southwest

:nathaN

Brilliant - this is a great tip thanks.

I realise that when going from one package to another you should try and learn that package as best as possible - but the way I have it configured in Max is non standard and suits me best.

This is one of those cases where I genuinely want to do it my own way, as it's one of those things that has become so instinctive it feels wierd not to work that way.

And after all - one of the great strenghts of Maya is that it is supposed to be customisable!

mynewcat
01-06-2011, 12:03 PM
I agree with what Nathan said but wanted to add one thing...

For what you are actually trying to do you shouldn't need the tool settings window open. I'm guessing that you copy/pasted some stuff from the script editor and picked up some lines that were specific to the tool settings window...but when you make the manipMoveContext call to edit the move tool the settings window will pick up the change without you have to call manipMoveValues.

You have guessed correctly.

The error I am getting is:

// Error: Object not found: |manipMove.

And it only happens when the tool window is not open, so I'm not sure what I'm doing wrong.

This is the code from the script editor (script listener?)

manipMoveContext -e -mode 1 Move;
// Result: Move //
manipMoveValues Move;
toolPropertyShow;

The only thing I have removed is "toolPropertyShow;" - but I figure that is at the end anyway, and the command has already been run - and I figured that displayed the tool window anyway, which is what I don't want to do.

NaughtyNathan
01-06-2011, 12:22 PM
the only line you need is:
manipMoveContext -e -mode 2 Move;bin the rest, it's ui stuff, which obviously will only work when the UI is visible.

the fact you work in a non-standard way doesn't worry me (although you're immediately screwed if you ever have to work on someone elses machine/setup!) but the fact that you may be destroying extremely useful existing hotkeys! However, it doesn't look like Alt-1/2/3 may be that useful to you anyway, but anyone who, for example, remaps any of the 4,5,6,q,w,e,r,y,d,g,x,c,v,b keys is just mental.. that's like cutting off three of your fingers in terms of efficiency! ;) )

:nathaN

mynewcat
01-06-2011, 12:59 PM
All very good points.

I think if I was thrown into a situation where I didn't have access to my UI, I now have two options; however, once you reach a certain level of ability in one package, fluency becomes quite important - and I need to keep my speed and flow going!

I did make sure the existing alt-1,2,3 hotkeys were things I could afford to lose.

I will update my scripts, thanks for the help.

ginodauri
01-06-2011, 01:51 PM
the only line you need is:
but anyone who, for example, remaps any of the 4,5,6,q,w,e,r,y,d,g,x,c,v,b keys is just mental.. that's like cutting off three of your fingers in terms of efficiency! ;) )
:nathaN


Maybe not completely change but customize.

This is how my X marking menu looks like:

http://img233.imageshack.us/img233/4402/markingmenu.png (http://img233.imageshack.us/i/markingmenu.png/)

I must say that i never get comfortable with this snapping method , and press realease functionality.

Another thing is that other applications don't support this method , so if you want to make similar functionality in two aplication you must do thing "standard" way.

Similar can be done with G key.You can have there repeat last action,repeat last tool,repeat last action at mouse position etc.

CGTalk Moderation
01-06-2011, 01:51 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.