Commit: 507b724056ddc92388b4814ba721c59081931d3b Author: Hans Goudey Date: Wed Nov 30 10:45:18 2022 -0600 Branches: master https://developer.blender.org/rB507b724056ddc92388b4814ba721c59081931d3b
Cleanup: Remove unnecessary BMesh unique pointer in OBJ code This is only used once, it's simpler to just free it in that case and wait for further RAII improvements from elsewhere in the codebase. =================================================================== 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_mesh.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc index 5d37b058ed0..8519fb97217 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc +++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc @@ -99,9 +99,8 @@ std::pair<Mesh *, bool> OBJMesh::triangulate_mesh_eval() * triangulated here. */ const int triangulate_min_verts = 4; - unique_bmesh_ptr bmesh( - BKE_mesh_to_bmesh_ex(export_mesh_eval_, &bm_create_params, &bm_convert_params)); - BM_mesh_triangulate(bmesh.get(), + BMesh *bmesh = BKE_mesh_to_bmesh_ex(export_mesh_eval_, &bm_create_params, &bm_convert_params); + BM_mesh_triangulate(bmesh, MOD_TRIANGULATE_NGON_BEAUTY, MOD_TRIANGULATE_QUAD_SHORTEDGE, triangulate_min_verts, @@ -110,8 +109,8 @@ std::pair<Mesh *, bool> OBJMesh::triangulate_mesh_eval() nullptr, nullptr); - Mesh *triangulated = BKE_mesh_from_bmesh_for_eval_nomain( - bmesh.get(), nullptr, export_mesh_eval_); + Mesh *triangulated = BKE_mesh_from_bmesh_for_eval_nomain(bmesh, nullptr, export_mesh_eval_); + BM_mesh_free(bmesh); free_mesh_if_needed(); return {triangulated, true}; } 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 e1c0e67c174..f45dda338ee 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh +++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh @@ -28,20 +28,6 @@ const int NOT_FOUND = -1; /** Any negative number other than `NOT_FOUND` to initialize usually non-negative numbers. */ const int NEGATIVE_INIT = -10; -/** - * #std::unique_ptr than handles freeing #BMesh. - */ -struct CustomBMeshDeleter { - void operator()(BMesh *bmesh) - { - if (bmesh) { - BM_mesh_free(bmesh); - } - } -}; - -using unique_bmesh_ptr = std::unique_ptr<BMesh, CustomBMeshDeleter>; - class OBJMesh : NonCopyable { private: /** _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs