Fix T60246: crash with Cycles baking while in edit mode.

This commit is contained in:
Brecht Van Lommel
2019-01-15 16:53:35 +01:00
parent 2f2272f71a
commit e4c78436c6

View File

@@ -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);
}