diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-05-05 01:05:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-05-05 01:08:33 +0300 |
commit | d18be66a54f977426013bcd5c5c541f698c675fe (patch) | |
tree | 618dc828d9333766694c2c871f7d603030406349 /source/blender/blenkernel/intern/mesh_convert.c | |
parent | 7ab7ae80c5a32be2cf4003f818e09fa3f1759fc4 (diff) |
Fix T86871: Mesh.mesh_from_object creates empty mesh from curve
Regression in 2b723abea02c868d94623f4dd9e9b6775cb3aaab
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_convert.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_convert.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c index 5892dc49fd6..098d9c420aa 100644 --- a/source/blender/blenkernel/intern/mesh_convert.c +++ b/source/blender/blenkernel/intern/mesh_convert.c @@ -1061,6 +1061,9 @@ static Object *object_for_curve_to_mesh_create(Object *object) return temp_object; } +/** + * Populate `object->runtime.curve_cache` which is then used to create the mesh. + */ static void curve_to_mesh_eval_ensure(Object *object) { Curve *curve = (Curve *)object->data; @@ -1070,10 +1073,13 @@ static void curve_to_mesh_eval_ensure(Object *object) remapped_object.data = &remapped_curve; - if (remapped_object.runtime.curve_cache == NULL) { - remapped_object.runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve"); + if (object->runtime.curve_cache == NULL) { + object->runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve"); } + /* Temporarily share the curve-cache with the temporary object, owned by `object`. */ + remapped_object.runtime.curve_cache = object->runtime.curve_cache; + /* Clear all modifiers for the bevel object. * * This is because they can not be reliably evaluated for an original object (at least because @@ -1116,6 +1122,9 @@ static void curve_to_mesh_eval_ensure(Object *object) BKE_object_eval_assign_data(&remapped_object, &mesh_eval->id, true); } + /* Owned by `object` & needed by the caller to create the mesh. */ + remapped_object.runtime.curve_cache = NULL; + BKE_object_runtime_free_data(&remapped_object); BKE_object_runtime_free_data(&taper_object); BKE_object_runtime_free_data(&taper_object); |