gltf: Use the new ShapeKey.points with faster foreach_get/set #105134
@ -871,14 +871,14 @@ class PrimitiveCreator:
|
||||
|
||||
def __get_positions(self):
|
||||
self.locs = np.empty(len(self.blender_mesh.vertices) * 3, dtype=np.float32)
|
||||
source = self.key_blocks[0].relative_key.data if self.key_blocks else self.blender_mesh.vertices
|
||||
source = self.key_blocks[0].relative_key.points if self.key_blocks else self.blender_mesh.vertices
|
||||
source.foreach_get('co', self.locs)
|
||||
self.locs = self.locs.reshape(len(self.blender_mesh.vertices), 3)
|
||||
|
||||
self.morph_locs = []
|
||||
for key_block in self.key_blocks:
|
||||
vs = np.empty(len(self.blender_mesh.vertices) * 3, dtype=np.float32)
|
||||
key_block.data.foreach_get('co', vs)
|
||||
key_block.points.foreach_get('co', vs)
|
||||
vs = vs.reshape(len(self.blender_mesh.vertices), 3)
|
||||
self.morph_locs.append(vs)
|
||||
|
||||
|
@ -370,7 +370,7 @@ def do_primitives(gltf, mesh_idx, skin_idx, mesh, ob):
|
||||
|
||||
ob.shape_key_add(name=sk_name)
|
||||
key_block = mesh.shape_keys.key_blocks[sk_name]
|
||||
key_block.data.foreach_set('co', squish(sk_vert_locs[sk_i]))
|
||||
key_block.points.foreach_set('co', squish(sk_vert_locs[sk_i]))
|
||||
|
||||
sk_i += 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user