diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-06-20 11:32:54 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-06-20 11:50:18 +0300 |
commit | bba0ad903cfa407368c78b0b8480b1a729474305 (patch) | |
tree | 9fcaea7afbcf54884defc560146bbf02a38bba51 | |
parent | 2acf4ace511292a66451b7842b2725d1776a6656 (diff) |
Cleanup: De-duplicate overrides properties apply loop
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 1c44350d340..3c184ed5dcf 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -1320,6 +1320,19 @@ static GSet **dynamic_override_apply_pre(const struct Depsgraph *depsgraph) return dynamic_override_cache; } +static void dynamic_override_apply_properties(PointerRNA *ptr, ListBase *properties_new) +{ + for (DynamicOverrideProperty *dyn_prop = properties_new->first; + dyn_prop != NULL; + dyn_prop = dyn_prop->next) + { + if ((dyn_prop->flag & DYN_OVERRIDE_PROP_USE) == 0) { + continue; + } + RNA_struct_dynamic_override_apply(ptr, dyn_prop); + } +} + void BKE_dynamic_override_apply(const struct Depsgraph *depsgraph, ID *id) { const ID_Type id_type = GS(id->name); @@ -1348,15 +1361,7 @@ void BKE_dynamic_override_apply(const struct Depsgraph *depsgraph, ID *id) if (id_type == ID_SCE) { /** Apply all the scene properties. */ - for (DynamicOverrideProperty *dyn_prop = override_set->scene_properties.first; - dyn_prop != NULL; - dyn_prop = dyn_prop->next) - { - if ((dyn_prop->flag & DYN_OVERRIDE_PROP_USE) == 0) { - continue; - } - RNA_struct_dynamic_override_apply(&ptr, dyn_prop); - } + dynamic_override_apply_properties(&ptr, &override_set->scene_properties); } else { if (dynamic_override_cache[i] != NULL && @@ -1364,20 +1369,10 @@ void BKE_dynamic_override_apply(const struct Depsgraph *depsgraph, ID *id) { continue; } - /** Check if object is in one of the affected collections. * If it is, apply all the overrides for the object and its material, mesh, ... **/ - for (DynamicOverrideProperty *dyn_prop = override_set->collection_properties.first; - dyn_prop != NULL; - dyn_prop = dyn_prop->next) - { - if ((dyn_prop->flag & DYN_OVERRIDE_PROP_USE) == 0) { - continue; - } - /* If object is in collection ... */ - RNA_struct_dynamic_override_apply(&ptr, dyn_prop); - } + dynamic_override_apply_properties(&ptr, &override_set->collection_properties); } } |