Last active
March 17, 2016 18:12
-
-
Save kpprt/21f7051c525edd607b8e to your computer and use it in GitHub Desktop.
Serialize a node to text in a NoOp node in Nuke. This could be helpful if some nodes of plugins etc. are causing problems on other machines like render slaves even if they are not connected in the node tree, but you also don't want to delete them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO: | |
# disconnect the SerializedNode completely | |
# set the position of the SerializedNode to the source node | |
# optional: after restoring the source node, reconnect all former inputs correctly | |
# (could be tricky when the script has changed in the meantime) | |
# optional: create the invisible node via python instead of pasting TCL code | |
for n in nuke.selectedNodes(): | |
node_as_string = 'set cut_paste_input [stack 0]\npush $cut_paste_input\n' + n.Class() + ' {' | |
node_as_string += n.writeKnobs(nuke.TO_SCRIPT | nuke.WRITE_ALL) | |
node_as_string += '\n}' | |
invisible_node = ''' | |
set cut_paste_input [stack 0] | |
push $cut_paste_input | |
NoOp { | |
name SerializedNode1 | |
label ''' | |
invisible_node += '"' + n.name() + '"\n' | |
invisible_node += ''' addUserKnob {20 SerializedNode} | |
addUserKnob {22 recreate_node l "Deserialize Node" T "nukescripts.clear_selection_recursive()\n\nnuke.tcl(''' | |
invisible_node += "'''" | |
invisible_node += node_as_string.encode('unicode-escape').replace('"', '\\"') | |
invisible_node += "'''" | |
invisible_node += ''')\n\nnuke.delete(nuke.thisNode())" +STARTLINE} | |
} | |
''' | |
nuke.tcl(invisible_node) | |
nuke.delete(n) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment