2.5
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 4 Sep 2009 20:51:09 +0000 (20:51 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 4 Sep 2009 20:51:09 +0000 (20:51 +0000)
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

85 files changed:
source/blender/blenkernel/BKE_depsgraph.h
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/booleanops.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/multires.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/pointcache.c
source/blender/editors/armature/editarmature.c
source/blender/editors/armature/poselib.c
source/blender/editors/armature/poseobject.c
source/blender/editors/curve/editcurve.c
source/blender/editors/curve/editfont.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/mesh/editmesh.c
source/blender/editors/mesh/editmesh_add.c
source/blender/editors/mesh/editmesh_loop.c
source/blender/editors/mesh/editmesh_mods.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/mesh_layers.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/metaball/editmball.c
source/blender/editors/object/editconstraint.c
source/blender/editors/object/editkey.c
source/blender/editors/object/editlattice.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_modifier.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/physics/editparticle.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/space_action/space_action.c
source/blender/editors/space_buttons/buttons_ops.c
source/blender/editors/space_buttons/space_buttons.c
source/blender/editors/space_console/space_console.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/space_file.c
source/blender/editors/space_graph/space_graph.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_info/space_info.c
source/blender/editors/space_nla/space_nla.c
source/blender/editors/space_node/space_node.c
source/blender/editors/space_outliner/outliner.c
source/blender/editors/space_outliner/space_outliner.c
source/blender/editors/space_sequencer/space_sequencer.c
source/blender/editors/space_text/space_text.c
source/blender/editors/space_text/text_ops.c
source/blender/editors/space_time/space_time.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/space_view3d/view3d_snap.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/util/editmode_undo.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/makesrna/intern/rna_armature.c
source/blender/makesrna/intern/rna_boid.c
source/blender/makesrna/intern/rna_cloth.c
source/blender/makesrna/intern/rna_constraint.c
source/blender/makesrna/intern/rna_curve.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_fluidsim.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_key.c
source/blender/makesrna/intern/rna_lattice.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_mesh_api.c
source/blender/makesrna/intern/rna_meta.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/makesrna/intern/rna_particle.c
source/blender/makesrna/intern/rna_pose.c
source/blender/makesrna/intern/rna_sculpt_paint.c
source/blender/makesrna/intern/rna_smoke.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/makesrna/intern/rna_wm.c
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/wm.c
source/blender/windowmanager/intern/wm_event_system.c

index 70b6c1d13f4862e834e9795b1b901a2fb368a1c9..e242ead3b87b37440386492c6ad009c695782fc9 100644 (file)
@@ -32,6 +32,8 @@
 #define DEPS_DEBUG
 */
 
+struct ID;
+struct Main;
 struct Scene;
 struct DagNodeQueue;
 struct DagForest;
@@ -103,8 +105,9 @@ void        DAG_object_update_flags(struct Scene *sce, struct Object *ob, unsigned int
 
                /* flushes all recalc flags in objects down the dependency tree */
 void   DAG_scene_flush_update(struct Scene *sce, unsigned int lay, int time);
-               /* flushes all recalc flags for this object down the dependency tree */
-void   DAG_object_flush_update(struct Scene *sce, struct Object *ob, short flag);
+               /* flushes all recalc flags for this object down the dependency tree,
+                  but not the DAG only supports objects and object data currently */
+void   DAG_id_flush_update(struct ID *id, short flag);
 
 void   DAG_pose_sort(struct Object *ob);
                
index 631bc2cb88c9eff06427eadb856c8dc43a5c97c4..e568f1b2c0ecb2b2556a6e9d358a064680b59a6a 100644 (file)
@@ -130,7 +130,6 @@ void free_bones (bArmature *arm)
 void free_armature(bArmature *arm)
 {
        if (arm) {
-               /*              unlink_armature(arm);*/
                free_bones(arm);
                
                /* free editmode data */
index eb3aefe7ee63a53dddf7b2c0c36eb77247574b22..5f0697f06ce539a40acb3f47b8c9755c38a674d1 100644 (file)
@@ -589,7 +589,7 @@ int NewBooleanMesh(Scene *scene, Base *base, Base *base_select, int int_op_type)
        MEM_freeN(mat);
 
        /* update dag */
-       DAG_object_flush_update(scene, ob_new, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob_new->id, OB_RECALC_DATA);
 
        return 1;
 }
index 6c765b02e5d95a0d02785836074dd60a3229b964..6a14762e0ed8772135bbba8ba5bcc31dbf8c40ba 100644 (file)
@@ -61,6 +61,7 @@
 #include "DNA_space_types.h"
 #include "DNA_view2d_types.h"
 #include "DNA_view3d_types.h"
+#include "DNA_windowmanager_types.h"
 
 #include "BLI_ghash.h"
 
@@ -2141,39 +2142,77 @@ void DAG_scene_update_flags(Scene *scene, unsigned int lay)
        
 }
 
-
-/* flag this object and all its relations to recalc */
-/* if you need to do more objects, tag object yourself and
-   use DAG_scene_flush_update() in end */
-void DAG_object_flush_update(Scene *sce, Object *ob, short flag)
+void DAG_id_flush_update(ID *id, short flag)
 {
-       
-       if(ob==NULL || sce->theDag==NULL) return;
+       Main *bmain= G.main;
+       wmWindowManager *wm;
+       wmWindow *win;
+       Scene *sce;
+       Object *obt, *ob= NULL;
+       short idtype;
 
-       ob->recalc |= flag;
-       BKE_ptcache_object_reset(sce, ob, PTCACHE_RESET_DEPSGRAPH);
-       
-       /* all users of this ob->data should be checked */
-       /* BUT! displists for curves are still only on cu */
-       if(flag & OB_RECALC_DATA) {
-               if(ob->type!=OB_CURVE && ob->type!=OB_SURF) {
-                       ID *id= ob->data;
-                       if(id && id->us>1) {
-                               /* except when there's a key and shapes are locked */
-                               if(ob_get_key(ob) && (ob->shapeflag & (OB_SHAPE_LOCK|OB_SHAPE_TEMPLOCK)));
-                               else {
-                                       Object *obt;
-                                       for (obt=G.main->object.first; obt; obt= obt->id.next) {
-                                               if (obt != ob && obt->data==ob->data) {
-                                                       obt->recalc |= OB_RECALC_DATA;
-                                                       BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH);
-                                               }
-                                       }
+       /* only one scene supported currently, making more scenes work
+          correctly requires changes beyond just the dependency graph */
+
+       if((wm= bmain->wm.first)) {
+               /* if we have a windowmanager, use sce from first window */
+               for(win=wm->windows.first; win; win=win->next) {
+                       sce= (win->screen)? win->screen->scene: NULL;
+
+                       if(sce)
+                               break;
+               }
+       }
+       else
+               /* if not, use the first sce */
+               sce= bmain->scene.first;
+
+       if(!id || !sce || !sce->theDag)
+               return;
+
+       /* set flags & pointcache for object */
+       if(GS(id->name) == ID_OB) {
+               ob= (Object*)id;
+               ob->recalc |= flag;
+               BKE_ptcache_object_reset(sce, ob, PTCACHE_RESET_DEPSGRAPH);
+
+               if(flag & OB_RECALC_DATA) {
+                       /* all users of this ob->data should be checked */
+                       id= ob->data;
+
+                       /* no point in trying in this cases */
+                       if(!id || id->us <= 1)
+                               id= NULL;
+                       /* curves and surfaces only need to mark one object, since
+                          otherwise cu->displist would be computed multiple times */
+                       else if(ob->type==OB_CURVE || ob->type==OB_SURF)
+                               id= NULL;
+                       /* also for locked shape keys we make an exception */
+                       else if(ob_get_key(ob) && (ob->shapeflag & (OB_SHAPE_LOCK|OB_SHAPE_TEMPLOCK)))
+                               id= NULL;
+               }
+       }
+
+       /* set flags & pointcache for object data */
+       if(id) {
+               idtype= GS(id->name);
+
+               if(ELEM7(idtype, ID_ME, ID_CU, ID_MB, ID_LA, ID_LT, ID_CA, ID_AR)) {
+                       for(obt=bmain->object.first; obt; obt= obt->id.next) {
+                               if(!(ob && obt == ob) && obt->data == id) {
+                                       obt->recalc |= OB_RECALC_DATA;
+                                       BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH);
+
+                                       /* for these we only flag one object, otherwise cu->displist
+                                          would be computed multiple times */
+                                       if(obt->type==OB_CURVE || obt->type==OB_SURF)
+                                               break;
                                }
                        }
                }
        }
-       
+
+       /* flush to other objects that depend on this one */
 // XXX if(G.curscreen)
 //             DAG_scene_flush_update(sce, dag_screen_view3d_layers(), 0);
 //     else
index c7454d3b832fed1311d2aff21ddce7d74398be69..c92eda6d169f39a60091b5d4c986044896b4d0a2 100644 (file)
@@ -977,7 +977,7 @@ void mesh_set_smooth_flag(Object *meshOb, int enableSmooth)
                }
        }
 
-// XXX do this in caller       DAG_object_flush_update(scene, meshOb, OB_RECALC_DATA);
+// XXX do this in caller       DAG_id_flush_update(&me->id, OB_RECALC_DATA);
 }
 
 void mesh_calc_normals(MVert *mverts, int numVerts, MFace *mfaces, int numFaces, float **faceNors_r) 
@@ -1265,7 +1265,7 @@ void mesh_pmv_revert(Object *ob, Mesh *me)
                MEM_freeN(me->pv->vert_map);
                me->pv->vert_map= NULL;
 
-// XXX do this in caller               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+// XXX do this in caller               DAG_id_flush_update(&me->id, OB_RECALC_DATA);
        }
 }
 
index 9ba5769843f76360929585b16f17933023ed9db9..37e7e55050a390e6abbfe5ef8ef5faffcfa638a3 100644 (file)
@@ -83,7 +83,7 @@ int multiresModifier_switch_level(Object *ob, const int distance)
                mmd->lvl += distance;
                if(mmd->lvl < 1) mmd->lvl = 1;
                else if(mmd->lvl > mmd->totlvl) mmd->lvl = mmd->totlvl;
-               /* XXX: DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); 
+               /* XXX: DAG_id_flush_update(&ob->id, OB_RECALC_DATA); 
                   object_handle_update(ob);*/
                return 1;
        }
index 18e3512967a22795b4c99ee52e41aafff8c42706..1ae3ec5dd5047443bd8fa9a01e93365712f48db0 100644 (file)
@@ -2631,7 +2631,7 @@ void psys_cache_paths(Scene *scene, Object *ob, ParticleSystem *psys, float cfra
        ParticleInterpolationData pind;
        
        float birthtime = 0.0, dietime = 0.0;
-       float t, time = 0.0, keytime = 0.0, dfra = 1.0, frs_sec = scene->r.frs_sec;
+       float t, time = 0.0, dfra = 1.0, frs_sec = scene->r.frs_sec;
        float col[4] = {0.5f, 0.5f, 0.5f, 1.0f};
        float prev_tangent[3], hairmat[4][4];
        float rotmat[3][3];
@@ -2853,14 +2853,13 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
 
        ParticleSystem *psys = edit->psys;
        ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
-       ParticleSettings *part = psys ? psys->part : NULL;
        ParticleData *pa = psys ? psys->particles : NULL;
 
        ParticleInterpolationData pind;
        ParticleKey result;
        
        float birthtime = 0.0, dietime = 0.0;
-       float t, time = 0.0, keytime = 0.0, dfra = 1.0, frs_sec;
+       float t, time = 0.0, keytime = 0.0, frs_sec;
        float hairmat[4][4];
        int k,i;
        int steps = (int)pow(2.0, (double)pset->draw_step);
@@ -3161,7 +3160,7 @@ void object_add_particle_system(Scene *scene, Object *ob)
        psys->cfra=bsystem_time(scene,ob,scene->r.cfra+1,0.0);
 
        DAG_scene_sort(scene);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 }
 void object_remove_particle_system(Scene *scene, Object *ob)
 {
@@ -3184,7 +3183,7 @@ void object_remove_particle_system(Scene *scene, Object *ob)
                ((ParticleSystem *) ob->particlesystem.first)->flag |= PSYS_CURRENT;
 
        DAG_scene_sort(scene);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 }
 static void default_particle_settings(ParticleSettings *part)
 {
@@ -3364,7 +3363,7 @@ void psys_flush_particle_settings(Scene *scene, ParticleSettings *part, int reca
                        }
                }
                if(flush)
-                       DAG_object_flush_update(scene, base->object, OB_RECALC_DATA);
+                       DAG_id_flush_update(&base->object->id, OB_RECALC_DATA);
        }
 }
 
@@ -3396,7 +3395,7 @@ LinkNode *psys_using_settings(struct Scene *scene, ParticleSettings *part, int f
                }
 
                if(flush_update && found)
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        }
 
        return node;
index c0223d1690c9ddfe03aa1e6eba7d59c750bcbbef..7a156f56d725727c1e964a82d7a95ed094408a38 100644 (file)
@@ -1947,7 +1947,7 @@ void BKE_ptcache_set_continue_physics(Scene *scene, int enable)
                if(CONTINUE_PHYSICS == 0) {
                        for(ob=G.main->object.first; ob; ob=ob->id.next)
                                if(BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED))
-                                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                }
        }
 }
index 9f83733a64060a496959b70e7d72b4ee9a270494..65051c384b325cc0d9ad8859917aac3edf7d7d6a 100644 (file)
@@ -340,7 +340,7 @@ void ED_armature_from_edit(Scene *scene, Object *obedit)
                        armature_rebuild_pose(obt, arm);
        }
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
 }
 
 
@@ -1054,8 +1054,8 @@ static int separate_armature_exec (bContext *C, wmOperator *op)
        /* 4) fix links before depsgraph flushes */ // err... or after?
        separated_armature_fix_links(oldob, newob);
        
-       DAG_object_flush_update(scene, oldob, OB_RECALC_DATA);  /* this is the original one */
-       DAG_object_flush_update(scene, newob, OB_RECALC_DATA);  /* this is the separated one */
+       DAG_id_flush_update(&oldob->id, OB_RECALC_DATA);        /* this is the original one */
+       DAG_id_flush_update(&newob->id, OB_RECALC_DATA);        /* this is the separated one */
        
        
        /* 5) restore original conditions */
@@ -1890,7 +1890,7 @@ void mouse_armature(bContext *C, short mval[2], int extend)
                        if(nearBone->flag & BONE_SELECTED) nearBone->flag |= BONE_ACTIVE;
                }
                
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
+               WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, vc.obedit);
        }
 }
 
@@ -4335,7 +4335,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor
                if (ob->mode & OB_MODE_WEIGHT_PAINT) {
                        if (nearBone->flag & BONE_ACTIVE) {
                                vertexgroup_select_by_name(OBACT, nearBone->name);
-                               DAG_object_flush_update(scene, OBACT, OB_RECALC_DATA);
+                               DAG_id_flush_update(&OBACT->id, OB_RECALC_DATA);
                        }
                }
                
@@ -4765,7 +4765,6 @@ void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mod
 
 static int pose_clear_scale_exec(bContext *C, wmOperator *op) 
 {
-       Scene *scene = CTX_data_scene(C);
        Object *ob= CTX_data_active_object(C);
        
        /* only clear those channels that are not locked */
@@ -4782,7 +4781,7 @@ static int pose_clear_scale_exec(bContext *C, wmOperator *op)
        }
        CTX_DATA_END;
        
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        /* note, notifier might evolve */
        WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
@@ -4807,7 +4806,6 @@ void POSE_OT_scale_clear(wmOperatorType *ot)
 
 static int pose_clear_loc_exec(bContext *C, wmOperator *op) 
 {
-       Scene *scene = CTX_data_scene(C);
        Object *ob= CTX_data_active_object(C);
        
        /* only clear those channels that are not locked */
@@ -4824,7 +4822,7 @@ static int pose_clear_loc_exec(bContext *C, wmOperator *op)
        }
        CTX_DATA_END;
        
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        /* note, notifier might evolve */
        WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
@@ -4849,7 +4847,6 @@ void POSE_OT_loc_clear(wmOperatorType *ot)
 
 static int pose_clear_rot_exec(bContext *C, wmOperator *op) 
 {
-       Scene *scene = CTX_data_scene(C);
        Object *ob= CTX_data_active_object(C);
        
        /* only clear those channels that are not locked */
@@ -4899,7 +4896,7 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op)
        }
        CTX_DATA_END;
        
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        /* note, notifier might evolve */
        WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
@@ -5337,7 +5334,6 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
 
 static int armature_flip_names_exec (bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_edit_object(C);
        bArmature *arm;
        char newname[32];
@@ -5357,7 +5353,7 @@ static int armature_flip_names_exec (bContext *C, wmOperator *op)
        CTX_DATA_END;
        
        /* since we renamed stuff... */
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        /* note, notifier might evolve */
        WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
@@ -5383,7 +5379,6 @@ void ARMATURE_OT_flip_names (wmOperatorType *ot)
 
 static int armature_autoside_names_exec (bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_edit_object(C);
        bArmature *arm;
        char newname[32];
@@ -5404,7 +5399,7 @@ static int armature_autoside_names_exec (bContext *C, wmOperator *op)
        CTX_DATA_END;
        
        /* since we renamed stuff... */
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        /* note, notifier might evolve */
        WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
index 021bec05a3ba53d02c9cf316af2c84c5c66e3918..56d714fd058c624d948309e34365219b1e2cd6d8 100644 (file)
@@ -843,7 +843,7 @@ static void poselib_preview_apply (bContext *C, wmOperator *op)
                 */
                // FIXME: shouldn't this use the builtin stuff?
                if ((pld->arm->flag & ARM_DELAYDEFORM)==0)
-                       DAG_object_flush_update(pld->scene, pld->ob, OB_RECALC_DATA);  /* sets recalc flags */
+                       DAG_id_flush_update(&pld->ob->id, OB_RECALC_DATA);  /* sets recalc flags */
                else
                        where_is_pose(pld->scene, pld->ob);
        }
@@ -1346,7 +1346,7 @@ static void poselib_preview_cleanup (bContext *C, wmOperator *op)
                 *      - note: code copied from transform_generics.c -> recalcData()
                 */
                if ((arm->flag & ARM_DELAYDEFORM)==0)
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);  /* sets recalc flags */
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);  /* sets recalc flags */
                else
                        where_is_pose(scene, ob);
                
@@ -1360,7 +1360,7 @@ static void poselib_preview_cleanup (bContext *C, wmOperator *op)
                action_set_activemarker(act, marker, 0);
                
                /* Update event for pose and deformation children */
-               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+               DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                
                /* updates */
                if (IS_AUTOKEY_MODE(scene, NORMAL)) {
index 9a72fce2bcfe729d94cb906950d5867a3c8cbc05..2673640b2132f1388ffce8c3b0324e15df43b364 100644 (file)
@@ -893,7 +893,7 @@ void pose_copy_menu(Scene *scene)
                        ob->pose->flag |= POSE_RECALC;
        }
        
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);     // and all its relations
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);   // and all its relations
        
        BIF_undo_push("Copy Pose Attributes");
        
@@ -1067,7 +1067,7 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
        }
 
        /* Update event for pose and deformation children */
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        
        if (IS_AUTOKEY_ON(scene)) {
 // XXX         remake_action_ipos(ob->action);
@@ -1124,7 +1124,7 @@ void pose_adds_vgroups(Scene *scene, Object *meshobj, int heatweights)
 
        
        // and all its relations
-       DAG_object_flush_update(scene, meshobj, OB_RECALC_DATA);
+       DAG_id_flush_update(&meshobj->id, OB_RECALC_DATA);
 }
 
 /* ********************************************** */
