Fix bug 29123, subdivide smooth distorts shape with numcuts > 1.

Three fixes:

* When smoothing a coord, the original position should be based off
  the unsmoothed subdivision (i.e. the vertex coord rather than the
  smoothed position in the shapekey)

* The normal of new vertices created by edge split must be updated
  (used the same interpolation as pre-bmesh here)

* The vertices created inside the subdivided face should use the
  subdivided coords from edges, so copy the shapekey coords back to
  vertex coords after subdividing edges
This commit is contained in:
2012-03-27 09:24:00 +00:00
parent b37387d3b0
commit 6420dc23fd

View File

@@ -104,6 +104,7 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar
BM_vert_normal_update_all(bm, v);
co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, CD_SHAPEKEY, params->origkey);
copy_v3_v3(co, v->co);
copy_v3_v3(prev_co, co);
if (params->beauty & B_SMOOTH) {
@@ -205,6 +206,9 @@ static BMVert *bm_subdivide_edge_addvert(BMesh *bm, BMEdge *edge, BMEdge *oedge,
}
#endif
interp_v3_v3v3(ev->no, vsta->no, vend->no, percent2);
normalize_v3(ev->no);
return ev;
}
@@ -888,6 +892,12 @@ void bmo_esubd_exec(BMesh *bmesh, BMOperator *op)
bm_subdivide_multicut(bmesh, edge, &params, edge->v1, edge->v2);
}
/* copy original-geometry displacements to current coordinate */
BM_ITER(v, &viter, bmesh, BM_VERTS_OF_MESH, NULL) {
float *co = CustomData_bmesh_get_n(&bmesh->vdata, v->head.data, CD_SHAPEKEY, skey);
copy_v3_v3(v->co, co);
}
i = 0;
for (i = 0; i < BLI_array_count(facedata); i++) {
face = facedata[i].face;