[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42566] branches/bmesh/blender/source/ blender: workaround for tessface not being recalculated when undo is disabled

Campbell Barton ideasman42 at gmail.com
Sun Dec 11 06:05:51 CET 2011


Revision: 42566
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42566
Author:   campbellbarton
Date:     2011-12-11 05:05:37 +0000 (Sun, 11 Dec 2011)
Log Message:
-----------
workaround for tessface not being recalculated when undo is disabled

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/blenkernel/BKE_tessmesh.h
    branches/bmesh/blender/source/blender/editors/mesh/bmeshutils.c
    branches/bmesh/blender/source/blender/editors/util/undo.c

Modified: branches/bmesh/blender/source/blender/blenkernel/BKE_tessmesh.h
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/BKE_tessmesh.h	2011-12-11 01:06:43 UTC (rev 42565)
+++ branches/bmesh/blender/source/blender/blenkernel/BKE_tessmesh.h	2011-12-11 05:05:37 UTC (rev 42566)
@@ -62,6 +62,10 @@
 	int mirr_free_arrays;
 } BMEditMesh;
 
+/* undo triggers editmesh tessface update, this is odd but works OK.
+ * BMESH_TODO, look into having the update elsewhere. */
+#define BMESH_EM_UNDO_RECALC_TESSFACE_WORKAROUND
+
 void BMEdit_RecalcTesselation(BMEditMesh *tm);
 BMEditMesh *BMEdit_Create(BMesh *bm);
 BMEditMesh *BMEdit_Copy(BMEditMesh *tm);

Modified: branches/bmesh/blender/source/blender/editors/mesh/bmeshutils.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/bmeshutils.c	2011-12-11 01:06:43 UTC (rev 42565)
+++ branches/bmesh/blender/source/blender/editors/mesh/bmeshutils.c	2011-12-11 05:05:37 UTC (rev 42566)
@@ -559,10 +559,14 @@
 	/*make sure shape keys work*/
 	me->me.key = obme->key ? copy_key_nolib(obme->key) : NULL;
 
+#ifdef BMESH_EM_UNDO_RECALC_TESSFACE_WORKAROUND
+
 	/*we recalc the tesselation here, to avoid seeding calls to
 	  BMEdit_RecalcTesselation throughout the code.*/
 	BMEdit_RecalcTesselation(em);
 
+#endif
+
 	BMO_CallOpf(em->bm, "bmesh_to_mesh mesh=%p notesselation=%i", me, 1);
 	me->selectmode = em->selectmode;
 

Modified: branches/bmesh/blender/source/blender/editors/util/undo.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/util/undo.c	2011-12-11 01:06:43 UTC (rev 42565)
+++ branches/bmesh/blender/source/blender/editors/util/undo.c	2011-12-11 05:05:37 UTC (rev 42566)
@@ -48,7 +48,9 @@
 #include "BKE_context.h"
 #include "BKE_global.h"
 #include "BKE_screen.h"
+#include "BKE_tessmesh.h" /* BMESH_EM_UNDO_RECALC_TESSFACE_WORKAROUND */
 
+
 #include "ED_armature.h"
 #include "ED_particle.h"
 #include "ED_curve.h"
@@ -86,6 +88,19 @@
 		printf("undo push %s\n", str);
 	
 	if(obedit) {
+
+#ifdef BMESH_EM_UNDO_RECALC_TESSFACE_WORKAROUND
+		/* undo is causing tessface recalc, so without we need to do explicitly */
+
+		if (U.undosteps == 0) {
+			if (obedit->type == OB_MESH) {
+				Mesh *me= obedit->data;
+				BMEdit_RecalcTesselation(me->edit_btmesh);
+			}
+		}
+
+#endif /* BMESH_EM_UNDO_RECALC_TESSFACE_WORKAROUND */
+
 		if (U.undosteps == 0) return;
 		
 		if(obedit->type==OB_MESH)




More information about the Bf-blender-cvs mailing list