diff options
author | Nathan Craddock <nzcraddock@gmail.com> | 2020-12-22 00:27:09 +0300 |
---|---|---|
committer | Nathan Craddock <nzcraddock@gmail.com> | 2020-12-22 00:31:32 +0300 |
commit | ffacce5be41df68658f8478fee73e74701d2b545 (patch) | |
tree | 71981b37cedbb77b002ae27511471c96c63597b8 /source/blender/editors/space_buttons | |
parent | 2d6e6d035b664d6244fd48090cb8545145032f9f (diff) |
UI: Properties editor popover and outliner sync
This adds a popover to the properties editor. Currently the only setting
is for controlling outliner to properties syncing.
Because we cannot define a perfect heuristic to determine when
properties editors should change tabs based on outliner icon selection,
we need an option to enable or disable this behavior per properties
editor.
There are 3 options for controlling the syncing. Auto uses the heuristic
to only allow tab switching when a properties editor and outliner share
a border. On and off enable and disable syncing respectively.
Differential Revision: https://developer.blender.org/D9758
Diffstat (limited to 'source/blender/editors/space_buttons')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index c1f29231f96..e2b889bece1 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -752,26 +752,25 @@ static bool is_pointer_in_path(ButsContextPath *path, PointerRNA *ptr) return false; } -void ED_buttons_set_context(const bContext *C, PointerRNA *ptr, const int context) +bool ED_buttons_should_sync_with_outliner(const bContext *C, + const SpaceProperties *sbuts, + ScrArea *area) { ScrArea *active_area = CTX_wm_area(C); - bScreen *screen = CTX_wm_screen(C); - - LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { - /* Only update for properties editors that are visible and share a border. */ - if (area->spacetype != SPACE_PROPERTIES) { - continue; - } - if (!ED_area_has_shared_border(active_area, area)) { - continue; - } + const bool auto_sync = ED_area_has_shared_border(active_area, area) && + sbuts->outliner_sync == PROPERTIES_SYNC_AUTO; + return auto_sync || sbuts->outliner_sync == PROPERTIES_SYNC_ON; +} - SpaceProperties *sbuts = (SpaceProperties *)area->spacedata.first; - ButsContextPath path; - if (buttons_context_path(C, sbuts, &path, context, 0) && is_pointer_in_path(&path, ptr)) { - sbuts->mainbuser = context; - sbuts->mainb = sbuts->mainbuser; - } +void ED_buttons_set_context(const bContext *C, + SpaceProperties *sbuts, + PointerRNA *ptr, + const int context) +{ + ButsContextPath path; + if (buttons_context_path(C, sbuts, &path, context, 0) && is_pointer_in_path(&path, ptr)) { + sbuts->mainbuser = context; + sbuts->mainb = sbuts->mainbuser; } } |