UI: Show material link type icon in dropdown

Enums that are displayed as icon-only should have their icons defined
in RNA, not just through the layout in Python. That way they are shown
in the dropdown itself and users make the connection between the listed
item label and the icon while collapsed.
This commit is contained in:
Pablo Vazquez
2024-09-12 19:23:09 +02:00
parent 97e8389bc9
commit 1e98b7d2a3
2 changed files with 3 additions and 4 deletions

View File

@@ -130,8 +130,7 @@ class EEVEE_MATERIAL_PT_context_material(MaterialButtonsPanel, Panel):
row.template_ID(ob, "active_material", new="material.new")
if slot:
icon_link = 'MESH_DATA' if slot.link == 'DATA' else 'OBJECT_DATA'
row.prop(slot, "link", icon=icon_link, icon_only=True)
row.prop(slot, "link", icon_only=True)
if ob.mode == 'EDIT':
row = layout.row(align=True)

View File

@@ -2337,8 +2337,8 @@ static void rna_def_material_slot(BlenderRNA *brna)
PropertyRNA *prop;
static const EnumPropertyItem link_items[] = {
{1, "OBJECT", 0, "Object", ""},
{0, "DATA", 0, "Data", ""},
{1, "OBJECT", ICON_OBJECT_DATAMODE, "Object", ""},
{0, "DATA", ICON_MESH_DATA, "Data", ""},
{0, nullptr, 0, nullptr, nullptr},
};