diff options
author | Sukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com> | 2011-08-07 22:15:40 +0400 |
---|---|---|
committer | Sukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com> | 2011-08-07 22:15:40 +0400 |
commit | c095397c988cd2ef6a956ce2742814ea2d3e7f0d (patch) | |
tree | cfd22caa8118463836a72754c95fbd178f8c96ff /source | |
parent | daab78bc614fdf19d1e56558972347121e82e06e (diff) |
Armature bake animation export ( not as pose matrices. Still needs fixing )
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/collada/AnimationExporter.cpp | 21 | ||||
-rw-r--r-- | source/blender/collada/AnimationExporter.h | 1 | ||||
-rw-r--r-- | source/blender/collada/AnimationImporter.cpp | 7 | ||||
-rw-r--r-- | source/blender/collada/AnimationImporter.h | 3 |
4 files changed, 30 insertions, 2 deletions
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 53f3cc9aae3..b1b26fa2915 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -367,7 +367,7 @@ void AnimationExporter::exportAnimations(Scene *sce) if (!pchan) return; - find_all_frames(ob_arm, fra); + find_frames(ob_arm, fra); if (flag & ARM_RESTPOS) { arm->flag &= ~ARM_RESTPOS; @@ -1119,6 +1119,25 @@ void AnimationExporter::exportAnimations(Scene *sce) return; } + + void AnimationExporter::find_frames(Object *ob, std::vector<float> &fra) + { + FCurve *fcu= (FCurve*)ob->adt->action->curves.first; + + for (; fcu; fcu = fcu->next) { + + for (unsigned int i = 0; i < fcu->totvert; i++) { + float f = fcu->bezt[i].vec[1][0]; // + if (std::find(fra.begin(), fra.end(), f) == fra.end()) + fra.push_back(f); + } + } + + // keep the keys in ascending order + std::sort(fra.begin(), fra.end()); + } + + void AnimationExporter::find_frames(Object *ob, std::vector<float> &fra, const char *prefix, const char *tm_name) { FCurve *fcu= (FCurve*)ob->adt->action->curves.first; diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index cadd6940e9d..d4559782ff4 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -144,6 +144,7 @@ protected: std::string get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis); void find_frames(Object *ob, std::vector<float> &fra, const char *prefix, const char *tm_name); + void find_frames(Object *ob, std::vector<float> &fra); void find_all_frames(Object *ob, std::vector<float> &fra); diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 8ae2d6970cd..0fc01e51020 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -929,6 +929,12 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node , Assign_float_animations( listid, AnimCurves , "specular_hardness" ); } + if((animType->material & MATERIAL_IOR) != 0){ + const COLLADAFW::FloatOrParam *ior = &(efc->getIndexOfRefraction()); + const COLLADAFW::UniqueId& listid = ior->getAnimationList(); + Assign_float_animations( listid, AnimCurves , "raytrace_transparency.ior" ); + } + if((animType->material & MATERIAL_SPEC_COLOR) != 0){ const COLLADAFW::ColorOrTexture *cot = &(efc->getSpecular()); const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList(); @@ -1010,6 +1016,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR); types->material = setAnimType(&(efc->getDiffuse().getColor()),(types->material), MATERIAL_DIFF_COLOR); // types->material = setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY); + types->material = setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR); } } return types; diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index 02b7b05afec..ea7de961382 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -111,7 +111,8 @@ private: MATERIAL_SHININESS = 2, MATERIAL_SPEC_COLOR = 4, MATERIAL_DIFF_COLOR = 1 << 3, - MATERIAL_TRANSPARENCY = 1 << 4 + MATERIAL_TRANSPARENCY = 1 << 4, + MATERIAL_IOR = 1 << 5 }; enum AnimationType |