Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
| Show First 20 Lines • Show All 1,229 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| /* Images. */ | /* Images. */ | ||||
| build_animation_images(id); | build_animation_images(id); | ||||
| /* Animation curves and NLA. */ | /* Animation curves and NLA. */ | ||||
| build_animdata_curves(id); | build_animdata_curves(id); | ||||
| /* Drivers. */ | /* Drivers. */ | ||||
| build_animdata_drivers(id); | build_animdata_drivers(id); | ||||
| } | } | ||||
| void DepsgraphRelationBuilder::build_animdata_curves(ID *id) | void DepsgraphRelationBuilder::build_animdata_curves(ID *id) | ||||
| { | { | ||||
sergey: Think you'll have a lot of warning messages in the terminal for objects which does not have… | |||||
| AnimData *adt = BKE_animdata_from_id(id); | AnimData *adt = BKE_animdata_from_id(id); | ||||
| if (adt == nullptr) { | if (adt == nullptr) { | ||||
| return; | return; | ||||
| } | } | ||||
| if (adt->action != nullptr) { | if (adt->action != nullptr) { | ||||
| build_action(adt->action); | build_action(adt->action); | ||||
| } | } | ||||
| if (adt->action == nullptr && BLI_listbase_is_empty(&adt->nla_tracks)) { | if (adt->action == nullptr && BLI_listbase_is_empty(&adt->nla_tracks)) { | ||||
| ▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH (FCurve *, fcu, curves) { | ||||
| * init anyway. */ | * init anyway. */ | ||||
| if (operation_to->opcode == OperationCode::BONE_LOCAL) { | if (operation_to->opcode == OperationCode::BONE_LOCAL) { | ||||
| OperationKey pose_init_key(id, NodeType::EVAL_POSE, OperationCode::POSE_INIT); | OperationKey pose_init_key(id, NodeType::EVAL_POSE, OperationCode::POSE_INIT); | ||||
| add_relation(adt_key, pose_init_key, "Animation -> Prop", RELATION_CHECK_BEFORE_ADD); | add_relation(adt_key, pose_init_key, "Animation -> Prop", RELATION_CHECK_BEFORE_ADD); | ||||
| continue; | continue; | ||||
| } | } | ||||
| graph_->add_new_relation( | graph_->add_new_relation( | ||||
| operation_from, operation_to, "Animation -> Prop", RELATION_CHECK_BEFORE_ADD); | operation_from, operation_to, "Animation -> Prop", RELATION_CHECK_BEFORE_ADD); | ||||
| if (RNA_struct_is_a(ptr.type, &RNA_Modifier)) { | |||||
| /* See RNANodeQuery::construct_node_identifier(); in this case there is a difference between | |||||
| * using this RNAPathKey as ENTRY or EXIT. This means that there will be relations | |||||
| * PARAMETERS_EVAL -> DRIVER, and ANIMATION_EXIT -> GEOMETRY_EVAL_INIT, but not | |||||
| * ANIMATION_EXIT -> PARAMETERS_EVAL. As a result, any driver targeting this animated value | |||||
| * is not properly updated unless we add another relation. */ | |||||
| ComponentKey animation_key(id, NodeType::ANIMATION); | |||||
| ComponentKey parameters_key(id, NodeType::PARAMETERS); | |||||
| add_relation(animation_key, parameters_key, "Animation -> Parameters"); | |||||
| } | |||||
| /* It is possible that animation is writing to a nested ID data-block, | /* It is possible that animation is writing to a nested ID data-block, | ||||
| * need to make sure animation is evaluated after target ID is copied. */ | * need to make sure animation is evaluated after target ID is copied. */ | ||||
| const IDNode *id_node_from = operation_from->owner->owner; | const IDNode *id_node_from = operation_from->owner->owner; | ||||
| const IDNode *id_node_to = operation_to->owner->owner; | const IDNode *id_node_to = operation_to->owner->owner; | ||||
| if (id_node_from != id_node_to) { | if (id_node_from != id_node_to) { | ||||
| ComponentKey cow_key(id_node_to->id_orig, NodeType::COPY_ON_WRITE); | ComponentKey cow_key(id_node_to->id_orig, NodeType::COPY_ON_WRITE); | ||||
| add_relation(cow_key, | add_relation(cow_key, | ||||
| adt_key, | adt_key, | ||||
| ▲ Show 20 Lines • Show All 245 Lines • ▼ Show 20 Lines | DRIVER_TARGETS_USED_LOOPER_BEGIN (dvar) { | ||||
| if (RNA_pointer_is_null(&variable_exit_key.ptr)) { | if (RNA_pointer_is_null(&variable_exit_key.ptr)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (is_same_bone_dependency(variable_exit_key, self_key) || | if (is_same_bone_dependency(variable_exit_key, self_key) || | ||||
| is_same_nodetree_node_dependency(variable_exit_key, self_key)) { | is_same_nodetree_node_dependency(variable_exit_key, self_key)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| add_relation(variable_exit_key, driver_key, "RNA Target -> Driver"); | add_relation(variable_exit_key, driver_key, "RNA Target -> Driver"); | ||||
| if (RNA_struct_is_a(variable_exit_key.ptr.type, &RNA_Modifier)) { | |||||
| /* See RNANodeQuery::construct_node_identifier(); in this case there is a difference | |||||
| * between using this RNAPathKey as ENTRY or EXIT. This means that there will be | |||||
| * relations PARAMETERS_EVAL -> DRIVER, and ANIMATION_EXIT -> GEOMETRY_EVAL_INIT, but not | |||||
| * ANIMATION_EXIT -> PARAMETERS_EVAL. As a result, the driver is not properly updated | |||||
| * when its variable reads animated data unless we add another relation. */ | |||||
| ComponentKey animation_key(target_id, NodeType::ANIMATION); | |||||
| ComponentKey parameters_key(target_id, NodeType::PARAMETERS); | |||||
| add_relation(animation_key, parameters_key, "Animation -> Parameters"); | |||||
| } | |||||
| } | } | ||||
| else { | else { | ||||
| /* If rna_path is nullptr, and DTAR_FLAG_STRUCT_REF isn't set, this | /* If rna_path is nullptr, and DTAR_FLAG_STRUCT_REF isn't set, this | ||||
| * is an incomplete target reference, so nothing to do here. */ | * is an incomplete target reference, so nothing to do here. */ | ||||
| } | } | ||||
| } | } | ||||
| DRIVER_TARGETS_LOOPER_END; | DRIVER_TARGETS_LOOPER_END; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,358 Lines • Show Last 20 Lines | |||||
Think you'll have a lot of warning messages in the terminal for objects which does not have animation, or objects which have adt but no action.
After deeper look seems that we should either: