Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2010-03-26 05:57:49 +0300
committerJoshua Leung <aligorith@gmail.com>2010-03-26 05:57:49 +0300
commit3c872daa59774abaf3f53acaa2baf876e54308a5 (patch)
tree3ea1248e6675d16e0eebb8b154992115fa53c6f0 /source/blender/blenloader
parentfda6082c682dcd8275f752e9a968ba4aa6e05441 (diff)
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
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c60
1 files changed, 29 insertions, 31 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index dbdd1685c81..58443a73b96 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -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 */
{