[Bf-blender-cvs] [4adc3174339] usd-importer-T81257: USD import: bounds checking vertex normal count.
Michael A. Kowalski
noreply at git.blender.org
Fri Nov 6 01:31:01 CET 2020
Commit: 4adc3174339c0c699c7464d0a33426a88d3fadb8
Author: Michael A. Kowalski
Date: Thu Nov 5 19:28:47 2020 -0500
Branches: usd-importer-T81257
https://developer.blender.org/rB4adc3174339c0c699c7464d0a33426a88d3fadb8
USD import: bounds checking vertex normal count.
Also added warning messages. A mismatch between the vertex
normal and vertex counts was causing crashes in some cases.
===================================================================
M source/blender/io/usd/import/usd_reader_mesh.cc
===================================================================
diff --git a/source/blender/io/usd/import/usd_reader_mesh.cc b/source/blender/io/usd/import/usd_reader_mesh.cc
index ce8686e5e00..d2226158ae3 100644
--- a/source/blender/io/usd/import/usd_reader_mesh.cc
+++ b/source/blender/io/usd/import/usd_reader_mesh.cc
@@ -228,7 +228,7 @@ void process_loop_normals(Mesh *mesh, const MeshSampleData &mesh_data)
}
if (loop_count != mesh->totloop) {
- std::cerr << "WARNING: loop normal count mismatch." << std::endl;
+ std::cerr << "WARNING: loop normal count mismatch for mesh " << mesh->id.name << std::endl;
process_no_normals(mesh);
return;
}
@@ -276,7 +276,12 @@ void process_vertex_normals(Mesh *mesh, const MeshSampleData &mesh_data)
size_t normals_count = mesh_data.normals.size();
if (normals_count == 0) {
- std::cerr << "WARNING: vertex normal count mismatch." << std::endl;
+ process_no_normals(mesh);
+ return;
+ }
+
+ if (normals_count != mesh->totvert) {
+ std::cerr << "WARNING: vertex normal count mismatch for mesh " << mesh->id.name << std::endl;
process_no_normals(mesh);
return;
}
More information about the Bf-blender-cvs
mailing list