4 Devs in Agreement - End of the Road for Old Track
authorJoshua Leung <aligorith@gmail.com>
Fri, 26 Mar 2010 02:57:49 +0000 (02:57 +0000)
committerJoshua Leung <aligorith@gmail.com>
Fri, 26 Mar 2010 02:57:49 +0000 (02:57 +0000)
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

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

index 73f0a6fe5c22d363430ec9be642ba35500f97889..5c13d778049e4f0a750c38adf3be1b752d26ee4e 100644 (file)
@@ -268,9 +268,10 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
             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 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
         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 @@ classes = [
     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,
index 6b656f1d12e78d2b2cb136be54520afaefe1e6ba..8865757b85a464c8fd2d873ad88cce65ad8595c4 100644 (file)
@@ -45,7 +45,7 @@ struct Scene;
 struct Main;
        
 #define BLENDER_VERSION                        252
-#define BLENDER_SUBVERSION             1
+#define BLENDER_SUBVERSION             2
 
 #define BLENDER_MINVERSION             250
 #define BLENDER_MINSUBVERSION  0
index afd0b3a0f5797e53beec538def0b8ae07d877eb7..52f59c1681a15e3285acfa40127b9385d54f55b9 100644 (file)
@@ -1063,7 +1063,6 @@ void what_does_obaction (Scene *scene, Object *ob, Object *workob, bPose *pose,
        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;
        
index b2ac32da1388e3b63c9819c38dc2b27be599bfe9..1465f4550f5d4456af133557509911032074bcf4 100644 (file)
@@ -668,7 +668,7 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int level,
        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 */
index 3ab5e9442b4ae4cde0372f214e5cd47640ca892f..7994849a469944621fb0c4e262ae3ab65c63db5b 100644 (file)
@@ -1867,7 +1867,7 @@ static void samevolume_new_data (void *cdata)
        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 @@ static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob)
                        }
                        break;
        }
-
 }
 
 static bConstraintTypeInfo CTI_SAMEVOL = {
index 4e0270315ad2d0f0ac1cd35831c111cec511638b..86cafa733ffa2af58b5e01e9aa56b32e3da6b54f 100644 (file)
@@ -468,11 +468,6 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
                
                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");
index 2026bb3da6e6d18d9894df77cac3432ef82bba02..b9e4894a868fe6b968bea0f7f0ec3fc6e6d8fe65 100644 (file)
@@ -361,11 +361,6 @@ void unlink_object(Scene *scene, Object *ob)
                        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 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime)
                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;
@@ -2156,33 +2126,6 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[
                }
        }
 
-}
-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)
@@ -2204,12 +2147,6 @@ for a lamp that is the child of another object */
        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 @@ for a lamp that is the child of another object */
                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 @@ for a lamp that is the child of another object */
                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 @@ void what_does_parent(Scene *scene, Object *ob, Object *workob)
        unit_m4(workob->parentinv);
        unit_m4(workob->constinv);
        workob->parent= ob->parent;
-       workob->track= ob->track;
 
        workob->trackflag= ob->trackflag;
        workob->upflag= ob->upflag;
index dbdd1685c816c1a88575a0f247a7317a9aea7f24..58443a73b969e36b8bfbfd10f52bb5702ec3cbbf 100644 (file)
@@ -6426,6 +6426,25 @@ static void do_version_constraints_radians_degrees_250(ListBase *lb)
        }
 }
 
+/* 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 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        }
 
                        /* 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 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                node= node->next;
                        }
                }
-
        }
+       
+       /* old-track -> constraints (this time we're really doing it!) */
+       if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 2)) {
+               Object *ob;
+               
+               for (ob = main->object.first; ob; ob = ob->id.next)
+                       do_version_old_trackto_to_constraints(ob);
+       }
+       
        /* put 2.50 compatibility code here until next subversion bump */
        {
                
index 921a56142d4e743026a1221de802ace42cf5db6c..a2070771844f5c4d739e1fb80e23132bf7ab1673 100644 (file)
@@ -973,10 +973,6 @@ static void copy_object_set_idnew(bContext *C, int dupflag)
 {
        Material *ma, *mao;
        ID *id;
-#if 0 // XXX old animation system
-       Ipo *ipo;
-       bActionStrip *strip;
-#endif // XXX old animation system
        int a;
        
        /* XXX check object pointers */
@@ -990,17 +986,8 @@ static void copy_object_set_idnew(bContext *C, int dupflag)
                }
                modifiers_foreachIDLink(ob, copy_object__forwardModifierLinks, NULL);
                ID_NEW(ob->parent);
-               ID_NEW(ob->track);
                ID_NEW(ob->proxy);
                ID_NEW(ob->proxy_group);
-               
-#if 0 // XXX old animation system
-               for(strip= ob->nlastrips.first; strip; strip= strip->next) {
-                       bActionModifier *amod;
-                       for(amod= strip->modifiers.first; amod; amod= amod->next)
-                               ID_NEW(amod->ob);
-               }
-#endif // XXX old animation system
        }
        CTX_DATA_END;
        
