Commit: 05d659e55e4702606a3ba7d508033036db6c246b
Author: Jacques Lucke
Date:   Thu Jun 16 16:44:58 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rB05d659e55e4702606a3ba7d508033036db6c246b

Fix T98796: avoid unnecessary mesh copy

The call to `get_component_for_write` would sometimes copy the mesh
even when the mesh is replaced with itself. The `replace_mesh` method
handles that case already, so just use that instead.

===================================================================

M       source/blender/blenkernel/intern/geometry_set_instances.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/geometry_set_instances.cc 
b/source/blender/blenkernel/intern/geometry_set_instances.cc
index d3c3f41779a..2d6e0e05a97 100644
--- a/source/blender/blenkernel/intern/geometry_set_instances.cc
+++ b/source/blender/blenkernel/intern/geometry_set_instances.cc
@@ -32,9 +32,7 @@ static void add_final_mesh_as_geometry_component(const Object 
&object, GeometryS
 
   if (mesh != nullptr) {
     BKE_mesh_wrapper_ensure_mdata(mesh);
-
-    MeshComponent &mesh_component = 
geometry_set.get_component_for_write<MeshComponent>();
-    mesh_component.replace(mesh, GeometryOwnershipType::ReadOnly);
+    geometry_set.replace_mesh(mesh, GeometryOwnershipType::ReadOnly);
   }
 }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to