Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / source / blender / editors / mesh / editmesh_mods.c
index 6176252..363b6ec 100644 (file)
@@ -39,7 +39,7 @@ editmesh_mods.c, UI level access, no geometry changes
 
 #include "MEM_guardedalloc.h"
 
-
+#include "MTC_matrixops.h"
 
 #include "DNA_mesh_types.h"
 #include "DNA_material_types.h"
@@ -127,7 +127,7 @@ void EM_automerge(int update)
 //             if (len) {
 //                     em->totvert -= len; /* saves doing a countall */
 //                     if (update) {
-//                             DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+//                             DAG_object_flush_update(scene, obedit, 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_GEOM|ND_SELECT, obedit->data);
+               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
                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(ToolSettings *ts, EditMesh *em, int mode)
+static int similar_edge_select__internal(Scene *scene, 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(ToolSettings *ts, EditMesh *em, int mod
        unsigned int deselcount=0;
        
        short ok=0;
-       float thresh= ts->select_thresh;
+       float thresh= scene->toolsettings->select_thresh;
        
        for(eed= em->edges.first; eed; eed= eed->next) {
                if (!eed->h) {
@@ -1039,17 +1039,17 @@ static int similar_edge_select__internal(ToolSettings *ts, EditMesh *em, int mod
 /* wrap the above function but do selection flushing edge to face */
 static int similar_edge_select_exec(bContext *C, wmOperator *op)
 {
-       ToolSettings *ts= CTX_data_tool_settings(C);
+       Scene *scene= CTX_data_scene(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(ts, em, RNA_int_get(op->ptr, "type"));
+       int selcount = similar_edge_select__internal(scene, 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_GEOM|ND_SELECT, obedit->data);
+               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
                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)
 {
-       ToolSettings *ts= CTX_data_tool_settings(C);
+       Scene *scene= CTX_data_scene(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= ts->select_thresh;
+       float thresh= scene->toolsettings->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_GEOM|ND_SELECT, obedit->data);
+               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
                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_id_flush_update(obedit->data, OB_RECALC_DATA);
+//             DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
                
        }
 }
@@ -1541,7 +1541,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type)
        }
        
        if (change) {
-//             DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+//             DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
                
        }
 }
@@ -1671,7 +1671,7 @@ void EM_mesh_copy_face_layer(EditMesh *em, wmOperator *op, short type)
        }
 
        if (change) {
-//             DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+//             DAG_object_flush_update(scene, obedit, 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_GEOM|ND_SELECT, obedit->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
        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_GEOM|ND_SELECT, vc.obedit->data);
+               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
        }
 }
 
@@ -2159,8 +2159,9 @@ static void mouse_mesh_shortest_path(bContext *C, short mval[2])
                                break;
                }
                
-               DAG_id_flush_update(vc.obedit->data, OB_RECALC_DATA);
-               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
+               DAG_object_flush_update(vc.scene, vc.obedit, OB_RECALC_DATA);
+       
+               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
        }
 }
 
@@ -2260,7 +2261,7 @@ void mouse_mesh(bContext *C, short mval[2], short extend)
                }
        }
 
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
        
 }
 
@@ -2404,12 +2405,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_GEOM|ND_SELECT, obedit->data);
+               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
                return retval;
        }
        
        if( unified_findnearest(&vc, &eve, &eed, &efa)==0 ) {
-               WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
                return OPERATOR_CANCELLED;
        }
@@ -2463,7 +2464,7 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
        
 //     if (EM_texFaceCheck())
        
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        return OPERATOR_FINISHED;       
 }
 
@@ -2544,7 +2545,7 @@ static int select_linked_exec(bContext *C, wmOperator *op)
        else
                selectconnected_mesh_all(em);
        
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -2670,7 +2671,7 @@ void EM_hide_mesh(EditMesh *em, int swap)
        em->totedgesel= em->totfacesel= em->totvertsel= 0;
 //     if(EM_texFaceCheck())
 
-       //      DAG_id_flush_update(obedit->data, OB_RECALC_DATA);      
+       //      DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); 
 }
 
 static int hide_mesh_exec(bContext *C, wmOperator *op)
@@ -2680,7 +2681,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_GEOM|ND_SELECT, obedit->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -2737,7 +2738,7 @@ void EM_reveal_mesh(EditMesh *em)
        EM_selectmode_flush(em);
 
 //     if (EM_texFaceCheck())
-//     DAG_id_flush_update(obedit->data, OB_RECALC_DATA);      
+//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); 
 }
 
 static int reveal_mesh_exec(bContext *C, wmOperator *op)
@@ -2747,7 +2748,7 @@ static int reveal_mesh_exec(bContext *C, wmOperator *op)
        
        EM_reveal_mesh(em);
 
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -2797,7 +2798,7 @@ int select_by_number_vertices_exec(bContext *C, wmOperator *op)
                }
        }
 
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        return OPERATOR_FINISHED;
 }
@@ -2923,7 +2924,7 @@ static int select_sharp_edges_exec(bContext *C, wmOperator *op)
 
 //     if (EM_texFaceCheck())
        
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); //TODO is this needed ?
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); //TODO is this needed ?
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -3091,7 +3092,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_GEOM|ND_SELECT, obedit->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -3192,7 +3193,7 @@ static int select_non_manifold_exec(bContext *C, wmOperator *op)
        
        select_non_manifold(em, op);
        
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -3256,7 +3257,7 @@ static int select_inverse_mesh_exec(bContext *C, wmOperator *op)
        
        EM_select_swap(em);
        
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -3299,7 +3300,7 @@ static int toggle_select_all_exec(bContext *C, wmOperator *op)
        
        EM_toggle_select_all(em);
        
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);      
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);     
        BKE_mesh_end_editmesh(obedit->data, em);
 
        return OPERATOR_FINISHED;
