glTF importer: perf improvment when accessor is shared by multiple primitives

This commit is contained in:
Julien Duroure 2019-09-27 19:33:08 +02:00
parent 48ef856ed3
commit 0dbe126969
2 changed files with 9 additions and 7 deletions

View File

@ -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, 78),
"version": (0, 9, 79),
'blender': (2, 81, 6),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@ -70,12 +70,14 @@ class BlenderPrimitive():
# unused)
pidx_to_bidx = [-1] * len(positions)
bidx = len(bme_verts)
for pidx in range(0, len(positions)):
if pidx in used_pidxs:
bme_verts.new(positions[pidx])
vert_idxs.append((bidx, pidx))
pidx_to_bidx[pidx] = bidx
bidx += 1
if bpy.app.debug:
used_pidxs = list(used_pidxs)
used_pidxs.sort()
for pidx in used_pidxs:
bme_verts.new(positions[pidx])
vert_idxs.append((bidx, pidx))
pidx_to_bidx[pidx] = bidx
bidx += 1
bme_verts.ensure_lookup_table()
# Add edges/faces to bmesh