Fix T62104: VertexGroup.add() doesn't push depsgraph update for the mesh.
authorSebastian Parborg <darkdefende@gmail.com>
Sat, 9 Mar 2019 10:45:31 +0000 (11:45 +0100)
committerSebastian Parborg <darkdefende@gmail.com>
Sat, 9 Mar 2019 10:45:31 +0000 (11:45 +0100)
When adding and removing weights from the python api, no depsgraph
updates were triggered.  This would cause the mesh geometry to be out of
sync in the viewport if there were any modifiers that used the vertex
groups in question.

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D4439

source/blender/makesrna/intern/rna_object.c

index 622a4b7..f320ce9 100644 (file)
@@ -1474,6 +1474,7 @@ static void rna_VertexGroup_vertex_add(ID *id, bDeformGroup *def, ReportList *re
        while (index_len--)
                ED_vgroup_vert_add(ob, def, *index++, weight, assignmode);  /* XXX, not efficient calling within loop*/
 
+       DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
        WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data);
 }
 
@@ -1489,6 +1490,7 @@ static void rna_VertexGroup_vertex_remove(ID *id, bDeformGroup *dg, ReportList *
        while (index_len--)
                ED_vgroup_vert_remove(ob, dg, *index++);
 
+       DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
        WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data);
 }