Tag object/scene for selection update from operators
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 13 Jun 2018 13:26:59 +0000 (15:26 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 13 Jun 2018 14:07:55 +0000 (16:07 +0200)
Before that depsgraph tagging was done from inside notifier listener in
viewport. This had the following issues:

- If there are no viewports, selection tag was not done. Causing possible
  issues when object becomes visible.

- Required special trickery to detect which data to tag for update.

- Was causing crash when transforming/selecting markers in clip editor.
  This is because selecting marker needed to poke viewport to redraw, since
  selected bundles will be displayed differently in viewport.

27 files changed:
source/blender/editors/animation/anim_markers.c
source/blender/editors/armature/armature_relations.c
source/blender/editors/armature/armature_select.c
source/blender/editors/curve/editcurve.c
source/blender/editors/curve/editcurve_select.c
source/blender/editors/gpencil/gpencil_convert.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/lattice/editlattice_select.c
source/blender/editors/mesh/editface.c
source/blender/editors/mesh/editmesh_loopcut.c
source/blender/editors/mesh/editmesh_select.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/metaball/mball_edit.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_select.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/render/render_shading.c
source/blender/editors/space_clip/clip_intern.h
source/blender/editors/space_outliner/outliner_collections.c
source/blender/editors/space_outliner/outliner_edit.c
source/blender/editors/space_outliner/outliner_select.c
source/blender/editors/space_outliner/outliner_tools.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/uvedit/uvedit_ops.c

index 624c6e9..e957e84 100644 (file)
@@ -76,6 +76,8 @@
 #include "ED_transform.h"
 #include "ED_types.h"
 
+#include "DEG_depsgraph.h"
+
 /* ************* Marker API **************** */
 
 /* helper function for getting the list of markers to work on */
@@ -1196,6 +1198,7 @@ static int ed_marker_select(bContext *C, const wmEvent *event, bool extend, bool
                        }
                }
 
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
        }
 #else
index 338f573..cc149d3 100644 (file)
@@ -403,6 +403,7 @@ int join_armature_exec(bContext *C, wmOperator *op)
        ED_armature_from_edit(bmain, arm);
        ED_armature_edit_free(arm);
 
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
 
        return OPERATOR_FINISHED;
index 95acc8a..cd5a4ce 100644 (file)
@@ -717,6 +717,7 @@ bool ED_armature_edit_select_pick(bContext *C, const int mval[2], bool extend, b
 
                        if (vc.view_layer->basact != basact) {
                                vc.view_layer->basact = basact;
+                               DEG_id_tag_update(&vc.scene->id, DEG_TAG_SELECT_UPDATE);
                                WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, vc.scene);
                        }
                }
index 418d1d3..aa50916 100644 (file)
@@ -2896,7 +2896,7 @@ static int hide_exec(bContext *C, wmOperator *op)
                }
        }
 
-       DEG_id_tag_update(obedit->data, 0);
+       DEG_id_tag_update(obedit->data, DEG_TAG_COPY_ON_WRITE | DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        BKE_curve_nurb_vert_active_validate(obedit->data);
 
@@ -2959,7 +2959,7 @@ static int reveal_exec(bContext *C, wmOperator *op)
                }
        }
 
-       DEG_id_tag_update(obedit->data, 0);
+       DEG_id_tag_update(obedit->data, DEG_TAG_COPY_ON_WRITE | DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
@@ -4413,6 +4413,7 @@ bool ED_curve_editnurb_select_pick(bContext *C, const int mval[2], bool extend,
                        BKE_curve_nurb_active_set(cu, nu);
                }
 
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
                return true;
@@ -5300,6 +5301,7 @@ static int duplicate_exec(bContext *C, wmOperator *op)
 
        if (BLI_listbase_is_empty(&newnurb) == false) {
                BLI_movelisttolist(object_editcurve_get(obedit), &newnurb);
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
        else {
@@ -6148,6 +6150,7 @@ int join_curve_exec(bContext *C, wmOperator *op)
        DEG_relations_tag_update(bmain);   // because we removed object(s), call before editmode!
 
        DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA);
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
 
        WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
 
index 58fb6d5..0fae397 100644 (file)
 
 #include "curve_intern.h"
 
-
 #include "RNA_access.h"
 #include "RNA_define.h"
 
+#include "DEG_depsgraph.h"
 
 /* returns 1 in case (de)selection was successful */
 bool select_beztriple(BezTriple *bezt, bool selstatus, short flag, eVisible_Types hidden)
@@ -404,6 +404,7 @@ static int de_select_first_exec(bContext *C, wmOperator *UNUSED(op))
        Object *obedit = CTX_data_edit_object(C);
 
        selectend_nurb(obedit, FIRST, true, DESELECT);
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        BKE_curve_nurb_vert_active_validate(obedit->data);
 
@@ -430,6 +431,7 @@ static int de_select_last_exec(bContext *C, wmOperator *UNUSED(op))
        Object *obedit = CTX_data_edit_object(C);
 
        selectend_nurb(obedit, LAST, true, DESELECT);
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        BKE_curve_nurb_vert_active_validate(obedit->data);
 
@@ -488,6 +490,7 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
                                break;
                }
 
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
                BKE_curve_nurb_vert_active_validate(cu);
        }