@@ -3370,7 +3371,7 @@ static int select_more(bContext *C, wmOperator *op)
 
 //     if (EM_texFaceCheck(em))
 
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -3460,7 +3461,7 @@ static int select_less(bContext *C, wmOperator *op)
        EM_select_less(em);
 
 //     if (EM_texFaceCheck(em))
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -3530,7 +3531,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_GEOM|ND_SELECT, obedit->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
@@ -3581,7 +3582,7 @@ void EM_deselect_by_material(EditMesh *em, int index)
        EM_selectmode_flush(em);
 }
 
-static void mesh_selection_type(ToolSettings *ts, EditMesh *em, int val)
+static void mesh_selection_type(Scene *scene, EditMesh *em, int val)
 {
        if(val>0) {
                if(val==1) { 
@@ -3602,7 +3603,7 @@ static void mesh_selection_type(ToolSettings *ts, 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 */
-               ts->selectmode= em->selectmode;
+               scene->toolsettings->selectmode= em->selectmode;
 //             if (EM_texFaceCheck())
        }
 }
@@ -3616,13 +3617,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(ts, em, RNA_enum_get(op->ptr,"type"));
+       mesh_selection_type(CTX_data_scene(C), em, RNA_enum_get(op->ptr,"type"));
 
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
@@ -3652,6 +3653,7 @@ 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);
@@ -3684,8 +3686,8 @@ static int editmesh_mark_seam(bContext *C, wmOperator *op)
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
        return OPERATOR_FINISHED;
 }
@@ -3709,6 +3711,7 @@ 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);
@@ -3736,8 +3739,8 @@ static int editmesh_mark_sharp(bContext *C, wmOperator *op)
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
        return OPERATOR_FINISHED;
 }
@@ -3967,7 +3970,7 @@ void righthandfaces(EditMesh *em, int select)     /* makes faces righthand turning *
 
        recalc_editnormals(em);
        
-//     DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
 
        waitcursor(0);
 }
@@ -3975,6 +3978,7 @@ 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));
        
@@ -3985,8 +3989,8 @@ static int righthandfaces_exec(bContext *C, wmOperator *op)
        
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); //TODO is this needed ?
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); //TODO is this needed ?
 
        return OPERATOR_FINISHED;       
 }
@@ -4186,7 +4190,7 @@ void editmesh_align_view_to_selected(Object *obedit, EditMesh *em, wmOperator *o
 
 static int smooth_vertex(bContext *C, wmOperator *op)
 {
-       ToolSettings *ts= CTX_data_tool_settings(C);
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        EditVert *eve, *eve_mir = NULL;
@@ -4274,7 +4278,7 @@ static int smooth_vertex(bContext *C, wmOperator *op)
                if(eve->f & SELECT) {
                        if(eve->f1) {
                                
-                               if (ts->editbutflag & B_MESH_X_MIRROR) {
+                               if (scene->toolsettings->editbutflag & B_MESH_X_MIRROR) {
                                        eve_mir= editmesh_get_x_mirror_vert(obedit, em, eve->co);
                                }
                                
@@ -4316,8 +4320,8 @@ static int smooth_vertex(bContext *C, wmOperator *op)
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
        return OPERATOR_FINISHED;
 }
@@ -4350,7 +4354,7 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot)
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 
-       RNA_def_int(ot->srna, "repeat", 1, 1, 100, "Smooth Iterations", "", 1, INT_MAX);
+       RNA_def_int(ot->srna, "repeat", 1, 1, 100, "Number of times to smooth the mesh", "", 1, INT_MAX);
 }
 
 void vertexnoise(Object *obedit, EditMesh *em)
@@ -4394,7 +4398,7 @@ void vertexnoise(Object *obedit, EditMesh *em)
        }
 
        recalc_editnormals(em);
-//     DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
 
 }
 
@@ -4451,23 +4455,23 @@ static void vertices_to_sphere(Scene *scene, View3D *v3d, Object *obedit, EditMe
        }
        
        recalc_editnormals(em);
-//     DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+//     DAG_object_flush_update(scene, obedit, 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_id_flush_update(obedit->data, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        return OPERATOR_FINISHED;       
 }
@@ -4476,8 +4480,7 @@ void MESH_OT_vertices_transform_to_sphere(wmOperatorType *ot)
 {
        /* identifiers */
        ot->name= "Vertices to Sphere";
-       //added "around cursor" to differentiate between "TFM_OT_tosphere()"
-       ot->description= "Move selected vertices outward in a spherical shape around cursor.";
+       ot->description= "Move selected vertices outward in a spherical shape.";
        ot->idname= "MESH_OT_vertices_transform_to_sphere";
        
        /* api callbacks */
@@ -4513,6 +4516,7 @@ 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 +4534,8 @@ static int flip_normals(bContext *C, wmOperator *op)
 
        BKE_mesh_end_editmesh(obedit->data, em);
 
-       DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
-       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
        return OPERATOR_FINISHED;
 }