@@ -1540,7 +1540,6 @@ void pose_select_grouped_menu (Scene *scene)
 
 static int pose_flip_names_exec (bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_active_object(C);
        bArmature *arm;
        char newname[32];
@@ -1560,7 +1559,7 @@ static int pose_flip_names_exec (bContext *C, wmOperator *op)
        CTX_DATA_END;
        
        /* since we renamed stuff... */
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        /* note, notifier might evolve */
        WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
@@ -1587,7 +1586,6 @@ void POSE_OT_flip_names (wmOperatorType *ot)
 
 static int pose_autoside_names_exec (bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_active_object(C);
        bArmature *arm;
        char newname[32];
@@ -1608,7 +1606,7 @@ static int pose_autoside_names_exec (bContext *C, wmOperator *op)
        CTX_DATA_END;
        
        /* since we renamed stuff... */
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        /* note, notifier might evolve */
        WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
@@ -1677,7 +1675,7 @@ void pose_activate_flipped_bone(Scene *scene)
                                /* in weightpaint we select the associated vertex group too */
                                if(ob->mode & OB_MODE_WEIGHT_PAINT) {
                                        vertexgroup_select_by_name(OBACT, name);
-                                       DAG_object_flush_update(scene, OBACT, OB_RECALC_DATA);
+                                       DAG_id_flush_update(&OBACT->id, OB_RECALC_DATA);
                                }
                                
                                // XXX notifiers need to be sent to other editors to update
@@ -2116,7 +2114,7 @@ void pose_relax(Scene *scene)
                pchan->bone->flag &= ~ BONE_TRANSFORM;
        
        /* do depsgraph flush */
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        BIF_undo_push("Relax Pose");
 }
 
@@ -2211,7 +2209,7 @@ void pose_clear_user_transforms(Scene *scene, Object *ob)
                rest_pose(ob->pose);
        }
        
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        BIF_undo_push("Clear User Transform");
 }
 
index 28a9d3ac7c9074b70bf7c8b50e9a9ab9f5df0834..4246c889de0964e104a24135c6c598061573c671 100644 (file)
@@ -409,10 +409,10 @@ static int separate_exec(bContext *C, wmOperator *op)
        load_editNurb(newob);
        free_editNurb(newob);
 
-       DAG_object_flush_update(scene, oldob, OB_RECALC_DATA);  /* this is the original one */
-       DAG_object_flush_update(scene, newob, OB_RECALC_DATA);  /* this is the separated one */
+       DAG_id_flush_update(&oldob->id, OB_RECALC_DATA);        /* this is the original one */
+       DAG_id_flush_update(&newob->id, OB_RECALC_DATA);        /* this is the separated one */
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, oldob);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, oldob->data);
 
        WM_cursor_wait(0);
 
@@ -1005,8 +1005,8 @@ static int switch_direction_exec(bContext *C, wmOperator *op)
                if(isNurbsel(nu))
                        switchdirectionNurb(nu);
        
-       DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -1052,8 +1052,8 @@ static int set_weight_exec(bContext *C, wmOperator *op)
                }
        }       
 
-       DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -1103,8 +1103,8 @@ static int set_radius_exec(bContext *C, wmOperator *op)
                }
        }       
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-       DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 
        return OPERATOR_FINISHED;
 }
@@ -1178,8 +1178,8 @@ static int smooth_exec(bContext *C, wmOperator *op)
                }
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-       DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 
        return OPERATOR_FINISHED;
 }
@@ -1343,8 +1343,8 @@ static int smooth_radius_exec(bContext *C, wmOperator *op)
                }
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-       DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 
        return OPERATOR_FINISHED;
 }
@@ -1493,7 +1493,7 @@ static int de_select_first_exec(bContext *C, wmOperator *op)
        Object *obedit= CTX_data_edit_object(C);
 
        selectend_nurb(obedit, FIRST, 1, DESELECT);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -1517,7 +1517,7 @@ static int de_select_last_exec(bContext *C, wmOperator *op)
        Object *obedit= CTX_data_edit_object(C);
 
        selectend_nurb(obedit, LAST, 1, DESELECT);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -1585,7 +1585,7 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
                select_adjacent_cp(editnurb, 1, 1, SELECT); /* cascade selection */
        }
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -1654,8 +1654,8 @@ static int hide_exec(bContext *C, wmOperator *op)
                }
        }
 
-       DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;       
 }
@@ -1714,8 +1714,8 @@ static int reveal_exec(bContext *C, wmOperator *op)
                }
        }
 
-       DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;       
 }
@@ -1770,7 +1770,7 @@ static int select_inverse_exec(bContext *C, wmOperator *op)
                }
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;       
 }
@@ -2166,8 +2166,8 @@ static int subdivide_exec(bContext *C, wmOperator *op)
                } /* End of 'if((nu->type & 7)==CU_NURBS)'  */
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-       DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 
        return OPERATOR_FINISHED;       
 }
@@ -2500,14 +2500,13 @@ void CURVE_OT_spline_type_set(wmOperatorType *ot)
 
 static int set_handle_type_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        ListBase *editnurb= curve_get_editcurve(obedit);
 
        sethandlesNurb(editnurb, RNA_enum_get(op->ptr, "type"));
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 
        return OPERATOR_FINISHED;
 }
@@ -2861,8 +2860,8 @@ static int merge_nurb(bContext *C, wmOperator *op)
        
        set_actNurb(obedit, NULL);
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-       DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        
        return OPERATOR_FINISHED;
 }
@@ -2870,7 +2869,6 @@ static int merge_nurb(bContext *C, wmOperator *op)
 static int make_segment_exec(bContext *C, wmOperator *op)
 {
        /* joins 2 curves */
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        ListBase *editnurb= curve_get_editcurve(obedit);
        Nurb *nu, *nu1=0, *nu2=0;
@@ -3015,8 +3013,8 @@ static int make_segment_exec(bContext *C, wmOperator *op)
                
                set_actNurb(obedit, NULL);      /* for selected */
 
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-               DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); 
+               WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+               DAG_id_flush_update(obedit->data, OB_RECALC_DATA);      
 
                return OPERATOR_FINISHED;
        }
@@ -3100,7 +3098,7 @@ void mouse_nurb(bContext *C, short mval[2], int extend)
 
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
        
        if(nu!=get_actNurb(obedit))
                set_actNurb(obedit, nu);
@@ -3231,8 +3229,8 @@ static int spin_exec(bContext *C, wmOperator *op)
                return OPERATOR_CANCELLED;
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 
        return OPERATOR_FINISHED;
 }
@@ -3255,7 +3253,6 @@ void CURVE_OT_spin(wmOperatorType *ot)
 
 static int addvert_Nurb(bContext *C, short mode, float location[3])
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        ListBase *editnurb= curve_get_editcurve(obedit);
        Nurb *nu;
@@ -3367,8 +3364,8 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
 
        test2DNurb(nu);
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 
        return OPERATOR_FINISHED;
 }
@@ -3423,7 +3420,6 @@ void CURVE_OT_vertex_add(wmOperatorType *ot)
 
 static int extrude_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        ListBase *editnurb= curve_get_editcurve(obedit);
        Nurb *nu;
@@ -3438,8 +3434,8 @@ static int extrude_exec(bContext *C, wmOperator *op)
        }
        else {
                if(extrudeflagNurb(editnurb, 1)) { /* '1'= flag */
-                       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-                       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+                       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+                       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
                }
        }
 
@@ -3549,8 +3545,8 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
                }
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-       DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 
        return OPERATOR_FINISHED;
 }
@@ -3641,7 +3637,7 @@ static int select_linked_exec(bContext *C, wmOperator *op)
                }
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
        
        return OPERATOR_FINISHED;
 }
@@ -3733,7 +3729,7 @@ static int select_row_exec(bContext *C, wmOperator *op)
                }
        }
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -3760,7 +3756,7 @@ static int select_next_exec(bContext *C, wmOperator *op)
        ListBase *editnurb= curve_get_editcurve(obedit);
        
        select_adjacent_cp(editnurb, 1, 0, SELECT);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -3787,7 +3783,7 @@ static int select_previous_exec(bContext *C, wmOperator *op)
        ListBase *editnurb= curve_get_editcurve(obedit);
        
        select_adjacent_cp(editnurb, -1, 0, SELECT);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -3874,7 +3870,7 @@ static int select_more_exec(bContext *C, wmOperator *op)
                select_adjacent_cp(editnurb, -1, 0, SELECT);
        }
                
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -4035,7 +4031,7 @@ static int select_less_exec(bContext *C, wmOperator *op)
                }
        }
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -4131,7 +4127,7 @@ static int select_random_exec(bContext *C, wmOperator *op)
                
        MEM_freeN(itemstobeselected);
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -4165,7 +4161,7 @@ static int select_every_nth_exec(bContext *C, wmOperator *op)
        select_adjacent_cp(editnurb, n, 1, SELECT);
        select_adjacent_cp(editnurb, -n, 1, SELECT);
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -4231,7 +4227,6 @@ void CURVE_OT_duplicate(wmOperatorType *ot)
 
 static int delete_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        ListBase *editnurb= curve_get_editcurve(obedit);
        Nurb *nu, *next, *nu1;
@@ -4243,8 +4238,8 @@ static int delete_exec(bContext *C, wmOperator *op)
                if(type==0) deleteflagNurb(C, op, 1);
                else freeNurblist(editnurb);
 
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-               DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+               WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+               DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        
                return OPERATOR_FINISHED;
        }
@@ -4373,8 +4368,8 @@ static int delete_exec(bContext *C, wmOperator *op)
                                                                bezt2= bezt+(nu->pntsu-1);
                                                                if( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) {
                                                                        nu->flagu &= ~CU_CYCLIC;
-                                                                       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-                                                                       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+                                                                       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+                                                                       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
                                                                }
                                                        }
 
@@ -4399,8 +4394,8 @@ static int delete_exec(bContext *C, wmOperator *op)
                                                                bp2= bp+(nu->pntsu-1);
                                                                if( bp2->f1 & SELECT ) {
                                                                        nu->flagu &= ~CU_CYCLIC;
-                                                                       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-                                                                       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+                                                                       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+                                                                       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
                                                                }
                                                        }
 
@@ -4497,8 +4492,8 @@ static int delete_exec(bContext *C, wmOperator *op)
        else if(type==2)
                freeNurblist(editnurb);
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        
        return OPERATOR_FINISHED;
 }
@@ -4569,8 +4564,8 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
                }
        }
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-       DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 
        return OPERATOR_FINISHED;
 }
@@ -5119,8 +5114,8 @@ static int clear_tilt_exec(bContext *C, wmOperator *op)
                }
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-       DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 
        return OPERATOR_FINISHED;
 }
index 46be95063ec1090b02fc88c9d79ec9c5abf2329b..ae34f30a4f16c34cd90521e287a02073a4e30e23 100644 (file)
@@ -273,15 +273,14 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re
        BKE_text_to_curve(scene, obedit, mode);
 
        if(recalc)
-               DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+               DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 }
 
 /********************** insert lorem operator *********************/
 
 static int insert_lorem_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        char *p, *p2;
        int i;
@@ -308,8 +307,8 @@ static int insert_lorem_exec(bContext *C, wmOperator *op)
        insert_into_textbuf(obedit, '\n');
        insert_into_textbuf(obedit, '\n');      
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -614,7 +613,6 @@ static EnumPropertyItem style_items[]= {
 
 static int set_style(bContext *C, int style, int clear)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        Curve *cu= obedit->data;
        EditFont *ef= cu->editfont;
@@ -630,8 +628,8 @@ static int set_style(bContext *C, int style, int clear)
                        ef->textbufinfo[i].flag |= style;
        }
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
index 6aa5f5efc418c682e86c8f913f011ee9a3201a4e..d253948e2e8eca608e41afbdd7a5daf37b03f672 100644 (file)
@@ -328,7 +328,6 @@ void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname
 
 static void modifiers_setOnCage(bContext *C, void *ob_v, void *md_v)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob = ob_v;
        ModifierData *md;
        
@@ -343,12 +342,11 @@ static void modifiers_setOnCage(bContext *C, void *ob_v, void *md_v)
        }
 
        WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 }
 
 static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob = ob_v;
        ModifierData *md = md_v;
        ModifierData *nmd = modifier_new(md->type);
@@ -361,7 +359,7 @@ static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v)
        ob->partype = PAROBJECT;
 
        WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        ED_undo_push(C, "Modifier convert to real");
 }
@@ -597,8 +595,8 @@ void do_constraint_panels(bContext *C, void *arg, int event)
        
        if(ob->pose) update_pose_constraint_flags(ob->pose);
        
-       if(ob->type==OB_ARMATURE) DAG_object_flush_update(scene, ob, OB_RECALC_DATA|OB_RECALC_OB);
-       else DAG_object_flush_update(scene, ob, OB_RECALC_OB);
+       if(ob->type==OB_ARMATURE) DAG_id_flush_update(&ob->id, OB_RECALC_DATA|OB_RECALC_OB);
+       else DAG_id_flush_update(&ob->id, OB_RECALC_OB);
        
        // XXX allqueue(REDRAWVIEW3D, 0);
        // XXX allqueue(REDRAWBUTSOBJECT, 0);
index c3f1637d3aff5779b40ddbeb7009a9bfed20e6ef..980d699dda51979d96c8fc97c75253e9b3bd7805 100644 (file)
@@ -1280,7 +1280,7 @@ void load_editMesh(Scene *scene, Object *ob)
 void remake_editMesh(Scene *scene, Object *ob)
 {
        make_editMesh(scene, ob);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        BIF_undo_push("Undo all changes");
 }
 
@@ -1390,8 +1390,8 @@ static int mesh_separate_selected(Scene *scene, Base *editbase)
        /* hashedges are invalid now, make new! */
        editMesh_set_hash(em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); 
-       DAG_object_flush_update(scene, basenew->object, OB_RECALC_DATA);        
+       DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);       
+       DAG_id_flush_update(&basenew->object->id, OB_RECALC_DATA);      
 
        BKE_mesh_end_editmesh(me, em);
 
@@ -1469,7 +1469,7 @@ static int mesh_separate_exec(bContext *C, wmOperator *op)
                retval= mesh_separate_loose(scene, base);
           
        if(retval) {
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, base->object);
+               WM_event_add_notifier(C, NC_GEOM|ND_DATA, base->object->data);
                return OPERATOR_FINISHED;
        }
        return OPERATOR_CANCELLED;
index 19078d2f6ff5da8274b8d22943dd1a6f1bca39ab..4af5ddf56fa7ca56f9e48f062fd3577710e574f8 100644 (file)
@@ -217,8 +217,8 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
        }
        
        //retopo_do_all();
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit); 
-       DAG_object_flush_update(vc.scene, vc.obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, vc.obedit->data); 
+       DAG_id_flush_update(vc.obedit->data, OB_RECALC_DATA);
        
        return OPERATOR_FINISHED;
 }
@@ -343,9 +343,8 @@ static int make_fgon_exec(bContext *C, wmOperator *op)
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
 
        if( make_fgon(em, op, 1) ) {
-               DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);     
-       
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+               DAG_id_flush_update(obedit->data, OB_RECALC_DATA);      
+               WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
                BKE_mesh_end_editmesh(obedit->data, em);
                return OPERATOR_FINISHED;
@@ -376,9 +375,8 @@ static int clear_fgon_exec(bContext *C, wmOperator *op)
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        
        if( make_fgon(em, op, 0) ) {
-               DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);     
-               
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+               DAG_id_flush_update(obedit->data, OB_RECALC_DATA);      
+               WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
                
                BKE_mesh_end_editmesh(obedit->data, em);
                return OPERATOR_FINISHED;
@@ -666,7 +664,7 @@ void addfaces_from_edgenet(EditMesh *em)
 
        EM_select_flush(em);
        
-// XXX DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+// XXX DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 }
 
 static void addedgeface_mesh(EditMesh *em, wmOperator *op)
@@ -695,7 +693,7 @@ static void addedgeface_mesh(EditMesh *em, wmOperator *op)
                eed= addedgelist(em, neweve[0], neweve[1], NULL);
                EM_select_edge(eed, 1);
 
-               // XXX          DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); 
+               // XXX          DAG_id_flush_update(obedit->data, OB_RECALC_DATA);      
                return;
        }
        else if(amount > 4) {
@@ -792,9 +790,8 @@ static int addedgeface_mesh_exec(bContext *C, wmOperator *op)
        
        addedgeface_mesh(em, op);
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-       
-       DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);     
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);      
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
        
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -1311,7 +1308,6 @@ static float new_primitive_matrix(bContext *C, float primmat[][4])
 
 static int add_primitive_plane_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1321,8 +1317,8 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op)
        
        make_prim(obedit, PRIM_PLANE, mat, 4, 0, 0, dia, 0.0f, 0, 1);
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
        
        return OPERATOR_FINISHED;       
 }
@@ -1344,7 +1340,6 @@ void MESH_OT_primitive_plane_add(wmOperatorType *ot)
 
 static int add_primitive_cube_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1354,8 +1349,8 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op)
        
        make_prim(obedit, PRIM_CUBE, mat, 4, 0, 0, dia, 1.0f, 1, 1);
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
        
        return OPERATOR_FINISHED;       
 }
@@ -1377,7 +1372,6 @@ void MESH_OT_primitive_cube_add(wmOperatorType *ot)
 
 static int add_primitive_circle_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1387,8 +1381,8 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op)
        make_prim(obedit, PRIM_CIRCLE, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, 0.0f, 0, 
                          RNA_boolean_get(op->ptr, "fill"));
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
        
        return OPERATOR_FINISHED;       
 }
@@ -1415,7 +1409,6 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot)
 
 static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1425,8 +1418,8 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
        make_prim(obedit, PRIM_CYLINDER, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, 
                          RNA_float_get(op->ptr, "depth"), 1, 1);
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
        
        return OPERATOR_FINISHED;       
 }
@@ -1453,7 +1446,6 @@ void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
 
 static int add_primitive_tube_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1463,8 +1455,8 @@ static int add_primitive_tube_exec(bContext *C, wmOperator *op)
        make_prim(obedit, PRIM_CYLINDER, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, 
                          RNA_float_get(op->ptr, "depth"), 1, 0);
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
        
        return OPERATOR_FINISHED;       
 }
@@ -1491,7 +1483,6 @@ void MESH_OT_primitive_tube_add(wmOperatorType *ot)
 
 static int add_primitive_cone_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1501,8 +1492,8 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op)
        make_prim(obedit, PRIM_CONE, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, 
                          RNA_float_get(op->ptr, "depth"), 0, RNA_boolean_get(op->ptr, "cap_end"));
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
        
        return OPERATOR_FINISHED;       
 }
@@ -1531,7 +1522,6 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot)
 
 static int add_primitive_grid_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1541,8 +1531,8 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op)
        make_prim(obedit, PRIM_GRID, mat, RNA_int_get(op->ptr, "x_subdivisions"), 
                          RNA_int_get(op->ptr, "y_subdivisions"), 0, dia, 0.0f, 0, 1);
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
        
        return OPERATOR_FINISHED;       
 }
@@ -1569,7 +1559,6 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot)
 
 static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float mat[4][4];
        
@@ -1577,8 +1566,8 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
        
        make_prim(obedit, PRIM_MONKEY, mat, 0, 0, 2, 0.0f, 0.0f, 0, 0);
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
        
        return OPERATOR_FINISHED;       
 }