@@ -540,6 +543,7 @@ static int select_linked_exec(bContext *C, wmOperator *UNUSED(op))
                }
 
                if (changed) {
+                       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
                }
        }
@@ -608,6 +612,7 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent
                }
        }
 
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        if (!select) {
                BKE_curve_nurb_vert_active_validate(obedit->data);
@@ -670,6 +675,7 @@ static int select_row_exec(bContext *C, wmOperator *UNUSED(op))
                }
        }
 
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
@@ -698,6 +704,7 @@ static int select_next_exec(bContext *C, wmOperator *UNUSED(op))
        ListBase *editnurb = object_editcurve_get(obedit);
 
        select_adjacent_cp(editnurb, 1, 0, SELECT);
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
@@ -726,6 +733,7 @@ static int select_previous_exec(bContext *C, wmOperator *UNUSED(op))
        ListBase *editnurb = object_editcurve_get(obedit);
 
        select_adjacent_cp(editnurb, -1, 0, SELECT);
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
@@ -814,6 +822,7 @@ static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
                select_adjacent_cp(editnurb, -1, 0, SELECT);
        }
 
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
@@ -1001,6 +1010,7 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
                }
        }
 
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        BKE_curve_nurb_vert_active_validate(obedit->data);
 
@@ -1087,6 +1097,7 @@ static int curve_select_random_exec(bContext *C, wmOperator *op)
                curve_select_random(editnurb, randfac, seed_iter, select);
                BKE_curve_nurb_vert_active_validate(obedit->data);
 
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
 
@@ -1197,6 +1208,7 @@ static int select_nth_exec(bContext *C, wmOperator *op)
                return OPERATOR_CANCELLED;
        }
 
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
@@ -1503,6 +1515,7 @@ static int curve_select_similar_exec(bContext *C, wmOperator *op)
        }
 
        if (changed) {
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
                return OPERATOR_FINISHED;
        }
@@ -1744,6 +1757,7 @@ static int edcu_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE
 
        BKE_curve_nurb_vert_active_set(cu, nu_dst, vert_dst_p);
 
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        return OPERATOR_FINISHED;
 }
index dfaa142..d230133 100644 (file)
@@ -1374,6 +1374,7 @@ static int gp_convert_layer_exec(bContext *C, wmOperator *op)
        }
 
        /* notifiers */
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_OBJECT | NA_ADDED, NULL);
        WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
 
index c2f6dab..2aa9459 100644 (file)
@@ -500,6 +500,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
                                        Main *bmain = CTX_data_main(C);
                                        Scene *scene = CTX_data_scene(C);
                                        ED_object_single_user(bmain, scene, (struct Object *)id);
+                                       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                                        WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
                                        DEG_relations_tag_update(bmain);
                                }
index 2ba1dde..6f1c864 100644 (file)
@@ -59,6 +59,8 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "DEG_depsgraph.h"
+
 #include "lattice_intern.h"
 
 /* -------------------------------------------------------------------- */
@@ -118,6 +120,7 @@ static int lattice_select_random_exec(bContext *C, wmOperator *op)
 
                BLI_rng_free(rng);
 
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
        }
@@ -209,6 +212,7 @@ static int lattice_select_mirror_exec(bContext *C, wmOperator *op)
                }
 
                /* TODO, only notify changes */
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
        MEM_freeN(objects);
@@ -295,6 +299,7 @@ static int lattice_select_more_less(bContext *C, const bool select)
 
        MEM_freeN(selpoints);
 
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        return OPERATOR_FINISHED;
 }
@@ -411,6 +416,7 @@ static int lattice_select_all_exec(bContext *C, wmOperator *op)
                                }
                                break;
                }
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
        MEM_freeN(objects);
@@ -470,6 +476,7 @@ static int lattice_select_ungrouped_exec(bContext *C, wmOperator *op)
                }
        }
 
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
@@ -568,6 +575,7 @@ bool ED_lattice_select_pick(bContext *C, const int mval[2], bool extend, bool de
                        lt->actbp = LT_ACTBP_NONE;
                }
 
+               DEG_id_tag_update(vc.obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data);
 
                return true;
index 7e31b6a..cf4d8eb 100644 (file)
@@ -52,6 +52,8 @@
 
 #include "GPU_draw.h"
 
+#include "DEG_depsgraph.h"
+
 /* own include */
 
 /* copy the face flags, most importantly selection from the mesh to the final derived mesh,
@@ -382,6 +384,7 @@ bool paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], b
        /* image window redraw */
 
        paintface_flush_flags(ob, SELECT);
+       DEG_id_tag_update(ob->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
        ED_region_tag_redraw(CTX_wm_region(C)); // XXX - should redraw all 3D views
        return true;
index 3e787b2..b7d8794 100644 (file)
@@ -400,6 +400,7 @@ static void edgering_select(RingSelOpData *lcd)
                        Object *ob_iter = lcd->objects[ob_index];
                        BMEditMesh *em = BKE_editmesh_from_object(ob_iter);
                        EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+                       DEG_id_tag_update(ob_iter->data, DEG_TAG_SELECT_UPDATE);
                        WM_main_add_notifier(NC_GEOM | ND_SELECT, ob_iter->data);
                }
        }
@@ -496,6 +497,7 @@ static void ringsel_finish(bContext *C, wmOperator *op)
                                BM_select_history_store(em->bm, lcd->eed);
 
                        EDBM_selectmode_flush(lcd->em);
+                       DEG_id_tag_update(lcd->ob->data, DEG_TAG_SELECT_UPDATE);
                        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, lcd->ob->data);
                }
        }
index 634c654..99a95c2 100644 (file)
@@ -1414,6 +1414,7 @@ static int edbm_select_similar_region_exec(bContext *C, wmOperator *op)
        MEM_freeN(group_index);
 
        if (changed) {
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
        else {
@@ -1621,6 +1622,7 @@ static int edbm_loop_multiselect_exec(bContext *C, wmOperator *op)
                MEM_freeN(edarray);
                //      if (EM_texFaceCheck())
 
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
        MEM_freeN(objects);
@@ -1824,6 +1826,7 @@ static bool mouse_mesh_loop(bContext *C, const int mval[2], bool extend, bool de
                }
        }
 
+       DEG_id_tag_update(vc.obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data);
 
        return true;
@@ -1930,6 +1933,7 @@ static int edbm_select_all_exec(bContext *C, wmOperator *op)
                                EDBM_selectmode_flush(em);
                                break;
                }
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
 
@@ -1975,6 +1979,7 @@ static int edbm_faces_select_interior_exec(bContext *C, wmOperator *UNUSED(op))
                        continue;
                }
 
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
        MEM_freeN(objects);
@@ -2032,6 +2037,7 @@ bool EDBM_select_pick(bContext *C, const int mval[2], bool extend, bool deselect
                                Object *ob_iter = objects[ob_index];
                                EDBM_flag_disable_all(BKE_editmesh_from_object(ob_iter), BM_ELEM_SELECT);
                                if (basact->object != ob_iter) {
+                                       DEG_id_tag_update(ob_iter->data, DEG_TAG_SELECT_UPDATE);
                                        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob_iter->data);
                                }
                        }
@@ -2150,8 +2156,10 @@ bool EDBM_select_pick(bContext *C, const int mval[2], bool extend, bool deselect
                 * switch UV layers, vgroups for eg. */
                if (vc.view_layer->basact != basact) {
                        vc.view_layer->basact = basact;
+                       DEG_id_tag_update(&vc.scene->id, DEG_TAG_SELECT_UPDATE);
                        WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, vc.scene);
                }
+               DEG_id_tag_update(vc.obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data);
 
                return true;
@@ -2482,7 +2490,7 @@ bool EDBM_selectmode_toggle(
                        Object *ob_iter = objects[ob_index];
                        BMEditMesh *em_iter = BKE_editmesh_from_object(ob_iter);
                        EDBM_selectmode_set(em_iter);
-                       DEG_id_tag_update(ob_iter->data, DEG_TAG_COPY_ON_WRITE);
+                       DEG_id_tag_update(ob_iter->data, DEG_TAG_COPY_ON_WRITE | DEG_TAG_SELECT_UPDATE);
                        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob_iter->data);
                }
                WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
@@ -2932,6 +2940,7 @@ static int edbm_select_linked_exec(bContext *C, wmOperator *op)
                        select_linked_delimit_end(em);
                }
 
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
        }
@@ -3143,6 +3152,7 @@ static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE
         * index selections isn't very common. */
        RNA_int_set(op->ptr, "index", index);
 
+       DEG_id_tag_update(basact->object->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, basact->object->data);
 
        return OPERATOR_FINISHED;
@@ -3172,6 +3182,7 @@ static int edbm_select_linked_pick_exec(bContext *C, wmOperator *op)
 
        edbm_select_linked_pick_ex(em, ele, sel, delimit);
 
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
@@ -3260,6 +3271,7 @@ static int edbm_select_face_by_sides_exec(bContext *C, wmOperator *op)
 
                EDBM_selectmode_flush(em);
 
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
 
@@ -3357,6 +3369,7 @@ static int edbm_select_loose_exec(bContext *C, wmOperator *op)
 
                EDBM_selectmode_flush(em);
 
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
 
@@ -3420,6 +3433,8 @@ static int edbm_select_mirror_exec(bContext *C, wmOperator *op)
 
                if (tot_mirr_iter) {
                        EDBM_selectmode_flush(em);
+
+                       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
                }
 
@@ -3480,6 +3495,7 @@ static int edbm_select_more_exec(bContext *C, wmOperator *op)
                }
 
                EDBM_select_more(em, use_face_step);
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
 
@@ -3530,6 +3546,7 @@ static int edbm_select_less_exec(bContext *C, wmOperator *op)
                }
 
                EDBM_select_less(em, use_face_step);
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
 
@@ -3855,6 +3872,7 @@ static int edbm_select_sharp_edges_exec(bContext *C, wmOperator *op)
                else {
                        EDBM_selectmode_flush(em);
                }
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
        MEM_freeN(objects);
@@ -3953,6 +3971,7 @@ static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op)
 
                BLI_LINKSTACK_FREE(stack);
 
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
        MEM_freeN(objects);
@@ -4049,6 +4068,7 @@ static int edbm_select_non_manifold_exec(bContext *C, wmOperator *op)
                        }
                }
 
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
                EDBM_selectmode_flush(em);
@@ -4152,6 +4172,7 @@ static int edbm_select_random_exec(bContext *C, wmOperator *op)
                        EDBM_deselect_flush(em);
                }
 
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
 
@@ -4246,6 +4267,7 @@ static int edbm_select_ungrouped_exec(bContext *C, wmOperator *op)
 
                if (changed) {
                        EDBM_selectmode_flush(em);
+                       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
                }
        }
@@ -4418,6 +4440,7 @@ static int edbm_region_to_loop_exec(bContext *C, wmOperator *UNUSED(op))
                        EDBM_selectmode_to_scene(C);
                }
 
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
        MEM_freeN(objects);
@@ -4625,6 +4648,7 @@ static int edbm_loop_to_region_exec(bContext *C, wmOperator *op)
 
                EDBM_selectmode_flush(em);
 
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
        MEM_freeN(objects);
index 146bcc7..6c8de1a 100644 (file)
@@ -593,6 +593,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
 
        DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA);
 
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
 
        return OPERATOR_FINISHED;
@@ -671,6 +672,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
        }
        CTX_DATA_END;
 
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
 
        return OPERATOR_FINISHED;
index 65bf258..aea125c 100644 (file)
@@ -154,6 +154,7 @@ static int mball_select_all_exec(bContext *C, wmOperator *op)
                        break;
        }
 
+       DEG_id_tag_update(&mb->id, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, mb);
 
        return OPERATOR_FINISHED;
@@ -335,6 +336,7 @@ static int mball_select_similar_exec(bContext *C, wmOperator *op)
        }
 
        if (changed) {
+               DEG_id_tag_update(&mb->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, mb);
        }
 
@@ -403,6 +405,7 @@ static int select_random_metaelems_exec(bContext *C, wmOperator *op)
 
                BLI_rng_free(rng);
 
+               DEG_id_tag_update(&mb->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, mb);
        }
        MEM_freeN(objects);
@@ -670,6 +673,7 @@ bool ED_mball_select_pick(bContext *C, const int mval[2], bool extend, bool dese
 
                        mb->lastelem = ml_act;
 
+                       DEG_id_tag_update(&mb->id, DEG_TAG_SELECT_UPDATE);
                        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, mb);
 
                        return true;
index d75d5de..dd358b9 100644 (file)
@@ -931,6 +931,7 @@ static int empty_drop_named_image_invoke(bContext *C, wmOperator *op, const wmEv
        /* if empty under cursor, then set object */
        if (base && base->object->type == OB_EMPTY) {
                ob = base->object;
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
        }
        else {
@@ -1098,6 +1099,7 @@ static int collection_instance_add_exec(bContext *C, wmOperator *op)
                DEG_relations_tag_update(bmain);
                DEG_id_tag_update(&collection->id, 0);
 
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
 
                return OPERATOR_FINISHED;
@@ -1294,6 +1296,7 @@ static int object_delete_exec(bContext *C, wmOperator *op)
 
                        DEG_relations_tag_update(bmain);
 
+                       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                        WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
                        WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
                }
@@ -2018,6 +2021,7 @@ static int convert_exec(bContext *C, wmOperator *op)
        }
 
        DEG_relations_tag_update(bmain);
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene);
        WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
 
@@ -2353,8 +2357,7 @@ static int duplicate_exec(bContext *C, wmOperator *op)
        BKE_main_id_clear_newpoins(bmain);
 
        DEG_relations_tag_update(bmain);
-       /* TODO(sergey): Use proper flag for tagging here. */
-       DEG_id_tag_update(&scene->id, 0);
+       DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE | DEG_TAG_SELECT_UPDATE);
 
        WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
 
