diff --git a/openpype/hosts/blender/api/lib.py b/openpype/hosts/blender/api/lib.py index 6aa1cb46ac..e4d063a583 100644 --- a/openpype/hosts/blender/api/lib.py +++ b/openpype/hosts/blender/api/lib.py @@ -3,6 +3,7 @@ import traceback import importlib import bpy +import addon_utils def load_scripts(paths): @@ -74,6 +75,23 @@ def load_scripts(paths): for mod in bpy.utils.modules_from_path(path, loaded_modules): test_register(mod) + addons_paths = [] + for base_path in paths: + addons_path = os.path.join(base_path, "addons") + if os.path.exists(addons_path): + addons_paths.append(addons_path) + + if addons_paths: + # Fake addons + origin_paths = addon_utils.paths + + def new_paths(): + paths = origin_paths() + addons_paths + return paths + + addon_utils.paths = new_paths + addon_utils.modules_refresh() + # load template (if set) if any(bpy.utils.app_template_paths()): import bl_app_template_utils