diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2019-07-30 19:38:31 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2019-07-31 13:23:56 +0300 |
commit | 6d2f9b1dfa98502e9e9f1a73e3dded2ded1f1ce6 (patch) | |
tree | d973e0855450fd71f968e548e6fe7eac594c7f32 /source/blender/blenkernel/BKE_mesh.h | |
parent | e51067505b63892420e5be09be2f24c6add3b2ba (diff) |
Added BKE_mesh_clear_geometry() function
This function makes it possible to clear/remove/nuke all the geometry in
a mesh, allowing functions like `Mesh.from_python()` to construct a new
mesh in its place. Without this function, code like in T67627 have to
allocate a new Mesh datablock, fill that, and swap out the old Mesh for
the new one. This introduces issues when exporting, as the new mesh
could be seen by an exporter as unrelated to the old one.
Shape keys are not freed by this function. Freeing those would require
tagging the depsgraph for relations update, which is an expensive
operation. They should be removed explicitly if necessary.
Material slots are also not cleared by this function, in the same way
that they are not cleared when manually removing all geometry from a
mesh.
The `BKE_mesh_clear_geometry()` function is available in Python as
`mesh.clear_geometry()`.
Reviewed by: mont29, brecht
Differential Revision: https://developer.blender.org/D5373
Diffstat (limited to 'source/blender/blenkernel/BKE_mesh.h')
-rw-r--r-- | source/blender/blenkernel/BKE_mesh.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index d6b4fa72281..3b7fe208bb6 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -105,6 +105,7 @@ void BKE_mesh_looptri_get_real_edges(const struct Mesh *mesh, void BKE_mesh_free(struct Mesh *me); void BKE_mesh_init(struct Mesh *me); +void BKE_mesh_clear_geometry(struct Mesh *me); struct Mesh *BKE_mesh_add(struct Main *bmain, const char *name); void BKE_mesh_copy_data(struct Main *bmain, struct Mesh *me_dst, |