Revision: 34702
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34702
Author:   aligorith
Date:     2011-02-07 23:21:28 +0000 (Mon, 07 Feb 2011)
Log Message:
-----------
Bugfix: Constraint target validation code was broken

While testing Apply Visual transforms last night, I noticed that
setting a constraint to use its owner as its target was allowed and
didn't trigger any warnings. This clearly doesn't do any good and is
different from the old behaviour.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/object/object_constraint.c

Modified: trunk/blender/source/blender/editors/object/object_constraint.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_constraint.c     
2011-02-07 22:48:23 UTC (rev 34701)
+++ trunk/blender/source/blender/editors/object/object_constraint.c     
2011-02-07 23:21:28 UTC (rev 34702)
@@ -405,11 +405,26 @@
                                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;
                                                }
                                        }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to