mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
feat(nuke): adding slate node integration
This commit is contained in:
parent
035cba879d
commit
518d4b2cfe
3 changed files with 62 additions and 0 deletions
39
pype/plugins/nuke/publish/collect_slate_node.py
Normal file
39
pype/plugins/nuke/publish/collect_slate_node.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import pyblish.api
|
||||
import nuke
|
||||
|
||||
class CollectSlate(pyblish.api.InstancePlugin):
|
||||
"""Check if SLATE node is in scene and connected to rendering tree"""
|
||||
|
||||
order = pyblish.api.CollectorOrder + 0.09
|
||||
label = "Collect Slate Node"
|
||||
hosts = ["nuke"]
|
||||
families = ["write"]
|
||||
|
||||
def process(self, instance):
|
||||
node = instance[0]
|
||||
|
||||
slate = next((n for n in nuke.allNodes()
|
||||
if "slate" in n.name().lower()
|
||||
if not n["disable"].getValue()),
|
||||
None)
|
||||
|
||||
if slate:
|
||||
# check if slate node is connected to write node tree
|
||||
slate_check = 0
|
||||
slate_node = None
|
||||
while slate_check == 0:
|
||||
try:
|
||||
node = node.dependencies()[0]
|
||||
if slate.name() in node.name():
|
||||
slate_node = node
|
||||
slate_check = 1
|
||||
except IndexError:
|
||||
break
|
||||
|
||||
if slate_node:
|
||||
instance.data["slateNodeName"] = slate_node.name()
|
||||
instance.data["families"].append("slate")
|
||||
self.log.info(
|
||||
"Slate node is in node graph: `{}`".format(slate.name()))
|
||||
self.log.debug(
|
||||
"__ instance: `{}`".format(instance))
|
||||
|
|
@ -25,6 +25,9 @@ class CollectNukeWrites(pyblish.api.InstancePlugin):
|
|||
|
||||
self.log.debug("checking instance: {}".format(instance))
|
||||
|
||||
# check if slate node available
|
||||
slate_node = instance.data.get("slateNodeName")
|
||||
|
||||
# Determine defined file type
|
||||
ext = node["file_type"].value()
|
||||
|
||||
|
|
@ -40,6 +43,10 @@ class CollectNukeWrites(pyblish.api.InstancePlugin):
|
|||
first_frame = int(nuke.root()["first_frame"].getValue())
|
||||
last_frame = int(nuke.root()["last_frame"].getValue())
|
||||
|
||||
# remove one frame at beggining if slate
|
||||
if slate_node:
|
||||
first_frame -= 1
|
||||
|
||||
if node["use_limit"].getValue():
|
||||
handles = 0
|
||||
first_frame = int(node["first"].getValue())
|
||||
|
|
@ -100,6 +107,13 @@ class CollectNukeWrites(pyblish.api.InstancePlugin):
|
|||
"subset": instance.data["subset"],
|
||||
"fps": instance.context.data["fps"]
|
||||
}
|
||||
|
||||
# if slate node then remove one frame from version data
|
||||
if slate_node:
|
||||
version_data.update({
|
||||
"frameStart": (first_frame + 1) + handle_start,
|
||||
})
|
||||
|
||||
instance.data["family"] = "write"
|
||||
group_node = [x for x in instance if x.Class() == "Group"][0]
|
||||
deadlineChunkSize = 1
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ class NukeRenderLocal(pype.api.Extractor):
|
|||
|
||||
self.log.debug("instance collected: {}".format(instance.data))
|
||||
|
||||
# check if slate node available
|
||||
slate_node = instance.data.get("slateNodeName")
|
||||
|
||||
first_frame = instance.data.get("frameStart", None)
|
||||
last_frame = instance.data.get("frameEnd", None)
|
||||
node_subset_name = instance.data.get("name", None)
|
||||
|
|
@ -80,5 +83,11 @@ class NukeRenderLocal(pype.api.Extractor):
|
|||
collection = collections[0]
|
||||
instance.data['collection'] = collection
|
||||
|
||||
if slate_node:
|
||||
instance.data['frameStart'] = first_frame + 1
|
||||
self.log.info(
|
||||
'Removing slate frame: `{}`'.format(
|
||||
instance.data['frameStart']))
|
||||
|
||||
self.log.info('Finished render')
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue