[Bf-blender-cvs] [30cc8b85674] soc-2020-io-performance: Cleanup: exporter: const, clang-tidy.
Ankit Meel
noreply at git.blender.org
Wed Nov 11 15:37:29 CET 2020
Commit: 30cc8b85674d92f1f473721821ee27d57ee0a269
Author: Ankit Meel
Date: Sun Nov 8 18:42:39 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rB30cc8b85674d92f1f473721821ee27d57ee0a269
Cleanup: exporter: const, clang-tidy.
===================================================================
M source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
M source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh
M source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
M source/blender/io/wavefront_obj/exporter/obj_exporter.cc
===================================================================
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 72b1d502e86..59fb1f56b44 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
@@ -208,11 +208,11 @@ void OBJWriter::write_vertex_coords(const OBJMesh &obj_mesh_data) const
* Write UV vertex coordinates for all vertices as "vt u v".
* \note UV indices are stored here, but written later.
*/
-void OBJWriter::write_uv_coords(OBJMesh &obj_mesh_data) const
+void OBJWriter::write_uv_coords(OBJMesh &r_obj_mesh_data) const
{
Vector<std::array<float, 2>> uv_coords;
/* UV indices are calculated and stored in an OBJMesh member here. */
- obj_mesh_data.store_uv_coords_and_indices(uv_coords);
+ r_obj_mesh_data.store_uv_coords_and_indices(uv_coords);
for (const std::array<float, 2> &uv_vertex : uv_coords) {
fprintf(outfile_, "vt %f %f\n", uv_vertex[0], uv_vertex[1]);
@@ -222,7 +222,7 @@ void OBJWriter::write_uv_coords(OBJMesh &obj_mesh_data) const
/**
* Write loop normals for smooth-shaded polygons, and polygon normals otherwise, as vn x y z .
*/
-void OBJWriter::write_poly_normals(OBJMesh &obj_mesh_data) const
+void OBJWriter::write_poly_normals(const OBJMesh &obj_mesh_data) const
{
obj_mesh_data.ensure_mesh_normals();
Vector<float3> lnormals;
@@ -324,7 +324,7 @@ int16_t OBJWriter::write_vertex_group(const OBJMesh &obj_mesh_data,
* \return Writer function with appropriate polygon-element syntax.
*/
OBJWriter::func_vert_uv_normal_indices OBJWriter::get_poly_element_writer(
- const OBJMesh &obj_mesh_data)
+ const OBJMesh &obj_mesh_data) const
{
if (export_params_.export_normals) {
if (export_params_.export_uv && (obj_mesh_data.tot_uv_vertices() > 0)) {
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh
index bc793c135b1..f0a0bb293cb 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh
@@ -69,7 +69,7 @@ class OBJWriter : NonMovable, NonCopyable {
void write_mtllib_name(const char *mtl_filepath) const;
void write_vertex_coords(const OBJMesh &obj_mesh_data) const;
void write_uv_coords(OBJMesh &obj_mesh_data) const;
- void write_poly_normals(OBJMesh &obj_mesh_data) const;
+ void write_poly_normals(const OBJMesh &obj_mesh_data) const;
int write_smooth_group(const OBJMesh &obj_mesh_data,
int poly_index,
const int last_poly_smooth_group) const;
@@ -89,7 +89,7 @@ class OBJWriter : NonMovable, NonCopyable {
typedef void (OBJWriter::*func_vert_uv_normal_indices)(Span<int> vert_indices,
Span<int> uv_indices,
Span<int> normal_indices) const;
- func_vert_uv_normal_indices get_poly_element_writer(const OBJMesh &obj_mesh_data);
+ func_vert_uv_normal_indices get_poly_element_writer(const OBJMesh &obj_mesh_data) const;
void write_vert_uv_normal_indices(Span<int> vert_indices,
Span<int> uv_indices,
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
index ac1d1e481be..b274c3fdca7 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
@@ -98,8 +98,8 @@ std::pair<Mesh *, bool> OBJMesh::triangulate_mesh_eval()
if (export_mesh_eval_->totpoly <= 0) {
return {export_mesh_eval_, false};
}
- const struct BMeshCreateParams bm_create_params = {false};
- const struct BMeshFromMeshParams bm_convert_params = {true, 0, 0, 0};
+ const struct BMeshCreateParams bm_create_params = {0u};
+ const struct BMeshFromMeshParams bm_convert_params = {1u, 0, 0, 0};
/* Lower threshold where triangulation of a polygon starts, i.e. a quadrilateral will be
* triangulated here. */
const int triangulate_min_verts = 4;
diff --git a/source/blender/io/wavefront_obj/exporter/obj_exporter.cc b/source/blender/io/wavefront_obj/exporter/obj_exporter.cc
index f122c0f6911..828943dddfb 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_exporter.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_exporter.cc
@@ -147,7 +147,7 @@ static void write_mesh_objects(Vector<std::unique_ptr<OBJMesh>> exportable_as_me
{
std::unique_ptr<MTLWriter> mtl_writer = nullptr;
if (export_params.export_materials) {
- mtl_writer.reset(new MTLWriter(export_params.filepath));
+ mtl_writer = std::make_unique<MTLWriter>(export_params.filepath);
if (mtl_writer->good()) {
obj_writer.write_mtllib_name(mtl_writer->mtl_file_path());
}
More information about the Bf-blender-cvs
mailing list