diff options
author | Joseph Eagar <joeedh@gmail.com> | 2009-08-06 13:56:14 +0400 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2009-08-06 13:56:14 +0400 |
commit | 38de6d14e4e7a55a4109313942df3ae9211b1aeb (patch) | |
tree | 83288d248bc7a4794b8b34e607f3e319e905b381 /source/blender/editors/util | |
parent | 416a3bf4a14a951642cace5ee8033c4c20dd9f66 (diff) | |
parent | 1e4fb484001994f4e164aab7b44c9578df59f67d (diff) |
merge with 2.5 (not trunk, last merge message said that on accident) at r22252
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r-- | source/blender/editors/util/editmode_undo.c | 15 | ||||
-rw-r--r-- | source/blender/editors/util/undo.c | 49 | ||||
-rw-r--r-- | source/blender/editors/util/util_intern.h | 1 |
3 files changed, 48 insertions, 17 deletions
diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index 8484ad78bc4..17a1e0b6cdb 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -297,6 +297,21 @@ static void undo_number(bContext *C, int nr) undo_editmode_step(C, 0); } +void undo_editmode_name(bContext *C, const char *undoname) +{ + UndoElem *uel; + + for(uel= undobase.last; uel; uel= uel->prev) { + if(strcmp(undoname, uel->name)==0) + break; + } + if(uel && uel->prev) { + curundo= uel->prev; + undo_editmode_step(C, 0); + } +} + + /* ************** for interaction with menu/pullown */ void undo_editmode_menu(bContext *C) diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 6f742d70440..435f2c7ecf4 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -71,10 +71,11 @@ #include "UI_interface.h" #include "UI_resources.h" +#include "util_intern.h" + /* ***************** generic undo system ********************* */ /* ********* XXX **************** */ -static void undo_push_mball() {} static void sound_initialize_sounds() {} /* ********* XXX **************** */ @@ -82,7 +83,7 @@ void ED_undo_push(bContext *C, char *str) { wmWindowManager *wm= CTX_wm_manager(C); Object *obedit= CTX_data_edit_object(C); - + if(obedit) { if (U.undosteps == 0) return; @@ -93,7 +94,7 @@ void ED_undo_push(bContext *C, char *str) else if (obedit->type==OB_FONT) undo_push_font(C, str); else if (obedit->type==OB_MBALL) - undo_push_mball(str); + undo_push_mball(C, str); else if (obedit->type==OB_LATTICE) undo_push_lattice(C, str); else if (obedit->type==OB_ARMATURE) @@ -115,13 +116,7 @@ void ED_undo_push(bContext *C, char *str) } } -void ED_undo_push_op(bContext *C, wmOperator *op) -{ - /* in future, get undo string info? */ - ED_undo_push(C, op->type->name); -} - -static int ed_undo_step(bContext *C, int step) +static int ed_undo_step(bContext *C, int step, const char *undoname) { Object *obedit= CTX_data_edit_object(C); ScrArea *sa= CTX_wm_area(C); @@ -141,8 +136,12 @@ static int ed_undo_step(bContext *C, int step) ED_text_undo_step(C, step); } else if(obedit) { - if ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) - undo_editmode_step(C, step); + if ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) { + if(undoname) + undo_editmode_name(C, undoname); + else + undo_editmode_step(C, step); + } } else { int do_glob_undo= 0; @@ -164,7 +163,10 @@ static int ed_undo_step(bContext *C, int step) #ifndef DISABLE_PYTHON // XXX BPY_scripts_clear_pyobjects(); #endif - BKE_undo_step(C, step); + if(undoname) + BKE_undo_name(C, undoname); + else + BKE_undo_step(C, step); sound_initialize_sounds(); } @@ -178,22 +180,35 @@ static int ed_undo_step(bContext *C, int step) void ED_undo_pop(bContext *C) { - ed_undo_step(C, 1); + ed_undo_step(C, 1, NULL); } void ED_undo_redo(bContext *C) { - ed_undo_step(C, -1); + ed_undo_step(C, -1, NULL); +} + +void ED_undo_push_op(bContext *C, wmOperator *op) +{ + /* in future, get undo string info? */ + ED_undo_push(C, op->type->name); +} + +void ED_undo_pop_op(bContext *C, wmOperator *op) +{ + /* search back a couple of undo's, in case something else added pushes */ + ed_undo_step(C, 0, op->type->name); } static int ed_undo_exec(bContext *C, wmOperator *op) { /* "last operator" should disappear, later we can tie ths with undo stack nicer */ WM_operator_stack_clear(C); - return ed_undo_step(C, 1); + return ed_undo_step(C, 1, NULL); } + static int ed_redo_exec(bContext *C, wmOperator *op) { - return ed_undo_step(C, -1); + return ed_undo_step(C, -1, NULL); } void ED_undo_menu(bContext *C) diff --git a/source/blender/editors/util/util_intern.h b/source/blender/editors/util/util_intern.h index 37e6c5c25e1..8a0787dde3f 100644 --- a/source/blender/editors/util/util_intern.h +++ b/source/blender/editors/util/util_intern.h @@ -33,6 +33,7 @@ /* editmode_undo.c */ void undo_editmode_clear(void); +void undo_editmode_name(bContext *C, const char *undoname); #endif /* ED_UTIL_INTERN_H */ |