1 # SPDX-License-Identifier: Apache-2.0
2 # Copyright 2018-2021 The glTF-Blender-IO authors.
6 from pathlib
import Path
9 from ...io
.com
.gltf2_io_debug
import print_console
12 def dll_path() -> Path
:
14 Get the DLL path depending on the underlying platform.
17 lib_name
= 'extern_draco'
18 blender_root
= Path(bpy
.app
.binary_path
).parent
19 python_lib
= Path('{v[0]}.{v[1]}/python/lib'.format(v
=bpy
.app
.version
))
20 python_version
= 'python{v[0]}.{v[1]}'.format(v
=sys
.version_info
)
22 path
= os
.environ
.get('BLENDER_EXTERN_DRACO_LIBRARY_PATH')
25 'win32': blender_root
/ python_lib
/ 'site-packages',
26 'linux': blender_root
/ python_lib
/ python_version
/ 'site-packages',
27 'darwin': blender_root
.parent
/ 'Resources' / python_lib
/ python_version
/ 'site-packages'
33 'win32': '{}.dll'.format(lib_name
),
34 'linux': 'lib{}.so'.format(lib_name
),
35 'darwin': 'lib{}.dylib'.format(lib_name
)
38 if path
is None or library_name
is None:
39 print_console('WARNING', 'Unsupported platform {}, Draco mesh compression is unavailable'.format(sys
.platform
))
41 return path
/ library_name
44 def dll_exists(quiet
=False) -> bool:
46 Checks whether the DLL path exists.
47 :return: True if the DLL exists.
49 exists
= dll_path().exists()
51 print("'{}' ".format(dll_path().absolute()) + ("exists, draco mesh compression is available" if exists
else
53 "does not exist, draco mesh compression not available,",
54 "please add it or create environment variable BLENDER_EXTERN_DRACO_LIBRARY_PATH",
55 "pointing to the folder"