@@ -2436,6 +2439,7 @@ static int add_named_exec(bContext *C, wmOperator *op)
        /* TODO(sergey): Only update relations for the current scene. */
        DEG_relations_tag_update(bmain);
 
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
        WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
 
index b7f5928..8effdb2 100644 (file)
@@ -1631,7 +1631,7 @@ static int move_to_collection_exec(bContext *C, wmOperator *op)
                    collection->id.name + 2);
 
        DEG_relations_tag_update(CTX_data_main(C));
-       DEG_id_tag_update(&scene->id, 0);
+       DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE | DEG_TAG_SELECT_UPDATE);
 
        WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene);
        WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
index 31e8685..0ce1294 100644 (file)
@@ -619,6 +619,7 @@ static int object_add_hook_newob_exec(bContext *C, wmOperator *op)
        Object *obedit = CTX_data_edit_object(C);
 
        if (add_hook_object(C, bmain, scene, view_layer, obedit, NULL, OBJECT_ADDHOOK_NEWOB, op->reports)) {
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
                WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obedit);
                return OPERATOR_FINISHED;
@@ -889,6 +890,7 @@ static int object_hook_select_exec(bContext *C, wmOperator *op)
        /* select functionality */
        object_hook_select(ob, hmd);
 
+       DEG_id_tag_update(ob->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
 
        return OPERATOR_FINISHED;
index bac1ba0..ce29125 100644 (file)
@@ -129,6 +129,7 @@ void ED_object_base_activate(bContext *C, Base *base)
        else {
                WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, NULL);
        }
+       DEG_id_tag_update(&CTX_data_scene(C)->id, DEG_TAG_SELECT_UPDATE);
 }
 
 /********************** Selection Operators **********************/
@@ -172,7 +173,9 @@ static int object_select_by_type_exec(bContext *C, wmOperator *op)
        }
        CTX_DATA_END;
 
-       WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
+       Scene *scene = CTX_data_scene(C);
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
+       WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
 
        return OPERATOR_FINISHED;
 }
@@ -365,7 +368,9 @@ void ED_object_select_linked_by_id(bContext *C, ID *id)
        }
 
        if (changed) {
-               WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
+               Scene *scene = CTX_data_scene(C);
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
+               WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
        }
 }
 
@@ -439,6 +444,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
                return OPERATOR_CANCELLED;
 
        if (changed) {
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
                return OPERATOR_FINISHED;
        }
@@ -809,6 +815,7 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
        }
 
        if (changed) {
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
                return OPERATOR_FINISHED;
        }
@@ -878,7 +885,9 @@ static int object_select_all_exec(bContext *C, wmOperator *op)
        }
        CTX_DATA_END;
 
-       WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
+       Scene *scene = CTX_data_scene(C);
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
+       WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
 
        return OPERATOR_FINISHED;
 }
@@ -930,7 +939,9 @@ static int object_select_same_collection_exec(bContext *C, wmOperator *op)
        }
        CTX_DATA_END;
 
-       WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
+       Scene *scene = CTX_data_scene(C);
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
+       WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
 
        return OPERATOR_FINISHED;
 }
@@ -986,6 +997,7 @@ static int object_select_mirror_exec(bContext *C, wmOperator *op)
        CTX_DATA_END;
 
        /* undo? */
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
 
        return OPERATOR_FINISHED;
