From 7cee74677dfbd66afb99673e672d02b7a7f37a87 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Wed, 12 Aug 2020 22:20:25 +0200 Subject: [PATCH] containerise all loaders --- pype/plugins/harmony/load/load_audio.py | 16 +++++++++++++ pype/plugins/harmony/load/load_background.py | 8 ------- .../harmony/load/load_imagesequence.py | 6 +++-- .../harmony/load/load_imagesequence00.py | 23 ------------------- .../harmony/load/load_template_workfile.py | 16 +++++++++++++ 5 files changed, 36 insertions(+), 33 deletions(-) delete mode 100644 pype/plugins/harmony/load/load_imagesequence00.py diff --git a/pype/plugins/harmony/load/load_audio.py b/pype/plugins/harmony/load/load_audio.py index a17af78964..694fda3247 100644 --- a/pype/plugins/harmony/load/load_audio.py +++ b/pype/plugins/harmony/load/load_audio.py @@ -40,3 +40,19 @@ class ImportAudioLoader(api.Loader): harmony.send( {"function": func, "args": [context["subset"]["name"], wav_file]} ) + + subset_name = context["subset"]["name"] + + return harmony.containerise( + subset_name, + namespace, + subset_name, + context, + self.__class__.__name__ + ) + + def update(self, container, representation): + pass + + def remove(self, container): + pass diff --git a/pype/plugins/harmony/load/load_background.py b/pype/plugins/harmony/load/load_background.py index f8de1e1145..f96fc275be 100644 --- a/pype/plugins/harmony/load/load_background.py +++ b/pype/plugins/harmony/load/load_background.py @@ -243,17 +243,12 @@ class BackgroundLoader(api.Loader): for child in data['children']: if child.get("filename"): - print(child["filename"]) layers.append(child["filename"]) else: for layer in child['children']: if layer.get("filename"): - print(layer["filename"]) layers.append(layer["filename"]) - print(layers) - print(data) - bg_folder = os.path.dirname(self.fname) subset_name = context["subset"]["name"] @@ -263,8 +258,6 @@ class BackgroundLoader(api.Loader): for layer in sorted(layers): file_to_import = [os.path.join(bg_folder, layer).replace("\\", "/")] - print(f"FILE TO IMPORT: {file_to_import}") - read_node = harmony.send( { "function": copy_files + import_files, @@ -273,7 +266,6 @@ class BackgroundLoader(api.Loader): )["result"] container_nodes.append(read_node) - return harmony.containerise( subset_name, namespace, diff --git a/pype/plugins/harmony/load/load_imagesequence.py b/pype/plugins/harmony/load/load_imagesequence.py index 0bc7c07ce5..774782b092 100644 --- a/pype/plugins/harmony/load/load_imagesequence.py +++ b/pype/plugins/harmony/load/load_imagesequence.py @@ -230,7 +230,7 @@ class ImageSequenceLoader(api.Loader): """Load images Stores the imported asset in a container named after the asset. """ - families = ["shot", "render", "image"] + families = ["shot", "render", "image", "plate"] representations = ["jpeg", "png", "jpg"] def load(self, context, name=None, namespace=None, data=None): @@ -267,7 +267,8 @@ class ImageSequenceLoader(api.Loader): namespace, read_node, context, - self.__class__.__name__ + self.__class__.__name__, + nodes=[read_node] ) def update(self, container, representation): @@ -336,6 +337,7 @@ class ImageSequenceLoader(api.Loader): harmony.send( {"function": func, "args": [node]} ) + harmony.imprint(node, {}, remove=True) def switch(self, container, representation): self.update(container, representation) diff --git a/pype/plugins/harmony/load/load_imagesequence00.py b/pype/plugins/harmony/load/load_imagesequence00.py deleted file mode 100644 index 82a33678ce..0000000000 --- a/pype/plugins/harmony/load/load_imagesequence00.py +++ /dev/null @@ -1,23 +0,0 @@ -import os - -import json - -file = r"G:\My Drive\pypeRoot\milo_s01\episodes\ml102\ml102_shots\ml102_sh0850\publish\image\imageForComp\v001\ml_ml102_sh0850_imageForComp_v001.json" - -with open(file) as json_file: - data = json.load(json_file) - -layers = list() - -for child in data['children']: - if child.get("filename"): - print(child["filename"]) - layers.append(child["filename"]) - else: - for layer in child['children']: - if layer.get("filename"): - print(layer["filename"]) - layers.append(layer["filename"]) - -for layer in sorted(layers): - print(layer) diff --git a/pype/plugins/harmony/load/load_template_workfile.py b/pype/plugins/harmony/load/load_template_workfile.py index db67f20ff7..3e79cc1903 100644 --- a/pype/plugins/harmony/load/load_template_workfile.py +++ b/pype/plugins/harmony/load/load_template_workfile.py @@ -35,6 +35,22 @@ class ImportTemplateLoader(api.Loader): shutil.rmtree(temp_dir) + subset_name = context["subset"]["name"] + + return harmony.containerise( + subset_name, + namespace, + subset_name, + context, + self.__class__.__name__ + ) + + def update(self, container, representation): + pass + + def remove(self, container): + pass + class ImportWorkfileLoader(ImportTemplateLoader): """Import workfiles."""