[Bf-blender-cvs] [c4bf66e5423] userpref_redesign: Use panel layout in most Preferences sections

William Reynish noreply at git.blender.org
Fri Dec 7 01:16:56 CET 2018


Commit: c4bf66e54237e85ad8a4d46a06360174280dcdeb
Author: William Reynish
Date:   Thu Dec 6 23:15:15 2018 +0100
Branches: userpref_redesign
https://developer.blender.org/rBc4bf66e54237e85ad8a4d46a06360174280dcdeb

Use panel layout in most Preferences sections

Also removes all buttons from the header (except editor switch) and puts
them into the corresponding sections.

Breaks the input section which will be fixed in a followup commit.

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

M	release/scripts/modules/rna_keymap_ui.py
M	release/scripts/startup/bl_ui/space_userpref.py

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

diff --git a/release/scripts/modules/rna_keymap_ui.py b/release/scripts/modules/rna_keymap_ui.py
index 756dbde23c9..fb6852c14ce 100644
--- a/release/scripts/modules/rna_keymap_ui.py
+++ b/release/scripts/modules/rna_keymap_ui.py
@@ -372,15 +372,25 @@ def draw_keymaps(context, layout):
     subcol = subsplit.column()
 
     col = subcol.column()
-    row = col.row(align=True)
+
 
     # row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config")
     text = bpy.path.display_name(kc_active.name)
     if not text:
         text = "Blender (default)"
-    row.menu("USERPREF_MT_keyconfigs", text=text)
-    row.operator("wm.keyconfig_preset_add", text="", icon='ADD')
-    row.operator("wm.keyconfig_preset_add", text="", icon='REMOVE').remove_active = True
+
+    row = col.row()
+
+    row.operator("wm.keyconfig_import", text="Import", icon='IMPORT')
+    row.operator("wm.keyconfig_export", text="Export",  icon='EXPORT')
+
+    row.separator()
+
+    rowsub = row.row(align=True)
+
+    rowsub.menu("USERPREF_MT_keyconfigs", text=text)
+    rowsub.operator("wm.keyconfig_preset_add", text="", icon='ADD')
+    rowsub.operator("wm.keyconfig_preset_add", text="", icon='REMOVE').remove_active = True
 
     # layout.context_pointer_set("keyconfig", wm.keyconfigs.active)
     # row.operator("wm.keyconfig_remove", text="", icon='X')
@@ -420,7 +430,7 @@ def draw_keymaps(context, layout):
                 inputs,
                 "show_ui_keyconfig",
                 text="",
-                icon='TRIA_DOWN' if show_ui_keyconfig else 'TRIA_RIGHT',
+                icon='DISCLOSURE_TRI_DOWN' if show_ui_keyconfig else 'DISCLOSURE_TRI_RIGHT',
                 emboss=False,
             )
             row.label(text="Preferences")
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 6d272faaf38..d349b179ae2 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -37,27 +37,13 @@ class USERPREF_HT_header(Header):
 
         userpref = context.user_preferences
 
-        if userpref.active_section == 'INPUT':
-            layout.operator("wm.keyconfig_import", icon='IMPORT')
-            layout.operator("wm.keyconfig_export", icon='EXPORT')
-        elif userpref.active_section == 'ADDONS':
-            layout.operator("wm.addon_install", icon='FILEBROWSER')
-            layout.operator("wm.addon_refresh", icon='FILE_REFRESH')
-            layout.menu("USERPREF_MT_addons_online_resources")
-        elif userpref.active_section == 'LIGHTS':
+
+        if userpref.active_section == 'LIGHTS':
             layout.operator('wm.studiolight_install', text="Add MatCap").type = 'MATCAP'
             layout.operator('wm.studiolight_install', text="Add LookDev HDRI").type = 'WORLD'
             op = layout.operator('wm.studiolight_install', text="Add Studio Light")
             op.type = 'STUDIO'
             op.filter_glob = ".sl"
-        elif userpref.active_section == 'THEMES':
-            layout.operator("wm.theme_install", icon='FILEBROWSER')
-            layout.operator("ui.reset_default_theme", icon='LOOP_BACK')
-
-        layout.separator_spacer()
-
-        layout.operator_context = 'EXEC_AREA'
-        layout.operator("wm.save_userpref")
 
 
 class USERPREF_PT_navigation(Panel):
@@ -68,6 +54,7 @@ class USERPREF_PT_navigation(Panel):
 
     def draw(self, context):
         layout = self.layout
+        layout.operator_context = 'EXEC_AREA'
 
         userpref = context.user_preferences
 
@@ -77,6 +64,11 @@ class USERPREF_PT_navigation(Panel):
         col.scale_y = 1.3
         col.prop(userpref, "active_section", expand=True)
 
+        col.separator_spacer()
+        #Doesn't work vertically yet
+
+        col.operator("wm.save_userpref")
+
 
 class PreferencePanel(Panel):
     bl_space_type = 'USER_PREFERENCES'
@@ -104,132 +96,228 @@ class PreferencePanel(Panel):
         row.label() # Needed so col above is centered.
 
 
-class USERPREF_PT_interface(Panel):
-    bl_space_type = 'USER_PREFERENCES'
-    bl_label = "Interface"
-    bl_region_type = 'WINDOW'
-    bl_options = {'HIDE_HEADER'}
+class USERPREF_PT_interface_display(PreferencePanel):
+    bl_label = "Display"
 
     @classmethod
     def poll(cls, context):
         userpref = context.user_preferences
         return (userpref.active_section == 'INTERFACE')
 
-    def draw(self, context):
-        layout = self.layout
+    def draw_props(self, context, layout):
+        userpref = context.user_preferences
+        view = userpref.view
+
+        layout.prop(view, "ui_scale", text="Scale")
+        layout.prop(view, "ui_line_width", text="Line Width")
 
