diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2020-07-18 17:49:25 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2020-07-18 17:49:25 +0300 |
commit | c08d847488048e9d5233bfd14e363de574332846 (patch) | |
tree | 59cd059ab1d146db2cebd8051319009adfcd5ea4 /source/blender/editors/screen/screen_ops.c | |
parent | fe49e4139cd3f78f126b60ea4240a0294eac9483 (diff) |
UI: Status Bar Statistics and Other Options
Status Bar can show scene statistics, memory usage, version, etc set by context menu. Part two of T75672.
Differential Revision: https://developer.blender.org/D7557
Reviewed by Julian Eisel
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index b034fb186d2..6bf08195b1c 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -89,6 +89,8 @@ #include "UI_resources.h" #include "UI_view2d.h" +#include "GPU_extensions.h" + #include "screen_intern.h" /* own module include */ #define KM_MODAL_CANCEL 1 @@ -4127,12 +4129,6 @@ static void SCREEN_OT_header_toggle_menus(wmOperatorType *ot) /** \name Region Context Menu Operator (Header/Footer/Navbar) * \{ */ -static bool screen_region_context_menu_poll(bContext *C) -{ - ScrArea *area = CTX_wm_area(C); - return (area && area->spacetype != SPACE_STATUSBAR); -} - void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg)) { ScrArea *area = CTX_wm_area(C); @@ -4221,15 +4217,35 @@ void ED_screens_navigation_bar_tools_menu_create(bContext *C, uiLayout *layout, uiItemO(layout, but_flip_str, ICON_NONE, "SCREEN_OT_region_flip"); } +static void ED_screens_statusbar_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg)) +{ + PointerRNA ptr; + + RNA_pointer_create(NULL, &RNA_PreferencesView, &U, &ptr); + uiItemR(layout, &ptr, "show_statusbar_stats", 0, IFACE_("Scene Statistics"), ICON_NONE); + uiItemR(layout, &ptr, "show_statusbar_memory", 0, IFACE_("System Memory"), ICON_NONE); + if (GPU_mem_stats_supported()) { + uiItemR(layout, &ptr, "show_statusbar_vram", 0, IFACE_("Video Memory"), ICON_NONE); + } + uiItemR(layout, &ptr, "show_statusbar_version", 0, IFACE_("Blender Version"), ICON_NONE); +} + static int screen_context_menu_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event)) { uiPopupMenu *pup; uiLayout *layout; + const ScrArea *area = CTX_wm_area(C); const ARegion *region = CTX_wm_region(C); - if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { + if (area && area->spacetype == SPACE_STATUSBAR) { + pup = UI_popup_menu_begin(C, IFACE_("Status Bar"), ICON_NONE); + layout = UI_popup_menu_layout(pup); + ED_screens_statusbar_menu_create(C, layout, NULL); + UI_popup_menu_end(C, pup); + } + else if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { pup = UI_popup_menu_begin(C, IFACE_("Header"), ICON_NONE); layout = UI_popup_menu_layout(pup); ED_screens_header_tools_menu_create(C, layout, NULL); @@ -4259,7 +4275,6 @@ static void SCREEN_OT_region_context_menu(wmOperatorType *ot) ot->idname = "SCREEN_OT_region_context_menu"; /* api callbacks */ - ot->poll = screen_region_context_menu_poll; ot->invoke = screen_context_menu_invoke; } |