From 1f4307669b5290932be0269f4f8e1a3d1e69a233 Mon Sep 17 00:00:00 2001 From: Thomas Barlow Date: Wed, 17 Jan 2024 13:25:20 +0000 Subject: [PATCH 1/2] FBX IO: Use the new ShapeKey.points with faster foreach_get/set Added to Blender 4.1.0 in ??????????, ShapeKey.points gives optimized access to shape key points data (meshes/lattices) when accessed with #foreach_get and #foreach_set. --- io_scene_fbx/export_fbx_bin.py | 2 +- io_scene_fbx/import_fbx.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py index 3bdf2dfbd..b4f5de98a 100644 --- a/io_scene_fbx/export_fbx_bin.py +++ b/io_scene_fbx/export_fbx_bin.py @@ -2753,7 +2753,7 @@ def fbx_data_from_scene(scene, depsgraph, settings): _cos = MESH_ATTRIBUTE_POSITION.to_ndarray(me.attributes) else: _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) for shape in me.shape_keys.key_blocks[1:]: diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py index 295b41cee..ff37e4d71 100644 --- a/io_scene_fbx/import_fbx.py +++ b/io_scene_fbx/import_fbx.py @@ -2002,7 +2002,7 @@ def blen_read_shapes(fbx_tmpl, fbx_data, objects, me, scene): if dvcos.any(): shape_cos = me_vcos_vector_view.copy() 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) -- 2.30.2 From 17b40a7151b5c5a9556c79d542b69a89f3320e8e Mon Sep 17 00:00:00 2001 From: Thomas Barlow Date: Wed, 24 Jan 2024 04:04:46 +0000 Subject: [PATCH 2/2] Increase FBX IO version --- io_scene_fbx/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py index 6424d3757..b07e1ede9 100644 --- a/io_scene_fbx/__init__.py +++ b/io_scene_fbx/__init__.py @@ -5,7 +5,7 @@ bl_info = { "name": "FBX format", "author": "Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem", - "version": (5, 11, 5), + "version": (5, 11, 6), "blender": (4, 1, 0), "location": "File > Import-Export", "description": "FBX IO meshes, UVs, vertex colors, materials, textures, cameras, lamps and actions", -- 2.30.2