From ca05219f3ec3574d2e1cb9c8eaa2790f685f26bb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 27 Mar 2012 00:01:35 +0000 Subject: fix [#30651] bpy.ops.object.mode_set(...) editmode removes faces. problem was that BMesh had tessellation call when undo pushes were called. if python called an operator with no undo push, tessfaces would not be created. fix this by making it the responsibility of each editmesh operator to re-tessellate, as it is with notifiers and depsgraph. added EDBM_update_generic() function to add notifier, tag for depsgraph update and optionally re-tessellate. --- source/blender/editors/mesh/editmesh_add.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'source/blender/editors/mesh/editmesh_add.c') diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index cb2442ff0b5..0d40e8585c3 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -98,29 +98,20 @@ static void make_prim_init(bContext *C, const char *idname, ED_object_enter_editmode(C, EM_DO_UNDO | EM_IGNORE_LAYER); /* rare cases the active layer is messed up */ *state = 1; } - else { - DAG_id_tag_update(&obedit->id, OB_RECALC_DATA); - } *dia *= new_primitive_matrix(C, loc, rot, mat); } static void make_prim_finish(bContext *C, int *state, int enter_editmode) { - Object *obedit; - Mesh *me; - BMEditMesh *em; - - obedit = CTX_data_edit_object(C); - me = obedit->data; - em = me->edit_btmesh; + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BMEdit_FromObject(obedit); /* Primitive has all verts selected, use vert select flush * to push this up to edges & faces. */ EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX); - DAG_id_tag_update(obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); + EDBM_update_generic(C, em, TRUE); /* userdef */ if (*state && !enter_editmode) { -- cgit v1.2.3