@@ -1600,7 +1589,6 @@ void MESH_OT_primitive_monkey_add(wmOperatorType *ot)
 
 static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1610,8 +1598,8 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
        make_prim(obedit, PRIM_UVSPHERE, mat, RNA_int_get(op->ptr, "rings"), 
                          RNA_int_get(op->ptr, "segments"), 0, dia, 0.0f, 0, 0);
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
        
        return OPERATOR_FINISHED;       
 }
@@ -1638,7 +1626,6 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot)
 
 static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1648,8 +1635,8 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
        make_prim(obedit, PRIM_ICOSPHERE, mat, 0, 0, 
                          RNA_int_get(op->ptr, "subdivisions"), dia, 0.0f, 0, 0);
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
        
        return OPERATOR_FINISHED;       
 }
@@ -1677,7 +1664,6 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
 
 static int mesh_duplicate_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(ob->data);
 
@@ -1685,8 +1671,8 @@ static int mesh_duplicate_exec(bContext *C, wmOperator *op)
 
        BKE_mesh_end_editmesh(ob->data, em);
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+       DAG_id_flush_update(ob->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
        
        return OPERATOR_FINISHED;
 }
index b46f745e8f5a927c1984c3f798557c76ce021ad1..4c3e76f2285894bf4616d746f82e6afa1859b9d3 100644 (file)
@@ -389,7 +389,7 @@ void CutEdgeloop(Object *obedit, wmOperator *op, EditMesh *em, int numcuts)
                EM_selectmode_set(em);
        }       
        
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+//     DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        return;
 }
 
@@ -624,7 +624,6 @@ static float seg_intersect(EditEdge *e, CutCurve *c, int len, char mode, struct
 
 static int knife_cut_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        ARegion *ar= CTX_wm_region(C);
@@ -705,8 +704,8 @@ static int knife_cut_exec(bContext *C, wmOperator *op)
        
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
index f2c5b7fb727b709dcc79eb03a0eb4e80fb4ec7fb..667a889b5fca2d3068e10f2fb6d6a8988bdd2ae5 100644 (file)
@@ -127,7 +127,7 @@ void EM_automerge(int update)
 //             if (len) {
 //                     em->totvert -= len; /* saves doing a countall */
 //                     if (update) {
-//                             DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+//                             DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 //                     }
 //             }
 //     }
@@ -807,7 +807,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
        if (selcount) {
                /* here was an edge-mode only select flush case, has to be generalized */
                EM_selectmode_flush(em);
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
                BKE_mesh_end_editmesh(me, em);
                return OPERATOR_FINISHED;
        }
@@ -839,7 +839,7 @@ static EnumPropertyItem prop_simedge_types[] = {
        {0, NULL, 0, NULL, NULL}
 };
 
-static int similar_edge_select__internal(Scene *scene, EditMesh *em, int mode)
+static int similar_edge_select__internal(ToolSettings *ts, EditMesh *em, int mode)
 {
        EditEdge *eed, *base_eed=NULL;
        unsigned int selcount=0; /* count how many new edges we select*/
@@ -849,7 +849,7 @@ static int similar_edge_select__internal(Scene *scene, EditMesh *em, int mode)
        unsigned int deselcount=0;
        
        short ok=0;
-       float thresh= scene->toolsettings->select_thresh;
+       float thresh= ts->select_thresh;
        
        for(eed= em->edges.first; eed; eed= eed->next) {
                if (!eed->h) {
@@ -1039,17 +1039,17 @@ static int similar_edge_select__internal(Scene *scene, EditMesh *em, int mode)
 /* wrap the above function but do selection flushing edge to face */
 static int similar_edge_select_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Object *obedit= CTX_data_edit_object(C);
        Mesh *me= obedit->data;
        EditMesh *em= BKE_mesh_get_editmesh(me); 
 
-       int selcount = similar_edge_select__internal(scene, em, RNA_int_get(op->ptr, "type"));
+       int selcount = similar_edge_select__internal(ts, em, RNA_int_get(op->ptr, "type"));
        
        if (selcount) {
                /* here was an edge-mode only select flush case, has to be generalized */
                EM_selectmode_flush(em);
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
                BKE_mesh_end_editmesh(me, em);
                return OPERATOR_FINISHED;
        }
@@ -1081,7 +1081,7 @@ static EnumPropertyItem prop_simvertex_types[] = {
 
 static int similar_vert_select_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Object *obedit= CTX_data_edit_object(C);
        Mesh *me= obedit->data;
        EditMesh *em= BKE_mesh_get_editmesh(me); 
@@ -1094,7 +1094,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
        int mode= RNA_enum_get(op->ptr, "type");
        
        short ok=0;
-       float thresh= scene->toolsettings->select_thresh;
+       float thresh= ts->select_thresh;
        
        for(eve= em->verts.first; eve; eve= eve->next) {
                if (!eve->h) {
@@ -1207,7 +1207,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
        } /* end basevert loop */
 
        if(selcount) {
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
                BKE_mesh_end_editmesh(me, em);
                return OPERATOR_FINISHED;
        }
@@ -1413,7 +1413,7 @@ void EM_mesh_copy_edge(EditMesh *em, short type)
        }
        
        if (change) {
-//             DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+//             DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
                
        }
 }
@@ -1541,7 +1541,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type)
        }
        
        if (change) {
-//             DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+//             DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
                
        }
 }
@@ -1671,7 +1671,7 @@ void EM_mesh_copy_face_layer(EditMesh *em, wmOperator *op, short type)
        }
 
        if (change) {
-//             DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+//             DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
                
        }
 }
@@ -1991,7 +1991,7 @@ static int loop_multiselect(bContext *C, wmOperator *op)
        MEM_freeN(edarray);
 //     if (EM_texFaceCheck())
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -2060,7 +2060,7 @@ static void mouse_mesh_loop(bContext *C, short mval[2], short extend, short ring
                EM_selectmode_flush(em);
 //                     if (EM_texFaceCheck())
                
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
+               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
        }
 }
 
@@ -2159,9 +2159,8 @@ static void mouse_mesh_shortest_path(bContext *C, short mval[2])
                                break;
                }
                
-               DAG_object_flush_update(vc.scene, vc.obedit, OB_RECALC_DATA);
-       
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
+               DAG_id_flush_update(vc.obedit->data, OB_RECALC_DATA);
+               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
        }
 }
 
@@ -2261,7 +2260,7 @@ void mouse_mesh(bContext *C, short mval[2], short extend)
                }
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
        
 }
 
@@ -2405,12 +2404,12 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
        /* return warning! */
        if(limit) {
                int retval= select_linked_limited_invoke(&vc, 0, sel);
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
                return retval;
        }
        
        if( unified_findnearest(&vc, &eve, &eed, &efa)==0 ) {
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
        
                return OPERATOR_CANCELLED;
        }
@@ -2464,7 +2463,7 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
        
 //     if (EM_texFaceCheck())
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
        return OPERATOR_FINISHED;       
 }
 
@@ -2545,7 +2544,7 @@ static int select_linked_exec(bContext *C, wmOperator *op)
        else
                selectconnected_mesh_all(em);
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -2671,7 +2670,7 @@ void EM_hide_mesh(EditMesh *em, int swap)
        em->totedgesel= em->totfacesel= em->totvertsel= 0;
 //     if(EM_texFaceCheck())
 
-       //      DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); 
+       //      DAG_id_flush_update(obedit->data, OB_RECALC_DATA);      
 }
 
 static int hide_mesh_exec(bContext *C, wmOperator *op)
@@ -2681,7 +2680,7 @@ static int hide_mesh_exec(bContext *C, wmOperator *op)
        
        EM_hide_mesh(em, RNA_boolean_get(op->ptr, "unselected"));
                
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -2738,7 +2737,7 @@ void EM_reveal_mesh(EditMesh *em)
        EM_selectmode_flush(em);
 
 //     if (EM_texFaceCheck())
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); 
+//     DAG_id_flush_update(obedit->data, OB_RECALC_DATA);      
 }
 
 static int reveal_mesh_exec(bContext *C, wmOperator *op)
@@ -2748,7 +2747,7 @@ static int reveal_mesh_exec(bContext *C, wmOperator *op)
        
        EM_reveal_mesh(em);
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -2798,7 +2797,7 @@ int select_by_number_vertices_exec(bContext *C, wmOperator *op)
                }
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
        
        return OPERATOR_FINISHED;
 }
@@ -2924,7 +2923,7 @@ static int select_sharp_edges_exec(bContext *C, wmOperator *op)
 
 //     if (EM_texFaceCheck())
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); //TODO is this needed ?
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); //TODO is this needed ?
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -3092,7 +3091,7 @@ static int select_linked_flat_faces_exec(bContext *C, wmOperator *op)
        
        select_linked_flat_faces(em, op, RNA_float_get(op->ptr, "sharpness"));
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -3193,7 +3192,7 @@ static int select_non_manifold_exec(bContext *C, wmOperator *op)
        
        select_non_manifold(em, op);
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -3257,7 +3256,7 @@ static int select_inverse_mesh_exec(bContext *C, wmOperator *op)
        
        EM_select_swap(em);
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -3295,7 +3294,7 @@ static int toggle_select_all_exec(bContext *C, wmOperator *op)
        
        EM_toggle_select_all(em);
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);     
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);      
        BKE_mesh_end_editmesh(obedit->data, em);
 
        return OPERATOR_FINISHED;
@@ -3366,7 +3365,7 @@ static int select_more(bContext *C, wmOperator *op)
 
 //     if (EM_texFaceCheck(em))
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -3456,7 +3455,7 @@ static int select_less(bContext *C, wmOperator *op)
        EM_select_less(em);
 
 //     if (EM_texFaceCheck(em))
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -3526,7 +3525,7 @@ static int mesh_select_random_exec(bContext *C, wmOperator *op)
        
        selectrandom_mesh(em, RNA_float_get(op->ptr,"percent"));
                
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
        
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -3577,7 +3576,7 @@ void EM_deselect_by_material(EditMesh *em, int index)
        EM_selectmode_flush(em);
 }
 
-static void mesh_selection_type(Scene *scene, EditMesh *em, int val)
+static void mesh_selection_type(ToolSettings *ts, EditMesh *em, int val)
 {
        if(val>0) {
                if(val==1) { 
@@ -3598,7 +3597,7 @@ static void mesh_selection_type(Scene *scene, EditMesh *em, int val)
                
                /* note, em stores selectmode to be able to pass it on everywhere without scene,
                   this is only until all select modes and toolsettings are settled more */
-               scene->toolsettings->selectmode= em->selectmode;
+               ts->selectmode= em->selectmode;
 //             if (EM_texFaceCheck())
        }
 }
@@ -3612,13 +3611,13 @@ static EnumPropertyItem prop_mesh_edit_types[] = {
 
 static int mesh_selection_type_exec(bContext *C, wmOperator *op)
 {              
-       
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
 
-       mesh_selection_type(CTX_data_scene(C), em, RNA_enum_get(op->ptr,"type"));
+       mesh_selection_type(ts, em, RNA_enum_get(op->ptr,"type"));
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
        
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -3648,7 +3647,6 @@ void MESH_OT_selection_type(wmOperatorType *ot)
 
 static int editmesh_mark_seam(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        Mesh *me= ((Mesh *)obedit->data);
@@ -3681,8 +3679,8 @@ static int editmesh_mark_seam(bContext *C, wmOperator *op)
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -3706,7 +3704,6 @@ void MESH_OT_mark_seam(wmOperatorType *ot)
 
 static int editmesh_mark_sharp(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        Mesh *me= ((Mesh *)obedit->data);
@@ -3734,8 +3731,8 @@ static int editmesh_mark_sharp(bContext *C, wmOperator *op)
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -3965,7 +3962,7 @@ void righthandfaces(EditMesh *em, int select)     /* makes faces righthand turning *
 
        recalc_editnormals(em);
        
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+//     DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 
        waitcursor(0);
 }
@@ -3973,7 +3970,6 @@ void righthandfaces(EditMesh *em, int select)     /* makes faces righthand turning *
 
 static int righthandfaces_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        
@@ -3984,8 +3980,8 @@ static int righthandfaces_exec(bContext *C, wmOperator *op)
        
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); //TODO is this needed ?
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); //TODO is this needed ?
 
        return OPERATOR_FINISHED;       
 }
@@ -4185,7 +4181,7 @@ void editmesh_align_view_to_selected(Object *obedit, EditMesh *em, wmOperator *o
 
 static int smooth_vertex(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        EditVert *eve, *eve_mir = NULL;
@@ -4273,7 +4269,7 @@ static int smooth_vertex(bContext *C, wmOperator *op)
                if(eve->f & SELECT) {
                        if(eve->f1) {
                                
-                               if (scene->toolsettings->editbutflag & B_MESH_X_MIRROR) {
+                               if (ts->editbutflag & B_MESH_X_MIRROR) {
                                        eve_mir= editmesh_get_x_mirror_vert(obedit, em, eve->co);
                                }
                                
@@ -4315,8 +4311,8 @@ static int smooth_vertex(bContext *C, wmOperator *op)
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -4393,7 +4389,7 @@ void vertexnoise(Object *obedit, EditMesh *em)
        }
 
        recalc_editnormals(em);
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+//     DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 
 }
 
@@ -4450,23 +4446,23 @@ static void vertices_to_sphere(Scene *scene, View3D *v3d, Object *obedit, EditMe
        }
        
        recalc_editnormals(em);
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+//     DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 
 }
 
 static int vertices_to_sphere_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        View3D *v3d = CTX_wm_view3d(C);
-       Scene *scene = CTX_data_scene(C);
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        
        vertices_to_sphere(scene, v3d, obedit, em, RNA_float_get(op->ptr,"percent"));
                
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
        
        return OPERATOR_FINISHED;       
 }
@@ -4512,7 +4508,6 @@ void flipface(EditMesh *em, EditFace *efa)
 
 static int flip_normals(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        EditFace *efa;
@@ -4530,8 +4525,8 @@ static int flip_normals(bContext *C, wmOperator *op)
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
index ac65820bfea8290bc8cb685f48d43edcb62cbcb5..5a4397256defa7a8108e35726fd47ff630f88d1d 100644 (file)
@@ -484,11 +484,11 @@ int removedoublesflag(EditMesh *em, short flag, short automerge, float limit)             /
 static int removedoublesflag_exec(bContext *C, wmOperator *op)
 {
        Object *obedit= CTX_data_edit_object(C);
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        char msg[100];
 
-       int cnt = removedoublesflag(em,1,0,scene->toolsettings->doublimit);
+       int cnt = removedoublesflag(em,1,0,ts->doublimit);
 
        if(cnt)
        {
@@ -496,8 +496,8 @@ static int removedoublesflag_exec(bContext *C, wmOperator *op)
                BKE_report(op->reports, RPT_INFO, msg);
        }
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -677,7 +677,7 @@ void extrude_mesh(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op)
                        * This shouldn't be necessary, derived queries should be
                        * automatically building this data if invalid. Or something.
                        */
-//             DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+//             DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
                object_handle_update(scene, obedit);
 
                /* individual faces? */
@@ -711,8 +711,8 @@ static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        RNA_enum_set(op->ptr, "proportional", 0);
        RNA_boolean_set(op->ptr, "mirror", 0);
@@ -736,8 +736,8 @@ static int mesh_extrude_exec(bContext *C, wmOperator *op)
 
        extrude_mesh(scene, obedit, em, op);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -762,7 +762,6 @@ void MESH_OT_extrude(wmOperatorType *ot)
 
 static int split_mesh(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
@@ -776,8 +775,8 @@ static int split_mesh(bContext *C, wmOperator *op)
 
        WM_cursor_wait(0);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -801,7 +800,6 @@ void MESH_OT_split(wmOperatorType *ot)
 
 static int extrude_repeat_mesh(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
@@ -837,8 +835,8 @@ static int extrude_repeat_mesh(bContext *C, wmOperator *op)
 
        EM_fgon_flags(em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -869,7 +867,7 @@ void MESH_OT_extrude_repeat(wmOperatorType *ot)
 static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float degr, int dupli )
 {
        Object *obedit= CTX_data_edit_object(C);
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        EditVert *eve,*nextve;
        float nor[3]= {0.0f, 0.0f, 0.0f};
@@ -891,7 +889,7 @@ static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float
 
        phi= degr*M_PI/360.0;
        phi/= steps;
-       if(scene->toolsettings->editbutflag & B_CLOCKWISE) phi= -phi;
+       if(ts->editbutflag & B_CLOCKWISE) phi= -phi;
 
        RNA_float_get_array(op->ptr, "axis", n);
        Normalize(n);
@@ -907,7 +905,7 @@ static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float
        Mat3MulMat3(bmat,imat,tmat);
 
        if(dupli==0)
-               if(scene->toolsettings->editbutflag & B_KEEPORIG)
+               if(ts->editbutflag & B_KEEPORIG)
                        adduplicateflag(em, 1);
 
        for(a=0; a<steps; a++) {
@@ -941,7 +939,7 @@ static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float
 
                EM_fgon_flags(em);
 
-               DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+               DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        }
 
        BKE_mesh_end_editmesh(obedit->data, em);
@@ -950,7 +948,6 @@ static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float
 
 static int spin_mesh_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        int ok;
 
@@ -960,8 +957,8 @@ static int spin_mesh_exec(bContext *C, wmOperator *op)
                return OPERATOR_CANCELLED;
        }
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -1006,7 +1003,6 @@ void MESH_OT_spin(wmOperatorType *ot)
 
 static int screw_mesh_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        EditVert *eve,*v1=0,*v2=0;
@@ -1062,8 +1058,8 @@ static int screw_mesh_exec(bContext *C, wmOperator *op)
        }
 
        if(spin_mesh(C, op, dvec, turns*steps, 360.0f*turns, 0)) {
-               DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+               DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+               WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
                BKE_mesh_end_editmesh(obedit->data, em);
                return OPERATOR_FINISHED;
@@ -1308,14 +1304,13 @@ static EnumPropertyItem prop_mesh_delete_types[] = {
 
 static int delete_mesh_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
        delete_mesh(obedit, em, op, RNA_enum_get(op->ptr, "type"));
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -2722,7 +2717,7 @@ void esubdivideflag(Object *obedit, EditMesh *em, int flag, float smooth, float
                }
        }
 
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+//     DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        // Now for each face in the mesh we need to figure out How many edges were cut
        // and which filling method to use for that face
        for(ef = em->faces.first;ef;ef = ef->next) {
@@ -3696,7 +3691,6 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed, int dir)
 /* only accepts 1 selected edge, or 2 selected faces */
 static int edge_rotate_selected(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        EditEdge *eed;
@@ -3760,8 +3754,8 @@ static int edge_rotate_selected(bContext *C, wmOperator *op)
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -4611,7 +4605,7 @@ useless:
                } else {
                        draw = 0;
                }
-//             DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+//             DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        }
 
 
@@ -4631,7 +4625,7 @@ useless:
 
        if(!immediate)
                EM_automerge(0);
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+//     DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 //     scrarea_queue_winredraw(curarea);
 
        //BLI_ghash_free(edgesgh, freeGHash, NULL);
@@ -4681,7 +4675,7 @@ int EdgeLoopDelete(EditMesh *em, wmOperator *op)
        EM_select_more(em);
        removedoublesflag(em, 1,0, 0.001);
        EM_select_flush(em);
-       //      DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       //      DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        return 1;
 }
 
@@ -4793,7 +4787,6 @@ static void mesh_rip_setface(EditMesh *em, EditFace *sefa)
 /* based on mouse cursor position, it defines how is being ripped */
 static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-       Scene *scene= CTX_data_scene(C);
        ARegion *ar= CTX_wm_region(C);
        RegionView3D *rv3d= ar->regiondata;
        Object *obedit= CTX_data_edit_object(C);
@@ -4989,8 +4982,8 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
                }
        }
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
@@ -5061,7 +5054,7 @@ void shape_propagate(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op)
                }
        }
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        return;
 }
 
@@ -5106,7 +5099,7 @@ void shape_copy_from_lerp(EditMesh *em, KeyBlock* thisBlock, KeyBlock* fromBlock
                                }
                        }
                        sprintf(str,"Blending at %d%c  MMB to Copy at 100%c",(int)(perc*100),'%','%');
