As I only have Nuke NC at home I can’t export a gizmo that I can share with other people, so I decided I had to try and create the whole node programmatically, by building it with my Python script. To do that I have to be able to create a group and then create nodes inside the group. To do that you have to open the group with .begin()
, then create any nodes that you want inside the group, and then close it with .end()
.
Here is an example where I create a group, then add an input node, then a corner pin, a crop and finally an output node before I close the group.
Thanks to Ben McEwan again for this one.
g = nuke.createNode('Group')
nuke.toNode(g.knob('name').value()).begin()
nuke.createNode('Input')
nuke.createNode('CornerPin2D')
nuke.createNode('Crop')
nuke.createNode('Output')
g.end()
You don’t need to do the whole toNode() thing in line 2 since ‘g’ is a pointer to the newly created node. Thus line 2 can just be: g.begin()