Hi,
This is about passing python vars to mel using an externally sourced
python script in maya 2008:
Simplified example:
import maya.cmds as cmds
import maya.mel as mel
joints = []
for i in range(5):
joints.append(cmds.joint())
def test():
global tmp
for i in range(5):
tmp = joints[i] + '_sum_up_inputs_calc'
cmds.shadingNode('plusMinusAverage', asUtility = 1, name =
tmp)
mel.eval('string $tmp = python("tmp")')
mel.eval('AEnewNonNumericMultiAddNewItem($tmp, "input3D");')
test()
Paste it in Maya. It should work. At least it does for me. However, it
does not work for me, when I source it via the usual import/reload
procedure using an external .py. Maya will then read: "Tmp not
defined".
I do not get it. I go crazy over it, because it does not make sense.
Paste directly, works. Source externally, does not. I tried putting
global tmp all over the place, but that did not help either. If I
source the script twice, the previously errored utility will suddenly
have four(!) inputs, while the other new ones will not have any.
That's weird for sure. I do not know what else to try to get this
working...
Help is much appreciated.
Martin
Thanks,
Martin
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---