[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54377] trunk/blender/source/blender/ collada/MeshImporter.cpp: fix warning message when imported Collada nodes have < 3 edges.

Gaia Clary gaia.clary at machinimatrix.org
Fri Feb 8 01:27:36 CET 2013


Revision: 54377
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54377
Author:   gaiaclary
Date:     2013-02-08 00:27:35 +0000 (Fri, 08 Feb 2013)
Log Message:
-----------
fix warning message when imported Collada nodes have < 3 edges.

Modified Paths:
--------------
    trunk/blender/source/blender/collada/MeshImporter.cpp

Modified: trunk/blender/source/blender/collada/MeshImporter.cpp
===================================================================
--- trunk/blender/source/blender/collada/MeshImporter.cpp	2013-02-07 21:29:31 UTC (rev 54376)
+++ trunk/blender/source/blender/collada/MeshImporter.cpp	2013-02-08 00:27:35 UTC (rev 54377)
@@ -63,10 +63,9 @@
 
 // get node name, or fall back to original id if not present (name is optional)
 template<class T>
-static const char *bc_get_dae_name(T *node)
+static const std::string bc_get_dae_name(T *node)
 {
-	const std::string& name = node->getName();
-	return name.size() ? name.c_str() : node->getOriginalId().c_str();
+	return node->getName().size() ? node->getName(): node->getOriginalId();
 }
 
 static const char *bc_primTypeToStr(COLLADAFW::MeshPrimitive::PrimitiveType type)
@@ -268,7 +267,7 @@
 {
 	COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives();
 
-	const char *name = bc_get_dae_name(mesh);
+	const std::string &name = bc_get_dae_name(mesh);
 	
 	for (unsigned i = 0; i < prim_arr.getCount(); i++) {
 		
@@ -287,7 +286,7 @@
 				int count = vca[j];
 				if (count < 3) {
 					fprintf(stderr, "Primitive %s in %s has at least one face with vertex count < 3\n",
-					        type_str, name);
+					        type_str, name.c_str());
 					return false;
 				}
 			}
@@ -305,7 +304,7 @@
 	}
 	
 	if (mesh->getPositions().empty()) {
-		fprintf(stderr, "Mesh %s has no vertices.\n", name);
+		fprintf(stderr, "Mesh %s has no vertices.\n", name.c_str());
 		return false;
 	}
 
@@ -1291,7 +1290,7 @@
 	COLLADAFW::Mesh *mesh = (COLLADAFW::Mesh *)geom;
 	
 	if (!is_nice_mesh(mesh)) {
-		fprintf(stderr, "Ignoring mesh %s\n", bc_get_dae_name(mesh));
+		fprintf(stderr, "Ignoring mesh %s\n", bc_get_dae_name(mesh).c_str());
 		return true;
 	}
 	




More information about the Bf-blender-cvs mailing list