diff options
author | Nathan Craddock <nzcraddock@gmail.com> | 2019-06-22 00:27:05 +0300 |
---|---|---|
committer | Nathan Craddock <nzcraddock@gmail.com> | 2019-06-22 00:27:05 +0300 |
commit | 56314980ac65f59b3e4b553bd157dc0efb40f472 (patch) | |
tree | 60587c617580d1bf192875677dc906549c038baf /source | |
parent | 6c82357176eaf1f5005b9c45258cef3e3e4566a1 (diff) |
Outliner: Add sync selection flag to main
The is_sync_select_dirty flag will be set after outliner and
3D viewport selection events to indicate a sync needs to occur.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_main.h | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_select.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 21 |
3 files changed, 25 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index 1c987d5eb8e..18e36fd788f 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -81,6 +81,7 @@ typedef struct Main { char recovered; /* indicate the main->name (file) is the recovered one */ /** All current ID's exist in the last memfile undo step. */ char is_memfile_undo_written; + char is_sync_select_dirty; BlendThumbnail *blen_thumb; diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index afdda8d6b7f..c297514710e 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -50,6 +50,7 @@ #include "BKE_collection.h" #include "BKE_context.h" #include "BKE_deform.h" +#include "BKE_global.h" #include "BKE_layer.h" #include "BKE_library.h" #include "BKE_main.h" @@ -116,6 +117,9 @@ void ED_object_base_select(Base *base, eObjectSelect_Mode mode) } BKE_scene_object_base_flag_sync_from_base(base); } + + /* Using globals to sync selection for now */ + G_MAIN->is_sync_select_dirty = true; } /** diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index a95ccd65dff..7b483e31033 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -419,6 +419,26 @@ void wm_event_do_notifiers(bContext *C) CTX_wm_window_set(C, win); + ViewLayer *view_layer = CTX_data_view_layer(C); + + /* This may need to be moved - A selection has occured */ + if (G_MAIN->is_sync_select_dirty) { + /* Mark all outliners as dirty */ + Main *bmain = CTX_data_main(C); + for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { + for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { + for (SpaceLink *space = sa->spacedata.first; space; space = space->next) { + if (space->spacetype == SPACE_OUTLINER) { + SpaceOutliner *soutliner = (SpaceOutliner *)space; + /* Mark selection state as dirty */ + soutliner->flag |= SO_IS_DIRTY; + } + } + } + } + G_MAIN->is_sync_select_dirty = false; + } + for (note = wm->queue.first; note; note = next) { next = note->next; @@ -483,7 +503,6 @@ void wm_event_do_notifiers(bContext *C) } } if (ELEM(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, NC_WM)) { - ViewLayer *view_layer = CTX_data_view_layer(C); ED_info_stats_clear(view_layer); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, NULL); } |