Fix T100687: Geometry Attribute Convert crashes in sculpt mode

Since above commit, `BKE_id_attributes_active_get` would also return
"internal" attributes like ".hide_poly" or ".hide_vert".
As a consequence, a couple of poll functions dont return false anymore
(attribute remove, attribute convert), allowing these operators to
execute, but acting on this "internal" layers is just asking for
trouble.

In the UI, we dont see these attributes, because `MESH_UL_attributes`
checks `is_internal`, same thing we do now in
`BKE_id_attributes_active_get`.

Maniphest Tasks: T100687

Differential Revision: https://developer.blender.org/D15833
This commit is contained in:
Philipp Oeser
2022-09-01 13:55:20 +02:00
parent 831ed297d0
commit a50ca6a1cd

View File

@@ -473,7 +473,7 @@ CustomDataLayer *BKE_id_attributes_active_get(ID *id)
for (int i = 0; i < customdata->totlayer; i++) {
CustomDataLayer *layer = &customdata->layers[i];
if (CD_MASK_PROP_ALL & CD_TYPE_AS_MASK(layer->type)) {
if (index == active_index) {
if (index == active_index && BKE_attribute_allow_procedural_access(layer->name)) {
return layer;
}
index++;