-//                     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+//                     DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 //                     headerprint(str);
 //                     force_draw(0);
 
@@ -5764,7 +5757,6 @@ int merge_target(EditMesh *em, int target, int uvmerge)
 
 static int merge_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        int count= 0, uvs= RNA_boolean_get(op->ptr, "uvs");
@@ -5794,8 +5786,8 @@ static int merge_exec(bContext *C, wmOperator *op)
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -6040,7 +6032,7 @@ int select_vertex_path_exec(bContext *C, wmOperator *op)
                return OPERATOR_CANCELLED;
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
        BKE_mesh_end_editmesh(obedit->data, em);
 
        return OPERATOR_FINISHED;
@@ -6108,7 +6100,7 @@ static int region_to_loop(bContext *C, wmOperator *op)
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -6284,7 +6276,7 @@ static int loop_to_region(bContext *C, wmOperator *op)
        freecollections(&allcollections);
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -6311,7 +6303,6 @@ void MESH_OT_loop_to_region(wmOperatorType *ot)
 
 static int mesh_rotate_uvs(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
@@ -6378,15 +6369,14 @@ static int mesh_rotate_uvs(bContext *C, wmOperator *op)
        if(!change)
                return OPERATOR_CANCELLED;
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
 
 static int mesh_mirror_uvs(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
@@ -6468,15 +6458,14 @@ static int mesh_mirror_uvs(bContext *C, wmOperator *op)
        if(!change)
                return OPERATOR_CANCELLED;
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
 
 static int mesh_rotate_colors(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
@@ -6525,8 +6514,8 @@ static int mesh_rotate_colors(bContext *C, wmOperator *op)
        if(!change)
                return OPERATOR_CANCELLED;
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -6534,7 +6523,6 @@ static int mesh_rotate_colors(bContext *C, wmOperator *op)
 
 static int mesh_mirror_colors(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
@@ -6582,8 +6570,8 @@ static int mesh_mirror_colors(bContext *C, wmOperator *op)
        if(!change)
                return OPERATOR_CANCELLED;
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -6664,7 +6652,7 @@ void MESH_OT_colors_mirror(wmOperatorType *ot)
 
 static int subdivide_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
+       ToolSettings *ts= CTX_data_tool_settings(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        int cuts= RNA_int_get(op->ptr,"number_cuts");
@@ -6677,10 +6665,10 @@ static int subdivide_exec(bContext *C, wmOperator *op)
        if(fractal != 0.0f)
                flag |= B_FRACTAL;
 
-       esubdivideflag(obedit, em, 1, smooth, fractal, scene->toolsettings->editbutflag|flag, cuts, 0);
+       esubdivideflag(obedit, em, 1, smooth, fractal, ts->editbutflag|flag, cuts, 0);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -6953,7 +6941,6 @@ static void fill_mesh(EditMesh *em)
 
 static int fill_mesh_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
@@ -6961,8 +6948,8 @@ static int fill_mesh_exec(bContext *C, wmOperator *op)
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 
@@ -6985,7 +6972,6 @@ void MESH_OT_fill(wmOperatorType *ot)
 
 static int beauty_fill_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
@@ -6993,8 +6979,8 @@ static int beauty_fill_exec(bContext *C, wmOperator *op)
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -7018,14 +7004,13 @@ void MESH_OT_beauty_fill(wmOperatorType *ot)
 
 static int quads_convert_to_tris_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
        convert_to_triface(em,0);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -7048,14 +7033,13 @@ void MESH_OT_quads_convert_to_tris(wmOperatorType *ot)
 
 static int tris_convert_to_quads_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
        join_triangles(em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -7078,14 +7062,13 @@ void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
 
 static int edge_flip_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
        edge_flip(em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -7124,7 +7107,6 @@ void mesh_set_smooth_faces(EditMesh *em, short smooth)
 
 static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
@@ -7132,8 +7114,8 @@ static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *op)
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -7155,14 +7137,13 @@ void MESH_OT_faces_shade_smooth(wmOperatorType *ot)
 
 static int mesh_faces_shade_flat_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
        mesh_set_smooth_faces(em, 0);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
index 17a448ecf90cfd908c5c26e9a6d58b24bef85a52..a36c7a56b7c0e46d3916955077563ce56b8efe61 100644 (file)
@@ -152,20 +152,21 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
 
 /*********************** UV texture operators ************************/
 
+static int layers_poll(bContext *C)
+{
+       Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+       ID *data= (ob)? ob->data: NULL;
+       return (ob && !ob->id.lib && ob->type==OB_MESH && data && !data->lib);
+}
+
 static int uv_texture_add_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
-       Mesh *me;
+       Mesh *me= ob->data;
        EditMesh *em;
        int layernum;
 
-       if(!ob || ob->type!=OB_MESH)
-               return OPERATOR_CANCELLED;
-       
-       me= (Mesh*)ob->data;
-
-       if(scene->obedit == ob) {
+       if(me->edit_mesh) {
                em= me->edit_mesh;
 
                layernum= CustomData_number_of_layers(&em->fdata, CD_MTFACE);
@@ -175,7 +176,7 @@ static int uv_texture_add_exec(bContext *C, wmOperator *op)
                EM_add_data_layer(em, &em->fdata, CD_MTFACE);
                CustomData_set_layer_active(&em->fdata, CD_MTFACE, layernum);
        }
-       else if(ob) {
+       else {
                layernum= CustomData_number_of_layers(&me->fdata, CD_MTFACE);
                if(layernum >= MAX_MTFACE)
                        return OPERATOR_CANCELLED;
@@ -189,8 +190,8 @@ static int uv_texture_add_exec(bContext *C, wmOperator *op)
                mesh_update_customdata_pointers(me);
        }
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+       DAG_id_flush_update(&me->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
 
        return OPERATOR_FINISHED;
 }
@@ -203,6 +204,7 @@ void MESH_OT_uv_texture_add(wmOperatorType *ot)
        ot->idname= "MESH_OT_uv_texture_add";
        
        /* api callbacks */
+       ot->poll= layers_poll;
        ot->exec= uv_texture_add_exec;
 
        /* flags */
@@ -211,16 +213,11 @@ void MESH_OT_uv_texture_add(wmOperatorType *ot)
 
 static int uv_texture_remove_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
-       Mesh *me;
+       Mesh *me= ob->data;
        CustomDataLayer *cdl;
        int index;
 
-       if(!ob || ob->type!=OB_MESH)
-               return OPERATOR_CANCELLED;
-       
-       me= (Mesh*)ob->data;
        index= CustomData_get_active_layer_index(&me->fdata, CD_MTFACE);
        cdl= (index == -1)? NULL: &me->fdata.layers[index];
 
@@ -229,8 +226,8 @@ static int uv_texture_remove_exec(bContext *C, wmOperator *op)
 
        delete_customdata_layer(C, ob, cdl);
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+       DAG_id_flush_update(&me->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
 
        return OPERATOR_FINISHED;
 }
@@ -243,6 +240,7 @@ void MESH_OT_uv_texture_remove(wmOperatorType *ot)
        ot->idname= "MESH_OT_uv_texture_remove";
        
        /* api callbacks */
+       ot->poll= layers_poll;
        ot->exec= uv_texture_remove_exec;
 
        /* flags */
@@ -255,17 +253,12 @@ static int vertex_color_add_exec(bContext *C, wmOperator *op)
 {
        Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
-       Mesh *me;
+       Mesh *me= ob->data;
        EditMesh *em;
        MCol *mcol;
        int layernum;
 
-       if(!ob || ob->type!=OB_MESH)
-               return OPERATOR_CANCELLED;
-       
-       me= (Mesh*)ob->data;
-
-       if(scene->obedit == ob) {
+       if(me->edit_mesh) {
                em= me->edit_mesh;
 
                layernum= CustomData_number_of_layers(&em->fdata, CD_MCOL);
@@ -294,8 +287,8 @@ static int vertex_color_add_exec(bContext *C, wmOperator *op)
                        shadeMeshMCol(scene, ob, me);
        }
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+       DAG_id_flush_update(&me->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
 
        return OPERATOR_FINISHED;
 }
@@ -308,6 +301,7 @@ void MESH_OT_vertex_color_add(wmOperatorType *ot)
        ot->idname= "MESH_OT_vertex_color_add";
        
        /* api callbacks */
+       ot->poll= layers_poll;
        ot->exec= vertex_color_add_exec;
 
        /* flags */
@@ -316,16 +310,11 @@ void MESH_OT_vertex_color_add(wmOperatorType *ot)
 
 static int vertex_color_remove_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
-       Mesh *me;
+       Mesh *me= ob->data;
        CustomDataLayer *cdl;
        int index;
 
-       if(!ob || ob->type!=OB_MESH)
-               return OPERATOR_CANCELLED;
-       
-       me= (Mesh*)ob->data;
        index= CustomData_get_active_layer_index(&me->fdata, CD_MCOL);
        cdl= (index == -1)? NULL: &me->fdata.layers[index];
 
@@ -334,8 +323,8 @@ static int vertex_color_remove_exec(bContext *C, wmOperator *op)
 
        delete_customdata_layer(C, ob, cdl);
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+       DAG_id_flush_update(&me->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
 
        return OPERATOR_FINISHED;
 }
@@ -349,6 +338,7 @@ void MESH_OT_vertex_color_remove(wmOperatorType *ot)
        
        /* api callbacks */
        ot->exec= vertex_color_remove_exec;
+       ot->poll= layers_poll;
 
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -358,22 +348,16 @@ void MESH_OT_vertex_color_remove(wmOperatorType *ot)
 
 static int sticky_add_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
-       Mesh *me;
-
-       if(!ob || ob->type!=OB_MESH)
-               return OPERATOR_CANCELLED;
-       
-       me= (Mesh*)ob->data;
+       Mesh *me= ob->data;
 
        if(me->msticky)
                return OPERATOR_CANCELLED;
 
        // XXX RE_make_sticky();
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+       DAG_id_flush_update(&me->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
 
        return OPERATOR_FINISHED;
 }
@@ -386,6 +370,7 @@ void MESH_OT_sticky_add(wmOperatorType *ot)
        ot->idname= "MESH_OT_sticky_add";
        
        /* api callbacks */
+       ot->poll= layers_poll;
        ot->exec= sticky_add_exec;
 
        /* flags */
@@ -394,14 +379,8 @@ void MESH_OT_sticky_add(wmOperatorType *ot)
 
 static int sticky_remove_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
-       Mesh *me;
-
-       if(!ob || ob->type!=OB_MESH)
-               return OPERATOR_CANCELLED;
-       
-       me= (Mesh*)ob->data;
+       Mesh *me= ob->data;
 
        if(!me->msticky)
                return OPERATOR_CANCELLED;
@@ -409,8 +388,8 @@ static int sticky_remove_exec(bContext *C, wmOperator *op)
        CustomData_free_layer_active(&me->vdata, CD_MSTICKY, me->totvert);
        me->msticky= NULL;
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+       DAG_id_flush_update(&me->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
 
        return OPERATOR_FINISHED;
 }
@@ -423,6 +402,7 @@ void MESH_OT_sticky_remove(wmOperatorType *ot)
        ot->idname= "MESH_OT_sticky_remove";
        
        /* api callbacks */
+       ot->poll= layers_poll;
        ot->exec= sticky_remove_exec;
 
        /* flags */
index 5d4be254593177c8dd7b190de7c217a3739cd352..2ef1d3b214d84e10c725bb97fe1034156edfca72 100644 (file)
@@ -681,7 +681,7 @@ void sort_faces(Scene *scene, View3D *v3d)
 
        MEM_freeN(index);
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(ob->data, OB_RECALC_DATA);
 }
 
 
index b9bb219783f35a136d2f04b6efadf630757f6cd0..9ab985fb3fb0cf9e47f1ab53cbab69347a0a74ab 100644 (file)
@@ -212,8 +212,8 @@ static int select_deselect_all_metaelems_exec(bContext *C, wmOperator *op)
                        else ml->flag |= SELECT;
                        ml= ml->next;
                }
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-               //DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, mb);
+               //DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        }
 
        return OPERATOR_FINISHED;
@@ -251,7 +251,7 @@ static int select_inverse_metaelems_exec(bContext *C, wmOperator *op)
                                ml->flag |= SELECT;
                        ml= ml->next;
                }
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, mb);
        }
        
        return OPERATOR_FINISHED;
@@ -296,7 +296,7 @@ static int select_random_metaelems_exec(bContext *C, wmOperator *op)
                ml= ml->next;
        }
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, mb);
        
        return OPERATOR_FINISHED;
 }
@@ -325,7 +325,6 @@ void MBALL_OT_select_random_metaelems(struct wmOperatorType *ot)
 /* Duplicate selected MetaElements */
 static int duplicate_metaelems_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        MetaBall *mb = (MetaBall*)obedit->data;
        MetaElem *ml, *newml;
@@ -341,8 +340,8 @@ static int duplicate_metaelems_exec(bContext *C, wmOperator *op)
                        }
                        ml= ml->prev;
                }
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-               DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+               WM_event_add_notifier(C, NC_GEOM|ND_DATA, mb);
+               DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        }
 
        return OPERATOR_FINISHED;
@@ -384,7 +383,6 @@ void MBALL_OT_duplicate_metaelems(wmOperatorType *ot)
 /* Delete all selected MetaElems (not MetaBall) */
 static int delete_metaelems_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        MetaBall *mb= (MetaBall*)obedit->data;
        MetaElem *ml, *next;
@@ -400,8 +398,8 @@ static int delete_metaelems_exec(bContext *C, wmOperator *op)
                        }
                        ml= next;
                }
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-               DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+               WM_event_add_notifier(C, NC_GEOM|ND_DATA, mb);
+               DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        }
 
        return OPERATOR_FINISHED;
@@ -426,7 +424,6 @@ void MBALL_OT_delete_metaelems(wmOperatorType *ot)
 /* Hide selected MetaElems */
 static int hide_metaelems_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        MetaBall *mb= (MetaBall*)obedit->data;
        MetaElem *ml;
@@ -450,8 +447,8 @@ static int hide_metaelems_exec(bContext *C, wmOperator *op)
                                ml= ml->next;
                        }
                }
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-               DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+               WM_event_add_notifier(C, NC_GEOM|ND_DATA, mb);
+               DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        }
 
        return OPERATOR_FINISHED;
@@ -479,7 +476,6 @@ void MBALL_OT_hide_metaelems(wmOperatorType *ot)
 /* Unhide all edited MetaElems */
 static int reveal_metaelems_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        MetaBall *mb= (MetaBall*)obedit->data;
        MetaElem *ml;
@@ -491,8 +487,8 @@ static int reveal_metaelems_exec(bContext *C, wmOperator *op)
                        ml->flag &= ~MB_HIDE;
                        ml= ml->next;
                }
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-               DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+               WM_event_add_notifier(C, NC_GEOM|ND_DATA, mb);
+               DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        }
        
        return OPERATOR_FINISHED;
@@ -584,7 +580,7 @@ void mouse_mball(bContext *C, short mval[2], int extend)
                        }
                        mb->lastelem= act;
                        
-                       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+                       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, mb);
                }
        }
 }
index dc0442a5af9f1320833f978b86dee4fd73fb72f8..c1b1062bfc4ae76d5426d402e284177a8b4d8b8b 100644 (file)
@@ -825,7 +825,6 @@ void CONSTRAINT_OT_move_up (wmOperatorType *ot)
 
 static int pose_constraints_clear_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_active_object(C);
        
        /* free constraints for all selected bones */
@@ -836,7 +835,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *op)
        CTX_DATA_END;
        
        /* do updates */
-       DAG_object_flush_update(scene, ob, OB_RECALC_OB);
+       DAG_id_flush_update(&ob->id, OB_RECALC_OB);
        WM_event_add_notifier(C, NC_OBJECT|ND_POSE|ND_CONSTRAINT|NA_REMOVED, ob);
        
        return OPERATOR_FINISHED;
@@ -857,7 +856,6 @@ void POSE_OT_constraints_clear(wmOperatorType *ot)
 
 static int object_constraints_clear_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_active_object(C);
        
        /* do freeing */
@@ -865,7 +863,7 @@ static int object_constraints_clear_exec(bContext *C, wmOperator *op)
        free_constraints(&ob->constraints);
        
        /* do updates */
-       DAG_object_flush_update(scene, ob, OB_RECALC_OB);
+       DAG_id_flush_update(&ob->id, OB_RECALC_OB);
        WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_REMOVED, ob);
        
        return OPERATOR_FINISHED;
@@ -1138,10 +1136,10 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
        
        if ((ob->type==OB_ARMATURE) && (pchan)) {
                ob->pose->flag |= POSE_RECALC;  /* sort pose channels */
-               DAG_object_flush_update(scene, ob, OB_RECALC_DATA|OB_RECALC_OB);
+               DAG_id_flush_update(&ob->id, OB_RECALC_DATA|OB_RECALC_OB);
        }
        else
-               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+               DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        
        /* notifiers for updates */
        WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_ADDED, ob);
@@ -1376,7 +1374,6 @@ void POSE_OT_ik_add(wmOperatorType *ot)
 /* remove IK constraints from selected bones */
 static int pose_ik_clear_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene = CTX_data_scene(C);
        Object *ob= CTX_data_active_object(C);
        
        /* only remove IK Constraints */
@@ -1397,7 +1394,7 @@ static int pose_ik_clear_exec(bContext *C, wmOperator *op)
        CTX_DATA_END;
        
        /* */
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        /* note, notifier might evolve */
        WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_REMOVED, ob);
index 82194a4c3b4c96b00cc2768a90f29b9606d21fdb..2ec3edd846adebb60ca65b473e62ce5aeaefb108 100644 (file)
@@ -473,7 +473,7 @@ int ED_object_shape_key_remove(bContext *C, Scene *scene, Object *ob)
                free_libblock_us(&(bmain->key), key);
        }
        
