I think the problem is the getValue() is meant for animated (number) values,
not string values. Assuming you're looking at Grade nodes here:

n['channels'].getValue() returns 1.0
n['channels'].value() returns 'rgb'

Bear in mind if you copy the xpos & ypos knobs your new node will be
positioned over the original node in the DAG!

hope this helps
Colin


On 20 October 2011 14:53, kernowkid <[email protected]>wrote:

> **
> Hi all,
> Im trying to save a selected nodes knob values into a variable and then set
> those values into another node.
>
> This is how far I got. The first bit puts the values and knob names into
> variables. The second bit , which isn't working, sets the value of the
> targeted node.
>
> *Code:*
> set1n = []
> set1v = []
>
> n = nuke.selectedNode()
> for i in range(n.getNumKnobs()):
>         set1n.insert(i, n.knob(i).name())
>         set1v.insert(i, n.knob(i).getValue())
>
> tn = nuke.toNode("Grade2")
> for i in range(tn.getNumKnobs()):
>         tn[set1n[i]].setValue(set1v[i])
>
>
> I get back:
>
> *Quote:*  # Result:
> Traceback (most recent call last):
> File "**", line 11, in **
> TypeError: setValue() argument 1 must be string, not float
>
> So something is going wrong. Either I'm saving the wrong info in to the
> variables or I have the *Code:*  tn[set1n[i]].setValue(set1v[i])  bit
> wrong?
> Any help appreciated
> [image: Smile]
>
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>


-- 
colin alway
_______________________________________________
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