[Bf-blender-cvs] [a2a7770] depsgraph_refactor: Depsgraph: Code cleanup, move utility function to BKE

Sergey Sharybin noreply at git.blender.org
Mon Mar 16 14:34:49 CET 2015


Commit: a2a777050bf33437a96c89ccc1736ba30c0e33d7
Author: Sergey Sharybin
Date:   Mon Mar 16 16:26:18 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rBa2a777050bf33437a96c89ccc1736ba30c0e33d7

Depsgraph: Code cleanup, move utility function to BKE

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

M	source/blender/blenkernel/BKE_object.h
M	source/blender/blenkernel/intern/object.c
M	source/blender/depsgraph/intern/depsgraph_build_relations.cpp

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

diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 5815986..4b70233 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -249,6 +249,8 @@ void             BKE_object_groups_clear(struct Scene *scene, struct Base *base,
 
 struct KDTree *BKE_object_as_kdtree(struct Object *ob, int *r_tot);
 
+bool BKE_object_modifier_use_time(struct Object *ob, struct ModifierData *md);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 5ea020c..0845d28 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -3903,3 +3903,51 @@ KDTree *BKE_object_as_kdtree(Object *ob, int *r_tot)
 	*r_tot = tot;
 	return tree;
 }
+
+bool BKE_object_modifier_use_time(Object *ob, ModifierData *md)
+{
+	if (modifier_dependsOnTime(md)) {
+		return true;
+	}
+
+	/* Check whether modifier is animated. */
+	// TODO: this should be handled as part of build_animdata()  -- Aligorith
+	if (ob->adt) {
+		AnimData *adt = ob->adt;
+		FCurve *fcu;
+
+		char pattern[MAX_NAME + 10];
+		/* TODO(sergey): Escape modifier name. */
+		BLI_snprintf(pattern, sizeof(pattern), "modifiers[%s", md->name);
+
+		/* action - check for F-Curves with paths containing 'modifiers[' */
+		if (adt->action) {
+			for (fcu = (FCurve *)adt->action->curves.first;
+			     fcu != NULL;
+			     fcu = (FCurve *)fcu->next)
+			{
+				if (fcu->rna_path && strstr(fcu->rna_path, pattern))
+					return true;
+			}
+		}
+
+		/* This here allows modifier properties to get driven and still update properly
+		 *
+		 * Workaround to get [#26764] (e.g. subsurf levels not updating when animated/driven)
+		 * working, without the updating problems ([#28525] [#28690] [#28774] [#28777]) caused
+		 * by the RNA updates cache introduced in r.38649
+		 */
+		for (fcu = (FCurve *)adt->drivers.first;
+		     fcu != NULL;
+		     fcu = (FCurve *)fcu->next)
+		{
+			if (fcu->rna_path && strstr(fcu->rna_path, pattern))
+				return true;
+		}
+
+		/* XXX: also, should check NLA strips, though for now assume that nobody uses
+		 * that and we can omit that for performance reasons... */
+	}
+
+	return false;
+}
diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
index 58d2408..57b2a35 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -100,59 +100,6 @@ extern "C" {
 
 #include "depsgraph_util_pchanmap.h"
 
-namespace {
-
-/* TODO(sergey): This is a stupid copy of function from depsgraph.c/ */
-bool modifier_check_depends_on_time(Object *ob, ModifierData *md)
-{
-	if (modifier_dependsOnTime(md)) {
-		return true;
-	}
-
-	/* Check whether modifier is animated. */
-	// TODO: this should be handled as part of build_animdata()  -- Aligorith
-	if (ob->adt) {
-		AnimData *adt = ob->adt;
-		FCurve *fcu;
-
-		char pattern[MAX_NAME + 10];
-		/* TODO(sergey): Escape modifier name. */
-		BLI_snprintf(pattern, sizeof(pattern), "modifiers[%s", md->name);
-
-		/* action - check for F-Curves with paths containing 'modifiers[' */
-		if (adt->action) {
-			for (fcu = (FCurve *)adt->action->curves.first;
-			     fcu != NULL;
-			     fcu = (FCurve *)fcu->next)
-			{
-				if (fcu->rna_path && strstr(fcu->rna_path, pattern))
-					return true;
-			}
-		}
-
-		/* This here allows modifier properties to get driven and still update properly
-		 *
-		 * Workaround to get [#26764] (e.g. subsurf levels not updating when animated/driven)
-		 * working, without the updating problems ([#28525] [#28690] [#28774] [#28777]) caused
-		 * by the RNA updates cache introduced in r.38649
-		 */
-		for (fcu = (FCurve *)adt->drivers.first;
-		     fcu != NULL;
-		     fcu = (FCurve *)fcu->next)
-		{
-			if (fcu->rna_path && strstr(fcu->rna_path, pattern))
-				return true;
-		}
-
-		/* XXX: also, should check NLA strips, though for now assume that nobody uses
-		 * that and we can omit that for performance reasons... */
-	}
-
-	return false;
-}
-
-}  /* namespace */
-
 /* ***************** */
 /* Relations Builder */
 
@@ -1439,7 +1386,7 @@ void DepsgraphRelationBuilder::build_obdata_geom(Scene *scene, Object *ob)
 				mti->updateDepsgraph(md, scene, ob, &handle);
 			}
 
-			if (modifier_check_depends_on_time(ob, md)) {
+			if (BKE_object_modifier_use_time(ob, md)) {
 				TimeSourceKey time_src_key;
 				add_relation(time_src_key, mod_key, DEPSREL_TYPE_TIME, "Time Source");
 			}




More information about the Bf-blender-cvs mailing list