-       DAG_object_flush_update(scene, OBACT, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
 
        return 1;
@@ -481,14 +481,18 @@ int ED_object_shape_key_remove(bContext *C, Scene *scene, Object *ob)
 
 /********************** shape key operators *********************/
 
+static int shape_key_poll(bContext *C)
+{
+       Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+       ID *data= (ob)? ob->data: NULL;
+       return (ob && !ob->id.lib && data && !data->lib);
+}
+
 static int shape_key_add_exec(bContext *C, wmOperator *op)
 {
        Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
 
-       if(!ob)
-               return OPERATOR_CANCELLED;
-
        ED_object_shape_key_add(C, scene, ob);
        
        return OPERATOR_FINISHED;
@@ -501,6 +505,7 @@ void OBJECT_OT_shape_key_add(wmOperatorType *ot)
        ot->idname= "OBJECT_OT_shape_key_add";
        
        /* api callbacks */
+       ot->poll= shape_key_poll;
        ot->exec= shape_key_add_exec;
 
        /* flags */
@@ -509,12 +514,9 @@ void OBJECT_OT_shape_key_add(wmOperatorType *ot)
 
 static int shape_key_remove_exec(bContext *C, wmOperator *op)
 {
-       Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
        Scene *scene= CTX_data_scene(C);
+       Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
 
-       if(!ob)
-               return OPERATOR_CANCELLED;
-       
        if(!ED_object_shape_key_remove(C, scene, ob))
                return OPERATOR_CANCELLED;
        
@@ -528,97 +530,10 @@ void OBJECT_OT_shape_key_remove(wmOperatorType *ot)
        ot->idname= "OBJECT_OT_shape_key_remove";
        
        /* api callbacks */
+       ot->poll= shape_key_poll;
        ot->exec= shape_key_remove_exec;
 
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
-void move_keys(Object *ob)
-{
-#if 0
-       /* XXX probably goes away entirely */
-       Key *key;
-       KeyBlock *kb;
-       float div, dy, oldpos, vec[3], dvec[3];
-       int afbreek=0, firsttime= 1;
-       unsigned short event = 0;
-       short mval[2], val, xo, yo;
-       char str[32];
-       
-       if(G.sipo->blocktype!=ID_KE) return;
-       
-       if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
-       if(G.sipo->editipo==NULL) return;
-
-       key= ob_get_key(ob);
-       if(key==NULL) return;
-       
-       /* which kb is involved */
-       kb= BLI_findlink(&key->block, ob->shapenr-1);
-       if(kb==NULL) return;    
-       
-       oldpos= kb->pos;
-       
-       getmouseco_areawin(mval);
-       xo= mval[0];
-       yo= mval[1];
-       dvec[0]=dvec[1]=dvec[2]= 0.0; 
-
-       while(afbreek==0) {
-               getmouseco_areawin(mval);
-               if(mval[0]!=xo || mval[1]!=yo || firsttime) {
-                       firsttime= 0;
-                       
-                       dy= (float)(mval[1]- yo);
-
-                       div= (float)(G.v2d->mask.ymax-G.v2d->mask.ymin);
-                       dvec[1]+= (G.v2d->cur.ymax-G.v2d->cur.ymin)*(dy)/div;
-                       
-                       VECCOPY(vec, dvec);
-
-                       apply_keyb_grid(vec, 0.0, 1.0, 0.1, U.flag & USER_AUTOGRABGRID);
-                       apply_keyb_grid(vec+1, 0.0, 1.0, 0.1, U.flag & USER_AUTOGRABGRID);
-
-                       kb->pos= oldpos+vec[1];
-                       
-                       sprintf(str, "Y: %.3f  ", vec[1]);
-                       headerprint(str);
-                       
-                       xo= mval[0];
-                       yo= mval[1];
-                               
-                       force_draw(0);
-               }
-               else BIF_wait_for_statechange();
-               
-               while(qtest()) {
-                       event= extern_qread(&val);
-                       if(val) {
-                               switch(event) {
-                               case ESCKEY:
-                               case LEFTMOUSE:
-                               case SPACEKEY:
-                                       afbreek= 1;
-                                       break;
-                               default:
-                                       arrows_move_cursor(event);
-                               }
-                       }
-               }
-       }
-       
-       if(event==ESCKEY) {
-               kb->pos= oldpos;
-       }
-       
-       sort_keys(key);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-       
-       /* for boundbox */
-       editipo_changed(G.sipo, 0);
-
-       BIF_undo_push("Move Shapekey(s)");
-#endif
-}
-
index 3e30efd635aa063fc3cc1f3713f20a9034331fde..3ec1f3af0141c50932d9d6ba4df43d36eef71b71 100644 (file)
@@ -203,7 +203,7 @@ int de_select_all_exec(bContext *C, wmOperator *op)
        else
                setflagsLatt(obedit, 1);
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -234,7 +234,6 @@ int make_regular_poll(bContext *C)
 
 int make_regular_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_edit_object(C);
        Lattice *lt;
        
@@ -248,8 +247,8 @@ int make_regular_exec(bContext *C, wmOperator *op)
                resizelattice(lt, lt->pntsu, lt->pntsv, lt->pntsw, NULL);
        }
        
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
 
        return OPERATOR_FINISHED;
 }
@@ -318,7 +317,7 @@ void mouse_lattice(bContext *C, short mval[2], int extend)
                else
                        bp->f1 ^= SELECT; /* swap */
 
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
+               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
        }
 }
 
index a5e92096ef91d2cb7e49313c0df6574a6b382b26..53882ad8424ebc4d4ae33fdfa8f9375689790160 100644 (file)
@@ -193,7 +193,7 @@ void ED_base_object_activate(bContext *C, Base *base)
                for(tbase=FIRSTBASE; tbase; tbase= tbase->next) {
                        if(base!=tbase && (tbase->object->shapeflag & OB_SHAPE_TEMPLOCK)) {
                                tbase->object->shapeflag &= ~OB_SHAPE_TEMPLOCK;
-                               DAG_object_flush_update(scene, tbase->object, OB_RECALC_DATA);
+                               DAG_id_flush_update(&tbase->object->id, OB_RECALC_DATA);
                        }
                }
                WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
@@ -343,7 +343,7 @@ static int object_add_mesh_exec(bContext *C, wmOperator *op)
                ED_object_enter_editmode(C, EM_DO_UNDO);
                newob = 1;
        }
-       else DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+       else DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
 
        switch(RNA_enum_get(op->ptr, "type")) {
                case 0:
@@ -379,7 +379,7 @@ static int object_add_mesh_exec(bContext *C, wmOperator *op)
                ED_object_exit_editmode(C, EM_FREEDATA);
        }
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
        
        return OPERATOR_FINISHED;
 }
@@ -425,7 +425,7 @@ static int object_add_curve_exec(bContext *C, wmOperator *op)
                ED_object_enter_editmode(C, 0);
                newob = 1;
        }
-       else DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+       else DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
        
        obedit= CTX_data_edit_object(C);
        nu= add_nurbs_primitive(C, RNA_enum_get(op->ptr, "type"), newob);
@@ -437,7 +437,7 @@ static int object_add_curve_exec(bContext *C, wmOperator *op)
                ED_object_exit_editmode(C, EM_FREEDATA);
        }
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
        
        return OPERATOR_FINISHED;
 }
@@ -500,7 +500,7 @@ static int object_add_surface_exec(bContext *C, wmOperator *op)
                ED_object_enter_editmode(C, 0);
                newob = 1;
        }
-       else DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+       else DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
        
        obedit= CTX_data_edit_object(C);
        nu= add_nurbs_primitive(C, RNA_enum_get(op->ptr, "type"), newob);
@@ -512,7 +512,7 @@ static int object_add_surface_exec(bContext *C, wmOperator *op)
                ED_object_exit_editmode(C, EM_FREEDATA);
        }
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
        
        return OPERATOR_FINISHED;
 }
@@ -557,7 +557,7 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
                ED_object_enter_editmode(C, 0);
                newob = 1;
        }
-       else DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+       else DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
        
        obedit= CTX_data_edit_object(C);
        elem= (MetaElem*)add_metaball_primitive(C, RNA_enum_get(op->ptr, "type"), newob);
@@ -569,7 +569,7 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
                ED_object_exit_editmode(C, EM_FREEDATA);
        }
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
        
        return OPERATOR_FINISHED;
 }
@@ -621,7 +621,7 @@ static int object_add_text_exec(bContext *C, wmOperator *op)
        if(U.flag & USER_ADD_EDITMODE)
                ED_object_enter_editmode(C, 0);
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
        
        return OPERATOR_FINISHED;
 }
@@ -653,7 +653,7 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
                ED_object_enter_editmode(C, 0);
                newob = 1;
        }
-       else DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
+       else DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
        
        if(v3d) 
                rv3d= CTX_wm_region(C)->regiondata;
@@ -666,7 +666,7 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
                ED_object_exit_editmode(C, EM_FREEDATA);
        }
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
        
        return OPERATOR_FINISHED;
 }
@@ -3034,7 +3034,7 @@ static int make_proxy_exec (bContext *C, wmOperator *op)
                
                /* depsgraph flushes are needed for the new data */
                DAG_scene_sort(scene);
-               DAG_object_flush_update(scene, newob, OB_RECALC);
+               DAG_id_flush_update(&newob->id, OB_RECALC);
                
                WM_event_add_notifier(C, NC_OBJECT, NULL);
        }
@@ -3543,7 +3543,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
                        
                        recalc_editnormals(em);
                        tot_change++;
-                       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+                       DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
                        BKE_mesh_end_editmesh(me, em);
                }
        }
@@ -3735,7 +3735,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
                                        tot_change++;
                                        if(obedit) {
                                                if (centermode==0) {
-                                                       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+                                                       DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
                                                }
                                                break;
                                        }
@@ -3884,7 +3884,7 @@ void ED_object_exit_editmode(bContext *C, int flag)
                scene->obedit= NULL; // XXX for context
                
                /* also flush ob recalc, doesn't take much overhead, but used for particles */
-               DAG_object_flush_update(scene, obedit, OB_RECALC_OB|OB_RECALC_DATA);
+               DAG_id_flush_update(&obedit->id, OB_RECALC_OB|OB_RECALC_DATA);
        
                ED_undo_push(C, "Editmode");
        
@@ -3963,7 +3963,7 @@ void ED_object_enter_editmode(bContext *C, int flag)
                scene->obedit= ob;
                ED_armature_to_edit(ob);
                /* to ensure all goes in restposition and without striding */
-               DAG_object_flush_update(scene, ob, OB_RECALC);
+               DAG_id_flush_update(&ob->id, OB_RECALC);
 
                WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_ARMATURE, scene);
        }
@@ -3997,7 +3997,7 @@ void ED_object_enter_editmode(bContext *C, int flag)
        }
        
        if(ok) {
-               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+               DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        }
        else {
                scene->obedit= NULL; // XXX for context
@@ -4327,7 +4327,7 @@ void special_editmenu(Scene *scene, View3D *v3d)
                                        }
                                }
                        }
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                }
                else if(ob->mode & OB_MODE_VERTEX_PAINT) {
                        Mesh *me= get_mesh(ob);
@@ -4339,7 +4339,7 @@ void special_editmenu(Scene *scene, View3D *v3d)
                                
 // XXX                         do_shared_vertexcol(me);
                                
-                               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                               DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                        }
                }
                else if(ob->mode & OB_MODE_WEIGHT_PAINT) {
@@ -4386,7 +4386,7 @@ void special_editmenu(Scene *scene, View3D *v3d)
                                break;
                        }
                        
-                       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+                       DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
                        
                        if(nr>0) waitcursor(0);
 #endif
@@ -4809,7 +4809,7 @@ static void object_flip_subdivison_particles(Scene *scene, Object *ob, int *set,
                        }
                }
 
-               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+               DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        }
 
        if(ob->dup_group && depth<=4) {
@@ -6790,7 +6790,6 @@ void OBJECT_OT_join(wmOperatorType *ot)
 
 static int shade_smooth_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob;
        Curve *cu;
        Nurb *nu;
@@ -6803,7 +6802,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
                if(ob->type==OB_MESH) {
                        mesh_set_smooth_flag(ob, !clear);
 
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                        WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
 
                        done= 1;
@@ -6817,7 +6816,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
                                nu= nu->next;
                        }
 
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                        WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
 
                        done= 1;
@@ -6904,7 +6903,7 @@ void image_aspect(Scene *scene, View3D *v3d)
                                                                else ob->size[1]= ob->size[0]*y/x;
                                                                
                                                                done= 1;
-                                                               DAG_object_flush_update(scene, ob, OB_RECALC_OB);                                                               
+                                                               DAG_id_flush_update(&ob->id, OB_RECALC_OB);                                                             
                                                        }
                                                }
                                                if(done) break;
@@ -7184,7 +7183,7 @@ void hookmenu(Scene *scene, View3D *v3d)
                                                        Mat4MulSerie(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
                                                        
                                                        changed= 1;
-                                                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                                                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                                                }
                                        } else {
                                                float *curs = give_cursor(scene, v3d);
@@ -7202,7 +7201,7 @@ void hookmenu(Scene *scene, View3D *v3d)
                                                Mat3MulVecfl(imat, hmd->cent);
                                                
                                                changed= 1;
-                                               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                                               DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                                        } 
                                }
                        }
index 96e485e54627ba44bce6276b901c7b7ef506e567..aecb778db06a4b1648c4e80620d15ac2929e14dd 100644 (file)
@@ -119,7 +119,7 @@ int ED_object_modifier_add(ReportList *reports, Scene *scene, Object *ob, int ty
                        DAG_scene_sort(scene);
        }
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        return 1;
 }
@@ -168,7 +168,7 @@ int ED_object_modifier_remove(ReportList *reports, Scene *scene, Object *ob, Mod
        BLI_remlink(&ob->modifiers, md);
        modifier_free(md);
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        return 1;
 }
@@ -376,7 +376,7 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi
 
                MEM_freeN(vertexCos);
 
-               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+               DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        }
        else {
                BKE_report(reports, RPT_ERROR, "Cannot apply modifier for this object type");
@@ -408,7 +408,8 @@ int ED_object_modifier_copy(ReportList *reports, Object *ob, ModifierData *md)
 
 static int modifier_poll(bContext *C)
 {
-       return (CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier).data != NULL);
+       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
+       return (ptr.data != NULL && !((ID*)ptr.id.data)->lib);
 }
 
 /************************ add modifier operator *********************/
@@ -518,7 +519,6 @@ void OBJECT_OT_modifier_remove(wmOperatorType *ot)
 
 static int modifier_move_up_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
        Object *ob= ptr.id.data;
        ModifierData *md= ptr.data;
@@ -526,7 +526,7 @@ static int modifier_move_up_exec(bContext *C, wmOperator *op)
        if(!ED_object_modifier_move_up(op->reports, ob, md))
                return OPERATOR_CANCELLED;
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
        
        return OPERATOR_FINISHED;
@@ -550,7 +550,6 @@ void OBJECT_OT_modifier_move_up(wmOperatorType *ot)
 
 static int modifier_move_down_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
        Object *ob= ptr.id.data;
        ModifierData *md= ptr.data;
@@ -558,7 +557,7 @@ static int modifier_move_down_exec(bContext *C, wmOperator *op)
        if(!ob || !md || !ED_object_modifier_move_down(op->reports, ob, md))
                return OPERATOR_CANCELLED;
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
        
        return OPERATOR_FINISHED;
@@ -590,7 +589,7 @@ static int modifier_apply_exec(bContext *C, wmOperator *op)
        if(!ob || !md || !ED_object_modifier_apply(op->reports, scene, ob, md))
                return OPERATOR_CANCELLED;
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
        
        return OPERATOR_FINISHED;
@@ -622,7 +621,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op)
        if(!ob || !md || !ED_object_modifier_convert(op->reports, scene, ob, md))
                return OPERATOR_CANCELLED;
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
        
        return OPERATOR_FINISHED;
@@ -646,7 +645,6 @@ void OBJECT_OT_modifier_convert(wmOperatorType *ot)
 
 static int modifier_copy_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
        Object *ob= ptr.id.data;
        ModifierData *md= ptr.data;
@@ -654,7 +652,7 @@ static int modifier_copy_exec(bContext *C, wmOperator *op)
        if(!ob || !md || !ED_object_modifier_copy(op->reports, ob, md))
                return OPERATOR_CANCELLED;
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
        
        return OPERATOR_FINISHED;
@@ -718,8 +716,9 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op)
 
 static int multires_subdivide_poll(bContext *C)
 {
-       return (CTX_data_pointer_get_type(C, "modifier", &RNA_MultiresModifier).data != NULL) &&
-               CTX_data_edit_object(C) == NULL;
+       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_MultiresModifier);
+       ID *id= ptr.id.data;
+       return (ptr.data && id && !id->lib);
 }
 
 void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
@@ -739,7 +738,9 @@ void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
 
 static int meshdeform_poll(bContext *C)
 {
-       return CTX_data_pointer_get_type(C, "modifier", &RNA_MeshDeformModifier).data != NULL;
+       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_MeshDeformModifier);
+       ID *id= ptr.id.data;
+       return (ptr.data && id && !id->lib);
 }
 
 static int meshdeform_bind_exec(bContext *C, wmOperator *op)
@@ -864,12 +865,13 @@ static uiBlock *modifiers_add_menu(void *ob_v)
 
 static int hook_poll(bContext *C)
 {
-       return CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier).data != NULL;
+       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
+       ID *id= ptr.id.data;
+       return (ptr.data && id && !id->lib);
 }
 
 static int hook_reset_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
        Object *ob= ptr.id.data;
        HookModifierData *hmd= ptr.data;
@@ -892,7 +894,7 @@ static int hook_reset_exec(bContext *C, wmOperator *op)
                }
        }
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
        
        return OPERATOR_FINISHED;
@@ -925,7 +927,7 @@ static int hook_recenter_exec(bContext *C, wmOperator *op)
        VECSUB(hmd->cent, scene->cursor, ob->obmat[3]);
        Mat3MulVecfl(imat, hmd->cent);
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
        
        return OPERATOR_FINISHED;
@@ -952,7 +954,7 @@ static int hook_select_exec(bContext *C, wmOperator *op)
 
        object_hook_select(ob, hmd);
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
        
        return OPERATOR_FINISHED;
 }
@@ -972,7 +974,6 @@ void OBJECT_OT_hook_select(wmOperatorType *ot)
 
 static int hook_assign_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
        Object *ob= ptr.id.data;
        HookModifierData *hmd= ptr.data;
@@ -992,7 +993,7 @@ static int hook_assign_exec(bContext *C, wmOperator *op)
        hmd->indexar= indexar;
        hmd->totindex= tot;
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
        
        return OPERATOR_FINISHED;
@@ -1015,19 +1016,20 @@ void OBJECT_OT_hook_assign(wmOperatorType *ot)
 
 static int explode_refresh_poll(bContext *C)
 {
-       return CTX_data_pointer_get_type(C, "modifier", &RNA_ExplodeModifier).data != NULL;
+       PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_ExplodeModifier);
+       ID *id= ptr.id.data;
+       return (ptr.data && id && !id->lib);
 }
 
 static int explode_refresh_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_ExplodeModifier);
        Object *ob= ptr.id.data;
        ExplodeModifierData *emd= ptr.data;
 
        emd->flag |= eExplodeFlag_CalcFaces;
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
        
        return OPERATOR_FINISHED;
index 767a04d917022f8dbfec0b7f9a831822a574fc24..1660160b56c172f7dae15d32e1ec264ce76760a4 100644 (file)
@@ -1102,17 +1102,21 @@ void vgroup_operation_with_menu(Object *ob)
 
 /********************** vertex group operators *********************/
 
-static int vertex_group_add_exec(bContext *C, wmOperator *op)
+static int vertex_group_poll(bContext *C)
 {
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
-       Scene *scene= CTX_data_scene(C);
+       ID *data= (ob)? ob->data: NULL;
+       return (ob && !ob->id.lib && data && !data->lib);
+}
 
-       if(!ob)
-               return OPERATOR_CANCELLED;
+static int vertex_group_add_exec(bContext *C, wmOperator *op)
+{
+       Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
 
        add_defgroup(ob);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
        
        return OPERATOR_FINISHED;
 }
@@ -1124,6 +1128,7 @@ void OBJECT_OT_vertex_group_add(wmOperatorType *ot)
        ot->idname= "OBJECT_OT_vertex_group_add";
        
        /* api callbacks */
+       ot->poll= vertex_group_poll;
        ot->exec= vertex_group_add_exec;
 
        /* flags */
@@ -1135,18 +1140,16 @@ static int vertex_group_remove_exec(bContext *C, wmOperator *op)
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
        Scene *scene= CTX_data_scene(C);
 
