diff options
-rwxr-xr-x | io_scene_gltf2/__init__.py | 2 | ||||
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gltf2_exporter.py | 35 |
2 files changed, 19 insertions, 18 deletions
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py index a4473b5a..1003bf69 100755 --- a/io_scene_gltf2/__init__.py +++ b/io_scene_gltf2/__init__.py @@ -15,7 +15,7 @@ bl_info = { 'name': 'glTF 2.0 format', 'author': 'Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors', - "version": (0, 9, 34), + "version": (0, 9, 35), 'blender': (2, 80, 0), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0', diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gltf2_exporter.py b/io_scene_gltf2/blender/exp/gltf2_blender_gltf2_exporter.py index fbb43836..19157c46 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gltf2_exporter.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gltf2_exporter.py @@ -110,23 +110,24 @@ class GlTF2Exporter: if self.__finalized: raise RuntimeError("Tried to finalize buffers for finalized glTF file") - if is_glb: - uri = None - elif output_path and buffer_name: - with open(output_path + buffer_name, 'wb') as f: - f.write(self.__buffer.to_bytes()) - uri = buffer_name - else: - uri = self.__buffer.to_embed_string() - - buffer = gltf2_io.Buffer( - byte_length=self.__buffer.byte_length, - extensions=None, - extras=None, - name=None, - uri=uri - ) - self.__gltf.buffers.append(buffer) + if self.__buffer.byte_length > 0: + if is_glb: + uri = None + elif output_path and buffer_name: + with open(output_path + buffer_name, 'wb') as f: + f.write(self.__buffer.to_bytes()) + uri = buffer_name + else: + uri = self.__buffer.to_embed_string() + + buffer = gltf2_io.Buffer( + byte_length=self.__buffer.byte_length, + extensions=None, + extras=None, + name=None, + uri=uri + ) + self.__gltf.buffers.append(buffer) self.__finalized = True |