[Bf-blender-cvs] [f98e2c0427c] master: Cleanup: add sections to preferences UI script

Campbell Barton noreply at git.blender.org
Thu Dec 19 03:31:09 CET 2019


Commit: f98e2c0427c1dc5e2f1cac58cfb43b464013a33b
Author: Campbell Barton
Date:   Thu Dec 19 13:20:37 2019 +1100
Branches: master
https://developer.blender.org/rBf98e2c0427c1dc5e2f1cac58cfb43b464013a33b

Cleanup: add sections to preferences UI script

Makes navigating between sections easier, order some classes
which were in the wrong section.

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

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

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

diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index b670376c453..fec76b045a4 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -27,6 +27,9 @@ from bpy.app.translations import pgettext_iface as iface_
 from bpy.app.translations import contexts as i18n_contexts
 
 
+# -----------------------------------------------------------------------------
+# Main Header
+
 class USERPREF_HT_header(Header):
     bl_space_type = 'PREFERENCES'
 
@@ -60,6 +63,9 @@ class USERPREF_HT_header(Header):
         self.draw_buttons(layout, context)
 
 
+# -----------------------------------------------------------------------------
+# Main Navigation Bar
+
 class USERPREF_PT_navigation_bar(Panel):
     bl_label = "Preferences Navigation"
     bl_space_type = 'PREFERENCES'
@@ -128,6 +134,9 @@ class USERPREF_PT_save_preferences(Panel):
         USERPREF_HT_header.draw_buttons(layout, context)
 
 
