[Bf-blender-cvs] [a9d146910bc] userpref_redesign: Add placeholder sections for workspaces

Julian Eisel noreply at git.blender.org
Tue Feb 27 14:39:10 CET 2018


Commit: a9d146910bcaadb84a799351bebb702b9d5a86bb
Author: Julian Eisel
Date:   Tue Feb 27 14:33:32 2018 +0100
Branches: userpref_redesign
https://developer.blender.org/rBa9d146910bcaadb84a799351bebb702b9d5a86bb

Add placeholder sections for workspaces

Adds
* "Worspace Configuration File",
* "Worspace Add-on Overrides",
* "Worspace Key-map Overrides"
sections to the Blender settings.

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

M	release/scripts/startup/bl_ui/space_userpref.py
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 f8fef4b0186..83925923fc3 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -57,13 +57,14 @@ class USERPREF_HT_header(Header):
         userpref = context.user_preferences
 
         layout.operator_context = 'EXEC_AREA'
-        layout.operator("wm.save_userpref")
+        if userpref.active_section in {'WORKSPACE_CONFIG', 'WORKSPACE_ADDONS', 'WORKSPACE_KEYMAPS'}:
+            layout.operator("wm.save_workspace_file")
+        else:
+            layout.operator("wm.save_userpref")
 
         layout.operator_context = 'INVOKE_DEFAULT'
 
-        if userpref.active_section == 'INTERFACE':
-            layout.operator("wm.save_workspace_file")
-        elif userpref.active_section == 'INPUT':
+        if userpref.active_section == 'INPUT':
             layout.operator("wm.keyconfig_import")
             layout.operator("wm.keyconfig_export")
         elif userpref.active_section == 'ADDONS':
@@ -1582,6 +1583,57 @@ class USERPREF_PT_addons(Panel):
                 row.label(text=module_name, translate=False)
 
 
+class USERPREF_PT_workspace_config(Panel):
+    bl_space_type = 'USER_PREFERENCES'
+    bl_label = "Workspace Configuration File"
+    bl_region_type = 'WINDOW'
+    bl_options = {'HIDE_HEADER'}
+
+    @classmethod
+    def poll(cls, context):
+        userpref = context.user_preferences
+        return (userpref.active_section == 'WORKSPACE_CONFIG')
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.label("Nothing to see here yet!")
+
+
+class USERPREF_PT_workspace_addons(Panel):
+    bl_space_type = 'USER_PREFERENCES'
+    bl_label = "Workspace Add-on Overrides"
+    bl_region_type = 'WINDOW'
+    bl_options = {'HIDE_HEADER'}
+
+    @classmethod
+    def poll(cls, context):
+        userpref = context.user_preferences
+        return (userpref.active_section == 'WORKSPACE_ADDONS')
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.label("Nothing to see here yet!")
+
+
+class USERPREF_PT_workspace_keymaps(Panel):
+    bl_space_type = 'USER_PREFERENCES'
+    bl_label = "Workspace Key-map Overrides"
+    bl_region_type = 'WINDOW'
+    bl_options = {'HIDE_HEADER'}
+
+    @classmethod
+    def poll(cls, context):
+        userpref = context.user_preferences
+        return (userpref.active_section == 'WORKSPACE_KEYMAPS')
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.label("Nothing to see here yet!")
+
+
 classes = (
     USERPREF_HT_header,
     USERPREF_PT_navigation,
@@ -1602,6 +1654,9 @@ classes = (
     USERPREF_PT_input,
     USERPREF_MT_addons_online_resources,
     USERPREF_PT_addons,
+    USERPREF_PT_workspace_config,
+    USERPREF_PT_workspace_addons,
+    USERPREF_PT_workspace_keymaps,
 )
 
 if __name__ == "__main__":  # only for live edit.
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index bc9dc8e95f4..c30fd7515ae 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -603,13 +603,16 @@ extern UserDef U; /* from blenkernel blender.c */
 
 /* UserDef.userpref (UI active_section) */
 typedef enum eUserPref_Section {
-	USER_SECTION_INTERFACE	= 0,
-	USER_SECTION_GENERAL		= 1,
-	USER_SECTION_FILE		= 2,
-	USER_SECTION_SYSTEM		= 3,
-	USER_SECTION_THEME		= 4,
-	USER_SECTION_INPUT		= 5,
-	USER_SECTION_ADDONS 	= 6,
+	USER_SECTION_INTERFACE         = 0,
+	USER_SECTION_GENERAL           = 1,
+	USER_SECTION_FILE              = 2,
+	USER_SECTION_SYSTEM            = 3,
+	USER_SECTION_THEME             = 4,
+	USER_SECTION_INPUT             = 5,
+	USER_SECTION_ADDONS            = 6,
+	USER_SECTION_WORKSPACE_CONFIG  = 7,
+	USER_SECTION_WORKSPACE_ADDONS  = 8,
+	USER_SECTION_WORKSPACE_KEYMAPS = 9,
 } eUserPref_Section;
 
 /* UserDef.flag */
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 74bb16d7e03..4b15a18ad63 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -4703,6 +4703,10 @@ void RNA_def_userdef(BlenderRNA *brna)
 		{USER_SECTION_ADDONS, "ADDONS", 0, "Add-ons", ""},
 		{USER_SECTION_THEME, "THEMES", 0, "Themes", ""},
 		{USER_SECTION_FILE, "FILES", 0, "File", ""},
+		{0, "", 0, "Workspaces", ""},
+		{USER_SECTION_WORKSPACE_CONFIG, "WORKSPACE_CONFIG", 0, "Workspace Configuration File", ""},
+		{USER_SECTION_WORKSPACE_ADDONS, "WORKSPACE_ADDONS", 0, "Workspace Add-on Overrides", ""},
+		{USER_SECTION_WORKSPACE_KEYMAPS, "WORKSPACE_KEYMAPS", 0, "Workspace Key-map Overrides", ""},
 		{USER_SECTION_SYSTEM, "SYSTEM", 0, "System", ""},
 		{0, NULL, 0, NULL, NULL}
 	};



More information about the Bf-blender-cvs mailing list