diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-03-29 16:36:01 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-03-29 16:36:01 +0300 |
commit | 11130970c6a3ff14cb4dd0caece2137891b43e87 (patch) | |
tree | b21d79b38e4ee28ed9762973e8ea1cc604dcfd1b /source/blender/collada/AnimationImporter.cpp | |
parent | f6ad53804099802ab3f5eafa830f95f8545eb888 (diff) | |
parent | ca5f3dd2200725712a665705fc25e20a208d6295 (diff) |
Merge commit 'origin/master^' into blender2.8
Diffstat (limited to 'source/blender/collada/AnimationImporter.cpp')
-rw-r--r-- | source/blender/collada/AnimationImporter.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index ee3fddbf5b7..31dd7d5de46 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -109,7 +109,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) fcu->flag = (FCURVE_VISIBLE | FCURVE_AUTO_HANDLES | FCURVE_SELECTED); // fcu->rna_path = BLI_strdupn(path, strlen(path)); fcu->array_index = 0; - fcu->totvert = curve->getKeyCount(); + //fcu->totvert = curve->getKeyCount(); // create beztriple for each key for (unsigned int j = 0; j < curve->getKeyCount(); j++) { @@ -669,6 +669,13 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list } +float AnimationImporter::convert_to_focal_length(float in_xfov, int fov_type, float aspect, float sensorx) +{ + // NOTE: Needs more testing (As we curretnly have no official test data for this) + float xfov = (fov_type == CAMERA_YFOV) ? (2.0f * atanf(aspect * tanf(DEG2RADF(in_xfov) * 0.5f))) : DEG2RADF(in_xfov); + return fov_to_focallength(xfov, sensorx); +} + /* * Lens animations must be stored in COLLADA by using FOV, * while blender internally uses focal length. @@ -698,13 +705,9 @@ void AnimationImporter::Assign_lens_animations(const COLLADAFW::UniqueId& listid FCurve *fcu = *iter; for (unsigned int i = 0; i < fcu->totvert; i++) { - - double input_fov = fcu->bezt[i].vec[1][1]; - - // NOTE: Needs more testing (As we curretnly have no official test data for this) - double xfov = (fov_type == CAMERA_YFOV) ? (2.0f * atanf(aspect * tanf(DEG2RADF(input_fov) * 0.5f))) : DEG2RADF(input_fov); - - fcu->bezt[i].vec[1][1] = fov_to_focallength(xfov, cam->sensor_x); + fcu->bezt[i].vec[0][1] = convert_to_focal_length(fcu->bezt[i].vec[0][1], fov_type, aspect, cam->sensor_x); + fcu->bezt[i].vec[1][1] = convert_to_focal_length(fcu->bezt[i].vec[1][1], fov_type, aspect, cam->sensor_x); + fcu->bezt[i].vec[2][1] = convert_to_focal_length(fcu->bezt[i].vec[2][1], fov_type, aspect, cam->sensor_x); } BLI_addtail(AnimCurves, fcu); |