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
This commit is contained in:
Sergey Sharybin 2019-05-27 11:29:22 +02:00
parent 5dbda33462
commit d4f12860aa
Notes: blender-bot 2023-02-14 03:07:39 +01:00
Referenced by issue #63244, object.to_mesh ignores object.update_from_editmode
1 changed files with 7 additions and 1 deletions

View File

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