diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-22 17:58:44 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-22 17:59:38 +0300 |
commit | bf0dc7ee19a1bb52e9f1061c4224eb23c13b49f6 (patch) | |
tree | 004b4e5b56261ef207c030d92d7da2801bd3037b /source | |
parent | b1e86ff385985f5a62fb83999f3275470387da08 (diff) |
Cleanup: use standard BKE_object_free_derived_caches in BKE_mesh_to_curve.
...Instead of doing own dirty/risky version of the same thing!
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_convert.c | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c index fb438bec7fd..3fc5d1ca51c 100644 --- a/source/blender/blenkernel/intern/mesh_convert.c +++ b/source/blender/blenkernel/intern/mesh_convert.c @@ -817,7 +817,6 @@ void BKE_mesh_to_curve(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object * /* make new mesh data from the original copy */ Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, ob, CD_MASK_MESH); ListBase nurblist = {NULL, NULL}; - bool needsFree = false; BKE_mesh_to_curve_nurblist(me_eval, &nurblist, 0); BKE_mesh_to_curve_nurblist(me_eval, &nurblist, 1); @@ -832,30 +831,7 @@ void BKE_mesh_to_curve(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object * ob->data = cu; ob->type = OB_CURVE; - /* curve objects can't contain DM in usual cases, we could free memory */ - needsFree = true; - } - - /* Just to avoid dangling pointer, dm will be removed. */ - { - DerivedMesh *dm = ob->derivedFinal; - if (dm != NULL) { - dm->needsFree = needsFree; - dm->release(dm); - } - } - - if (needsFree) { - BKE_mesh_free(me_eval); - - ob->derivedFinal = NULL; - ob->runtime.mesh_eval = NULL; - - /* curve object could have got bounding box only in special cases */ - if (ob->bb) { - MEM_freeN(ob->bb); - ob->bb = NULL; - } + BKE_object_free_derived_caches(ob); } } |