Cleanup: Remove unnecessary manual mesh edit data destruction

Also slightly improve comments about original indices.
This commit is contained in:
Hans Goudey
2023-07-26 00:08:31 -04:00
parent f9a4fcd8cf
commit 673fc326db
3 changed files with 4 additions and 14 deletions

View File

@@ -30,7 +30,6 @@ int BKE_mesh_runtime_looptri_len(const struct Mesh *mesh);
const int *BKE_mesh_runtime_looptri_faces_ensure(const struct Mesh *mesh);
bool BKE_mesh_runtime_ensure_edit_data(struct Mesh *mesh);
void BKE_mesh_runtime_reset_edit_data(struct Mesh *mesh);
/**
* Clear and free any derived caches associated with the mesh geometry data. Examples include BVH

View File

@@ -247,14 +247,6 @@ bool BKE_mesh_runtime_ensure_edit_data(Mesh *mesh)
return true;
}
void BKE_mesh_runtime_reset_edit_data(Mesh *mesh)
{
using namespace blender::bke;
if (blender::bke::EditMeshData *edit_data = mesh->runtime->edit_data) {
*edit_data = {};
}
}
void BKE_mesh_runtime_clear_cache(Mesh *mesh)
{
using namespace blender::bke;

View File

@@ -114,14 +114,14 @@ void BKE_mesh_wrapper_ensure_mdata(Mesh *me)
BMEditMesh *em = me->edit_mesh;
BM_mesh_bm_to_me_for_eval(em->bm, me, &me->runtime->cd_mask_extra);
/* Adding original index layers assumes that all BMesh mesh wrappers are created from
/* Adding original index layers here assumes that all BMesh Mesh wrappers are created from
* original edit mode meshes (the only case where adding original indices makes sense).
* If that assumption is broken, the layers might be incorrect in that they might not
* If that assumption is broken, the layers might be incorrect because they might not
* actually be "original".
*
* There is also a performance aspect, where this also assumes that original indices are
* always needed when converting an edit mesh to a mesh. That might be wrong, but it's not
* harmful. */
* always needed when converting a BMesh to a mesh with the mesh wrapper system. That might
* be wrong, but it's not harmful. */
BKE_mesh_ensure_default_orig_index_customdata_no_check(me);
blender::bke::EditMeshData *edit_data = me->runtime->edit_data;
@@ -129,7 +129,6 @@ void BKE_mesh_wrapper_ensure_mdata(Mesh *me)
me->vert_positions_for_write().copy_from(edit_data->vertexCos);
me->runtime->is_original_bmesh = false;
}
BKE_mesh_runtime_reset_edit_data(me);
MEM_delete(me->runtime->edit_data);
me->runtime->edit_data = nullptr;
break;