UI: Allow Some Buttons to Scale Width With Text Style

Allow some View3D buttons to change their width according to content
and Text Styles, rather than be fixed amount of UI_UNIT_X. Examples
include "Object Mode", "Transform Orientation", "Grease Pencil Layers",
"Texture Slots", "Vertex Groups", "Attribute", etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/119223
This commit is contained in:
Harley Acheson
2024-03-08 21:49:56 +01:00
committed by Harley Acheson
parent 4dd11c458a
commit 85762d99ef
-7
View File
@@ -209,7 +209,6 @@ class VIEW3D_HT_tool_header(Header):
layout.label(text="Layer:")
sub = layout.row()
sub.ui_units_x = 8
sub.popover(
panel="TOPBAR_PT_gpencil_layers",
text=text,
@@ -638,7 +637,6 @@ class VIEW3D_HT_header(Header):
row = layout.row(align=True)
sub = row.row()
sub.ui_units_x = 4
sub.prop_with_popover(
orient_slot,
"type",
@@ -751,7 +749,6 @@ class VIEW3D_HT_header(Header):
act_mode_i18n_context = bpy.types.Object.bl_rna.properties["mode"].translation_context
sub = row.row(align=True)
sub.ui_units_x = 5.5
sub.operator_menu_enum(
"object.mode_set", "mode",
text=iface_(act_mode_item.name, act_mode_i18n_context),
@@ -946,7 +943,6 @@ class VIEW3D_HT_header(Header):
color_type = shading.color_type
row = layout.row()
row.ui_units_x = 6
row.active = is_paint_tool and color_type == 'VERTEX'
if context.preferences.experimental.use_sculpt_texture_paint:
@@ -964,12 +960,10 @@ class VIEW3D_HT_header(Header):
elif object_mode == 'VERTEX_PAINT':
row = layout.row()
row.ui_units_x = 6
row.popover(panel="VIEW3D_PT_slots_color_attributes", icon='GROUP_VCOL')
elif object_mode == 'WEIGHT_PAINT':
row = layout.row()
row.ui_units_x = 6
row.popover(panel="VIEW3D_PT_slots_vertex_groups", icon='GROUP_VERTEX')
elif object_mode == 'TEXTURE_PAINT':
@@ -977,7 +971,6 @@ class VIEW3D_HT_header(Header):
icon = 'MATERIAL' if tool_mode == 'MATERIAL' else 'IMAGE_DATA'
row = layout.row()
row.ui_units_x = 9
row.popover(panel="VIEW3D_PT_slots_projectpaint", icon=icon)
row.popover(panel="VIEW3D_PT_mask", icon='MOD_MASK', text="")
else: