[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27758] trunk/blender: 4 Devs in Agreement - End of the Road for Old Track

Joshua Leung aligorith at gmail.com
Fri Mar 26 03:57:50 CET 2010


Revision: 27758
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27758
Author:   aligorith
Date:     2010-03-26 03:57:49 +0100 (Fri, 26 Mar 2010)

Log Message:
-----------
4 Devs in Agreement - End of the Road for Old Track 

This commit removes the Old Track method (used to be found under Object -> Animation -> Track), with all existing instances of this being converted to Track To Constraints. In fact, while performing this removal, I found that this was supposed to have happened in version 2.27 already, but for some reason the options were left in, and this function managed to survive for a further decade.

I've left the tracking axes around still, since it seems some curve tools still use that. However, that usage should probably get faded out in future too?


Misc notes:
* Fixed compiling error with constaints from harkyman's Maintain Volume patch. 
* Subversion of 2.52 now bumped up to .2

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_object.py
    trunk/blender/source/blender/blenkernel/BKE_blender.h
    trunk/blender/source/blender/blenkernel/intern/action.c
    trunk/blender/source/blender/blenkernel/intern/anim.c
    trunk/blender/source/blender/blenkernel/intern/constraint.c
    trunk/blender/source/blender/blenkernel/intern/depsgraph.c
    trunk/blender/source/blender/blenkernel/intern/object.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/object/object_add.c
    trunk/blender/source/blender/editors/object/object_relations.c
    trunk/blender/source/blender/editors/transform/transform_conversions.c
    trunk/blender/source/blender/makesrna/intern/rna_object.c

Modified: trunk/blender/release/scripts/ui/properties_object.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_object.py	2010-03-26 01:31:43 UTC (rev 27757)
+++ trunk/blender/release/scripts/ui/properties_object.py	2010-03-26 02:57:49 UTC (rev 27758)
@@ -268,9 +268,10 @@
             else:
                 layout.prop(ob, "dupli_group", text="")
 
-
+# XXX: the following options are all quite buggy, ancient hacks that should be dropped
 class OBJECT_PT_animation(ObjectButtonsPanel):
-    bl_label = "Animation"
+    bl_label = "Animation Hacks"
+    bl_default_closed = True
 
     def draw(self, context):
         layout = self.layout
@@ -293,16 +294,12 @@
         row.prop(ob, "slow_parent")
         row.active = (ob.parent is not None)
         col.prop(ob, "time_offset", text="Offset")
-
-        if wide_ui:
-            col = split.column()
-        col.label(text="Track:")
-        col.prop(ob, "track", text="")
+		
+        # XXX: these are still used for a few curve-related tracking features
+        col = split.column()
+        col.label(text="Tracking Axes:")
         col.prop(ob, "track_axis", text="Axis")
         col.prop(ob, "up_axis", text="Up Axis")
-        row = col.row()
-        row.prop(ob, "track_override_parent", text="Override Parent")
-        row.active = (ob.parent is not None)
 
 
 # import generic panels from other files
@@ -316,7 +313,7 @@
     OBJECT_PT_groups,
     OBJECT_PT_display,
     OBJECT_PT_duplication,
-    OBJECT_PT_animation,
+    OBJECT_PT_animation, # XXX: panel of old hacks pending to be removed...
 
     OBJECT_PT_motion_paths,
     #OBJECT_PT_onion_skinning,

Modified: trunk/blender/source/blender/blenkernel/BKE_blender.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_blender.h	2010-03-26 01:31:43 UTC (rev 27757)
+++ trunk/blender/source/blender/blenkernel/BKE_blender.h	2010-03-26 02:57:49 UTC (rev 27758)
@@ -45,7 +45,7 @@
 struct Main;
 	
 #define BLENDER_VERSION			252
-#define BLENDER_SUBVERSION		1
+#define BLENDER_SUBVERSION		2
 
 #define BLENDER_MINVERSION		250
 #define BLENDER_MINSUBVERSION	0

Modified: trunk/blender/source/blender/blenkernel/intern/action.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/action.c	2010-03-26 01:31:43 UTC (rev 27757)
+++ trunk/blender/source/blender/blenkernel/intern/action.c	2010-03-26 02:57:49 UTC (rev 27758)
@@ -1063,7 +1063,6 @@
 	copy_m4_m4(workob->parentinv, ob->parentinv);
 	copy_m4_m4(workob->constinv, ob->constinv);
 	workob->parent= ob->parent;
-	workob->track= ob->track;
 	
 	workob->rotmode= ob->rotmode;
 	

