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
This commit is contained in:
Hans Goudey 2021-07-15 12:25:36 -04:00
parent 3af0e1f6fd
commit 0cc2a72f94
Notes: blender-bot 2023-02-14 08:40:26 +01:00
Referenced by issue #89877, Crash with inconsistent backtrace when weight painting with driven subsurf modifier
1 changed files with 4 additions and 4 deletions

View File

@ -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);