MEL: Open Mel Script Containing Definition of a Procedure
This procedure opens the original .mel file for the provided procedure name with the associated script editor in the OS. Very helpful when you’re studying original Maya scripts to learn MEL and also when you want to edit a script.
global proc openCmd(string $sCommand) {
string $sCommandType = `whatIs $sCommand`;
string $szBuffer[];
if($sCommandType == "Unknown")
error("Command unknown: "+$sCommandType);
if($sCommandType == "Command")
error("Internal Command. No Script file to Open.");
else if($sCommandType == "Run Time Command")
error("RunTime Command for: " + `runTimeCommand -q -c $sCommand` );
else if(`gmatch $sCommandType "*variable*"`) {
error("String is Variable not Command: "+$sCommandType);
}
if(`gmatch $sCommandType "*found in:*"`) {
tokenize $sCommandType " " $szBuffer;
// print("Opening " + `toNativePath($szBuffer[ size($szBuffer) - 1 ])`);
system("Shell " + `toNativePath($szBuffer[ size($szBuffer) - 1 ])`);
}
}
Discuss - No Comments