[Bf-blender-cvs] [5b86fe6f335] master: UI: About Blender Dialog
Harley Acheson
noreply at git.blender.org
Tue May 12 23:30:08 CEST 2020
Commit: 5b86fe6f33505bcea7c81021506eb538908c245d
Author: Harley Acheson
Date: Tue May 12 14:28:32 2020 -0700
Branches: master
https://developer.blender.org/rB5b86fe6f33505bcea7c81021506eb538908c245d
UI: About Blender Dialog
Adds an 'About Blender' dialog to the 'App' menu to display information like branch and hash.
Differential Revision: https://developer.blender.org/D7146
Reviewed by Campbell Barton
===================================================================
M release/scripts/startup/bl_operators/wm.py
M release/scripts/startup/bl_ui/space_topbar.py
M source/blender/windowmanager/intern/wm_operators.c
M source/blender/windowmanager/intern/wm_splash_screen.c
M source/blender/windowmanager/wm.h
===================================================================
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 9e2ce8b83ad..b54ae67a9c5 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -2557,6 +2557,36 @@ class WM_MT_splash(Menu):
layout.separator()
+class WM_MT_splash_about(Menu):
+ bl_label = "About"
+
+ def draw(self, context):
+
+ layout = self.layout
+ layout.operator_context = 'EXEC_DEFAULT'
+
+ layout.label(text="Blender is free software")
+ layout.label(text="Licensed under the GNU General Public License")
+ layout.separator()
+ layout.separator()
+
+ split = layout.split()
+ split.emboss = 'PULLDOWN_MENU'
+ split.scale_y = 1.3
+
+ col1 = split.column()
+
+ col1.operator("wm.url_open_preset", text="Release Notes", icon='URL').type = 'RELEASE_NOTES'
+ col1.operator("wm.url_open_preset", text="Credits", icon='URL').type = 'CREDITS'
+ col1.operator("wm.url_open", text="License", icon='URL').url = "https://www.blender.org/about/license/"
+
+ col2 = split.column()
+
+ col2.operator("wm.url_open_preset", text="Blender Website", icon='URL').type = 'BLENDER'
+ col2.operator("wm.url_open", text="Blender Store", icon='URL').url = "https://store.blender.org"
+ col2.operator("wm.url_open_preset", text="Development Fund", icon='FUND').type = 'FUND'
+
+
class WM_OT_drop_blend_file(Operator):
bl_idname = "wm.drop_blend_file"
bl_label = "Handle dropped .blend file"
@@ -2626,4 +2656,5 @@ classes = (
BatchRenameAction,
WM_OT_batch_rename,
WM_MT_splash,
+ WM_MT_splash_about,
)
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 7a23eb9282c..9aedd7ef0b3 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -229,14 +229,7 @@ class TOPBAR_MT_app(Menu):
layout = self.layout
layout.operator("wm.splash")
-
- layout.separator()
-
- layout.menu("TOPBAR_MT_app_support")
-
- layout.separator()
-
- layout.menu("TOPBAR_MT_app_about")
+ layout.operator("wm.splash_about")
layout.separator()
@@ -407,45 +400,6 @@ class TOPBAR_MT_file_defaults(Menu):
props.app_template = app_template
-class TOPBAR_MT_app_about(Menu):
- bl_label = "About"
-
- def draw(self, _context):
- layout = self.layout
-
- layout.operator("wm.url_open_preset", text="Release Notes",
- icon='URL').type = 'RELEASE_NOTES'
-
- layout.separator()
-
- layout.operator("wm.url_open_preset",
- text="Blender Website", icon='URL').type = 'BLENDER'
- layout.operator("wm.url_open_preset", text="Credits",
- icon='URL').type = 'CREDITS'
-
- layout.separator()
-
- layout.operator(
- "wm.url_open", text="License", icon='URL',
- ).url = "https://www.blender.org/about/license/"
-
-
-class TOPBAR_MT_app_support(Menu):
- bl_label = "Support Blender"
-
- def draw(self, _context):
- layout = self.layout
-
- layout.operator("wm.url_open_preset",
- text="Development Fund", icon='FUND').type = 'FUND'
-
- layout.separator()
-
- layout.operator(
- "wm.url_open", text="Blender Store", icon='URL',
- ).url = "https://store.blender.org"
-
-
# Include technical operators here which would otherwise have no way for users to access.
class TOPBAR_MT_app_system(Menu):
bl_label = "System"
@@ -854,9 +808,7 @@ classes = (
TOPBAR_MT_workspace_menu,
TOPBAR_MT_editor_menus,
TOPBAR_MT_app,
- TOPBAR_MT_app_about,
TOPBAR_MT_app_system,
- TOPBAR_MT_app_support,
TOPBAR_MT_file,
TOPBAR_MT_file_new,
TOPBAR_MT_file_recover,
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index ad1f5430872..39811d67b9a 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -3797,6 +3797,7 @@ void wm_operatortypes_register(void)
WM_operatortype_append(WM_OT_debug_menu);
WM_operatortype_append(WM_OT_operator_defaults);
WM_operatortype_append(WM_OT_splash);
+ WM_operatortype_append(WM_OT_splash_about);
WM_operatortype_append(WM_OT_search_menu);
WM_operatortype_append(WM_OT_search_operator);
WM_operatortype_append(WM_OT_call_menu);
diff --git a/source/blender/windowmanager/intern/wm_splash_screen.c b/source/blender/windowmanager/intern/wm_splash_screen.c
index f209a2f31a3..8445fac0498 100644
--- a/source/blender/windowmanager/intern/wm_splash_screen.c
+++ b/source/blender/windowmanager/intern/wm_splash_screen.c
@@ -48,6 +48,8 @@
#include "BKE_context.h"
#include "BKE_screen.h"
+#include "BLT_translation.h"
+
#include "BLF_api.h"
#include "IMB_imbuf.h"
@@ -56,6 +58,7 @@
#include "ED_screen.h"
#include "UI_interface.h"
+#include "UI_interface_icons.h"
#include "UI_resources.h"
#include "WM_api.h"
@@ -63,21 +66,19 @@
#include "wm.h"
-static void wm_block_splash_close(bContext *C, void *arg_block, void *UNUSED(arg))
+static void wm_block_close(bContext *C, void *arg_block, void *UNUSED(arg))
{
wmWindow *win = CTX_wm_window(C);
UI_popup_block_close(C, win, arg_block);
}
-static uiBlock *wm_block_create_splash(bContext *C, ARegion *region, void *arg_unused);
-
static void wm_block_splash_refreshmenu(bContext *C, void *UNUSED(arg_block), void *UNUSED(arg))
{
ARegion *region_menu = CTX_wm_menu(C);
ED_region_tag_refresh_ui(region_menu);
}
-static void wm_block_splash_add_label(uiBlock *block, const char *label, int x, int *y)
+static void wm_block_splash_add_label(uiBlock *block, const char *label, int x, int y)
{
if (!(label && label[0])) {
return;
@@ -86,21 +87,19 @@ static void wm_block_splash_add_label(uiBlock *block, const char *label, int x,
UI_block_emboss_set(block, UI_EMBOSS_NONE);
uiBut *but = uiDefBut(
- block, UI_BTYPE_LABEL, 0, label, 0, *y, x, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
+ block, UI_BTYPE_LABEL, 0, label, 0, y, x, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
UI_but_drawflag_disable(but, UI_BUT_TEXT_LEFT);
UI_but_drawflag_enable(but, UI_BUT_TEXT_RIGHT);
/* 1 = UI_SELECT, internal flag to draw in white. */
UI_but_flag_enable(but, 1);
UI_block_emboss_set(block, UI_EMBOSS);
- *y -= 12 * U.dpi_fac;
}
-static void wm_block_splash_add_labels(uiBlock *block, int x, int y)
+static void get_version_string(char *ver, const int max_length)
{
/* Version number. */
const char *version_cycle = NULL;
- bool show_build_info = true;
if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "alpha")) {
version_cycle = " Alpha";
@@ -110,11 +109,9 @@ static void wm_block_splash_add_labels(uiBlock *block, int x, int y)
}
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "rc")) {
version_cycle = " Release Candidate";
- show_build_info = false;
}
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "release")) {
version_cycle = STRINGIFY(BLENDER_VERSION_CHAR);
- show_build_info = false;
}
const char *version_cycle_number = "";
@@ -122,46 +119,14 @@ static void wm_block_splash_add_labels(uiBlock *block, int x, int y)
version_cycle_number = " " STRINGIFY(BLENDER_VERSION_CYCLE_NUMBER);
}
- char version_buf[256] = "\0";
- BLI_snprintf(version_buf,
- sizeof(version_buf),
- "v %d.%d%s%s",
+ BLI_snprintf(ver,
+ max_length,
+ "%d.%d.%d%s%s",
BLENDER_VERSION / 100,
BLENDER_VERSION % 100,
+ BLENDER_SUBVERSION,
version_cycle,
version_cycle_number);
-
- wm_block_splash_add_label(block, version_buf, x, &y);
-
-#ifdef WITH_BUILDINFO
- if (show_build_info) {
- extern unsigned long build_commit_timestamp;
- extern char build_hash[], build_commit_date[], build_commit_time[], build_branch[];
-
- /* Date, hidden for builds made from tag. */
- if (build_commit_timestamp != 0) {
- char date_buf[256] = "\0";
- BLI_snprintf(
- date_buf, sizeof(date_buf), "Date: %s %s", build_commit_date, build_commit_time);
- wm_block_splash_add_label(block, date_buf, x, &y);
- }
-
- /* Hash. */
- char hash_buf[256] = "\0";
- BLI_snprintf(hash_buf, sizeof(hash_buf), "Hash: %s", build_hash);
- wm_block_splash_add_label(block, hash_buf, x, &y);
-
- /* Branch. */
- if (!STREQ(build_branch, "master")) {
- char branch_buf[256] = "\0";
- BLI_snprintf(branch_buf, sizeof(branch_buf), "Branch: %s", build_branch);
-
- wm_block_splash_add_label(block, branch_buf, x, &y);
- }
- }
-#else
- UNUSED_VARS(show_build_info);
-#endif /* WITH_BUILDINFO */
}
static void wm_block_splash_image_roundcorners_add(ImBuf *ibuf)
@@ -281,10 +246,12 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *region, void *UNUSE
but = uiDefButImage(block, ibuf, 0, 0.5f * U.widget_unit, splash_width, splash_height, NULL);
- UI_but_func_set(but, wm_block_splash_close, block, NULL);
+ UI_but_func_set(but, wm_block_close, block, NULL);
UI_block_func_set(block, wm_block_splash_refreshmenu, block, NULL);
- wm_block_splash_add_labels(block, splash_width, splash_height - 13 * U.dpi_fac);
+ char version_buf[256] = "\0";
+ get_version_string(version_buf, sizeof(version_buf));
+ wm_block_splash_add_label(block, version_buf, splash_width, splash_height - 13.0 * U.dpi_fac);
const int layout_margin_x = U.dpi_fac * 26;
uiLayout *layout = UI_block_layout(block,
@@ -323,3 +290,93 @@ void WM_OT_splash(wmOperatorType *ot)
ot->invoke = wm_splash_invoke;
ot->poll = WM_operator_winactive;
}
+
+static uiBlock *wm_block_create_about(bContext *C, ARegion *region, void *UNUSED(arg))
+{
+ uiBlock *block;
+ const uiStyle *style = UI_style_get_dpi();
+ const int dialog_width = U.widget_unit * 24;
+ const short logo_size = 128 * U.dpi_fac;
+
+ /* Calculate icon column fac
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list