Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/armature/armature_naming.c
| Show First 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | static void constraint_bone_name_fix(Object *ob, | ||||
| ListBase *conlist, | ListBase *conlist, | ||||
| const char *oldname, | const char *oldname, | ||||
| const char *newname) | const char *newname) | ||||
| { | { | ||||
| bConstraint *curcon; | bConstraint *curcon; | ||||
| bConstraintTarget *ct; | bConstraintTarget *ct; | ||||
| for (curcon = conlist->first; curcon; curcon = curcon->next) { | for (curcon = conlist->first; curcon; curcon = curcon->next) { | ||||
| const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(curcon); | |||||
| ListBase targets = {NULL, NULL}; | ListBase targets = {NULL, NULL}; | ||||
| /* constraint targets */ | /* constraint targets */ | ||||
| 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) { | if (ct->tar == ob) { | ||||
| if (STREQ(ct->subtarget, oldname)) { | if (STREQ(ct->subtarget, oldname)) { | ||||
| BLI_strncpy(ct->subtarget, newname, MAXBONENAME); | BLI_strncpy(ct->subtarget, newname, MAXBONENAME); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (cti->flush_constraint_targets) { | BKE_constraint_targets_flush(curcon, &targets, 0); | ||||
| cti->flush_constraint_targets(curcon, &targets, 0); | |||||
| } | |||||
| } | } | ||||
| /* action constraints */ | /* action constraints */ | ||||
| if (curcon->type == CONSTRAINT_TYPE_ACTION) { | if (curcon->type == CONSTRAINT_TYPE_ACTION) { | ||||
| bActionConstraint *actcon = (bActionConstraint *)curcon->data; | bActionConstraint *actcon = (bActionConstraint *)curcon->data; | ||||
| BKE_action_fix_paths_rename(&ob->id, actcon->act, "pose.bones", oldname, newname, 0, 0, 1); | BKE_action_fix_paths_rename(&ob->id, actcon->act, "pose.bones", oldname, newname, 0, 0, 1); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 462 Lines • Show Last 20 Lines | |||||