Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/datafiles/userdef/userdef_default.c2
-rw-r--r--release/scripts/startup/bl_ui/space_statusbar.py19
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py17
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c4
-rw-r--r--source/blender/editors/include/ED_info.h6
-rw-r--r--source/blender/editors/screen/screen_ops.c31
-rw-r--r--source/blender/editors/space_info/info_stats.c242
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c2
-rw-r--r--source/blender/makesdna/DNA_layer_types.h1
-rw-r--r--source/blender/makesdna/DNA_screen_types.h2
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h12
-rw-r--r--source/blender/makesrna/intern/rna_scene.c18
-rw-r--r--source/blender/makesrna/intern/rna_screen.c19
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c29
15 files changed, 300 insertions, 106 deletions
diff --git a/release/datafiles/userdef/userdef_default.c b/release/datafiles/userdef/userdef_default.c
index 31d0eb8e923..fbdb226ab6d 100644
--- a/release/datafiles/userdef/userdef_default.c
+++ b/release/datafiles/userdef/userdef_default.c
@@ -229,6 +229,8 @@ const UserDef U_default = {
.collection_instance_empty_size = 1.0f,
+ .statusbar_flag = STATUSBAR_SHOW_VERSION,
+
.runtime =
{
.is_dirty = 0,
diff --git a/release/scripts/startup/bl_ui/space_statusbar.py b/release/scripts/startup/bl_ui/space_statusbar.py
index 4984372eed3..cbf72a7bc59 100644
--- a/release/scripts/startup/bl_ui/space_statusbar.py
+++ b/release/scripts/startup/bl_ui/space_statusbar.py
@@ -31,17 +31,20 @@ class STATUSBAR_HT_header(Header):
layout.separator_spacer()
- # messages
- layout.template_reports_banner()
- layout.template_running_jobs()
-
+ # Nothing in the center.
layout.separator_spacer()
- # stats
- scene = context.scene
- view_layer = context.view_layer
+ row = layout.row()
+ row.alignment = 'RIGHT'
+
+ # Stats & Info
+ row.label(text=context.screen.statusbar_info(), translate=False)
+
+ # Messages
+ row.template_reports_banner()
- layout.label(text=scene.statistics(view_layer), translate=False)
+ # Progress Bar
+ row.template_running_jobs()
classes = (
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 66c98b81e0e..03f85578b6e 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -283,6 +283,22 @@ class USERPREF_PT_interface_temporary_windows(InterfacePanel, CenterAlignMixIn,
col.prop(view, "filebrowser_display_type", text="File Browser")
+class USERPREF_PT_interface_statusbar(InterfacePanel, CenterAlignMixIn, Panel):
+ bl_label = "Status Bar"
+ bl_parent_id = "USERPREF_PT_interface_editors"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw_centered(self, context, layout):
+ prefs = context.preferences
+ view = prefs.view
+
+ col = layout.column(heading="Show")
+ col.prop(view, "show_statusbar_stats", text="Scene Statistics")
+ col.prop(view, "show_statusbar_memory", text="System Memory")
+ col.prop(view, "show_statusbar_vram", text="Video Memory")
+ col.prop(view, "show_statusbar_version", text="Blender Version")
+
+
class USERPREF_PT_interface_menus(InterfacePanel, Panel):
bl_label = "Menus"
bl_options = {'DEFAULT_CLOSED'}
@@ -2189,6 +2205,7 @@ classes = (
USERPREF_PT_interface_display,
USERPREF_PT_interface_editors,
USERPREF_PT_interface_temporary_windows,
+ USERPREF_PT_interface_statusbar,
USERPREF_PT_interface_translation,
USERPREF_PT_interface_text,
USERPREF_PT_interface_menus,
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 57f22a8d709..14fb1091045 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -34,7 +34,7 @@ extern "C" {
/* Blender major and minor version. */
#define BLENDER_VERSION 290
/* Blender patch version for bugfix releases. */
-#define BLENDER_VERSION_PATCH 0
+#define BLENDER_VERSION_PATCH 1
/** Blender release cycle stage: alpha/beta/rc/release. */
#define BLENDER_VERSION_CYCLE alpha
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 1b0e41ec54a..9a3f4be6786 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -753,6 +753,10 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
userdef->transopts &= ~USER_DOTRANSLATE_DEPRECATED;
}
+ if (!USER_VERSION_ATLEAST(290, 1)) {
+ userdef->statusbar_flag = STATUSBAR_SHOW_VERSION;
+ }
+
/**
* Versioning code until next subversion bump goes here.
*
diff --git a/source/blender/editors/include/ED_info.h b/source/blender/editors/include/ED_info.h
index 1146c49bef2..e97fd424742 100644
--- a/source/blender/editors/include/ED_info.h
+++ b/source/blender/editors/include/ED_info.h
@@ -31,9 +31,11 @@ struct Main;
/* info_stats.c */
void ED_info_stats_clear(struct ViewLayer *view_layer);
-const char *ED_info_footer_string(struct ViewLayer *view_layer);
+const char *ED_info_statusbar_string(struct Main *bmain,
+ struct bScreen *screen,
+ struct bContext *C);
void ED_info_draw_stats(
- Main *bmain, Scene *scene, ViewLayer *view_layer, int x, int *y, int height);
+ struct Main *bmain, Scene *scene, ViewLayer *view_layer, int x, int *y, int height);
#ifdef __cplusplus
}
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;
}
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index e1937dffb37..4e91da01cc9 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -43,6 +43,7 @@
#include "BLT_translation.h"
#include "BKE_blender_version.h"
+#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
#include "BKE_editmesh.h"
@@ -405,46 +406,6 @@ static void stats_update(Depsgraph *depsgraph, ViewLayer *view_layer)
*(view_layer->stats) = stats;
}
-static const char *footer_string(ViewLayer *view_layer)
-{
-#define MAX_INFO_MEM_LEN 64
- char memstr[MAX_INFO_MEM_LEN];
- char gpumemstr[MAX_INFO_MEM_LEN] = "";
- char formatted_mem[15];
- size_t ofs = 0;
-
- uintptr_t mem_in_use = MEM_get_memory_in_use();
-
- /* get memory statistics */
- BLI_str_format_byte_unit(formatted_mem, mem_in_use, false);
- ofs = BLI_snprintf(memstr, MAX_INFO_MEM_LEN, TIP_("Mem: %s"), formatted_mem);
-
- if (GPU_mem_stats_supported()) {
- int gpu_free_mem, gpu_tot_memory;
-
- GPU_mem_stats_get(&gpu_tot_memory, &gpu_free_mem);
-
- BLI_str_format_byte_unit(formatted_mem, gpu_free_mem, false);
- ofs = BLI_snprintf(gpumemstr, MAX_INFO_MEM_LEN, TIP_(" | Free GPU Mem: %s"), formatted_mem);
-
- if (gpu_tot_memory) {
- BLI_str_format_byte_unit(formatted_mem, gpu_tot_memory, false);
- BLI_snprintf(gpumemstr + ofs, MAX_INFO_MEM_LEN - ofs, TIP_("/%s"), formatted_mem);
- }
- }
-
- BLI_snprintf(view_layer->footer_str,
- sizeof(view_layer->footer_str),
- "%s%s | %s",
- memstr,
- gpumemstr,
- BKE_blender_version_string());
-
- return view_layer->footer_str;
-
-#undef MAX_INFO_MEM_LEN
-}
-
void ED_info_stats_clear(ViewLayer *view_layer)
{
if (view_layer->stats) {
@@ -453,45 +414,26 @@ void ED_info_stats_clear(ViewLayer *view_layer)
}
}
-const char *ED_info_footer_string(ViewLayer *view_layer)
-{
- return footer_string(view_layer);
-}
-
-static void stats_row(int col1,
- const char *key,
- int col2,
- const char *value1,
- const char *value2,
- int *y,
- int height)
-{
- *y -= height;
- BLF_draw_default(col1, *y, 0.0f, key, 128);
- char values[128];
- BLI_snprintf(values, sizeof(values), (value2) ? "%s / %s" : "%s", value1, value2);
- BLF_draw_default(col2, *y, 0.0f, values, sizeof(values));
-}
-
-void ED_info_draw_stats(
- Main *bmain, Scene *scene, ViewLayer *view_layer, int x, int *y, int height)
+static bool format_stats(Main *bmain,
+ Scene *scene,
+ ViewLayer *view_layer,
+ SceneStatsFmt *stats_fmt)
{
/* Create stats if they don't already exist. */
if (!view_layer->stats) {
/* Do not not access dependency graph if interface is marked as locked. */
wmWindowManager *wm = bmain->wm.first;
if (wm->is_interface_locked) {
- return;
+ return false;
}
Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true);
stats_update(depsgraph, view_layer);
}
SceneStats *stats = view_layer->stats;
- SceneStatsFmt stats_fmt;
/* Generate formatted numbers. */
-#define SCENE_STATS_FMT_INT(_id) BLI_str_format_uint64_grouped(stats_fmt._id, stats->_id)
+#define SCENE_STATS_FMT_INT(_id) BLI_str_format_uint64_grouped(stats_fmt->_id, stats->_id)
SCENE_STATS_FMT_INT(totvert);
SCENE_STATS_FMT_INT(totvertsel);
@@ -519,6 +461,176 @@ void ED_info_draw_stats(
SCENE_STATS_FMT_INT(totgppoint);
#undef SCENE_STATS_FMT_INT
+ return true;
+}
+
+static void get_stats_string(
+ char *info, int len, size_t *ofs, ViewLayer *view_layer, SceneStatsFmt *stats_fmt)
+{
+ Object *ob = OBACT(view_layer);
+ Object *obedit = OBEDIT_FROM_OBACT(ob);
+ eObjectMode object_mode = ob ? ob->mode : OB_MODE_OBJECT;
+ LayerCollection *layer_collection = view_layer->active_collection;
+
+ if (object_mode == OB_MODE_OBJECT) {
+ *ofs += BLI_snprintf(info + *ofs,
+ len - *ofs,
+ "%s | ",
+ BKE_collection_ui_name_get(layer_collection->collection));
+ }
+
+ if (ob) {
+ *ofs += BLI_snprintf(info + *ofs, len - *ofs, "%s | ", ob->id.name + 2);
+ }
+
+ if (obedit) {
+ if (BKE_keyblock_from_object(obedit)) {
+ *ofs += BLI_strncpy_rlen(info + *ofs, TIP_("(Key) "), len - *ofs);
+ }
+
+ if (obedit->type == OB_MESH) {
+ *ofs += BLI_snprintf(info + *ofs,
+ len - *ofs,
+ TIP_("Verts:%s/%s | Edges:%s/%s | Faces:%s/%s | Tris:%s"),
+ stats_fmt->totvertsel,
+ stats_fmt->totvert,
+ stats_fmt->totedgesel,
+ stats_fmt->totedge,
+ stats_fmt->totfacesel,
+ stats_fmt->totface,
+ stats_fmt->tottri);
+ }
+ else if (obedit->type == OB_ARMATURE) {
+ *ofs += BLI_snprintf(info + *ofs,
+ len - *ofs,
+ TIP_("Verts:%s/%s | Bones:%s/%s"),
+ stats_fmt->totvertsel,
+ stats_fmt->totvert,
+ stats_fmt->totbonesel,
+ stats_fmt->totbone);
+ }
+ else {
+ *ofs += BLI_snprintf(
+ info + *ofs, len - *ofs, TIP_("Verts:%s/%s"), stats_fmt->totvertsel, stats_fmt->totvert);
+ }
+ }
+ else if (ob && (object_mode & OB_MODE_POSE)) {
+ *ofs += BLI_snprintf(
+ info + *ofs, len - *ofs, TIP_("Bones:%s/%s"), stats_fmt->totbonesel, stats_fmt->totbone);
+ }
+ else if ((ob) && (ob->type == OB_GPENCIL)) {
+ *ofs += BLI_snprintf(info + *ofs,
+ len - *ofs,
+ TIP_("Layers:%s | Frames:%s | Strokes:%s | Points:%s"),
+ stats_fmt->totgplayer,
+ stats_fmt->totgpframe,
+ stats_fmt->totgpstroke,
+ stats_fmt->totgppoint);
+ }
+ else if (stats_is_object_dynamic_topology_sculpt(ob, object_mode)) {
+ *ofs += BLI_snprintf(info + *ofs,
+ len - *ofs,
+ TIP_("Verts:%s | Tris:%s"),
+ stats_fmt->totvert,
+ stats_fmt->tottri);
+ }
+ else {
+ *ofs += BLI_snprintf(info + *ofs,
+ len - *ofs,
+ TIP_("Verts:%s | Faces:%s | Tris:%s"),
+ stats_fmt->totvert,
+ stats_fmt->totface,
+ stats_fmt->tottri);
+ }
+
+ *ofs += BLI_snprintf(
+ info + *ofs, len - *ofs, TIP_(" | Objects:%s/%s"), stats_fmt->totobjsel, stats_fmt->totobj);
+}
+
+const char *ED_info_statusbar_string(Main *bmain, bScreen *screen, bContext *C)
+{
+ char formatted_mem[15];
+ size_t ofs = 0;
+ char *info = screen->statusbar_info;
+ int len = sizeof(screen->statusbar_info);
+
+ info[0] = '\0';
+
+ /* Scene statistics. */
+ if (U.statusbar_flag & STATUSBAR_SHOW_STATS) {
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Scene *scene = CTX_data_scene(C);
+ SceneStatsFmt stats_fmt;
+ if (format_stats(bmain, scene, view_layer, &stats_fmt)) {
+ get_stats_string(info + ofs, len, &ofs, view_layer, &stats_fmt);
+ }
+ }
+
+ /* Memory status. */
+ if (U.statusbar_flag & STATUSBAR_SHOW_MEMORY) {
+ if (info[0]) {
+ ofs += BLI_snprintf(info + ofs, len - ofs, " | ");
+ }
+ uintptr_t mem_in_use = MEM_get_memory_in_use();
+ BLI_str_format_byte_unit(formatted_mem, mem_in_use, false);
+ ofs += BLI_snprintf(info + ofs, len, TIP_("Memory: %s"), formatted_mem);
+ }
+
+ /* GPU VRAM status. */
+ if ((U.statusbar_flag & STATUSBAR_SHOW_VRAM) && (GPU_mem_stats_supported())) {
+ int gpu_free_mem_kb, gpu_tot_mem_kb;
+ GPU_mem_stats_get(&gpu_tot_mem_kb, &gpu_free_mem_kb);
+ float gpu_total_gb = gpu_tot_mem_kb / 1048576.0f;
+ float gpu_free_gb = gpu_free_mem_kb / 1048576.0f;
+ if (info[0]) {
+ ofs += BLI_snprintf(info + ofs, len - ofs, " | ");
+ }
+ if (gpu_free_mem_kb && gpu_tot_mem_kb) {
+ ofs += BLI_snprintf(info + ofs,
+ len - ofs,
+ TIP_("VRAM: %.1f/%.1f GiB"),
+ gpu_total_gb - gpu_free_gb,
+ gpu_total_gb);
+ }
+ else {
+ /* Can only show amount of GPU VRAM available. */
+ ofs += BLI_snprintf(info + ofs, len - ofs, TIP_("VRAM: %.1f GiB Free"), gpu_free_gb);
+ }
+ }
+
+ /* Blender version. */
+ if (U.statusbar_flag & STATUSBAR_SHOW_VERSION) {
+ if (info[0]) {
+ ofs += BLI_snprintf(info + ofs, len - ofs, " | ");
+ }
+ ofs += BLI_snprintf(info + ofs, len - ofs, TIP_("%s"), BKE_blender_version_string());
+ }
+
+ return info;
+}
+
+static void stats_row(int col1,
+ const char *key,
+ int col2,
+ const char *value1,
+ const char *value2,
+ int *y,
+ int height)
+{
+ *y -= height;
+ BLF_draw_default(col1, *y, 0.0f, key, 128);
+ char values[128];
+ BLI_snprintf(values, sizeof(values), (value2) ? "%s / %s" : "%s", value1, value2);
+ BLF_draw_default(col2, *y, 0.0f, values, sizeof(values));
+}
+
+void ED_info_draw_stats(
+ Main *bmain, Scene *scene, ViewLayer *view_layer, int x, int *y, int height)
+{
+ SceneStatsFmt stats_fmt;
+ if (!format_stats(bmain, scene, view_layer, &stats_fmt)) {
+ return;
+ }
Object *ob = OBACT(view_layer);
Object *obedit = OBEDIT_FROM_OBACT(ob);
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index 1c533c80ab7..77ad16eeb72 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -409,7 +409,7 @@ void gpu_extensions_exit(void)
bool GPU_mem_stats_supported(void)
{
#ifndef GPU_STANDALONE
- return (GLEW_NVX_gpu_memory_info || GLEW_ATI_meminfo) && (G.debug & G_DEBUG_GPU_MEM);
+ return (GLEW_NVX_gpu_memory_info || GLEW_ATI_meminfo);
#else
return false;
#endif
diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h
index 6348dc5f03d..cb604fd6681 100644
--- a/source/blender/makesdna/DNA_layer_types.h
+++ b/source/blender/makesdna/DNA_layer_types.h
@@ -115,7 +115,6 @@ typedef struct ViewLayer {
ListBase object_bases;
/** Default allocated now. */
struct SceneStats *stats;
- char footer_str[128];
struct Base *basact;
/** A view layer has one top level layer collection, because a scene has only one top level
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 72421ecb79d..bf5c097322f 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -69,6 +69,8 @@ typedef struct bScreen {
/** User-setting for which editors get redrawn during anim playback. */
short redraws_flag;
+ char statusbar_info[256];
+
/** Temp screen in a temp window, don't save (like user prefs). */
char temp;
/** Temp screen for image render display or fileselect. */
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 8ea4d3b6476..cd5be0638e1 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -880,7 +880,9 @@ typedef struct UserDef {
char _pad5[2];
float collection_instance_empty_size;
- char _pad10[4];
+ char _pad10[3];
+
+ char statusbar_flag; /* eUserpref_StatusBar_Flag */
struct WalkNavigation walk_navigation;
@@ -1079,6 +1081,14 @@ typedef enum eUserpref_APP_Flag {
USER_APP_LOCK_UI_LAYOUT = (1 << 0),
} eUserpref_APP_Flag;
+/** #UserDef.statusbar_flag */
+typedef enum eUserpref_StatusBar_Flag {
+ STATUSBAR_SHOW_MEMORY = (1 << 0),
+ STATUSBAR_SHOW_VRAM = (1 << 1),
+ STATUSBAR_SHOW_STATS = (1 << 2),
+ STATUSBAR_SHOW_VERSION = (1 << 3),
+} eUserpref_StatusBar_Flag;
+
/**
* Auto-Keying mode.
* #UserDef.autokey_mode
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 9b98be61cbf..1208d69a988 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -924,13 +924,6 @@ static void rna_Scene_volume_update(Main *UNUSED(bmain), Scene *UNUSED(scene), P
DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_VOLUME | ID_RECALC_SEQUENCER_STRIPS);
}
-static const char *rna_Scene_statistics_string_get(Scene *UNUSED(scene),
- Main *UNUSED(bmain),
- ViewLayer *view_layer)
-{
- return ED_info_footer_string(view_layer);
-}
-
static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
scene->r.framelen = (float)scene->r.framapto / (float)scene->r.images;
@@ -7275,9 +7268,6 @@ void RNA_def_scene(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- FunctionRNA *func;
- PropertyRNA *parm;
-
static const EnumPropertyItem audio_distance_model_items[] = {
{0, "NONE", 0, "None", "No distance attenuation"},
{1, "INVERSE", 0, "Inverse", "Inverse distance model"},
@@ -7669,14 +7659,6 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SCENE, NULL);
RNA_def_property_update(prop, NC_SCENE, "rna_Scene_volume_update");
- /* Statistics */
- func = RNA_def_function(srna, "statistics", "rna_Scene_statistics_string_get");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Active layer");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_string(func, "statistics", NULL, 0, "Statistics", "");
- RNA_def_function_return(func, parm);
-
/* Grease Pencil */
prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "gpd");
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index ea6421c8d11..2b65bf4922c 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -30,6 +30,8 @@
#include "DNA_screen_types.h"
#include "DNA_workspace_types.h"
+#include "ED_info.h"
+
const EnumPropertyItem rna_enum_region_type_items[] = {
{RGN_TYPE_WINDOW, "WINDOW", 0, "Window", ""},
{RGN_TYPE_HEADER, "HEADER", 0, "Header", ""},
@@ -286,6 +288,11 @@ static void rna_View2D_view_to_region(
}
}
+static const char *rna_Screen_statusbar_info_get(struct bScreen *screen, Main *bmain, bContext *C)
+{
+ return ED_info_statusbar_string(bmain, screen, C);
+}
+
#else
/* Area.spaces */
@@ -536,6 +543,9 @@ static void rna_def_screen(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
srna = RNA_def_struct(brna, "Screen", "ID");
RNA_def_struct_sdna(srna, "Screen"); /* it is actually bScreen but for 2.5 the dna is patched! */
RNA_def_struct_ui_text(
@@ -570,11 +580,18 @@ static void rna_def_screen(BlenderRNA *brna)
RNA_def_property_boolean_funcs(prop, "rna_Screen_fullscreen_get", NULL);
RNA_def_property_ui_text(prop, "Maximize", "An area is maximized, filling this screen");
+ /* Status Bar. */
+
prop = RNA_def_property(srna, "show_statusbar", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SCREEN_COLLAPSE_STATUSBAR);
- RNA_def_property_ui_text(prop, "Show Status Bar", "Show status bar");
+ RNA_def_property_ui_text(prop, "Show Status Bar", "Show Status Bar");
RNA_def_property_update(prop, 0, "rna_Screen_bar_update");
+ func = RNA_def_function(srna, "statusbar_info", "rna_Screen_statusbar_info_get");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_CONTEXT);
+ parm = RNA_def_string(func, "statusbar_info", NULL, 0, "Status Bar Info", "");
+ RNA_def_function_return(func, parm);
+
/* Define Anim Playback Areas */
prop = RNA_def_property(srna, "use_play_top_left_3d_editor", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_REGION);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 956fb65054b..e609bdacb02 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -188,6 +188,7 @@ static const EnumPropertyItem rna_enum_userdef_viewport_aa_items[] = {
# include "DEG_depsgraph.h"
# include "GPU_draw.h"
+# include "GPU_extensions.h"
# include "GPU_select.h"
# include "BLF_api.h"
@@ -1066,6 +1067,11 @@ static void rna_UserDef_studiolight_light_ambient_get(PointerRNA *ptr, float *va
copy_v3_v3(values, sl->light_ambient);
}
+int rna_show_statusbar_vram_editable(struct PointerRNA *UNUSED(ptr), const char **UNUSED(r_info))
+{
+ return GPU_mem_stats_supported() ? PROP_EDITABLE : 0;
+}
+
#else
# define USERDEF_TAG_DIRTY_PROPERTY_UPDATE_ENABLE \
@@ -4771,6 +4777,29 @@ static void rna_def_userdef_view(BlenderRNA *brna)
"Translate New Names",
"Translate the names of new data-blocks (objects, materials...)");
RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ /* Statusbar. */
+
+ prop = RNA_def_property(srna, "show_statusbar_memory", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "statusbar_flag", STATUSBAR_SHOW_MEMORY);
+ RNA_def_property_ui_text(prop, "Show Memory", "Show Blender memory usage");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "show_statusbar_vram", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "statusbar_flag", STATUSBAR_SHOW_VRAM);
+ RNA_def_property_ui_text(prop, "Show VRAM", "Show GPU video memory usage");
+ RNA_def_property_editable_func(prop, "rna_show_statusbar_vram_editable");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "show_statusbar_version", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "statusbar_flag", STATUSBAR_SHOW_VERSION);
+ RNA_def_property_ui_text(prop, "Show Version", "Show Blender version string");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "show_statusbar_stats", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "statusbar_flag", STATUSBAR_SHOW_STATS);
+ RNA_def_property_ui_text(prop, "Show Statistics", "Show scene statistics");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, "rna_userdef_update");
}
static void rna_def_userdef_edit(BlenderRNA *brna)