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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-27 20:48:54 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-27 20:48:54 +0300
commitd3b814e9ecb18d173a4ed0621c8f714b23c50082 (patch)
tree48a5537319a856fc40c81f4af24f1c6d0f65194d
parent0e304ca8f57563c8f22313f6cee2551c88dcef3f (diff)
UI: tweak status bar layout to make it less jumpy.
Keymap on the left, messages and jobs in the middle, stats on the right.
-rw-r--r--release/scripts/startup/bl_ui/space_statusbar.py37
-rw-r--r--source/blender/editors/interface/interface_templates.c20
-rw-r--r--source/blender/editors/space_info/info_stats.c12
-rw-r--r--source/blender/editors/space_statusbar/space_statusbar.c17
4 files changed, 34 insertions, 52 deletions
diff --git a/release/scripts/startup/bl_ui/space_statusbar.py b/release/scripts/startup/bl_ui/space_statusbar.py
index b0cfe424d3e..dbcfbf165ce 100644
--- a/release/scripts/startup/bl_ui/space_statusbar.py
+++ b/release/scripts/startup/bl_ui/space_statusbar.py
@@ -25,34 +25,14 @@ class STATUSBAR_HT_header(Header):
bl_space_type = 'STATUSBAR'
def draw(self, context):
- area = context.area
- region = context.region
-
- if region.alignment == 'RIGHT':
- if region == area.regions[0]:
- self.draw_right(context)
- else:
- self.draw_center(context)
- else:
- self.draw_left(context)
-
- def draw_left(self, context):
layout = self.layout
+ # input status
layout.template_input_status()
- def draw_center(self, context):
- layout = self.layout
+ layout.separator_spacer()
- scene = context.scene
- view_layer = context.view_layer
-
- layout.label(text=scene.statistics(view_layer), translate=False)
-
- def draw_right(self, context):
- layout = self.layout
-
- layout.template_running_jobs()
+ # messages
layout.template_reports_banner()
row = layout.row(align=True)
@@ -66,7 +46,16 @@ class STATUSBAR_HT_header(Header):
# include last so text doesn't push buttons out of the header
row.label(bpy.app.autoexec_fail_message)
- return
+
+ layout.template_running_jobs()
+
+ layout.separator_spacer()
+
+ # stats
+ scene = context.scene
+ view_layer = context.view_layer
+
+ layout.label(text=scene.statistics(view_layer), translate=False)
classes = (
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 1f0cd5bbb42..041dc56cf92 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -4310,14 +4310,20 @@ void uiTemplateInputStatus(uiLayout *layout, struct bContext *C)
/* Otherwise should cursor keymap status. */
for (int i = 0; i < 3; i++) {
uiLayout *box = uiLayoutRow(layout, true);
- for (int j = 0; j < 2; j++) {
- const char *msg = WM_window_cursor_keymap_status_get(win, i, j);
- if ((j == 0) || (msg != NULL)) {
- uiItemL(box, msg, j == 0 ? (ICON_MOUSE_LMB + i) : ICON_MOUSE_DRAG);
+
+ const char *msg = WM_window_cursor_keymap_status_get(win, i, 0);
+ const char *msg_drag = WM_window_cursor_keymap_status_get(win, i, 1);
+
+ if (msg || msg_drag) {
+ uiItemL(box, msg ? msg : "", (ICON_MOUSE_LMB + i));
+
+ if (msg_drag) {
+ uiItemL(box, msg_drag, ICON_MOUSE_DRAG);
+ }
+
+ if (i != 2) {
+ uiItemS(layout);
}
- }
- if (i != 2) {
- uiItemSpacer(layout);
}
}
}
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index b0b0f6dee07..3830e6d2792 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -471,7 +471,9 @@ static void stats_string(ViewLayer *view_layer)
s = stats->infostr;
ofs = 0;
- ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, "%s | ", versionstr);
+ if (ob) {
+ ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, "%s | ", ob->id.name + 2);
+ }
if (obedit) {
if (BKE_keyblock_from_object(obedit))
@@ -505,15 +507,13 @@ static void stats_string(ViewLayer *view_layer)
}
else {
ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs,
- IFACE_("Verts:%s | Faces:%s | Tris:%s | Objects:%s/%s | Lamps:%s/%s%s%s"),
+ IFACE_("Verts:%s | Faces:%s | Tris:%s | Objects:%s/%s%s%s"),
stats_fmt.totvert, stats_fmt.totface,
stats_fmt.tottri, stats_fmt.totobjsel,
- stats_fmt.totobj, stats_fmt.totlampsel,
- stats_fmt.totlamp, memstr, gpumemstr);
+ stats_fmt.totobj, memstr, gpumemstr);
}
- if (ob)
- BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, " | %s", ob->id.name + 2);
+ ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, " | %s", versionstr);
#undef MAX_INFO_MEM_LEN
}
diff --git a/source/blender/editors/space_statusbar/space_statusbar.c b/source/blender/editors/space_statusbar/space_statusbar.c
index 2d98431bf0c..a66b36c2580 100644
--- a/source/blender/editors/space_statusbar/space_statusbar.c
+++ b/source/blender/editors/space_statusbar/space_statusbar.c
@@ -56,21 +56,8 @@ static SpaceLink *statusbar_new(const ScrArea *UNUSED(area), const Scene *UNUSED
sstatusbar = MEM_callocN(sizeof(*sstatusbar), "init statusbar");
sstatusbar->spacetype = SPACE_STATUSBAR;
- /* header regions */
- /* *** NOTE: ***
- * Python layout code (space_statusbar.py) depends on the list order of
- * these! Not nice at all, but the only way to identify the correct header
- * to draw to is using alignment + list position. It can't use alignment
- * only since code below has to set two right aligned regions - XXX. */
- ar = MEM_callocN(sizeof(*ar), "right aligned header for statusbar");
- BLI_addtail(&sstatusbar->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = RGN_ALIGN_RIGHT;
- ar = MEM_callocN(sizeof(*ar), "center header for statusbar");
- BLI_addtail(&sstatusbar->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = RGN_ALIGN_RIGHT; /* Right aligned too, so region layout code scales it correctly. */
- ar = MEM_callocN(sizeof(*ar), "left aligned header for statusbar");
+ /* header region */
+ ar = MEM_callocN(sizeof(*ar), "header for statusbar");
BLI_addtail(&sstatusbar->regionbase, ar);
ar->regiontype = RGN_TYPE_HEADER;
ar->alignment = RGN_ALIGN_NONE;