Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'io_scene_gltf2/io/imp/gltf2_io_binary.py')
-rwxr-xr-xio_scene_gltf2/io/imp/gltf2_io_binary.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/io_scene_gltf2/io/imp/gltf2_io_binary.py b/io_scene_gltf2/io/imp/gltf2_io_binary.py
index 92450672..f7a101df 100755
--- a/io_scene_gltf2/io/imp/gltf2_io_binary.py
+++ b/io_scene_gltf2/io/imp/gltf2_io_binary.py
@@ -46,8 +46,11 @@ class BinaryData():
return buffer[accessor_offset + bufferview_offset:accessor_offset + bufferview_offset + bufferView.byte_length]
@staticmethod
- def get_data_from_accessor(gltf, accessor_idx):
+ def get_data_from_accessor(gltf, accessor_idx, cache=False):
"""Get data from accessor."""
+ if accessor_idx in gltf.accessor_cache:
+ return gltf.accessor_cache[accessor_idx]
+
accessor = gltf.data.accessors[accessor_idx]
bufferView = gltf.data.buffer_views[accessor.buffer_view] # TODO initialize with 0 when not present!
@@ -102,6 +105,9 @@ class BinaryData():
new_tuple += (float(i),)
data[idx] = new_tuple
+ if cache:
+ gltf.accessor_cache[accessor_idx] = data
+
return data
@staticmethod