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-01-26 06:16:14 +0300
committerJoshua Leung <aligorith@gmail.com>2010-01-26 06:16:14 +0300
commit14d4feca576e78d3707872bfb8b29c749bb20572 (patch)
tree1f9b6fa131a1011ea6d4f60876b3fccca2ca8e78 /source/blender/blenloader
parente6a23762da3f6b88da21669b7ae30c834ace2f55 (diff)
Radians vs Degrees: The Second Attempt
F-Curves now internally store radians again instead of degrees. - This solves problems with inconsistencies when working with drivers. - No need to version patch old files, potentially screwing them up. As such, removed the version patching for F-Curves. - Is better suited to optionally showing radians throughout the UI instead or degrees. As a result, values are now converted on the fly in the Graph Editor for display and operators that operate on values. I've made the conversion system for this rather general, so that other unit type conversions can also be hooked up with the type conversion backend. Also, made some tweaks to F-Curve RNA wrapping to make it represent the data better. TODO: - Transform code currently still needs to be corrected to work with these changes. Currently moving keyframes for rotation curves will make them change too rapidly vertically when using degrees.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c65
1 files changed, 6 insertions, 59 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 141fcce96ac..46051555a81 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6459,50 +6459,10 @@ static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype)
}
}
-static void do_version_fcurves_radians_degrees_250(ListBase *lb, char *propname)
-{
- FCurve *fcu;
- FModifier *fcm;
- int i;
-
- for (fcu=lb->first; fcu; fcu=fcu->next) {
- if (strstr(fcu->rna_path, propname)) {
- if (fcu->bezt) {
- for (i=0; i<fcu->totvert; i++) {
- BezTriple *bt = fcu->bezt+i;
-
- bt->vec[0][1] *= 180.0/M_PI;
- bt->vec[1][1] *= 180.0/M_PI;
- bt->vec[2][1] *= 180.0/M_PI;
- }
- }
- else if (fcu->fpt) {
- for (i=0; i<fcu->totvert; i++) {
- FPoint *fpt = fcu->fpt+i;
-
- fpt->vec[1] *= 180.0/M_PI;
- }
- }
-
- for (fcm= fcu->modifiers.first; fcm; fcm= fcm->next) {
- if (fcm->type == FMODIFIER_TYPE_GENERATOR) {
- FMod_Generator *data= (FMod_Generator *)fcm->data;
-
- for (i=0; i<data->arraysize; i++)
- data->coefficients[i] *= 180/M_PI;
- }
- }
-
- fcu->flag |= FCURVE_ROTATION_DEGREES;
- }
- }
-}
-
static void do_version_constraints_radians_degrees_250(ListBase *lb)
{
bConstraint *con;
- /* fcurves for this are not converted, assumption is these were unlikely to be used */
for (con=lb->first; con; con=con->next) {
if(con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) {
bRigidBodyJointConstraint *data = con->data;
@@ -10578,25 +10538,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
-
- /* put 2.50 compatibility code here until next subversion bump */
if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 13)) {
/* NOTE: if you do more conversion, be sure to do it outside of this and
increase subversion again, otherwise it will not be correct */
Object *ob;
- bAction *act;
/* convert degrees to radians for internal use */
for (ob=main->object.first; ob; ob=ob->id.next) {
- AnimData *adt = BKE_animdata_from_id((ID *)ob);
bPoseChannel *pchan;
- if (adt) {
- do_version_fcurves_radians_degrees_250(&adt->drivers, "rotation_euler");
- do_version_fcurves_radians_degrees_250(&adt->drivers, "delta_rotation_euler");
- do_version_fcurves_radians_degrees_250(&adt->drivers, "pole_angle");
- }
-
do_version_constraints_radians_degrees_250(&ob->constraints);
if (ob->pose) {
@@ -10612,18 +10562,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
-
- /* convert fcurve values to be stored in degrees */
- for (act = main->action.first; act; act=act->id.next) {
- /* convert over named properties with PROP_UNIT_ROTATION time of this change */
- do_version_fcurves_radians_degrees_250(&act->curves, "rotation_euler");
- do_version_fcurves_radians_degrees_250(&act->curves, "delta_rotation_euler");
- do_version_fcurves_radians_degrees_250(&act->curves, "pole_angle");
- }
+ }
+
+ /* put 2.50 compatibility code here until next subversion bump */
+ if (1) {
+
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
- /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
+ /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
/* don't forget to set version number in blender.c! */
}