Paste P691

Quick patch to show in the splashcreen if Blender is running with or without COW enabled
ActivePublic

Authored by Inês Almeida (brita_) on May 19 2018, 4:26 PM.
1diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
2index 70be609dba3..cc0549dee31 100644
3--- a/source/blender/windowmanager/intern/wm_operators.c
4+++ b/source/blender/windowmanager/intern/wm_operators.c
5@@ -1865,6 +1865,7 @@ static int wm_resource_check_prev(void)
6​ }
7​ }
8
9+#include "DEG_depsgraph.h"
10​ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(arg))
11​ {
12​ uiBlock *block;
13@@ -1904,6 +1905,13 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
14​ hash_width = (int)BLF_width(style->widgetlabel.uifont_id, hash_buf, sizeof(hash_buf)) + U.widget_unit;
15​ date_width = (int)BLF_width(style->widgetlabel.uifont_id, date_buf, sizeof(date_buf)) + U.widget_unit;
16​ #endif /* WITH_BUILDINFO */
17+ int label_delta2 = 0;
18+ int cow_width;
19+ char cow_buf[64] = "\0";
20+ BLI_snprintf(cow_buf, sizeof(cow_buf), "COW %s", DEG_depsgraph_use_copy_on_write() ? "Enabled!" : "disabled");
21+
22+ BLF_size(style->widgetlabel.uifont_id, style->widgetlabel.points, U.pixelsize * U.dpi);
23+ cow_width = (int)BLF_width(style->widgetlabel.uifont_id, cow_buf, sizeof(cow_buf)) + U.widget_unit;
24
25​ #ifndef WITH_HEADLESS
26​ if (U.pixelsize == 2) {
27@@ -2011,7 +2019,16 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
28​ /* XXX, set internal flag - UI_SELECT */
29​ UI_but_flag_enable(but, 1);
30​ }
31+
32+ label_delta2 = label_delta + 24;
33​ #endif /* WITH_BUILDINFO */
34+
35+ but = uiDefBut(
36+ block, UI_BTYPE_LABEL, 0, cow_buf,
37+ U.pixelsize * 502 - cow_width, U.pixelsize * (267 - label_delta2),
38+ cow_width, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
39+ /* XXX, set internal flag - UI_SELECT */
40+ UI_but_flag_enable(but, 1);
41
42​ layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, U.pixelsize * 480, U.pixelsize * 110, 0, style);
43