From 524b8614373df3e1eb212939f048a79b75450c28 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Fri, 26 Jun 2009 15:48:09 +0000 Subject: 2.5 Part one (of probably many :) of Operator review/validation. Nothing final nor defined, it's reseach :) - Added tool buttons in "Toolbar" (Tkey). Just four examples for objectmode, and six for mesh editmode. (Review in progress is operator internal state vs context, what do redo exactly, undo vs redo syncing, when op->invoke or not, etc. This has to be pinned down exactly and frozen asap) - On undo, clear redo-operator-stack for now (won't work) - Added call to better detect active/current view3d region. ED_view3d_context_rv3d(C) - Fixed some operators that missed correct redo (add-prim etc). Later more fun! --- source/blender/editors/object/object_edit.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'source/blender/editors/object/object_edit.c') diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 7a75e3875ea..8102b1bfb9c 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -340,7 +340,7 @@ static int object_add_mesh_exec(bContext *C, wmOperator *op) if(obedit==NULL || obedit->type!=OB_MESH) { object_add_type(C, OB_MESH); - ED_object_enter_editmode(C, 0); + ED_object_enter_editmode(C, EM_DO_UNDO); newob = 1; } else DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); @@ -398,8 +398,8 @@ void OBJECT_OT_mesh_add(wmOperatorType *ot) ot->poll= ED_operator_scene_editable; - /* flags */ - ot->flag= 0; + /* flags: no register or undo, this operator calls operators */ + ot->flag= 0; //OPTYPE_REGISTER|OPTYPE_UNDO; RNA_def_enum(ot->srna, "type", prop_mesh_types, 0, "Primitive", ""); } @@ -1395,7 +1395,8 @@ static int parent_clear_exec(bContext *C, wmOperator *op) DAG_scene_sort(CTX_data_scene(C)); ED_anim_dag_flush_update(C); - + WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); + return OPERATOR_FINISHED; } @@ -2600,7 +2601,8 @@ static int parent_set_exec(bContext *C, wmOperator *op) CTX_DATA_END; DAG_scene_sort(CTX_data_scene(C)); - ED_anim_dag_flush_update(C); + ED_anim_dag_flush_update(C); + WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; } @@ -2648,7 +2650,7 @@ void OBJECT_OT_parent_set(wmOperatorType *ot) ot->poll= ED_operator_object_active; /* flags */ - ot->flag= 0; + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; RNA_def_enum(ot->srna, "type", prop_make_parent_types, 0, "Type", ""); } @@ -3349,6 +3351,7 @@ void ED_object_enter_editmode(bContext *C, int flag) WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene); } + if(flag & EM_DO_UNDO) ED_undo_push(C, "Enter Editmode"); if(flag & EM_WAITCURSOR) waitcursor(0); } -- cgit v1.2.3