Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_userpref.py
| Show First 20 Lines • Show All 1,415 Lines • ▼ Show 20 Lines | def draw_centered(self, context, layout): | ||||
| if sys.platform[:3] == "win": | if sys.platform[:3] == "win": | ||||
| layout.prop(inputs, "tablet_api") | layout.prop(inputs, "tablet_api") | ||||
| layout.separator() | layout.separator() | ||||
| col = layout.column() | col = layout.column() | ||||
| col.prop(inputs, "pressure_threshold_max") | col.prop(inputs, "pressure_threshold_max") | ||||
| col.prop(inputs, "pressure_softness") | col.prop(inputs, "pressure_softness") | ||||
campbellbarton: Don't think an extra class is needed just to share a function, it could be a static method in… | |||||
| class USERPREF_PT_input_ndof(InputPanel, CenterAlignMixIn, Panel): | class NDOF_settings_panel(): | ||||
| @staticmethod | |||||
| def draw_settings(layout, props, draw_3dview_settings=True): | |||||
campbellbartonUnsubmitted Done Inline ActionsWe normally use draw_ for layout functions, prefer show_3dview_settings. campbellbarton: We normally use `draw_` for layout functions, prefer `show_3dview_settings`. | |||||
| col = layout.column() | |||||
| col.prop(props, "ndof_sensitivity", text="Pan Sensitivity") | |||||
| col.prop(props, "ndof_orbit_sensitivity") | |||||
| col.prop(props, "ndof_deadzone") | |||||
| layout.separator() | |||||
| if draw_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() | |||||
| col = layout.column() | |||||
| if draw_3dview_settings: | |||||
| col.prop(props, "ndof_show_guide") | |||||
| col.prop(props, "ndof_zoom_invert") | |||||
| row = col.row(heading="Pan") | |||||
| row.prop(props, "ndof_pan_yz_swap_axis", text="Swap Y and Z Axes") | |||||
| layout.separator() | |||||
| row = layout.row(heading=("Invert Axis Pan" if draw_3dview_settings else "Invert Pan Axis")) | |||||
| for text, attr in ( | |||||
| ("X", "ndof_panx_invert_axis"), | |||||
| ("Y", "ndof_pany_invert_axis"), | |||||
| ("Z", "ndof_panz_invert_axis"), | |||||
| ): | |||||
| row.prop(props, attr, text=text, toggle=True) | |||||
| if draw_3dview_settings: | |||||
| row = layout.row(heading="Orbit") | |||||
| 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.separator() | |||||
| col = layout.column(heading="Fly/Walk") | |||||
| col.prop(props, "ndof_lock_horizon") | |||||
| col.prop(props, "ndof_fly_helicopter") | |||||
| class USERPREF_PT_input_ndof(InputPanel, CenterAlignMixIn, NDOF_settings_panel, Panel): | |||||
| bl_label = "NDOF" | bl_label = "NDOF" | ||||
| bl_options = {'DEFAULT_CLOSED'} | bl_options = {'DEFAULT_CLOSED'} | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| prefs = context.preferences | prefs = context.preferences | ||||
| inputs = prefs.inputs | inputs = prefs.inputs | ||||
| return inputs.use_ndof | return inputs.use_ndof | ||||
| def draw_centered(self, context, layout): | def draw_centered(self, context, layout): | ||||
| prefs = context.preferences | prefs = context.preferences | ||||
| inputs = prefs.inputs | inputs = prefs.inputs | ||||
| flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False) | self.draw_settings(layout, inputs) | ||||
| 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) | |||||
| # ----------------------------------------------------------------------------- | # ----------------------------------------------------------------------------- | ||||
| # Navigation Panels | # Navigation Panels | ||||
| class NavigationPanel: | class NavigationPanel: | ||||
| bl_space_type = 'PREFERENCES' | bl_space_type = 'PREFERENCES' | ||||
| bl_region_type = 'WINDOW' | bl_region_type = 'WINDOW' | ||||
| ▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | def draw_centered(self, context, layout): | ||||
| layout.active = walk.use_gravity | layout.active = walk.use_gravity | ||||
| col = layout.column() | col = layout.column() | ||||
| col.prop(walk, "view_height") | col.prop(walk, "view_height") | ||||
| col.prop(walk, "jump_height") | col.prop(walk, "jump_height") | ||||
| # Special case, this is only exposed as a popover. | # Special case, this is only exposed as a popover. | ||||
| class USERPREF_PT_ndof_settings(Panel): | class USERPREF_PT_ndof_settings(Panel, NDOF_settings_panel): | ||||
| bl_label = "3D Mouse Settings" | bl_label = "3D Mouse Settings" | ||||
| bl_space_type = 'TOPBAR' # dummy. | bl_space_type = 'TOPBAR' # dummy. | ||||
| bl_region_type = 'HEADER' | bl_region_type = 'HEADER' | ||||
| bl_ui_units_x = 12 | |||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| layout.use_property_split = True | layout.use_property_split = True | ||||
| layout.use_property_decorate = False # No animation. | layout.use_property_decorate = False # No animation. | ||||
| input_prefs = context.preferences.inputs | input_prefs = context.preferences.inputs | ||||
| is_view3d = context.space_data.type == 'VIEW_3D' | is_view3d = context.space_data.type == 'VIEW_3D' | ||||
| self.draw_settings(layout, input_prefs, is_view3d) | |||||
| 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") | |||||
| # ----------------------------------------------------------------------------- | # ----------------------------------------------------------------------------- | ||||
| # Key-Map Editor Panels | # Key-Map Editor Panels | ||||
| class KeymapPanel: | class KeymapPanel: | ||||
| bl_space_type = 'PREFERENCES' | bl_space_type = 'PREFERENCES' | ||||
| bl_region_type = 'WINDOW' | bl_region_type = 'WINDOW' | ||||
| bl_context = "keymap" | bl_context = "keymap" | ||||
| ▲ Show 20 Lines • Show All 603 Lines • Show Last 20 Lines | |||||
Don't think an extra class is needed just to share a function, it could be a static method in the USERPREF_PT_ndof_settings class.