diff options
Diffstat (limited to 'source/blender/io/wavefront_obj')
6 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc index f2547e6fc14..95be927589e 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc +++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc @@ -503,7 +503,7 @@ static const char *tex_map_type_to_string[] = { "map_d", "map_Bump", }; -BLI_STATIC_ASSERT(ARRAY_SIZE(tex_map_type_to_string) == (int)MTLTexMapType::Count, +BLI_STATIC_ASSERT(ARRAY_SIZE(tex_map_type_to_string) == int(MTLTexMapType::Count), "array size mismatch"); /** @@ -641,7 +641,7 @@ void MTLWriter::write_texture_map(const MTLMaterial &mtl_material, /* Always emit forward slashes for cross-platform compatibility. */ std::replace(path.begin(), path.end(), '\\', '/'); - fmt_handler_.write_mtl_map(tex_map_type_to_string[(int)texture_key], options, path); + fmt_handler_.write_mtl_map(tex_map_type_to_string[int(texture_key)], options, path); } static bool is_pbr_map(MTLTexMapType type) @@ -677,7 +677,7 @@ void MTLWriter::write_materials(const char *blen_filepath, fmt_handler_.write_string(""); fmt_handler_.write_mtl_newmtl(mtlmat.name); write_bsdf_properties(mtlmat, write_pbr); - for (int key = 0; key < (int)MTLTexMapType::Count; key++) { + for (int key = 0; key < int(MTLTexMapType::Count); key++) { const MTLTexMap &tex = mtlmat.texture_maps[key]; if (!tex.is_valid()) { continue; diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc index 851358f8762..0231bc79b89 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc +++ b/source/blender/io/wavefront_obj/exporter/obj_export_mtl.cc @@ -33,7 +33,7 @@ const char *tex_map_type_to_socket_id[] = { "Alpha", "Normal", }; -BLI_STATIC_ASSERT(ARRAY_SIZE(tex_map_type_to_socket_id) == (int)MTLTexMapType::Count, +BLI_STATIC_ASSERT(ARRAY_SIZE(tex_map_type_to_socket_id) == int(MTLTexMapType::Count), "array size mismatch"); /** @@ -312,12 +312,12 @@ static void store_image_textures(const bNode *bsdf_node, * - finding "Strength" property of the node for `-bm` option. */ - for (int key = 0; key < (int)MTLTexMapType::Count; ++key) { + for (int key = 0; key < int(MTLTexMapType::Count); ++key) { MTLTexMap &value = r_mtl_mat.texture_maps[key]; Vector<const bNodeSocket *> linked_sockets; const bNode *normal_map_node{nullptr}; - if (key == (int)MTLTexMapType::Normal) { + if (key == int(MTLTexMapType::Normal)) { /* Find sockets linked to destination "Normal" socket in P-BSDF node. */ linked_sockets_to_dest_id(bsdf_node, *node_tree, "Normal", linked_sockets); /* Among the linked sockets, find Normal Map shader node. */ @@ -328,7 +328,7 @@ static void store_image_textures(const bNode *bsdf_node, } else { /* Skip emission map if emission strength is zero. */ - if (key == (int)MTLTexMapType::Emission) { + if (key == int(MTLTexMapType::Emission)) { float emission_strength = 0.0f; copy_property_from_node( SOCK_FLOAT, bsdf_node, "Emission Strength", {&emission_strength, 1}); 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 a30dfda24d8..bd1c2d32a12 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 @@ -216,7 +216,7 @@ static void geom_add_polygon(Geometry *geom, fprintf(stderr, "Invalid vertex index %i (valid range [0, %zu)), ignoring face\n", corner.vert_index, - (size_t)global_vertices.vertices.size()); + size_t(global_vertices.vertices.size())); face_valid = false; } else { @@ -228,7 +228,7 @@ static void geom_add_polygon(Geometry *geom, fprintf(stderr, "Invalid UV index %i (valid range [0, %zu)), ignoring face\n", corner.uv_vert_index, - (size_t)global_vertices.uv_vertices.size()); + size_t(global_vertices.uv_vertices.size())); face_valid = false; } } @@ -244,7 +244,7 @@ static void geom_add_polygon(Geometry *geom, fprintf(stderr, "Invalid normal index %i (valid range [0, %zu)), ignoring face\n", corner.vertex_normal_index, - (size_t)global_vertices.vertex_normals.size()); + size_t(global_vertices.vertex_normals.size())); face_valid = false; } } @@ -485,7 +485,7 @@ void OBJParser::parse(Vector<std::unique_ptr<Geometry>> &r_all_geometries, /* Parse the buffer (until last newline) that we have so far, * line by line. */ - StringRef buffer_str{buffer.data(), (int64_t)last_nl}; + StringRef buffer_str{buffer.data(), int64_t(last_nl)}; while (!buffer_str.is_empty()) { StringRef line = read_next_line(buffer_str); const char *p = line.begin(), *end = line.end(); @@ -768,7 +768,7 @@ void MTLParser::parse_and_store(Map<string, std::unique_ptr<MTLMaterial>> &r_mat MTLMaterial *material = nullptr; - StringRef buffer_str{(const char *)buffer, (int64_t)buffer_len}; + StringRef buffer_str{(const char *)buffer, int64_t(buffer_len)}; while (!buffer_str.is_empty()) { const StringRef line = read_next_line(buffer_str); const char *p = line.begin(), *end = line.end(); diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc b/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc index ef05534928a..4a4d1eeadb6 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc +++ b/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc @@ -166,7 +166,7 @@ void MeshFromGeometry::create_vertices(Mesh *mesh) if (!mesh_geometry_.vertices_.contains(vi)) { continue; } - int local_vi = (int)mesh_geometry_.global_to_local_vertices_.size(); + int local_vi = int(mesh_geometry_.global_to_local_vertices_.size()); BLI_assert(local_vi >= 0 && local_vi < mesh->totvert); copy_v3_v3(verts[local_vi].co, global_vertices_.vertices[vi]); mesh_geometry_.global_to_local_vertices_.add_new(vi, local_vi); diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc index 439a5fa8f05..787b1fc9730 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc +++ b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc @@ -356,7 +356,7 @@ static void add_image_textures(Main *bmain, bool relative_paths) { float node_locy = node_locy_top; - for (int key = 0; key < (int)MTLTexMapType::Count; ++key) { + for (int key = 0; key < int(MTLTexMapType::Count); ++key) { const MTLTexMap &value = mtl_mat.texture_maps[key]; if (!value.is_valid()) { /* No Image texture node of this map type can be added to this material. */ @@ -375,7 +375,7 @@ static void add_image_textures(Main *bmain, /* Add normal map node if needed. */ bNode *normal_map = nullptr; - if (key == (int)MTLTexMapType::Normal) { + if (key == int(MTLTexMapType::Normal)) { normal_map = add_node(ntree, SH_NODE_NORMAL_MAP, node_locx_normalmap, node_locy); const float bump = std::max(0.0f, mtl_mat.normal_strength); set_property_of_socket(SOCK_FLOAT, "Strength", {bump}, normal_map); @@ -396,7 +396,7 @@ static void add_image_textures(Main *bmain, link_sockets(ntree, image_node, "Color", normal_map, "Color"); link_sockets(ntree, normal_map, "Normal", bsdf, "Normal"); } - else if (key == (int)MTLTexMapType::Alpha) { + else if (key == int(MTLTexMapType::Alpha)) { link_sockets(ntree, image_node, "Alpha", bsdf, tex_map_type_to_socket_id[key]); mat->blend_method = MA_BM_BLEND; } diff --git a/source/blender/io/wavefront_obj/tests/obj_mtl_parser_tests.cc b/source/blender/io/wavefront_obj/tests/obj_mtl_parser_tests.cc index e473d629673..ce3c14a2939 100644 --- a/source/blender/io/wavefront_obj/tests/obj_mtl_parser_tests.cc +++ b/source/blender/io/wavefront_obj/tests/obj_mtl_parser_tests.cc @@ -67,7 +67,7 @@ class obj_mtl_parser_test : public testing::Test { EXPECT_NEAR(exp.cc_roughness, got.cc_roughness, tol); EXPECT_NEAR(exp.aniso, got.aniso, tol); EXPECT_NEAR(exp.aniso_rot, got.aniso_rot, tol); - for (int key = 0; key < (int)MTLTexMapType::Count; key++) { + for (int key = 0; key < int(MTLTexMapType::Count); key++) { const MTLTexMap &exp_tex = exp.texture_maps[key]; const MTLTexMap &got_tex = got.texture_maps[key]; EXPECT_STREQ(exp_tex.image_path.c_str(), got_tex.image_path.c_str()); |