@@ -1073,7 +1085,9 @@ static int object_select_more_exec(bContext *C, wmOperator *UNUSED(op))
        bool changed = object_select_more_less(C, true);
 
        if (changed) {
-               WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
+               Scene *scene = CTX_data_scene(C);
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
+               WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
                return OPERATOR_FINISHED;
        }
        else {
@@ -1101,7 +1115,9 @@ static int object_select_less_exec(bContext *C, wmOperator *UNUSED(op))
        bool changed = object_select_more_less(C, false);
 
        if (changed) {
-               WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
+               Scene *scene = CTX_data_scene(C);
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
+               WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
                return OPERATOR_FINISHED;
        }
        else {
@@ -1147,7 +1163,9 @@ static int object_select_random_exec(bContext *C, wmOperator *op)
 
        BLI_rng_free(rng);
 
-       WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
+       Scene *scene = CTX_data_scene(C);
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
+       WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
 
        return OPERATOR_FINISHED;
 }
index 8478602..a6f688c 100644 (file)
@@ -2820,6 +2820,7 @@ static int vertex_group_select_exec(bContext *C, wmOperator *UNUSED(op))
                return OPERATOR_CANCELLED;
 
        vgroup_select_verts(ob, 1);
+       DEG_id_tag_update(ob->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
 
        return OPERATOR_FINISHED;
@@ -2845,6 +2846,7 @@ static int vertex_group_deselect_exec(bContext *C, wmOperator *UNUSED(op))
        Object *ob = ED_object_context(C);
 
        vgroup_select_verts(ob, 0);
+       DEG_id_tag_update(ob->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
 
        return OPERATOR_FINISHED;
index 3f32242..a822dab 100644 (file)
@@ -303,6 +303,7 @@ static int material_slot_de_select(bContext *C, bool select)
                }
        }
 
+       DEG_id_tag_update(ob->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
 
        return OPERATOR_FINISHED;
index ab8a7ad..e5c4f56 100644 (file)
@@ -145,6 +145,8 @@ void clip_view_center_to_point(SpaceClip *sc, float x, float y);
 
 void clip_draw_sfra_efra(struct View2D *v2d, struct Scene *scene);
 
+void clip_on_marker_selection_changed(struct bContext *C);
+
 /* tracking_ops.c */
 struct MovieTrackingTrack *tracking_marker_check_slide(struct bContext *C, const struct wmEvent *event,
                                                        int *area_r, int *action_r, int *corner_r);
index 909938a..a700f8e 100644 (file)
@@ -320,7 +320,10 @@ static int collection_objects_select_exec(bContext *C, wmOperator *op)
        }
 
        BKE_layer_collection_objects_select(view_layer, layer_collection, deselect);
-       WM_main_add_notifier(NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
+
+       Scene *scene = CTX_data_scene(C);
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
+       WM_main_add_notifier(NC_SCENE | ND_OB_SELECT, scene);
 
        return OPERATOR_FINISHED;
 }
index 2a694e2..c6288dc 100644 (file)
@@ -63,6 +63,7 @@
 #include "BKE_scene.h"
 #include "BKE_material.h"
 
+#include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
 
 #include "../blenloader/BLO_readfile.h"
@@ -901,6 +902,7 @@ static int outliner_toggle_selected_exec(bContext *C, wmOperator *UNUSED(op))
        else
                outliner_set_flag(&soops->tree, TSE_SELECTED, 1);
 
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
        ED_region_tag_redraw_no_rebuild(ar);
 
@@ -2169,6 +2171,7 @@ static int scene_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 
                DEG_relations_tag_update(bmain);
 
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                WM_main_add_notifier(NC_SCENE | ND_OB_SELECT, scene);
 
                return OPERATOR_FINISHED;
index 36fd37e..f2ba001 100644 (file)
@@ -81,6 +81,7 @@ static void do_outliner_activate_obdata(bContext *C, Scene *scene, ViewLayer *vi
 
        if (obact == NULL) {
                ED_object_base_activate(C, base);
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
                obact = base->object;
                use_all = true;
@@ -104,6 +105,7 @@ static void do_outliner_activate_obdata(bContext *C, Scene *scene, ViewLayer *vi
                        }
                        if (ok) {
                                ED_object_base_select(base, (ob->mode & OB_MODE_EDIT) ? BA_SELECT : BA_DESELECT);
+                               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                                WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
                        }
                }
@@ -118,6 +120,7 @@ static void do_outliner_activate_pose(bContext *C, ViewLayer *view_layer, Base *
        if (obact == NULL) {
                ED_object_base_activate(C, base);
                Scene *scene = CTX_data_scene(C);
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
                obact = base->object;
                use_all = true;
@@ -144,6 +147,7 @@ static void do_outliner_activate_pose(bContext *C, ViewLayer *view_layer, Base *
                                ED_object_base_select(base, (ob->mode & OB_MODE_POSE) ? BA_SELECT : BA_DESELECT);
 
                                Scene *scene = CTX_data_scene(C);
+                               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                                WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL);
                                WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
                        }
@@ -297,6 +301,7 @@ static eOLDrawState tree_element_set_active_object(
 
                if (set != OL_SETSEL_NONE) {
                        ED_object_base_activate(C, base); /* adds notifier */
+                       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                        WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
                }
 
@@ -976,6 +981,7 @@ static void do_outliner_item_activate_tree_element(
                                FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
                        }
 
+                       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                        WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
                }
                else if (OB_DATA_SUPPORT_EDITMODE(te->idcode)) {
@@ -1176,6 +1182,7 @@ static int outliner_border_select_exec(bContext *C, wmOperator *op)
                outliner_item_border_select(scene, &rectf, te, select);
        }
 
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
        ED_region_tag_redraw(ar);
 
index 8a01e5a..f8d9877 100644 (file)
@@ -893,6 +893,7 @@ static void object_delete_hierarchy_cb(
 #endif
        }
 
+       DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
 }
 
@@ -947,6 +948,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
                }
 
                str = "Select Objects";
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
        }
        else if (event == OL_OP_SELECT_HIERARCHY) {
@@ -956,11 +958,13 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
                        WM_window_change_active_scene(bmain, C, win, sce);
                }
                str = "Select Object Hierarchy";
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
        }
        else if (event == OL_OP_DESELECT) {
                outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_deselect_cb);
                str = "Deselect Objects";
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
        }
        else if (event == OL_OP_DELETE) {
@@ -975,6 +979,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
 
                DEG_relations_tag_update(bmain);
                str = "Delete Objects";
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
        }
        else if (event == OL_OP_DELETE_HIERARCHY) {
@@ -985,6 +990,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
 
                DEG_relations_tag_update(bmain);
                str = "Delete Object Hierarchy";
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
        }
        else if (event == OL_OP_REMAP) {
index 964f6f8..3c98bc6 100644 (file)
@@ -820,7 +820,6 @@ static void view3d_main_region_listener(
                                        break;
                                case ND_OB_ACTIVE:
                                case ND_OB_SELECT:
-                                       DEG_id_tag_update((ID *)&scene->id, DEG_TAG_SELECT_UPDATE);
                                        ATTR_FALLTHROUGH;
                                case ND_FRAME:
                                case ND_TRANSFORM:
@@ -875,18 +874,6 @@ static void view3d_main_region_listener(
                                case ND_SELECT:
                                {
                                        WM_manipulatormap_tag_refresh(mmap);
-
-                                       ID *ob_data = wmn->reference;
-                                       if (ob_data == NULL) {
-                                               BLI_assert(wmn->window); // Use `WM_event_add_notifier` instead of `WM_main_add_notifier`
-                                               ViewLayer *view_layer = WM_window_get_active_view_layer(wmn->window);
-                                               ob_data = OBEDIT_FROM_VIEW_LAYER(view_layer)->data;
-                                       }
-                                       if (ob_data) {
-                                               BLI_assert(OB_DATA_SUPPORT_ID(GS(ob_data->name)));
-                                               /* TODO(sergey): Notifiers shouldn't really be doing DEG tags. */
-                                               DEG_id_tag_update(ob_data, DEG_TAG_SELECT_UPDATE);
-                                       }
                                        ATTR_FALLTHROUGH;
                                }
                                case ND_DATA:
index f4e39c7..08c6a6c 100644 (file)
@@ -855,6 +855,7 @@ static void view3d_lasso_select(
                }
                else {
                        do_lasso_select_objects(vc, mcords, moves, extend, select);
+                       DEG_id_tag_update(&vc->scene->id, DEG_TAG_SELECT_UPDATE);
                        WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, vc->scene);
                }
        }
@@ -885,6 +886,7 @@ static void view3d_lasso_select(
                                        break;
                        }
 
+                       DEG_id_tag_update(vc->obedit->data, DEG_TAG_SELECT_UPDATE);
                        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc->obedit->data);
                }
                FOREACH_OBJECT_IN_MODE_END;
