From 0a0074f9c65255dfa7b5bca67abe149b7d74e797 Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Wed, 12 Sep 2012 18:26:01 +0000 Subject: Collada: do not call polylist export for objects with no polygons (avoid a missleading warning message) --- source/blender/collada/DocumentExporter.cpp | 2 ++ source/blender/collada/GeometryExporter.cpp | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index baaa6dbeed2..7683ec1e9cd 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -163,6 +163,8 @@ void DocumentExporter::exportCurrentScene(Scene *sce) COLLADABU::NativeString(std::string(this->export_settings->filepath)); COLLADASW::StreamWriter sw(native_filename); + fprintf(stdout, "Collada export: %s\n", this->export_settings->filepath); + // open sw.startDocument(); diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp index c7ad2ff3975..27700444ba9 100644 --- a/source/blender/collada/GeometryExporter.cpp +++ b/source/blender/collada/GeometryExporter.cpp @@ -132,14 +132,17 @@ void GeometryExporter::operator()(Object *ob) createLooseEdgeList(ob, me, geom_id, norind); - // XXX slow - if (ob->totcol) { - for (int a = 0; a < ob->totcol; a++) { - createPolylist(a, has_uvs, has_color, ob, me, geom_id, norind); + // Only create Polylists if number of faces > 0 + if (me->totface > 0) { + // XXX slow + if (ob->totcol) { + for (int a = 0; a < ob->totcol; a++) { + createPolylist(a, has_uvs, has_color, ob, me, geom_id, norind); + } + } + else { + createPolylist(0, has_uvs, has_color, ob, me, geom_id, norind); } - } - else { - createPolylist(0, has_uvs, has_color, ob, me, geom_id, norind); } closeMesh(); @@ -248,7 +251,7 @@ void GeometryExporter::createPolylist(short material_index, // no faces using this material if (faces_in_polylist == 0) { - fprintf(stderr, "%s: no faces use material %d\n", id_name(ob).c_str(), material_index); + fprintf(stderr, "%s: material with index %d is not used.\n", id_name(ob).c_str(), material_index); return; } -- cgit v1.2.3