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.
This commit is contained in:
Campbell Barton
2012-09-28 11:02:43 +00:00
parent 79d8367974
commit ad3f01e1d8
3 changed files with 20 additions and 3 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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)
{