+
+class USERPREF_PT_interface_display_info(PreferencePanel):
+    bl_label = "Information"
+    bl_parent_id = "USERPREF_PT_interface_display"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    def draw_props(self, context, layout):
         userpref = context.user_preferences
         view = userpref.view
 
-        split = layout.split()
-        row = split.row()
-        col = row.column()
+        layout.prop(view, "show_tooltips")
+        layout.prop(view, "show_object_info", text="Object Info")
+        layout.prop(view, "show_large_cursors")
+        layout.prop(view, "show_view_name", text="View Name")
+        layout.prop(view, "show_playback_fps", text="Playback FPS")
 
-        col.label(text="Display:")
-        col.prop(view, "ui_scale", text="Scale")
-        col.prop(view, "ui_line_width", text="Line Width")
-        col.prop(view, "show_tooltips")
-        col.prop(view, "show_object_info", text="Object Info")
-        col.prop(view, "show_large_cursors")
-        col.prop(view, "show_view_name", text="View Name")
-        col.prop(view, "show_playback_fps", text="Playback FPS")
-        col.prop(view, "object_origin_size")
+class USERPREF_PT_interface_develop(PreferencePanel):
+    bl_label = "Develop"
+    bl_options = {'DEFAULT_CLOSED'}
 
-        col.separator()
+    @classmethod
+    def poll(cls, context):
+        userpref = context.user_preferences
+        return (userpref.active_section == 'INTERFACE')
+
+    def draw_props(self, context, layout):
+        userpref = context.user_preferences
+        view = userpref.view
+
+        layout.prop(view, "show_tooltips_python")
+        layout.prop(view, "show_developer_ui")
+
+
+class USERPREF_PT_interface_view_manipulation(PreferencePanel):
+    bl_label = "View Manipulation"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        userpref = context.user_preferences
+        return (userpref.active_section == 'INTERFACE')
+
+    def draw_props(self, context, layout):
+        userpref = context.user_preferences
+        view = userpref.view
+
+        layout.prop(view, "smooth_view")
+        layout.prop(view, "rotation_angle")
+
+        layout.separator()
+
+        layout.prop(view, "use_mouse_depth_cursor")
+        layout.prop(view, "use_cursor_lock_adjust")
+
+        layout.separator()
+
+        layout.prop(view, "use_auto_perspective")
+        layout.prop(view, "use_mouse_depth_navigate")
+
+        layout.separator()
+
+        layout.prop(view, "use_zoom_to_mouse")
+        layout.prop(view, "use_rotate_around_active")
+
+        layout.separator()
+
+        layout.prop(view, "use_camera_lock_parent")
+
+
+class USERPREF_PT_interface_viewports(PreferencePanel):
+    bl_label = "Viewports"
+    bl_options = {'DEFAULT_CLOSED'}
 
-        # col.prop(view, "show_gizmo_navigate")
+    @classmethod
+    def poll(cls, context):
+        userpref = context.user_preferences
+        return (userpref.active_section == 'INTERFACE')
+
+
+class USERPREF_PT_interface_viewports_3d(PreferencePanel):
+    bl_label = "3D Viewports"
+    bl_parent_id = "USERPREF_PT_interface_viewports"
+
+    def draw_props(self, context, layout):
+        userpref = context.user_preferences
+        view = userpref.view
 
-        sub = col.column(align=True)
+        layout.prop(view, "object_origin_size")
+
+        layout.separator()
 
-        sub.label(text="3D Viewport Axis:")
-        sub.row().prop(view, "mini_axis_type", text="")
+        layout.prop(view, "mini_axis_type", text="3D Viewport Axis")
 
-        sub = col.column(align=True)
+        sub = layout.column()
         sub.active = view.mini_axis_type == 'MINIMAL'
         sub.prop(view, "mini_axis_size", text="Size")
         sub.prop(view, "mini_axis_brightness", text="Brightness")
 
-        col.separator()
+        layout.separator()
 
-        # Toolbox doesn't exist yet
-        # col.label(text="Toolbox:")
-        #col.prop(view, "show_column_layout")
-        #col.label(text="Open Toolbox Delay:")
-        #col.prop(view, "open_left_mouse_delay", text="Hold LMB")
-        #col.prop(view, "open_right_mouse_delay", text="Hold RMB")
-        col.prop(view, "show_gizmo", text="Gizmos")
-        sub = col.column()
-        sub.active = view.show_gizmo
-        sub.prop(view, "gizmo_size", text="Size")
+        layout.prop(view, "gizmo_size", text="Gizmo Size")
 
-        col.separator()
 
-        col.label(text="Development:")
-        col.prop(view, "show_tooltips_python")
-        col.prop(view, "show_developer_ui")
+class USERPREF_PT_interface_viewports_3d_weight_paint(PreferencePanel):
+    bl_label = "Custom Weight Paint Range"
+    bl_options = {'DEFAULT_CLOSED'}
+    bl_parent_id = "USERPREF_PT_interface_viewports_3d"
 
-        row = split.row()
-        row.separator()
-        col = row.column()
+    def draw_header(self, context):
+        userpref = context.user_preferences
+        system = userpref.system
 
-        col.label(text="View Gizmos:")
-        col.prop(view, "use_mouse_depth_cursor")
-        col.prop(view, "use_cursor_lock_adjust")
-        col.prop(view, "use_mouse_depth_navigate")
-        col.prop(view, "use_zoom_to_mouse")
-        col.prop(view, "use_rotate_around_active")
-        col.prop(view, "use_camera_lock_parent")
+        self.layout.prop(system, "use_weight_color_range", text="")
 
-        col.separator()
+    def draw_props(self, context, layout):
+        userpref = context.user_preferences
+        system = userpr

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list