diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-09-28 15:02:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-09-28 15:02:43 +0400 |
commit | ad3f01e1d890aa6783c17cf673c6531b3023e4e5 (patch) | |
tree | 8925d60b93cb682ca23ba7ef914a3421fd00bc23 | |
parent | 79d83679747989540c9b031765634e1fd1ce9290 (diff) |
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.
-rw-r--r-- | source/blender/editors/include/ED_mesh.h | 1 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_loopcut.c | 8 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_utils.c | 14 |
3 files changed, 20 insertions, 3 deletions
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 3d15f349f9b..02c7d52f08d 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -79,6 +79,7 @@ struct BMVert *EDBM_verts_mirror_get(struct BMEditMesh *em, struct BMVert *v); 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); diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 8b13cc61d3e..c0a36e24015 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -373,11 +373,12 @@ static void ringsel_exit(bContext *UNUSED(C), wmOperator *op) 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 @@ static int ringsel_init(bContext *C, wmOperator *op, int do_cut) 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); diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index b844ba0baa2..537d463dfbc 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -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,7 +104,17 @@ void EDBM_redo_state_free(BMBackup *backup, BMEditMesh *em, int recalctess) 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) { |