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.
This commit is contained in:
Brecht Van Lommel
2012-08-23 13:54:30 +00:00
parent 6a13ae2b52
commit 0dd42fd513
2 changed files with 16 additions and 0 deletions

View File

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

View File

@@ -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++;
}
}