mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
update publish rendering
This commit is contained in:
parent
0cb6ce3206
commit
ad1db73b21
4 changed files with 30 additions and 35 deletions
|
|
@ -1,23 +0,0 @@
|
|||
import pyblish.api
|
||||
import os
|
||||
|
||||
class CollectFrames(pyblish.api.InstancePlugin):
|
||||
"""Inject the host into context"""
|
||||
|
||||
order = pyblish.api.CollectorOrder + 0.499
|
||||
label = "Collect data into prerenderd frames"
|
||||
hosts = ["nuke"]
|
||||
families = ['prerendered.frames']
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
collected_frames = os.listdir(instance.data['outputDir'])
|
||||
|
||||
if "files" not in instance.data:
|
||||
instance.data["files"] = list()
|
||||
|
||||
instance.data["files"].append(collected_frames)
|
||||
instance.data['stagingDir'] = instance.data['outputDir']
|
||||
instance.data['transfer'] = False
|
||||
|
||||
self.log.info('collected frames: {}'.format(collected_frames))
|
||||
|
|
@ -2,7 +2,6 @@ import os
|
|||
|
||||
import nuke
|
||||
import pyblish.api
|
||||
import clique
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -42,6 +41,7 @@ class CollectNukeWrites(pyblish.api.ContextPlugin):
|
|||
# get path
|
||||
path = nuke.filename(node)
|
||||
output_dir = os.path.dirname(path)
|
||||
self.log.debug(output_dir)
|
||||
# Include start and end render frame in label
|
||||
name = node.name()
|
||||
|
||||
|
|
@ -51,28 +51,36 @@ class CollectNukeWrites(pyblish.api.ContextPlugin):
|
|||
int(last_frame)
|
||||
)
|
||||
|
||||
self.log.debug("checking for error: {}".format(label))
|
||||
|
||||
files = []
|
||||
# preredered frames
|
||||
if not node["render"].value():
|
||||
try:
|
||||
families = "prerendered.frames"
|
||||
collected_frames = os.listdir(output_dir)
|
||||
if not collected_frames:
|
||||
node["render"].setValue(True)
|
||||
if "files" not in instance.data:
|
||||
instance.data["files"] = list()
|
||||
|
||||
instance.data["files"] = collected_frames
|
||||
instance.data['stagingDir'] = output_dir
|
||||
instance.data['transfer'] = False
|
||||
except Exception:
|
||||
node["render"].setValue(True)
|
||||
|
||||
if node["render"].value():
|
||||
# dealing with local/farm rendering
|
||||
if node["render_farm"].value():
|
||||
families = "{}.farm".format(instance.data["families"][0])
|
||||
else:
|
||||
families = "{}.local".format(instance.data["families"][0])
|
||||
else:
|
||||
families = 'prerendered.frames'
|
||||
files = [f for f in os.listdir(output_dir)]
|
||||
|
||||
self.log.debug("checking for error: {}".format(label))
|
||||
instance.data.update({
|
||||
"path": path,
|
||||
"outputDir": output_dir,
|
||||
"ext": ext, # todo: should be redundant
|
||||
"ext": ext,
|
||||
"label": label,
|
||||
"families": [families],
|
||||
"files": files,
|
||||
"firstFrame": first_frame,
|
||||
"lastFrame": last_frame,
|
||||
"outputType": output_type
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class NukeRenderLocal(pyblish.api.InstancePlugin):
|
|||
|
||||
first_frame = instance.data.get("firstFrame", None)
|
||||
last_frame = instance.data.get("lastFrame", None)
|
||||
node_subset_name = instance.data.get("subset", None)
|
||||
node_subset_name = instance.data.get("name", None)
|
||||
|
||||
self.log.info("Starting render")
|
||||
self.log.info("Start frame: {}".format(first_frame))
|
||||
|
|
@ -43,4 +43,6 @@ class NukeRenderLocal(pyblish.api.InstancePlugin):
|
|||
int(first_frame),
|
||||
int(last_frame)
|
||||
)
|
||||
# swith to prerendered.frames
|
||||
instance[0]["render"].setValue(False)
|
||||
self.log.info('Finished render')
|
||||
|
|
|
|||
|
|
@ -10,7 +10,11 @@ class RepairCollectionAction(pyblish.api.Action):
|
|||
icon = "wrench"
|
||||
|
||||
def process(self, context, plugin):
|
||||
[os.remove(f) for f in context[0].data["files"]]
|
||||
|
||||
files_remove = [os.path.join(context[0].data["outputDir"], f)
|
||||
for f in context[0].data["files"]]
|
||||
for f in files_remove:
|
||||
self.log.debug("removing file: {}".format(f))
|
||||
context[0][0]["render"].setValue(True)
|
||||
self.log.info("Rendering toggled ON")
|
||||
|
||||
|
|
@ -31,11 +35,15 @@ class ValidateCollection(pyblish.api.InstancePlugin):
|
|||
self.log.info('collections: {}'.format(collections))
|
||||
|
||||
frame_length = instance.data["lastFrame"] \
|
||||
- instance.data["firstFrame"]
|
||||
- instance.data["firstFrame"] + 1
|
||||
|
||||
assert len(collections) == 1, self.log.info("There are multiple collections in the folder")
|
||||
|
||||
assert collections[0].is_contiguous(), self.log.info("Some frames appear to be missing")
|
||||
|
||||
self.log.info('frame_length: {}'.format(frame_length))
|
||||
self.log.info('len(list(instance.data["files"])): {}'.format(
|
||||
len(list(instance.data["files"]))))
|
||||
|
||||
assert len(list(instance.data["files"])) is frame_length, self.log.info(
|
||||
"{} missing frames. Use repair to render all frames".format(__name__))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue