From a9763fad6077ebf92f05c18dad080eb0a2f05385 Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Thu, 28 Nov 2024 10:26:34 +0100 Subject: [PATCH 1/3] Search draco lib at addon root --- addons/io_scene_gltf2/io/com/draco.py | 44 +++------------------------ 1 file changed, 5 insertions(+), 39 deletions(-) diff --git a/addons/io_scene_gltf2/io/com/draco.py b/addons/io_scene_gltf2/io/com/draco.py index 64c37b2e1..91fb4c2c7 100644 --- a/addons/io_scene_gltf2/io/com/draco.py +++ b/addons/io_scene_gltf2/io/com/draco.py @@ -18,59 +18,25 @@ import bpy -def find_draco_dll_in_module(library_name: str) -> Path: - """ - Get the extern Draco library if it exist in the default location used when - build PYthon as a module - :return: DLL/shared library path. - """ - bpy_path = Path(bpy.__file__).resolve() - bpy_dir = bpy_path.parents[4] - lib_dir = bpy_dir / 'lib' - - draco_path = lib_dir / library_name - if draco_path.exists(): - return draco_path - - return None - - def dll_path() -> Path: """ - Get the DLL path depending on the underlying platform. - :return: DLL path. + Get the library path, that should be at addon root + :return: library path. """ lib_name = 'extern_draco' - blender_root = Path(bpy.app.binary_path).parent - python_lib = Path('{v[0]}.{v[1]}/python/lib'.format(v=bpy.app.version)) - python_version = 'python{v[0]}.{v[1]}'.format(v=sys.version_info) - - path = os.environ.get('BLENDER_EXTERN_DRACO_LIBRARY_PATH') - if path is not None: - return Path(path) - library_name = { 'win32': '{}.dll'.format(lib_name), 'linux': 'lib{}.so'.format(lib_name), 'darwin': 'lib{}.dylib'.format(lib_name) }.get(sys.platform) - path = find_draco_dll_in_module(library_name) + path = os.path.dirname(sys.modules['io_scene_gltf2'].__file__) if path is not None: - return path - - path = { - 'win32': blender_root / python_lib / 'site-packages', - 'linux': blender_root / python_lib / python_version / 'site-packages', - 'darwin': blender_root.parent / 'Resources' / python_lib / python_version / 'site-packages' - }.get(sys.platform) + return Path(os.path.join(path, library_name)) - if path is None or library_name is None: + if library_name is None: print('WARNING', 'Unsupported platform {}, Draco mesh compression is unavailable'.format(sys.platform)) - return path / library_name - - def dll_exists(quiet=False) -> bool: """ Checks whether the DLL path exists. From bdaf0abbd93b9b762be193ff6bdaed06f4b25db7 Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Thu, 28 Nov 2024 12:09:51 +0100 Subject: [PATCH 2/3] The new lib location will require Blender 4.4 --- addons/io_scene_gltf2/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/io_scene_gltf2/__init__.py b/addons/io_scene_gltf2/__init__.py index 3e1e826d4..02ddacd66 100644 --- a/addons/io_scene_gltf2/__init__.py +++ b/addons/io_scene_gltf2/__init__.py @@ -16,7 +16,7 @@ 'name': 'glTF 2.0 format', 'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors', "version": (4, 4, 23), - 'blender': (4, 3, 0), + 'blender': (4, 4, 0), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0', 'warning': '', From bfa37d9f4a5d981657e45a1c63d092aff0d0c255 Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Mon, 2 Dec 2024 12:47:21 +0100 Subject: [PATCH 3/3] Bump to 4.4.24 --- addons/io_scene_gltf2/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/io_scene_gltf2/__init__.py b/addons/io_scene_gltf2/__init__.py index 02ddacd66..0c08d54b0 100644 --- a/addons/io_scene_gltf2/__init__.py +++ b/addons/io_scene_gltf2/__init__.py @@ -15,7 +15,7 @@ bl_info = { 'name': 'glTF 2.0 format', 'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors', - "version": (4, 4, 23), + "version": (4, 4, 24), 'blender': (4, 4, 0), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0',