[Bf-blender-cvs] [717090f40e1] master: UI: option not to show screen splitting widgets

Campbell Barton noreply at git.blender.org
Thu Jan 11 06:02:41 CET 2018


Commit: 717090f40e1aa12be26522df350d01a50d7b6316
Author: Campbell Barton
Date:   Thu Jan 11 16:08:55 2018 +1100
Branches: master
https://developer.blender.org/rB717090f40e1aa12be26522df350d01a50d7b6316

UI: option not to show screen splitting widgets

Request for simplified Blender template,
this may be extended to limit access to other UI changes
that could be pressed by accident.

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

M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/blenkernel/intern/blender.c
M	source/blender/editors/interface/resources.c
M	source/blender/editors/screen/area.c
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 5ba1f0b8dcb..3d44c624a7b 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -316,6 +316,9 @@ class USERPREF_PT_interface(Panel):
         col.separator()
         col.separator()
 
+        col.label(text="Screen:")
+        col.prop(view, "show_layout_ui")
+
         col.prop(view, "show_splash")
 
 
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 7a61ef2abac..bc47cfde143 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -258,6 +258,16 @@ void BKE_blender_userdef_app_template_data_swap(UserDef *userdef_a, UserDef *use
 	SWAP(ListBase, userdef_a->id, userdef_b->id); \
 } ((void)0)
 
+#define FLAG_SWAP(id, ty, flags) { \
+	CHECK_TYPE(&(userdef_a->id), ty *); \
+	const ty f = flags; \
+	const ty a = userdef_a->id; \
+	const ty b = userdef_b->id; \
+	 userdef_a->id = (userdef_a->id & ~f) | (b & f); \
+	 userdef_b->id = (userdef_b->id & ~f) | (a & f); \
+} ((void)0)
+
+
 	LIST_SWAP(uistyles);
 	LIST_SWAP(uifonts);
 	LIST_SWAP(themes);
@@ -270,9 +280,11 @@ void BKE_blender_userdef_app_template_data_swap(UserDef *userdef_a, UserDef *use
 	DATA_SWAP(font_path_ui_mono);
 	DATA_SWAP(keyconfigstr);
 
-#undef SWAP_TYPELESS
-#undef LIST_SWAP
+	FLAG_SWAP(uiflag, int, USER_LOCK_UI_LAYOUT);
+
 #undef DATA_SWAP
+#undef LIST_SWAP
+#undef FLAG_SWAP
 }
 
 void BKE_blender_userdef_app_template_data_set(UserDef *userdef)
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index d12e7cc036b..09b0906f134 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -2765,7 +2765,7 @@ void init_userdef_do_versions(void)
 		    USER_FLAG_DEPRECATED_6 | USER_FLAG_DEPRECATED_7 |
 		    USER_FLAG_DEPRECATED_9 | USER_FLAG_DEPRECATED_10);
 		U.uiflag &= ~(
-		    USER_UIFLAG_DEPRECATED_7);
+		    USER_LOCK_UI_LAYOUT);
 		U.transopts &= ~(
 		    USER_TR_DEPRECATED_2 | USER_TR_DEPRECATED_3 | USER_TR_DEPRECATED_4 |
 		    USER_TR_DEPRECATED_6 | USER_TR_DEPRECATED_7);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 9cfaf3b4c1d..e8dc220667a 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -666,6 +666,10 @@ static void area_azone_initialize(wmWindow *win, bScreen *screen, ScrArea *sa)
 		return;
 	}
 
+	if (U.uiflag & USER_LOCK_UI_LAYOUT) {
+		return;
+	}
+
 	/* can't click on bottom corners on OS X, already used for resizing */
 #ifdef __APPLE__
 	if (!(sa->totrct.xmin == 0 && sa->totrct.ymin == 0) || WM_window_is_fullscreen(win))
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index ae6907d256a..93fab4da566 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -668,7 +668,9 @@ typedef enum eUserpref_UI_Flag {
 	USER_DRAWVIEWINFO		= (1 << 4),
 	USER_PLAINMENUS			= (1 << 5),
 	USER_LOCK_CURSOR_ADJUST	= (1 << 6),
-	USER_UIFLAG_DEPRECATED_7	= (1 << 7),  /* cleared */
+	/* Avoid accidentally adjusting the layout
+	 * (exact behavior may change based on whats considered reasonable to lock down). */
+	USER_LOCK_UI_LAYOUT	= (1 << 7),
 	USER_ALLWINCODECS		= (1 << 8),
 	USER_MENUOPENAUTO		= (1 << 9),
 	USER_ZBUF_CURSOR		= (1 << 10),
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 71c53579585..3aed3a1edb1 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -155,6 +155,12 @@ static void rna_userdef_dpi_update(Main *bmain, Scene *UNUSED(scene), PointerRNA
 	WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);    /* refresh region sizes */
 }
 
+static void rna_userdef_update_ui(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+{
+	WM_main_add_notifier(NC_WINDOW, NULL);
+	WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);    /* refresh region sizes */
+}
+
 static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
 {
 	BLF_cache_clear();
@@ -3389,6 +3395,11 @@ static void rna_def_userdef_view(BlenderRNA *brna)
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_SPLASH_DISABLE);
 	RNA_def_property_ui_text(prop, "Show Splash", "Display splash screen on startup");
 
+	prop = RNA_def_property(srna, "show_layout_ui", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_LOCK_UI_LAYOUT);
+	RNA_def_property_ui_text(prop, "Show Layout Widgets", "Show screen layout editing UI");
+	RNA_def_property_update(prop, 0, "rna_userdef_update_ui");
+
 	prop = RNA_def_property(srna, "show_playback_fps", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_FPS);
 	RNA_def_property_ui_text(prop, "Show Playback FPS",



More information about the Bf-blender-cvs mailing list