From 3400304cef1d11fc352f1c8d040978e11ec0f1ed Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Thu, 19 Jan 2023 12:16:11 +0100 Subject: [PATCH] use 'apply_settings' method to get value of 'delete_unmatched_assets' --- .../unreal/plugins/load/load_layout_existing.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/openpype/hosts/unreal/plugins/load/load_layout_existing.py b/openpype/hosts/unreal/plugins/load/load_layout_existing.py index 3ce99f8ef6..ceb64ab19d 100644 --- a/openpype/hosts/unreal/plugins/load/load_layout_existing.py +++ b/openpype/hosts/unreal/plugins/load/load_layout_existing.py @@ -15,7 +15,6 @@ from openpype.pipeline import ( AVALON_CONTAINER_ID, legacy_io, ) -from openpype.api import get_current_project_settings from openpype.hosts.unreal.api import plugin from openpype.hosts.unreal.api import pipeline as upipeline @@ -33,6 +32,17 @@ class ExistingLayoutLoader(plugin.Loader): color = "orange" ASSET_ROOT = "/Game/OpenPype" + delete_unmatched_assets = True + + @classmethod + def apply_settings(cls, project_settings, *args, **kwargs): + super(ExistingLayoutLoader, cls).apply_settings( + project_settings, *args, **kwargs + ) + cls.delete_unmatched_assets = ( + project_settings["unreal"]["delete_unmatched_assets"] + ) + @staticmethod def _create_container( asset_name, asset_dir, asset, representation, parent, family @@ -222,8 +232,6 @@ class ExistingLayoutLoader(plugin.Loader): return assets def _process(self, lib_path): - data = get_current_project_settings() - delete_unmatched = data["unreal"]["delete_unmatched_assets"] ar = unreal.AssetRegistryHelpers.get_asset_registry() @@ -360,7 +368,7 @@ class ExistingLayoutLoader(plugin.Loader): continue if actor not in actors_matched: self.log.warning(f"Actor {actor.get_name()} not matched.") - if delete_unmatched: + if self.delete_unmatched_assets: EditorLevelLibrary.destroy_actor(actor) return containers