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

This commit is contained in:
Gaia Clary 2016-11-12 22:20:07 +01:00
parent 4151f12713
commit 447fc7c4ce
Notes: blender-bot 2023-02-14 07:25:44 +01:00
Referenced by issue #50004, No empty Collada mesh import possible
1 changed files with 7 additions and 8 deletions

View File

@ -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;