nuke: improving get view process node

This commit is contained in:
Jakub Jezek 2023-01-17 11:12:14 +01:00
parent 66cde9f6c7
commit efcb280b75
No known key found for this signature in database
GPG key ID: 730D7C02726179A7

View file

@ -893,17 +893,27 @@ def get_imageio_input_colorspace(filename):
def get_view_process_node():
reset_selection()
ipn_orig = None
for v in nuke.allNodes(filter="Viewer"):
ipn = v['input_process_node'].getValue()
if ipn:
if "VIEWER_INPUT" in ipn:
return
ipn_orig = nuke.toNode(ipn)
ipn_orig.setSelected(True)
ipn_node = None
for v_ in nuke.allNodes(filter="Viewer"):
ipn = v_['input_process_node'].getValue()
ipn_node = nuke.toNode(ipn)
if ipn_node:
if ipn == "VIEWER_INPUT":
# since it is set by default we can ignore it
# nobody usually use this
continue
else:
# in case a Viewer node is transfered from
# different workfile with old values
raise NameError((
"Input process node name '{}' set in "
"Viewer '{}' is does't exists in nodes"
).format(ipn, v_.name()))
if ipn_orig:
return duplicate_node(ipn_orig)
ipn_node.setSelected(True)
if ipn_node:
return duplicate_node(ipn_node)
def on_script_load():