Revision: 38123
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38123
Author:   phabtar
Date:     2011-07-05 18:02:08 +0000 (Tue, 05 Jul 2011)
Log Message:
-----------
Spot Light spot_blend animation im/export.

Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp
    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-07-05 16:31:21 UTC (rev 38122)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp       
2011-07-05 18:02:08 UTC (rev 38123)
@@ -89,7 +89,8 @@
                                        (!strcmp(transformName, 
"rotation_euler") && ob->rotmode == ROT_MODE_EUL)||
                                        (!strcmp(transformName, 
"rotation_quaternion")) ||
                                        (!strcmp(transformName, "color")) ||
-                                       (!strcmp(transformName, "spot_size"))) 
+                                       (!strcmp(transformName, "spot_size"))||
+                                       (!strcmp(transformName, "spot_blend"))) 
                                        dae_animation(ob ,fcu, transformName );
                                
 

Modified: branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp       
2011-07-05 16:31:21 UTC (rev 38122)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationImporter.cpp       
2011-07-05 18:02:08 UTC (rev 38123)
@@ -692,13 +692,30 @@
                }
 }
 
-void AnimationImporter:: Assign_float_animations(const 
COLLADAFW::AnimationList::AnimationBinding * binding,
-                                                                               
                 std::vector<FCurve*>* curves, char * anim_type)
+void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& 
listid, ListBase *AnimCurves, char * anim_type)
 {
        char rna_path[100];
-       BLI_strncpy(rna_path, anim_type , sizeof(rna_path));
-
-       modify_fcurve(curves, rna_path, 0 );
+       if (animlist_map.find(listid) == animlist_map.end()) return ;
+       else 
+       {
+               //transformation has animations
+               const COLLADAFW::AnimationList *animlist = animlist_map[listid];
+               const COLLADAFW::AnimationList::AnimationBindings& bindings = 
animlist->getAnimationBindings();
+               //all the curves belonging to the current binding
+               std::vector<FCurve*> animcurves;    
+               for (unsigned int j = 0; j < bindings.getCount(); j++) {
+                        animcurves = curve_map[bindings[j].animation];
+                       //calculate rnapaths and array index of fcurves 
according to transformation and animation class
+                        BLI_strncpy(rna_path, anim_type , sizeof(rna_path));
+                        modify_fcurve(&animcurves, rna_path, 0 );
+                        std::vector<FCurve*>::iterator iter;
+                               //Add the curves of the current animation to 
the object
+                               for (iter = animcurves.begin(); iter != 
animcurves.end(); iter++) {
+                                       FCurve * fcu = *iter;
+                                       BLI_addtail(AnimCurves, fcu);   
+                               }                               
+               }
+       }
        
 }
 
@@ -787,7 +804,7 @@
                }
        }
 
