Home Technical Talk

Maya right click convert to object mode script.

polycount sponsor
Offline / Send Message
malcolm polycount sponsor
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.

Replies

  • Warheart
    Options
    Offline / Send Message
    Warheart polycounter lvl 17
    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.
  • malcolm
    Options
    Offline / Send Message
    malcolm polycount sponsor
    What is grepWin? I tried echo all before posting but I didn't know how to track down the associated mel file.
  • Warheart
    Options
    Offline / Send Message
    Warheart polycounter lvl 17
    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.

    http://tools.tortoisesvn.net/grepWin.html
  • malcolm
    Options
    Offline / Send Message
    malcolm polycount sponsor
    Well that script is way too advanced for me to decipher, do you know what line I can replace to just override that command with another.
  • Warheart
    Options
    Offline / Send Message
    Warheart polycounter lvl 17
    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.
  • malcolm
    Options
    Offline / Send Message
    malcolm polycount sponsor
    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?

    SelectVertexMask;
    SelectToggleMode;
    TranslateToolWithSnapMarkingMenu;
    buildTranslateMM;
    setToolTo $gMove;
    changeToolIcon;
    TranslateToolWithSnapMarkingMenuPopDown;
    MarkingMenuPopDown;
    if (`popupMenu -exists tempMM`) { deleteUI tempMM; }if (`popupMenu -exists tempMM2`) { deleteUI tempMM2; };
  • Warheart
    Options
    Offline / Send Message
    Warheart polycounter lvl 17
    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?
  • malcolm
    Options
    Offline / Send Message
    malcolm polycount sponsor
    That is perfect, thanks!
  • Warheart
    Options
    Offline / Send Message
    Warheart polycounter lvl 17
    Cool, glad to help :)
Sign In or Register to comment.