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:
authorJoshua Leung <aligorith@gmail.com>2018-01-29 09:01:44 +0300
committerJoshua Leung <aligorith@gmail.com>2018-01-29 09:01:59 +0300
commit45fdea48c152b0e632a911139c7173f1e44f9310 (patch)
treeccd000cce1e5caa829395318a2065e3b1ca69f10 /source/blender/depsgraph/intern
parent79639ccd6b118d14fdf43998032226ebf54a2b3e (diff)
Fix T53614: New Depsgraph ignores NLA strips
The new depsgraph was only considering the active action when attaching relations from the AnimData component/operation to the properties that are affected by the animation data. As a result, only properties animated by the active action were working, while those animated by NLA strips did not change when playing back/scrubbing the timeline. This commit fixes this introducing a recursive method to properly visit all NLA strips, and calling DepsRelBuilder::build_animdata_curves_targets() on each of those strips.
Diffstat (limited to 'source/blender/depsgraph/intern')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc52
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.h9
2 files changed, 47 insertions, 14 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 81daa8cfb8c..85ea2c0a8e4 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -916,18 +916,7 @@ void DepsgraphRelationBuilder::build_animdata_curves(ID *id)
ComponentKey adt_key(id, DEG_NODE_TYPE_ANIMATION);
TimeSourceKey time_src_key;
add_relation(time_src_key, adt_key, "TimeSrc -> Animation");
- /* Build relations from animation operation to properties it changes. */
- build_animdata_curves_targets(id);
-}
-
-void DepsgraphRelationBuilder::build_animdata_curves_targets(ID *id)
-{
- AnimData *adt = BKE_animdata_from_id(id);
- if (adt == NULL || adt->action == NULL) {
- return;
- }
- /* Get source operation. */
- ComponentKey adt_key(id, DEG_NODE_TYPE_ANIMATION);
+ /* Get source operations. */
DepsNode *node_from = get_node(adt_key);
BLI_assert(node_from != NULL);
if (node_from == NULL) {
@@ -935,10 +924,28 @@ void DepsgraphRelationBuilder::build_animdata_curves_targets(ID *id)
}
OperationDepsNode *operation_from = node_from->get_exit_operation();
BLI_assert(operation_from != NULL);
+ /* Build relations from animation operation to properties it changes. */
+ if (adt->action != NULL) {
+ build_animdata_curves_targets(id, adt_key,
+ operation_from,
+ &adt->action->curves);
+ }
+ BLI_LISTBASE_FOREACH(NlaTrack *, nlt, &adt->nla_tracks) {
+ build_animdata_nlastrip_targets(id, adt_key,
+ operation_from,
+ &nlt->strips);
+ }
+}
+
+void DepsgraphRelationBuilder::build_animdata_curves_targets(
+ ID *id, ComponentKey &adt_key,
+ OperationDepsNode *operation_from,
+ ListBase *curves)
+{
/* Iterate over all curves and build relations. */
PointerRNA id_ptr;
RNA_id_pointer_create(id, &id_ptr);
- BLI_LISTBASE_FOREACH(FCurve *, fcu, &adt->action->curves) {
+ BLI_LISTBASE_FOREACH(FCurve *, fcu, curves) {
PointerRNA ptr;
PropertyRNA *prop;
int index;
@@ -969,6 +976,25 @@ void DepsgraphRelationBuilder::build_animdata_curves_targets(ID *id)
}
}
+void DepsgraphRelationBuilder::build_animdata_nlastrip_targets(
+ ID *id, ComponentKey &adt_key,
+ OperationDepsNode *operation_from,
+ ListBase *strips)
+{
+ BLI_LISTBASE_FOREACH(NlaStrip *, strip, strips) {
+ if (strip->act != NULL) {
+ build_animdata_curves_targets(id, adt_key,
+ operation_from,
+ &strip->act->curves);
+ }
+ else if (strip->strips.first != NULL) {
+ build_animdata_nlastrip_targets(id, adt_key,
+ operation_from,
+ &strip->strips);
+ }
+ }
+}
+
void DepsgraphRelationBuilder::build_animdata_drivers(ID *id)
{
AnimData *adt = BKE_animdata_from_id(id);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index de13ee19122..aa55b9f66ae 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -201,7 +201,14 @@ struct DepsgraphRelationBuilder
RootPChanMap *root_map);
void build_animdata(ID *id);
void build_animdata_curves(ID *id);
- void build_animdata_curves_targets(ID *id);
+ void build_animdata_curves_targets(ID *id,
+ ComponentKey &adt_key,
+ OperationDepsNode *operation_from,
+ ListBase *curves);
+ void build_animdata_nlastrip_targets(ID *id,
+ ComponentKey &adt_key,
+ OperationDepsNode *operation_from,
+ ListBase *strips);
void build_animdata_drivers(ID *id);
void build_driver(ID *id, FCurve *fcurve);
void build_driver_data(ID *id, FCurve *fcurve);