Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
| Show First 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | if (target == id) { | ||||
| */ | */ | ||||
| if (root_map->has_common_root(component_subdata, subtarget)) { | if (root_map->has_common_root(component_subdata, subtarget)) { | ||||
| return DEG_OPCODE_BONE_READY; | return DEG_OPCODE_BONE_READY; | ||||
| } | } | ||||
| } | } | ||||
| return DEG_OPCODE_BONE_DONE; | return DEG_OPCODE_BONE_DONE; | ||||
| } | } | ||||
| static bool bone_has_segments(Object *object, const char *bone_name) | |||||
| { | |||||
| /* Proxies don't have BONE_SEGMENTS */ | |||||
| if (ID_IS_LINKED(object) && object->proxy_from != NULL) { | |||||
| return false; | |||||
| } | |||||
| /* Only B-Bones have segments. */ | |||||
| bPoseChannel *pchan = BKE_pose_channel_find_name(object->pose, bone_name); | |||||
| return pchan && pchan->bone && pchan->bone->segments > 1; | |||||
| } | |||||
| /* **** General purpose functions **** */ | /* **** General purpose functions **** */ | ||||
| DepsgraphRelationBuilder::DepsgraphRelationBuilder(Main *bmain, | DepsgraphRelationBuilder::DepsgraphRelationBuilder(Main *bmain, | ||||
| Depsgraph *graph) | Depsgraph *graph) | ||||
| : bmain_(bmain), | : bmain_(bmain), | ||||
| graph_(graph), | graph_(graph), | ||||
| scene_(NULL) | scene_(NULL) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 795 Lines • ▼ Show 20 Lines | else if (cti->get_constraint_targets) { | ||||
| DEG_NODE_TYPE_TRANSFORM); | DEG_NODE_TYPE_TRANSFORM); | ||||
| add_relation(target_transform_key, constraint_op_key, cti->name); | add_relation(target_transform_key, constraint_op_key, cti->name); | ||||
| } | } | ||||
| else if ((ct->tar->type == OB_ARMATURE) && (ct->subtarget[0])) { | else if ((ct->tar->type == OB_ARMATURE) && (ct->subtarget[0])) { | ||||
| eDepsOperation_Code opcode; | eDepsOperation_Code opcode; | ||||
| /* relation to bone */ | /* relation to bone */ | ||||
| opcode = bone_target_opcode(&ct->tar->id, ct->subtarget, | opcode = bone_target_opcode(&ct->tar->id, ct->subtarget, | ||||
| id, component_subdata, root_map); | id, component_subdata, root_map); | ||||
| /* Armature constraint always wants the final position and chan_mat. */ | |||||
| if (ELEM(con->type, CONSTRAINT_TYPE_ARMATURE)) { | |||||
| opcode = DEG_OPCODE_BONE_DONE; | |||||
| } | |||||
| /* if needs bbone shape, reference the segment computation */ | |||||
| if (BKE_constraint_target_uses_bbone(con, ct) && | |||||
| bone_has_segments(ct->tar, ct->subtarget)) { | |||||
| opcode = DEG_OPCODE_BONE_SEGMENTS; | |||||
| } | |||||
| OperationKey target_key(&ct->tar->id, | OperationKey target_key(&ct->tar->id, | ||||
| DEG_NODE_TYPE_BONE, | DEG_NODE_TYPE_BONE, | ||||
| ct->subtarget, | ct->subtarget, | ||||
| opcode); | opcode); | ||||
| add_relation(target_key, constraint_op_key, cti->name); | add_relation(target_key, constraint_op_key, cti->name); | ||||
| /* if needs bbone shape, also reference handles */ | |||||
| if (BKE_constraint_target_uses_bbone(con, ct)) { | |||||
| bPoseChannel *pchan = BKE_pose_channel_find_name(ct->tar->pose, ct->subtarget); | |||||
| /* actually a bbone */ | |||||
| if (pchan && pchan->bone && pchan->bone->segments > 1) { | |||||
| bPoseChannel *prev, *next; | |||||
| BKE_pchan_get_bbone_handles(pchan, &prev, &next); | |||||
| /* add handle links */ | |||||
| if (prev) { | |||||
| opcode = bone_target_opcode(&ct->tar->id, prev->name, | |||||
| id, component_subdata, root_map); | |||||
| OperationKey prev_key(&ct->tar->id, | |||||
| DEG_NODE_TYPE_BONE, | |||||
| prev->name, | |||||
| opcode); | |||||
| add_relation(prev_key, constraint_op_key, cti->name); | |||||
| } | |||||
| if (next) { | |||||
| opcode = bone_target_opcode(&ct->tar->id, next->name, | |||||
| id, component_subdata, root_map); | |||||
| OperationKey next_key(&ct->tar->id, | |||||
| DEG_NODE_TYPE_BONE, | |||||
| next->name, | |||||
| opcode); | |||||
| add_relation(next_key, constraint_op_key, cti->name); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| else if (ELEM(ct->tar->type, OB_MESH, OB_LATTICE) && | else if (ELEM(ct->tar->type, OB_MESH, OB_LATTICE) && | ||||
| (ct->subtarget[0])) | (ct->subtarget[0])) | ||||
| { | { | ||||
| /* Vertex group. */ | /* Vertex group. */ | ||||
| /* NOTE: for now, we don't need to represent vertex groups | /* NOTE: for now, we don't need to represent vertex groups | ||||
| * separately. | * separately. | ||||
| */ | */ | ||||
| ▲ Show 20 Lines • Show All 1,486 Lines • Show Last 20 Lines | |||||