[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33876] trunk/blender/source/blender: Bugfix #25341

Ton Roosendaal ton at blender.org
Thu Dec 23 14:16:56 CET 2010


Revision: 33876
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33876
Author:   ton
Date:     2010-12-23 14:16:56 +0100 (Thu, 23 Dec 2010)

Log Message:
-----------
Bugfix #25341

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.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/constraint.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/armature/poseobject.c
    trunk/blender/source/blender/editors/object/object_constraint.c
    trunk/blender/source/blender/editors/space_view3d/drawobject.c

Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/constraint.c	2010-12-23 10:34:37 UTC (rev 33875)
+++ trunk/blender/source/blender/blenkernel/intern/constraint.c	2010-12-23 13:16:56 UTC (rev 33876)
@@ -861,6 +861,7 @@
 	}
 }
 
+/* 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 */

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2010-12-23 10:34:37 UTC (rev 33875)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2010-12-23 13:16:56 UTC (rev 33876)
@@ -2200,6 +2200,12 @@
 				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;
 		}
 	}

Modified: trunk/blender/source/blender/editors/armature/poseobject.c
===================================================================
--- trunk/blender/source/blender/editors/armature/poseobject.c	2010-12-23 10:34:37 UTC (rev 33875)
+++ trunk/blender/source/blender/editors/armature/poseobject.c	2010-12-23 13:16:56 UTC (rev 33876)
@@ -1091,7 +1091,7 @@
 	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");
 }
 
 /* ********************************************** */

Modified: trunk/blender/source/blender/editors/object/object_constraint.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_constraint.c	2010-12-23 10:34:37 UTC (rev 33875)
+++ trunk/blender/source/blender/editors/object/object_constraint.c	2010-12-23 13:16:56 UTC (rev 33876)
@@ -1298,7 +1298,7 @@
 		{
 			/* 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;
 			}

Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c	2010-12-23 10:34:37 UTC (rev 33875)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c	2010-12-23 13:16:56 UTC (rev 33876)
@@ -6293,12 +6293,13 @@
 		}
 
 		/* 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);





More information about the Bf-blender-cvs mailing list