[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24539] trunk/blender/source/blender/ blenkernel/intern/armature.c: Spline IK: Fixes for the crashes with non-existant path data that are applied elsewhere

Joshua Leung aligorith at gmail.com
Fri Nov 13 00:27:35 CET 2009


Revision: 24539
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24539
Author:   aligorith
Date:     2009-11-13 00:27:33 +0100 (Fri, 13 Nov 2009)

Log Message:
-----------
Spline IK: Fixes for the crashes with non-existant path data that are applied elsewhere

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/armature.c

Modified: trunk/blender/source/blender/blenkernel/intern/armature.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/armature.c	2009-11-12 23:12:34 UTC (rev 24538)
+++ trunk/blender/source/blender/blenkernel/intern/armature.c	2009-11-12 23:27:33 UTC (rev 24539)
@@ -1632,7 +1632,7 @@
 /* ----------- */
 
 /* Tag the bones in the chain formed by the given bone for IK */
-static void splineik_init_tree_from_pchan(Object *ob, bPoseChannel *pchan_tip)
+static void splineik_init_tree_from_pchan(Scene *scene, Object *ob, bPoseChannel *pchan_tip)
 {
 	bPoseChannel *pchan, *pchanRoot=NULL;
 	bPoseChannel *pchanChain[255];
@@ -1661,6 +1661,21 @@
 	}
 	if (con == NULL)
 		return;
+		
+	/* make sure that the constraint targets are ok 
+	 *	- this is a workaround for a depsgraph bug...
+	 */
+	if (ikData->tar) {
+		Curve *cu= ikData->tar->data;
+		
+		/* note: when creating constraints that follow path, the curve gets the CU_PATH set now,
+		 *		currently for paths to work it needs to go through the bevlist/displist system (ton) 
+		 */
+		
+		/* only happens on reload file, but violates depsgraph still... fix! */
+		if ((cu->path==NULL) || (cu->path->data==NULL))
+			makeDispListCurveTypes(scene, ikData->tar, 0);
+	}
 	
 	/* find the root bone and the chain of bones from the root to the tip 
 	 * NOTE: this assumes that the bones are connected, but that may not be true...
@@ -1743,7 +1758,7 @@
 		
 		/* get the current length of the curve */
 		// NOTE: this is assumed to be correct even after the curve was resized
-		splineLen= (cu->path)? cu->path->totdist: 1.0f;
+		splineLen= cu->path->totdist;
 		
 		/* calculate the scale factor to multiply all the path values by so that the 
 		 * bone chain retains its current length, such that
@@ -1800,7 +1815,7 @@
 	/* find the tips of Spline IK chains, which are simply the bones which have been tagged as such */
 	for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
 		if (pchan->constflag & PCHAN_HAS_SPLINEIK)
-			splineik_init_tree_from_pchan(ob, pchan);
+			splineik_init_tree_from_pchan(scene, ob, pchan);
 	}
 }
 





More information about the Bf-blender-cvs mailing list