-       if(!ob)
-               return OPERATOR_CANCELLED;
-
        if(scene->obedit == ob) {
                del_defgroup(ob);
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
        }
        else {
                del_defgroup_in_object_mode(ob);
-               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+               DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        }
+
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
        
        return OPERATOR_FINISHED;
 }
@@ -1158,6 +1161,7 @@ void OBJECT_OT_vertex_group_remove(wmOperatorType *ot)
        ot->idname= "OBJECT_OT_vertex_group_remove";
        
        /* api callbacks */
+       ot->poll= vertex_group_poll;
        ot->exec= vertex_group_remove_exec;
 
        /* flags */
@@ -1166,16 +1170,12 @@ void OBJECT_OT_vertex_group_remove(wmOperatorType *ot)
 
 static int vertex_group_assign_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        ToolSettings *ts= CTX_data_tool_settings(C);
        Object *ob= CTX_data_edit_object(C);
 
-       if(!ob)
-               return OPERATOR_CANCELLED;
-
        assign_verts_defgroup(ob, ts->vgroup_weight);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
        
        return OPERATOR_FINISHED;
 }
@@ -1187,6 +1187,7 @@ void OBJECT_OT_vertex_group_assign(wmOperatorType *ot)
        ot->idname= "OBJECT_OT_vertex_group_assign";
        
        /* api callbacks */
+       ot->poll= vertex_group_poll;
        ot->exec= vertex_group_assign_exec;
 
        /* flags */
@@ -1195,15 +1196,11 @@ void OBJECT_OT_vertex_group_assign(wmOperatorType *ot)
 
 static int vertex_group_remove_from_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_edit_object(C);
 
-       if(!ob)
-               return OPERATOR_CANCELLED;
-
        remove_verts_defgroup(ob, 0);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
        
        return OPERATOR_FINISHED;
 }
@@ -1215,6 +1212,7 @@ void OBJECT_OT_vertex_group_remove_from(wmOperatorType *ot)
        ot->idname= "OBJECT_OT_vertex_group_remove_from";
        
        /* api callbacks */
+       ot->poll= vertex_group_poll;
        ot->exec= vertex_group_remove_from_exec;
 
        /* flags */
@@ -1225,11 +1223,11 @@ static int vertex_group_select_exec(bContext *C, wmOperator *op)
 {
        Object *ob= CTX_data_edit_object(C);
 
-       if(!ob)
+       if(!ob || ob->id.lib)
                return OPERATOR_CANCELLED;
 
-       sel_verts_defgroup(ob, 1); /* runs countall() */
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+       sel_verts_defgroup(ob, 1);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
 
        return OPERATOR_FINISHED;
 }
@@ -1241,6 +1239,7 @@ void OBJECT_OT_vertex_group_select(wmOperatorType *ot)
        ot->idname= "OBJECT_OT_vertex_group_select";
        
        /* api callbacks */
+       ot->poll= vertex_group_poll;
        ot->exec= vertex_group_select_exec;
 
        /* flags */
@@ -1251,11 +1250,8 @@ static int vertex_group_deselect_exec(bContext *C, wmOperator *op)
 {
        Object *ob= CTX_data_edit_object(C);
 
-       if(!ob)
-               return OPERATOR_CANCELLED;
-
-       sel_verts_defgroup(ob, 0); /* runs countall() */
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+       sel_verts_defgroup(ob, 0);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
 
        return OPERATOR_FINISHED;
 }
@@ -1267,6 +1263,7 @@ void OBJECT_OT_vertex_group_deselect(wmOperatorType *ot)
        ot->idname= "OBJECT_OT_vertex_group_deselect";
        
        /* api callbacks */
+       ot->poll= vertex_group_poll;
        ot->exec= vertex_group_deselect_exec;
 
        /* flags */
@@ -1275,15 +1272,12 @@ void OBJECT_OT_vertex_group_deselect(wmOperatorType *ot)
 
 static int vertex_group_copy_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
 
-       if(!ob)
-               return OPERATOR_CANCELLED;
-
        duplicate_defgroup(ob);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
        
        return OPERATOR_FINISHED;
 }
@@ -1295,6 +1289,7 @@ void OBJECT_OT_vertex_group_copy(wmOperatorType *ot)
        ot->idname= "OBJECT_OT_vertex_group_copy";
        
        /* api callbacks */
+       ot->poll= vertex_group_poll;
        ot->exec= vertex_group_copy_exec;
 
        /* flags */
@@ -1308,9 +1303,6 @@ static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *op)
     Base *base;
        int retval= OPERATOR_CANCELLED;
 
-       if(!ob)
-               return retval;
-
     for(base=scene->base.first; base; base= base->next) {
         if(base->object->type==ob->type) {
             if(base->object!=ob && base->object->data==ob->data) {
@@ -1318,8 +1310,9 @@ static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *op)
                 BLI_duplicatelist(&base->object->defbase, &ob->defbase);
                 base->object->actdef= ob->actdef;
 
-                DAG_object_flush_update(scene, base->object, OB_RECALC_DATA);
-                               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, base->object);
+                DAG_id_flush_update(&base->object->id, OB_RECALC_DATA);
+                               WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, base->object);
+                               WM_event_add_notifier(C, NC_GEOM|ND_DATA, base->object->data);
 
                                retval = OPERATOR_FINISHED;
             }
@@ -1336,6 +1329,7 @@ void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot)
        ot->idname= "OBJECT_OT_vertex_group_copy_to_linked";
        
        /* api callbacks */
+       ot->poll= vertex_group_poll;
        ot->exec= vertex_group_copy_to_linked_exec;
 
        /* flags */
index 220928cb79ce6704c8e37df1f92a1cba89527332..3ddc143b5a38c827827ce8bc19adf1651d0681aa 100644 (file)
@@ -1018,7 +1018,6 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
 
 static void PE_update_selection(Scene *scene, Object *ob, int useflag)
 {
-       ParticleEditSettings *pset= PE_settings(scene);
        PTCacheEdit *edit= PE_get_current(scene, ob);
        HairKey *hkey;
        POINT_P; KEY_K;
@@ -1156,7 +1155,7 @@ void PE_update_object(Scene *scene, Object *ob, int useflag)
                point->flag &= ~PEP_EDIT_RECALC;
        }
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 }
 
 /************************************************/
@@ -1235,7 +1234,7 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
        }
 
        PE_update_selection(scene, ob, 1);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_SELECT, ob);
 
        return OPERATOR_FINISHED;
 }
@@ -1283,7 +1282,7 @@ int PE_mouse_particles(bContext *C, short *mval, int extend)
        for_mouse_hit_keys(&data, toggle_key_select, 1);  /* nearest only */
 
        PE_update_selection(scene, ob, 1);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, data.ob);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_SELECT, data.ob);
 
        return OPERATOR_FINISHED;
 }
@@ -1301,7 +1300,7 @@ static int select_first_exec(bContext *C, wmOperator *op)
 
        PE_set_data(C, &data);
        foreach_point(&data, select_root);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, data.ob);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_SELECT, data.ob);
 
        return OPERATOR_FINISHED;
 }
@@ -1334,7 +1333,7 @@ static int select_last_exec(bContext *C, wmOperator *op)
 
        PE_set_data(C, &data);
        foreach_point(&data, select_tip);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, data.ob);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_SELECT, data.ob);
 
        return OPERATOR_FINISHED;
 }
@@ -1374,7 +1373,7 @@ static int select_linked_exec(bContext *C, wmOperator *op)
 
        for_mouse_hit_keys(&data, select_keys, 1);  /* nearest only */
        PE_update_selection(data.scene, data.ob, 1);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, data.ob);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_SELECT, data.ob);
 
        return OPERATOR_FINISHED;
 }
@@ -1429,7 +1428,7 @@ int PE_border_select(bContext *C, rcti *rect, int select)
        for_mouse_hit_keys(&data, select_key, 0);
 
        PE_update_selection(scene, ob, 1);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_SELECT, ob);
 
        return OPERATOR_FINISHED;
 }
@@ -1454,7 +1453,7 @@ int PE_circle_select(bContext *C, int selecting, short *mval, float rad)
        for_mouse_hit_keys(&data, select_key, 0);
 
        PE_update_selection(scene, ob, 1);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_SELECT, ob);
 
        return OPERATOR_FINISHED;
 }
@@ -1520,7 +1519,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short select)
        }
 
        PE_update_selection(scene, ob, 1);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_SELECT, ob);
 
        return OPERATOR_FINISHED;
 }
@@ -1554,7 +1553,7 @@ static int hide_exec(bContext *C, wmOperator *op)
        }
 
        PE_update_selection(scene, ob, 1);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_SELECT, ob);
 
        return OPERATOR_FINISHED;
 }
@@ -1596,7 +1595,7 @@ static int reveal_exec(bContext *C, wmOperator *op)
        }
 
        PE_update_selection(scene, ob, 1);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_SELECT, ob);
 
        return OPERATOR_FINISHED;
 }
@@ -1650,7 +1649,7 @@ static int select_less_exec(bContext *C, wmOperator *op)
 
        PE_set_data(C, &data);
        foreach_point(&data, select_less_keys);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, data.ob);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_SELECT, data.ob);
 
        return OPERATOR_FINISHED;
 }
@@ -1708,7 +1707,7 @@ static int select_more_exec(bContext *C, wmOperator *op)
 
        PE_set_data(C, &data);
        foreach_point(&data, select_more_keys);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, data.ob);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_SELECT, data.ob);
 
        return OPERATOR_FINISHED;
 }
@@ -1796,7 +1795,7 @@ static int rekey_exec(bContext *C, wmOperator *op)
        
        recalc_lengths(data.edit);
        PE_update_object(data.scene, data.ob, 1);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, data.ob);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, data.ob);
 
        return OPERATOR_FINISHED;
 }
@@ -2091,7 +2090,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
        
        recalc_lengths(data.edit);
        PE_update_object(data.scene, data.ob, 1);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, data.ob);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, data.ob);
 
        return OPERATOR_FINISHED;
 }
@@ -2180,8 +2179,8 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
        BKE_reportf(op->reports, RPT_INFO, "Remove %d double particles.", totremoved);
 
        PE_update_object(scene, ob, 0);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, ob);
 
        return OPERATOR_FINISHED;
 }
@@ -2358,8 +2357,8 @@ static int delete_exec(bContext *C, wmOperator *op)
 
        PE_update_object(data.scene, data.ob, 0);
 
-       DAG_object_flush_update(data.scene, data.ob, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, data.ob);
+       DAG_id_flush_update(&data.ob->id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, data.ob);
 
        return OPERATOR_FINISHED;
 }
@@ -2512,8 +2511,8 @@ static int mirror_exec(bContext *C, wmOperator *op)
        PE_mirror_x(scene, ob, 0);
 
        update_world_cos(ob, edit);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, ob);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        return OPERATOR_FINISHED;
 }
@@ -2593,11 +2592,11 @@ static int set_edit_mode_exec(bContext *C, wmOperator *op)
 void PARTICLE_OT_edit_type_set(wmOperatorType *ot)
 {
        /* identifiers */
-       ot->name= "Set Brush";
+       ot->name= "Set Edit Type";
        ot->idname= "PARTICLE_OT_edit_type_set";
        
        /* api callbacks */
-       ot->exec= set_brush_exec;
+       ot->exec= set_edit_mode_exec;
        ot->invoke= WM_menu_invoke;
        ot->poll= PE_poll;
 
@@ -2627,11 +2626,9 @@ static void brush_comb(PEData *data, float mat[][4], float imat[][4], int point_
 static void brush_cut(PEData *data, int pa_index)
 {
        PTCacheEdit *edit = data->edit;
-       ParticleSystem *psys= edit->psys;
        ARegion *ar= data->vc.ar;
        Object *ob= data->ob;
        ParticleEditSettings *pset= PE_settings(data->scene);
-       ParticleData *pa= &psys->particles[pa_index];
        ParticleCacheKey *key= edit->pathcache[pa_index];
        float rad2, cut_time= 1.0;
        float x0, x1, v0, v1, o0, o1, xo0, xo1, d, dv;
@@ -3237,12 +3234,12 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 
                        update_world_cos(ob,edit);
                        psys_free_path_cache(NULL, edit);
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                }
                else
                        PE_update_object(scene, ob, 1);
 
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+               WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_SELECT, ob);
                
                bedit->lastmouse[0]= mouse[0];
                bedit->lastmouse[1]= mouse[1];
@@ -3553,7 +3550,7 @@ void PE_undo_step(Scene *scene, int step)
        }
 
        PE_update_object(scene, OBACT, 0);
-       DAG_object_flush_update(scene, OBACT, OB_RECALC_DATA);
+       DAG_id_flush_update(&OBACT->id, OB_RECALC_DATA);
 }
 
 static void PTCacheUndo_number(Scene *scene, PTCacheEdit *edit, int nr)
@@ -3780,9 +3777,7 @@ static int particle_edit_toggle_poll(bContext *C)
 
 static int particle_edit_toggle_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_active_object(C);
-       PTCacheEdit *edit= PE_get_current(scene, ob);
 
        if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
                ob->mode |= OB_MODE_PARTICLE_EDIT;
@@ -3795,7 +3790,7 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op)
                WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL);
        }
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        return OPERATOR_FINISHED;
 }
@@ -3819,7 +3814,6 @@ void PARTICLE_OT_particle_edit_toggle(wmOperatorType *ot)
 
 static int clear_edited_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_active_object(C);
        ParticleSystem *psys = psys_get_current(ob);
        
@@ -3833,7 +3827,7 @@ static int clear_edited_exec(bContext *C, wmOperator *op)
                        psys->recalc |= PSYS_RECALC_RESET;
 
                        psys_reset(psys, PSYS_RESET_DEPSGRAPH);
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                }
        }
 
index d082e17cda385bd78020e960131aa8f43bdb50d0..870b66cdbbd1cc14c657c9ad8636aebe6a609490 100644 (file)
@@ -5184,7 +5184,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
                toggle_paint_cursor(C, 1);
        }
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_SCENE|ND_MODE, scene);
 
        return OPERATOR_FINISHED;
index f66a9fbc1ed6cea369895de449be8f222051e032..953a055c9e51a3f36dd1b60c69552b93a7e21947 100644 (file)
@@ -295,7 +295,7 @@ void make_vertexcol(Scene *scene, int shade)        /* single ob */
        else
                memset(me->mcol, 255, 4*sizeof(MCol)*me->totface);
        
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&me->id, OB_RECALC_DATA);
        
 }
 
@@ -358,7 +358,7 @@ void clear_vpaint(Scene *scene, int selected)
                }
        }
        
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&me->id, OB_RECALC_DATA);
 }
 
 
@@ -468,7 +468,7 @@ void clear_wpaint_selectedfaces(Scene *scene)
        MEM_freeN(indexar);
        copy_wpaint_prev(wp, NULL, 0);
 
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&me->id, OB_RECALC_DATA);
 }
 
 
@@ -923,7 +923,7 @@ void sample_wpaint(Scene *scene, ARegion *ar, View3D *v3d, int mode)
                                        val= 0; // XXX pupmenu(str);
                                        if(val>=0) {
                                                ob->actdef= val+1;
-                                               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                                               DAG_id_flush_update(&me->id, OB_RECALC_DATA);
                                        }
                                        MEM_freeN(str);
                                }
@@ -1049,7 +1049,7 @@ static int set_wpaint(bContext *C, wmOperator *op)                /* toggle */
                * exit (exit needs doing regardless because we
                                * should redeform).
                */
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&me->id, OB_RECALC_DATA);
        
        if(ob->mode & OB_MODE_WEIGHT_PAINT) {
                Object *par;
@@ -1446,7 +1446,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
                        
        MTC_Mat4SwapMat4(vc->rv3d->persmat, mat);
                        
-       DAG_object_flush_update(vc->scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(ob->data, OB_RECALC_DATA);
        ED_region_tag_redraw(vc->ar);
 }
 
@@ -1478,7 +1478,7 @@ static void wpaint_stroke_done(bContext *C, struct PaintStroke *stroke)
                }
        }
        
-       DAG_object_flush_update(CTX_data_scene(C), ob, OB_RECALC_DATA);
+       DAG_id_flush_update(ob->data, OB_RECALC_DATA);
        
        MEM_freeN(wpd);
 }
@@ -1564,7 +1564,7 @@ static int set_vpaint(bContext *C, wmOperator *op)                /* toggle */
        
        if (me)
                /* update modifier stack for mapping requirements */
-               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+               DAG_id_flush_update(&me->id, OB_RECALC_DATA);
        
        WM_event_add_notifier(C, NC_SCENE|ND_MODE, scene);
        
@@ -1735,7 +1735,7 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
                        
        ED_region_tag_redraw(vc->ar);
                        
-       DAG_object_flush_update(vc->scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(ob->data, OB_RECALC_DATA);
 }
 
 static void vpaint_stroke_done(bContext *C, struct PaintStroke *stroke)
index 2977d07d8457be065889261ce23d5666ad0eaf00..b7a3df563ea673626c31f7e14541311d9f5a2927 100644 (file)
@@ -372,6 +372,10 @@ static void action_listener(ScrArea *sa, wmNotifier *wmn)
                        }*/
                        ED_area_tag_refresh(sa);
                        break;
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_DOPESHEET)
+                               ED_area_tag_redraw(sa);
+                       break;
        }
 }
 
index 954a52c54aa76196ef9816e9dc694408189f732b..8cdc6b0cd2b23d77c4d6b1f61230d57ae0288933 100644 (file)
@@ -260,7 +260,6 @@ void OBJECT_OT_material_slot_remove(wmOperatorType *ot)
 
 static int material_slot_assign_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
 
        if(!ob)
@@ -298,8 +297,8 @@ static int material_slot_assign_exec(bContext *C, wmOperator *op)
                }
        }
 
-    DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-    WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+    DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+    WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
        
        return OPERATOR_FINISHED;
 }
@@ -377,7 +376,7 @@ static int material_slot_de_select(bContext *C, int select)
                }
        }
 
-    WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob);
+    WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
 
        return OPERATOR_FINISHED;
 }
@@ -648,7 +647,7 @@ static int new_particle_settings_exec(bContext *C, wmOperator *op)
        psys_check_boid_data(psys);
 
        DAG_scene_sort(scene);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
        
@@ -695,7 +694,7 @@ static int new_particle_target_exec(bContext *C, wmOperator *op)
        BLI_addtail(&psys->targets, pt);
 
        DAG_scene_sort(scene);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
        
@@ -742,7 +741,7 @@ static int remove_particle_target_exec(bContext *C, wmOperator *op)
                pt->flag |= PTARGET_CURRENT;
 
        DAG_scene_sort(scene);
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
        WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
        
@@ -766,7 +765,6 @@ void PARTICLE_OT_remove_target(wmOperatorType *ot)
 
 static int target_move_up_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
        ParticleSystem *psys= ptr.data;
        Object *ob = ptr.id.data;
@@ -781,7 +779,7 @@ static int target_move_up_exec(bContext *C, wmOperator *op)
                        BLI_remlink(&psys->targets, pt);
                        BLI_insertlink(&psys->targets, pt->prev->prev, pt);
 
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                        WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
                        break;
                }
@@ -806,7 +804,6 @@ void PARTICLE_OT_target_move_up(wmOperatorType *ot)
 
 static int target_move_down_exec(bContext *C, wmOperator *op)
 {
-       Scene *scene= CTX_data_scene(C);
        PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
        ParticleSystem *psys= ptr.data;
        Object *ob = ptr.id.data;
@@ -820,7 +817,7 @@ static int target_move_down_exec(bContext *C, wmOperator *op)
                        BLI_remlink(&psys->targets, pt);
                        BLI_insertlink(&psys->targets, pt->next, pt);
 
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                        WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
                        break;
                }
