Bugfix #25341
authorTon Roosendaal <ton@blender.org>
Thu, 23 Dec 2010 13:16:56 +0000 (13:16 +0000)
committerTon Roosendaal <ton@blender.org>
Thu, 23 Dec 2010 13:16:56 +0000 (13:16 +0000)
Child-of constraint issue: on adding, it wasn't checking owner
correctly for Bones, resulting in a constraint working in wrong
space; it looked as if transform was applied double when moving
the object. Only adding via Py API went wrong btw.

Also found a silly check for drawing constraints, which caused
constraint initialization to happen for every object on every
redraw!

Implementation note: con->flag CONSTRAINT_SPACEONCE was only used
for child-of constraints in Bones, so I've patched it on file
reading to always set the flag. Marked with XXX, so it can be
removed one day. Now at least things get corrected well for
imported armatures.

source/blender/blenkernel/intern/constraint.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/armature/poseobject.c
source/blender/editors/object/object_constraint.c
source/blender/editors/space_view3d/drawobject.c

index bb0fc23c02c39705e170b1f98be06ccbd8ada9ce..b0932533ea6da35d4aa2d7b7a4969f152eddea7e 100644 (file)
@@ -861,6 +861,7 @@ static void childof_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
        }
 }
 
+/* XXX note, con->flag should be CONSTRAINT_SPACEONCE for bone-childof, patched in readfile.c */
 static bConstraintTypeInfo CTI_CHILDOF = {
        CONSTRAINT_TYPE_CHILDOF, /* type */
        sizeof(bChildOfConstraint), /* size */
index e86daf0ce4b0ac84430496311283c92034060a5e..b711d704d2d9172d06873e61ab03ad5e7da47fc6 100644 (file)
@@ -2199,6 +2199,12 @@ static void direct_link_constraints(FileData *fd, ListBase *lb)
                        {
                                con->lin_error = 0.f;
                                con->rot_error = 0.f;
+                       }
+                       case CONSTRAINT_TYPE_CHILDOF:
+                       {
+                               /* XXX version patch, in older code this flag wasn't always set, and is inherent to type */
+                               if(con->ownspace == CONSTRAINT_SPACE_POSE)
+                                       con->flag |= CONSTRAINT_SPACEONCE;
                        }
                                break;
                }
index 2db9b43519831142ad70d25814b76b1a0a80a0a5..bea7155291bb173c90044b4be9fa2657121675ac 100644 (file)
@@ -1091,7 +1091,7 @@ void POSE_OT_paste (wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* properties */
-       RNA_def_boolean(ot->srna, "flipped", 0, "Flipped on X-Axis", "");
+       RNA_def_boolean(ot->srna, "flipped", 0, "Flipped on X-Axis", "Paste the stored pose flipped on to current pose");
 }
 
 /* ********************************************** */
index f856ab7649ca1e40335151f9d6b383c57914f5eb..5afba182cc03a0677392534d58c74f7549ba5338 100644 (file)
@@ -1298,7 +1298,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
                {
                        /* if this constraint is being added to a posechannel, make sure
                         * the constraint gets evaluated in pose-space */
-                       if (ob->mode & OB_MODE_POSE) {
+                       if (pchan) {
                                con->ownspace = CONSTRAINT_SPACE_POSE;
                                con->flag |= CONSTRAINT_SPACEONCE;
                        }
index b6d0efa26c5367fb629ff5cd9b85d1290e93468d..1f1acef02db4281f8e8f0d6d706f0073d7f8dbd4 100644 (file)
@@ -6293,12 +6293,13 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
                }
 
                /* Drawing the constraint lines */
-               list = &ob->constraints;
-               if (list) {
+               if (ob->constraints.first) {
                        bConstraint *curcon;
                        bConstraintOb *cob;
                        unsigned char col1[4], col2[4];
                        
+                       list = &ob->constraints;
+                       
                        UI_GetThemeColor3ubv(TH_GRID, col1);
                        UI_make_axis_color(col1, col2, 'Z');
                        glColor3ubv(col2);