diff options
author | Aras Pranckevicius <aras@nesnausk.org> | 2022-04-04 14:58:45 +0300 |
---|---|---|
committer | Aras Pranckevicius <aras@nesnausk.org> | 2022-04-04 14:58:45 +0300 |
commit | a56f53ad5615afc4b9ed74907de21376c14b3775 (patch) | |
tree | 98487d67b708c00a7fb2b086cdba9fbfdfd173f9 | |
parent | 277fa2f441f4ab2c00e7f329ba34a3466956647c (diff) |
OBJ: fix mac/linux tests and compile warnings in the new obj importer
Related to D13958
-rw-r--r-- | source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc | 10 | ||||
-rw-r--r-- | source/blender/io/wavefront_obj/tests/obj_importer_tests.cc | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc index 9111ff05e8a..7dac8525bf5 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc +++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc @@ -184,6 +184,10 @@ static void geom_add_polygon(Geometry *geom, } } } + else { + fprintf(stderr, "Invalid face syntax '%s', ignoring\n", std::string(str_corner).c_str()); + face_valid = false; + } /* Always keep stored indices non-negative and zero-based. */ corner.vert_index += corner.vert_index < 0 ? global_vertices.vertices.size() : -offsets.get_index_offset() - 1; @@ -191,7 +195,7 @@ static void geom_add_polygon(Geometry *geom, fprintf(stderr, "Invalid vertex index %i (valid range [0, %zi)), ignoring face\n", corner.vert_index, - global_vertices.vertices.size()); + (size_t)global_vertices.vertices.size()); face_valid = false; } if (got_uv) { @@ -200,7 +204,7 @@ static void geom_add_polygon(Geometry *geom, fprintf(stderr, "Invalid UV index %i (valid range [0, %zi)), ignoring face\n", corner.uv_vert_index, - global_vertices.uv_vertices.size()); + (size_t)global_vertices.uv_vertices.size()); face_valid = false; } } @@ -213,7 +217,7 @@ static void geom_add_polygon(Geometry *geom, fprintf(stderr, "Invalid normal index %i (valid range [0, %zi)), ignoring face\n", corner.vertex_normal_index, - global_vertices.vertex_normals.size()); + (size_t)global_vertices.vertex_normals.size()); face_valid = false; } } diff --git a/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc b/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc index ddcfd6176f0..2a0e2aaf510 100644 --- a/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc +++ b/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc @@ -338,8 +338,8 @@ TEST_F(obj_importer_test, import_invalid_syntax) 3, float3(1, 2, 3), float3(10, 11, 12), - float3(0.4082f, -0.8165f, 0.4082f), - float2(0, 0)}, + float3(0, 1, 0), + float2(0.5f, 0.25f)}, }; import_and_check("invalid_syntax.obj", expect, std::size(expect), 0); } |