diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2016-11-16 19:01:19 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2016-11-16 19:04:21 +0300 |
commit | 2bcb1b208a4193fb28f1e0c4408b733f5ee2c028 (patch) | |
tree | 8b9260ffd9fb7b371dc66955903c7b0c7f4e7bf9 /source/blender/editors/util | |
parent | 930f999f6ea683d02ac490026a52817f1d965377 (diff) | |
parent | 2a2eb0c463bd96d42f7306eb17f88cad87f73aea (diff) |
Merge remote-tracking branch 'origin/master' into blender2.8
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r-- | source/blender/editors/util/undo.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 805238bd2af..7fd67849414 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -205,6 +205,19 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) return OPERATOR_FINISHED; } +void ED_undo_grouped_push(bContext *C, const char *str) +{ + /* do nothing if previous undo task is the same as this one (or from the same undo group) */ + const char *last_undo = BKE_undo_get_name_last(); + + if (last_undo && STREQ(str, last_undo)) { + return; + } + + /* push as usual */ + ED_undo_push(C, str); +} + void ED_undo_pop(bContext *C) { ed_undo_step(C, 1, NULL); @@ -220,6 +233,16 @@ void ED_undo_push_op(bContext *C, wmOperator *op) ED_undo_push(C, op->type->name); } +void ED_undo_grouped_push_op(bContext *C, wmOperator *op) +{ + if (op->type->undo_group[0] != '\0') { + ED_undo_grouped_push(C, op->type->undo_group); + } + else { + ED_undo_grouped_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 */ |