From 0a54f569ceb80e491e21ff1f8b80131191f0c48f Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 26 Mar 2025 16:55:26 +0100 Subject: [PATCH] fix addons discovery --- client/ayon_core/addon/base.py | 25 ++++++++++++++++++++----- client/ayon_core/cli.py | 1 + client/ayon_core/settings/lib.py | 27 ++++++++++++++++++++++----- 3 files changed, 43 insertions(+), 10 deletions(-) diff --git a/client/ayon_core/addon/base.py b/client/ayon_core/addon/base.py index 72270fa585..7d02acf548 100644 --- a/client/ayon_core/addon/base.py +++ b/client/ayon_core/addon/base.py @@ -155,18 +155,33 @@ def load_addons(force=False): def _get_ayon_bundle_data(): + studio_bundle_name = os.environ.get("AYON_STUDIO_BUNDLE_NAME") + project_bundle_name = os.getenv("AYON_BUNDLE_NAME") bundles = ayon_api.get_bundles()["bundles"] - - bundle_name = os.getenv("AYON_BUNDLE_NAME") - - return next( + project_bundle = next( ( bundle for bundle in bundles - if bundle["name"] == bundle_name + if bundle["name"] == project_bundle_name ), None ) + studio_bundle = None + if studio_bundle_name and project_bundle_name != studio_bundle_name: + studio_bundle = next( + ( + bundle + for bundle in bundles + if bundle["name"] == studio_bundle_name + ), + None + ) + + if project_bundle and studio_bundle: + addons = copy.deepcopy(studio_bundle["addons"]) + addons.update(project_bundle["addons"]) + project_bundle["addons"] = addons + return project_bundle def _get_ayon_addons_information(bundle_info): diff --git a/client/ayon_core/cli.py b/client/ayon_core/cli.py index dc8ca44082..8f2abbaeab 100644 --- a/client/ayon_core/cli.py +++ b/client/ayon_core/cli.py @@ -59,6 +59,7 @@ def main_cli(ctx, *_args, **_kwargs): print(ctx.get_help()) sys.exit(0) else: + ctx.params.pop("project") ctx.forward(tray) diff --git a/client/ayon_core/settings/lib.py b/client/ayon_core/settings/lib.py index d251439221..7b4c08bc04 100644 --- a/client/ayon_core/settings/lib.py +++ b/client/ayon_core/settings/lib.py @@ -128,18 +128,35 @@ class _AyonSettingsCache: @classmethod def _get_addon_versions_from_bundle(cls): - expected_bundle = cls._get_project_bundle_name() + studio_bundle_name = cls._get_studio_bundle_name() + project_bundle_name = cls._get_project_bundle_name() bundles = ayon_api.get_bundles()["bundles"] - bundle = next( + project_bundle = next( ( bundle for bundle in bundles - if bundle["name"] == expected_bundle + if bundle["name"] == project_bundle_name ), None ) - if bundle is not None: - return bundle["addons"] + studio_bundle = None + if studio_bundle_name and project_bundle_name != studio_bundle_name: + studio_bundle = next( + ( + bundle + for bundle in bundles + if bundle["name"] == studio_bundle_name + ), + None + ) + + if studio_bundle and project_bundle: + addons = copy.deepcopy(studio_bundle["addons"]) + addons.update(project_bundle["addons"]) + project_bundle["addons"] = addons + + if project_bundle is not None: + return project_bundle["addons"] return {} @classmethod