diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2022-04-21 15:30:13 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2022-04-21 17:18:05 +0300 |
commit | f6d5d017150c54c1f359f6341d758196584ee9eb (patch) | |
tree | fa1d96b5675803427db2df6268a17dff6be1943c /source/blender/makesrna/intern/rna_attribute.c | |
parent | b9799dfb8a78dddbb3591dcb3e0b4de954c80fee (diff) |
Fix T97502: Issues/crashes with "color_attributes" AttributeGroup
Property collection functions were not really in sync which could result
in crashes in UI_LISTS.
The reason is that attributes of type color defined on domains other than
Points or Corners are still valid, but should really be skipped for the
special "color_attributes".
`rna_AttributeGroup_color_length` itself was fine here, it skips these,
but the iterator (`rna_AttributeGroup_color_iterator_begin` /
`rna_Attributes_noncolor_layer_skip`) wasnt, so when a UI_LIST
filter_items() would iterate the collection it would actually get
results were it shouldnt.
Now check a suiting domain in `rna_Attributes_noncolor_layer_skip` as
well.
Maniphest Tasks: T97502
Differential Revision: https://developer.blender.org/D14717
Diffstat (limited to 'source/blender/makesrna/intern/rna_attribute.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_attribute.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_attribute.c b/source/blender/makesrna/intern/rna_attribute.c index 6f3688b66f5..5efbebc9b97 100644 --- a/source/blender/makesrna/intern/rna_attribute.c +++ b/source/blender/makesrna/intern/rna_attribute.c @@ -339,9 +339,17 @@ static int rna_Attributes_layer_skip(CollectionPropertyIterator *UNUSED(iter), v return !(CD_TYPE_AS_MASK(layer->type) & CD_MASK_PROP_ALL); } -static int rna_Attributes_noncolor_layer_skip(CollectionPropertyIterator *UNUSED(iter), void *data) +static int rna_Attributes_noncolor_layer_skip(CollectionPropertyIterator *iter, void *data) { CustomDataLayer *layer = (CustomDataLayer *)data; + + /* Check valid domain here, too, keep in line with rna_AttributeGroup_color_length(). */ + ID *id = iter->parent.owner_id; + AttributeDomain domain = BKE_id_attribute_domain(id, layer); + if (!ELEM(domain, ATTR_DOMAIN_POINT, ATTR_DOMAIN_CORNER)) { + return 1; + } + return !(CD_TYPE_AS_MASK(layer->type) & CD_MASK_COLOR_ALL) || (layer->flag & CD_FLAG_TEMPORARY); } |