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
path: root/source
diff options
context:
space:
mode:
authorGaia Clary <gaia.clary@machinimatrix.org>2018-03-28 18:56:09 +0300
committerGaia Clary <gaia.clary@machinimatrix.org>2018-03-28 19:01:32 +0300
commit8afc9c1e7d1a38e819ea4b4d16faa3cd3539f6c4 (patch)
tree2aa8b8cb02fe46d86566b13f4c7dfa7f5a94fb2d /source
parentbc3a55c3439c29a85af334c289ac2dcb35f08e07 (diff)
Fix Collada: broken tangents with Camera Animation import for xfov
When importing an xfov curve, we must transformed the data to Lens opening angles in degrees. While the curve value itself is correctly transformed, the transformation of the tangents has been forgotten. this is fixed now.
Diffstat (limited to 'source')
-rw-r--r--source/blender/collada/AnimationImporter.cpp19
-rw-r--r--source/blender/collada/AnimationImporter.h2
2 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index f7ea8342eae..6ae82ddd836 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);
diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h
index 7dc4131dd69..1f2de2f3162 100644
--- a/source/blender/collada/AnimationImporter.h
+++ b/source/blender/collada/AnimationImporter.h
@@ -202,6 +202,8 @@ public:
// gives a world-space mat, end's mat not included
bool calc_joint_parent_mat_rest(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end);
+ float convert_to_focal_length(float in_xfov, int fov_type, float aspect, float sensorx);
+
#ifdef ARMATURE_TEST
Object *get_joint_object(COLLADAFW::Node *root, COLLADAFW::Node *node, Object *par_job);
#endif