Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-09-06 10:13:41 +0300
committerCampbell Barton <campbell@blender.org>2022-09-06 10:16:04 +0300
commit6602f3022545f1bfd86b12390289b9c39df727d7 (patch)
tree67df3c9e46c3dc1f59ba5aea9ad783aafacdf565 /source/blender/blenkernel
parent3ebf6a7f38e9ef0e74073f442d369dc426912ac9 (diff)
Cleanup: early exit when the active layer disallows procedural access
Once the active layer index is reached, there is no need to keep searching. Return early instead.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/attribute.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/attribute.cc b/source/blender/blenkernel/intern/attribute.cc
index 8524f340803..b2c1382c423 100644
--- a/source/blender/blenkernel/intern/attribute.cc
+++ b/source/blender/blenkernel/intern/attribute.cc
@@ -474,8 +474,11 @@ 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 && BKE_attribute_allow_procedural_access(layer->name)) {
- return layer;
+ if (index == active_index) {
+ if (BKE_attribute_allow_procedural_access(layer->name)) {
+ return layer;
+ }
+ return nullptr;
}
index++;
}