Group {
name Diffusion1
onCreate "knob = nuke.thisNode()\['layers']; knob.setRange(2,12); knob.setFlag(0x00000010)"
knobChanged "node = nuke.thisNode()\n\nif nuke.thisKnob() == node\['layers']:\n with node:\n cur = len(nuke.allNodes('Blur'))\n new = node\['layers'].value()\n dif = int( new - cur )\n \n merge = nuke.toNode('Blend1')\n input = nuke.toNode('Input')\n \n #create extra blur nodes\n if dif > 0:\n for i in range(dif):\n #create blur node\n blur = nuke.nodes.Blur()\n #set inputs blur node\n blur.setInput(0,input)\n inputs = merge.inputs()\n #int knob for use in expression\n intknob = nuke.Int_Knob('val')\n intknob.setValue(i + cur +1)\n blur.addKnob(intknob)\n #set blur size expression\n blur\['size'].setExpression('!falloff? lerp(parent.min, parent.max, (val-1)/(parent.layers-1)) : lerp(parent.min, parent.max, smoothstep(0,layers-1,val-1))')\n \n #set blend node inputs\n if inputs == 2:\n inputs += 1\n merge.setInput(inputs,blur)\n \n #link blend knob\n l = nuke.Link_Knob( str(i + cur +1) )\n l.makeLink('Blend1', 'weight' + str(i+cur))\n node.addKnob( l )\n \n #remove blur nodes\n if dif < 0:\n for i in range(-dif):\n input = cur - i\n if input == 2:\n input -= 1\n inpnode = merge.input(input)\n merge.setInput(input, None)\n nuke.delete(inpnode)\n #node.removeKnob(node\[str(cur - i)])\n node.removeKnob( node.knobs()\[str(cur - i)] )"
tile_color 0xcc804eff
addUserKnob {20 Diffusion}
addUserKnob {3 layers R 2 12}
layers 8
addUserKnob {4 falloff l " falloff " -STARTLINE M {linear smooth "" "" "" ""}}
addUserKnob {26 ""}
addUserKnob {7 min R 0 100}
min {0}
addUserKnob {7 max R 0 100}
max {100}
addUserKnob {26 weights}
addUserKnob {41 1 T Blend1.weight0}
addUserKnob {41 2 T Blend1.weight1}
addUserKnob {41 3 T Blend1.weight2}
addUserKnob {41 4 T Blend1.weight3}
addUserKnob {41 5 T Blend1.weight4}
addUserKnob {41 6 T Blend1.weight5}
addUserKnob {41 7 T Blend1.weight6}
addUserKnob {41 8 T Blend1.weight7}
}
Input {
inputs 0
name Input
xpos -14
ypos -143
}
set Ncaaa690 [stack 0]
Blur {
size {{"!falloff? lerp(parent.min, parent.max, (val-1)/(parent.layers-1)) : lerp(parent.min, parent.max, smoothstep(0,layers-1,val-1))"}}
name Blur8
xpos 756
ypos -117
addUserKnob {20 User}
addUserKnob {3 val}
val 8
}
push $Ncaaa690
Blur {
size {{"!falloff? lerp(parent.min, parent.max, (val-1)/(parent.layers-1)) : lerp(parent.min, parent.max, smoothstep(0,layers-1,val-1))"}}
name Blur7
xpos 646
ypos -117
addUserKnob {20 User}
addUserKnob {3 val}
val 7
}
push $Ncaaa690
Blur {
size {{"!falloff? lerp(parent.min, parent.max, (val-1)/(parent.layers-1)) : lerp(parent.min, parent.max, smoothstep(0,layers-1,val-1))"}}
name Blur6
xpos 536
ypos -117
addUserKnob {20 User}
addUserKnob {3 val}
val 6
}
push $Ncaaa690
Blur {
size {{"!falloff? lerp(parent.min, parent.max, (val-1)/(parent.layers-1)) : lerp(parent.min, parent.max, smoothstep(0,layers-1,val-1))"}}
name Blur5
xpos 426
ypos -117
addUserKnob {20 User}
addUserKnob {3 val}
val 5
}
push $Ncaaa690
Blur {
size {{"!falloff? lerp(parent.min, parent.max, (val-1)/(parent.layers-1)) : lerp(parent.min, parent.max, smoothstep(0,layers-1,val-1))"}}
name Blur4
xpos 316
ypos -117
addUserKnob {20 User}
addUserKnob {3 val}
val 4
}
push $Ncaaa690
Blur {
size {{"!falloff? lerp(parent.min, parent.max, (val-1)/(parent.layers-1)) : lerp(parent.min, parent.max, smoothstep(0,layers-1,val-1))"}}
name Blur3
xpos 206
ypos -117
addUserKnob {20 User}
addUserKnob {3 val}
val 3
}
push 0
push $Ncaaa690
Blur {
size {{"!falloff? lerp(parent.min, parent.max, (val-1)/(parent.layers-1)) : lerp(parent.min, parent.max, smoothstep(0,layers-1,val-1))"}}
name Blur2
xpos 96
ypos -117
addUserKnob {20 User}
addUserKnob {3 val}
val 2
}
push $Ncaaa690
Blur {
size {{"!falloff? lerp(parent.min, parent.max, (val-1)/(parent.layers-1)) : lerp(parent.min, parent.max, smoothstep(0,layers-1,val-1))"}}
name Blur1
xpos -14
ypos -117
addUserKnob {20 User}
addUserKnob {3 val}
val 1
}
Blend {
inputs 8+1
weight0 {1}
weight1 {1}
name Blend1
selected true
xpos -14
ypos -79
}
Output {
name Output1
xpos -14
ypos -41
}
end_group