From 7394e7284a7ccef06e9c2321088bc0cb7a314b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= <33513211+antirotor@users.noreply.github.com> Date: Sun, 2 Aug 2020 23:08:55 +0200 Subject: [PATCH 1/4] disable undo/redo during extraction, fix frame num --- pype/hosts/harmony/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pype/hosts/harmony/__init__.py b/pype/hosts/harmony/__init__.py index 3cae695852..d1a9c3ae17 100644 --- a/pype/hosts/harmony/__init__.py +++ b/pype/hosts/harmony/__init__.py @@ -151,6 +151,7 @@ def application_launch(): def export_template(backdrops, nodes, filepath): func = """function func(args) { + scene.beginUndoRedoAccum("Publish: export template"); // Add an extra node just so a new group can be created. var temp_node = node.add("Top", "temp_note", "NOTE", 0, 0, 0); var template_group = node.createGroup(temp_node, "temp_group"); @@ -168,7 +169,7 @@ def export_template(backdrops, nodes, filepath): }; // Copy-paste the selected nodes into the new group. - var drag_object = copyPaste.copy(args[1], 1, frame.numberOf, ""); + var drag_object = copyPaste.copy(args[1], 1, frame.numberOf(), ""); copyPaste.pasteNewNodes(drag_object, template_group, ""); // Select all nodes within group and export as template. @@ -179,6 +180,7 @@ def export_template(backdrops, nodes, filepath): // created during the process. Action.perform("onActionUpToParent()", "Node View"); node.deleteNode(template_group, true, true); + scene.cancelUndoRedoAccum(); } func """ From 0f32a6d056a48c5102d07c023ea335f81224b63a Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Tue, 4 Aug 2020 13:57:41 +0200 Subject: [PATCH 2/4] use Action.perform copy() to copy nodes --- pype/hosts/harmony/__init__.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pype/hosts/harmony/__init__.py b/pype/hosts/harmony/__init__.py index d1a9c3ae17..d4b7d91fdb 100644 --- a/pype/hosts/harmony/__init__.py +++ b/pype/hosts/harmony/__init__.py @@ -151,28 +151,31 @@ def application_launch(): def export_template(backdrops, nodes, filepath): func = """function func(args) { - scene.beginUndoRedoAccum("Publish: export template"); - // Add an extra node just so a new group can be created. + var temp_node = node.add("Top", "temp_note", "NOTE", 0, 0, 0); var template_group = node.createGroup(temp_node, "temp_group"); node.deleteNode( template_group + "/temp_note" ); - // This will make Node View to focus on the new group. + selection.clearSelection(); + for (var f = 0; f < args[1].length; f++) + { + selection.addNodeToSelection(args[1][f]); + } + + Action.perform("copy()", "Node View"); + selection.clearSelection(); selection.addNodeToSelection(template_group); Action.perform("onActionEnterGroup()", "Node View"); + Action.perform("paste()", "Node View"); // Recreate backdrops in group. for (var i = 0 ; i < args[0].length; i++) { + MessageLog.trace(args[0][i]); Backdrop.addBackdrop(template_group, args[0][i]); }; - // Copy-paste the selected nodes into the new group. - var drag_object = copyPaste.copy(args[1], 1, frame.numberOf(), ""); - copyPaste.pasteNewNodes(drag_object, template_group, ""); - - // Select all nodes within group and export as template. Action.perform( "selectAll()", "Node View" ); copyPaste.createTemplateFromSelection(args[2], args[3]); @@ -180,7 +183,6 @@ def export_template(backdrops, nodes, filepath): // created during the process. Action.perform("onActionUpToParent()", "Node View"); node.deleteNode(template_group, true, true); - scene.cancelUndoRedoAccum(); } func """ From 9a4c7673e9244f8486655f2c7795f6f5b67553ae Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Tue, 4 Aug 2020 21:37:35 +0200 Subject: [PATCH 3/4] temporary change to extract render logic collection should eventually be phased out in favour of explicit render collection --- .../plugins/harmony/publish/extract_render.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/pype/plugins/harmony/publish/extract_render.py b/pype/plugins/harmony/publish/extract_render.py index fe1352f9f9..45b52e0307 100644 --- a/pype/plugins/harmony/publish/extract_render.py +++ b/pype/plugins/harmony/publish/extract_render.py @@ -72,19 +72,27 @@ class ExtractRender(pyblish.api.InstancePlugin): self.log.info(output.decode("utf-8")) # Collect rendered files. + self.log.debug(path) files = os.listdir(path) + self.log.debug(files) collections, remainder = clique.assemble(files, minimum_items=1) assert not 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( - path, len(collections) - ) - ) - collection = collections[0] + self.log.debug(collections) + if len(collections) > 1: + for col in collections: + if len(list(col)) > 1: + collection = col + else: + # assert len(collections) == 1, ( + # "There should only be one image sequence in {}. Found: {}".format( + # path, len(collections) + # ) + # ) + collection = collections[0] # Generate thumbnail. thumbnail_path = os.path.join(path, "thumbnail.png") From 0c883a9f5b300874be3ba52849936e17ac09673a Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Tue, 4 Aug 2020 21:38:29 +0200 Subject: [PATCH 4/4] temp frame range filter implementation temporary implementation for a client. must be cleaned up and logic should be changed to work based on task type --- .../harmony/publish/validate_scene_settings.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pype/plugins/harmony/publish/validate_scene_settings.py b/pype/plugins/harmony/publish/validate_scene_settings.py index aa9a70bd85..3602f1ca22 100644 --- a/pype/plugins/harmony/publish/validate_scene_settings.py +++ b/pype/plugins/harmony/publish/validate_scene_settings.py @@ -28,8 +28,11 @@ class ValidateSceneSettings(pyblish.api.InstancePlugin): hosts = ["harmony"] actions = [ValidateSceneSettingsRepair] + frame_check_filter = ["_ch_", "_pr_", "_intd_", "_extd_"] + def process(self, instance): expected_settings = pype.hosts.harmony.get_asset_settings() + self.log.info(expected_settings) # Harmony is expected to start at 1. frame_start = expected_settings["frameStart"] @@ -37,6 +40,14 @@ class ValidateSceneSettings(pyblish.api.InstancePlugin): expected_settings["frameEnd"] = frame_end - frame_start + 1 expected_settings["frameStart"] = 1 + + + self.log.info(instance.context.data['anatomyData']['asset']) + + if any(string in instance.context.data['anatomyData']['asset'] + for string in frame_check_filter): + expected_settings.pop("frameEnd") + func = """function func() { return {