Wednesday, August 6, 2014

Call MEL with return in Python

Hi,

Hope this is helpful.

//MEL
global proc string[] nozo(string $a, string$b ){
return {$a,$b};
}
//nozo("great","day")

#Python

import maya.mel as mel

#calling a Mel function in python
cmd = "nozo"
arg1 = '"Great"'
arg2 = '"Day"'
melCallString = "%s(%s,%s)" %(cmd,arg1,arg2)
print melCallString
#####

result = mel.eval(melCallString)
print result
#['Great', 'Day']


(Note its probably cleaner to write all the code in Python)

cheers,
Nate