diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-11-27 22:12:17 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-11-27 22:17:14 +0300 |
commit | 7711231838e726055c6690757f3799dff90bfd96 (patch) | |
tree | 4e41e96ddaeb612dc128bf160c4baa8fafb60ded /source/blender/bmesh/intern/bmesh_mesh_conv.c | |
parent | e7502ee0aa8e27247689ef8debccaaa3b8b056bf (diff) |
Fix T71865: Separating mesh parts breaks shape keys
This was an old bug which could be caused by saving after separating.
Changes from 79b703bb635e made this fail reliably.
Update shape key indices when they may be used again later.
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_mesh_conv.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_conv.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c index 9bcc9b9e84b..4e65ac40dd4 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_conv.c +++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c @@ -972,6 +972,16 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh if (ofs) { MEM_freeN(ofs); } + + if (params->update_shapekey_indices) { + /* We have written a new shape key, if this mesh is _not_ going to be freed, + * update the shape key indices to match the newly updated. */ + if (cd_shape_keyindex_offset != -1) { + BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) { + BM_ELEM_CD_SET_INT(eve, cd_shape_keyindex_offset, i); + } + } + } } if (oldverts != NULL) { |