[Bf-blender-cvs] [53f27cdc205] master: UI: use popover for NDOF menu

Campbell Barton noreply at git.blender.org
Fri Nov 29 09:14:08 CET 2019


Commit: 53f27cdc205327739e81e0980c5beb356c5dd793
Author: Campbell Barton
Date:   Fri Nov 29 19:12:50 2019 +1100
Branches: master
https://developer.blender.org/rB53f27cdc205327739e81e0980c5beb356c5dd793

UI: use popover for NDOF menu

Number sliders were being used in a menu which doesn't work very well.

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

M	release/scripts/presets/keyconfig/keymap_data/blender_default.py
M	release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
M	release/scripts/startup/bl_ui/space_userpref.py

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

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 3a7a142e310..06fac16292d 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -392,7 +392,7 @@ def km_window(params):
         ),
 
         # NDOF settings
-        op_menu("USERPREF_MT_ndof_settings", {"type": 'NDOF_BUTTON_MENU', "value": 'PRESS'}),
+        op_panel("USERPREF_PT_ndof_settings", {"type": 'NDOF_BUTTON_MENU', "value": 'PRESS'}),
         ("wm.context_scale_float", {"type": 'NDOF_BUTTON_PLUS', "value": 'PRESS'},
          {"properties": [("data_path", 'preferences.inputs.ndof_sensitivity'), ("value", 1.1)]}),
         ("wm.context_scale_float", {"type": 'NDOF_BUTTON_MINUS', "value": 'PRESS'},
diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index dc62b6bba68..6bf9a60a3d7 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -196,7 +196,7 @@ def km_window(params):
         op_menu("SCREEN_MT_user_menu", {"type": 'TAB', "value": 'PRESS', "shift": True}),
 
         # NDOF settings
-        op_menu("USERPREF_MT_ndof_settings", {"type": 'NDOF_BUTTON_MENU', "value": 'PRESS'}),
+        op_panel("USERPREF_PT_ndof_settings", {"type": 'NDOF_BUTTON_MENU', "value": 'PRESS'}),
         ("wm.context_scale_float", {"type": 'NDOF_BUTTON_PLUS', "value": 'PRESS'},
          {"properties": [("data_path", 'preferences.inputs.ndof_sensitivity'), ("value", 1.1)]}),
         ("wm.context_scale_float", {"type": 'NDOF_BUTTON_MINUS', "value": 'PRESS'},
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 7c6a7ecbcee..ab4d54f039e 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -1409,20 +1409,24 @@ class USERPREF_PT_saveload_file_browser(PreferencePanel, Panel):
         flow.prop(paths, "hide_system_bookmarks")
 
 
-class USERPREF_MT_ndof_settings(Menu):
-    # accessed from the window key-bindings in C (only)
+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'
 
-        layout.prop(input_prefs, "ndof_sensitivity")
-        layout.prop(input_prefs, "ndof_orbit_sensitivity")
-        layout.prop(input_prefs, "ndof_deadzone")
+        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()
@@ -1430,8 +1434,8 @@ class USERPREF_MT_ndof_settings(Menu):
 
             layout.separator()
             layout.label(text="Orbit Style")
-            layout.row().prop(input_prefs, "ndof_view_navigate_method", text="")
-            layout.row().prop(input_prefs, "ndof_view_rotate_method", text="")
+            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")
             layout.prop(input_prefs, "ndof_rotx_invert_axis")
@@ -2255,7 +2259,6 @@ classes = (
     USERPREF_PT_saveload_autorun,
     USERPREF_PT_saveload_file_browser,
 
-    USERPREF_MT_ndof_settings,
     USERPREF_MT_keyconfigs,
 
     USERPREF_PT_input_keyboard,
@@ -2278,6 +2281,9 @@ classes = (
 
     USERPREF_PT_experimental_all,
 
+    # Popovers.
+    USERPREF_PT_ndof_settings,
+
     # Add dynamically generated editor theme panels last,
     # so they show up last in the theme section.
     *ThemeGenericClassGenerator.generate_panel_classes_from_theme_areas(),



More information about the Bf-blender-cvs mailing list