[Bf-blender-cvs] [d4f12860aa0] master: Python API: Tag for update on object.update_from_editmode()

Sergey Sharybin noreply at git.blender.org
Mon May 27 11:31:11 CEST 2019


Commit: d4f12860aa0d54e4a2d095cd55a51bc607bc65c0
Author: Sergey Sharybin
Date:   Mon May 27 11:29:22 2019 +0200
Branches: master
https://developer.blender.org/rBd4f12860aa0d54e4a2d095cd55a51bc607bc65c0

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

===================================================================

M	source/blender/makesrna/intern/rna_object_api.c

===================================================================

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 */



More information about the Bf-blender-cvs mailing list