From 45fdea48c152b0e632a911139c7173f1e44f9310 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 29 Jan 2018 19:01:44 +1300 Subject: 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. --- .../intern/builder/deg_builder_relations.cc | 52 ++++++++++++++++------ .../intern/builder/deg_builder_relations.h | 9 +++- 2 files changed, 47 insertions(+), 14 deletions(-) (limited to 'source/blender/depsgraph/intern') 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); -- cgit v1.2.3 From 70286a76523a8a9c36858285a080075e4cd313d2 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 29 Jan 2018 14:43:12 +0100 Subject: Depsgraph: Cleanup, line wraps --- .../intern/builder/deg_builder_relations_rig.cc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'source/blender/depsgraph/intern') diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc index b23a6112fce..b0e99799824 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -444,12 +444,24 @@ void DepsgraphRelationBuilder::build_rig(Object *object) void DepsgraphRelationBuilder::build_proxy_rig(Object *object) { - OperationKey pose_init_key(&object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT); - OperationKey pose_done_key(&object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_DONE); + OperationKey pose_init_key(&object->id, + DEG_NODE_TYPE_EVAL_POSE, + DEG_OPCODE_POSE_INIT); + OperationKey pose_done_key(&object->id, + DEG_NODE_TYPE_EVAL_POSE, + DEG_OPCODE_POSE_DONE); BLI_LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { - OperationKey bone_local_key(&object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_LOCAL); - OperationKey bone_ready_key(&object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_READY); - OperationKey bone_done_key(&object->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_DONE); + OperationKey bone_local_key(&object->id, + DEG_NODE_TYPE_BONE, pchan->name, + DEG_OPCODE_BONE_LOCAL); + OperationKey bone_ready_key(&object->id, + DEG_NODE_TYPE_BONE, + pchan->name, + DEG_OPCODE_BONE_READY); + OperationKey bone_done_key(&object->id, + DEG_NODE_TYPE_BONE, + pchan->name, + DEG_OPCODE_BONE_DONE); add_relation(pose_init_key, bone_local_key, "Pose Init -> Bone Local"); add_relation(bone_local_key, bone_ready_key, "Local -> Ready"); add_relation(bone_ready_key, bone_done_key, "Ready -> Done"); -- cgit v1.2.3 From 6eb2b57f5a76d3ff91b485801747ba8547ab72d1 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 29 Jan 2018 14:45:45 +0100 Subject: Depsgraph: Disable labels on relations This code was disable a while back and got re-enabled by some previous debug process. Having relation names in dot file helps understanding what's going on in one cases, but makes things spread too far away in others. --- source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/depsgraph/intern') diff --git a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc index 270202f9f34..b76cd9eaadd 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc @@ -468,7 +468,7 @@ static void deg_debug_graphviz_node_relations(const DebugContext &ctx, deg_debug_fprintf(ctx, "["); /* Note: without label an id seem necessary to avoid bugs in graphviz/dot */ deg_debug_fprintf(ctx, "id=\"%s\"", rel->name); - deg_debug_fprintf(ctx, "label=\"%s\"", rel->name); + // deg_debug_fprintf(ctx, "label=\"%s\"", rel->name); deg_debug_fprintf(ctx, ",color="); deg_debug_graphviz_relation_color(ctx, rel); deg_debug_fprintf(ctx, ",penwidth=\"%f\"", penwidth); /* NOTE: edge from node to own cluster is not possible and gives graphviz -- cgit v1.2.3 From 68c1e3c28d60297d736a598bd897e1fff57f47b7 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 29 Jan 2018 14:53:27 +0100 Subject: Depsgraph: Fix missing update when property from proxy rig drives something --- source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/blender/depsgraph/intern') diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 85ea2c0a8e4..107ba8dc9a1 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -535,6 +535,14 @@ void DepsgraphRelationBuilder::build_object(Object *object) ComponentKey ob_pose_key(&object->id, DEG_NODE_TYPE_EVAL_POSE); ComponentKey proxy_pose_key(&object->proxy->id, DEG_NODE_TYPE_EVAL_POSE); add_relation(ob_pose_key, proxy_pose_key, "Proxy"); + + ComponentKey ob_parameters_key(&object->id, + DEG_NODE_TYPE_PARAMETERS); + ComponentKey proxy_parameters_key(&object->proxy->id, + DEG_NODE_TYPE_PARAMETERS); + add_relation(ob_parameters_key, + proxy_parameters_key, + "Proxy Parameters"); } /* Object dupligroup. */ if (object->dup_group != NULL) { -- cgit v1.2.3 From 263efb0b9a736a1529d8c6fce37e56bdb8d7866b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 29 Jan 2018 15:06:44 +0100 Subject: Depsgraph: Correction for previous fix Original fix only worked when there is one custom property. --- .../depsgraph/intern/builder/deg_builder_nodes_rig.cc | 1 + .../depsgraph/intern/builder/deg_builder_relations.cc | 8 -------- .../depsgraph/intern/builder/deg_builder_relations_rig.cc | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) (limited to 'source/blender/depsgraph/intern') diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc index 177a0ec4358..29cd72c13fd 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -274,6 +274,7 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object) DEG_OPCODE_POSE_INIT); op_node->set_as_entry(); + BLI_LISTBASE_FOREACH (bPoseChannel *, pchan, &object->pose->chanbase) { op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, NULL, DEG_OPCODE_BONE_LOCAL); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 107ba8dc9a1..85ea2c0a8e4 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -535,14 +535,6 @@ void DepsgraphRelationBuilder::build_object(Object *object) ComponentKey ob_pose_key(&object->id, DEG_NODE_TYPE_EVAL_POSE); ComponentKey proxy_pose_key(&object->proxy->id, DEG_NODE_TYPE_EVAL_POSE); add_relation(ob_pose_key, proxy_pose_key, "Proxy"); - - ComponentKey ob_parameters_key(&object->id, - DEG_NODE_TYPE_PARAMETERS); - ComponentKey proxy_parameters_key(&object->proxy->id, - DEG_NODE_TYPE_PARAMETERS); - add_relation(ob_parameters_key, - proxy_parameters_key, - "Proxy Parameters"); } /* Object dupligroup. */ if (object->dup_group != NULL) { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc index b0e99799824..4a822fe7477 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -444,6 +444,7 @@ void DepsgraphRelationBuilder::build_rig(Object *object) void DepsgraphRelationBuilder::build_proxy_rig(Object *object) { + Object *proxy_from = object->proxy_from; OperationKey pose_init_key(&object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT); @@ -466,6 +467,20 @@ void DepsgraphRelationBuilder::build_proxy_rig(Object *object) add_relation(bone_local_key, bone_ready_key, "Local -> Ready"); add_relation(bone_ready_key, bone_done_key, "Ready -> Done"); add_relation(bone_done_key, pose_done_key, "Bone Done -> Pose Done"); + + if (pchan->prop != NULL) { + OperationKey bone_parameters(&object->id, + DEG_NODE_TYPE_PARAMETERS, + DEG_OPCODE_PARAMETERS_EVAL, + pchan->name); + OperationKey from_bone_parameters(&proxy_from->id, + DEG_NODE_TYPE_PARAMETERS, + DEG_OPCODE_PARAMETERS_EVAL, + pchan->name); + add_relation(from_bone_parameters, + bone_parameters, + "Proxy Bone Parameters"); + } } } -- cgit v1.2.3