index e89bde00ce73d4429647ab28062c51919ec472e7..52d6a7a7b8b4b1cbf1d6ffcb43f4c2aef8d831c4 100644 (file)
@@ -405,7 +405,7 @@ void OBJECT_OT_proxy_make (wmOperatorType *ot)
 
 static EnumPropertyItem prop_clear_parent_types[] = {
        {0, "CLEAR", 0, "Clear Parent", ""},
-       {1, "CLEAR_KEEP_TRANSFORM", 0, "Clear and Keep Transformation (Clear Track)", ""},
+       {1, "CLEAR_KEEP_TRANSFORM", 0, "Clear and Keep Transformation", ""},
        {2, "CLEAR_INVERSE", 0, "Clear Parent Inverse", ""},
        {0, NULL, 0, NULL, NULL}
 };
@@ -422,7 +422,6 @@ static int parent_clear_exec(bContext *C, wmOperator *op)
                }                       
                else if(type == 1) {
                        ob->parent= NULL;
-                       ob->track= NULL;
                        object_apply_mat4(ob, ob->obmat);
                }
                else if(type == 2)
@@ -916,7 +915,6 @@ static EnumPropertyItem prop_make_track_types[] = {
        {1, "DAMPTRACK", 0, "Damped Track Constraint", ""},
        {2, "TRACKTO", 0, "Track To Constraint", ""},
        {3, "LOCKTRACK", 0, "Lock Track Constraint", ""},
-       {4, "OLDTRACK", 0, "Old Track", ""},
        {0, NULL, 0, NULL, NULL}
 };
 
@@ -988,15 +986,6 @@ static int track_set_exec(bContext *C, wmOperator *op)
                }
                CTX_DATA_END;
        }
-       else {
-               CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
-                       if(ob!=obact) {
-                               ob->track= obact;
-                               ob->recalc |= OB_RECALC;
-                       }
-               }
-               CTX_DATA_END;
-       }
        
        DAG_scene_sort(scene);
        DAG_ids_flush_update(0);
@@ -1353,7 +1342,6 @@ void single_object_users(Scene *scene, View3D *v3d, int flag)
                        modifiers_foreachObjectLink(base->object, single_object_users__forwardModifierLinks, NULL);
                        
                        ID_NEW(ob->parent);
-                       ID_NEW(ob->track);
                }
        }
 
@@ -1732,7 +1720,6 @@ static int make_local_exec(bContext *C, wmOperator *op)
        CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
                if(ob->id.lib==NULL) {
                        ID_NEW(ob->parent);
-                       ID_NEW(ob->track);
                }
        }
        CTX_DATA_END;
index 8e8e2aeb5af0e6399a0199e552f8d6185bdee32f..eed6c65362c7fa760cbb95d52f703187aa376c20 100644 (file)
@@ -4180,10 +4180,7 @@ static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *
        if (t->mode == TFM_DUMMY)
                skip_invert = 1;
 
-       if (skip_invert == 0 && (ob->track || constinv==0)) {
-               track= ob->track;
-               ob->track= NULL;
-               
+       if (skip_invert == 0 && constinv == 0) {
                if (constinv == 0)
                        ob->transflag |= OB_NO_CONSTRAINTS; /* where_is_object_time checks this */
                
@@ -4191,8 +4188,6 @@ static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *
                
                if (constinv == 0)
                        ob->transflag &= ~OB_NO_CONSTRAINTS;
-               
-               ob->track= track;
        }
        else
                where_is_object(t->scene, ob);
index 3823af25619e0f4c7516ae0424b822845d087889..a3a20376026acb2d2b8b99d777d49f3495148679 100644 (file)
@@ -1474,7 +1474,7 @@ static void rna_def_object(BlenderRNA *brna)
        RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL);
        RNA_def_property_ui_text(prop, "Bound Box", "Objects bound box in object-space coords");
 
-       /* parent and track */
+       /* parent */
        prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_parent_set", NULL);
        RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
@@ -1500,16 +1500,13 @@ static void rna_def_object(BlenderRNA *brna)
        RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Object_parent_bone_set");
        RNA_def_property_ui_text(prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation");
        RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
-
-       prop= RNA_def_property(srna, "track", PROP_POINTER, PROP_NONE);
-       RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
-       RNA_def_property_ui_text(prop, "Track", "Object being tracked to define the rotation (Old Track)");
-       RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
-
+       
+       /* Track and Up flags */
+       // XXX: these have been saved here for a bit longer (after old track was removed), since some other tools still refer to this
        prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "trackflag");
        RNA_def_property_enum_items(prop, track_items);
-       RNA_def_property_ui_text(prop, "Track Axis", "Tracking axis pointing to the tracked object");
+       RNA_def_property_ui_text(prop, "Track Axis", "Axis that points in 'forward' direction");
        RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
 
        prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
@@ -1517,7 +1514,7 @@ static void rna_def_object(BlenderRNA *brna)
        RNA_def_property_enum_items(prop, up_items);
        RNA_def_property_ui_text(prop, "Up Axis", "Axis that points in the upward direction");
        RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
-
+       
        /* proxy */
        prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
        RNA_def_property_ui_text(prop, "Proxy", "Library object this proxy object controls");
@@ -1781,11 +1778,7 @@ static void rna_def_object(BlenderRNA *brna)
        rna_def_motionpath_common(srna);
        
        /* duplicates */
-       prop= RNA_def_property(srna, "track_override_parent", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_POWERTRACK);
-       RNA_def_property_ui_text(prop, "Track Override Parent", "Override rotation from parenting");
-       RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
-
+               // XXX: evil old crap
        prop= RNA_def_property(srna, "slow_parent", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "partype", PARSLOW);
        RNA_def_property_ui_text(prop, "Slow Parent", "Create a delay in the parent relationship");