From 0b2e0877de97c79dfe0579f175f29c615a914140 Mon Sep 17 00:00:00 2001 From: Nathan Craddock Date: Mon, 19 Aug 2019 08:58:13 -0600 Subject: Outliner: sync selection on undo/redo Tags all outliner sync types on undo and redo operations. --- source/blender/editors/include/ED_outliner.h | 1 + source/blender/editors/space_outliner/outliner_select.c | 5 ++++- source/blender/editors/space_outliner/outliner_sync.c | 6 ++++++ source/blender/editors/undo/ed_undo.c | 5 +++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/include/ED_outliner.h b/source/blender/editors/include/ED_outliner.h index 30e2624604c..3015d8d9cdc 100644 --- a/source/blender/editors/include/ED_outliner.h +++ b/source/blender/editors/include/ED_outliner.h @@ -36,6 +36,7 @@ void ED_outliner_select_sync_from_object_tag(struct bContext *C); void ED_outliner_select_sync_from_edit_bone_tag(struct bContext *C); void ED_outliner_select_sync_from_pose_bone_tag(struct bContext *C); void ED_outliner_select_sync_from_sequence_tag(struct bContext *C); +void ED_outliner_select_sync_from_all_tag(struct bContext *C); bool ED_outliner_select_sync_is_dirty(const struct bContext *C); diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 19fd4511e50..75219e6624f 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -1398,7 +1398,6 @@ static int outliner_item_do_activate_from_cursor(bContext *C, else { ED_region_tag_redraw_no_rebuild(ar); } - ED_undo_push(C, "Outliner selection change"); if (soops->flag & SO_SYNC_SELECT) { ED_outliner_select_sync_from_outliner(C, soops); @@ -1427,6 +1426,8 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot) ot->poll = ED_operator_outliner_active; + ot->flag |= OPTYPE_REGISTER | OPTYPE_UNDO; + PropertyRNA *prop; RNA_def_boolean(ot->srna, "extend", true, "Extend", "Extend selection for activation"); prop = RNA_def_boolean( @@ -1767,6 +1768,8 @@ void OUTLINER_OT_select_walk(wmOperatorType *ot) ot->invoke = outliner_walk_select_invoke; ot->poll = ED_operator_outliner_active; + ot->flag |= OPTYPE_REGISTER | OPTYPE_UNDO; + /* properties */ PropertyRNA *prop; prop = RNA_def_enum(ot->srna, diff --git a/source/blender/editors/space_outliner/outliner_sync.c b/source/blender/editors/space_outliner/outliner_sync.c index a8aeb7ea4e1..cf734526958 100644 --- a/source/blender/editors/space_outliner/outliner_sync.c +++ b/source/blender/editors/space_outliner/outliner_sync.c @@ -75,6 +75,12 @@ void ED_outliner_select_sync_from_sequence_tag(bContext *C) wm->outliner_sync_select_dirty |= WM_OUTLINER_SYNC_SELECT_FROM_SEQUENCE; } +void ED_outliner_select_sync_from_all_tag(bContext *C) +{ + wmWindowManager *wm = CTX_wm_manager(C); + wm->outliner_sync_select_dirty |= WM_OUTLINER_SYNC_SELECT_FROM_ALL; +} + bool ED_outliner_select_sync_is_dirty(const bContext *C) { wmWindowManager *wm = CTX_wm_manager(C); diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index c84d7539cce..e0f4d1cf465 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -53,6 +53,7 @@ #include "ED_gpencil.h" #include "ED_render.h" #include "ED_object.h" +#include "ED_outliner.h" #include "ED_screen.h" #include "ED_undo.h" @@ -390,6 +391,8 @@ static int ed_undo_exec(bContext *C, wmOperator *op) /* Keep button under the cursor active. */ WM_event_add_mousemove(C); } + + ED_outliner_select_sync_from_all_tag(C); return ret; } @@ -417,6 +420,8 @@ static int ed_redo_exec(bContext *C, wmOperator *op) /* Keep button under the cursor active. */ WM_event_add_mousemove(C); } + + ED_outliner_select_sync_from_all_tag(C); return ret; } -- cgit v1.2.3