1

I am new to Maya scripting and I am asked to convert the below MEL to Python.

I've been searching for all the commands in Mel and everything seemed to be fine, except the two terms ## followObject_setup and followObjectExpr ## in the below script.

Can someone explain me, what is this.

Thanks in Advance

global proc newPointBlast_Follow()
{
/*
    Function to get the point from selection and camera from view.
    Attach the camera to point.
*/
global string $followingCamera[];
global string $object_to_Follow[];

undoInfo -swf off;

string $currentPanel = `getPanel -wf`;
string $type = `getPanel -typeOf $currentPanel`;
if ( $type == "modelPanel" ) 
    { 
        $followingCamera[0]  = `modelPanel -q -camera $currentPanel`; 
    }

$object_to_Follow = `ls -sl`;
if ( `size( $object_to_Follow )` == 0 ) 
    { 
        confirmDialog -title "No Object selected" -message "Please select an Object or Vertex to Follow" -button "OK"; }

else
{
    newPointBlast_unlockImagePlanes();

    if ( `objExists followObject_setup` )
    {
            delete followObject_setup;
    }
    if ( `objExists followObjectExpr` )
    {
            delete followObjectExpr;
    }

What is the meaning of the last if statements?

Pradeep
  • 116
  • 11

1 Answers1

0

It is some variables that has been defined somewhere else.

In maya, if you type in MEL :

whatIs followObjectExpr
whatIs followObject_setup

if it return None, it is not a proc or something belonging to maya

otherwise if you cant to convert your commands roughly in python, you can use the command below to convert a mel string :

import pymel.tools.mel2py as mel2py
text = raw_input()
print(mel2py.mel2pyStr(text, pymelNamespace='pm'))

or you can use this to convert a mel file :

import pymel.tools.mel2py as mel2py

mel2py.mel2py('/path/maya20XX/scripts/others/doWrapArgList.mel',
                '/path/myfolder/doWrapArgList/')
DrWeeny
  • 2,487
  • 1
  • 14
  • 17