[Bf-blender-cvs] [6d6aad08d72] userpref_redesign: Split keymap settings from "Input" into separate section

Julian Eisel noreply at git.blender.org
Fri Dec 7 01:16:58 CET 2018


Commit: 6d6aad08d72408f272d82018f04d30b333b82447
Author: Julian Eisel
Date:   Fri Dec 7 01:06:58 2018 +0100
Branches: userpref_redesign
https://developer.blender.org/rB6d6aad08d72408f272d82018f04d30b333b82447

Split keymap settings from "Input" into separate section

Adds a new section "Keymap" and puts keymap settings into this.

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

M	release/scripts/modules/bpy/utils/__init__.py
M	release/scripts/modules/rna_keymap_ui.py
M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/release/scripts/modules/bpy/utils/__init__.py b/release/scripts/modules/bpy/utils/__init__.py
index 75044d9d85c..9ef89fa365f 100644
--- a/release/scripts/modules/bpy/utils/__init__.py
+++ b/release/scripts/modules/bpy/utils/__init__.py
@@ -572,7 +572,7 @@ def preset_find(name, preset_path, display_name=False, ext=".py"):
 def keyconfig_init():
     # Key configuration initialization and refresh, called from the Blender
     # window manager on startup and refresh.
-    active_config = _user_preferences.inputs.active_keyconfig
+    active_config = _user_preferences.keymap.active_keyconfig
 
     # Load the default key configuration.
     default_filepath = preset_find("blender", "keyconfig")
diff --git a/release/scripts/modules/rna_keymap_ui.py b/release/scripts/modules/rna_keymap_ui.py
index fb6852c14ce..d39fa7ac7bd 100644
--- a/release/scripts/modules/rna_keymap_ui.py
+++ b/release/scripts/modules/rna_keymap_ui.py
@@ -424,10 +424,10 @@ def draw_keymaps(context, layout):
             row = box.row(align=True)
 
             userpref = context.user_preferences
-            inputs = userpref.inputs
-            show_ui_keyconfig = inputs.show_ui_keyconfig
+            keymappref = userpref.keymap
+            show_ui_keyconfig = keymappref.show_ui_keyconfig
             row.prop(
-                inputs,
+                keymappref,
                 "show_ui_keyconfig",
                 text="",
                 icon='DISCLOSURE_TRI_DOWN' if show_ui_keyconfig else 'DISCLOSURE_TRI_RIGHT',
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index d349b179ae2..3b11c5e0ff2 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -1424,12 +1424,12 @@ class USERPREF_PT_keymap(Panel):
         #start = time.time()
 
         userpref = context.user_preferences
-        inputs = userpref.inputs
+        keymappref = userpref.keymap
 
         col = layout.column()
 
         # Input settings
-        self.draw_input_prefs(inputs, col)
+        self.draw_input_prefs(keymappref, col)
 
         # Keymap Settings
         draw_keymaps(context, col)
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 2e3baa27898..b36dc4bc3a6 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -696,14 +696,15 @@ typedef enum eUserPref_Section {
 	USER_SECTION_INPUT             = 5,
 	USER_SECTION_ADDONS            = 6,
 	USER_SECTION_LIGHT             = 7,
+	USER_SECTION_KEYMAP            = 8,
 #ifdef WITH_USERDEF_WORKSPACES
-	USER_SECTION_WORKSPACE_CONFIG  = 8,
-	USER_SECTION_WORKSPACE_ADDONS  = 9,
-	USER_SECTION_WORKSPACE_KEYMAPS = 10,
+	USER_SECTION_WORKSPACE_CONFIG  = 9,
+	USER_SECTION_WORKSPACE_ADDONS  = 10,
+	USER_SECTION_WORKSPACE_KEYMAPS = 11,
 #endif
 #ifdef WITH_USERDEF_SYSTEM_SPLIT
-	USER_SECTION_SYSTEM_DISPLAY    = 11,
-	USER_SECTION_SYSTEM_DEVICES    = 12,
+	USER_SECTION_SYSTEM_DISPLAY    = 12,
+	USER_SECTION_SYSTEM_DEVICES    = 13,
 #endif
 } eUserPref_Section;
 
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 86f0f2d85bf..746a4a2b31c 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -711,6 +711,7 @@ extern StructRNA RNA_UserPreferences;
 extern StructRNA RNA_UserPreferencesEdit;
 extern StructRNA RNA_UserPreferencesFilePaths;
 extern StructRNA RNA_UserPreferencesInput;
+extern StructRNA RNA_UserPreferencesKeymap;
 extern StructRNA RNA_UserPreferencesSystem;
 extern StructRNA RNA_UserPreferencesView;
 extern StructRNA RNA_UserPreferencesWalkNavigation;
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 3bdec89ce5b..489c592ad90 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -293,6 +293,11 @@ static PointerRNA rna_UserDef_input_get(PointerRNA *ptr)
 	return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesInput, ptr->data);
 }
 
