diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-05-06 19:08:27 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-05-06 21:14:58 +0300 |
commit | c9ed78733cc99296e90434f085651cc83fe0a7d1 (patch) | |
tree | 1bac611ab7e22dfbbc6b36892ec31141a4bedb41 /source/blender/editors/space_view3d | |
parent | 16e220c95929365e3e75479018bdbd71b0ad2981 (diff) |
UI: fixes for 3D viewport popovers moving / flipping on edits.
* Ensure popover does not change direction or location.
* Open popover towards the relevant editor, like pulldown menus.
* Use a bigger maximum assumed size to deal with some corner cases.
* Do proper 3D viewport header refresh on shading mode changes.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index a5a12b509e1..ff5eb46a38e 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -1154,6 +1154,36 @@ static void view3d_header_region_listener( } } +static void view3d_header_region_message_subscribe( + const struct bContext *UNUSED(C), + struct WorkSpace *UNUSED(workspace), struct Scene *UNUSED(scene), + struct bScreen *UNUSED(screen), struct ScrArea *UNUSED(sa), struct ARegion *ar, + struct wmMsgBus *mbus) +{ + wmMsgParams_RNA msg_key_params = {{{0}}}; + + /* Only subscribe to types. */ + StructRNA *type_array[] = { + &RNA_View3DShading, + }; + + wmMsgSubscribeValue msg_sub_value_region_tag_redraw = { + .owner = ar, + .user_data = ar, + .notify = ED_region_do_msg_notify_tag_redraw, + }; + + for (int i = 0; i < ARRAY_SIZE(type_array); i++) { + msg_key_params.ptr.type = type_array[i]; + WM_msg_subscribe_rna_params( + mbus, + &msg_key_params, + &msg_sub_value_region_tag_redraw, + __func__); + } +} + + /* add handlers, stuff you only do once or on area/region changes */ static void view3d_buttons_region_init(wmWindowManager *wm, ARegion *ar) { @@ -1496,6 +1526,7 @@ void ED_spacetype_view3d(void) art->listener = view3d_header_region_listener; art->init = view3d_header_region_init; art->draw = view3d_header_region_draw; + art->message_subscribe = view3d_header_region_message_subscribe; BLI_addhead(&st->regiontypes, art); BKE_spacetype_register(st); |