From 9e8bb4baa84d2f81a1c9408ce2e932dd7f79c063 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Fri, 22 May 2020 17:24:15 +0100 Subject: [PATCH 01/10] Harmony template publish --- pype/harmony/__init__.py | 22 +++++ pype/plugins/global/publish/integrate_new.py | 5 +- pype/plugins/harmony/create/template.py | 12 +++ .../harmony/publish/collect_current_file.py | 27 ++++++ .../harmony/publish/collect_instances.py | 44 +++++++++ .../harmony/publish/extract_template.py | 90 +++++++++++++++++++ 6 files changed, 198 insertions(+), 2 deletions(-) create mode 100644 pype/harmony/__init__.py create mode 100644 pype/plugins/harmony/create/template.py create mode 100644 pype/plugins/harmony/publish/collect_current_file.py create mode 100644 pype/plugins/harmony/publish/collect_instances.py create mode 100644 pype/plugins/harmony/publish/extract_template.py diff --git a/pype/harmony/__init__.py b/pype/harmony/__init__.py new file mode 100644 index 0000000000..8ac21d3cd3 --- /dev/null +++ b/pype/harmony/__init__.py @@ -0,0 +1,22 @@ +import os + +import avalon.api +import pyblish.api + + +def install(): + print("Installing Pype config...") + + plugins_directory = os.path.join( + os.path.dirname(os.path.dirname(__file__)), "plugins", "harmony" + ) + + pyblish.api.register_plugin_path( + os.path.join(plugins_directory, "publish") + ) + avalon.api.register_plugin_path( + avalon.api.Loader, os.path.join(plugins_directory, "load") + ) + avalon.api.register_plugin_path( + avalon.api.Creator, os.path.join(plugins_directory, "create") + ) diff --git a/pype/plugins/global/publish/integrate_new.py b/pype/plugins/global/publish/integrate_new.py index 0cd46d8891..985a1d2ee7 100644 --- a/pype/plugins/global/publish/integrate_new.py +++ b/pype/plugins/global/publish/integrate_new.py @@ -81,7 +81,8 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): "assembly", "fbx", "textures", - "action" + "action", + "template" ] exclude_families = ["clip"] db_representation_context_keys = [ @@ -743,7 +744,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): matching_profiles[name] = filters if len(matching_profiles) == 1: - template_name = matching_profiles.keys()[0] + template_name = tuple(matching_profiles.keys())[0] self.log.debug( "Using template name \"{}\".".format(template_name) ) diff --git a/pype/plugins/harmony/create/template.py b/pype/plugins/harmony/create/template.py new file mode 100644 index 0000000000..6268127687 --- /dev/null +++ b/pype/plugins/harmony/create/template.py @@ -0,0 +1,12 @@ +from avalon import harmony + + +class CreateTemplate(harmony.Creator): + """Composite node for publishing to templates.""" + + name = "templateDefault" + label = "Template" + family = "template" + + def __init__(self, *args, **kwargs): + super(CreateTemplate, self).__init__(*args, **kwargs) diff --git a/pype/plugins/harmony/publish/collect_current_file.py b/pype/plugins/harmony/publish/collect_current_file.py new file mode 100644 index 0000000000..aab66c2b62 --- /dev/null +++ b/pype/plugins/harmony/publish/collect_current_file.py @@ -0,0 +1,27 @@ +import os + +import pyblish.api +from avalon import harmony + + +class CollectCurrentFile(pyblish.api.ContextPlugin): + """Inject the current working file into context""" + + order = pyblish.api.CollectorOrder - 0.5 + label = "Current File" + hosts = ["harmony"] + + def process(self, context): + """Inject the current working file""" + func = """function func() + { + return ( + scene.currentProjectPath() + "/" + + scene.currentVersionName() + ".xstage" + ); + } + func + """ + + current_file = harmony.send({"function": func})["result"] + context.data["currentFile"] = os.path.normpath(current_file) diff --git a/pype/plugins/harmony/publish/collect_instances.py b/pype/plugins/harmony/publish/collect_instances.py new file mode 100644 index 0000000000..1ed49e3eb8 --- /dev/null +++ b/pype/plugins/harmony/publish/collect_instances.py @@ -0,0 +1,44 @@ +import pyblish.api +from avalon import harmony + + +class CollectInstances(pyblish.api.ContextPlugin): + """Gather instances by nodes metadata. + + This collector takes into account assets that are associated with + a composite node and marked with a unique identifier; + + Identifier: + id (str): "pyblish.avalon.instance" + """ + + label = "Instances" + order = pyblish.api.CollectorOrder + hosts = ["harmony"] + + def process(self, context): + nodes = harmony.send( + {"function": "node.getNodes", "args": [["COMPOSITE"]]} + )["result"] + + for node in nodes: + data = harmony.read(node) + + # Skip non-tagged nodes. + if not data: + continue + + # Skip containers. + 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) + + # Produce diagnostic message for any graphical + # user interface interested in visualising it. + self.log.info("Found: \"%s\" " % instance.data["name"]) diff --git a/pype/plugins/harmony/publish/extract_template.py b/pype/plugins/harmony/publish/extract_template.py new file mode 100644 index 0000000000..9347620dc2 --- /dev/null +++ b/pype/plugins/harmony/publish/extract_template.py @@ -0,0 +1,90 @@ +import os +import shutil + +import pype.api +from avalon import harmony + + +class ExtractTemplate(pype.api.Extractor): + """Extract the connected nodes to the composite instance.""" + label = "Extract Template" + hosts = ["harmony"] + families = ["template"] + + def process(self, instance): + staging_dir = self.staging_dir(instance) + + self.log.info("Outputting template to %s" % staging_dir) + + self.dependencies = [] + self.get_dependencies(instance[0]) + + func = """function func(args) + { + var nodes = args[0]; + selection.clearSelection(); + for (var i = 0 ; i < nodes.length; i++) + { + selection.addNodeToSelection(nodes[i]); + } + } + func + """ + harmony.send({"function": func, "args": [self.dependencies]}) + func = """function func(args) + { + copyPaste.createTemplateFromSelection(args[0], args[1]); + } + func + """ + harmony.send( + { + "function": func, + "args": ["{}.tpl".format(instance.name), staging_dir] + } + ) + + os.chdir(staging_dir) + shutil.make_archive( + "{}".format(instance.name), + "zip", + os.path.join(staging_dir, "{}.tpl".format(instance.name)) + ) + + representation = { + "name": "tpl", + "ext": "zip", + "files": "{}.zip".format(instance.name), + "stagingDir": staging_dir, + } + instance.data["representations"] = [representation] + + def get_dependencies(self, node): + func = """function func(args) + { + var target_node = args[0]; + var numInput = node.numberOfInputPorts(target_node); + var dependencies = []; + for (var i = 0 ; i < numInput; i++) + { + dependencies.push(node.srcNode(target_node, i)); + } + return dependencies; + } + func + """ + + current_dependencies = harmony.send( + {"function": func, "args": [node]} + )["result"] + + for dependency in current_dependencies: + if not dependency: + continue + + if dependency in self.dependencies: + continue + + self.dependencies.append(dependency) + + self.get_dependencies(dependency) From 06b55cbcaaf2b324ab83a551ab61167722956c24 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Mon, 25 May 2020 11:38:58 +0100 Subject: [PATCH 02/10] Import templates. --- .../{template.py => create_template.py} | 0 pype/plugins/harmony/load/load_template.py | 48 +++++++++++++++++++ 2 files changed, 48 insertions(+) rename pype/plugins/harmony/create/{template.py => create_template.py} (100%) create mode 100644 pype/plugins/harmony/load/load_template.py diff --git a/pype/plugins/harmony/create/template.py b/pype/plugins/harmony/create/create_template.py similarity index 100% rename from pype/plugins/harmony/create/template.py rename to pype/plugins/harmony/create/create_template.py diff --git a/pype/plugins/harmony/load/load_template.py b/pype/plugins/harmony/load/load_template.py new file mode 100644 index 0000000000..711c43a913 --- /dev/null +++ b/pype/plugins/harmony/load/load_template.py @@ -0,0 +1,48 @@ +import tempfile +import zipfile +import os +import shutil + +from avalon import api, harmony + + +class ImportTemplateLoader(api.Loader): + """Import templates.""" + + families = ["template"] + representations = ["*"] + label = "Import Template" + + def load(self, context, name=None, namespace=None, data=None): + temp_dir = tempfile.mkdtemp() + zip_file = api.get_representation_path(context["representation"]) + template_path = os.path.join(temp_dir, "temp.tpl") + with zipfile.ZipFile(zip_file, "r") as zip_ref: + zip_ref.extractall(template_path) + + func = """function func(args) + { + var template_path = args[0]; + var drag_object = copyPaste.copyFromTemplate( + template_path, 0, 0, copyPaste.getCurrentCreateOptions() + ); + copyPaste.pasteNewNodes( + drag_object, "", copyPaste.getCurrentPasteOptions() + ); + } + func + """ + + func = """function func(args) + { + var template_path = args[0]; + var drag_object = copyPaste.pasteTemplateIntoGroup( + template_path, "Top", 1 + ); + } + func + """ + + harmony.send({"function": func, "args": [template_path]}) + + shutil.rmtree(temp_dir) From 654f7b2f7d738e52e52771283996033e8820c360 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Mon, 25 May 2020 12:54:09 +0100 Subject: [PATCH 03/10] Change family name. --- pype/plugins/global/publish/integrate_new.py | 2 +- pype/plugins/harmony/create/create_template.py | 2 +- pype/plugins/harmony/load/load_template.py | 2 +- pype/plugins/harmony/publish/extract_template.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pype/plugins/global/publish/integrate_new.py b/pype/plugins/global/publish/integrate_new.py index 3758612767..fd76b19eb9 100644 --- a/pype/plugins/global/publish/integrate_new.py +++ b/pype/plugins/global/publish/integrate_new.py @@ -82,7 +82,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): "fbx", "textures", "action", - "template" + "harmony.template" ] exclude_families = ["clip"] db_representation_context_keys = [ diff --git a/pype/plugins/harmony/create/create_template.py b/pype/plugins/harmony/create/create_template.py index 6268127687..babc3fe8d7 100644 --- a/pype/plugins/harmony/create/create_template.py +++ b/pype/plugins/harmony/create/create_template.py @@ -6,7 +6,7 @@ class CreateTemplate(harmony.Creator): name = "templateDefault" label = "Template" - family = "template" + family = "harmony.template" def __init__(self, *args, **kwargs): super(CreateTemplate, self).__init__(*args, **kwargs) diff --git a/pype/plugins/harmony/load/load_template.py b/pype/plugins/harmony/load/load_template.py index 711c43a913..0bc9706407 100644 --- a/pype/plugins/harmony/load/load_template.py +++ b/pype/plugins/harmony/load/load_template.py @@ -9,7 +9,7 @@ from avalon import api, harmony class ImportTemplateLoader(api.Loader): """Import templates.""" - families = ["template"] + families = ["harmony.template"] representations = ["*"] label = "Import Template" diff --git a/pype/plugins/harmony/publish/extract_template.py b/pype/plugins/harmony/publish/extract_template.py index 9347620dc2..78184217dc 100644 --- a/pype/plugins/harmony/publish/extract_template.py +++ b/pype/plugins/harmony/publish/extract_template.py @@ -9,7 +9,7 @@ class ExtractTemplate(pype.api.Extractor): """Extract the connected nodes to the composite instance.""" label = "Extract Template" hosts = ["harmony"] - families = ["template"] + families = ["harmony.template"] def process(self, instance): staging_dir = self.staging_dir(instance) From 331ffab46fe015aebeb0a15ac2de893ba2fc5b0a Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Tue, 26 May 2020 12:02:20 +0100 Subject: [PATCH 04/10] Initial render publishing --- pype/harmony/__init__.py | 39 +++++++++ pype/plugins/harmony/create/create_render.py | 26 ++++++ .../harmony/publish/collect_instances.py | 47 +++++++++++ .../plugins/harmony/publish/extract_render.py | 82 +++++++++++++++++++ .../harmony/publish/extract_save_scene.py | 14 ++++ 5 files changed, 208 insertions(+) create mode 100644 pype/harmony/__init__.py create mode 100644 pype/plugins/harmony/create/create_render.py create mode 100644 pype/plugins/harmony/publish/collect_instances.py create mode 100644 pype/plugins/harmony/publish/extract_render.py create mode 100644 pype/plugins/harmony/publish/extract_save_scene.py diff --git a/pype/harmony/__init__.py b/pype/harmony/__init__.py new file mode 100644 index 0000000000..b3edca7d15 --- /dev/null +++ b/pype/harmony/__init__.py @@ -0,0 +1,39 @@ +import os + +from avalon import api, harmony +import pyblish.api + + +def install(): + print("Installing Pype config...") + + plugins_directory = os.path.join( + os.path.dirname(os.path.dirname(__file__)), "plugins", "harmony" + ) + + pyblish.api.register_plugin_path( + os.path.join(plugins_directory, "publish") + ) + api.register_plugin_path( + api.Loader, os.path.join(plugins_directory, "load") + ) + api.register_plugin_path( + api.Creator, os.path.join(plugins_directory, "create") + ) + + pyblish.api.register_callback( + "instanceToggled", on_pyblish_instance_toggled + ) + + +def on_pyblish_instance_toggled(instance, old_value, new_value): + """Toggle node enabling on instance toggles.""" + func = """function func(args) + { + node.setEnable(args[0], args[1]) + } + func + """ + harmony.send( + {"function": func, "args": [instance[0], new_value]} + ) diff --git a/pype/plugins/harmony/create/create_render.py b/pype/plugins/harmony/create/create_render.py new file mode 100644 index 0000000000..c416bb6fff --- /dev/null +++ b/pype/plugins/harmony/create/create_render.py @@ -0,0 +1,26 @@ +from avalon import harmony + + +class CreateRender(harmony.Creator): + """Composite node for publishing renders.""" + + name = "renderDefault" + label = "Render" + family = "render" + families = "imagesequence" + node_type = "WRITE" + + def __init__(self, *args, **kwargs): + super(CreateRender, self).__init__(*args, **kwargs) + + def setup_node(self, node): + func = """function func(args) + { + node.setTextAttr(args[0], "DRAWING_TYPE", 1, "PNG4"); + node.setTextAttr(args[0], "DRAWING_NAME", 1, args[1]); + node.setTextAttr(args[0], "MOVIE_PATH", 1, args[1]); + } + func + """ + path = "{0}/{0}".format(node.split("/")[-1]) + harmony.send({"function": func, "args": [node, path]}) diff --git a/pype/plugins/harmony/publish/collect_instances.py b/pype/plugins/harmony/publish/collect_instances.py new file mode 100644 index 0000000000..76d735c28c --- /dev/null +++ b/pype/plugins/harmony/publish/collect_instances.py @@ -0,0 +1,47 @@ +import pyblish.api +from avalon import harmony + + +class CollectInstances(pyblish.api.ContextPlugin): + """Gather instances by nodes metadata. + + This collector takes into account assets that are associated with + a composite node and marked with a unique identifier; + + Identifier: + id (str): "pyblish.avalon.instance" + """ + + label = "Instances" + order = pyblish.api.CollectorOrder + hosts = ["harmony"] + + def process(self, context): + nodes = harmony.send( + {"function": "node.subNodes", "args": ["Top"]} + )["result"] + + for node in nodes: + data = harmony.read(node) + + # Skip non-tagged nodes. + if not data: + continue + + # Skip containers. + 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"] + + # Produce diagnostic message for any graphical + # user interface interested in visualising it. + self.log.info("Found: \"%s\" " % instance.data["name"]) diff --git a/pype/plugins/harmony/publish/extract_render.py b/pype/plugins/harmony/publish/extract_render.py new file mode 100644 index 0000000000..d24110da19 --- /dev/null +++ b/pype/plugins/harmony/publish/extract_render.py @@ -0,0 +1,82 @@ +import os +import tempfile + +import pyblish.api +from avalon import harmony +import pype.lib + +import clique + + +class ExtractRender(pyblish.api.InstancePlugin): + """Produce a flattened image file from instance. + This plug-in only takes into account the nodes connected to the composite. + """ + + label = "Extract Render" + order = pyblish.api.ExtractorOrder + hosts = ["harmony"] + families = ["render"] + + def process(self, instance): + # Collect scene data. + func = """function func(write_node) + { + return [ + about.getApplicationPath(), + scene.currentProjectPath(), + scene.currentScene() + ] + } + func + """ + result = harmony.send( + {"function": func, "args": [instance[0]]} + )["result"] + application_path = result[0] + project_path = result[1] + scene_path = os.path.join(result[1], result[2] + ".xstage") + + # Set output path to temp folder. + path = tempfile.mkdtemp() + func = """function func(args) + { + node.setTextAttr(args[0], "DRAWING_NAME", 1, args[1]); + scene.saveAll(); + } + func + """ + result = harmony.send( + { + "function": func, + "args": [instance[0], path + "/" + instance.data["name"]] + } + ) + + # Execute rendering. + 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) + ) + assert len(collections) == 1, ( + "There should only be one image sequence in {}. Found: {}".format( + path, len(collections) + ) + ) + + extension = os.path.splitext(list(collections[0])[0])[-1][1:] + representation = { + "name": extension, + "ext": extension, + "files": list(collections[0]), + "stagingDir": path, + } + instance.data["representations"] = [representation] + + self.log.info("Extracted {instance} to {path}".format(**locals())) diff --git a/pype/plugins/harmony/publish/extract_save_scene.py b/pype/plugins/harmony/publish/extract_save_scene.py new file mode 100644 index 0000000000..9f1195c058 --- /dev/null +++ b/pype/plugins/harmony/publish/extract_save_scene.py @@ -0,0 +1,14 @@ +import pyblish.api +from avalon import harmony + + +class ExtractSaveScene(pyblish.api.ContextPlugin): + """Save the scene.""" + + label = "Extract Save Scene" + order = pyblish.api.ExtractorOrder - 0.49 + hosts = ["harmony"] + families = ["render"] + + def process(self, instance): + harmony.send({"function": "scene.saveAll"}) From 70333d22ad9a10781ebfa2cb431dcfa154e049e1 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Wed, 27 May 2020 10:35:04 +0100 Subject: [PATCH 05/10] Use Avalon scene save. --- pype/plugins/harmony/publish/extract_render.py | 2 +- pype/plugins/harmony/publish/extract_save_scene.py | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 pype/plugins/harmony/publish/extract_save_scene.py diff --git a/pype/plugins/harmony/publish/extract_render.py b/pype/plugins/harmony/publish/extract_render.py index d24110da19..07dbd22145 100644 --- a/pype/plugins/harmony/publish/extract_render.py +++ b/pype/plugins/harmony/publish/extract_render.py @@ -42,7 +42,6 @@ class ExtractRender(pyblish.api.InstancePlugin): func = """function func(args) { node.setTextAttr(args[0], "DRAWING_NAME", 1, args[1]); - scene.saveAll(); } func """ @@ -52,6 +51,7 @@ class ExtractRender(pyblish.api.InstancePlugin): "args": [instance[0], path + "/" + instance.data["name"]] } ) + harmony.save_scene() # Execute rendering. output = pype.lib._subprocess([application_path, "-batch", scene_path]) diff --git a/pype/plugins/harmony/publish/extract_save_scene.py b/pype/plugins/harmony/publish/extract_save_scene.py deleted file mode 100644 index 9f1195c058..0000000000 --- a/pype/plugins/harmony/publish/extract_save_scene.py +++ /dev/null @@ -1,14 +0,0 @@ -import pyblish.api -from avalon import harmony - - -class ExtractSaveScene(pyblish.api.ContextPlugin): - """Save the scene.""" - - label = "Extract Save Scene" - order = pyblish.api.ExtractorOrder - 0.49 - hosts = ["harmony"] - families = ["render"] - - def process(self, instance): - harmony.send({"function": "scene.saveAll"}) From 4fe2ee7bb88c686ef4a3bddea34b12b6b0af80a3 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Wed, 27 May 2020 12:58:15 +0100 Subject: [PATCH 06/10] Ftrack and review. --- pype/plugins/global/publish/extract_review.py | 2 +- pype/plugins/harmony/create/create_render.py | 1 - .../harmony/publish/collect_instances.py | 17 ++++++++--- .../plugins/harmony/publish/extract_render.py | 30 +++++++++++++++---- 4 files changed, 39 insertions(+), 11 deletions(-) diff --git a/pype/plugins/global/publish/extract_review.py b/pype/plugins/global/publish/extract_review.py index 228b4cd6f4..4dd85a9810 100644 --- a/pype/plugins/global/publish/extract_review.py +++ b/pype/plugins/global/publish/extract_review.py @@ -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"] diff --git a/pype/plugins/harmony/create/create_render.py b/pype/plugins/harmony/create/create_render.py index c416bb6fff..493c585a09 100644 --- a/pype/plugins/harmony/create/create_render.py +++ b/pype/plugins/harmony/create/create_render.py @@ -7,7 +7,6 @@ class CreateRender(harmony.Creator): name = "renderDefault" label = "Render" family = "render" - families = "imagesequence" node_type = "WRITE" def __init__(self, *args, **kwargs): diff --git a/pype/plugins/harmony/publish/collect_instances.py b/pype/plugins/harmony/publish/collect_instances.py index 76d735c28c..9626cb3693 100644 --- a/pype/plugins/harmony/publish/collect_instances.py +++ b/pype/plugins/harmony/publish/collect_instances.py @@ -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) + ) + ) diff --git a/pype/plugins/harmony/publish/extract_render.py b/pype/plugins/harmony/publish/extract_render.py index 07dbd22145..eb0850dc58 100644 --- a/pype/plugins/harmony/publish/extract_render.py +++ b/pype/plugins/harmony/publish/extract_render.py @@ -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())) From 667aea41283825a31db5087f0b89b3d0400bbf63 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Wed, 27 May 2020 13:03:02 +0100 Subject: [PATCH 07/10] Fix extractor. --- pype/plugins/harmony/publish/extract_render.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pype/plugins/harmony/publish/extract_render.py b/pype/plugins/harmony/publish/extract_render.py index eb0850dc58..de6e8b9008 100644 --- a/pype/plugins/harmony/publish/extract_render.py +++ b/pype/plugins/harmony/publish/extract_render.py @@ -60,10 +60,8 @@ class ExtractRender(pyblish.api.InstancePlugin): harmony.save_scene() # Execute rendering. - import subprocess - subprocess.call([application_path, "-batch", scene_path]) - #output = pype.lib._subprocess([application_path, "-batch", scene_path]) - #self.log.info(output) + output = pype.lib._subprocess([application_path, "-batch", scene_path]) + self.log.info(output) # Collect rendered files. files = os.listdir(path) From 4143eafae5c8b234de18f61f4448e7cfb4304c21 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Thu, 28 May 2020 00:22:37 +0200 Subject: [PATCH 08/10] Add project automation for bugs --- .github/workflows/automate-projects.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/automate-projects.yml diff --git a/.github/workflows/automate-projects.yml b/.github/workflows/automate-projects.yml new file mode 100644 index 0000000000..b605071c2d --- /dev/null +++ b/.github/workflows/automate-projects.yml @@ -0,0 +1,19 @@ +name: Automate Projects + +on: + issues: + types: [opened, labeled] +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + assign_one_project: + runs-on: ubuntu-latest + name: Assign to One Project + steps: + - name: Assign NEW bugs to triage + uses: srggrs/assign-one-project-github-action@1.2.0 + if: contains(github.event.issue.labels.*.name, 'bug') + with: + project: 'https://github.com/pypeclub/pype/projects/2' + column_name: 'Needs triage' From 579d9e0162b5529f51be813baa5456f01ca20532 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Thu, 28 May 2020 01:12:23 +0200 Subject: [PATCH 09/10] bump version --- pype/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pype/version.py b/pype/version.py index 892994aa6c..43ce13db01 100644 --- a/pype/version.py +++ b/pype/version.py @@ -1 +1 @@ -__version__ = "2.8.0" +__version__ = "2.9.0" From b5f78a4f4ab5a61012a1988002e34ce3642700fc Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Mon, 1 Jun 2020 12:19:51 +0200 Subject: [PATCH 10/10] bump version --- pype/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pype/version.py b/pype/version.py index 892994aa6c..43ce13db01 100644 --- a/pype/version.py +++ b/pype/version.py @@ -1 +1 @@ -__version__ = "2.8.0" +__version__ = "2.9.0"