[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45209] trunk/blender/source/blender/bmesh /operators/bmo_subdivide.c: Fix bug 29123, subdivide smooth distorts shape with numcuts > 1.

Nicholas Bishop nicholasbishop at gmail.com
Tue Mar 27 11:24:11 CEST 2012


Revision: 45209
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45209
Author:   nicholasbishop
Date:     2012-03-27 09:24:00 +0000 (Tue, 27 Mar 2012)
Log Message:
-----------
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

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/operators/bmo_subdivide.c

Modified: trunk/blender/source/blender/bmesh/operators/bmo_subdivide.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_subdivide.c	2012-03-27 09:11:44 UTC (rev 45208)
+++ trunk/blender/source/blender/bmesh/operators/bmo_subdivide.c	2012-03-27 09:24:00 UTC (rev 45209)
@@ -104,6 +104,7 @@
 	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 @@
 	}
 #endif
 	
+	interp_v3_v3v3(ev->no, vsta->no, vend->no, percent2);
+	normalize_v3(ev->no);
+
 	return ev;
 }
 
@@ -888,6 +892,12 @@
 		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;




More information about the Bf-blender-cvs mailing list