nuke.nodes is the atomic command that does nothing else but create the node.
nuke.createNode() acts exactly like the UI in that it deselects everything and
selects the new node, auto-places it, auto-connects it etc.
So if you use createNode you can grab the first node's auto-position (where you
clicked last) and position subsequent nodes accordingly. E.g.:
d = nuke.createNode( 'Dot' )
xp = d.xpos()
yp = d.ypos()
d2 = nuke.createNode( 'Dot' )
d2.setXYpos( xp+d.screenWidth(), yp )
> Is it possible to have something as a .gizmo file and it's actually still a
> group?
the easiest way is to export a gizmo, then change the word "Gizmo" to "Group"
in the resulting file.
On Nov 10, 2011, at 6:14 PM, thoma wrote:
> Hi Frank,
>
> I'm using mymenu.addCommand('myGizmo', 'nuke.nodes.myGizmo()') in my menu.py
> with each of the various gizmos I've collected from nukepedia. I didn't even
> realize that nuke.nodes.() and nuke.createNode() did different things. Is it
> possible to have something as a .gizmo file and it's actually still a group?
>
> My other problem is when creating nodes and connecting them via python. I
> noticed this first when using quick3d() recently and it was creating the old
> camera class instead of Camera2. So, i went into the script and updated the
> class but i also wanted to specify the layout of the three nodes on creation
> so they didn't show up in a bunch....the problem is that i could only manage
> to hard code the position into the creation of the nodes and I'd much rather
> have them created where i last clicked in the DAG - the way it always seems
> to work with all of the built-in nodes. I assumed there would be some way to
> access that information -either explicitly or maybe implicitly by using a
> particular function
>
> Thanks!
> Thomas
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python