[Bf-blender-cvs] [ff4c9d69ee4] master: User Prefs: add new flag for app-template options

Campbell Barton noreply at git.blender.org
Fri Jan 12 02:37:42 CET 2018


Commit: ff4c9d69ee4bf1764b6f4effa487e29e6c4ab985
Author: Campbell Barton
Date:   Fri Jan 12 12:30:58 2018 +1100
Branches: master
https://developer.blender.org/rBff4c9d69ee4bf1764b6f4effa487e29e6c4ab985

User Prefs: add new flag for app-template options

For experimental options, outside the scope of typical preferences.

While templates are developed we might want to make changes
to behavior which aren't fully compatible with typical work-flows.

Instead of mixing these options in with current preferences
expose separately (we could even force disable them when templates
aren't int use)

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

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 3d44c624a7b..3516085602e 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -313,13 +313,14 @@ class USERPREF_PT_interface(Panel):
         sub.prop(view, "pie_menu_threshold")
         sub.prop(view, "pie_menu_confirm")
         col.separator()
-        col.separator()
+
+        col.prop(view, "show_splash")
         col.separator()
 
-        col.label(text="Screen:")
+        col.label(text="App Template:")
+        col.label(text="Options intended for use with app-templates only.")
         col.prop(view, "show_layout_ui")
 
-        col.prop(view, "show_splash")
 
 
 class USERPREF_PT_edit(Panel):
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index bc47cfde143..f8a3f134bfb 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -280,7 +280,10 @@ void BKE_blender_userdef_app_template_data_swap(UserDef *userdef_a, UserDef *use
 	DATA_SWAP(font_path_ui_mono);
 	DATA_SWAP(keyconfigstr);
 
-	FLAG_SWAP(uiflag, int, USER_LOCK_UI_LAYOUT);
+	DATA_SWAP(app_flag);
+
+	/* We could add others. */
+	FLAG_SWAP(uiflag, int, USER_QUIT_PROMPT);
 
 #undef DATA_SWAP
 #undef LIST_SWAP
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 09b0906f134..d12e7cc036b 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_LOCK_UI_LAYOUT);
+		    USER_UIFLAG_DEPRECATED_7);
 		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 e8dc220667a..fc0922c7b7c 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -666,7 +666,7 @@ static void area_azone_initialize(wmWindow *win, bScreen *screen, ScrArea *sa)
 		return;
 	}
 
-	if (U.uiflag & USER_LOCK_UI_LAYOUT) {
+	if (U.app_flag & USER_APP_LOCK_UI_LAYOUT) {
 		return;
 	}
 
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 93fab4da566..3d3e9d1704b 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -461,7 +461,10 @@ typedef struct UserDef {
 	short wheellinescroll;
 	int uiflag;   /* eUserpref_UI_Flag */
 	int uiflag2;  /* eUserpref_UI_Flag2 */
-	int language;
+	/* Experimental flag for app-templates to make changes to behavior
+	 * which are outside the scope of typical preferences. */
+	short app_flag;
+	short language;
 	short userpref, viewzoom;
 	
 	int mixbufsize;
@@ -670,7 +673,7 @@ typedef enum eUserpref_UI_Flag {
 	USER_LOCK_CURSOR_ADJUST	= (1 << 6),
 	/* Avoid accidentally adjusting the layout
 	 * (exact behavior may change based on whats considered reasonable to lock down). */
-	USER_LOCK_UI_LAYOUT	= (1 << 7),
+	USER_UIFLAG_DEPRECATED_7 = (1 << 7),
 	USER_ALLWINCODECS		= (1 << 8),
 	USER_MENUOPENAUTO		= (1 << 9),
 	USER_ZBUF_CURSOR		= (1 << 10),
@@ -703,7 +706,12 @@ typedef enum eUserpref_UI_Flag2 {
 	USER_REGION_OVERLAP			= (1 << 1),
 	USER_TRACKPAD_NATURAL		= (1 << 2),
 } eUserpref_UI_Flag2;
-	
+
+/* UserDef.app_flag */
+typedef enum eUserpref_APP_Flag {
+	USER_APP_LOCK_UI_LAYOUT = (1 << 0),
+} eUserpref_APP_Flag;
+
 /* Auto-Keying mode.
  * UserDef.autokey_mode */
 typedef enum eAutokey_Mode {
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 3aed3a1edb1..1258febab61 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3395,17 +3395,19 @@ 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",
 	                         "Show the frames per second screen refresh rate, while animation is played back");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
-	
+
+	/* app flags (use for app-templates) */
+	prop = RNA_def_property(srna, "show_layout_ui", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "app_flag", USER_APP_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");
+
 	/* menus */
 	prop = RNA_def_property(srna, "use_mouse_over_open", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_MENUOPENAUTO);



More information about the Bf-blender-cvs mailing list