[Bf-blender-cvs] [5962db093f2] blender-v3.2-release: Fix T97793, Fix T97795: Use correct defaults for missing values in new OBJ importer
Aras Pranckevicius
noreply at git.blender.org
Tue May 3 13:49:07 CEST 2022
Commit: 5962db093f2f1fcf735ceaaa1ba6bbd25efc397f
Author: Aras Pranckevicius
Date: Tue May 3 14:45:44 2022 +0300
Branches: blender-v3.2-release
https://developer.blender.org/rB5962db093f2f1fcf735ceaaa1ba6bbd25efc397f
Fix T97793, Fix T97795: Use correct defaults for missing values in new OBJ importer
- Fix T97793: when a UV coordinate after vt is missing, use zero. While
at it, also use zeroes for positions & normals, since "maximum
possible float" is very likely to cause issues in imported meshes.
- Fix T97795: use 1.0 default if -bm value is missing, instead of zero.
Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14826
===================================================================
M source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
===================================================================
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 3724eaaa361..8df2a6bf16a 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
@@ -71,7 +71,7 @@ static void geom_add_vertex(Geometry *geom,
GlobalVertices &r_global_vertices)
{
float3 vert;
- parse_floats(line, FLT_MAX, vert, 3);
+ parse_floats(line, 0.0f, vert, 3);
r_global_vertices.vertices.append(vert);
geom->vertex_count_++;
}
@@ -81,7 +81,7 @@ static void geom_add_vertex_normal(Geometry *geom,
GlobalVertices &r_global_vertices)
{
float3 normal;
- parse_floats(line, FLT_MAX, normal, 3);
+ parse_floats(line, 0.0f, normal, 3);
r_global_vertices.vertex_normals.append(normal);
geom->has_vertex_normals_ = true;
}
@@ -89,7 +89,7 @@ static void geom_add_vertex_normal(Geometry *geom,
static void geom_add_uv_vertex(const StringRef line, GlobalVertices &r_global_vertices)
{
float2 uv;
- parse_floats(line, FLT_MAX, uv, 2);
+ parse_floats(line, 0.0f, uv, 2);
r_global_vertices.uv_vertices.append(uv);
}
@@ -558,7 +558,7 @@ static bool parse_texture_option(StringRef &line, MTLMaterial *material, tex_map
return true;
}
if (parse_keyword(line, "-bm")) {
- line = parse_float(line, 0.0f, material->map_Bump_strength);
+ line = parse_float(line, 1.0f, material->map_Bump_strength);
return true;
}
if (parse_keyword(line, "-type")) {
More information about the Bf-blender-cvs
mailing list