@@ -1009,7 +1011,9 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
 
        /* undo? */
        if (changed) {
-               WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
+               Scene *scene = CTX_data_scene(C);
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
+               WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
                return OPERATOR_FINISHED;
        }
        else {
@@ -1562,6 +1566,7 @@ static bool ed_object_select_pick(
 
                                                                retval = true;
 
+                                                               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                                                                WM_event_add_notifier(C, NC_MOVIECLIP | ND_SELECT, track);
                                                                WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
 
@@ -1658,6 +1663,7 @@ static bool ed_object_select_pick(
                        }
                }
 
+               DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
        }
 
@@ -2241,6 +2247,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
 
                MEM_freeN(bases);
 
+               DEG_id_tag_update(&vc->scene->id, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, vc->scene);
        }
        MEM_freeN(vbuffer);
@@ -2276,6 +2283,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
                                        vc.em = BKE_editmesh_from_object(vc.obedit);
                                        ret |= do_mesh_box_select(&vc, &rect, select, extend);
                                        if (ret & OPERATOR_FINISHED) {
+                                               DEG_id_tag_update(vc.obedit->data, DEG_TAG_SELECT_UPDATE);
                                                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data);
                                        }
                                        break;
@@ -2283,24 +2291,28 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
                                case OB_SURF:
                                        ret |= do_nurbs_box_select(&vc, &rect, select, extend);
                                        if (ret & OPERATOR_FINISHED) {
+                                               DEG_id_tag_update(vc.obedit->data, DEG_TAG_SELECT_UPDATE);
                                                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data);
                                        }
                                        break;
                                case OB_MBALL:
                                        ret |= do_meta_box_select(&vc, &rect, select, extend);
                                        if (ret & OPERATOR_FINISHED) {
+                                               DEG_id_tag_update(vc.obedit->data, DEG_TAG_SELECT_UPDATE);
                                                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data);
                                        }
                                        break;
                                case OB_ARMATURE:
                                        ret |= do_armature_box_select(&vc, &rect, select, extend);
                                        if (ret & OPERATOR_FINISHED) {
+                                               DEG_id_tag_update(&vc.obedit->id, DEG_TAG_SELECT_UPDATE);
                                                WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, vc.obedit);
                                        }
                                        break;
                                case OB_LATTICE:
                                        ret |= do_lattice_box_select(&vc, &rect, select, extend);
                                        if (ret & OPERATOR_FINISHED) {
+                                               DEG_id_tag_update(vc.obedit->data, DEG_TAG_SELECT_UPDATE);
                                                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data);
                                        }
                                        break;
