Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-11-28 09:33:53 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-11-28 09:33:53 +0300
commit716c08903219ad57dcb4a2d970065a7b84c5aef7 (patch)
tree84a5497145c3a8ec2c89feda469df4ba4dd944ac /source/blender/bmesh
parent6288dbffb6c1f98a04f7c25ed96caa963e5c8819 (diff)
Fix separating mesh parts breaking vertex parents & hooks
Follow up on T71865 which only reported the issue for shape keys.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index 4e65ac40dd4..3942cdd27fb 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -574,6 +574,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
const int cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT);
const int cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT);
const int cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
+ const int cd_shape_keyindex_offset = CustomData_get_offset(&bm->vdata, CD_SHAPE_KEYINDEX);
ototvert = me->totvert;
@@ -831,8 +832,6 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
/* See comment below, this logic is in twice. */
if (me->key) {
- const int cd_shape_keyindex_offset = CustomData_get_offset(&bm->vdata, CD_SHAPE_KEYINDEX);
-
KeyBlock *currkey;
KeyBlock *actkey = BLI_findlink(&me->key->block, bm->shapenr - 1);
@@ -972,14 +971,15 @@ 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);
- }
+ /* Run this even when shape keys aren't used since it may be used for hooks or vertex parents. */
+ 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);
}
}
}