[Bf-blender-cvs] [79eeabafb39] master: UI: 'About Blender' with Full Logo

Yevgeny Makarov noreply at git.blender.org
Sun Dec 6 19:30:53 CET 2020


Commit: 79eeabafb39f8771c0f41c46dc8b819097e403cb
Author: Yevgeny Makarov
Date:   Sun Dec 6 10:29:26 2020 -0800
Branches: master
https://developer.blender.org/rB79eeabafb39f8771c0f41c46dc8b819097e403cb

UI: 'About Blender' with Full Logo

New layout for the 'About' dialog featuring the full version of the Blender logo.

Differential Revision: https://developer.blender.org/D9507

Reviewed by Hans Goudey

===================================================================

A	release/datafiles/blender_logo.png
M	release/scripts/startup/bl_operators/wm.py
M	source/blender/editors/datafiles/CMakeLists.txt
M	source/blender/editors/include/ED_datafiles.h
M	source/blender/windowmanager/intern/wm_splash_screen.c

===================================================================

diff --git a/release/datafiles/blender_logo.png b/release/datafiles/blender_logo.png
new file mode 100644
index 00000000000..17ffef7df5d
Binary files /dev/null and b/release/datafiles/blender_logo.png differ
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index bd1ae2ca8e1..387e93cb769 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -31,6 +31,7 @@ from bpy.props import (
     IntProperty,
     StringProperty,
 )
+from bpy.app.translations import pgettext_iface as iface_
 
 # FIXME, we need a way to detect key repeat events.
 # unfortunately checking event previous values isn't reliable.
@@ -2642,26 +2643,28 @@ class WM_MT_splash_about(Menu):
         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'
+        split = layout.split(factor=0.65)
+
+        col = split.column(align=True)
+        col.scale_y = 0.8
+        col.label(text=bpy.app.version_string, translate=False)
+        col.separator(factor=2.5)
+        col.label(text=iface_("Date: %s %s") % (bpy.app.build_commit_date.decode('utf-8', 'replace'),
+                                                bpy.app.build_commit_time.decode('utf-8', 'replace')), translate=False)
+        col.label(text=iface_("Hash: %s") % bpy.app.build_hash.decode('ascii'), translate=False)
+        col.label(text=iface_("Branch: %s") % bpy.app.build_branch.decode('utf-8', 'replace'), translate=False)
+        col.separator(factor=2.0)
+        col.label(text="Blender is free software")
+        col.label(text="Licensed under the GNU General Public License")
+
+        col = split.column(align=True)
+        col.emboss = 'PULLDOWN_MENU'
+        col.operator("wm.url_open_preset", text="Release Notes", icon='URL').type = 'RELEASE_NOTES'
+        col.operator("wm.url_open_preset", text="Credits", icon='URL').type = 'CREDITS'
+        col.operator("wm.url_open", text="License", icon='URL').url = "https://www.blender.org/about/license/"
+        col.operator("wm.url_open_preset", text="Blender Website", icon='URL').type = 'BLENDER'
+        col.operator("wm.url_open", text="Blender Store", icon='URL').url = "https://store.blender.org"
+        col.operator("wm.url_open_preset", text="Development Fund", icon='FUND').type = 'FUND'
 
 
 class WM_OT_drop_blend_file(Operator):
diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt
index e374010cf44..337fb18f835 100644
--- a/source/blender/editors/datafiles/CMakeLists.txt
+++ b/source/blender/editors/datafiles/CMakeLists.txt
@@ -791,6 +791,7 @@ if(WITH_BLENDER)
     # images
     data_to_c_simple(../../../../release/datafiles/splash.png SRC)
     data_to_c_simple(../../../../release/datafiles/alert_icons.png SRC)
+    data_to_c_simple(../../../../release/datafiles/blender_logo.png SRC)
     # XXX These are handy, but give nasty "false changes" in svn :/
     # svg_to_png(../../../../release/datafiles/blender_icons.svg
     #            ../../../../release/datafiles/blender_icons16.png
diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h
index ba77da24406..40b0a8d96b1 100644
--- a/source/blender/editors/include/ED_datafiles.h
+++ b/source/blender/editors/include/ED_datafiles.h
@@ -50,6 +50,9 @@ extern char datatoc_prvicons_png[];
 extern int datatoc_alert_icons_png_size;
 extern char datatoc_alert_icons_png[];
 
+extern int datatoc_blender_logo_png_size;
+extern char datatoc_blender_logo_png[];
+
 extern int datatoc_splash_png_size;
 extern char datatoc_splash_png[];
 
