Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/armature/armature_add.c
| Show First 20 Lines • Show All 385 Lines • ▼ Show 20 Lines | static void updateDuplicateSubtarget(EditBone *dup_bone, | ||||
| ListBase *conlist; | ListBase *conlist; | ||||
| if ((pchan = BKE_pose_channel_ensure(ob->pose, dup_bone->name))) { | if ((pchan = BKE_pose_channel_ensure(ob->pose, dup_bone->name))) { | ||||
| if ((conlist = &pchan->constraints)) { | if ((conlist = &pchan->constraints)) { | ||||
| for (curcon = conlist->first; curcon; curcon = curcon->next) { | for (curcon = conlist->first; curcon; curcon = curcon->next) { | ||||
| /* does this constraint have a subtarget in | /* does this constraint have a subtarget in | ||||
| * this armature? | * this armature? | ||||
| */ | */ | ||||
| const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(curcon); | |||||
| ListBase targets = {NULL, NULL}; | ListBase targets = {NULL, NULL}; | ||||
| bConstraintTarget *ct; | bConstraintTarget *ct; | ||||
| if (cti && cti->get_constraint_targets) { | if (BKE_constraint_targets_get(curcon, &targets)) { | ||||
| cti->get_constraint_targets(curcon, &targets); | |||||
| for (ct = targets.first; ct; ct = ct->next) { | for (ct = targets.first; ct; ct = ct->next) { | ||||
| if ((ct->tar == ob) && (ct->subtarget[0])) { | if ((ct->tar == ob) && (ct->subtarget[0])) { | ||||
| oldtarget = get_named_editbone(editbones, ct->subtarget); | oldtarget = get_named_editbone(editbones, ct->subtarget); | ||||
| if (oldtarget) { | if (oldtarget) { | ||||
| /* was the subtarget bone duplicated too? If | /* was the subtarget bone duplicated too? If | ||||
| * so, update the constraint to point at the | * so, update the constraint to point at the | ||||
| * duplicate of the old subtarget. | * duplicate of the old subtarget. | ||||
| */ | */ | ||||
| Show All 11 Lines | if ((conlist = &pchan->constraints)) { | ||||
| if (newtarget) { | if (newtarget) { | ||||
| BLI_strncpy(ct->subtarget, newtarget->name, sizeof(ct->subtarget)); | BLI_strncpy(ct->subtarget, newtarget->name, sizeof(ct->subtarget)); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (cti->flush_constraint_targets) { | BKE_constraint_targets_flush(curcon, &targets, 0); | ||||
| cti->flush_constraint_targets(curcon, &targets, 0); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void updateDuplicateActionConstraintSettings( | static void updateDuplicateActionConstraintSettings( | ||||
| EditBone *dup_bone, EditBone *orig_bone, Object *ob, bPoseChannel *pchan, bConstraint *curcon) | EditBone *dup_bone, EditBone *orig_bone, Object *ob, bPoseChannel *pchan, bConstraint *curcon) | ||||
| ▲ Show 20 Lines • Show All 1,283 Lines • Show Last 20 Lines | |||||