+static PointerRNA rna_UserDef_keymap_get(PointerRNA *ptr)
+{
+	return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesKeymap, ptr->data);
+}
+
 static PointerRNA rna_UserDef_filepaths_get(PointerRNA *ptr)
 {
 	return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesFilePaths, ptr->data);
@@ -4606,10 +4611,6 @@ static void rna_def_userdef_input(BlenderRNA *brna)
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Input", "Settings for input devices");
 
-	prop = RNA_def_property(srna, "show_ui_keyconfig", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_negative_sdna(prop, NULL, "userpref_flag", USER_SECTION_INPUT_HIDE_UI_KEYCONFIG);
-	RNA_def_property_ui_text(prop, "Show UI Key-Config", "");
-
 	prop = RNA_def_property(srna, "view_zoom_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "viewzoom");
 	RNA_def_property_enum_items(prop, view_zoom_styles);
@@ -4796,6 +4797,21 @@ static void rna_def_userdef_input(BlenderRNA *brna)
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag2", USER_TRACKPAD_NATURAL);
 	RNA_def_property_ui_text(prop, "Trackpad Natural",
 	                         "If your system uses 'natural' scrolling, this option keeps consistent trackpad usage throughout the UI");
+}
+
+static void rna_def_userdef_keymap(BlenderRNA *brna)
+{
+	PropertyRNA *prop;
+
+	StructRNA *srna = RNA_def_struct(brna, "UserPreferencesKeymap", NULL);
+	RNA_def_struct_sdna(srna, "UserDef");
+	RNA_def_struct_nested(brna, srna, "UserPreferences");
+	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+	RNA_def_struct_ui_text(srna, "Keymap", "Shortcut setup for keyboards and other input devices");
+
+	prop = RNA_def_property(srna, "show_ui_keyconfig", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "userpref_flag", USER_SECTION_INPUT_HIDE_UI_KEYCONFIG);
+	RNA_def_property_ui_text(prop, "Show UI Key-Config", "");
 
 	prop = RNA_def_property(srna, "active_keyconfig", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "keyconfigstr");
@@ -5003,13 +5019,15 @@ void RNA_def_userdef(BlenderRNA *brna)
 	PropertyRNA *prop;
 
 	static const EnumPropertyItem user_pref_sections[] = {
-		{0, "", ICON_USER, "User Preferences", ""},
+		{0, "", ICON_USER, "User", ""},
 		{USER_SECTION_INTERFACE, "INTERFACE", 0, "Interface", ""},
+		{USER_SECTION_THEME, "THEMES", 0, "Themes", ""},
+		{USER_SECTION_LIGHT, "LIGHTS", 0, "Lights", ""},
 		{USER_SECTION_EDIT, "EDITING", 0, "Editing", ""},
 		{USER_SECTION_INPUT, "INPUT", 0, "Input", ""},
+		{USER_SECTION_KEYMAP, "KEYMAP", 0, "Keymap", ""},
 		{USER_SECTION_ADDONS, "ADDONS", 0, "Add-ons", ""},
-		{USER_SECTION_THEME, "THEMES", 0, "Themes", ""},
-		{USER_SECTION_LIGHT, "LIGHTS", 0, "Lights", ""},
+
 #ifdef WITH_USERDEF_WORKSPACES
 		{0, "", ICON_WORKSPACE, "Workspaces", ""},
 		{USER_SECTION_WORKSPACE_CONFIG, "WORKSPACE_CONFIG", 0, "Configuration File", ""},
@@ -5088,6 +5106,12 @@ void RNA_def_userdef(BlenderRNA *brna)
 	RNA_def_property_pointer_funcs(prop, "rna_UserDef_input_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Inputs", "Settings for input devices");
 
+	prop = RNA_def_property(srna, "keymap", PROP_POINTER, PROP_NONE);
+	RNA_def_property_flag(prop, PROP_NEVER_NULL);
+	RNA_def_property_struct_type(prop, "UserPreferencesKeymap");
+	RNA_def_property_pointer_funcs(prop, "rna_UserDef_keymap_get", NULL, NULL, NULL);
+	RNA_def_property_ui_text(prop, "Keymap", "Shortcut setup for keyboards and other input devices");
+
 	prop = RNA_def_property(srna, "filepaths", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "UserPreferencesFilePaths");
@@ -5119,6 +5143,7 @@ void RNA_def_userdef(BlenderRNA *brna)
 	rna_def_userdef_view(brna);
 	rna_def_userdef_edit(brna);
 	rna_def_userdef_input(brna);
+	rna_def_userdef_keymap(brna);
 	rna_def_userdef_filepaths(brna);
 	rna_def_userdef_system(brna);
 	rna_def_userdef_addon(brna);



More information about the Bf-blender-cvs mailing list