Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
| Show First 20 Lines • Show All 1,144 Lines • ▼ Show 20 Lines | OperationKey constraint_op_key(id, | ||||
| component_type, | component_type, | ||||
| component_subdata, | component_subdata, | ||||
| (component_type == NodeType::BONE) ? | (component_type == NodeType::BONE) ? | ||||
| OperationCode::BONE_CONSTRAINTS : | OperationCode::BONE_CONSTRAINTS : | ||||
| OperationCode::TRANSFORM_CONSTRAINTS); | OperationCode::TRANSFORM_CONSTRAINTS); | ||||
| /* Add dependencies for each constraint in turn. */ | /* Add dependencies for each constraint in turn. */ | ||||
| for (bConstraint *con = (bConstraint *)constraints->first; con; con = con->next) { | for (bConstraint *con = (bConstraint *)constraints->first; con; con = con->next) { | ||||
| const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); | const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); | ||||
| ListBase targets = {nullptr, nullptr}; | |||||
| /* Invalid constraint type. */ | /* Invalid constraint type. */ | ||||
| if (cti == nullptr) { | if (cti == nullptr) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| /* Special case for camera tracking -- it doesn't use targets to | /* Special case for camera tracking -- it doesn't use targets to | ||||
| * define relations. */ | * define relations. */ | ||||
| /* TODO: we can now represent dependencies in a much richer manner, | /* TODO: we can now represent dependencies in a much richer manner, | ||||
| * so review how this is done. */ | * so review how this is done. */ | ||||
| Show All 32 Lines | else if (cti->type == CONSTRAINT_TYPE_TRANSFORM_CACHE) { | ||||
| TimeSourceKey time_src_key; | TimeSourceKey time_src_key; | ||||
| add_relation(time_src_key, constraint_op_key, "TimeSrc -> Animation"); | add_relation(time_src_key, constraint_op_key, "TimeSrc -> Animation"); | ||||
| bTransformCacheConstraint *data = (bTransformCacheConstraint *)con->data; | bTransformCacheConstraint *data = (bTransformCacheConstraint *)con->data; | ||||
| if (data->cache_file) { | if (data->cache_file) { | ||||
| ComponentKey cache_key(&data->cache_file->id, NodeType::CACHE); | ComponentKey cache_key(&data->cache_file->id, NodeType::CACHE); | ||||
| add_relation(cache_key, constraint_op_key, cti->name); | add_relation(cache_key, constraint_op_key, cti->name); | ||||
| } | } | ||||
| } | } | ||||
| else if (cti->get_constraint_targets) { | else if (BKE_constraint_targets_get(con, &targets)) { | ||||
| ListBase targets = {nullptr, nullptr}; | |||||
| cti->get_constraint_targets(con, &targets); | |||||
| LISTBASE_FOREACH (bConstraintTarget *, ct, &targets) { | LISTBASE_FOREACH (bConstraintTarget *, ct, &targets) { | ||||
| if (ct->tar == nullptr) { | if (ct->tar == nullptr) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK)) { | if (ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK)) { | ||||
| /* Ignore IK constraints - these are handled separately | /* Ignore IK constraints - these are handled separately | ||||
| * (on pose level). */ | * (on pose level). */ | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | else if (BKE_constraint_targets_get(con, &targets)) { | ||||
| CONSTRAINT_TYPE_SIZELIKE, | CONSTRAINT_TYPE_SIZELIKE, | ||||
| CONSTRAINT_TYPE_LOCLIKE, | CONSTRAINT_TYPE_LOCLIKE, | ||||
| CONSTRAINT_TYPE_TRANSLIKE)) { | CONSTRAINT_TYPE_TRANSLIKE)) { | ||||
| /* TODO(sergey): Add used space check. */ | /* TODO(sergey): Add used space check. */ | ||||
| ComponentKey target_transform_key(&ct->tar->id, NodeType::TRANSFORM); | ComponentKey target_transform_key(&ct->tar->id, NodeType::TRANSFORM); | ||||
| add_relation(target_transform_key, constraint_op_key, cti->name); | add_relation(target_transform_key, constraint_op_key, cti->name); | ||||
| } | } | ||||
| } | } | ||||
| if (cti->flush_constraint_targets) { | BKE_constraint_targets_flush(con, &targets, true); | ||||
| cti->flush_constraint_targets(con, &targets, true); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void DepsgraphRelationBuilder::build_animdata(ID *id) | void DepsgraphRelationBuilder::build_animdata(ID *id) | ||||
| { | { | ||||
| /* Images. */ | /* Images. */ | ||||
| build_animation_images(id); | build_animation_images(id); | ||||
| ▲ Show 20 Lines • Show All 1,787 Lines • Show Last 20 Lines | |||||