Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/editors/object/object_constraint.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index f695f112bc0..e92d73a3e67 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -405,11 +405,26 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
for (ct= targets.first; ct; ct= ct->next) {
/* general validity checks (for those constraints that need this) */
if (exist_object(ct->tar) == 0) {
+ /* object doesn't exist, but constraint requires target */
ct->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
}
else if (ct->tar == owner) {
- if (!get_named_bone(get_armature(owner), ct->subtarget)) {
+ if (type == CONSTRAINT_OBTYPE_BONE) {
+ if (!get_named_bone(get_armature(owner), ct->subtarget)) {
+ /* bone must exist in armature... */
+ // TODO: clear subtarget?
+ curcon->flag |= CONSTRAINT_DISABLE;
+ }
+ else if (strcmp(pchan->name, ct->subtarget) == 0) {
+ /* cannot target self */
+ ct->subtarget[0] = '\0';
+ curcon->flag |= CONSTRAINT_DISABLE;
+ }
+ }
+ else {
+ /* cannot use self as target */
+ ct->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
}
}