Ok - Format screwed - so attached a better version of the code
Cheers
Howard
>________________________________
> From: Howard Jones <[email protected]>
>To: Nuke user discussion <[email protected]>
>Sent: Sunday, 7 October 2012, 16:10
>Subject: Re: [Nuke-users] Nuke Script Layout, was new comp stack node survey
>
>
>Hi
>
>
>FWIWthis will set a selection of dots' labels to the first dot it finds with a
>label, inc font size and colour.
>
>
>So if you label the top dot of a branch, this will label the selected dot(s)
>to it.
>See example script and select all dots in the backdrop before running it
>
>
>Howard
>
>
>def getParentNode(node):
>try:
>parentNode = node.input(0)
>if parentNode.Class() == 'Dot':
>if not parentNode['label'].getValue():
>return getParentNode(parentNode)
>else:
>return (parentNode['label'].getValue(),
>parentNode['note_font_size'].getValue() ,
>parentNode['note_font_color'].getValue() )
>else:
>return node['label'].getValue()
>except AttributeError:
>nuke.message('No input node')
>def setDotLabel():
>if not nuke.selectedNodes():
>nuke.message('Please select a node')
>return
>else:
>nodes= nuke.selectedNodes()
>for i in nodes:
>TopDotLabel=getParentNode(i)
>i['label'].setValue(TopDotLabel[0])
>i['note_font_size'].setValue(TopDotLabel[1])
>i['note_font_color'].setValue(int(topDotLabel[2]))
>
>
>setDotLabel()
>
>
>----------
>
>set cut_paste_input [stack 0]
>version 6.3 v8
>BackdropNode {
> inputs 0
> name BackdropNode1
> tile_color 0x5f5f5fff
> note_font_size 42
> selected true
> xpos -2243
> ypos 522
> bdwidth 570
> bdheight 345
>}
>push $cut_paste_input
>Primatte3 {
> data { 3
> 0 0 0
> 65552
> 0 5
> 30234 30234 30234 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 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0.866
> 0.05 0.866 0.866
> 0.05 0.866 0.866
> 0.05 0.866 0.866
> 0.05 0.866 0.866
> }
>
> crop {0 0 {width i} {height i}}
> name Primatte2
> selected true
> xpos -1981
> ypos 77
>}
>Dot {
> name Dot8
> label "Main Matte\n"
> note_font_color 0xff00ff
> selected true
> xpos -1950
> ypos 165
>}
>Dot {
> name Dot9
> selected true
> xpos -1950
> ypos 243
>}
>Dot {
> name Dot10
> selected true
> xpos -1950
> ypos 321
>}
>Dot {
> name Dot11
> selected true
> xpos -1950
> ypos 399
>}
>set N33ea6f80 [stack 0]
>Blur {
> name Blur3
> selected true
> xpos
-2081
> ypos 381
>}
>Dot {
> name Dot12
> label "Matte Blur\n"
> note_font_size 15
> note_font_color 0xf20000ff
> selected true
> xpos -2231
> ypos 399
>}
>Dot {
> name Dot13
> selected true
> xpos -2231
> ypos 588
>}
>Dot {
> name Dot16
> selected true
> xpos -2231
> ypos 666
>}
>Dot {
> name Dot17
> selected true
> xpos -2231
> ypos 744
>}
>Dot {
> name Dot18
> selected true
> xpos -2231
> ypos 822
>}
>push $N33ea6f80
>Dot {
> name Dot14
> selected true
> xpos -1950
> ypos 487
>}
>set N33e2de60 [stack 0]
>Dot {
> name Dot19
> selected true
> xpos -1950
> ypos 585
>}
>Dot {
> name Dot22
> selected true
> xpos -1950
> ypos 663
>}
>Dot {
> name
Dot23
> selected true
> xpos -1950
> ypos 741
>}
>push $N33e2de60
>Transform {
> center {960 540}
> name Transform1
> selected true
> xpos -1858
> ypos 482
>}
>Dot {
> name Dot15
> label "Matte Moved\n"
> note_font_size 30
> selected true
> xpos -1699
> ypos 487
>}
>Dot {
> name Dot20
> selected true
> xpos -1699
> ypos 587
>}
>Dot {
> name Dot21
> selected true
> xpos -1699
> ypos 665
>}
>Dot {
> name Dot24
> selected true
> xpos -1699
> ypos 743
>}
>
>
>
>
>>________________________________
>> From: Howard Jones <[email protected]>
>>To: Nuke user discussion <[email protected]>
>>Sent: Thursday, 4 October 2012, 8:39
>>Subject: Re: [Nuke-users] Nuke Script Layout, was new comp stack node survey
>>
>>
>>Might pinch that, however the label I use may be main mattes, rather than the
>>last node name.
>>
>>
>>And of course they can have multi channels in them.
>>
>>
>>I just found when you have pipes running several 'pages' worth, it saves all
>>that scrolling up and down. But requires a bit of copy and paste. Obviously
>>there are tools to modify multiple nodes at once on nukepedia.
>>
>>
>>Maybe the python could be modified to take one master dot at the top and copy
>>its label? Hmmmm.
>>
>>
>>Howard
>>
>>On 4 Oct 2012, at 03:22, Frank Rueter <[email protected]> wrote:
>>
>>
>>bugger tcl.
>>>
>>>
>>>def getParentNode(node):
>>>parentNode = node.input(0)
>>>if parentNode.Class() == 'Dot':
>>>return getParentNode(parentNode)
>>>else:
>>>return parentNode.name()
>>>
>>>nuke.knobDefault('Dot.label', "[python
getParentNode(nuke.toNode('Dot1'))]")
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>On 10/4/12 1:46 PM, chris wrote:
>>>
>>>On 10/3/12 at 12:57 AM, (Howard Jones) wrote:
>>>>
>>>>my favorite - label the dots. And have one just before inputs so you can
>>>>easily see where each input came from.
>>>>>
>>>>i like that one a lot! just added this to my menu.py
>>>>
>>>>nuke.knobDefault('Dot.label', ' [value input0.name]')
>>>>
>>>>might be worth thinking about how to get the name of the next
non-dot node when traveling up the tree (in case one uses several
dots in a row to direct the flow), but no idea how to do that
through TCL.
>>>>
>>>>++ chris
>>>>
>>>>_______________________________________________
>>>>Nuke-users mailing list
>>>>[email protected], http://forums.thefoundry.co.uk/
>>>>http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>>>>
>>>>
>>>>
>>>
>>_______________________________________________
>>>Nuke-users mailing list
>>>[email protected], http://forums.thefoundry.co.uk/
>>>http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>>_______________________________________________
>>Nuke-users mailing list
>>[email protected], http://forums.thefoundry.co.uk/
>>http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>>
>>
>_______________________________________________
>Nuke-users mailing list
>[email protected], http://forums.thefoundry.co.uk/
>http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>
>def getParentNode(node):
try:
parentNode = node.input(0)
if parentNode.Class() == 'Dot':
if not parentNode['label'].getValue():
return getParentNode(parentNode)
else:
return parentNode
else:
return node['label'].value()
except AttributeError:
nuke.message('No input node')
def dotLabel():
if not nuke.selectedNodes('Dot'):
nuke.message('Please select a dot')
return
else:
nodes= nuke.selectedNodes('Dot')
for i in nodes:
try:
pnlabel=getParentNode(i)['label'].value()
pnLabelSize=getParentNode(i)['note_font_size'].value()
pnLabelColour=getParentNode(i)['note_font_color'].value()
i['label'].setValue(pnlabel)
i['note_font_size'].setValue(pnLabelSize)
i['note_font_color'].setValue(int(pnLabelColour))
except:
pass_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users