diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2019-11-27 13:18:10 +0300 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2019-11-27 13:18:38 +0300 |
commit | 0281411b482e718922fe446f03caca8c7fadb9a9 (patch) | |
tree | 2654055b7ba01c746d6cc42592f73f7d729eb53b /source/blender/collada | |
parent | 1c2f7b022a56b034e3e24d8bd5bf03d3beb5ca94 (diff) |
fix T69772 Collada importer creates wrong fcurves for skeletal animation
Diffstat (limited to 'source/blender/collada')
-rw-r--r-- | source/blender/collada/AnimationImporter.cpp | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 9aebde095aa..b17f647bf14 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -513,6 +513,24 @@ void AnimationImporter::find_frames(std::vector<float> *frames, std::vector<FCur } } +static int get_animation_axis_index(const COLLADABU::Math::Vector3 &axis) +{ + int index; + if (COLLADABU::Math::Vector3::UNIT_X == axis) { + index = 0; + } + else if (COLLADABU::Math::Vector3::UNIT_Y == axis) { + index = 1; + } + else if (COLLADABU::Math::Vector3::UNIT_Z == axis) { + index = 2; + } + else { + index = -1; + } + return index; +} + /* creates the rna_paths and array indices of fcurves from animations using transformation and * bound animation class of each animation. */ void AnimationImporter::Assign_transform_animations( @@ -592,30 +610,15 @@ void AnimationImporter::Assign_transform_animations( COLLADABU::Math::Vector3 &axis = rot->getRotationAxis(); switch (binding->animationClass) { - case COLLADAFW::AnimationList::ANGLE: - if (COLLADABU::Math::Vector3::UNIT_X == axis) { - modify_fcurve(curves, rna_path, 0); - } - else if (COLLADABU::Math::Vector3::UNIT_Y == axis) { - if (is_joint) { - modify_fcurve(curves, rna_path, 2, -1); // Bone animation from dae to blender - } - else { - modify_fcurve(curves, rna_path, 1); - } - } - else if (COLLADABU::Math::Vector3::UNIT_Z == axis) { - if (is_joint) { - modify_fcurve(curves, rna_path, 1); // Bone animation from dae to blender - } - else { - modify_fcurve(curves, rna_path, 2); - } + case COLLADAFW::AnimationList::ANGLE: { + int axis_index = get_animation_axis_index(axis); + if (axis_index >= 0) { + modify_fcurve(curves, rna_path, axis_index); } else { unused_fcurve(curves); } - break; + } break; case COLLADAFW::AnimationList::AXISANGLE: /* TODO convert axis-angle to quat? or XYZ? */ default: |