Modified: trunk/blender/source/blender/blenkernel/intern/anim.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim.c	2010-03-26 01:31:43 UTC (rev 27757)
+++ trunk/blender/source/blender/blenkernel/intern/anim.c	2010-03-26 02:57:49 UTC (rev 27758)
@@ -668,7 +668,7 @@
 	if(level>MAX_DUPLI_RECUR) return;
 	
 	cfrao= scene->r.cfra;
-	if(ob->parent==NULL && ob->track==NULL && ob->ipo==NULL && ob->constraints.first==NULL) return;
+	if(ob->parent==NULL && ob->constraints.first==NULL) return;
 
 	if(ob->transflag & OB_DUPLINOSPEED) enable_cu_speed= 0;
 	copyob= *ob;	/* store transform info */

Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/constraint.c	2010-03-26 01:31:43 UTC (rev 27757)
+++ trunk/blender/source/blender/blenkernel/intern/constraint.c	2010-03-26 02:57:49 UTC (rev 27758)
@@ -1867,7 +1867,7 @@
 	data->volume = 1.0f;
 }
 
-static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob)
+static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
 {
 	bSameVolumeConstraint *data= con->data;
 
@@ -1896,7 +1896,6 @@
 			}
 			break;
 	}
-
 }
 
 static bConstraintTypeInfo CTI_SAMEVOL = {

Modified: trunk/blender/source/blender/blenkernel/intern/depsgraph.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/depsgraph.c	2010-03-26 01:31:43 UTC (rev 27757)
+++ trunk/blender/source/blender/blenkernel/intern/depsgraph.c	2010-03-26 02:57:49 UTC (rev 27758)
@@ -468,11 +468,6 @@
 		
 		addtoroot = 0;
 	}
-	if (ob->track) {
-		node2 = dag_get_node(dag,ob->track);
-		dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Track To");
-		addtoroot = 0;
-	}
 	if (ob->proxy) {
 		node2 = dag_get_node(dag, ob->proxy);
 		dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Proxy");

Modified: trunk/blender/source/blender/blenkernel/intern/object.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/object.c	2010-03-26 01:31:43 UTC (rev 27757)
+++ trunk/blender/source/blender/blenkernel/intern/object.c	2010-03-26 02:57:49 UTC (rev 27758)
@@ -361,11 +361,6 @@
 			obt->recalc |= OB_RECALC;
 		}
 		
-		if(obt->track==ob) {
-			obt->track= NULL;
-			obt->recalc |= OB_RECALC_OB;
-		}
-		
 		modifiers_foreachObjectLink(obt, unlink_object__unlinkModifierLinks, ob);
 		
 		if ELEM(obt->type, OB_CURVE, OB_FONT) {
@@ -2037,31 +2032,6 @@
 		object_to_mat4(ob, ob->obmat);
 	}
 
-	/* Handle tracking */
-	if(ob->track) {
-		/* Try to remove this tracking relationship if we can easily detect that
-		 * it is cyclic (i.e. direct tracking), and bound to cause us troubles.
-		 * For the other cases (i.e. a cyclic triangle, and higher orders), we can't
-		 * easily detect or know how to remove those relationships, safely, so just
-		 * let them be (with warnings).
-		 * Of course, this could also be a simple track that doesn't do anything bad either :)
-		 */
-		if (ob->track->track == ob) {
-			printf("Removed direct cyclic tracking between %s and %s\n", ob->id.name+2, ob->track->id.name+2);
-			ob->track->track = NULL;
-			ob->track = NULL;
-		}
-		else {
-			/* NOTE: disabled recursive recalc for tracking for now, since this causes crashes
-			 * when users create cyclic dependencies (stack overflow). Really, this step ought
-			 * not to be needed anymore with the depsgraph, though this may not be the case.
-			 * -- Aligorith, 2010 Mar 26
-			 */
-			//if( ctime != ob->track->ctime) where_is_object_time(scene, ob->track, ctime);
-			solve_tracking(ob, ob->track->obmat);
-		}
-	}
-
 	/* solve constraints */
 	if (ob->constraints.first && !(ob->flag & OB_NO_CONSTRAINTS)) {
 		bConstraintOb *cob;
@@ -2157,34 +2127,7 @@
 	}
 
 }
