[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50941] trunk/blender/source/blender/ editors: fix/workaround [#31811] Subdivision Surface ( Apply modifier to editing cage during Editmode) Loop Cut Crash

Campbell Barton ideasman42 at gmail.com
Fri Sep 28 13:02:44 CEST 2012


Revision: 50941
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50941
Author:   campbellbarton
Date:     2012-09-28 11:02:43 +0000 (Fri, 28 Sep 2012)
Log Message:
-----------
fix/workaround [#31811] Subdivision Surface (Apply modifier to editing cage during Editmode) Loop Cut Crash

A correct fix for this bug likely involves changuing how operators are called in the event loop but such changes better not be made just before the release.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_mesh.h
    trunk/blender/source/blender/editors/mesh/editmesh_loopcut.c
    trunk/blender/source/blender/editors/mesh/editmesh_utils.c

Modified: trunk/blender/source/blender/editors/include/ED_mesh.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_mesh.h	2012-09-28 09:35:32 UTC (rev 50940)
+++ trunk/blender/source/blender/editors/include/ED_mesh.h	2012-09-28 11:02:43 UTC (rev 50941)
@@ -79,6 +79,7 @@
 void           EDBM_verts_mirror_cache_clear(struct BMEditMesh *em, struct BMVert *v);
 void           EDBM_verts_mirror_cache_end(struct BMEditMesh *em);
 
+void EDBM_mesh_ensure_valid_dm_hack(struct Scene *scene, struct BMEditMesh *em);
 void EDBM_mesh_normals_update(struct BMEditMesh *em);
 void EDBM_mesh_clear(struct BMEditMesh *em);
 

Modified: trunk/blender/source/blender/editors/mesh/editmesh_loopcut.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_loopcut.c	2012-09-28 09:35:32 UTC (rev 50940)
+++ trunk/blender/source/blender/editors/mesh/editmesh_loopcut.c	2012-09-28 11:02:43 UTC (rev 50941)
@@ -373,11 +373,12 @@
 	op->customdata = NULL;
 }
 
+
 /* called when modal loop selection gets set up... */
 static int ringsel_init(bContext *C, wmOperator *op, int do_cut)
 {
 	RingSelOpData *lcd;
-	
+
 	/* alloc new customdata */
 	lcd = op->customdata = MEM_callocN(sizeof(RingSelOpData), "ringsel Modal Op Data");
 	
@@ -392,7 +393,10 @@
 	initNumInput(&lcd->num);
 	lcd->num.idx_max = 0;
 	lcd->num.flag |= NUM_NO_NEGATIVE | NUM_NO_FRACTION;
-	
+
+	/* XXX, temp, workaround for [#	] */
+	EDBM_mesh_ensure_valid_dm_hack(CTX_data_scene(C), lcd->em);
+
 	em_setup_viewcontext(C, &lcd->vc);
 
 	ED_region_tag_redraw(lcd->ar);

Modified: trunk/blender/source/blender/editors/mesh/editmesh_utils.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_utils.c	2012-09-28 09:35:32 UTC (rev 50940)
+++ trunk/blender/source/blender/editors/mesh/editmesh_utils.c	2012-09-28 11:02:43 UTC (rev 50941)
@@ -48,6 +48,8 @@
 #include "BKE_report.h"
 #include "BKE_tessmesh.h"
 
+#include "BKE_object.h"  /* XXX. only for EDBM_mesh_ensure_valid_dm_hack() which will be removed */
+
 #include "WM_api.h"
 #include "WM_types.h"
 
@@ -102,8 +104,18 @@
 		BMEdit_RecalcTessellation(em);
 }
 
+/* hack to workaround multiple operators being called within the same event loop without an update
+ * see: [#31811] */
+void EDBM_mesh_ensure_valid_dm_hack(Scene *scene, BMEditMesh *em)
+{
+	if ((((ID *)em->ob->data)->flag & LIB_ID_RECALC) ||
+	    (em->ob->recalc & OB_RECALC_DATA))
+	{
+		em->ob->recalc |= OB_RECALC_DATA;  /* since we may not have done selection flushing */
+		BKE_object_handle_update(scene, em->ob);
+	}
+}
 
-
 void EDBM_mesh_normals_update(BMEditMesh *em)
 {
 	BM_mesh_normals_update(em->bm, TRUE);




More information about the Bf-blender-cvs mailing list