UI: Minor layout and style adjustments in Preferences

Small style and layout tweaks of some tabs in Preferences.
Mainly inline styling for compact layouts, grouping labels and
adding icons where needed.

Purposely leaving aside complex areas such as Themes,
Add-ons, or Keymap. They require larger design decisions.

Pull Request: https://projects.blender.org/blender/blender/pulls/112393
This commit is contained in:
Pablo Vazquez
2023-09-22 01:07:56 +02:00
committed by Pablo Vazquez
parent ef5e57bbff
commit d0aa521ea8

View File

@@ -385,8 +385,9 @@ class USERPREF_PT_edit_objects_new(EditingPanel, CenterAlignMixIn, Panel):
class USERPREF_PT_edit_objects_duplicate_data(EditingPanel, CenterAlignMixIn, Panel):
bl_label = "Duplicate Data"
bl_label = "Copy on Duplicate"
bl_parent_id = "USERPREF_PT_edit_objects"
bl_options = {'DEFAULT_CLOSED'}
def draw_centered(self, context, layout):
prefs = context.preferences
@@ -396,33 +397,49 @@ class USERPREF_PT_edit_objects_duplicate_data(EditingPanel, CenterAlignMixIn, Pa
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True)
col = flow.column()
col.prop(edit, "use_duplicate_action", text="Action")
col.prop(edit, "use_duplicate_armature", text="Armature")
col.prop(edit, "use_duplicate_camera", text="Camera")
col.prop(edit, "use_duplicate_curve", text="Curve")
# col.prop(edit, "use_duplicate_fcurve", text="F-Curve") # Not implemented.
col.prop(edit, "use_duplicate_curves", text="Curves")
col.prop(edit, "use_duplicate_grease_pencil", text="Grease Pencil")
col.prop(edit, "use_duplicate_lattice", text="Lattice")
datablock_types = (
("use_duplicate_action", "Action", 'ACTION', ''),
("use_duplicate_armature", "Armature", 'OUTLINER_DATA_ARMATURE', ''),
("use_duplicate_camera", "Camera", 'OUTLINER_DATA_CAMERA', ''),
("use_duplicate_curve", "Curve", 'OUTLINER_DATA_CURVE', ''),
("use_duplicate_curves", "Curves", 'OUTLINER_DATA_CURVES', ''),
("use_duplicate_grease_pencil", "Grease Pencil", 'OUTLINER_OB_GREASEPENCIL', ''),
("use_duplicate_lattice", "Lattice", 'OUTLINER_DATA_LATTICE', ''),
(None, None, None, None),
("use_duplicate_light", "Light", 'OUTLINER_DATA_LIGHT', ''),
("use_duplicate_lightprobe", "Light Probe", 'OUTLINER_DATA_LIGHTPROBE', ''),
("use_duplicate_material", "Material", 'MATERIAL_DATA', ''),
("use_duplicate_mesh", "Mesh", 'OUTLINER_DATA_MESH', ''),
("use_duplicate_metaball", "Metaball", 'OUTLINER_DATA_META', ''),
("use_duplicate_node_tree", "Node Tree", 'NODETREE', ''),
("use_duplicate_particle", "Particle", 'PARTICLES', ''),
(None, None, None, None),
("use_duplicate_pointcloud", "Point Cloud", 'OUTLINER_DATA_POINTCLOUD', ''),
("use_duplicate_speaker", "Speaker", 'OUTLINER_DATA_SPEAKER', ''),
("use_duplicate_surface", "Surface", 'OUTLINER_DATA_SURFACE', ''),
("use_duplicate_text", "Text", 'OUTLINER_DATA_FONT', ''),
("use_duplicate_volume", "Volume", 'OUTLINER_DATA_VOLUME', 'i18n_contexts.id_id'),
)
col = flow.column()
col.prop(edit, "use_duplicate_light", text="Light")
col.prop(edit, "use_duplicate_lightprobe", text="Light Probe")
col.prop(edit, "use_duplicate_material", text="Material")
col.prop(edit, "use_duplicate_mesh", text="Mesh")
col.prop(edit, "use_duplicate_metaball", text="Metaball")
col.prop(edit, "use_duplicate_node_tree", text="Node Tree")
col.prop(edit, "use_duplicate_particle", text="Particle")
col = flow.column()
if hasattr(edit, "use_duplicate_pointcloud"):
col.prop(edit, "use_duplicate_pointcloud", text="Point Cloud")
col.prop(edit, "use_duplicate_speaker", text="Speaker")
col.prop(edit, "use_duplicate_surface", text="Surface")
col.prop(edit, "use_duplicate_text", text="Text")
# col.prop(edit, "use_duplicate_texture", text="Texture") # Not implemented.
col.prop(edit, "use_duplicate_volume", text="Volume", text_ctxt=i18n_contexts.id_id)
for prop, type_name, type_icon, type_ctx in datablock_types:
if prop is None:
col = flow.column()
continue
row = col.row()
row_checkbox = row.row()
if (hasattr(edit, prop)):
row_checkbox.prop(edit, prop, text="")
elif type_ctx:
row_checkbox.prop(edit, prop, text="", text_ctxt=type_ctx)
row_label = row.row()
row_label.label(text=type_name, icon=type_icon)
row_label.active = getattr(edit, prop)
class USERPREF_PT_edit_cursor(EditingPanel, CenterAlignMixIn, Panel):
@@ -432,9 +449,9 @@ class USERPREF_PT_edit_cursor(EditingPanel, CenterAlignMixIn, Panel):
prefs = context.preferences
edit = prefs.edit
col = layout.column()
col.prop(edit, "use_mouse_depth_cursor")
col.prop(edit, "use_cursor_lock_adjust")
col = layout.column(heading="Cursor")
col.prop(edit, "use_mouse_depth_cursor", text="Surface Project")
col.prop(edit, "use_cursor_lock_adjust", text="Lock Adjust")
class USERPREF_PT_edit_gpencil(EditingPanel, CenterAlignMixIn, Panel):
@@ -472,7 +489,7 @@ class USERPREF_PT_edit_weight_paint(EditingPanel, CenterAlignMixIn, Panel):
layout.use_property_split = False
layout.prop(view, "use_weight_color_range", text="Use Custom Colors")
layout.prop(view, "use_weight_color_range", text="Custom Gradient")
col = layout.column()
col.active = view.use_weight_color_range
@@ -498,10 +515,14 @@ class USERPREF_PT_edit_node_editor(EditingPanel, CenterAlignMixIn, Panel):
prefs = context.preferences
edit = prefs.edit
col = layout.column()
col.prop(edit, "node_use_insert_offset", text="Auto-Offset")
col.prop(edit, "node_margin", text="Auto-Offset Margin")
col.prop(edit, "node_preview_resolution", text="Preview Resolution")
col = layout.column(heading="Auto-Offset")
row = col.row()
row.prop(edit, "node_use_insert_offset", text="")
subrow = row.row()
subrow.prop(edit, "node_margin", text="")
subrow.active = edit.node_use_insert_offset
layout.prop(edit, "node_preview_resolution", text="Preview Resolution")
class USERPREF_PT_edit_misc(EditingPanel, CenterAlignMixIn, Panel):
@@ -720,10 +741,13 @@ class USERPREF_PT_viewport_display(ViewportPanel, CenterAlignMixIn, Panel):
col = layout.column(heading="Text Info Overlay")
col.prop(view, "show_object_info", text="Object Info")
col.prop(view, "show_view_name", text="View Name")
col.prop(view, "show_playback_fps", text="Playback Frame Rate (FPS)")
col = layout.column(heading="Playback Frame Rate (FPS)")
row = col.row()
row.active = view.show_playback_fps
row.prop(view, "playback_fps_samples", text="Frame Rate Samples")
row.prop(view, "show_playback_fps", text="")
subrow = row.row()
subrow.active = view.show_playback_fps
subrow.prop(view, "playback_fps_samples", text="Samples")
layout.separator()
@@ -1395,6 +1419,7 @@ class USERPREF_PT_file_paths_script_directories(FilePathsPanel, Panel):
class USERPREF_PT_file_paths_render(FilePathsPanel, Panel):
bl_label = "Render"
bl_parent_id = "USERPREF_PT_file_paths_data"
def draw(self, context):
layout = self.layout
@@ -1417,6 +1442,7 @@ class USERPREF_PT_text_editor_presets(PresetPanel, Panel):
class USERPREF_PT_file_paths_applications(FilePathsPanel, Panel):
bl_label = "Applications"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
@@ -1453,6 +1479,7 @@ class USERPREF_PT_text_editor(FilePathsPanel, Panel):
class USERPREF_PT_file_paths_development(FilePathsPanel, Panel):
bl_label = "Development"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
@@ -1624,7 +1651,27 @@ class USERPREF_PT_saveload_blend(SaveLoadPanel, CenterAlignMixIn, Panel):
col = layout.column(heading="Save")
col.prop(view, "use_save_prompt")
col.prop(paths, "file_preview_type")
col = layout.column()
col.prop(paths, "save_version")
col.prop(paths, "recent_files")
layout.separator()
col = layout.column(heading="Auto-Save")
row = col.row()
row.prop(paths, "use_auto_save_temporary_files", text="")
subrow = row.row()
subrow.active = paths.use_auto_save_temporary_files
subrow.prop(paths, "auto_save_time", text="Timer (Minutes)")
layout.separator()
layout.prop(paths, "file_preview_type")
layout.separator()
layout.separator()
col = layout.column(heading="Default To")
col.prop(paths, "use_relative_paths")
@@ -1634,29 +1681,6 @@ class USERPREF_PT_saveload_blend(SaveLoadPanel, CenterAlignMixIn, Panel):
col = layout.column(heading="Text Files")
col.prop(paths, "use_tabs_as_spaces")
col = layout.column()
col.prop(paths, "save_version")
col.prop(paths, "recent_files")
class USERPREF_PT_saveload_blend_autosave(SaveLoadPanel, CenterAlignMixIn, Panel):
bl_label = "Auto Save"
bl_parent_id = "USERPREF_PT_saveload_blend"
def draw_header(self, context):
prefs = context.preferences
paths = prefs.filepaths
self.layout.prop(paths, "use_auto_save_temporary_files", text="")
def draw_centered(self, context, layout):
prefs = context.preferences
paths = prefs.filepaths
col = layout.column()
col.active = paths.use_auto_save_temporary_files
col.prop(paths, "auto_save_time", text="Timer (Minutes)")
class USERPREF_PT_saveload_file_browser(SaveLoadPanel, CenterAlignMixIn, Panel):
bl_label = "File Browser"
@@ -1704,11 +1728,16 @@ class USERPREF_PT_input_mouse(InputPanel, CenterAlignMixIn, Panel):
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
flow.prop(inputs, "use_mouse_emulate_3_button")
if sys.platform[:3] != "win":
rowsub = flow.row()
rowsub.active = inputs.use_mouse_emulate_3_button
rowsub.prop(inputs, "mouse_emulate_3_button_modifier")
if sys.platform[:3] == "win":
flow.prop(inputs, "use_mouse_emulate_3_button")
else:
col = flow.column(heading="Emulate 3 Button Mouse")
row = col.row()
row.prop(inputs, "use_mouse_emulate_3_button", text="")
subrow = row.row()
subrow.prop(inputs, "mouse_emulate_3_button_modifier", text="")
subrow.active = inputs.use_mouse_emulate_3_button
flow.prop(inputs, "use_mouse_continuous")
flow.prop(inputs, "use_drag_immediately")
flow.prop(inputs, "mouse_double_click_time", text="Double Click Speed")
@@ -2636,17 +2665,16 @@ classes = (
USERPREF_PT_theme_strip_colors,
USERPREF_PT_file_paths_data,
USERPREF_PT_file_paths_script_directories,
USERPREF_PT_file_paths_render,
USERPREF_PT_file_paths_asset_libraries,
USERPREF_PT_file_paths_script_directories,
USERPREF_PT_file_paths_extension_repos,
USERPREF_PT_file_paths_applications,
USERPREF_PT_text_editor,
USERPREF_PT_text_editor_presets,
USERPREF_PT_file_paths_development,
USERPREF_PT_file_paths_asset_libraries,
USERPREF_PT_file_paths_extension_repos,
USERPREF_PT_saveload_blend,
USERPREF_PT_saveload_blend_autosave,
USERPREF_PT_saveload_autorun,
USERPREF_PT_saveload_file_browser,