[Bf-blender-cvs] [0cc2a72f94b] master: Fix failing tests from vertex group name parameter copy

Hans Goudey noreply at git.blender.org
Thu Jul 15 18:27:17 CEST 2021


Commit: 0cc2a72f94b71d5594a0aca088007ecbb3221b60
Author: Hans Goudey
Date:   Thu Jul 15 12:25:36 2021 -0400
Branches: master
https://developer.blender.org/rB0cc2a72f94b71d5594a0aca088007ecbb3221b60

Fix failing tests from vertex group name parameter copy

It turns out `BKE_mesh_copy_parameters` can be called while other
tools are running calculations, which meant that it was called at the
same time as `armature_deform_coords_impl`. Beause of that, we
shouldn't do any freeing (of the old vertex group names) there.

Since the materials are copied in the "for_eval" version anyway,
it seems to make sense to copy the vertex group name list there also.

Fixes T89877, and also the failing `deform_modifiers` test.

Differential Revision: https://developer.blender.org/D11936

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

M	source/blender/blenkernel/intern/mesh.c

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

diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index c4186ad3180..4102703ca7c 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -932,10 +932,6 @@ void BKE_mesh_copy_parameters(Mesh *me_dst, const Mesh *me_src)
   copy_v3_v3(me_dst->loc, me_src->loc);
   copy_v3_v3(me_dst->size, me_src->size);
 
-  /* Some callers call this on existing meshes, so free the existing vertex groups first. */
-  BLI_freelistN(&me_dst->vertex_group_names);
-  BKE_defgroup_copy_list(&me_dst->vertex_group_names, &me_src->vertex_group_names);
-
   me_dst->vertex_group_active_index = me_src->vertex_group_active_index;
 }
 
@@ -952,6 +948,10 @@ void BKE_mesh_copy_parameters_for_eval(Mesh *me_dst, const Mesh *me_src)
 
   BKE_mesh_copy_parameters(me_dst, me_src);
 
+  /* Copy vertex group names. */
+  BLI_assert(BLI_listbase_is_empty(&me_dst->vertex_group_names));
+  BKE_defgroup_copy_list(&me_dst->vertex_group_names, &me_src->vertex_group_names);
+
   /* Copy materials. */
   if (me_dst->mat != NULL) {
     MEM_freeN(me_dst->mat);



More information about the Bf-blender-cvs mailing list