FBX IO: Use the new ShapeKey.points with faster foreach_get/set #105133

Merged
Thomas Barlow merged 2 commits from Mysteryem/blender-addons:shape_key_points_fbx into main 2024-01-24 05:06:50 +01:00
3 changed files with 3 additions and 3 deletions

View File

@ -5,7 +5,7 @@
bl_info = { bl_info = {
"name": "FBX format", "name": "FBX format",
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem", "author": "Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem",
"version": (5, 11, 5), "version": (5, 11, 6),
"blender": (4, 1, 0), "blender": (4, 1, 0),
"location": "File > Import-Export", "location": "File > Import-Export",
"description": "FBX IO meshes, UVs, vertex colors, materials, textures, cameras, lamps and actions", "description": "FBX IO meshes, UVs, vertex colors, materials, textures, cameras, lamps and actions",

View File

@ -2753,7 +2753,7 @@ def fbx_data_from_scene(scene, depsgraph, settings):
_cos = MESH_ATTRIBUTE_POSITION.to_ndarray(me.attributes) _cos = MESH_ATTRIBUTE_POSITION.to_ndarray(me.attributes)
else: else:
_cos = np.empty(len(me.vertices) * 3, dtype=co_bl_dtype) _cos = np.empty(len(me.vertices) * 3, dtype=co_bl_dtype)
shape_key.data.foreach_get("co", _cos) shape_key.points.foreach_get("co", _cos)
return vcos_transformed(_cos, geom_mat_co, co_fbx_dtype) return vcos_transformed(_cos, geom_mat_co, co_fbx_dtype)
for shape in me.shape_keys.key_blocks[1:]: for shape in me.shape_keys.key_blocks[1:]:

View File

@ -2002,7 +2002,7 @@ def blen_read_shapes(fbx_tmpl, fbx_data, objects, me, scene):
if dvcos.any(): if dvcos.any():
shape_cos = me_vcos_vector_view.copy() shape_cos = me_vcos_vector_view.copy()
shape_cos[indices] += dvcos shape_cos[indices] += dvcos
kb.data.foreach_set("co", shape_cos.ravel()) kb.points.foreach_set("co", shape_cos.ravel())
shape_key_values_in_range &= expand_shape_key_range(kb, weight) shape_key_values_in_range &= expand_shape_key_range(kb, weight)