From d4f12860aa0d54e4a2d095cd55a51bc607bc65c0 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 27 May 2019 11:29:22 +0200 Subject: Python API: Tag for update on object.update_from_editmode() This call modifies geometry but does not inform anyone about changes. After this change it's possible to load edit mesh, then request evaluated dependency graph and do some interesting things with the updated object. This is part of T63244: object.to_mesh ignores object.update_from_editmode --- source/blender/makesrna/intern/rna_object_api.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index b5f515277ca..f5c83df0f45 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -706,7 +706,13 @@ void rna_Object_me_eval_info( static bool rna_Object_update_from_editmode(Object *ob, Main *bmain) { /* fail gracefully if we aren't in edit-mode. */ - return ED_object_editmode_load(bmain, ob); + const bool result = ED_object_editmode_load(bmain, ob); + if (result) { + /* Loading edit mesh to mesh changes geometry, and scripts might expect it to be properly + * informed about changes. */ + DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); + } + return result; } #else /* RNA_RUNTIME */ -- cgit v1.2.3