+# -----------------------------------------------------------------------------
+# Min-In Helpers
+
 # Panel mix-in.
 class PreferencePanel:
     """
@@ -160,6 +169,9 @@ class PreferencePanel:
             row.label()  # Needed so col above is centered.
 
 
+# -----------------------------------------------------------------------------
+# Interface Panels
+
 class USERPREF_PT_interface_display(PreferencePanel, Panel):
     bl_label = "Display"
 
@@ -340,6 +352,9 @@ class USERPREF_PT_interface_menus_pie(PreferencePanel, Panel):
         flow.prop(view, "pie_menu_confirm")
 
 
+# -----------------------------------------------------------------------------
+# Editing Panels
+
 class USERPREF_PT_edit_objects(Panel):
     bl_label = "Objects"
     bl_space_type = 'PREFERENCES'
@@ -492,6 +507,9 @@ class USERPREF_PT_edit_misc(PreferencePanel, Panel):
         flow.prop(edit, "node_margin", text="Node Auto-offset Margin")
 
 
+# -----------------------------------------------------------------------------
+# Animation Panels
+
 class USERPREF_PT_animation_timeline(PreferencePanel, Panel):
     bl_label = "Timeline"
 
@@ -575,6 +593,9 @@ class USERPREF_PT_animation_fcurves(PreferencePanel, Panel):
         flow.prop(edit, "use_insertkey_xyz_to_rgb", text="XYZ to RGB")
 
 
+# -----------------------------------------------------------------------------
+# System Panels
+
 class USERPREF_PT_system_sound(PreferencePanel, Panel):
     bl_label = "Sound"
 
@@ -624,6 +645,50 @@ class USERPREF_PT_system_cycles_devices(PreferencePanel, Panel):
         #     col.row().prop(system, "opensubdiv_compute_type", text="")
 
 
+class USERPREF_PT_system_memory(PreferencePanel, Panel):
+    bl_label = "Memory & Limits"
+
+    @classmethod
+    def poll(cls, context):
+        prefs = context.preferences
+        return (prefs.active_section == 'SYSTEM')
+
+    def draw_props(self, context, layout):
+        prefs = context.preferences
+        system = prefs.system
+        edit = prefs.edit
+
+        flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
+
+        flow.prop(edit, "undo_steps", text="Undo Steps")
+        flow.prop(edit, "undo_memory_limit", text="Undo Memory Limit")
+        flow.prop(edit, "use_global_undo")
+
+        layout.separator()
+
+        flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
+
+        flow.prop(system, "memory_cache_limit", text="Sequencer Cache Limit")
+        flow.prop(system, "scrollback", text="Console Scrollback Lines")
+
+        layout.separator()
+
+        flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
+
+        flow.prop(system, "texture_time_out", text="Texture Time Out")
+        flow.prop(system, "texture_collection_rate", text="Garbage Collection Rate")
+
+        layout.separator()
+
+        flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
+
+        flow.prop(system, "vbo_time_out", text="Vbo Time Out")
+        flow.prop(system, "vbo_collection_rate", text="Garbage Collection Rate")
+
+
+# -----------------------------------------------------------------------------
+# Viewport Panels
+
 class USERPREF_PT_viewport_display(PreferencePanel, Panel):
     bl_label = "Display"
 
@@ -718,46 +783,8 @@ class USERPREF_PT_viewport_selection(PreferencePanel, Panel):
         flow.prop(system, "use_select_pick_depth")
 
 
-class USERPREF_PT_system_memory(PreferencePanel, Panel):
-    bl_label = "Memory & Limits"
-
-    @classmethod
-    def poll(cls, context):
-        prefs = context.preferences
-        return (prefs.active_section == 'SYSTEM')
-
-    def draw_props(self, context, layout):
-        prefs = context.preferences
-        system = prefs.system
-        edit = prefs.edit
-
-        flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
-
-        flow.prop(edit, "undo_steps", text="Undo Steps")
-        flow.prop(edit, "undo_memory_limit", text="Undo Memory Limit")
-        flow.prop(edit, "use_global_undo")
-
-        layout.separator()
-
-        flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
-
-        flow.prop(system, "memory_cache_limit", text="Sequencer Cache Limit")
-        flow.prop(system, "scrollback", text="Console Scrollback Lines")
-
-        layout.separator()
-
-        flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
-
-        flow.prop(system, "texture_time_out", text="Texture Time Out")
-        flow.prop(system, "texture_collection_rate", text="Garbage Collection Rate")
-
-        layout.separator()
-
-        flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
-
-        flow.prop(system, "vbo_time_out", text="Vbo Time Out")
-        flow.prop(system, "vbo_collection_rate", text="Garbage Collection Rate")
-
+# -----------------------------------------------------------------------------
+# Theme Panels
 
 class USERPREF_MT_interface_theme_presets(Menu):
     bl_label = "Presets"
@@ -1247,6 +1274,9 @@ class ThemeGenericClassGenerator():
                 theme_area, theme_area.identifier.lower())
 
 
+# -----------------------------------------------------------------------------
+# File Paths Panels
+
 # Panel mix-in.
 class FilePathsPanel:
     bl_space_type = 'PREFERENCES'
@@ -1348,6 +1378,9 @@ class USERPREF_PT_saveload_autorun(PreferencePanel, Panel):
             row.operator("wm.userpref_autoexec_path_remove", text="", icon='X', emboss=False).index = i
 
 
+# -----------------------------------------------------------------------------
+# Save/Load Panels
+
 class USERPREF_PT_saveload_blend(PreferencePanel, Panel):
     bl_label = "Blend Files"
 
@@ -1414,75 +1447,8 @@ class USERPREF_PT_saveload_file_browser(PreferencePanel, Panel):
         flow.prop(paths, "hide_system_bookmarks")
 
 
-class USERPREF_PT_ndof_settings(Panel):
-    bl_label = "3D Mouse Settings"
-    bl_space_type = 'TOPBAR'  # dummy.
-    bl_region_type = 'HEADER'
-
-    def draw(self, context):
-        layout = self.layout
-        layout.use_property_split = True
-        layout.use_property_decorate = False  # No animation.
-
-        input_prefs = context.preferences.inputs
-
-        is_view3d = context.space_data.type == 'VIEW_3D'
-
-        col = layout.column(align=True)
-        col.prop(input_prefs, "ndof_sensitivity")
-        col.prop(input_prefs, "ndof_orbit_sensitivity")
-        col.prop(input_prefs, "ndof_deadzone")
-
-        if is_view3d:
-            layout.separator()
-            layout.prop(input_prefs, "ndof_show_guide")
-
-            layout.separator()
-            layout.label(text="Orbit Style")
-            layout.row().prop(input_prefs, "ndof_view_navigate_method", text="Navigate")
-            layout.row().prop(input_prefs, "ndof_view_rotate_method", text="Orbit")
-            layout.separator()
-
-            layout.label(text="Orbit Options")
-            split = layout.split(factor=0.6)
-            row = split.row()
-            row.alignment = 'RIGHT'
-            row.label(text="Invert Axis")
-            row = split.row(align=True)
-            for text, attr in (
-                    ("X", "ndof_rotx_invert_axis"),
-                    ("Y", "ndof_roty_invert_axis"),
-                    ("Z", "ndof_rotz_invert_axis"),
-            ):
-                row.prop(input_prefs, attr, text=text, toggle=True)
-
-        # view2d use pan/zoom
-        layout.separator()
-        layout.label(text="Pan Options")
-
-        split = layout.split(factor=0.6)
-        row = split.row()
-        row.alignment = 'RIGHT'
-        row.label(text="Invert Axis")
-        row = split.row(align=True)
-        for text, attr in (
-                ("X", "ndof_panx_invert_axis"),
-                ("Y", "ndof_pany_invert_axis"),
-                ("Z", "ndof_panz_invert_axis"),
-        ):
-            row.prop(input_prefs, attr, text=text, toggle=True)
-
-        layout.prop(input_prefs, "ndof_pan_yz_swap_axis")
-
-        layout.label(text="Zoom Options")
-        layout.prop(input_prefs, "ndof_zoom_invert")
-
-        if is_view3d:
-            layout.separator()
-            layout.label(text="Fly/Walk Options")
-            layout.prop(input_prefs, "ndof_fly_helicopter")
-            layout.prop(input_prefs, "ndof_lock_horizon")
-
+# -----------------------------------------------------------------------------
+# Input Panels
 
 class USERPREF_PT_input_keyboard(PreferencePanel, Panel):
     bl_label = "Keyboard"
@@ -1529,6 +1495,58 @@ class USERPREF_PT_input_mouse(PreferencePanel, Panel):
         flow.prop(inputs, "move_threshold")
 
 
+class USERPREF_PT_input_tablet(PreferencePanel, Panel):
+    bl_label = "Tablet"
+
+    @classmethod
+    def poll(cls, context):
+        prefs = context.preferences
+        return prefs.active_section == 'INPUT'
+
+    def draw_props(self, context, layout):
+        prefs = context.preferences
+        inputs = prefs.inputs
+
+        import sys
+        if sy

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list