UI: use popover for NDOF menu
authorCampbell Barton <ideasman42@gmail.com>
Fri, 29 Nov 2019 08:12:50 +0000 (19:12 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 29 Nov 2019 08:12:50 +0000 (19:12 +1100)
Number sliders were being used in a menu which doesn't work very well.

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

index 3a7a142e310edc225cdeee4ad19a73cde6c7e00a..06fac16292d234178c7dc21cda8224a60b5234cf 100644 (file)
@@ -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'},
index dc62b6bba686f7afffa98b6f9a54acc39ec1e03a..6bf9a60a3d75317fda09914682bd8507a9942f60 100644 (file)
@@ -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'},
index 7c6a7ecbcee4430feef0d1e85875ad868c5f2c68..ab4d54f039e38acae23765b08ddef869c929724f 100644 (file)
@@ -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(),