diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2011-03-18 17:06:13 +0300 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2011-03-18 17:06:13 +0300 |
commit | 7e53769d09863b59beae4155ea0ad13c6ab2fac2 (patch) | |
tree | cb5ef0f99fa4c171fb1ce1128db19db42b14b0be /source/blender/collada/DocumentExporter.cpp | |
parent | b4743ccd8fdb577670d16ffdd6b3ad2132fa3fea (diff) |
COLLADA conformance: don't write empty libraries for effect, image and animation
Diffstat (limited to 'source/blender/collada/DocumentExporter.cpp')
-rw-r--r-- | source/blender/collada/DocumentExporter.cpp | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index f481add98ff..00daac60281 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -307,15 +307,19 @@ public: AnimationExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryAnimations(sw) { this->sw = sw; } + + void exportAnimations(Scene *sce) { - this->scene = sce; + if(hasAnimations(sce)) { + this->scene = sce; - openLibrary(); - - forEachObjectInScene(sce, *this); - - closeLibrary(); + openLibrary(); + + forEachObjectInScene(sce, *this); + + closeLibrary(); + } } // called for each exported object @@ -905,6 +909,24 @@ protected: } } } + + bool 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; + + if ((ob->type == OB_ARMATURE && ob->data) || fcu) { + return true; + } + base= base->next; + } + return false; + } }; void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename) |