Home Technical Talk

Maya : Creating toggles

sublime tool
Offline / Send Message
Fansub sublime tool
Hello :)

Any buddy here knows how to create toggles between commands in Maya ?

I have the edge loop,edge ring and "Off" selection constaints that i want to be in one hotkey using a toggle command,just like this for the Move Tool :

string $currentTool = `currentCtx`; 
setToolTo $gMove;
if ($currentTool == "moveSuperContext")
setToolTo $gRotate;
else if ($currentTool == "RotateSuperContext")
setToolTo $gScale;
Here are the different selection constraints in Maya,from the Modeling Toolkit :
dR_selConstraintEdgeLoop;
dR_selConstraintEdgeRing;
dR_selConstraintOff;
I have already tried some simple copy/paste things but I'm just starting to learn Mel scripting so don't really know how some of these things work (especially the SuperContext that i don't understand and couldn't find any documentation of it)

In the long run creating my own toggle between X commands is what i want to do,but for now solving this issue will certainly help me understand how to do so.

Thanks,Fansub :)

Replies

  • DireWolf
    Options
    Offline / Send Message
    I don't think there's a way to query current dr tools.

    We could store a global int and use that to switch tools. The first time you run it, it will always start at 0 tho instead of toggling based on current mode.
    global int $dr_count;
    switch($dr_count) {
    case 0:
        print "Mode: EdgeLoop";
        dR_selConstraintEdgeLoop;
        break;
    case 1:
        print "Mode: EdgeRing";
        dR_selConstraintEdgeRing;
        break;
    case 2:
        print "Mode: None";
        dR_selConstraintOff;
        break;
    default:
        $dr_count = 0;    
        print "Mode: EdgeLoop";
        dR_selConstraintEdgeLoop;
        break;
    }
    $dr_count++;
    
  • Fansub
    Options
    Offline / Send Message
    Fansub sublime tool
    Thanks ! ! ! :D

    Tried the script and it works just like i wanted it to :)
Sign In or Register to comment.