Script node error...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey guys, I am having some trouble with a script node and expression combination and I cant figure out what is wrong. I have two different script nodes for the test. They both do the same thing, one in python and one in mel. They are both set to execute on open, basically creating a function I can call.
As a note, in both expressions I have
locator1.translateY = pythonSphere.testEnum;
The expression wouldnt update correctly it seemed if I didnt have it directly connected to some other objects attribute.
the python one:
def printEnum(theObject): switchTo = cmds.getAttr(theObject+'.testEnum', asString = True) print switchTo
the python expression:
locator1.translateY = pythonSphere.testEnum;
python("printEnum('pythonSphere')");
If I change the enum attr I get an error.
# File "<maya console>", line 2, in printEnum # TypeError: Flag 'asString' must be passed a boolean argument //
However if I just run the function like this.
printEnum('pythonSphere')
it prints the enum as expected, so the function actually works. It only seems to not work if I try to call the function from the expresssion because if I run it exactly as it is thru a mel tab like so
python("printEnum('pythonSphere')");
It STILL works!! It just doesnt work if that is called from an expression and errors out the funciton.
the mel one:
global proc printEnumMel(string $theObject){
string $testFor = $theObject+".testEnum";
string $spaceSwitcher = `getAttr -asString $testFor`;
print $spaceSwitcher;}
the mel expression:
locator1.translateX = melSphere.testEnum; printEnumMel "melSphere";
The mel one works as expected. If you change the enum attr it prints what the enum is set to.
Any ideas what is going on? Is this a bug?
I know extressions are not really mel, but I feel if I can run the function it is trying to run it should still work.
The file is attached here. You should be able to just load the scene and change the attrs on the spheres and see what is going on.