diff options
author | Hans Goudey <h.goudey@me.com> | 2021-07-31 06:26:35 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-07-31 06:26:35 +0300 |
commit | 2f63303e2540ceeca9e99cc47c07de37f3d79c0a (patch) | |
tree | 1d1d25f3f1d64eae001db1ed26eb1d1b51ae6cc0 /source/blender/editors/object | |
parent | 8063f101669065942ec465636c78913bea6ebc85 (diff) |
Cleanup: Use const mesh arguments
These functions do not change their source or input mesh, so it can
be passed with const, which means in one case that a function doesn't
have to be responsible for freeing its argument mesh, which is a clearly
better separation of concerns.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_remesh.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/editors/object/object_remesh.cc b/source/blender/editors/object/object_remesh.cc index 5dc91d7d5e4..82dbc9aaf38 100644 --- a/source/blender/editors/object/object_remesh.cc +++ b/source/blender/editors/object/object_remesh.cc @@ -132,7 +132,6 @@ static int voxel_remesh_exec(bContext *C, wmOperator *op) Object *ob = CTX_data_active_object(C); Mesh *mesh = static_cast<Mesh *>(ob->data); - Mesh *new_mesh; if (mesh->remesh_voxel_size <= 0.0f) { BKE_report(op->reports, RPT_ERROR, "Voxel remesher cannot run with a voxel size of 0.0"); @@ -151,7 +150,7 @@ static int voxel_remesh_exec(bContext *C, wmOperator *op) isovalue = mesh->remesh_voxel_size * 0.3f; } - new_mesh = BKE_mesh_remesh_voxel( + Mesh *new_mesh = BKE_mesh_remesh_voxel( mesh, mesh->remesh_voxel_size, mesh->remesh_voxel_adaptivity, isovalue); if (!new_mesh) { @@ -164,7 +163,9 @@ static int voxel_remesh_exec(bContext *C, wmOperator *op) } if (mesh->flag & ME_REMESH_FIX_POLES && mesh->remesh_voxel_adaptivity <= 0.0f) { - new_mesh = BKE_mesh_remesh_voxel_fix_poles(new_mesh); + Mesh *mesh_fixed_poles = BKE_mesh_remesh_voxel_fix_poles(new_mesh); + BKE_id_free(nullptr, new_mesh); + new_mesh = mesh_fixed_poles; BKE_mesh_calc_normals(new_mesh); } |