diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-05-02 22:11:09 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-05-02 22:11:09 +0400 |
commit | 203a4d42ca9f8a6e41c60c9d7a4e855b0c6cf635 (patch) | |
tree | f70421bbffa759ba52fe58c478b56e7d8116fa0a /source/blender/collada/AnimationImporter.cpp | |
parent | a1f4be4577776add4a71ac3446aceb4195234fc7 (diff) |
Fix #31089: collada file crashing on importing file with unknown/unsupported animation data.
Diffstat (limited to 'source/blender/collada/AnimationImporter.cpp')
-rw-r--r-- | source/blender/collada/AnimationImporter.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 6a66f1fb817..cf815920b57 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -438,6 +438,16 @@ void AnimationImporter::modify_fcurve(std::vector<FCurve*>* curves, const char* } } +void AnimationImporter::unused_fcurve(std::vector<FCurve*>* curves) +{ + // when an error happens and we can't actually use curve remove it from unused_curves + std::vector<FCurve*>::iterator it; + for (it = curves->begin(); it != curves->end(); it++) { + FCurve *fcu = *it; + unused_curves.erase(std::remove(unused_curves.begin(), unused_curves.end(), fcu), unused_curves.end()); + } +} + void AnimationImporter::find_frames( std::vector<float>* frames, std::vector<FCurve*>* curves) { std::vector<FCurve*>::iterator iter; @@ -499,6 +509,7 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation * modify_fcurve(curves, rna_path, -1 ); break; default: + unused_fcurve(curves); fprintf(stderr, "AnimationClass %d is not supported for %s.\n", binding->animationClass, loc ? "TRANSLATE" : "SCALE"); } @@ -534,10 +545,13 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation * else if (COLLADABU::Math::Vector3::UNIT_Z == axis) { modify_fcurve(curves, rna_path, 2 ); } + else + unused_fcurve(curves); break; case COLLADAFW::AnimationList::AXISANGLE: // TODO convert axis-angle to quat? or XYZ? default: + unused_fcurve(curves); fprintf(stderr, "AnimationClass %d is not supported for ROTATE transformation.\n", binding->animationClass); } @@ -553,9 +567,11 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation * } }*/ + unused_fcurve(curves); break; case COLLADAFW::Transformation::SKEW: case COLLADAFW::Transformation::LOOKAT: + unused_fcurve(curves); fprintf(stderr, "Animation of SKEW and LOOKAT transformations is not supported yet.\n"); break; } @@ -591,6 +607,7 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list break; default: + unused_fcurve(&animcurves); fprintf(stderr, "AnimationClass %d is not supported for %s.\n", bindings[j].animationClass, "COLOR" ); } |