Skip to content

Instantly share code, notes, and snippets.

@kpprt
Last active September 1, 2023 08:56
Show Gist options
  • Save kpprt/bbc278ff201d8fd41c17206902cc194a to your computer and use it in GitHub Desktop.
Save kpprt/bbc278ff201d8fd41c17206902cc194a to your computer and use it in GitHub Desktop.
An advanced Write node for Nuke where you can define certain path fragments which are combined to the final path via expressions.
set cut_paste_input [stack 0]
version 10.5 v1
push $cut_paste_input
Write {
file "\[string trimright \[value projectroot] \\\\/]/\[string trimright \[value outputfolder] \\\\/]/\[string trimright \[value shot] \\\\/]/\[string trimright \[value task] \\\\/]/\[if \{\[value enable_cache]\} \{return \[value cachefolder]/\[string trimright \[value cache] \\\\/]/\}]\[if \{\[value file_type] == \"mov\"\} \{return \[string trimright \[value outputfilename] \\\\/].\[value file_type]\} \{return \[string trimright \[value outputfilename] \\\\/]/\[string trimright \[value outputfilename] \\\\/]\[value padding].\[value file_type]\}]"
proxy "\[string trimright \[value projectroot] \\\\/]/\[string trimright \[value outputfolder] \\\\/]/\[string trimright \[value shot] \\\\/]/\[string trimright \[value task] \\\\/]/\[if \{\[value enable_cache]\} \{return \[value cachefolder]/\[string trimright \[value cache] \\\\/]/\}]\[if \{\[value file_type] == \"mov\"\} \{return \[string trimright \[value outputfilename] \\\\/]\[value proxy_indicator].\[value file_type]\} \{return \[string trimright \[value outputfilename] \\\\/]\[value proxy_indicator]/\[string trimright \[value outputfilename] \\\\/]\[value proxy_indicator]\[value padding].\[value file_type]\}]"
file_type exr
create_directories true
name CK_Write1
label "\[if \{\[value showpath]\} \{return \[expr \{\[value root.proxy]\} ? \{\[value proxy]\} : \{\[value file]\}]\}]\n"
addUserKnob {20 PathFragments}
addUserKnob {2 projectroot}
projectroot "\[value project_directory]"
addUserKnob {1 outputfolder}
outputfolder 04_renders/010
addUserKnob {1 shot}
shot 000_000
addUserKnob {1 task}
task compositing
addUserKnob {1 cachefolder l cache}
cachefolder cache
addUserKnob {1 cache l / -STARTLINE}
cache denoise
addUserKnob {6 enable_cache l enable -STARTLINE}
addUserKnob {1 outputfilename}
outputfilename "\[file root \[file tail \[value root.name]]]"
addUserKnob {1 padding}
padding _####
addUserKnob {1 proxy_indicator l proxy}
proxy_indicator _proxy
addUserKnob {26 ""}
addUserKnob {22 copyfileoutputpath l "Copy file output path" T "from PySide import QtGui\n\nclipboard = QtGui.QApplication.clipboard()\npath = nuke.thisNode()\['file'].getEvaluatedValue()\nclipboard.setText(path)" +STARTLINE}
addUserKnob {22 copyproxyoutputpath l "Copy proxy output path" -STARTLINE T "from PySide import QtGui\n\nclipboard = QtGui.QApplication.clipboard()\npath = nuke.thisNode()\['proxy'].getEvaluatedValue()\nclipboard.setText(path)"}
addUserKnob {6 showpath l "Show path in label" +STARTLINE}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment