« MEL: Setting the value of a Slim attribute | Home | The importance of having an efficient pipeline »

MEL: Find and edit the source of a procedure

By nikos | September 23, 2008

The following script opens a MEL file in a text editor by checking where queried procedure is stored. As an example Notepad is used for Windows and Nedit for Linux.

Usage:
edit “procname”

Limitations:
The script only finds global procedures that have already been sourced

global proc edit( string $file ) {
  1.     string $result = `whatIs $file`;
  2.     string $buffer[];
  3.     tokenize( $result, " ", $buffer );
  4.  
  5.     if (`about -linux`){
  6.         exec( "nedit " + $buffer[ size($buffer)1 ] );
  7.     }
  8.     else if (`about -nt`){
  9.         exec( "notepad " + $buffer[ size($buffer)1 ] );
  10.     }
  11. }

Topics: Maya | No Comments »

Comments are closed.