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:
authorNathan Letwory <nathan@letworyinteractive.com>2011-03-18 17:06:13 +0300
committerNathan Letwory <nathan@letworyinteractive.com>2011-03-18 17:06:13 +0300
commit7e53769d09863b59beae4155ea0ad13c6ab2fac2 (patch)
treecb5ef0f99fa4c171fb1ce1128db19db42b14b0be /source/blender/collada/EffectExporter.cpp
parentb4743ccd8fdb577670d16ffdd6b3ad2132fa3fea (diff)
COLLADA conformance: don't write empty libraries for effect, image and animation
Diffstat (limited to 'source/blender/collada/EffectExporter.cpp')
-rw-r--r--source/blender/collada/EffectExporter.cpp33
1 files changed, 28 insertions, 5 deletions
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index ee0ade53e99..323b90fe1cc 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -55,15 +55,38 @@ static std::string getActiveUVLayerName(Object *ob)
return "";
}
-
EffectsExporter::EffectsExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryEffects(sw){}
+
+bool EffectsExporter::hasEffects(Scene *sce)
+{
+ Base *base = (Base *)sce->base.first;
+
+ while(base) {
+ Object *ob= base->object;
+ int a;
+ for(a = 0; a < ob->totcol; a++)
+ {
+ Material *ma = give_current_material(ob, a+1);
+
+ // no material, but check all of the slots
+ if (!ma) continue;
+
+ return true;
+ }
+ base= base->next;
+ }
+ return false;
+}
+
void EffectsExporter::exportEffects(Scene *sce)
{
- openLibrary();
- MaterialFunctor mf;
- mf.forEachMaterialInScene<EffectsExporter>(sce, *this);
+ if(hasEffects(sce)) {
+ openLibrary();
+ MaterialFunctor mf;
+ mf.forEachMaterialInScene<EffectsExporter>(sce, *this);
- closeLibrary();
+ closeLibrary();
+ }
}
void EffectsExporter::operator()(Material *ma, Object *ob)