You're right. Adding nuke.WRITE_USER_KNOB_DEFS to the .writeKnobs mask should fix that though (and the result can still be passed to `nuke.createNode`:

node.writeKnobs(nuke.WRITE_USER_KNOB_DEFS | nuke.WRITE_NON_DEFAULT_ONLY | nuke.TO_SCRIPT)

-Nathan


-----Original Message----- From: Ben Dickson
Sent: Tuesday, April 16, 2013 5:45 PM
To: Nuke Python discussion
Subject: Re: [Nuke-python] duplicating a nuke node

That wont handle user-knobs. The more reliable way I've found is to use
nuke.nodeCopy/nuke.nodePaste, with some juggling of the selected nodes:

https://gist.github.com/dbr/5400853

On 17/04/13 07:17, Nathan Rusch wrote:
Assuming `node` is the node you want to duplicate:
for n in nuke.allNodes():
n.setSelected(False)
newNode = nuke.createNode(node.Class(),
node.writeKnobs(nuke.WRITE_NON_DEFAULT_ONLY | nuke.TO_SCRIPT),
inpanel=False)
-Nathan

*From:* sanfx <mailto:nuke-python-re...@thefoundry.co.uk>
*Sent:* Sunday, April 14, 2013 8:50 AM
*To:* nuke-python@support.thefoundry.co.uk
<mailto:nuke-python@support.thefoundry.co.uk>
*Subject:* [Nuke-python] duplicating a nuke node
can anyone tell me how should I duplicate a nuke node without using
*Code:*
nukescripts.node_copypaste()

if I use the above technique it copies node information to clipboard
which is what i dont want, I want to duplicate a reformat node and
connect the duplicated one to copy node's B input....


------------------------------------------------------------------------

san

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

--
ben dickson
2D TD | ben.dick...@rsp.com.au
rising sun pictures | www.rsp.com.au
_______________________________________________
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