Fix T103212: ignore OBJ UV indices if no UVs are present
Similar to T98782 that was about normal indices: some files out there are technically "wrong" since they refer to UV indices, without ever defining any UVs. If the file does not have any UVs, simply ignore UV indices in the OBJ face definitions. Fixes T103212.
This commit is contained in:
parent
614704f90c
commit
8007f7e74f
Notes:
blender-bot
2023-02-14 10:43:47 +01:00
Referenced by issue #103212, New Wavefront OBJ importer only imports points
|
@ -222,7 +222,8 @@ static void geom_add_polygon(Geometry *geom,
|
|||
else {
|
||||
geom->track_vertex_index(corner.vert_index);
|
||||
}
|
||||
if (got_uv) {
|
||||
/* Ignore UV index, if the geometry does not have any UVs (T103212). */
|
||||
if (got_uv && !global_vertices.uv_vertices.is_empty()) {
|
||||
corner.uv_vert_index += corner.uv_vert_index < 0 ? global_vertices.uv_vertices.size() : -1;
|
||||
if (corner.uv_vert_index < 0 || corner.uv_vert_index >= global_vertices.uv_vertices.size()) {
|
||||
fprintf(stderr,
|
||||
|
|
Loading…
Reference in New Issue