Revision: 39162
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39162
Author:   phabtar
Date:     2011-08-07 18:15:40 +0000 (Sun, 07 Aug 2011)
Log Message:
-----------
Armature bake animation export ( not as pose matrices. Still needs fixing ) 

Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp
    branches/soc-2011-pepper/source/blender/collada/AnimationExporter.h
    branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp
    branches/soc-2011-pepper/source/blender/collada/AnimationImporter.h

Modified: branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp       
2011-08-07 18:00:47 UTC (rev 39161)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp       
2011-08-07 18:15:40 UTC (rev 39162)
@@ -367,7 +367,7 @@
                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 @@
                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;

Modified: branches/soc-2011-pepper/source/blender/collada/AnimationExporter.h
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/AnimationExporter.h 
2011-08-07 18:00:47 UTC (rev 39161)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationExporter.h 
2011-08-07 18:15:40 UTC (rev 39162)
@@ -144,6 +144,7 @@
        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);
        

Modified: branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp       
2011-08-07 18:00:47 UTC (rev 39161)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp       
2011-08-07 18:15:40 UTC (rev 39162)
@@ -929,6 +929,12 @@
                                        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 @@
                        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;

Modified: branches/soc-2011-pepper/source/blender/collada/AnimationImporter.h
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/AnimationImporter.h 
2011-08-07 18:00:47 UTC (rev 39161)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationImporter.h 
2011-08-07 18:15:40 UTC (rev 39162)
@@ -111,7 +111,8 @@
                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

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to