[Bf-blender-cvs] [e5b553a8b7e] userpref_redesign: Various improvements to Preferences buttons/layouts

William Reynish noreply at git.blender.org
Thu Dec 20 01:42:07 CET 2018


Commit: e5b553a8b7e0fb28b87a78313245cd5ee9a80ae1
Author: William Reynish
Date:   Thu Dec 20 01:40:27 2018 +0100
Branches: userpref_redesign
https://developer.blender.org/rBe5b553a8b7e0fb28b87a78313245cd5ee9a80ae1

Various improvements to Preferences buttons/layouts

* Header is now fully redundant. Added buttons to add studio lights under the Lights category.
* Removed redundant theme category dropdown
* Made the theme layout use layout flow, so it goes to single column when narrow, but multiple columns as you make it wider
* Made all the themes layouts consistent and all use property split fit with the rest of 2.8
* Fix UI Scale property so it doesn't flicker, by making it a number value rather than a slider - it's more correct this way anyway

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

M	release/scripts/modules/rna_keymap_ui.py
M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/release/scripts/modules/rna_keymap_ui.py b/release/scripts/modules/rna_keymap_ui.py
index d39fa7ac7bd..57a00895568 100644
--- a/release/scripts/modules/rna_keymap_ui.py
+++ b/release/scripts/modules/rna_keymap_ui.py
@@ -381,8 +381,8 @@ def draw_keymaps(context, layout):
 
     row = col.row()
 
-    row.operator("wm.keyconfig_import", text="Import", icon='IMPORT')
-    row.operator("wm.keyconfig_export", text="Export",  icon='EXPORT')
+    row.operator("wm.keyconfig_import", text="Import...", icon='IMPORT')
+    row.operator("wm.keyconfig_export", text="Export...",  icon='EXPORT')
 
     row.separator()
 
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 97c092853d5..74f6ec1fc85 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -32,19 +32,8 @@ class USERPREF_HT_header(Header):
 
     def draw(self, context):
         layout = self.layout
-
         layout.template_header()
 
-        userpref = context.user_preferences
-
-
-        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"
-
 
 class USERPREF_PT_navigation(Panel):
     bl_label = ""
@@ -738,9 +727,6 @@ class USERPREF_PT_theme(Panel):
         subrow.operator("wm.interface_theme_preset_add", text="", icon='ADD')
         subrow.operator("wm.interface_theme_preset_add", text="", icon='REMOVE').remove_active = True
 
-        # TODO theme_area should be deprecated
-        row.prop(theme, "theme_area", text="")
-
 
 class USERPREF_PT_theme_user_interface(PreferencePanel):
     bl_space_type = 'USER_PREFERENCES'
@@ -775,28 +761,28 @@ class PreferenceThemeWidgetColorPanel(Panel):
         widget_style = getattr(ui, self.wcol)
         layout = self.layout
 
-        col = layout.column()
-
-        row = col.row()
+        layout.use_property_split = True
 
-        row.column().prop(widget_style, "outline")
-        row.column().prop(widget_style, "item", slider=True)
-        row.column().prop(widget_style, "inner", slider=True)
-        row.column().prop(widget_style, "inner_sel", slider=True)
-        row.column().prop(widget_style, "text")
-        row.column().prop(widget_style, "text_sel")
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=False)
 
-        col.separator()
+        col = flow.column()
+        col.prop(widget_style, "outline")
+        col.prop(widget_style, "item", slider=True)
+        col.prop(widget_style, "inner", slider=True)
+        col.prop(widget_style, "inner_sel", slider=True)
 
-        row = col.row()
+        col = flow.column()
+        col.prop(widget_style, "text")
+        col.prop(widget_style, "text_sel")
+        col.prop(widget_style, "roundness")
 
-        row.prop(widget_style, "roundness")
-        row.prop(widget_style, "show_shaded")
+        col = flow.column()
+        col.prop(widget_style, "show_shaded")
 
-        rowsub = row.row(align=True)
-        rowsub.active = widget_style.show_shaded
-        rowsub.prop(widget_style, "shadetop")
-        rowsub.prop(widget_style, "shadedown")
+        colsub = col.column()
+        colsub.active = widget_style.show_shaded
+        colsub.prop(widget_style, "shadetop")
+        colsub.prop(widget_style, "shadedown")
 
     @classmethod
     def poll(cls, context):
@@ -814,30 +800,30 @@ class USERPREF_PT_theme_interface_state(PreferencePanel):
         ui = theme.user_interface
         ui_state = theme.user_interface.wcol_state
 
-        row = layout.row()
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=False)
+
+        col = flow.column(align=True)
+        col.prop(ui_state, "inner_anim")
+        col.prop(ui_state, "inner_anim_sel")
 
-        subsplit = row.split(factor=0.95)
+        col = flow.column(align=True)
+        col.prop(ui_state, "inner_driven")
+        col.prop(ui_state, "inner_driven_sel")
 
-        padding = subsplit.split(factor=0.15)
-        colsub = padding.column()
-        colsub = padding.column()
-        colsub.row().prop(ui_state, "inner_anim")
-        colsub.row().prop(ui_state, "inner_anim_sel")
-        colsub.row().prop(ui_state, "inner_driven")
-        colsub.row().prop(ui_state, "inner_driven_sel")
-        colsub.row().prop(ui_state, "blend")
+        col = flow.column(align=True)
+        col.prop(ui_state, "inner_key")
+        col.prop(ui_state, "inner_key_sel")
 
-        subsplit = row.split(factor=0.85)
+        col = flow.column(align=True)
+        col.prop(ui_state, "inner_overridden")
+        col.prop(ui_state, "inner_overridden_sel")
 
