From e4c78436c6a3bef0d30ff656a4758295f58b5ae4 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 15 Jan 2019 16:53:35 +0100 Subject: [PATCH] Fix T60246: crash with Cycles baking while in edit mode. --- source/blender/editors/object/object_bake_api.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index fca3cc3e9f6..81715890f0a 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -635,9 +635,15 @@ static size_t initialize_internal_images(BakeImages *bake_images, ReportList *re /* create new mesh with edit mode changes and modifiers applied */ static Mesh *bake_mesh_new_from_object(Depsgraph *depsgraph, Main *bmain, Scene *scene, Object *ob) { - ED_object_editmode_load(bmain, ob); + bool apply_modifiers = false; - Mesh *me = BKE_mesh_new_from_object(depsgraph, bmain, scene, ob, 1, 0); + /* Mesh is already updated and has modifiers applied. */ + if (ob->type != OB_MESH) { + ED_object_editmode_load(bmain, ob); + apply_modifiers = true; + } + + Mesh *me = BKE_mesh_new_from_object(depsgraph, bmain, scene, ob, apply_modifiers, 0); if (me->flag & ME_AUTOSMOOTH) { BKE_mesh_split_faces(me, true); }