From 7df35db1b1364dcd81dd8247ad3707d40a78fd59 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 4 Sep 2009 20:51:09 +0000 Subject: 2.5 Notifiers --------- Various fixes for wrong use of notifiers, and some new notifiers to make things a bit more clear and consistent, with two notable changes: * Geometry changes are now done with NC_GEOM, rather than NC_OBJECT|ND_GEOM_, so an object does need to be available. * Space data now use NC_SPACE|ND_SPACE_*, instead of data notifiers or even NC_WINDOW in some cases. Note that NC_SPACE should only be used for notifying about changes in space data, we don't want to go back to allqueue(REDRAW..). Depsgraph --------- The dependency graph now has a different flush call: DAG_object_flush_update(scene, ob, flag) is replaced by: DAG_id_flush_update(id, flag) It still works basically the same, one difference is that it now also accepts object data (e.g. Mesh), again to avoid requiring an Object to be available. Other ID types will simply do nothing at the moment. Docs ---- I made some guidelines for how/when to do which kinds of updates and notifiers. I can't specify totally exact how to make these decisions, but these are basically the guidelines I use. So, new and updated docs are here: http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers --- source/blender/makesrna/intern/rna_mesh_api.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'source/blender/makesrna/intern/rna_mesh_api.c') diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index c98b3fb7b09..686d91e4fe2 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -102,20 +102,13 @@ static void rna_Mesh_calc_edges(Mesh *mesh) static void rna_Mesh_update(Mesh *mesh, bContext *C) { - Main *bmain= CTX_data_main(C); - Object *ob; - if(mesh->totface && mesh->totedge == 0) rna_Mesh_calc_edges(mesh); mesh_calc_normals(mesh->mvert, mesh->totvert, mesh->mface, mesh->totface, NULL); - for(ob=bmain->object.first; ob; ob=ob->id.next) { - if(ob->data == mesh) { - ob->recalc |= OB_RECALC_DATA; - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob); - } - } + DAG_id_flush_update(&mesh->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, mesh); } static void rna_Mesh_add_verts(Mesh *mesh, int len) -- cgit v1.2.3