Armature bake animation export ( not as pose matrices. Still needs fixing )
authorSukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com>
Sun, 7 Aug 2011 18:15:40 +0000 (18:15 +0000)
committerSukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com>
Sun, 7 Aug 2011 18:15:40 +0000 (18:15 +0000)
source/blender/collada/AnimationExporter.cpp
source/blender/collada/AnimationExporter.h
source/blender/collada/AnimationImporter.cpp
source/blender/collada/AnimationImporter.h

index 53f3cc9aae31c338687e6bd194ff1f44c6a0a6de..b1b26fa29150684606cb5c2a7451a8a703c2027a 100644 (file)
@@ -367,7 +367,7 @@ void AnimationExporter::exportAnimations(Scene *sce)
                if (!pchan)
                        return;
     
                if (!pchan)
                        return;
     
-               find_all_frames(ob_arm, fra);
+               find_frames(ob_arm, fra);
 
                if (flag & ARM_RESTPOS) {
                        arm->flag &= ~ARM_RESTPOS;
 
                if (flag & ARM_RESTPOS) {
                        arm->flag &= ~ARM_RESTPOS;
@@ -1119,6 +1119,25 @@ void AnimationExporter::exportAnimations(Scene *sce)
                return;
 
        }
                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;
        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;
index cadd6940e9d1b2b814e33e92ab0c93516597bcf5..d4559782ff41e3dae0d23dbb24ce53773398c43e 100644 (file)
@@ -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);
        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);
        
 
        void find_all_frames(Object *ob, std::vector<float> &fra);
        
index 8ae2d6970cdd5a67f29790d6cc82dfb06a54c90d..0fc01e510206d3eb24d23fd901112a583a0e1f96 100644 (file)
@@ -929,6 +929,12 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node ,
                                        Assign_float_animations( listid, AnimCurves , "specular_hardness" );
                                }
 
                                        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();
                                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->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;
                }
        }
        return types;
index 02b7b05afec1431635f0f6f3478b52f431b617c8..ea7de961382dfb5c20e1f1f86b18b67823a98a06 100644 (file)
@@ -111,7 +111,8 @@ private:
                MATERIAL_SHININESS = 2,
                MATERIAL_SPEC_COLOR = 4,
                MATERIAL_DIFF_COLOR = 1 << 3,
                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
        };
        
        enum AnimationType