mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 21:32:15 +01:00
feat(nuke): adding outut node for later use in Load Precomp
This commit is contained in:
parent
fce8f6b515
commit
bbf4957f47
3 changed files with 65 additions and 0 deletions
|
|
@ -12,3 +12,4 @@ class CollectActiveViewer(pyblish.api.ContextPlugin):
|
|||
|
||||
def process(self, context):
|
||||
context.data["ViewerProcess"] = nuke.ViewerProcess.node()
|
||||
context.data["ActiveViewer"] = nuke.activeViewer()
|
||||
|
|
|
|||
42
pype/plugins/nuke/publish/extract_ouput_node.py
Normal file
42
pype/plugins/nuke/publish/extract_ouput_node.py
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import nuke
|
||||
import pyblish.api
|
||||
from avalon.nuke import maintained_selection
|
||||
|
||||
class CreateOutputNode(pyblish.api.ContextPlugin):
|
||||
"""Adding output node for each ouput write node
|
||||
So when latly user will want to Load .nk as LifeGroup or Precomp
|
||||
Nuke will not complain about missing Output node
|
||||
"""
|
||||
label = 'Output Node Create'
|
||||
order = pyblish.api.ExtractorOrder + 0.4
|
||||
families = ["workfile"]
|
||||
hosts = ['nuke']
|
||||
|
||||
def process(self, context):
|
||||
# capture selection state
|
||||
with maintained_selection():
|
||||
# deselect all allNodes
|
||||
self.log.info(context.data["ActiveViewer"])
|
||||
|
||||
active_viewer = context.data["ActiveViewer"]
|
||||
active_input = active_viewer.activeInput()
|
||||
active_node = active_viewer.node()
|
||||
|
||||
|
||||
last_viewer_node = active_node.input(active_input)
|
||||
|
||||
name = last_viewer_node.name()
|
||||
self.log.info("Node name: {}".format(name))
|
||||
|
||||
# select only instance render node
|
||||
last_viewer_node['selected'].setValue(True)
|
||||
output_node = nuke.createNode("Output")
|
||||
|
||||
# deselect all and select the original selection
|
||||
output_node['selected'].setValue(False)
|
||||
|
||||
# save script
|
||||
nuke.scriptSave()
|
||||
|
||||
# add node to instance node list
|
||||
context.data["outputNode"] = output_node
|
||||
22
pype/plugins/nuke/publish/remove_ouput_node.py
Normal file
22
pype/plugins/nuke/publish/remove_ouput_node.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import nuke
|
||||
import pyblish.api
|
||||
|
||||
|
||||
class RemoveOutputNode(pyblish.api.ContextPlugin):
|
||||
"""Removing output node for each ouput write node
|
||||
|
||||
"""
|
||||
label = 'Output Node Remove'
|
||||
order = pyblish.api.IntegratorOrder
|
||||
families = ["workfile"]
|
||||
hosts = ['nuke']
|
||||
|
||||
def process(self, context):
|
||||
try:
|
||||
output_node = context.data["outputNode"]
|
||||
name = output_node["name"].value()
|
||||
self.log.info("Removing output node: '{}'".format(name))
|
||||
|
||||
nuke.delete(output_node)
|
||||
except Exception:
|
||||
return
|
||||
Loading…
Add table
Add a link
Reference in a new issue