diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-05-03 16:42:55 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2018-05-04 15:02:58 +0300 |
commit | d8a03c77d796db4ae2546fbcbe230dbf4846b0ea (patch) | |
tree | df3426bdeb08321f7654bfe0ca5f814469c2d384 /source/blender/blenkernel/intern/mesh.c | |
parent | 4880e2e75a860f4716e3122f5ae14f34f50a9452 (diff) |
Allocate/free meshes with generic library functions.
This avoids the need to use Mesh-specific functions, and makes allocation
and freeing easy oneliners.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 2baa8c6edf4..3163ea6551e 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -47,6 +47,7 @@ #include "BLI_utildefines_stack.h" #include "BKE_animsys.h" +#include "BKE_idcode.h" #include "BKE_main.h" #include "BKE_DerivedMesh.h" #include "BKE_global.h" @@ -621,8 +622,7 @@ static Mesh *mesh_from_template_ex( { const bool do_tessface = ((me_src->totface != 0) && (me_src->totpoly == 0)); /* only do tessface if we have no polys */ - Mesh *me_dst = MEM_callocN(sizeof(struct Mesh), "Mesh"); - BKE_mesh_init(me_dst); + Mesh *me_dst = BKE_id_new_nomain(ID_ME, NULL); me_dst->mat = MEM_dupallocN(me_src->mat); me_dst->mselect = MEM_dupallocN(me_dst->mselect); @@ -703,8 +703,7 @@ BMesh *BKE_mesh_to_bmesh( Mesh *BKE_bmesh_to_mesh(BMesh *bm, const struct BMeshToMeshParams *params) { - Mesh *mesh = BKE_libblock_alloc_notest(ID_ME); - BKE_mesh_init(mesh); + Mesh *mesh = BKE_id_new_nomain(ID_ME, NULL); BM_mesh_bm_to_me(bm, mesh, params); return mesh; } |