-        padding = subsplit.split(factor=0.15)
-        colsub = padding.column()
-        colsub = padding.column()
-        colsub.row().prop(ui_state, "inner_key")
-        colsub.row().prop(ui_state, "inner_key_sel")
-        colsub.row().prop(ui_state, "inner_overridden")
-        colsub.row().prop(ui_state, "inner_overridden_sel")
-        colsub.row().prop(ui_state, "inner_changed")
-        colsub.row().prop(ui_state, "inner_changed_sel")
+        col = flow.column(align=True)
+        col.prop(ui_state, "inner_changed")
+        col.prop(ui_state, "inner_changed_sel")
+
+        col = flow.column(align=True)
+        col.prop(ui_state, "blend")
 
 
 class USERPREF_PT_theme_interface_styles(PreferencePanel):
@@ -849,25 +835,14 @@ class USERPREF_PT_theme_interface_styles(PreferencePanel):
         theme = context.user_preferences.themes[0]
         ui = theme.user_interface
 
-        row = layout.row()
-
-        subsplit = row.split(factor=0.95)
-
-        padding = subsplit.split(factor=0.15)
-        colsub = padding.column()
-        colsub = padding.column()
-        colsub.row().prop(ui, "menu_shadow_fac")
-        colsub.row().prop(ui, "icon_alpha")
-        colsub.row().prop(ui, "icon_saturation")
-        colsub.row().prop(ui, "editor_outline")
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=False)
 
-        subsplit = row.split(factor=0.85)
-
-        padding = subsplit.split(factor=0.15)
-        colsub = padding.column()
-        colsub = padding.column()
-        colsub.row().prop(ui, "menu_shadow_width")
-        colsub.row().prop(ui, "widget_emboss")
+        flow.prop(ui, "menu_shadow_fac")
+        flow.prop(ui, "icon_alpha")
+        flow.prop(ui, "icon_saturation")
+        flow.prop(ui, "editor_outline")
+        flow.prop(ui, "menu_shadow_width")
+        flow.prop(ui, "widget_emboss")
 
 
 class USERPREF_PT_theme_interface_gizmos(PreferencePanel):
@@ -879,26 +854,20 @@ class USERPREF_PT_theme_interface_gizmos(PreferencePanel):
         theme = context.user_preferences.themes[0]
         ui = theme.user_interface
 
-        row = layout.row()
-
-        subsplit = row.split(factor=0.95)
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=True, align=False)
 
-        padding = subsplit.split(factor=0.15)
-        colsub = padding.column()
-        colsub = padding.column()
-        colsub.row().prop(ui, "axis_x")
-        colsub.row().prop(ui, "axis_y")
-        colsub.row().prop(ui, "axis_z")
+        col = flow.column(align=True)
+        col.prop(ui, "axis_x", text="Axis X")
+        col.prop(ui, "axis_y", text="Y")
+        col.prop(ui, "axis_z", text="Z")
 
-        subsplit = row.split(factor=0.85)
+        col = flow.column()
+        col.prop(ui, "gizmo_primary")
+        col.prop(ui, "gizmo_secondary")
 
-        padding = subsplit.split(factor=0.15)
-        colsub = padding.column()
-        colsub = padding.column()
-        colsub.row().prop(ui, "gizmo_primary")
-        colsub.row().prop(ui, "gizmo_secondary")
-        colsub.row().prop(ui, "gizmo_a")
-        colsub.row().prop(ui, "gizmo_b")
+        col = flow.column()
+        col.prop(ui, "gizmo_a")
+        col.prop(ui, "gizmo_b")
 
 
 class USERPREF_PT_theme_interface_icons(PreferencePanel):
@@ -910,25 +879,13 @@ class USERPREF_PT_theme_interface_icons(PreferencePanel):
         theme = context.user_preferences.themes[0]
         ui = theme.user_interface
 
-        row = layout.row()
-
-        subsplit = row.split(factor=0.95)
-
-        padding = subsplit.split(factor=0.15)
-        colsub = padding.column()
-        colsub = padding.column()
-        colsub.row().prop(ui, "icon_collection")
-        colsub.row().prop(ui, "icon_object")
-        colsub.row().prop(ui, "icon_object_data")
-
-        subsplit = row.split(factor=0.85)
-
-        padding = subsplit.split(factor=0.15)
-        colsub = padding.column()
-        colsub = padding.column()
-        colsub.row().prop(ui, "icon_modifier")
-        colsub.row().prop(ui, "icon_shading")
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=False)
 
+        flow.prop(ui, "icon_collection")
+        flow.prop(ui, "icon_object")
+        flow.prop(ui, "icon_object_data")
+        flow.prop(ui, "icon_modifier")
+        flow.prop(ui, "icon_shading")
 
 class USERPREF_PT_theme_text_style(PreferencePanel):
     bl_label = "Text Style"
@@ -941,25 +898,22 @@ class USERPREF_PT_theme_text_style(PreferencePanel):
 
     @staticmethod
     def _ui_font_style(layout, font_style):
-        split = layout.split()
+        layout.use_property_split = True
+        flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=True)
 
-        col = split.column()
-        col.label(text="Kerning Style:")
+        col = flow.column()
         col.row().prop(font_style, "font_kerning_style", expand=True)
         col.prop(font_style, "points")
 
-        col = split.column()
-        col.label(text="Shadow Offset:")
-        col.prop(font_style, "shadow_offset_x", text="X")
+        col = flow.column(align=True)
+        col.prop

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list