[Bf-blender-cvs] [bba0ad903cf] temp-dynamic-overrides: Cleanup: De-duplicate overrides properties apply loop

Sergey Sharybin noreply at git.blender.org
Wed Jun 20 10:52:11 CEST 2018


Commit: bba0ad903cfa407368c78b0b8480b1a729474305
Author: Sergey Sharybin
Date:   Wed Jun 20 10:32:54 2018 +0200
Branches: temp-dynamic-overrides
https://developer.blender.org/rBbba0ad903cfa407368c78b0b8480b1a729474305

Cleanup: De-duplicate overrides properties apply loop

===================================================================

M	source/blender/blenkernel/intern/layer.c

===================================================================

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);
 		}
 	}



More information about the Bf-blender-cvs mailing list