Fix #155263: "Custom Property Values as Default" raises an exception

Updating defaults didn't account for some property types such as
IDPropertyGroup not supporting id_properties_ui(...).

Ref !155411
This commit is contained in:
Campbell Barton 2026-03-10 00:14:54 +00:00
parent c1c7984396
commit 1e3c53d702

View file

@ -69,7 +69,13 @@ def rna_idprop_value_item_type(value):
def rna_idprop_ui_prop_default_set(item, prop, value):
ui_data = item.id_properties_ui(prop)
# NOTE: the internal check to know if a property supports UI is not exposed.
# Use an exception here and assert this isn't catching unrelated errors.
try:
ui_data = item.id_properties_ui(prop)
except TypeError as ex:
assert ex.args and ("does not support UI data" in ex.args[0])
return
ui_data.update(default=value)