Ftrack and review.

This commit is contained in:
Toke Stuart Jepsen 2020-05-27 12:58:15 +01:00
parent 70333d22ad
commit 4fe2ee7bb8
4 changed files with 39 additions and 11 deletions

View file

@ -22,7 +22,7 @@ class ExtractReview(pyblish.api.InstancePlugin):
label = "Extract Review"
order = pyblish.api.ExtractorOrder + 0.02
families = ["review"]
hosts = ["nuke", "maya", "shell", "nukestudio", "premiere"]
hosts = ["nuke", "maya", "shell", "nukestudio", "premiere", "harmony"]
# Supported extensions
image_exts = ["exr", "jpg", "jpeg", "png", "dpx"]

View file

@ -7,7 +7,6 @@ class CreateRender(harmony.Creator):
name = "renderDefault"
label = "Render"
family = "render"
families = "imagesequence"
node_type = "WRITE"
def __init__(self, *args, **kwargs):

View file

@ -1,3 +1,5 @@
import json
import pyblish.api
from avalon import harmony
@ -15,6 +17,10 @@ class CollectInstances(pyblish.api.ContextPlugin):
label = "Instances"
order = pyblish.api.CollectorOrder
hosts = ["harmony"]
families_mapping = {
"render": ["imagesequence", "review"],
"harmony.template": []
}
def process(self, context):
nodes = harmony.send(
@ -32,16 +38,19 @@ class CollectInstances(pyblish.api.ContextPlugin):
if "container" in data["id"]:
continue
# Adding families if missing.
data["families"] = data.get("families", [])
instance = context.create_instance(node.split("/")[-1])
instance.append(node)
instance.data.update(data)
instance.data["publish"] = harmony.send(
{"function": "node.getEnable", "args": [node]}
)["result"]
instance.data["families"] = self.families_mapping[data["family"]]
instance.data["families"].append("ftrack")
# Produce diagnostic message for any graphical
# user interface interested in visualising it.
self.log.info("Found: \"%s\" " % instance.data["name"])
self.log.info(
"Found: \"{0}\": \n{1}".format(
instance.data["name"], json.dumps(instance.data, indent=4)
)
)

View file

@ -25,7 +25,10 @@ class ExtractRender(pyblish.api.InstancePlugin):
return [
about.getApplicationPath(),
scene.currentProjectPath(),
scene.currentScene()
scene.currentScene(),
scene.getFrameRate(),
scene.getStartFrame(),
scene.getStopFrame()
]
}
func
@ -36,6 +39,9 @@ class ExtractRender(pyblish.api.InstancePlugin):
application_path = result[0]
project_path = result[1]
scene_path = os.path.join(result[1], result[2] + ".xstage")
frame_rate = result[3]
frame_start = result[4]
frame_end = result[5]
# Set output path to temp folder.
path = tempfile.mkdtemp()
@ -54,15 +60,18 @@ class ExtractRender(pyblish.api.InstancePlugin):
harmony.save_scene()
# Execute rendering.
output = pype.lib._subprocess([application_path, "-batch", scene_path])
self.log.info(output)
import subprocess
subprocess.call([application_path, "-batch", scene_path])
#output = pype.lib._subprocess([application_path, "-batch", scene_path])
#self.log.info(output)
# Collect rendered files.
files = os.listdir(path)
collections, remainder = clique.assemble(files, minimum_items=1)
assert not remainder, (
"There shouldn't have been a remainder for '%s': "
"%s" % (instance[0], remainder)
"There should not be a remainder for {0}: {1}".format(
instance[0], remainder
)
)
assert len(collections) == 1, (
"There should only be one image sequence in {}. Found: {}".format(
@ -76,7 +85,18 @@ class ExtractRender(pyblish.api.InstancePlugin):
"ext": extension,
"files": list(collections[0]),
"stagingDir": path,
"frameStart": frame_start,
"frameEnd": frame_end,
"fps": frame_rate,
"preview": True,
"tags": ["review"]
}
instance.data["representations"] = [representation]
self.log.info(frame_rate)
# Required for extract_review plugin (L222 onwards).
instance.data["frameStart"] = frame_start
instance.data["frameEnd"] = frame_end
instance.data["fps"] = frame_rate
self.log.info("Extracted {instance} to {path}".format(**locals()))