Because the 'points' knob has no specialized Python wrapper type, you will need 
to set the entire state of the knob from a serialized curve string. Set up a 
shape and have a look at the result of node['points'].toScript().

-Nathan



From: radvfx 
Sent: Tuesday, April 16, 2013 6:45 PM
To: nuke-python@support.thefoundry.co.uk 
Subject: [Nuke-python] lists of points for shapes

I am trying to draw a shape using a list of points in the Bezier (yes, legacy I 
know) or the rotopaint nodes.

I know how to set values for a float, int, tuples or strings, but I have yet to 
see a value set for a list of points.

I have a list that works for the Bezier, I believe, but I am not certain how to 
declare the list for the "points" knob in the nodes.

Here is what I tried with the Bezier node:

pts=[[
[-18.1,223.5,0,-3.03],
[-20,-22,0,-0.11],
[1932,-10,0,0.48],
[1926.5,1084.5,0,2.64],
[-8,1083.5,0,-3.03],
[-7,858.6,0,-0.15],
[1923.7,858.5,0,-0.32],
[1926.5,223,0,-2.82],
]]


m=nuke.nodes.Bezier()
m[ 'points' ].setValue( [pts] )

But the setValue, I believe wants a float with this syntax.

The knob values for the Bezier I was trying to duplicate, look like this:

output rgba
premult none
cliptype format
replace false
invert false
opacity 1
maskChannelMask alpha
maskChannelInput none
inject false
invert_mask false
extra_blur 0
falloff 1
blur_type linear
points {{
}}
shape 1
pixel_aspect 0
linear false
translate {0 0}
rotate 0
scale 1
skewX 0
skewY 0
skew_order XY
center {960 540}
invert_matrix false
ramp none
color 1
p1 {100 400}
color0 0
p0 {100 100}
sNode=nuke.selectedNode()
print sNode
# Result:

output rgba
premult none
cliptype format
replace false
invert false
opacity 1
maskChannelMask alpha
maskChannelInput none
inject false
invert_mask false
extra_blur 0
falloff 1
blur_type linear
points {{
{-18.1 223.5 0 -3.03}
{-20 -22 0 -0.11}
{1932 -10 0 0.48}
{1926.5 1084.5 0 2.64}
{-8 1083.5 0 -3.03}
{-7 858.6 0 -0.15}
{1923.7 858.5 0 -0.32}
{1926.5 223 0 -2.82}
}}
shape 1
pixel_aspect 0
linear false
translate {0 0}
rotate 0
scale 1
skewX 0
skewY 0
skew_order XY
center {960 540}
invert_matrix false
ramp none
color 1
p1 {100 400}
color0 0
p0 {100 100}

What I need to know is the syntax for setting a list of points.

Cheers.

premult none
cliptype format
replace false
invert false
opacity 1
maskChannelMask alpha
maskChannelInput none
inject false
invert_mask false
extra_blur 0
falloff 1
blur_type linear
points {{
}}
shape 1
pixel_aspect 0
linear false
translate {0 0}
rotate 0
scale 1
skewX 0
skewY 0
skew_order XY
center {960 540}
invert_matrix false
ramp none
color 1
p1 {100 400}
color0 0
p0 {100 100}
sNode=nuke.selectedNode()
print sNode
# Result:

output rgba
premult none
cliptype format
replace false
invert false
opacity 1
maskChannelMask alpha
maskChannelInput none
inject false
invert_mask false
extra_blur 0
falloff 1
blur_type linear
points {{
{-18.1 223.5 0 -3.03}
{-20 -22 0 -0.11}
{1932 -10 0 0.48}
{1926.5 1084.5 0 2.64}
{-8 1083.5 0 -3.03}
{-7 858.6 0 -0.15}
{1923.7 858.5 0 -0.32}
{1926.5 223 0 -2.82}
}}
shape 1
pixel_aspect 0
linear false
translate {0 0}
rotate 0
scale 1
skewX 0
skewY 0
skew_order XY
center {960 540}
invert_matrix false
ramp none
color 1
p1 {100 400}
color0 0
p0 {100 100}


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

Reply via email to