-       if ( ((animType & LIGHT_COLOR) != 0)|| ((animType & LIGHT_FOA) != 0) )
+       if ( ((animType & LIGHT_COLOR) != 0)|| ((animType & LIGHT_FOA) != 0) || 
((animType & LIGHT_FOE) != 0) )
        {
                Lamp * lamp  = (Lamp*) ob->data;
 
@@ -799,58 +816,43 @@
 
                for (unsigned int i = 0; i < nodeLights.getCount(); i++) {
                        const COLLADAFW::Light *light = (COLLADAFW::Light *) 
FW_object_map[nodeLights[i]->getInstanciatedObjectId()];
+
                        if ((animType & LIGHT_COLOR) != 0)
                        {
                                const COLLADAFW::Color *col =  
&(light->getColor());
                                const COLLADAFW::UniqueId& listid = 
col->getAnimationList();
-                               if (animlist_map.find(listid) == 
animlist_map.end()) continue ;
-                               else 
-                               {
-                                       //transformation has animations
-                                       const COLLADAFW::AnimationList 
*animlist = animlist_map[listid];
-                                       const 
COLLADAFW::AnimationList::AnimationBindings& bindings = 
animlist->getAnimationBindings();
-                                       //all the curves belonging to the 
current binding
-                                       std::vector<FCurve*> animcurves;    
-                                       for (unsigned int j = 0; j < 
bindings.getCount(); j++) {
-                                                animcurves = 
curve_map[bindings[j].animation];
-                                               //calculate rnapaths and array 
index of fcurves according to transformation and animation class
-                                                Assign_color_animations( 
&bindings[j], &animcurves); 
-                                               
-                                                std::vector<FCurve*>::iterator 
iter;
-                                                       //Add the curves of the 
current animation to the object
-                                                       for (iter = 
animcurves.begin(); iter != animcurves.end(); iter++) {
-                                                               FCurve * fcu = 
*iter;
-                                                               
BLI_addtail(AnimCurves, fcu);   
-                                                       }                       
        
-                                       }
+                               //transformation has animations
+                               const COLLADAFW::AnimationList *animlist = 
animlist_map[listid];
+                               const 
COLLADAFW::AnimationList::AnimationBindings& bindings = 
animlist->getAnimationBindings();
+                               //all the curves belonging to the current 
binding
+                               std::vector<FCurve*> animcurves;    
+                               for (unsigned int j = 0; j < 
bindings.getCount(); j++) {
+                                        animcurves = 
curve_map[bindings[j].animation];
+                                       //calculate rnapaths and array index of 
fcurves according to transformation and animation class
+                                        Assign_color_animations( &bindings[j], 
&animcurves); 
+                                       
+                                        std::vector<FCurve*>::iterator iter;
+                                               //Add the curves of the current 
animation to the object
+                                               for (iter = animcurves.begin(); 
iter != animcurves.end(); iter++) {
+                                                       FCurve * fcu = *iter;
+                                                       BLI_addtail(AnimCurves, 
fcu);   
+                                               }                               
                                }
+                               
                        }
-                       if ((animType & LIGHT_FOA) != 0)
+                       if ((animType & LIGHT_FOA) != 0 )
                        {
                                const COLLADAFW::AnimatableFloat *foa =  
&(light->getFallOffAngle());
                                const COLLADAFW::UniqueId& listid = 
foa->getAnimationList();
-                               if (animlist_map.find(listid) == 
animlist_map.end()) continue ;
-                               else 
-                               {
-                                       //transformation has animations
-                                       const COLLADAFW::AnimationList 
*animlist = animlist_map[listid];
-                                       const 
COLLADAFW::AnimationList::AnimationBindings& bindings = 
animlist->getAnimationBindings();
-                                       //all the curves belonging to the 
current binding
-                                       std::vector<FCurve*> animcurves;    
-                                       for (unsigned int j = 0; j < 
bindings.getCount(); j++) {
-                                                animcurves = 
curve_map[bindings[j].animation];
-                                               //calculate rnapaths and array 
index of fcurves according to transformation and animation class
-                                                Assign_float_animations( 
&bindings[j], &animcurves , "spot_size"); 
-                                               
-                                                std::vector<FCurve*>::iterator 
iter;
-                                                       //Add the curves of the 
current animation to the object
-                                                       for (iter = 
animcurves.begin(); iter != animcurves.end(); iter++) {
-                                                               FCurve * fcu = 
*iter;
-                                                               
BLI_addtail(AnimCurves, fcu);   
-                                                       }                       
        
-                                       }
-                               }
-                       }               
+                               Assign_float_animations( listid ,AnimCurves, 
"spot_size"); 
+                       }
+                       if ( (animType & LIGHT_FOE) != 0 )
+                       {
+                               const COLLADAFW::AnimatableFloat *foe =  
&(light->getFallOffExponent());
+                               const COLLADAFW::UniqueId& listid = 
foe->getAnimationList();
+                               Assign_float_animations( listid ,AnimCurves, 
"spot_blend"); 
+                       
+                       }
                }
        }
 }
@@ -894,6 +896,12 @@
                if (animlist_map.find(foa_listid) != animlist_map.end()) 
                                type = type|LIGHT_FOA;
                
+               const COLLADAFW::AnimatableFloat *fallOffExpo =  
&(light->getFallOffExponent());
+           const COLLADAFW::UniqueId& foe_listid = fallOffExpo 
->getAnimationList();
+
+               if (animlist_map.find(foe_listid) != animlist_map.end()) 
+                               type = type|LIGHT_FOE;
+               
                if ( type != 0) break;
 
        }

Modified: branches/soc-2011-pepper/source/blender/collada/AnimationImporter.h
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/AnimationImporter.h 
2011-07-05 16:31:21 UTC (rev 38122)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationImporter.h 
2011-07-05 18:02:08 UTC (rev 38123)
@@ -89,7 +89,8 @@
                        INANIMATE = 0,
                        NODE_TRANSFORM = 1,
                        LIGHT_COLOR     = 2,
-                       LIGHT_FOA = 4
+                       LIGHT_FOA = 4,
+                       LIGHT_FOE = 8
                };
 public:
 
@@ -122,8 +123,7 @@
        void Assign_color_animations(const 
COLLADAFW::AnimationList::AnimationBinding * binding,
                                                                 
std::vector<FCurve*>* curves);
 
-       void Assign_float_animations(const 
COLLADAFW::AnimationList::AnimationBinding * binding,
-                                                                               
                 std::vector<FCurve*>* curves, char * anim_type);
+       void Assign_float_animations(const COLLADAFW::UniqueId& listid, 
ListBase *AnimCurves, char * anim_type);
 
        void modify_fcurve(std::vector<FCurve*>* curves , char* rna_path , int 
array_index );
        // prerequisites:

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

Reply via email to