Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-06-13 16:26:59 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-06-13 17:07:55 +0300
commit9c6522706125794201173207d0caecae0be0b484 (patch)
tree1d779a4262488cede1f5a2d85198aeefdf7d027c /source/blender/editors/curve
parentc1e503e89a7c3b463a1ef9fb5845ab6588e3c9a6 (diff)
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.
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r--source/blender/editors/curve/editcurve.c7
-rw-r--r--source/blender/editors/curve/editcurve_select.c16
2 files changed, 20 insertions, 3 deletions
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;
}