Maya ~= Autocad|Rhino II

Maya ~= Autocad|Rhino II

AutoCAD/Rhino command line aliases-like behaviour in Maya 2011 with custom command + hotkey


//20100418 ec @ studiounit6
if ( `window -exists customCommandUI` ) {
deleteUI customCommandUI;
}
string $window = eval("window -t \"command\" -tb 1 -tlb 1 -s 0 -widthHeight 105 25 customCommandUI");
rowColumnLayout -numberOfColumns 2 -columnAttach 1 "right" 0 -columnWidth 1 90 -columnWidth 2 15;
//text -label "command";
$testCommand = `textField -aie 1 commandUI`;

//textField -edit -enterCommand ("ecRunCommand()") $testCommand;
textField -edit -rfc ("ecClearCommand()") -enterCommand ("ecRunCommand();evalDeferred \"deleteUI customCommandUI\"") $testCommand;
//button -label "X" -command ("deleteUI -window " + $window);
button -label "O" -command ("ecRunCommand();evalDeferred \"deleteUI customCommandUI\"");
showWindow $window;
window -edit -widthHeight 105 25 $window;

global proc ecRunCommand(){
$statement = `textField -q -tx commandUI`;
eval($statement);
}
global proc ecClearCommand(){
eval("textField -edit -tx \"\" commandUI");
}

Leave a Reply

Your email address will not be published. Required fields are marked *