diff --git a/source/blender/windowmanager/intern/wm_splash_screen.c b/source/blender/windowmanager/intern/wm_splash_screen.c
index d732393b631..a3619a69152 100644
--- a/source/blender/windowmanager/intern/wm_splash_screen.c
+++ b/source/blender/windowmanager/intern/wm_splash_screen.c
@@ -256,71 +256,62 @@ void WM_OT_splash(wmOperatorType *ot)
 static uiBlock *wm_block_create_about(bContext *C, ARegion *region, void *UNUSED(arg))
 {
   const uiStyle *style = UI_style_get_dpi();
-  const short logo_size = 128 * U.dpi_fac;
   const int text_points_max = MAX2(style->widget.points, style->widgetlabel.points);
-  const int dialog_width = logo_size + (text_points_max * 32 * U.dpi_fac);
-
-  /* Calculate icon column factor. */
-  const float split_factor = (float)logo_size / (float)(dialog_width - style->columnspace);
+  const int dialog_width = text_points_max * 42 * U.dpi_fac;
 
   uiBlock *block = UI_block_begin(C, region, "about", UI_EMBOSS);
 
-  UI_block_flag_enable(
-      block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_LOOP | UI_BLOCK_NO_WIN_CLIP | UI_BLOCK_NUMSELECT);
+  UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_LOOP | UI_BLOCK_NO_WIN_CLIP);
   UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
-  UI_block_emboss_set(block, UI_EMBOSS);
 
-  uiLayout *block_layout = UI_block_layout(
+  uiLayout *layout = UI_block_layout(
       block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, dialog_width, 0, 0, style);
 
-  /* Split layout to put Blender logo on left side. */
-  uiLayout *split_block = uiLayoutSplit(block_layout, split_factor, false);
-
-  /* Blender Logo. */
-  uiLayout *layout = uiLayoutColumn(split_block, false);
-  uiDefButAlert(block, ALERT_ICON_BLENDER, 0, 0, 0, logo_size);
-
-  /* The rest of the content on the right. */
-  layout = uiLayoutColumn(split_block, false);
-
-  uiLayoutSetScaleY(layout, 0.7f);
-
-  uiItemS_ex(layout, 1.0f);
-
-  /* Title. */
-  uiItemL_ex(layout, "Blender", ICON_NONE, true, false);
+  /* Blender logo. */
+#ifndef WITH_HEADLESS
+  extern char datatoc_blender_logo_png[];
+  extern int datatoc_blender_logo_png_size;
 
-  /* Version. */
-  uiItemL(layout, BKE_blender_version_string(), ICON_NONE);
+  const uchar *blender_logo_data = (const uchar *)datatoc_blender_logo_png;
+  size_t blender_logo_data_size = datatoc_blender_logo_png_size;
+  ImBuf *ibuf = IMB_ibImageFromMemory(
+      blender_logo_data, blender_logo_data_size, IB_rect, NULL, "blender_logo");
 
-  uiItemS_ex(layout, 3.0f);
+  if (ibuf) {
+    int width = 0.5 * dialog_width;
+    int height = (width * ibuf->y) / ibuf->x;
 
-#ifdef WITH_BUILDINFO
+    IMB_premultiply_alpha(ibuf);
+    IMB_scaleImBuf(ibuf, width, height);
 
-  extern char build_hash[], build_commit_date[], build_commit_time[], build_branch[];
+    bTheme *btheme = UI_GetTheme();
+    const uchar *color = btheme->tui.wcol_menu_back.text_sel;
 
-  char str_buf[256] = "\0";
-  BLI_snprintf(str_buf, sizeof(str_buf), "Date: %s %s", build_commit_date, build_commit_time);
-  uiItemL(layout, str_buf, ICON_NONE);
+    /* The top margin. */
+    uiLayout *row = uiLayoutRow(layout, false);
+    uiItemS_ex(row, 0.2f);
 
-  BLI_snprintf(str_buf, sizeof(str_buf), "Hash: %s", build_hash);
-  uiItemL(layout, str_buf, ICON_NONE);
+    /* The logo image. */
+    row = uiLayoutRow(layout, false);
+    uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT);
+    uiDefButImage(block, ibuf, 0, U.widget_unit, width, height, color);
 
-  BLI_snprintf(str_buf, sizeof(str_buf), "Branch: %s", build_branch);
-  uiItemL(layout, str_buf, ICON_NONE);
+    /* Padding below the logo. */
+    row = uiLayoutRow(layout, false);
+    uiItemS_ex(row, 2.7f);
+  }
+#endif /* WITH_HEADLESS */
 
-#endif /* WITH_BUILDINFO */
+  uiLayout *col = uiLayoutColumn(layout, true);
 
-  uiItemS_ex(layout, 1.5f);
+  uiItemL_ex(col, N_("Blender"), ICON_NONE, true, false);
 
   MenuType *mt = WM_menutype_find("WM_MT_splash_about", true);
   if (mt) {
-    UI_menutype_draw(C, mt, layout);
+    UI_menutype_draw(C, mt, col);
   }
 
-  uiItemS_ex(layout, 2.0f);
-
-  UI_block_bounds_set_centered(block, 14 * U.dpi_fac);
+  UI_block_bounds_set_centered(block, 22 * U.dpi_fac);
 
   return block;
 }



More information about the Bf-blender-cvs mailing list