Revision: 34710
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34710
Author:   aligorith
Date:     2011-02-08 05:51:20 +0000 (Tue, 08 Feb 2011)
Log Message:
-----------
Bugfix [#25814] ChildOf constraint: double transformation in object
mode with drivers

ChildOf constraints added using the PoseBone.constraints.new() method
via Python scripts instead of using the operator (this latter method
is still the preferred/recommended method) were not getting some
critical flags set, causing errors arising from space conversions
being performed more than once.

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

Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/constraint.c 2011-02-08 
03:37:49 UTC (rev 34709)
+++ trunk/blender/source/blender/blenkernel/intern/constraint.c 2011-02-08 
05:51:20 UTC (rev 34710)
@@ -4148,6 +4148,21 @@
                constraints_set_active(list, con);
        }
        
+       /* set type+owner specific immutable settings */
+       // TODO: does action constraint need anything here - i.e. spaceonce?
+       switch (type) {
+               case CONSTRAINT_TYPE_CHILDOF:
+               {
+                       /* if this constraint is being added to a posechannel, 
make sure
+                        * the constraint gets evaluated in pose-space */
+                       if (pchan) {
+                               con->ownspace = CONSTRAINT_SPACE_POSE;
+                               con->flag |= CONSTRAINT_SPACEONCE;
+                       }
+               }
+                       break;
+       }
+       
        return con;
 }
 

Modified: trunk/blender/source/blender/editors/object/object_constraint.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_constraint.c     
2011-02-08 03:37:49 UTC (rev 34709)
+++ trunk/blender/source/blender/editors/object/object_constraint.c     
2011-02-08 05:51:20 UTC (rev 34710)
@@ -1272,12 +1272,12 @@
        bPoseChannel *pchan;
        bConstraint *con;
        
-       if(list == &ob->constraints) {
+       if (list == &ob->constraints) {
                pchan= NULL;
        }
        else {
                pchan= get_active_posechannel(ob);
-
+               
                /* ensure not to confuse object/pose adding */
                if (pchan == NULL) {
                        BKE_report(op->reports, RPT_ERROR, "No active pose bone 
to add a constraint to.");
@@ -1327,19 +1327,7 @@
        }
        
        /* do type-specific tweaking to the constraint settings  */
-       // TODO: does action constraint need anything here - i.e. spaceonce?
        switch (type) {
-               case CONSTRAINT_TYPE_CHILDOF:
-               {
-                       /* if this constraint is being added to a posechannel, 
make sure
-                        * the constraint gets evaluated in pose-space */
-                       if (pchan) {
-                               con->ownspace = CONSTRAINT_SPACE_POSE;
-                               con->flag |= CONSTRAINT_SPACEONCE;
-                       }
-               }
-                       break;
-                       
                case CONSTRAINT_TYPE_PYTHON: // FIXME: this code is not really 
valid anymore
                {
 #ifdef WITH_PYTHON

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

Reply via email to