index 71f8642afd489b9518bf9d5bad04e878667225a2..5d1dbe47345a86d6a281f1d6b24b900c0810554c 100644 (file)
@@ -335,7 +335,6 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
                                case ND_TRANSFORM:
                                case ND_BONE_ACTIVE:
                                case ND_BONE_SELECT:
-                               case ND_GEOM_SELECT:
                                case ND_CONSTRAINT:
                                        ED_area_tag_redraw(sa);
                                        break;
@@ -346,6 +345,13 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
                                        break;
                        }
                        break;
+               case NC_GEOM:
+                       switch(wmn->data) {
+                               case ND_SELECT:
+                                       ED_area_tag_redraw(sa);
+                                       break;
+                       }
+                       break;
                case NC_MATERIAL:
                        ED_area_tag_redraw(sa);
                        
@@ -358,14 +364,15 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
                        }                                       
                        break;
                case NC_WORLD:
-                       ED_area_tag_redraw(sa);
-                       sbuts->preview= 1;
                case NC_LAMP:
-                       ED_area_tag_redraw(sa);
-                       sbuts->preview= 1;
                case NC_TEXTURE:
                        ED_area_tag_redraw(sa);
                        sbuts->preview= 1;
+                       break;
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_PROPERTIES)
+                               ED_area_tag_redraw(sa);
+                       break;
        }
 
        if(wmn->data == ND_KEYS)
index 48890d6cac28d6c0a5daf3398bfaa97fb518e0ca..7e0dfe94432cc311a1b2479d4d62970fa3c8e07b 100644 (file)
@@ -321,11 +321,11 @@ static void console_main_area_listener(ScrArea *sa, wmNotifier *wmn)
 
        /* context changes */
        switch(wmn->category) {
-               case NC_CONSOLE:
-                       if(wmn->data == ND_CONSOLE) { /* generic redraw request */
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_CONSOLE) { /* generic redraw request */
                                ED_area_tag_redraw(sa);
                        }
-                       else if(wmn->data == ND_CONSOLE_REPORT && sc->type==CONSOLE_TYPE_REPORT) {
+                       else if(wmn->data == ND_SPACE_CONSOLE_REPORT && sc->type==CONSOLE_TYPE_REPORT) {
                                /* redraw also but only for report view, could do less redraws by checking the type */
                                ED_area_tag_redraw(sa);
                        }
index a06c1663d8e7c740a9a89a0e8890db6fa609a9bd..e1a6e346ce248b9530d31e6ac6c7e973573aa25c 100644 (file)
@@ -190,9 +190,9 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
        BLI_isect_rcti(&(ar->v2d.mask), &rect, &rect);
        
        if (FILE_SELECT_DIR == file_select(sfile, ar, &rect, val )) {
-               WM_event_add_notifier(C, NC_FILE|ND_FILELIST, NULL);
+               WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
        } else {
-               WM_event_add_notifier(C, NC_FILE|ND_PARAMS, NULL);
+               WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
        }
        return OPERATOR_FINISHED;
 }
@@ -239,12 +239,12 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
        file_deselect_all(sfile);
 
        if (FILE_SELECT_DIR == file_select(sfile, ar, &rect, val ))
-               WM_event_add_notifier(C, NC_FILE|ND_FILELIST, NULL);
+               WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
        else
-               WM_event_add_notifier(C, NC_FILE|ND_PARAMS, NULL);
+               WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 
        WM_event_add_mousemove(C); /* for directory changes */
-       WM_event_add_notifier(C, NC_FILE|ND_PARAMS, NULL);
+       WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -322,7 +322,7 @@ static int bookmark_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
                BLI_cleanup_dir(G.sce, params->dir);
                file_change_dir(sfile);                         
 
-               WM_event_add_notifier(C, NC_FILE|ND_FILELIST, NULL);
+               WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
        }
        
        return OPERATOR_FINISHED;
@@ -587,7 +587,7 @@ int file_parent_exec(bContext *C, wmOperator *unused)
                        BLI_parent_dir(sfile->params->dir);
                        BLI_cleanup_dir(G.sce, sfile->params->dir);
                        file_change_dir(sfile);
-                       WM_event_add_notifier(C, NC_FILE|ND_FILELIST, NULL);
+                       WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
                }
        }               
        
@@ -614,7 +614,7 @@ int file_refresh_exec(bContext *C, wmOperator *unused)
        
        file_change_dir(sfile);
 
-       WM_event_add_notifier(C, NC_FILE|ND_FILELIST, NULL);
+       WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
 
        return OPERATOR_FINISHED;
 
@@ -645,7 +645,7 @@ int file_previous_exec(bContext *C, wmOperator *unused)
 
                file_change_dir(sfile);
        }
-       WM_event_add_notifier(C, NC_FILE|ND_FILELIST, NULL);
+       WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -676,7 +676,7 @@ int file_next_exec(bContext *C, wmOperator *unused)
 
                file_change_dir(sfile);
        }               
-       WM_event_add_notifier(C, NC_FILE|ND_FILELIST, NULL);
+       WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -705,7 +705,7 @@ int file_directory_new_exec(bContext *C, wmOperator *unused)
                        BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), FILE_MAX);
                } 
        }               
-       WM_event_add_notifier(C, NC_FILE|ND_FILELIST, NULL);
+       WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -754,7 +754,7 @@ int file_directory_exec(bContext *C, wmOperator *unused)
                BLI_cleanup_dir(G.sce, sfile->params->dir);
                BLI_add_slash(sfile->params->dir);
                file_change_dir(sfile);
-               WM_event_add_notifier(C, NC_FILE|ND_FILELIST, NULL);
+               WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
        }               
        
 
@@ -769,7 +769,7 @@ int file_filename_exec(bContext *C, wmOperator *unused)
                if (file_select_match(sfile, sfile->params->file))
                {
                        sfile->params->file[0] = '\0';
-                       WM_event_add_notifier(C, NC_FILE|ND_PARAMS, NULL);
+                       WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
                }
        }               
 
@@ -796,7 +796,7 @@ int file_hidedot_exec(bContext *C, wmOperator *unused)
                sfile->params->flag ^= FILE_HIDE_DOT;
                filelist_free(sfile->files);
                sfile->params->active_file = -1;
-               WM_event_add_notifier(C, NC_FILE|ND_FILELIST, NULL);
+               WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
        }
        
        return OPERATOR_FINISHED;
@@ -958,7 +958,7 @@ int file_delete_exec(bContext *C, wmOperator *op)
        file = filelist_file(sfile->files, sfile->params->active_file);
        BLI_make_file_string(G.sce, str, sfile->params->dir, file->relname);
        BLI_delete(str, 0, 0);  
-       WM_event_add_notifier(C, NC_FILE | ND_FILELIST, NULL);
+       WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
        
        return OPERATOR_FINISHED;
 
index 793f7cf88158aa53a2cfd5ae5d6dad42dbe25379..722fa47572712cd1d072fa6582a4262b426bba6d 100644 (file)
@@ -212,14 +212,14 @@ static void file_listener(ScrArea *sa, wmNotifier *wmn)
 
        /* context changes */
        switch(wmn->category) {
-               case NC_FILE:
+               case NC_SPACE:
                        switch (wmn->data) {
-                               case ND_FILELIST:
+                               case ND_SPACE_FILE_LIST:
                                        if (sfile->files) filelist_free(sfile->files);
                                        ED_area_tag_refresh(sa);
                                        ED_area_tag_redraw(sa);
                                        break;
-                               case ND_PARAMS:
+                               case ND_SPACE_FILE_PARAMS:
                                        ED_area_tag_refresh(sa);
                                        ED_area_tag_redraw(sa);
                                        break;
@@ -249,12 +249,12 @@ static void file_main_area_listener(ARegion *ar, wmNotifier *wmn)
 {
        /* context changes */
        switch(wmn->category) {
-               case NC_FILE:
+               case NC_SPACE:
                        switch (wmn->data) {
-                               case ND_FILELIST:
+                               case ND_SPACE_FILE_LIST:
                                        ED_region_tag_redraw(ar);
                                        break;
-                               case ND_PARAMS:
+                               case ND_SPACE_FILE_PARAMS:
                                        ED_region_tag_redraw(ar);
                                        break;
                        }
@@ -470,9 +470,9 @@ static void file_ui_area_listener(ARegion *ar, wmNotifier *wmn)
 {
        /* context changes */
        switch(wmn->category) {
-               case NC_FILE:
+               case NC_SPACE:
                        switch (wmn->data) {
-                               case ND_FILELIST:
+                               case ND_SPACE_FILE_LIST:
                                        ED_region_tag_redraw(ar);
                                        break;
                        }
index 3717ccc82447fe470a85d64b21129255af7afdee..8887d464f3003c4a54ebe247015ea6e9b03e5d89 100644 (file)
@@ -423,6 +423,10 @@ static void graph_listener(ScrArea *sa, wmNotifier *wmn)
                        }*/
                        ED_area_tag_refresh(sa);
                        break;
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_GRAPH)
+                               ED_area_tag_redraw(sa);
+                       break;
                default:
                        if(wmn->data==ND_KEYS)
                                ED_area_tag_refresh(sa);
index bb647e689171c216c44ac5f82d5d739aef9556b1..c57bc5773b0fc288c1cda109fda0483b34d9f53f 100644 (file)
@@ -295,10 +295,14 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
                case NC_IMAGE:  
                        ED_area_tag_redraw(sa);
                        break;
-               case NC_OBJECT:
+               case NC_SPACE:  
+                       if(wmn->data == ND_SPACE_IMAGE)
+                               ED_area_tag_redraw(sa);
+                       break;
+               case NC_GEOM:
                        switch(wmn->data) {
-                               case ND_GEOM_SELECT:
-                               case ND_GEOM_DATA:
+                               case ND_DATA:
+                               case ND_SELECT:
                                        ED_area_tag_redraw(sa);
                                        break;
                        }
@@ -625,7 +629,7 @@ void ED_space_image_set(bContext *C, SpaceImage *sima, Scene *scene, Object *obe
 
        if(C) {
                if(obedit)
-                       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+                       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
                ED_area_tag_redraw(CTX_wm_area(C));
        }
index b6f9cbeabb5fdd09f8d6c26baf1bc8d62fa9fc02..d3f9c97205c8bdacc4ee99f862e2352d91398bc7 100644 (file)
@@ -167,8 +167,9 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn)
                        if(wmn->data==ND_RENDER_RESULT)
                                ED_region_tag_redraw(ar);
                        break;
-               case NC_INFO:
-                       ED_region_tag_redraw(ar);
+               case NC_SPACE:  
+                       if(wmn->data == ND_SPACE_INFO)
+                               ED_region_tag_redraw(ar);
                        break;
        }
        
index c4f929274c74794e66820670787794eb89832262..89d4e7cddf239a16a7f3f7ad3ad820087235fa62 100644 (file)
@@ -488,6 +488,10 @@ static void nla_listener(ScrArea *sa, wmNotifier *wmn)
                        }*/
                        ED_area_tag_refresh(sa);
                        break;
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_NLA)
+                               ED_area_tag_redraw(sa);
+                       break;
        }
 }
 
index 2233a4db3a065b8adea18f62e43cfc30a67c9df5..d3a445b18c072e0e88f530ba26ee99bc5624a91b 100644 (file)
@@ -163,6 +163,15 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
                        if(wmn->data==ND_NODES)
                                ED_area_tag_refresh(sa);
                        break;
+               case NC_TEXT:
+                       /* pynodes */
+                       if(wmn->data==ND_SHADING)
+                               ED_area_tag_refresh(sa);
+                       break;
+               case NC_SPACE:
+                       if(wmn->data==ND_SPACE_NODE)
+                               ED_area_tag_refresh(sa);
+                       break;
        }
 }
 
index a9a9a5dab5fe4358a2d0e02bdfd53fb69646f334..a3b47d505fdff4a7590cf2f45ce844145a929294 100644 (file)
@@ -1994,7 +1994,7 @@ static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement *
        ob= (Object *)tselem->id;
        if(set) {
                ob->actdef= te->index+1;
-               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+               DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
        }
        else {
@@ -2121,7 +2121,7 @@ static int tree_element_active_psys(bContext *C, Scene *scene, TreeElement *te,
        if(set) {
                Object *ob= (Object *)tselem->id;
                
-               WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
+               WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, ob);
                
 // XXX         extern_set_butspace(F7KEY, 0);
        }
@@ -4682,7 +4682,7 @@ static void restrictbutton_modifier_cb(bContext *C, void *poin, void *poin2)
        Scene *scene = (Scene *)poin;
        Object *ob = (Object *)poin2;
        
-       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        object_handle_update(scene, ob);
 
        WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
index f57445a32f1f93dd36046d9bb36ffd1fe21225a8..5058a167a29ef072a1a58f039357cb2d8508efa6 100644 (file)
@@ -137,6 +137,10 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
                        /* all actions now, todo: check outliner view mode? */
                        ED_region_tag_redraw(ar);
                        break;
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_OUTLINER)
+                               ED_region_tag_redraw(ar);
+                       break;
        }
        
 }
@@ -190,6 +194,10 @@ static void outliner_header_area_listener(ARegion *ar, wmNotifier *wmn)
                        if(wmn->data == ND_KEYINGSET)
                                ED_region_tag_redraw(ar);
                        break;
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_OUTLINER)
+                               ED_region_tag_redraw(ar);
+                       break;
        }
 }
 
index 084416f3a60783dc5e240a26a96beb62483e834e..26ffd88ae674fcab58927f1e8d611b018de534b4 100644 (file)
@@ -219,6 +219,10 @@ static void sequencer_main_area_listener(ARegion *ar, wmNotifier *wmn)
                                        break;
                        }
                        break;
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_SEQUENCER)
+                               ED_region_tag_redraw(ar);
+                       break;
        }
 }
 
@@ -241,6 +245,10 @@ static void sequencer_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
 {
        /* context changes */
        switch(wmn->category) {
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_SEQUENCER)
+                               ED_region_tag_redraw(ar);
+                       break;
                
        }
 }
@@ -293,6 +301,7 @@ void ED_spacetype_sequencer(void)
        
        art->init= sequencer_header_area_init;
        art->draw= sequencer_header_area_draw;
+       art->listener= sequencer_main_area_listener;
        
        BLI_addhead(&st->regiontypes, art);
        
index 4394fbfe1f558437dea52c1c958482e46d701663..0d08490cfb08e16e955c7ff4ee59de9753c498a8 100644 (file)
@@ -143,6 +143,10 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn)
                                ED_area_tag_redraw(sa);
 
                        break;
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_TEXT)
+                               ED_area_tag_redraw(sa);
+                       break;
        }
 }
 
index 14b72e13856b7c237fd702a7b52f1527a265a140..a8ef72e327341378c649d1206228c548fbf94cef 100644 (file)
@@ -549,7 +549,6 @@ static int refresh_pyconstraints_exec(bContext *C, wmOperator *op)
 {
 #ifndef DISABLE_PYTHON
        Text *text= CTX_data_edit_text(C);
-       Scene *scene= CTX_data_scene(C);
        Object *ob;
        bConstraint *con;
        short update;
@@ -579,7 +578,7 @@ static int refresh_pyconstraints_exec(bContext *C, wmOperator *op)
                }
                
                if(update) {
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                }
        }
 #endif
index ce6846a448980ac488d2002005572c1473772cc3..8f7486f81d955e99c9e07f4eb796892ce18ebf8a 100644 (file)
@@ -260,6 +260,11 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
 {
        /* context changes */
        switch(wmn->category) {
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_TIME)
+                               ED_region_tag_redraw(ar);
+                       break;
+
                case NC_ANIMATION:
                        ED_region_tag_redraw(ar);
                        break;
@@ -293,6 +298,7 @@ static void time_header_area_listener(ARegion *ar, wmNotifier *wmn)
                        if(wmn->data==ND_ANIMPLAY)
                                ED_region_tag_redraw(ar);
                        break;
+
                case NC_SCENE:
                        switch (wmn->data) {
                                case ND_FRAME:
@@ -300,6 +306,11 @@ static void time_header_area_listener(ARegion *ar, wmNotifier *wmn)
                                        ED_region_tag_redraw(ar);
                                break;
                        }
+
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_TIME)
+                               ED_region_tag_redraw(ar);
+                       break;
        }
 }
 
index 97c5549e1ea9f0685e0d4f3b681469b094d73b34..2250c2e7718dff64b8255bd97101161ed831398f 100644 (file)
@@ -452,16 +452,24 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
                                case ND_BONE_ACTIVE:
                                case ND_BONE_SELECT:
                                case ND_TRANSFORM:
-                               case ND_GEOM_SELECT:
-                               case ND_GEOM_DATA:
                                case ND_DRAW:
                                case ND_MODIFIER:
                                case ND_CONSTRAINT:
                                case ND_KEYS:
-                               case ND_PARTICLE:
+                               case ND_PARTICLE_SELECT:
+                               case ND_PARTICLE_DATA:
                                        ED_region_tag_redraw(ar);
                                        break;
                        }
+                       break;
+               case NC_GEOM:
+                       switch(wmn->data) {
+                               case ND_DATA:
+                               case ND_SELECT:
+                                       ED_region_tag_redraw(ar);
+                                       break;
+                       }
+                       break;
                case NC_GROUP:
                        /* all group ops for now */
                        ED_region_tag_redraw(ar);
@@ -483,6 +491,10 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
                         * more context than just the region */
                        ED_region_tag_redraw(ar);
                        break;
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_VIEW3D)
+                               ED_region_tag_redraw(ar);
+                       break;
        }
 }
 
@@ -528,6 +540,10 @@ static void view3d_header_area_listener(ARegion *ar, wmNotifier *wmn)
                                        break;
                        }
                        break;
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_VIEW3D)
+                               ED_region_tag_redraw(ar);
+                       break;
        }
 }
 
@@ -576,13 +592,24 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
                                case ND_BONE_ACTIVE:
                                case ND_BONE_SELECT:
                                case ND_TRANSFORM:
-                               case ND_GEOM_SELECT:
-                               case ND_GEOM_DATA:
                                case ND_DRAW:
                                case ND_KEYS:
                                        ED_region_tag_redraw(ar);
                                        break;
                        }
+                       break;
+               case NC_GEOM:
+                       switch(wmn->data) {
+                               case ND_DATA:
+                               case ND_SELECT:
+                                       ED_region_tag_redraw(ar);
+                                       break;
+                       }
+                       break;
+               case NC_SPACE:
+                       if(wmn->data == ND_SPACE_VIEW3D)
+                               ED_region_tag_redraw(ar);
+                       break;
        }
 }
 
index 7c305d598667a311b78d3b26076dc160bce41c0f..c854de8e54d4008a00fe1538475e2c5170510491 100644 (file)
@@ -660,7 +660,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event)
                return; /* no notifier! */
                
        case B_OBJECTPANEL:
-               DAG_object_flush_update(scene, ob, OB_RECALC_OB);
+               DAG_id_flush_update(&ob->id, OB_RECALC_OB);
                break;
                
        case B_OBJECTPANELROT:
@@ -668,7 +668,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event)
                        ob->rot[0]= M_PI*tfp->ob_eul[0]/180.0;
                        ob->rot[1]= M_PI*tfp->ob_eul[1]/180.0;
                        ob->rot[2]= M_PI*tfp->ob_eul[2]/180.0;
-                       DAG_object_flush_update(scene, ob, OB_RECALC_OB);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_OB);
                }
                break;
 
