Improved UI when material lookups fail in material order list
This commit is contained in:
@@ -21,8 +21,23 @@ class PSK_UL_material_names(UIList):
|
||||
row = layout.row()
|
||||
item = typing_cast(PSK_PG_material_name_list_item, item)
|
||||
material = bpy.data.materials.get(item.material_name, None)
|
||||
icon_value = layout.icon(material) if material else 0
|
||||
row.prop(item, 'material_name', text='', emboss=False, icon_value=icon_value, icon='BLANK1' if icon_value == 0 else 'NONE')
|
||||
|
||||
# If the material is not found by name and the name is not 'None', show a not found icon
|
||||
if item.material_name == 'None':
|
||||
icon = 'NODE_MATERIAL'
|
||||
else:
|
||||
icon = 'NOT_FOUND' if material is None else 'NONE'
|
||||
|
||||
row.prop(item, 'material_name', text='', emboss=False,
|
||||
icon_value=layout.icon(material) if material else 0,
|
||||
icon=icon)
|
||||
|
||||
# Add right-aligned "Not Found" label if material is not found
|
||||
if item.material_name != 'None' and material is None:
|
||||
label_row = row.row()
|
||||
label_row.alignment = 'RIGHT'
|
||||
label_row.enabled = False
|
||||
label_row.label(text='Not Found')
|
||||
|
||||
|
||||
_classes = (
|
||||
|
||||
Reference in New Issue
Block a user