I’m guessing your 'changeValue' knob is a string knob, which means you’re 
grabbing its (string) value and trying to set the Grade nodes’ knob values 
using it directly, when they are expecting floats.

You need to be sure to properly cast your input value to the target knobs’ 
expected type. Calling type(value) will give you back a type object, which you 
can use to cast your string properly (at least for primitive types). Setting 
knobs to arrays of values is something you’ll have to deal with yourself.

As an alternative, you could set your node up so that, based on the node and 
knob you pick, it dynamically inserts a proxy knob of the same type, which the 
user simply manipulates to set all the target knobs. Thus, you would be able to 
copy the proxy knob’s value across to all target knobs directly, without 
worrying about arrays or type conversions.

-Nathan



From: ae.branton 
Sent: Friday, July 27, 2012 10:45 AM
To: [email protected] 
Subject: [Nuke-python] Re: return if value is a string, boolean,or otherwise?

ONE more ting i just noticed thats bugging me. The tool works great for most 
things (booleans, strings, etc.) But when i try and change an integer, say... 
whitepoint on a group of grades, it says "expected string need integer" or 
something along those lines. heres my code for the final button

value = nuke.thisNode()['changeValue'].value()
classType = nuke.thisNode()['nodesClass'].value()
knobType = nuke.thisNode()['nodeKnobs'].value()
for g in nuke.selectedNodes(classType):
g [knobType].setValue(value)

and when i type just the end part as .setValue(2.4) instead of (value) it seems 
to work, but calling the value from elsewhere doesnt.

Do you happen to know whats happening?


--------------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to