@@ -706,7 +706,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event)
                                VECCOPY(ob->size, tfp->ob_scale);
                                
                        }
-                       DAG_object_flush_update(scene, ob, OB_RECALC_OB);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_OB);
                }
                break;
 
@@ -752,14 +752,14 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event)
                        /* prevent multiple B_OBJECTPANELDIMS events to keep scaling, cycling with TAB on buttons can cause that */
                        VECCOPY(tfp->ob_dims, old_dims);
                        
-                       DAG_object_flush_update(scene, ob, OB_RECALC_OB);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_OB);
                }
                break;
        
        case B_OBJECTPANELMEDIAN:
                if(ob) {
                        v3d_editvertex_buts(C, NULL, v3d, ob, 1.0);
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                }
                break;
                
@@ -770,7 +770,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event)
                                ob->parent= NULL;
                        else {
                                DAG_scene_sort(scene);
-                               DAG_object_flush_update(scene, ob, OB_RECALC_OB);
+                               DAG_id_flush_update(&ob->id, OB_RECALC_OB);
                        }
                }
                break;
@@ -847,7 +847,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event)
        case B_ARMATUREPANEL2:
                {
                        ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                }
                break;
        case B_TRANSFORMSPACEADD:
@@ -900,7 +900,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event)
                                int a;
                                for(a=0; a<me->totvert; a++)
                                        remove_vert_defgroup (ob, defGroup, a);
-                               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                               DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                        }
                }
                break;
index 305b69560371cdf3105dd7d4b879f63d6745e7ab..2283d36e018f5c94517601a63c4da0b947648752 100644 (file)
@@ -1725,7 +1725,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
                                em->selectmode= SCE_SELECT_VERTEX;
                        ts->selectmode= em->selectmode;
                        EM_selectmode_set(em);
-                       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+                       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
                        ED_undo_push(C, "Selectmode Set: Vertex");
                }
                break;
@@ -1739,7 +1739,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
                        }
                        ts->selectmode= em->selectmode;
                        EM_selectmode_set(em);
-                       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+                       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
                        ED_undo_push(C, "Selectmode Set: Edge");
                }
                break;
@@ -1753,7 +1753,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
                        }
                        ts->selectmode= em->selectmode;
                        EM_selectmode_set(em);
-                       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+                       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
                        ED_undo_push(C, "Selectmode Set: Face");
                }
                break;  
index 7743ede399bbe01b10af600e4d25d9ca8561da53..5c6a22f51571dd9e27a7fec0a0c8f32031b0df6b 100644 (file)
@@ -1359,7 +1359,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
                        vc.em= me->edit_mesh;
                        do_mesh_box_select(&vc, &rect, (val==LEFTMOUSE));
 //                     if (EM_texFaceCheck())
-                       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+                       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
                        
                }
                else if(ELEM(obedit->type, OB_CURVE, OB_SURF)) {
@@ -1802,7 +1802,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
 
                if(CTX_data_edit_object(C)) {
                        obedit_circle_select(&vc, selecting, mval, (float)radius);
-                       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obact);
+                       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obact->data);
                }
                else
                        return PE_circle_select(C, selecting, mval, (float)radius);
index 335bc2c9e563def2727b8259e2b8d03cbbeafe06..2e5696170e22948dea24cbef96895f9928f6e6b4 100644 (file)
@@ -106,7 +106,7 @@ static void special_transvert_update(Scene *scene, Object *obedit)
        
        if(obedit) {
                
-               DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+               DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
                
                if(obedit->type==OB_MESH) {
                        Mesh *me= obedit->data;
@@ -514,7 +514,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *op)
                                
                                /* auto-keyframing */
 // XXX                         autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0);
-                               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                               DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                        }
                        else {
                                ob->recalc |= OB_RECALC_OB;
@@ -640,7 +640,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *op)
                                
                                /* auto-keyframing */
 // XXX                         autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0);
-                               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                               DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                        }
                        else {
                                ob->recalc |= OB_RECALC_OB;
@@ -1028,7 +1028,7 @@ static int snap_selected_to_center(bContext *C, wmOperator *op)
                                /* auto-keyframing */
                                ob->pose->flag |= POSE_DO_UNLOCK;
 // XXX                         autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0);
-                               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+                               DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                        }
                        else {
                                ob->recalc |= OB_RECALC_OB;
index f0de28476f0c7dae8bd6b9151bdf719c0e775ee9..370e98ebd073b08726db8625c4f2137b6f59475d 100644 (file)
@@ -333,7 +333,7 @@ static void viewRedrawForce(bContext *C, TransInfo *t)
                else force_draw(0);
 #endif
 
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, t->obedit);
+               WM_event_add_notifier(C, NC_GEOM|ND_DATA, t->obedit->data);
        }
 }
 
index 302d9b675a02b3cd64c889097bd6575cbccc1bcd..0fce9592d1dd9148f7ab9b98da38359403a24039 100644 (file)
@@ -4722,9 +4722,9 @@ void special_aftertrans_update(TransInfo *t)
                                ob->ctime= -1234567.0f;
                                
                                if (ob->pose || ob_get_key(ob))
-                                       DAG_object_flush_update(scene, ob, OB_RECALC);
+                                       DAG_id_flush_update(&ob->id, OB_RECALC);
                                else
-                                       DAG_object_flush_update(scene, ob, OB_RECALC_OB);
+                                       DAG_id_flush_update(&ob->id, OB_RECALC_OB);
                        }
                        
                        /* Do curve cleanups? */
@@ -4748,7 +4748,7 @@ void special_aftertrans_update(TransInfo *t)
                        }
 #endif // XXX old animation system
                        
-                       DAG_object_flush_update(scene, OBACT, OB_RECALC_DATA);
+                       DAG_id_flush_update(&OBACT->id, OB_RECALC_DATA);
                }
 #if 0 // XXX future of this is still not clear
                else if (ac.datatype == ANIMCONT_GPENCIL) {
@@ -4912,15 +4912,15 @@ void special_aftertrans_update(TransInfo *t)
                /* automatic inserting of keys and unkeyed tagging - only if transform wasn't cancelled (or TFM_DUMMY) */
                if (!cancelled && (t->mode != TFM_DUMMY)) {
                        autokeyframe_pose_cb_func(t->scene, (View3D *)t->view, ob, t->mode, targetless_ik);
-                       DAG_object_flush_update(t->scene, ob, OB_RECALC_DATA);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                }
                else if (arm->flag & ARM_DELAYDEFORM) {
                        /* old optimize trick... this enforces to bypass the depgraph */
-                       DAG_object_flush_update(t->scene, ob, OB_RECALC_DATA);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
                        ob->recalc= 0;  // is set on OK position already by recalcData()
                }
                else
-                       DAG_object_flush_update(t->scene, ob, OB_RECALC_DATA);
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
 
                //if (t->mode==TFM_BONESIZE || t->mode==TFM_BONE_ENVELOPE)
                //      allqueue(REDRAWBUTSEDIT, 0);
@@ -4948,7 +4948,7 @@ void special_aftertrans_update(TransInfo *t)
                                /* Creates troubles for moving animated objects without */
                                /* autokey though, probably needed is an anim sys override? */
                                /* Please remove if some other solution is found. -jahka */
-                               DAG_object_flush_update(scene, ob, OB_RECALC_OB);
+                               DAG_id_flush_update(&ob->id, OB_RECALC_OB);
 
                                /* Set autokey if necessary */
                                if (!cancelled)
index 0f715f1d35ab1bb638c6d44764b7f57d2d764921..0b7029adde06b08bd9ed566b5cabdc540ae2df70 100644 (file)
@@ -283,7 +283,7 @@ static void animedit_refresh_id_tags (Scene *scene, ID *id)
                        case ID_OB:
                        {
                                Object *ob= (Object *)id;
-                               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);  /* sets recalc flags */
+                               DAG_id_flush_update(&ob->id, OB_RECALC_DATA);  /* sets recalc flags */
                        }
                                break;
                }
@@ -621,7 +621,7 @@ void recalcData(TransInfo *t)
                        Curve *cu= t->obedit->data;
                        Nurb *nu= cu->editnurb->first;
 
-                       DAG_object_flush_update(scene, t->obedit, OB_RECALC_DATA);  /* sets recalc flags */
+                       DAG_id_flush_update(t->obedit->data, OB_RECALC_DATA);  /* sets recalc flags */
 
                        if (t->state == TRANS_CANCEL) {
                                while(nu) {
@@ -641,7 +641,7 @@ void recalcData(TransInfo *t)
                }
                else if(t->obedit->type==OB_LATTICE) {
                        Lattice *la= t->obedit->data;
-                       DAG_object_flush_update(scene, t->obedit, OB_RECALC_DATA);  /* sets recalc flags */
+                       DAG_id_flush_update(t->obedit->data, OB_RECALC_DATA);  /* sets recalc flags */
 
                        if(la->editlatt->flag & LT_OUTSIDE) outside_lattice(la->editlatt);
                }
@@ -653,7 +653,7 @@ void recalcData(TransInfo *t)
                                if(sima->flag & SI_LIVE_UNWRAP)
                                        ED_uvedit_live_unwrap_re_solve();
 
-                               DAG_object_flush_update(scene, t->obedit, OB_RECALC_DATA);
+                               DAG_id_flush_update(t->obedit->data, OB_RECALC_DATA);
                        } else {
                                EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh;
                                /* mirror modifier clipping? */
@@ -668,7 +668,7 @@ void recalcData(TransInfo *t)
                                if((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
                                        editmesh_apply_to_mirror(t);
 
-                               DAG_object_flush_update(scene, t->obedit, OB_RECALC_DATA);  /* sets recalc flags */
+                               DAG_id_flush_update(t->obedit->data, OB_RECALC_DATA);  /* sets recalc flags */
 
                                recalc_editnormals(em);
                        }
@@ -752,7 +752,7 @@ void recalcData(TransInfo *t)
 
                }
                else
-                       DAG_object_flush_update(scene, t->obedit, OB_RECALC_DATA);  /* sets recalc flags */
+                       DAG_id_flush_update(t->obedit->data, OB_RECALC_DATA);  /* sets recalc flags */
        }
        else if( (t->flag & T_POSE) && t->poseobj) {
                Object *ob= t->poseobj;
@@ -772,7 +772,7 @@ void recalcData(TransInfo *t)
 
                /* old optimize trick... this enforces to bypass the depgraph */
                if (!(arm->flag & ARM_DELAYDEFORM)) {
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);  /* sets recalc flags */
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);  /* sets recalc flags */
                }
                else
                        where_is_pose(scene, ob);
index 17a1e0b6cdbeb97dfaae93aeed3e7a0af5bacd6e..2d73a9f1d25eed6ab044e8f797d19fe3263effb6 100644 (file)
@@ -267,7 +267,7 @@ void undo_editmode_step(bContext *C, int step)
                }
        }
 
-//     DAG_object_flush_update(G.scene, obedit, OB_RECALC_DATA);
+//     DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
        /* XXX notifiers */
 }
 
index bb5a8b1dd40e11481d4ee1d064f6790c12ae8e50..a44421e8145ccbe2819aeb983a58abee957c72b4 100644 (file)
@@ -139,7 +139,7 @@ void ED_uvedit_assign_image(Scene *scene, Object *obedit, Image *ima, Image *pre
 
        /* and update depdency graph */
        if(update)
-               DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+               DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
 
        BKE_mesh_end_editmesh(obedit->data, em);
 }
@@ -169,8 +169,8 @@ void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, i
                        tf->tile= curtile; /* set tile index */
        }
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
        BKE_mesh_end_editmesh(obedit->data, em);
 }
 
@@ -1058,8 +1058,8 @@ static void weld_align_uv(bContext *C, int tool)
                }
        }
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
 }
@@ -1279,8 +1279,8 @@ static int stitch_exec(bContext *C, wmOperator *op)
                MEM_freeN(uv_average);
        }
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -1336,7 +1336,7 @@ static int select_inverse_exec(bContext *C, wmOperator *op)
                }
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -1406,7 +1406,7 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
                }
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -1710,8 +1710,8 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
                }
        }
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
        
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_PASS_THROUGH|OPERATOR_FINISHED;
@@ -1834,8 +1834,8 @@ static int select_linked_exec(bContext *C, wmOperator *op)
        uvedit_pixel_to_float(sima, limit, 0.05f);
        select_linked(scene, ima, em, limit, NULL, extend);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -1890,8 +1890,8 @@ static int unlink_selection_exec(bContext *C, wmOperator *op)
                }
        }
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -2167,7 +2167,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
                        }
                }
 
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
                
                BKE_mesh_end_editmesh(obedit->data, em);
                return OPERATOR_FINISHED;
@@ -2262,7 +2262,7 @@ int circle_select_exec(bContext *C, wmOperator *op)
        if(select) EM_select_flush(em);
        else EM_deselect_flush(em);
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -2567,8 +2567,8 @@ static int snap_selection_exec(bContext *C, wmOperator *op)
        if(!change)
                return OPERATOR_CANCELLED;
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        return OPERATOR_FINISHED;
 }
@@ -2627,7 +2627,7 @@ static int pin_exec(bContext *C, wmOperator *op)
                }
        }
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -2672,7 +2672,7 @@ static int select_pinned_exec(bContext *C, wmOperator *op)
                }
        }
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -2704,7 +2704,7 @@ static int hide_exec(bContext *C, wmOperator *op)
 
        if(ts->uv_flag & UV_SYNC_SELECTION) {
                EM_hide_mesh(em, swap);
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
                BKE_mesh_end_editmesh(obedit->data, em);
                return OPERATOR_FINISHED;
@@ -2812,7 +2812,7 @@ static int hide_exec(bContext *C, wmOperator *op)
        }
        
        EM_validate_selections(em);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -2847,7 +2847,7 @@ static int reveal_exec(bContext *C, wmOperator *op)
        /* call the mesh function if we are in mesh sync sel */
        if(ts->uv_flag & UV_SYNC_SELECTION) {
                EM_reveal_mesh(em);
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
                BKE_mesh_end_editmesh(obedit->data, em);
                return OPERATOR_FINISHED;
@@ -2943,7 +2943,7 @@ static int reveal_exec(bContext *C, wmOperator *op)
                                EM_select_face(efa, 1);
        }
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
index c4f4704e47e408f5741d92c47431240d631e2ec1..c18c9f8e022ad25794393b003a089335d40cddb7 100644 (file)
@@ -263,8 +263,8 @@ static void minimize_stretch_iteration(bContext *C, wmOperator *op, int interact
 
                ms->lasttime = PIL_check_seconds_timer();
 
-               DAG_object_flush_update(ms->scene, ms->obedit, OB_RECALC_DATA);
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ms->obedit);
+               DAG_id_flush_update(ms->obedit->data, OB_RECALC_DATA);
+               WM_event_add_notifier(C, NC_GEOM|ND_DATA, ms->obedit->data);
        }
 }
 
@@ -286,8 +286,8 @@ static void minimize_stretch_exit(bContext *C, wmOperator *op, int cancel)
        param_stretch_end(ms->handle);
        param_delete(ms->handle);
 
-       DAG_object_flush_update(ms->scene, ms->obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ms->obedit);
+       DAG_id_flush_update(ms->obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, ms->obedit->data);
 
        MEM_freeN(ms);
        op->customdata= NULL;
@@ -413,8 +413,8 @@ static int pack_islands_exec(bContext *C, wmOperator *op)
        param_flush(handle);
        param_delete(handle);
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -446,8 +446,8 @@ static int average_islands_scale_exec(bContext *C, wmOperator *op)
        param_flush(handle);
        param_delete(handle);
        
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -810,8 +810,8 @@ static int unwrap_exec(bContext *C, wmOperator *op)
 
        param_delete(handle);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -943,8 +943,8 @@ static int from_view_exec(bContext *C, wmOperator *op)
 
        uv_map_clip_correct(em, op);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -1010,8 +1010,8 @@ static int reset_exec(bContext *C, wmOperator *op)
                }
        }
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -1098,8 +1098,8 @@ static int sphere_project_exec(bContext *C, wmOperator *op)
 
        uv_map_clip_correct(em, op);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -1170,8 +1170,8 @@ static int cylinder_project_exec(bContext *C, wmOperator *op)
 
        uv_map_clip_correct(em, op);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -1257,8 +1257,8 @@ static int cube_project_exec(bContext *C, wmOperator *op)
 
        uv_map_clip_correct(em, op);
 
-       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
+       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
index 7bab7947843c0a3b5500e600e4c06619220292bf..3f4b75508fea086688cc7416c3551eb262f89cce 100644 (file)
 
 static void rna_Armature_update_data(bContext *C, PointerRNA *ptr)
 {
-       Main *bmain= CTX_data_main(C);
-       Scene *scene= CTX_data_scene(C);
        ID *id= ptr->id.data;
-       Object *ob;
 
-       for(ob=bmain->object.first; ob; ob= ob->id.next) {
-               if(ob->data == id) {
-                       /* XXX this will loop over all objects again (slow) */
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-                       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
-               }
-       }
+       DAG_id_flush_update(id, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, id);
 }
 
 static void rna_Armature_redraw_data(bContext *C, PointerRNA *ptr)
 {
-       Main *bmain= CTX_data_main(C);
        ID *id= ptr->id.data;
-       Object *ob;
 
-       for(ob=bmain->object.first; ob; ob= ob->id.next)
-               if(ob->data == id)
-                       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
+       WM_event_add_notifier(C, NC_GEOM|ND_DATA, id);
 }
 
 static void rna_bone_layer_set(short *layer, const int *values)
index 0c5565e253aa070cf1e79f14856b2a958ed88763..8002aa89313e87aed4e81dd893e457285df56aae 100644 (file)
@@ -41,6 +41,7 @@
 #include "DNA_object_types.h"
 #include "DNA_particle_types.h"
 
+#include "WM_api.h"
 #include "WM_types.h"
 
 EnumPropertyItem boidrule_type_items[] ={
@@ -82,14 +83,15 @@ static void rna_Boids_reset(bContext *C, PointerRNA *ptr)
                
                psys->recalc = PSYS_RECALC_RESET;
 
-               if(ob) {
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-               }
+               if(ob)
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        }
        else {
                part = ptr->id.data;
                psys_flush_particle_settings(scene, part, PSYS_RECALC_RESET);
        }
+
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL);
 }
 static void rna_Boids_reset_deps(bContext *C, PointerRNA *ptr)
 {
@@ -102,15 +104,16 @@ static void rna_Boids_reset_deps(bContext *C, PointerRNA *ptr)
                
                psys->recalc = PSYS_RECALC_RESET;
 
-               if(ob) {
-                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-               }
+               if(ob)
+                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
        }
        else {
                part = ptr->id.data;
                psys_flush_particle_settings(scene, part, PSYS_RECALC_RESET);
                DAG_scene_sort(scene);
        }
+
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE_DATA, NULL);
 }
 
 static StructRNA* rna_BoidRule_refine(struct PointerRNA *ptr)
@@ -247,12 +250,12 @@ static void rna_def_boidrule_goal(BlenderRNA *brna)
        RNA_def_property_pointer_sdna(prop, NULL, "ob");
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Object", "Goal object.");
-       RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Boids_reset_deps");
+       RNA_def_property_update(prop, 0, "rna_Boids_reset_deps");
 
        prop= RNA_def_property(srna, "predict", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_GOAL_AVOID_PREDICT);
        RNA_def_property_ui_text(prop, "Predict", "Predict target movement.");
-       RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Boids_reset");
+       RNA_def_property_update(prop, 0, "rna_Boids_reset");
 }
 
 static void rna_def_boidrule_avoid(BlenderRNA *brna)
@@