Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_convert.c')
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.c13
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);