diff options
Diffstat (limited to 'io_scene_gltf2/blender')
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gltf2_exporter.py | 35 |
1 files changed, 18 insertions, 17 deletions
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 |