@@ -2403,6 +2415,7 @@ static bool ed_wpaint_vertex_select_pick(
                }
 
                paintvert_flush_flags(obact);
+               DEG_id_tag_update(obact->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
                return true;
        }
@@ -3004,14 +3017,17 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
 
                        if (CTX_data_edit_object(C)) {
                                obedit_circle_select(&vc, select, mval, (float)radius);
+                               DEG_id_tag_update(obact->data, DEG_TAG_SELECT_UPDATE);
                                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
                        }
                        else if (BKE_paint_select_face_test(obact)) {
                                paint_facesel_circle_select(&vc, select, mval, (float)radius);
+                               DEG_id_tag_update(obact->data, DEG_TAG_SELECT_UPDATE);
                                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
                        }
                        else if (BKE_paint_select_vert_test(obact)) {
                                paint_vertsel_circle_select(&vc, select, mval, (float)radius);
+                               DEG_id_tag_update(obact->data, DEG_TAG_SELECT_UPDATE);
                                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
                        }
                        else if (obact->mode & OB_MODE_POSE) {
@@ -3028,6 +3044,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
        }
        else {
                if (object_circle_select(&vc, select, mval, (float)radius)) {
+                       DEG_id_tag_update(&vc.scene->id, DEG_TAG_SELECT_UPDATE);
                        WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, vc.scene);
                }
        }
index 45a6ccf..e3d2537 100644 (file)
@@ -1362,7 +1362,7 @@ static int uv_select_more_less(bContext *C, const bool select)
                else {
                        EDBM_select_less(em, true);
                }
-
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
                return OPERATOR_FINISHED;
        }
@@ -1434,6 +1434,7 @@ static int uv_select_more_less(bContext *C, const bool select)
                uv_select_flush_from_tag_loop(sima, scene, obedit, select);
        }
 
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
@@ -2058,6 +2059,7 @@ static int uv_select_all_exec(bContext *C, wmOperator *op)
 
        for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
                Object *obedit = objects[ob_index];
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
 
@@ -2371,7 +2373,7 @@ static int uv_mouse_select_multi(
 #endif
        }
 
-       DEG_id_tag_update(obedit->data, 0);
+       DEG_id_tag_update(obedit->data, DEG_TAG_COPY_ON_WRITE | DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
        return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED;
@@ -2547,7 +2549,7 @@ static int uv_select_linked_internal(bContext *C, wmOperator *op, const wmEvent
 
        for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
                Object *obedit = objects[ob_index];
-               DEG_id_tag_update(obedit->data, 0);
+               DEG_id_tag_update(obedit->data, DEG_TAG_COPY_ON_WRITE | DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
 
@@ -3052,6 +3054,7 @@ static int uv_border_select_exec(bContext *C, wmOperator *op)
                        uv_select_sync_flush(ts, em, select);
 
                        if (ts->uv_flag & UV_SYNC_SELECTION) {
+                               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
                        }
                }
@@ -3181,6 +3184,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
        if (changed) {
                uv_select_sync_flush(ts, em, select);
 
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
        }
 
@@ -3314,6 +3318,7 @@ static bool do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short mo
                        uv_select_sync_flush(scene->toolsettings, em, select);
 
                        if (ts->uv_flag & UV_SYNC_SELECTION) {
+                               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
                        }
                }
@@ -3746,6 +3751,7 @@ static int uv_select_pinned_exec(bContext *C, wmOperator *UNUSED(op))
                }
        }
 
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
@@ -3812,6 +3818,8 @@ static int uv_hide_exec(bContext *C, wmOperator *op)
 
        if (ts->uv_flag & UV_SYNC_SELECTION) {
                EDBM_mesh_hide(em, swap);
+
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
                return OPERATOR_FINISHED;
@@ -3880,6 +3888,8 @@ static int uv_hide_exec(bContext *C, wmOperator *op)
                EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX | SCE_SELECT_EDGE);
 
        BM_select_history_validate(em->bm);
+
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;
@@ -3933,6 +3943,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *op)
        /* call the mesh function if we are in mesh sync sel */
        if (ts->uv_flag & UV_SYNC_SELECTION) {
                EDBM_mesh_reveal(em, select);
+               DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
                WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
                return OPERATOR_FINISHED;
@@ -4022,6 +4033,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *op)
        /* re-select tagged faces */
        BM_mesh_elem_hflag_enable_test(em->bm, BM_FACE, BM_ELEM_SELECT, true, false, BM_ELEM_TAG);
 
+       DEG_id_tag_update(obedit->data, DEG_TAG_SELECT_UPDATE);
        WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
        return OPERATOR_FINISHED;