[Bf-blender-cvs] [6f20fcd5984] blender2.8: UI: Global "Status-bar" Area (WIP)
Julian Eisel
noreply at git.blender.org
Wed May 23 23:07:13 CEST 2018
Commit: 6f20fcd5984a47baee9ff440e9e59584fccd1e59
Author: Julian Eisel
Date: Wed May 23 22:38:25 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB6f20fcd5984a47baee9ff440e9e59584fccd1e59
UI: Global "Status-bar" Area (WIP)
* Add horizontal bar at bottom of all non-temp windows, similar to the Top-bar.
* Status-bar is hidden in UI-less fullscreen mode
* Current contents are preliminary and based on T54861:
** Left: Current file-path if needed. "(Modified)" note if file was changed.
** Center: Scene statistics (like in 2.7 Info Editor).
** Right: Progress-bars and reports
* Internally managed as own "STATUSBAR" editor-type (hidden in UI).
* Like with the Top-bar, Status-bar data and SDNA writing is disabled.
* Most changes in low-level screen/area code are to support layout bounds that differ from window bounds.
Design task: T54861
Main changes approved by @brecht.
===================================================================
M build_files/cmake/macros.cmake
M release/scripts/startup/bl_ui/__init__.py
A release/scripts/startup/bl_ui/space_statusbar.py
M release/scripts/startup/bl_ui/space_topbar.py
M source/blender/blenloader/intern/writefile.c
M source/blender/editors/CMakeLists.txt
M source/blender/editors/include/ED_screen.h
M source/blender/editors/include/ED_space_api.h
M source/blender/editors/screen/area.c
M source/blender/editors/screen/screen_edit.c
M source/blender/editors/screen/screen_intern.h
M source/blender/editors/screen/screen_ops.c
M source/blender/editors/screen/workspace_layout_edit.c
M source/blender/editors/space_api/spacetypes.c
A source/blender/editors/space_statusbar/CMakeLists.txt
A source/blender/editors/space_statusbar/space_statusbar.c
M source/blender/makesdna/DNA_screen_types.h
M source/blender/makesdna/DNA_space_types.h
M source/blender/makesrna/intern/rna_screen.c
M source/blender/makesrna/intern/rna_space.c
M source/blender/windowmanager/WM_api.h
M source/blender/windowmanager/intern/wm_window.c
===================================================================
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 3bb435fa892..a38a6805274 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -581,6 +581,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_editor_space_outliner
bf_editor_space_script
bf_editor_space_sequencer
+ bf_editor_space_statusbar
bf_editor_space_text
bf_editor_space_time
bf_editor_space_topbar
diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py
index 0de0e8ad72d..dd99195f12a 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -81,6 +81,7 @@ _modules = [
"space_outliner",
"space_properties",
"space_sequencer",
+ "space_statusbar",
"space_text",
"space_time",
"space_topbar",
diff --git a/release/scripts/startup/bl_ui/space_statusbar.py b/release/scripts/startup/bl_ui/space_statusbar.py
new file mode 100644
index 00000000000..983b474d18b
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_statusbar.py
@@ -0,0 +1,84 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from bpy.types import Header
+
+
+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
+
+ row = layout.row(align=True)
+ if (bpy.data.filepath):
+ row.label(text=bpy.data.filepath, translate=False)
+ if bpy.data.is_dirty:
+ row.label("(Modified)")
+
+ def draw_center(self, context):
+ layout = self.layout
+
+ 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()
+ layout.template_reports_banner()
+
+ row = layout.row(align=True)
+ if bpy.app.autoexec_fail is True and bpy.app.autoexec_fail_quiet is False:
+ row.label("Auto-run disabled", icon='ERROR')
+ if bpy.data.is_saved:
+ props = row.operator("wm.revert_mainfile", icon='SCREEN_BACK', text="Reload Trusted")
+ props.use_scripts = True
+
+ row.operator("script.autoexec_warn_clear", text="Ignore")
+
+ # include last so text doesn't push buttons out of the header
+ row.label(bpy.app.autoexec_fail_message)
+ return
+
+
+
+classes = (
+ STATUSBAR_HT_header,
+)
+
+if __name__ == "__main__": # only for live edit.
+ from bpy.utils import register_class
+ for cls in classes:
+ register_class(cls)
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 1c4e5493e24..4eabf2bf327 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -57,26 +57,6 @@ class TOPBAR_HT_upper_bar(Header):
text="Back to Previous",
)
- layout.separator()
-
- layout.template_running_jobs()
-
- layout.template_reports_banner()
-
- row = layout.row(align=True)
-
- if bpy.app.autoexec_fail is True and bpy.app.autoexec_fail_quiet is False:
- row.label("Auto-run disabled", icon='ERROR')
- if bpy.data.is_saved:
- props = row.operator("wm.revert_mainfile", icon='SCREEN_BACK', text="Reload Trusted")
- props.use_scripts = True
-
- row.operator("script.autoexec_warn_clear", text="Ignore")
-
- # include last so text doesn't push buttons out of the header
- row.label(bpy.app.autoexec_fail_message)
- return
-
def draw_right(self, context):
layout = self.layout
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index d94fe790c9d..f3042dc84db 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2879,10 +2879,13 @@ static void write_area_regions(WriteData *wd, ScrArea *area)
}
writestruct(wd, DATA, SpaceConsole, 1, sl);
}
-#ifdef WITH_TOPBAR_WRITING
+#ifdef WITH_GLOBAL_AREA_WRITING
else if (sl->spacetype == SPACE_TOPBAR) {
writestruct(wd, DATA, SpaceTopBar, 1, sl);
}
+ else if (sl->spacetype == SPACE_STATUSBAR) {
+ writestruct(wd, DATA, SpaceStatusBar, 1, sl);
+ }
#endif
else if (sl->spacetype == SPACE_USERPREF) {
writestruct(wd, DATA, SpaceUserPref, 1, sl);
@@ -2905,7 +2908,7 @@ static void write_area_map(WriteData *wd, ScrAreaMap *area_map)
writestruct(wd, DATA, ScrArea, 1, area);
-#ifdef WITH_TOPBAR_WRITING
+#ifdef WITH_GLOBAL_AREA_WRITING
writestruct(wd, DATA, ScrGlobalAreaData, 1, area->global);
#endif
@@ -2921,7 +2924,7 @@ static void write_windowmanager(WriteData *wd, wmWindowManager *wm)
write_iddata(wd, &wm->id);
for (wmWindow *win = wm->windows.first; win; win = win->next) {
-#ifndef WITH_TOPBAR_WRITING
+#ifndef WITH_GLOBAL_AREA_WRITING
/* Don't write global areas yet, while we make changes to them. */
ScrAreaMap global_areas = win->global_areas;
memset(&win->global_areas, 0, sizeof(win->global_areas));
@@ -2934,7 +2937,7 @@ static void write_windowmanager(WriteData *wd, wmWindowManager *wm)
writestruct(wd, DATA, WorkSpaceInstanceHook, 1, win->workspace_hook);
writestruct(wd, DATA, Stereo3dFormat, 1, win->stereo3d_format);
-#ifdef WITH_TOPBAR_WRITING
+#ifdef WITH_GLOBAL_AREA_WRITING
write_area_map(wd, &win->global_areas);
#else
win->global_areas = global_areas;
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index 358f82499c2..2b30382f4a4 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -54,6 +54,7 @@ if(WITH_BLENDER)
add_subdirectory(space_outliner)
add_subdirectory(space_script)
add_subdirectory(space_sequencer)
+ add_subdirectory(space_statusbar)
add_subdirectory(space_text)
add_subdirectory(space_topbar)
add_subdirectory(space_userpref)
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index c30aaf8df0a..749d1347eb3 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -119,9 +119,6 @@ int ED_area_header_switchbutton(const struct bContext *C, struct uiBlock *bl
void ED_area_initialize(struct wmWindowManager *wm, struct wmWindow *win, struct ScrArea *sa);
void ED_area_exit(struct bContext *C, struct ScrArea *sa);
int ED_screen_area_active(const struct bContext *C);
-void ED_screen_global_topbar_area_create(
- struct wmWindow *win,
- const struct bScreen *screen);
void ED_screen_global_areas_create(
struct wmWindow *win);
void ED_area_do_listen(struct bScreen *sc, ScrArea *sa, struct wmNotifier *note, Scene *scene,
diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h
index 0cb23514867..77539bff252 100644
--- a/source/blender/editors/include/ED_space_api.h
+++ b/source/blender/editors/include/ED_space_api.h
@@ -57,6 +57,7 @@ void ED_spacetype_logic(void);
void ED_spacetype_console(void);
void ED_spacetype_userpref(void);
void ED_spacetype_clip(void);
+void ED_spacetype_statusbar(void);
void ED_spacetype_topbar(void);
/* calls for instancing and freeing spacetype static data
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index dc5c9be04c8..e8192c4ce90 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1259,7 +1259,7 @@ static void region_rect_recursive(wmWindow *win, ScrArea *sa, ARegion *ar, rcti
region_rect_recursive(win, sa, ar->next, remainder, overlap_remainder, quad);
}
-static void area_calc_totrct(ScrArea *sa, int window_size_x, int window_size_y)
+static void area_calc_totrct(ScrArea *sa, const rcti *window_rect)
{
short px = (short)U.pixelsize;
@@ -1269,16 +1269,16 @@ static void area_calc_totrct(ScrArea *sa, int window_size_x, int window_size_y)
sa->totrct.ymax = sa->v2->vec.y;
/* scale down totrct by 1 pixel on all sides not matching window borders */
- if (sa->totrct.xmin > 0) {
+ if (sa->totrct.xmin > window_rect->xmin) {
sa->totrct.xmin += px;
}
- if (sa->totrct.xmax < (window_size_x - 1)) {
+ if (sa->totrct.xmax < (window_rect->xmax - 1)) {
sa->totrct.xmax -= px;
}
- if (sa->totrct.ymin > 0) {
+ if (sa->totrct.ymin > window_rect->ymin) {
sa->totrct.ymin += px;
}
- if (sa->totrct.ymax < (window_size_y - 1)) {
+ if (sa->totrct.ymax < (window_rect->ymax - 1)) {
sa->totrct.ymax -= px;
}
/* Although the following asserts are correct they lead to a very unstable Blender.
@@ -1373,15 +1373,15 @@ static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *hand
void ED_area_update_region_sizes(wmWindowManager *wm, wmWindow *win, ScrArea *area)
{
+ rcti rect, overlap_rect;
+ rcti wi
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list