Page MenuHome
Paste P981

T65052
ActivePublic

Authored by Sergey Sharybin (sergey) on May 24 2019, 4:13 PM.
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index cb152cb4e49..39753e9b51f 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1970,14 +1970,15 @@ static void convert_ensure_curve_cache(Depsgraph *depsgraph, Scene *scene, Objec
}
}
-static void curvetomesh(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
+static void curvetomesh(Main *bmain, Depsgraph *depsgraph, Object *ob)
{
- convert_ensure_curve_cache(depsgraph, scene, ob);
- BKE_mesh_from_nurbs(bmain, ob); /* also does users */
-
- if (ob->type == OB_MESH) {
- BKE_object_free_modifiers(ob, 0);
- }
+ Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+ Curve *curve = ob->data;
+ Mesh *mesh = BKE_mesh_new_from_object_to_bmain(bmain, object_eval);
+ ob->data = mesh;
+ ob->type = OB_MESH;
+ id_us_min(&curve->id);
+ id_us_plus(&mesh->id);
}
static bool convert_poll(bContext *C)
@@ -2233,7 +2234,7 @@ static int convert_exec(bContext *C, wmOperator *op)
BKE_curve_curve_dimension_update(cu);
if (target == OB_MESH) {
- curvetomesh(bmain, depsgraph, scene, newob);
+ curvetomesh(bmain, depsgraph, newob);
/* meshes doesn't use displist */
BKE_object_free_curve_cache(newob);
@@ -2257,7 +2258,7 @@ static int convert_exec(bContext *C, wmOperator *op)
newob = ob;
}
- curvetomesh(bmain, depsgraph, scene, newob);
+ curvetomesh(bmain, depsgraph, newob);
/* meshes doesn't use displist */
BKE_object_free_curve_cache(newob);