Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/armature/pose_select.c
| Show First 20 Lines • Show All 674 Lines • ▼ Show 20 Lines | |||||
| static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op)) | static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| bConstraint *con; | bConstraint *con; | ||||
| int found = 0; | int found = 0; | ||||
| CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) { | CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) { | ||||
| if (pchan->bone->flag & BONE_SELECTED) { | if (pchan->bone->flag & BONE_SELECTED) { | ||||
| for (con = pchan->constraints.first; con; con = con->next) { | for (con = pchan->constraints.first; con; con = con->next) { | ||||
| const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); | |||||
| ListBase targets = {NULL, NULL}; | ListBase targets = {NULL, NULL}; | ||||
| bConstraintTarget *ct; | bConstraintTarget *ct; | ||||
| if (cti && cti->get_constraint_targets) { | if (BKE_constraint_targets_get(con, &targets)) { | ||||
| cti->get_constraint_targets(con, &targets); | |||||
| for (ct = targets.first; ct; ct = ct->next) { | for (ct = targets.first; ct; ct = ct->next) { | ||||
| Object *ob = ct->tar; | Object *ob = ct->tar; | ||||
| /* Any armature that is also in pose mode should be selected. */ | /* Any armature that is also in pose mode should be selected. */ | ||||
| if ((ct->subtarget[0] != '\0') && (ob != NULL) && (ob->type == OB_ARMATURE) && | if ((ct->subtarget[0] != '\0') && (ob != NULL) && (ob->type == OB_ARMATURE) && | ||||
| (ob->mode == OB_MODE_POSE)) { | (ob->mode == OB_MODE_POSE)) { | ||||
| bPoseChannel *pchanc = BKE_pose_channel_find_name(ob->pose, ct->subtarget); | bPoseChannel *pchanc = BKE_pose_channel_find_name(ob->pose, ct->subtarget); | ||||
| if ((pchanc) && !(pchanc->bone->flag & BONE_UNSELECTABLE)) { | if ((pchanc) && !(pchanc->bone->flag & BONE_UNSELECTABLE)) { | ||||
| pchanc->bone->flag |= BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL; | pchanc->bone->flag |= BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL; | ||||
| ED_pose_bone_select_tag_update(ob); | ED_pose_bone_select_tag_update(ob); | ||||
| found = 1; | found = 1; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (cti->flush_constraint_targets) { | BKE_constraint_targets_flush(con, &targets, 1); | ||||
| cti->flush_constraint_targets(con, &targets, 1); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| CTX_DATA_END; | CTX_DATA_END; | ||||
| if (!found) { | if (!found) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| ▲ Show 20 Lines • Show All 574 Lines • Show Last 20 Lines | |||||