[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23391] trunk/blender/source/blender: 2. 5 - Partial Bugfixes for Parenting Objects to Curves (Ctrl-P)

Joshua Leung aligorith at gmail.com
Mon Sep 21 14:09:02 CEST 2009


Revision: 23391
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23391
Author:   aligorith
Date:     2009-09-21 14:09:00 +0200 (Mon, 21 Sep 2009)

Log Message:
-----------
2.5 - Partial Bugfixes for Parenting Objects to Curves (Ctrl-P)

* Path Constraint option (i.e. this creates a follow-path constraint but doesn't actually parent the object to the curve) works now. Fixed a crash here too.

* Follow Path option (i.e. parent the object to the curve, and follow it), is not working correctly yet. Some matrix seems to get set wrongly.

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

Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/constraint.c	2009-09-21 10:57:46 UTC (rev 23390)
+++ trunk/blender/source/blender/blenkernel/intern/constraint.c	2009-09-21 12:09:00 UTC (rev 23391)
@@ -1188,7 +1188,10 @@
 		if (cu->path && cu->path->data) {
 			if ((data->followflag & FOLLOWPATH_STATIC) == 0) { 
 				/* animated position along curve depending on time */
-				curvetime= bsystem_time(cob->scene, ct->tar, ctime, 0.0) - data->offset;
+				if (cob->scene)
+					curvetime= bsystem_time(cob->scene, ct->tar, ctime, 0.0) - data->offset;
+				else	
+					curvetime= ctime - data->offset;
 				
 				/* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
 				 * but this will only work if it actually is animated... 

Modified: trunk/blender/source/blender/editors/object/object_relations.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_relations.c	2009-09-21 10:57:46 UTC (rev 23390)
+++ trunk/blender/source/blender/editors/object/object_relations.c	2009-09-21 12:09:00 UTC (rev 23391)
@@ -566,8 +566,9 @@
 			}
 			else cu->flag |= CU_FOLLOW;
 			
-			/* fall back on regular parenting now */
-			partype= PAR_OBJECT;
+			/* fall back on regular parenting now (for follow only) */
+			if(partype == PAR_FOLLOW)
+				partype= PAR_OBJECT;
 		}		
 	}
 	else if(partype==PAR_BONE) {
@@ -593,7 +594,9 @@
 				/* apply transformation of previous parenting */
 				ED_object_apply_obmat(ob);
 				
-				ob->parent= par;
+				/* set the parent (except for follow-path constraint option) */
+				if(partype != PAR_PATH_CONST)
+					ob->parent= par;
 				
 				/* handle types */
 				if (pchan)
@@ -602,7 +605,7 @@
 					ob->parsubstr[0]= 0;
 				
 				/* constraint */
-				if(partype==PAR_PATH_CONST) {
+				if(partype == PAR_PATH_CONST) {
 					bConstraint *con;
 					bFollowPathConstraint *data;
 					float cmat[4][4], vec[3];
@@ -620,6 +623,7 @@
 					
 					ob->loc[0] = vec[0];
 					ob->loc[1] = vec[1];
+					ob->loc[2] = vec[2];
 				}
 				else if(pararm && ob->type==OB_MESH && par->type == OB_ARMATURE) {
 					if(partype == PAR_ARMATURE_NAME)
@@ -645,6 +649,8 @@
 				
 				ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
 				
+				if(partype == PAR_PATH_CONST)
+					; /* don't do anything here, since this is not technically "parenting" */
 				if( ELEM(partype, PAR_CURVE, PAR_LATTICE) || pararm )
 					ob->partype= PARSKEL; /* note, dna define, not operator property */
 				else if (partype == PAR_BONE)





More information about the Bf-blender-cvs mailing list