From f19d8762df971ac9802c163d2e29d379bbadcf6d Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 9 Feb 2024 17:10:47 +0100 Subject: [PATCH] flame Loaders can use AYON settings --- .../flame/plugins/load/load_clip_batch.py | 19 ++++++++++--- client/ayon_core/settings/ayon_settings.py | 27 ------------------- 2 files changed, 15 insertions(+), 31 deletions(-) diff --git a/client/ayon_core/hosts/flame/plugins/load/load_clip_batch.py b/client/ayon_core/hosts/flame/plugins/load/load_clip_batch.py index a66bf53622..57797e5a44 100644 --- a/client/ayon_core/hosts/flame/plugins/load/load_clip_batch.py +++ b/client/ayon_core/hosts/flame/plugins/load/load_clip_batch.py @@ -50,17 +50,28 @@ class LoadClipBatch(opfapi.ClipLoader): version_name = version.get("name", None) colorspace = self.get_colorspace(context) + # TODO remove '{folder[name]}' and '{product[name]}' replacement + clip_name_template = ( + self.clip_name_template + .replace("{folder[name]}", "{asset}") + .replace("{product[name]}", "{subset}") + ) + layer_rename_template = ( + self.layer_rename_template + .replace("{folder[name]}", "{asset}") + .replace("{product[name]}", "{subset}") + ) # in case output is not in context replace key to representation if not context["representation"]["context"].get("output"): - self.clip_name_template = self.clip_name_template.replace( + clip_name_template = clip_name_template.replace( "output", "representation") - self.layer_rename_template = self.layer_rename_template.replace( + layer_rename_template = layer_rename_template.replace( "output", "representation") formatting_data = deepcopy(context["representation"]["context"]) formatting_data["batch"] = self.batch.name.get_value() - clip_name = StringTemplate(self.clip_name_template).format( + clip_name = StringTemplate(clip_name_template).format( formatting_data) # convert colorspace with ocio to flame mapping @@ -86,7 +97,7 @@ class LoadClipBatch(opfapi.ClipLoader): "path": path.replace("\\", "/"), "colorspace": colorspace, "version": "v{:0>3}".format(version_name), - "layer_rename_template": self.layer_rename_template, + "layer_rename_template": layer_rename_template, "layer_rename_patterns": self.layer_rename_patterns, "context_data": formatting_data } diff --git a/client/ayon_core/settings/ayon_settings.py b/client/ayon_core/settings/ayon_settings.py index 7de6011916..39e30d4846 100644 --- a/client/ayon_core/settings/ayon_settings.py +++ b/client/ayon_core/settings/ayon_settings.py @@ -267,34 +267,7 @@ def _convert_flame_project_settings(ayon_settings, output): ayon_flame = ayon_settings["flame"] - ayon_publish_flame = ayon_flame["publish"] - - # 'imageio' changed model - # - missing subkey 'project' which is in root of 'imageio' model _convert_host_imageio(ayon_flame) - ayon_imageio_flame = ayon_flame["imageio"] - if "project" not in ayon_imageio_flame: - profile_mapping = ayon_imageio_flame.pop("profilesMapping") - ayon_flame["imageio"] = { - "project": ayon_imageio_flame, - "profilesMapping": profile_mapping - } - - ayon_load_flame = ayon_flame["load"] - for plugin_name in ("LoadClip", "LoadClipBatch"): - plugin_settings = ayon_load_flame[plugin_name] - plugin_settings["families"] = plugin_settings.pop("product_types") - plugin_settings["clip_name_template"] = ( - plugin_settings["clip_name_template"] - .replace("{folder[name]}", "{asset}") - .replace("{product[name]}", "{subset}") - ) - plugin_settings["layer_rename_template"] = ( - plugin_settings["layer_rename_template"] - .replace("{folder[name]}", "{asset}") - .replace("{product[name]}", "{subset}") - ) - output["flame"] = ayon_flame