diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-08-23 17:54:30 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-08-23 17:54:30 +0400 |
commit | 0dd42fd5138f19e22c347ac0a0817d8ba605a5c4 (patch) | |
tree | 2e38815d4bc7a4392fc4927071645142f7168784 | |
parent | 6a13ae2b5238a6eec82e8f5999ddb6b3f4c19ad2 (diff) |
Fix #32387: some mesh modifications breaking other shape keys.
The vertex shapekey index is now no longer copied, and propagation of offsets
in the basis to other shapekeys is disabled if new vertices were added. The
reason being that the propagation will only be done for the old vertices leaving
the new ones behind, and so doing e.g. subdivide + translate on the basis would
create a mess on other shape keys.
-rw-r--r-- | source/blender/bmesh/intern/bmesh_core.c | 7 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_conv.c | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index 8c8cc216e96..94d94cbec3e 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -80,7 +80,14 @@ BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example) CustomData_bmesh_set_default(&bm->vdata, &v->head.data); if (example) { + int *keyi; + BM_elem_attrs_copy(bm, bm, example, v); + + /* exception: don't copy the original shapekey index */ + keyi = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_SHAPE_KEYINDEX); + if(keyi) + *keyi = ORIGINDEX_NONE; } BM_CHECK_ELEMENT(v); diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c index 123eb6829a3..51c8b5d3bd8 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_conv.c +++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c @@ -793,6 +793,15 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess) if (keyi && *keyi != ORIGINDEX_NONE) { sub_v3_v3v3(ofs[i], mvert->co, fp[*keyi]); } + else { + /* if there are new vertices in the mesh, we can't propagate the offset + * because it will only work for the existing vertices and not the new + * ones, creating a mess when doing e.g. subdivide + translate */ + MEM_freeN(ofs); + ofs = NULL; + break; + } + mvert++; } } |