[Bf-blender-cvs] [2a98a1c1335] refactor-mesh-corners-generic: Avoid allocating vertex indices in obj exporter
Hans Goudey
noreply at git.blender.org
Thu Jan 19 01:44:27 CET 2023
Commit: 2a98a1c13355021c504a86baf29a096bb4a273d0
Author: Hans Goudey
Date: Wed Jan 18 18:44:15 2023 -0600
Branches: refactor-mesh-corners-generic
https://developer.blender.org/rB2a98a1c13355021c504a86baf29a096bb4a273d0
Avoid allocating vertex indices in obj exporter
===================================================================
M source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
M source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
M source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh
===================================================================
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 6957e07dadd..9a59ccd50c9 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
@@ -348,7 +348,7 @@ void OBJWriter::write_poly_elements(FormatHandler &fh,
int prev_i = obj_mesh_data.remap_poly_index(idx - 1);
int i = obj_mesh_data.remap_poly_index(idx);
- Vector<int> poly_vertex_indices = obj_mesh_data.calc_poly_vertex_indices(i);
+ Span<int> poly_vertex_indices = obj_mesh_data.calc_poly_vertex_indices(i);
Span<int> poly_uv_indices = obj_mesh_data.calc_poly_uv_indices(i);
Vector<int> poly_normal_indices = obj_mesh_data.calc_poly_normal_indices(i);
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 181ead5e335..1ce118d290f 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
@@ -276,7 +276,7 @@ float3 OBJMesh::calc_vertex_coords(const int vert_index, const float global_scal
return r_coords;
}
-Vector<int> OBJMesh::calc_poly_vertex_indices(const int poly_index) const
+Span<int> OBJMesh::calc_poly_vertex_indices(const int poly_index) const
{
const MPoly &mpoly = mesh_polys_[poly_index];
return mesh_corner_verts_.slice(mpoly.loopstart, mpoly.totloop);
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh
index 1540ced36bb..2b0ce326bd4 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh
@@ -151,7 +151,7 @@ class OBJMesh : NonCopyable {
/**
* Calculate vertex indices of all vertices of the polygon at the given index.
*/
- Vector<int> calc_poly_vertex_indices(int poly_index) const;
+ Span<int> calc_poly_vertex_indices(int poly_index) const;
/**
* Calculate UV vertex coordinates of an Object.
* Stores the coordinates and UV vertex indices in the member variables.
More information about the Bf-blender-cvs
mailing list