Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/collada/AnimationExporter.cpp32
-rw-r--r--source/blender/collada/AnimationExporter.h1
-rw-r--r--source/blender/collada/TransformReader.cpp1
3 files changed, 27 insertions, 7 deletions
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index ade1475c871..50f96926fab 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -29,6 +29,7 @@ template<class Functor>
void forEachObjectInScene(Scene *sce, Functor &f)
{
Base *base= (Base*) sce->base.first;
+
while(base) {
Object *ob = base->object;
@@ -54,8 +55,16 @@ void AnimationExporter::exportAnimations(Scene *sce)
// 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 @@ void AnimationExporter::exportAnimations(Scene *sce)
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 @@ void AnimationExporter::exportAnimations(Scene *sce)
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 @@ void AnimationExporter::exportAnimations(Scene *sce)
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;
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h
index e05fac4eed7..85e5e23d0f0 100644
--- a/source/blender/collada/AnimationExporter.h
+++ b/source/blender/collada/AnimationExporter.h
@@ -32,6 +32,7 @@ extern "C"
#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"
diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp
index 625a0220830..0fd0c85aa09 100644
--- a/source/blender/collada/TransformReader.cpp
+++ b/source/blender/collada/TransformReader.cpp
@@ -37,6 +37,7 @@ void TransformReader::get_node_mat(float mat[][4], COLLADAFW::Node *node, std::m
{
float cur[4][4];
float copy[4][4];
+ float eul[3];
unit_m4(mat);