[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41293] branches/bmesh/blender/source/ blender/bmesh/intern/bmesh_mesh.c: Disable converting multires to absolute space during bmesh edits, as this was causing bmesh edits that used absolute space to have no effect on the higher levels of the multires mesh .

Andrew Wiggin ender79bl at gmail.com
Wed Oct 26 14:27:29 CEST 2011


Revision: 41293
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41293
Author:   ender79
Date:     2011-10-26 12:27:29 +0000 (Wed, 26 Oct 2011)
Log Message:
-----------
Disable converting multires to absolute space during bmesh edits, as this was causing bmesh edits that used absolute space to have no effect on the higher levels of the multires mesh.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c	2011-10-26 10:49:21 UTC (rev 41292)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c	2011-10-26 12:27:29 UTC (rev 41293)
@@ -47,15 +47,20 @@
 #include "BKE_DerivedMesh.h"
 #include "BKE_multires.h"
 
+#include "ED_mesh.h"
+
 #include "bmesh.h"
 #include "bmesh_private.h"
 
-void BME_error(void);
-
 /*bmesh_error stub*/
 void bmesh_error(void)
 {
-	printf("BM modelling error!");
+	printf("BM modelling error!\n");
+
+	/* This placeholder assert makes modelling errors easier to catch
+	   in the debugger, until bmesh_error is replaced with something
+	   better. */
+	BLI_assert(0);
 }
 
 /*
@@ -81,7 +86,7 @@
 
 	bm->ob = ob;
 	
-/*allocate the memory pools for the mesh elements*/
+   /*allocate the memory pools for the mesh elements*/
 	bm->vpool = BLI_mempool_create(vsize, allocsize[0], allocsize[0], 0, 1);
 	bm->epool = BLI_mempool_create(esize, allocsize[1], allocsize[1], 0, 1);
 	bm->lpool = BLI_mempool_create(lsize, allocsize[2], allocsize[2], 0, 0);
@@ -144,6 +149,12 @@
 	BLI_mempool_destroy(bm->toolflagpool);
 	BLI_mempool_destroy(bm->looplistpool);
 
+	/* These tables aren't used yet, so it's not stricly necessary
+	   to 'end' them (with 'e' param) but if someone tries to start
+	   using them, having these in place will save a lot of pain */
+	mesh_octree_table(NULL, NULL, NULL, 'e');
+	mesh_mirrtopo_table(NULL, 'e');
+
 	BLI_freelistN(&bm->selected);
 
 	BMO_ClearStack(bm);
@@ -378,6 +389,12 @@
 void bmesh_begin_edit(BMesh *bm, int flag) {
 	bm->opflag = flag;
 	
+	/* Most operators seem to be using BMOP_UNTAN_MULTIRES to change the MDisps to
+	   absolute space during mesh edits. With this enabled, changes to the topology
+	   (loop cuts, edge subdivides, etc) are not reflected in the higher levels of
+	   the mesh at all, which doesn't seem right. Turning off completely for now,
+	   until this is shown to be better for certain types of mesh edits. */
+#if BMOP_UNTAN_MULTIRES_ENABLED
 	/*switch multires data out of tangent space*/
 	if ((flag & BMOP_UNTAN_MULTIRES) && CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
 		bmesh_set_mdisps_space(bm, MULTIRES_SPACE_TANGENT, MULTIRES_SPACE_ABSOLUTE);
@@ -388,9 +405,16 @@
 	} else if (flag & BMOP_RATIONALIZE_NORMALS) {
 		bmesh_rationalize_normals(bm, 0);
 	}
+#else
+	if (flag & BMOP_RATIONALIZE_NORMALS) {
+		bmesh_rationalize_normals(bm, 0);
+	}
+#endif
 }
 
 void bmesh_end_edit(BMesh *bm, int flag){
+	/* BMOP_UNTAN_MULTIRES disabled for now, see comment above in bmesh_begin_edit. */
+#if BMOP_UNTAN_MULTIRES_ENABLED
 	/*switch multires data into tangent space*/
 	if ((flag & BMOP_UNTAN_MULTIRES) && CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
 		/*set normals to their previous winding*/
@@ -399,6 +423,11 @@
 	} else if (flag & BMOP_RATIONALIZE_NORMALS) {
 		bmesh_rationalize_normals(bm, 1);
 	}
+#else
+	if (flag & BMOP_RATIONALIZE_NORMALS) {
+		bmesh_rationalize_normals(bm, 1);
+	}
+#endif
 
 	bm->opflag = 0;
 




More information about the Bf-blender-cvs mailing list