Revision: 37989
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37989
Author:   phabtar
Date:     2011-06-30 18:24:45 +0000 (Thu, 30 Jun 2011)
Log Message:
-----------
Light color parameter animation export support.

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/TransformReader.cpp

Modified: branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp       
2011-06-30 16:06:30 UTC (rev 37988)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationExporter.cpp       
2011-06-30 18:24:45 UTC (rev 37989)
@@ -29,6 +29,7 @@
 void forEachObjectInScene(Scene *sce, Functor &f)
 {
        Base *base= (Base*) sce->base.first;
+       
        while(base) {
                Object *ob = base->object;
                        
@@ -54,8 +55,16 @@
        // called for each exported object
        void AnimationExporter::operator() (Object *ob) 
        {
-               if (!ob->adt || !ob->adt->action) return;  //this is already 
checked in hasAnimations()
-               FCurve *fcu = (FCurve*)ob->adt->action->curves.first;
+               FCurve *fcu;
+        if(ob->adt && ob->adt->action)      
+                               fcu = (FCurve*)ob->adt->action->curves.first;
+           else if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && 
((Lamp*)ob ->data)->adt->action )
+                               fcu = (FCurve*)(((Lamp*)ob 
->data)->adt->action->curves.first);
+               else return;
+               //if (!ob->adt || !ob->adt->action) 
+               //      fcu = 
(FCurve*)((Lamp*)ob->data)->adt->action->curves.first;  //this is already 
checked in hasAnimations()
+               //else
+               //    fcu = (FCurve*)ob->adt->action->curves.first;
                char * transformName = extract_transform_name( fcu->rna_path );
                
                                        
@@ -78,8 +87,10 @@
                                
                                if ((!strcmp(transformName, "location") || 
!strcmp(transformName, "scale")) ||
                                        (!strcmp(transformName, 
"rotation_euler") && ob->rotmode == ROT_MODE_EUL)||
-                                       (!strcmp(transformName, 
"rotation_quaternion"))) 
+                                       (!strcmp(transformName, 
"rotation_quaternion")) ||
+                                       (!strcmp(transformName, "color"))) 
                                        dae_animation(ob ,fcu, transformName );
+                               
 
                                fcu = fcu->next;
                        }
@@ -153,7 +164,12 @@
                        if (fcu->array_index < 4)
                        axis_name = axis_names[fcu->array_index];*/
                }
-
+               else if ( !strcmp(transformName, "color") )
+               {
+                       const char *axis_names[] = {"R", "G", "B"};
+                       if (fcu->array_index < 3)
+                       axis_name = axis_names[fcu->array_index];
+               }
                else
                {
                        const char *axis_names[] = {"X", "Y", "Z"};
@@ -837,17 +853,19 @@
        bool AnimationExporter::hasAnimations(Scene *sce)
        {
                Base *base= (Base*) sce->base.first;
+               
                while(base) {
                        Object *ob = base->object;
                        
                        FCurve *fcu = 0;
                        if(ob->adt && ob->adt->action)      
                                fcu = (FCurve*)ob->adt->action->curves.first;
-                               
-                       //The Scene has animations if object type is armature 
or object has f-curve
+                       else if( (ob->type == OB_LAMP ) && ((Lamp*)ob 
->data)->adt && ((Lamp*)ob ->data)->adt->action )
+                               fcu = (FCurve*)(((Lamp*)ob 
->data)->adt->action->curves.first);
+                       //The Scene has animations if object type is armature 
or object has f-curve or object is a Lamp which has f-curves
                        if ((ob->type == OB_ARMATURE && ob->data) || fcu) {
                                return true;
-                       }
+                       } 
                        base= base->next;
                }
                return false;

Modified: branches/soc-2011-pepper/source/blender/collada/AnimationExporter.h
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/AnimationExporter.h 
2011-06-30 16:06:30 UTC (rev 37988)
+++ branches/soc-2011-pepper/source/blender/collada/AnimationExporter.h 
2011-06-30 18:24:45 UTC (rev 37989)
@@ -32,6 +32,7 @@
 #include "DNA_anim_types.h"
 #include "DNA_action_types.h"
 #include "DNA_curve_types.h"
+#include "DNA_lamp_types.h"
 #include "DNA_armature_types.h"
 
 #include "BKE_DerivedMesh.h"

Modified: branches/soc-2011-pepper/source/blender/collada/TransformReader.cpp
===================================================================
--- branches/soc-2011-pepper/source/blender/collada/TransformReader.cpp 
2011-06-30 16:06:30 UTC (rev 37988)
+++ branches/soc-2011-pepper/source/blender/collada/TransformReader.cpp 
2011-06-30 18:24:45 UTC (rev 37989)
@@ -37,6 +37,7 @@
 {
        float cur[4][4];
        float copy[4][4];
+       float eul[3];
 
        unit_m4(mat);
        

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

Reply via email to