diff options
author | Hans Goudey <h.goudey@me.com> | 2020-05-25 17:53:17 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-05-25 17:53:17 +0300 |
commit | ce0db0d329985e44930e32322012e5f2d6bca3b8 (patch) | |
tree | cbd099387c02bebb0148eaed9e09b30a9abc8318 /release/scripts | |
parent | 219ce574b56585eb5db056983a8acf08f7ff9991 (diff) |
UI: Fix T76918: 3D Mouse Inconsistent / Inaccessible UI
This consolidates the UI code for NDOF input settings, making all
settings accessible from the preferences. This works around an issue
where the Space Navigator's "Menu" button doesn't trigger the settings
menu in Blender.
I also took the opportunity to redo the UI layout.
Note: Separate commit for 2.83 because UI layouts features
have diverged.
Differential Revision: https://developer.blender.org/D7806
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref.py | 108 |
1 files changed, 51 insertions, 57 deletions
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 89f4bfd4c83..8686c6a2327 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -1455,16 +1455,7 @@ class USERPREF_PT_input_ndof(InputPanel, CenterAlignMixIn, Panel): prefs = context.preferences inputs = prefs.inputs - flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False) - - flow.prop(inputs, "ndof_sensitivity", text="Pan Sensitivity") - flow.prop(inputs, "ndof_orbit_sensitivity", text="Orbit Sensitivity") - flow.prop(inputs, "ndof_deadzone", text="Deadzone") - - layout.separator() - - flow.row().prop(inputs, "ndof_view_navigate_method", expand=True) - flow.row().prop(inputs, "ndof_view_rotate_method", expand=True) + USERPREF_PT_ndof_settings.draw_settings(layout, inputs) # ----------------------------------------------------------------------------- @@ -1598,71 +1589,74 @@ class USERPREF_PT_ndof_settings(Panel): bl_label = "3D Mouse Settings" bl_space_type = 'TOPBAR' # dummy. bl_region_type = 'HEADER' + bl_ui_units_x = 10 - 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' + @staticmethod + def draw_settings(layout, props, show_3dview_settings=True): + col = layout.column() + col.prop(props, "ndof_sensitivity", text="Pan Sensitivity") + col.prop(props, "ndof_orbit_sensitivity") + col.prop(props, "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") + layout.separator() - if is_view3d: - layout.separator() - layout.prop(input_prefs, "ndof_show_guide") + if show_3dview_settings: + col = layout.column() + col.row().prop(props, "ndof_view_navigate_method", expand=True, text="Navigation") + col.row().prop(props, "ndof_view_rotate_method", expand=True, text="Rotation") 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) + col = layout.column() + if show_3dview_settings: + col.prop(props, "ndof_show_guide") + col.prop(props, "ndof_zoom_invert") + col.prop(props, "ndof_pan_yz_swap_axis", text="Swap Y and Z Pan Axes") - # 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) + split = layout.split() + col = split.column() + col.alignment = 'RIGHT' + col.label(text="Invert Axis Pan" if show_3dview_settings else "Invert Pan Axis") + col = split.column() + row = col.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) + row.prop(props, attr, text=text, toggle=True) + + if show_3dview_settings: + split = layout.split() + col = split.column() + col.alignment = 'RIGHT' + col.label(text="Invert Axis Orbit") + col = split.column() + row = col.row(align=True) + for text, attr in ( + ("X", "ndof_rotx_invert_axis"), + ("Y", "ndof_roty_invert_axis"), + ("Z", "ndof_rotz_invert_axis"), + ): + row.prop(props, attr, text=text, toggle=True) - layout.prop(input_prefs, "ndof_pan_yz_swap_axis") + layout.separator() - layout.label(text="Zoom Options") - layout.prop(input_prefs, "ndof_zoom_invert") + col = layout.column() + col.prop(props, "ndof_lock_horizon", text="Fly/Walk Lock Horizon") + col.prop(props, "ndof_fly_helicopter") - 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") + 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' + self.draw_settings(layout, input_prefs, is_view3d) # ----------------------------------------------------------------------------- # Key-Map Editor Panels |