[Bf-blender-cvs] [9c652270612] blender2.8: Tag object/scene for selection update from operators

Sergey Sharybin noreply at git.blender.org
Wed Jun 13 16:08:02 CEST 2018


Commit: 9c6522706125794201173207d0caecae0be0b484
Author: Sergey Sharybin
Date:   Wed Jun 13 15:26:59 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB9c6522706125794201173207d0caecae0be0b484

Tag object/scene for selection update from operators

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.

===================================================================

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

===================================================================

diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 624c6e9f5de..e957e84857a 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -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
diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c
index 338f573dfd5..cc149d3e42f 100644
--- a/source/blender/editors/armature/armature_relations.c
+++ b/source/blender/editors/armature/armature_relations.c
@@ -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;
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index 95acc8ab6ba..cd5a4ced26f 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -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);
 			}
 		}
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 418d1d3400c..aa50916f5e0 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -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);
 
diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c
index 58fb6d50575..0fae39776a9 100644
--- a/source/blender/editors/curve/editcurve_select.c
+++ b/source/blender/editors/curve/editcurve_select.c
@@ -55,10 +55,10 @@
 
 #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;
 }
diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c
index dfaa1420d68..d2301337c0e 100644
--- a/source/blender/editors/gpencil/gpencil_convert.c
+++ b/source/blender/editors/gpencil/gpencil_convert.c
@@ -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);
 
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index c2f6dab5c7b..2aa94591e55 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -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);
 				}
diff --git a/source/blender/editors/lattice/editlattice_select.c b/source/blender/editors/lattice/editlattice_select.c
index 2ba1dde243b..6f1c864130d 100644
--- a/source/blender/editors/lattice/editlattice_select.c
+++ b/source/blender/editors/lattice/editlattice_select.c
@@ -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(r

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list