[Bf-blender-cvs] [447fc7c] master: fix T50004: Removed check for empty mesh and adjusted the vertex import function to accept meshes without vertices as well

Gaia Clary noreply at git.blender.org
Sat Nov 12 22:20:28 CET 2016


Commit: 447fc7c4ce3e2c7ddc0590a0373b5831304745e2
Author: Gaia Clary
Date:   Sat Nov 12 22:20:07 2016 +0100
Branches: master
https://developer.blender.org/rB447fc7c4ce3e2c7ddc0590a0373b5831304745e2

fix T50004: Removed check for empty mesh and adjusted the vertex import function to accept meshes without vertices as well

===================================================================

M	source/blender/collada/MeshImporter.cpp

===================================================================

diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
index 6ff6de3..8f3bf88 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -317,11 +317,6 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh)  // checks if mesh has su
 		}
 	}
 	
-	if (mesh->getPositions().empty()) {
-		fprintf(stderr, "ERROR: Mesh %s has no vertices.\n", name.c_str());
-		return false;
-	}
-
 	return true;
 }
 
@@ -329,11 +324,15 @@ void MeshImporter::read_vertices(COLLADAFW::Mesh *mesh, Mesh *me)
 {
 	// vertices
 	COLLADAFW::MeshVertexData& pos = mesh->getPositions();
+	if (pos.empty()) {
+		return;
+	}
+
 	int stride = pos.getStride(0);
 	if (stride == 0) stride = 3;
-	
-	me->totvert = mesh->getPositions().getFloatValues()->getCount() / stride;
-	me->mvert = (MVert *)CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, me->totvert);
+
+	me->totvert = pos.getFloatValues()->getCount() / stride;
+	me->mvert   = (MVert *)CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, me->totvert);
 
 	MVert *mvert;
 	int i;




More information about the Bf-blender-cvs mailing list