diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-22 05:42:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-22 05:42:19 +0300 |
commit | 36618a099673a4d6b8552a67d469a223153f55a1 (patch) | |
tree | e39e106216c75ccb23633fa01f10c89ee25b2d7d /source | |
parent | b5e3d2a2eaec5ac20c959538a9c161b25e2087a7 (diff) |
operator ED_OT_undo_push, needed for editmode undo/redo glitch fix, (coming next).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/include/ED_util.h | 1 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 1 | ||||
-rw-r--r-- | source/blender/editors/util/undo.c | 25 |
3 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index 6943772e6ff..77b754519fb 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -57,6 +57,7 @@ void ED_undo_pop_op (struct bContext *C, struct wmOperator *op); void ED_undo_pop (struct bContext *C); void ED_undo_redo (struct bContext *C); void ED_OT_undo (struct wmOperatorType *ot); +void ED_OT_undo_push (struct wmOperatorType *ot); void ED_OT_redo (struct wmOperatorType *ot); int ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 33c1fce4872..1bc485c645a 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3075,6 +3075,7 @@ void ED_operatortypes_screen(void) /* tools shared by more space types */ WM_operatortype_append(ED_OT_undo); + WM_operatortype_append(ED_OT_undo_push); WM_operatortype_append(ED_OT_redo); } diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index a992e33e7d6..c3294657635 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -60,9 +60,13 @@ #include "WM_api.h" #include "WM_types.h" +#include "RNA_access.h" +#include "RNA_define.h" #include "util_intern.h" +#define MAXUNDONAME 64 /* XXX, make common define */ + /* ***************** generic undo system ********************* */ void ED_undo_push(bContext *C, const char *str) @@ -252,6 +256,14 @@ static int ed_undo_exec(bContext *C, wmOperator *UNUSED(op)) return ed_undo_step(C, 1, NULL); } +static int ed_undo_push_exec(bContext *C, wmOperator *op) +{ + char str[MAXUNDONAME]; + RNA_string_get(op->ptr, "message", str); + ED_undo_push(C, str); + return OPERATOR_FINISHED; +} + static int ed_redo_exec(bContext *C, wmOperator *UNUSED(op)) { return ed_undo_step(C, -1, NULL); @@ -298,6 +310,19 @@ void ED_OT_undo(wmOperatorType *ot) ot->poll= ED_operator_screenactive; } +void ED_OT_undo_push(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Undo Push"; + ot->description= "Add an undo state (internal use only)"; + ot->idname= "ED_OT_undo_push"; + + /* api callbacks */ + ot->exec= ed_undo_push_exec; + + RNA_def_string(ot->srna, "message", "Add an undo step *function may be moved*", MAXUNDONAME, "Undo Message", ""); +} + void ED_OT_redo(wmOperatorType *ot) { /* identifiers */ |