From 2b64b32507c0f3d6e75e989d9c652912ec7f52e4 Mon Sep 17 00:00:00 2001 From: Jack Yao <151671689+jack-yao91@users.noreply.github.com> Date: Thu, 1 Aug 2024 17:57:13 -0500 Subject: [PATCH] fix extension loading send2ue import error (#59) --- src/addons/send2ue/__init__.py | 2 +- src/addons/send2ue/blender_manifest.toml | 2 +- src/addons/send2ue/core/extension.py | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/addons/send2ue/__init__.py b/src/addons/send2ue/__init__.py index aff004d9..d4f966f3 100644 --- a/src/addons/send2ue/__init__.py +++ b/src/addons/send2ue/__init__.py @@ -13,7 +13,7 @@ bl_info = { "name": "Send to Unreal", "author": "Epic Games Inc (now a community fork)", - "version": (2, 4, 6), + "version": (2, 4, 7), "blender": (3, 6, 0), "location": "Header > Pipeline > Send to Unreal", "description": "Sends an asset to the first open Unreal Editor instance on your machine.", diff --git a/src/addons/send2ue/blender_manifest.toml b/src/addons/send2ue/blender_manifest.toml index f49999a0..b0080f8a 100644 --- a/src/addons/send2ue/blender_manifest.toml +++ b/src/addons/send2ue/blender_manifest.toml @@ -2,7 +2,7 @@ schema_version = "1.0.0" id = "send2ue" name = "Send to Unreal" tagline = "Send assets directly to an open Unreal Editor on your machine" -version = "2.4.6" +version = "2.4.7" type = "add-on" tags = [ "Pipeline" ] blender_version_min = "4.2.0" diff --git a/src/addons/send2ue/core/extension.py b/src/addons/send2ue/core/extension.py index 5a956c2d..b040b365 100644 --- a/src/addons/send2ue/core/extension.py +++ b/src/addons/send2ue/core/extension.py @@ -10,6 +10,7 @@ from abc import abstractmethod from ..constants import ToolInfo, Extensions, ExtensionTasks from . import utilities +from pathlib import Path def run_extension_filters(armature_objects, mesh_objects, hair_objects): @@ -262,6 +263,12 @@ class ExtensionCollector(ast.NodeVisitor): def __init__(self, file_path): super(ExtensionCollector, self).__init__() + + # Todo: Remove this when extensions don't need base classes + addons_folder = str(Path(__file__).parent.parent.parent) + if addons_folder not in sys.path: + sys.path.insert(0, addons_folder) + self._extension_module = self.get_module(file_path) self._extension_classes = []