-void solve_tracking (Object *ob, float targetmat[][4])
-{
-	float quat[4];
-	float vec[3];
-	float totmat[3][3];
-	float tmat[4][4];
-	
-	sub_v3_v3v3(vec, ob->obmat[3], targetmat[3]);
-	vec_to_quat( quat,vec, ob->trackflag, ob->upflag);
-	quat_to_mat3( totmat,quat);
-	
-	if(ob->parent && (ob->transflag & OB_POWERTRACK)) {
-		/* 'temporal' : clear parent info */
-		object_to_mat4(ob, tmat);
-		tmat[0][3]= ob->obmat[0][3];
-		tmat[1][3]= ob->obmat[1][3];
-		tmat[2][3]= ob->obmat[2][3];
-		tmat[3][0]= ob->obmat[3][0];
-		tmat[3][1]= ob->obmat[3][1];
-		tmat[3][2]= ob->obmat[3][2];
-		tmat[3][3]= ob->obmat[3][3];
-	}
-	else copy_m4_m4(tmat, ob->obmat);
-	
-	mul_m4_m3m4(ob->obmat, totmat, tmat);
 
-}
-
 void where_is_object(struct Scene *scene, Object *ob)
 {
 	where_is_object_time(scene, ob, (float)scene->r.cfra);
@@ -2204,12 +2147,6 @@
 	int a;
 	
 	/* NO TIMEOFFS */
-	
-	/* no ipo! (because of dloc and realtime-ipos) */
-		// XXX old animation system
-	//ipo= ob->ipo;
-	//ob->ipo= NULL;
-
 	if(ob->parent) {
 		par= ob->parent;
 		
@@ -2231,9 +2168,6 @@
 		object_to_mat4(ob, ob->obmat);
 	}
 	
-	if(ob->track) 
-		solve_tracking(ob, ob->track->obmat);
-
 	/* solve constraints */
 	if (ob->constraints.first) {
 		bConstraintOb *cob;
@@ -2242,10 +2176,6 @@
 		solve_constraints(&ob->constraints, cob, (float)scene->r.cfra);
 		constraints_clear_evalob(cob);
 	}
-	
-	/*  WATCH IT!!! */
-		// XXX old animation system
-	//ob->ipo= ipo;
 }
 
 /* for calculation of the inverse parent transform, only used for editor */
@@ -2257,7 +2187,6 @@
 	unit_m4(workob->parentinv);
 	unit_m4(workob->constinv);
 	workob->parent= ob->parent;
-	workob->track= ob->track;
 
 	workob->trackflag= ob->trackflag;
 	workob->upflag= ob->upflag;

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2010-03-26 01:31:43 UTC (rev 27757)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2010-03-26 02:57:49 UTC (rev 27758)
@@ -6426,6 +6426,25 @@
 	}
 }
 
+/* NOTE: this version patch is intended for versions < 2.52.2, but was initially introduced in 2.27 already */
+static void do_version_old_trackto_to_constraints(Object *ob)
+{
+	/* create new trackto constraint from the relationship */
+	if (ob->track)
+	{
+		bConstraint *con= add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO);
+		bTrackToConstraint *data = con->data;
+		
+		/* copy tracking settings from the object */
+		data->tar = ob->track;
+		data->reserved1 = ob->trackflag;
+		data->reserved2 = ob->upflag;
+	}
+	
+	/* clear old track setting */
+	ob->track = NULL;
+}
+
 static void do_versions(FileData *fd, Library *lib, Main *main)
 {
 	/* WATCH IT!!!: pointers from libdata have not been converted */
@@ -7248,36 +7267,7 @@
 			}
 
 			/* Change Ob->Track in real TrackTo constraint */
-
-			if (ob->track){
-				bConstraint *con;
-				bConstraintTypeInfo *cti;
-				bTrackToConstraint *data;
-				void *cdata;
-
-				list = &ob->constraints;
-				if (list)
-				{
-					con = MEM_callocN(sizeof(bConstraint), "constraint");
-					strcpy (con->name, "AutoTrack");
-					unique_constraint_name(con, list);
-					con->flag |= CONSTRAINT_EXPAND;
-					con->enforce=1.0F;
-					con->type = CONSTRAINT_TYPE_TRACKTO;
-					
-					cti= get_constraint_typeinfo(CONSTRAINT_TYPE_TRACKTO);
-					cdata= MEM_callocN(cti->size, cti->structName);
-					cti->new_data(cdata);
-					data = (bTrackToConstraint *)cdata;
-					
-					data->tar = ob->track;
-					data->reserved1 = ob->trackflag;
-					data->reserved2 = ob->upflag;
-					con->data= (void*) data;
-					BLI_addtail(list, con);
-				}
-				ob->track = 0;
-			}
+			do_version_old_trackto_to_constraints(ob);
 			
 			ob = ob->id.next;
 		}
@@ -10695,8 +10685,16 @@

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list