Anyone know where I can find the mel script that is run when I right click on a model and choose object mode. I'd like to replace that script with something that has better functionality but I'm not sure how to track down that command.
I think what you're looking for is "maintainActiveChangeSelectMode" it can be found in: C:\Program Files\Autodesk\Maya2011\scripts\others\dagMenuProc.mel
"Echo All Commands" + grepWin is how I usually find this type of stuff.
It's an open source tool for searching text file contents. So after you find the name of the procedure you're interested in then just point grepWin to the folder you think it'll be in and have it search for the name of the proc.
hmm I suspect it's not going to be as simple as that. What do you want the script to do exactly? I might be able to have a look for you to see what the nicest approach would be.
Edit: Actually since you know that "maintainActiveChangeSelectMode" is going to get called when you do the right "click > object mode" thing, you could just put a call in that function to execute the script you want. I would warn that this is a bit dirty though. Especially because we would be assuming that that is the only way that function is going to be called (might screw up other stuff if it's not). If you did it that way you would also have to ensure that the procedure you are calling was loaded and accessible to be called from there before it was ever called.
Edit again: The actual line where that function gets called is line 1061 (in maya 2011). As far as I can see that is the only place that function ever gets called so if that's the case you'd probably get away with modifying it.
I just want to run this basic script to go to object mode but leave the object selected, maya's ghetto default has bothered me for year. Why the fuck would I want to go to object mode and deselect the object? Like why?
Oh right, that should be very simple then. just replace the contents of the "maintainActiveChangeSelectMode" function with that bit of script. i.e.
global proc maintainActiveChangeSelectMode( string $item )
{
SelectVertexMask;
SelectToggleMode;
}
That should do what you want. I'm not sure I understand the other stuff you were trying to make it do though. Why did you want it to change to the move tool?
Replies
"Echo All Commands" + grepWin is how I usually find this type of stuff.
http://tools.tortoisesvn.net/grepWin.html
Edit: Actually since you know that "maintainActiveChangeSelectMode" is going to get called when you do the right "click > object mode" thing, you could just put a call in that function to execute the script you want. I would warn that this is a bit dirty though. Especially because we would be assuming that that is the only way that function is going to be called (might screw up other stuff if it's not). If you did it that way you would also have to ensure that the procedure you are calling was loaded and accessible to be called from there before it was ever called.
Edit again: The actual line where that function gets called is line 1061 (in maya 2011). As far as I can see that is the only place that function ever gets called so if that's the case you'd probably get away with modifying it.
SelectVertexMask;
SelectToggleMode;
TranslateToolWithSnapMarkingMenu;
buildTranslateMM;
setToolTo $gMove;
changeToolIcon;
TranslateToolWithSnapMarkingMenuPopDown;
MarkingMenuPopDown;
if (`popupMenu -exists tempMM`) { deleteUI tempMM; }if (`popupMenu -exists tempMM2`) { deleteUI tempMM2; };
global proc maintainActiveChangeSelectMode( string $item )
{
SelectVertexMask;
SelectToggleMode;
}
That should do what you want. I'm not sure I understand the other stuff you were trying to make it do though. Why did you want it to change to the move tool?