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
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-05-12 11:38:55 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-05-12 14:06:36 +0300
commit08d87514d3bf33f8b4770e9213ad3dcddcda9b26 (patch)
treebcf881ff134afe6786eb8de4f88eaceab9508ee5 /source
parent31f0c27ae7d6f45cfde71cca8c4f791a089452a5 (diff)
Depsgraph: Add utility function to check whether modifier depends on time
Currently unused, based on the code from old depsgraph.c. The purpose is to re-sue the code over old and new depsgraph in an easy way.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_object.h3
-rw-r--r--source/blender/blenkernel/intern/object.c48
2 files changed, 51 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index d287eb4a057..ec90cc74082 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -47,6 +47,7 @@ struct MovieClip;
struct Main;
struct RigidBodyWorld;
struct HookModifierData;
+struct ModifierData;
void BKE_object_workob_clear(struct Object *workob);
void BKE_object_workob_calc_parent(struct Scene *scene, struct Object *ob, struct Object *workob);
@@ -232,6 +233,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 d5f070bc770..8dfc7e0e8cd 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -3891,3 +3891,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;
+}