You’re already grabbing nuke.thisNode(), so you already have the name of your 
group... But even easier is to just grab the internal Grade directly.

n = nuke.thisNode()

pos = (n.xpos(), n.ypos())

g = n.node('Grade')

nuke.root().begin()

myGrade = nuke.createNode('Grade', inpanel=False)

myGrade['whitepoint'].setValue(g['whitepoint'].value())

myGrade['blackpoint'].setValue(g['blackpoint'].value())

myGrade.setXYpos(*pos)

nuke.delete(n)

nuke.show(myGrade)



-Nathan


From: kylesim 
Sent: Saturday, June 16, 2012 7:30 AM
To: nuke-python@support.thefoundry.co.uk 
Subject: [Nuke-python] Accessing values of Nodes inside group

I know this has been asked before but i'm having trouble finding the answer.

I have a simple group setup with a curve tool driving the white and black 
points of a grade node within it. After I get the values with the curve tool, i 
would like to be able to export that as a single grade node, then delete the 
group. I've got all that working, but i had to "hard code" the name of the 
group into the python button I called "export" in order to get the internal 
grade nodes values. The problem is if there is more than one of these groups in 
the script as the names become incremented. The python code will still access 
the first groups values.

I'd like to make the python more generic, and i think the answer has something 
to do with nuke.group.begin() or similar. If anyone can take a look at the 
following and help me out, that would be greatly appreciated!

Here's the group:

set cut_paste_input [stack 0]
version 6.3 v7
push $cut_paste_input
Group {
name autoGrade
help "Takes an incoming RGB source and finds the max and min luminance values 
and range maps those to values between 0-1. Especially handy for ZDepth 
passes.\n\nIf the source is a static image one frame is adequate. If it's a 
moving sequence you'll want to get the whole range."
tile_color 0x55ffffff
gl_color 0x55ffffff
selected true
xpos 345
ypos -164
addUserKnob {20 Normalize}
addUserKnob {41 FindRange l "Find Min/Max Luminance" T CurveTool.go}
addUserKnob {26 ""}
addUserKnob {41 whitepoint T Grade.whitepoint}
addUserKnob {41 blackpoint T Grade.blackpoint}
addUserKnob {26 ""}
addUserKnob {22 exportGrade l "Export Grade" T 
"n=nuke.thisNode()\n\n\nnuke.root().begin()\nmyGrade = 
nuke.createNode('Grade')\nwhitePointValue=nuke.toNode('autoGrade.Grade')\['whitepoint'].getValue()\nblackPointValue=nuke.toNode('autoGrade.Grade')\['blackpoint'].getValue()\nmyGrade\['whitepoint'].setValue(whitePointValue)\nmyGrade\['blackpoint'].setValue(blackPointValue)\n\nnuke.delete(n)\n"
 +STARTLINE}
}
Input {
inputs 0
name Input1
xpos -47
ypos -341
}
Dot {
name Dot127
xpos -13
ypos -250
}
set Ncdc7e340 [stack 0]
add_layer {rgb rgb.red rgb.green rgb.blue}
add_layer {rgba redguard1.glow rgba.edgeblur}
Grade {
blackpoint {{parent.CurveTool.minlumapixvalue.left.r} 
{parent.CurveTool.minlumapixvalue.left.g} 
{parent.CurveTool.minlumapixvalue.left.b} 1}
whitepoint {{parent.CurveTool.maxlumapixvalue.left.r} 
{parent.CurveTool.maxlumapixvalue.left.g} 
{parent.CurveTool.maxlumapixvalue.left.b} 1}
name Grade
xpos -47
ypos -199
}
Output {
name Output1
xpos -47
ypos -132
}
push $Ncdc7e340
CurveTool {
operation "Max Luma Pixel"
ROI {512 288 1536 864}
autocropdata {512 288 1536 864}
maxlumapixvalue {1 1 1}
minlumapixvalue {0 0 0}
name CurveTool
selected true
xpos 67
ypos -260
}
end_group


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