Hello,

Currently, blender fails to export as GLTF2:

07:59:45 | WARNING: Unsupported platform openbsd6, Draco mesh compression is 
unavailable
Python: Traceback (most recent call last):
  File "/usr/local/share/blender/scripts/addons/io_scene_gltf2/__init__.py", 
line 116, in __init__
    self.is_draco_available = gltf2_io_draco_compression_extension.dll_exists()
  File 
"/usr/local/share/blender/scripts/addons/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py",
 line 62, in dll_exists
    exists = dll_path().exists()
  File 
"/usr/local/share/blender/scripts/addons/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py",
 line 54, in dll_path
    return path / library_name
TypeError: unsupported operand type(s) for /: 'NoneType' and 'NoneType'

This is because of a couple of lookups table per-OS, so simply adding
"openbsd6" fixes it, even if we don't have this draco compression
library (AFAICS.)

I didn't try to build the package; I only applied the patch in the
installed file, and it seems to work fine: I can now export as GLTF2 and
do the import in games/godot.

The only thing I fear is that a patch like this will be silently broken
in some months when we switch to the 7.0.  Avoid the sys.platform lookup
would also be an option, but it won't be possible to upstream the patch
then.  What's the best thing to do in cases like this?

Thanks,


Omar Polo


Index: Makefile
===================================================================
RCS file: /home/cvs/ports/graphics/blender/Makefile,v
retrieving revision 1.103
diff -u -p -r1.103 Makefile
--- Makefile    27 Mar 2021 15:15:06 -0000      1.103
+++ Makefile    15 May 2021 07:43:41 -0000
@@ -6,6 +6,7 @@ DPB_PROPERTIES = parallel
 COMMENT =      3D creation software
 
 DISTNAME =     blender-2.92.0
+REVISION =     0
 
 CATEGORIES =   graphics
 
Index: 
patches/patch-release_scripts_addons_io_scene_gltf2_io_com_gltf2_io_draco_compression_extension_py
===================================================================
RCS file: 
patches/patch-release_scripts_addons_io_scene_gltf2_io_com_gltf2_io_draco_compression_extension_py
diff -N 
patches/patch-release_scripts_addons_io_scene_gltf2_io_com_gltf2_io_draco_compression_extension_py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
patches/patch-release_scripts_addons_io_scene_gltf2_io_com_gltf2_io_draco_compression_extension_py
  15 May 2021 07:50:31 -0000
@@ -0,0 +1,24 @@
+$OpenBSD$
+
+Fix the GLTF2 exporter crash: even if we don't have the draco
+compression library, avoid path and library_name being None.
+
+Index: 
release/scripts/addons/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py
+--- 
release/scripts/addons/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py.orig
++++ 
release/scripts/addons/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py
+@@ -35,6 +35,7 @@ def dll_path() -> Path:
+         path = {
+             'win32': blender_root / python_lib / 'site-packages',
+             'linux': blender_root / python_lib / python_version / 
'site-packages',
++            'openbsd6': blender_root / python_lib / python_version / 
'site-packages',
+             'darwin': blender_root.parent / 'Resources' / python_lib / 
python_version / 'site-packages'
+         }.get(sys.platform)
+     else:
+@@ -43,6 +44,7 @@ def dll_path() -> Path:
+     library_name = {
+         'win32': '{}.dll'.format(lib_name),
+         'linux': 'lib{}.so'.format(lib_name),
++        'openbsd6': 'lib{}.so'.format(lib_name),
+         'darwin': 'lib{}.dylib'.format(lib_name)
+     }.get(sys.platform)
+ 

Reply via email to