diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-21 18:29:58 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-23 10:47:13 +0300 |
commit | fec9615ea06c94b5224c14479c31c55c567fb7ee (patch) | |
tree | 3193277e063be03ad7218fecd778735f673686ea /source/blender/editors/mask | |
parent | 1d48fa2206934688a4c1b303279c26b3a8d1a5ec (diff) |
Masks: Properly port to Copy-on-Write concept
Masks were not really covered by Copy-on-Write due to mistake
in the dependency graph. After correcting that mistake a lot
of tools became broken, so majority of the patch is related
on making it so access to evaluated/tessellated masks is done.
When accessing evaluated mask state make sure access to an
evaluated dependency graph is done. This solves possible
access to NULL data on redo.
Fixes T64899: Re-doing new point addition causes crash
Reviewers: brecht
Reviewed By: brecht
Maniphest Tasks: T64899
Differential Revision: https://developer.blender.org/D4918
Diffstat (limited to 'source/blender/editors/mask')
-rw-r--r-- | source/blender/editors/mask/mask_add.c | 66 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_draw.c | 10 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_ops.c | 111 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_select.c | 12 |
4 files changed, 109 insertions, 90 deletions
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c index 3c456f9e2e2..fc85eab6e66 100644 --- a/source/blender/editors/mask/mask_add.c +++ b/source/blender/editors/mask/mask_add.c @@ -29,6 +29,7 @@ #include "BKE_mask.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" @@ -47,7 +48,7 @@ #include "mask_intern.h" /* own include */ bool ED_mask_find_nearest_diff_point(const bContext *C, - struct Mask *mask, + struct Mask *mask_orig, const float normal_co[2], int threshold, bool feather, @@ -63,7 +64,7 @@ bool ED_mask_find_nearest_diff_point(const bContext *C, ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); - MaskLayer *masklay, *point_masklay; + MaskLayer *point_masklay; MaskSpline *point_spline; MaskSplinePoint *point = NULL; float dist_best_sq = FLT_MAX, co[2]; @@ -71,31 +72,36 @@ bool ED_mask_find_nearest_diff_point(const bContext *C, float u = 0.0f; float scalex, scaley; + Depsgraph *depsgraph = CTX_data_evaluated_depsgraph(C); + Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_orig->id); + ED_mask_get_size(sa, &width, &height); ED_mask_pixelspace_factor(sa, ar, &scalex, &scaley); co[0] = normal_co[0] * scalex; co[1] = normal_co[1] * scaley; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { - MaskSpline *spline; - - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + for (MaskLayer *masklay_orig = mask_orig->masklayers.first, + *masklay_eval = mask_eval->masklayers.first; + masklay_orig != NULL; + masklay_orig = masklay_orig->next, masklay_eval = masklay_eval->next) { + if (masklay_orig->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (MaskSpline *spline_orig = masklay_orig->splines.first, + *spline_eval = masklay_eval->splines.first; + spline_orig != NULL; + spline_orig = spline_orig->next, spline_eval = spline_eval->next) { int i; - MaskSplinePoint *cur_point; + MaskSplinePoint *cur_point_eval; - for (i = 0, cur_point = use_deform ? spline->points_deform : spline->points; - i < spline->tot_point; - i++, cur_point++) { - float *diff_points; + for (i = 0, cur_point_eval = use_deform ? spline_eval->points_deform : spline_eval->points; + i < spline_eval->tot_point; + i++, cur_point_eval++) { unsigned int tot_diff_point; - - diff_points = BKE_mask_point_segment_diff( - spline, cur_point, width, height, &tot_diff_point); + float *diff_points = BKE_mask_point_segment_diff( + spline_eval, cur_point_eval, width, height, &tot_diff_point); if (diff_points) { int j, tot_point; @@ -104,7 +110,7 @@ bool ED_mask_find_nearest_diff_point(const bContext *C, if (feather) { feather_points = BKE_mask_point_segment_feather_diff( - spline, cur_point, width, height, &tot_feather_point); + spline_eval, cur_point_eval, width, height, &tot_feather_point); points = feather_points; tot_point = tot_feather_point; @@ -130,19 +136,19 @@ bool ED_mask_find_nearest_diff_point(const bContext *C, sub_v2_v2v2(tangent, &diff_points[2 * j + 2], &diff_points[2 * j]); } - point_masklay = masklay; - point_spline = spline; - point = use_deform ? &spline->points[(cur_point - spline->points_deform)] : - cur_point; + point_masklay = masklay_orig; + point_spline = spline_orig; + point = use_deform ? + &spline_orig->points[(cur_point_eval - spline_eval->points_deform)] : + &spline_orig->points[(cur_point_eval - spline_eval->points)]; dist_best_sq = dist_sq; u = (float)j / tot_point; } } - if (feather_points) { + if (feather_points != NULL) { MEM_freeN(feather_points); } - MEM_freeN(diff_points); } } @@ -580,7 +586,6 @@ static bool add_vertex_new(const bContext *C, Mask *mask, MaskLayer *masklay, co static int add_vertex_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); Mask *mask = CTX_data_edit_mask(C); MaskLayer *masklay; @@ -626,8 +631,7 @@ static int add_vertex_exec(bContext *C, wmOperator *op) BKE_mask_calc_handle_point_auto(spline, point, false); BKE_mask_calc_handle_point_auto(spline, point_other, false); - /* TODO: only update this spline */ - BKE_mask_update_display(mask, CFRA); + DEG_id_tag_update(&mask->id, ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); return OPERATOR_FINISHED; @@ -648,8 +652,7 @@ static int add_vertex_exec(bContext *C, wmOperator *op) } } - /* TODO: only update this spline */ - BKE_mask_update_display(mask, CFRA); + DEG_id_tag_update(&mask->id, ID_RECALC_GEOMETRY); return OPERATOR_FINISHED; } @@ -716,7 +719,6 @@ static int add_feather_vertex_exec(bContext *C, wmOperator *op) if (ED_mask_find_nearest_diff_point( C, mask, co, threshold, true, NULL, true, true, &masklay, &spline, &point, &u, NULL)) { - Scene *scene = CTX_data_scene(C); float w = BKE_mask_point_weight(spline, point, u); float weight_scalar = BKE_mask_point_weight_scalar(spline, point, u); @@ -726,12 +728,10 @@ static int add_feather_vertex_exec(bContext *C, wmOperator *op) BKE_mask_point_add_uw(point, u, w); - BKE_mask_update_display(mask, scene->r.cfra); + DEG_id_tag_update(&mask->id, ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); - DEG_id_tag_update(&mask->id, 0); - return OPERATOR_FINISHED; } @@ -786,7 +786,6 @@ static int create_primitive_from_points( bContext *C, wmOperator *op, const float (*points)[2], int num_points, char handle_type) { ScrArea *sa = CTX_wm_area(C); - Scene *scene = CTX_data_scene(C); Mask *mask; MaskLayer *mask_layer; MaskSpline *new_spline; @@ -848,8 +847,7 @@ static int create_primitive_from_points( } WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); - /* TODO: only update this spline */ - BKE_mask_update_display(mask, CFRA); + DEG_id_tag_update(&mask->id, ID_RECALC_GEOMETRY); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 305e3a328ab..33e89b1a7c5 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -52,6 +52,8 @@ #include "UI_resources.h" #include "UI_view2d.h" +#include "DEG_depsgraph_query.h" + #include "mask_intern.h" /* own include */ static void mask_spline_color_get(MaskLayer *masklay, @@ -672,7 +674,8 @@ static float *mask_rasterize(Mask *mask, const int width, const int height) /* sets up the opengl context. * width, height are to match the values from ED_mask_get_size() */ void ED_mask_draw_region( - Mask *mask, + Depsgraph *depsgraph, + Mask *mask_, ARegion *ar, const char draw_flag, const char draw_type, @@ -690,6 +693,7 @@ void ED_mask_draw_region( const bContext *C) { struct View2D *v2d = &ar->v2d; + Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_->id); /* aspect always scales vertically in movie and image spaces */ const float width = width_i, height = (float)height_i * (aspy / aspx); @@ -735,7 +739,7 @@ void ED_mask_draw_region( if (draw_flag & MASK_DRAWFLAG_OVERLAY) { float red[4] = {1.0f, 0.0f, 0.0f, 0.0f}; - float *buffer = mask_rasterize(mask, width, height); + float *buffer = mask_rasterize(mask_eval, width, height); if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) { /* More blending types could be supported in the future. */ @@ -779,7 +783,7 @@ void ED_mask_draw_region( } /* draw! */ - draw_masklays(C, mask, draw_flag, draw_type, width, height); + draw_masklays(C, mask_eval, draw_flag, draw_type, width, height); if (do_draw_cb) { ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 1f825c0bb31..5a7a84dbbc8 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -31,6 +31,7 @@ #include "BKE_mask.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "DNA_scene_types.h" #include "DNA_mask_types.h" @@ -65,7 +66,7 @@ static void mask_point_scaled_handle(/*const*/ MaskSplinePoint *point, } MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, - Mask *mask, + Mask *mask_orig, const float normal_co[2], const float threshold, MaskLayer **masklay_r, @@ -76,7 +77,6 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); - MaskLayer *masklay; MaskLayer *point_masklay = NULL; MaskSpline *point_spline = NULL; MaskSplinePoint *point = NULL; @@ -86,29 +86,35 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, eMaskWhichHandle which_handle = MASK_WHICH_HANDLE_NONE; int width, height; + Depsgraph *depsgraph = CTX_data_evaluated_depsgraph(C); + Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_orig->id); + ED_mask_get_size(sa, &width, &height); ED_mask_pixelspace_factor(sa, ar, &scalex, &scaley); co[0] = normal_co[0] * scalex; co[1] = normal_co[1] * scaley; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { - MaskSpline *spline; + for (MaskLayer *masklay_orig = mask_orig->masklayers.first, + *masklay_eval = mask_eval->masklayers.first; + masklay_orig != NULL; + masklay_orig = masklay_orig->next, masklay_eval = masklay_eval->next) { - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (masklay_orig->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { - MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); - - int i; + for (MaskSpline *spline_orig = masklay_orig->splines.first, + *spline_eval = masklay_eval->splines.first; + spline_orig != NULL; + spline_orig = spline_orig->next, spline_eval = spline_eval->next) { + MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline_eval); - for (i = 0; i < spline->tot_point; i++) { - MaskSplinePoint *cur_point = &spline->points[i]; - MaskSplinePoint *cur_point_deform = &points_array[i]; + for (int i = 0; i < spline_orig->tot_point; i++) { + MaskSplinePoint *cur_point_orig = &spline_orig->points[i]; + MaskSplinePoint *cur_point_deform_eval = &points_array[i]; eMaskWhichHandle cur_which_handle = MASK_WHICH_HANDLE_NONE; - BezTriple *bezt = &cur_point_deform->bezt; + BezTriple *bezt = &cur_point_deform_eval->bezt; float cur_len_sq, vec[2]; vec[0] = bezt->vec[1][0] * scalex; @@ -117,17 +123,17 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, cur_len_sq = len_squared_v2v2(co, vec); if (cur_len_sq < len_sq) { - point_spline = spline; - point_masklay = masklay; - point = cur_point; + point_spline = spline_orig; + point_masklay = masklay_orig; + point = cur_point_orig; len_sq = cur_len_sq; which_handle = MASK_WHICH_HANDLE_NONE; } - if (BKE_mask_point_handles_mode_get(cur_point_deform) == MASK_HANDLE_MODE_STICK) { + if (BKE_mask_point_handles_mode_get(cur_point_deform_eval) == MASK_HANDLE_MODE_STICK) { float handle[2]; mask_point_scaled_handle( - cur_point_deform, MASK_WHICH_HANDLE_STICK, scalex, scaley, handle); + cur_point_deform_eval, MASK_WHICH_HANDLE_STICK, scalex, scaley, handle); cur_len_sq = len_squared_v2v2(co, handle); cur_which_handle = MASK_WHICH_HANDLE_STICK; } @@ -135,9 +141,9 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, float handle_left[2], handle_right[2]; float len_left_sq, len_right_sq; mask_point_scaled_handle( - cur_point_deform, MASK_WHICH_HANDLE_LEFT, scalex, scaley, handle_left); + cur_point_deform_eval, MASK_WHICH_HANDLE_LEFT, scalex, scaley, handle_left); mask_point_scaled_handle( - cur_point_deform, MASK_WHICH_HANDLE_RIGHT, scalex, scaley, handle_right); + cur_point_deform_eval, MASK_WHICH_HANDLE_RIGHT, scalex, scaley, handle_right); len_left_sq = len_squared_v2v2(co, handle_left); len_right_sq = len_squared_v2v2(co, handle_right); @@ -168,9 +174,9 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, } if (cur_len_sq <= len_sq && cur_which_handle != MASK_WHICH_HANDLE_NONE) { - point_masklay = masklay; - point_spline = spline; - point = cur_point; + point_masklay = masklay_orig; + point_spline = spline_orig; + point = cur_point_orig; len_sq = cur_len_sq; which_handle = cur_which_handle; } @@ -214,7 +220,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, } bool ED_mask_feather_find_nearest(const bContext *C, - Mask *mask, + Mask *mask_orig, const float normal_co[2], const float threshold, MaskLayer **masklay_r, @@ -226,7 +232,7 @@ bool ED_mask_feather_find_nearest(const bContext *C, ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); - MaskLayer *masklay, *point_masklay = NULL; + MaskLayer *point_masklay = NULL; MaskSpline *point_spline = NULL; MaskSplinePoint *point = NULL; MaskSplinePointUW *uw = NULL; @@ -235,32 +241,41 @@ bool ED_mask_feather_find_nearest(const bContext *C, float scalex, scaley; int width, height; + Depsgraph *depsgraph = CTX_data_evaluated_depsgraph(C); + Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_orig->id); + ED_mask_get_size(sa, &width, &height); ED_mask_pixelspace_factor(sa, ar, &scalex, &scaley); co[0] = normal_co[0] * scalex; co[1] = normal_co[1] * scaley; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { - MaskSpline *spline; + for (MaskLayer *masklay_orig = mask_orig->masklayers.first, + *masklay_eval = mask_eval->masklayers.first; + masklay_orig != NULL; + masklay_orig = masklay_orig->next, masklay_eval = masklay_eval->next) { - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (MaskSpline *spline_orig = masklay_orig->splines.first, + *spline_eval = masklay_eval->splines.first; + spline_orig != NULL; + spline_orig = spline_orig->next, spline_eval = spline_eval->next) { // MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); int i, tot_feather_point; float(*feather_points)[2], (*fp)[2]; - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (masklay_orig->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - feather_points = fp = BKE_mask_spline_feather_points(spline, &tot_feather_point); + feather_points = fp = BKE_mask_spline_feather_points(spline_eval, &tot_feather_point); - for (i = 0; i < spline->tot_point; i++) { + for (i = 0; i < spline_orig->tot_point; i++) { int j; - MaskSplinePoint *cur_point = &spline->points[i]; + MaskSplinePoint *cur_point_orig = &spline_orig->points[i]; + MaskSplinePoint *cur_point_eval = &spline_eval->points[i]; - for (j = 0; j <= cur_point->tot_uw; j++) { + for (j = 0; j <= cur_point_eval->tot_uw; j++) { float cur_len_sq, vec[2]; vec[0] = (*fp)[0] * scalex; @@ -273,12 +288,12 @@ bool ED_mask_feather_find_nearest(const bContext *C, uw = NULL; } else { - uw = &cur_point->uw[j - 1]; + uw = &cur_point_eval->uw[j - 1]; } - point_masklay = masklay; - point_spline = spline; - point = cur_point; + point_masklay = masklay_orig; + point_spline = spline_orig; + point = cur_point_orig; len = cur_len_sq; } @@ -1648,7 +1663,6 @@ static void delete_feather_points(MaskSplinePoint *point) static int delete_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene = CTX_data_scene(C); Mask *mask = CTX_data_edit_mask(C); MaskLayer *masklay; bool changed = false; @@ -1743,8 +1757,7 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; } - /* TODO: only update edited splines */ - BKE_mask_update_display(mask, CFRA); + DEG_id_tag_update(&mask->id, ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); @@ -1801,8 +1814,7 @@ static int mask_switch_direction_exec(bContext *C, wmOperator *UNUSED(op)) } if (changed) { - /* TODO: only update this spline */ - BKE_mask_update_display(mask, CFRA); + DEG_id_tag_update(&mask->id, ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); @@ -1867,8 +1879,7 @@ static int mask_normals_make_consistent_exec(bContext *C, wmOperator *UNUSED(op) } if (changed) { - /* TODO: only update this spline */ - BKE_mask_update_display(mask, CFRA); + DEG_id_tag_update(&mask->id, ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); @@ -2094,7 +2105,6 @@ void MASK_OT_hide_view_set(wmOperatorType *ot) static int mask_feather_weight_clear_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene = CTX_data_scene(C); Mask *mask = CTX_data_edit_mask(C); MaskLayer *masklay; bool changed = false; @@ -2121,8 +2131,7 @@ static int mask_feather_weight_clear_exec(bContext *C, wmOperator *UNUSED(op)) } if (changed) { - /* TODO: only update edited splines */ - BKE_mask_update_display(mask, CFRA); + DEG_id_tag_update(&mask->id, ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_MASK | ND_DRAW, mask); DEG_id_tag_update(&mask->id, 0); @@ -2234,7 +2243,6 @@ void MASK_OT_layer_move(wmOperatorType *ot) static int mask_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene = CTX_data_scene(C); Mask *mask = CTX_data_edit_mask(C); MaskLayer *mask_layer; @@ -2324,8 +2332,7 @@ static int mask_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) } } - /* TODO: only update edited splines */ - BKE_mask_update_display(mask, CFRA); + DEG_id_tag_update(&mask->id, ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); @@ -2391,7 +2398,6 @@ static bool paste_splines_poll(bContext *C) static int paste_splines_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene = CTX_data_scene(C); Mask *mask = CTX_data_edit_mask(C); MaskLayer *mask_layer = BKE_mask_layer_active(mask); @@ -2401,8 +2407,7 @@ static int paste_splines_exec(bContext *C, wmOperator *UNUSED(op)) BKE_mask_clipboard_paste_to_layer(CTX_data_main(C), mask_layer); - /* TODO: only update edited splines */ - BKE_mask_update_display(mask, CFRA); + DEG_id_tag_update(&mask->id, ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index a592f39d24b..717ce9fd72e 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -43,6 +43,8 @@ #include "RNA_access.h" #include "RNA_define.h" +#include "DEG_depsgraph.h" + #include "mask_intern.h" /* own include */ /* -------------------------------------------------------------------- */ @@ -223,6 +225,7 @@ static int select_all_exec(bContext *C, wmOperator *op) ED_mask_select_toggle_all(mask, action); ED_mask_select_flush_all(mask); + DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); return OPERATOR_FINISHED; @@ -326,6 +329,7 @@ static int select_exec(bContext *C, wmOperator *op) ED_mask_select_flush_all(mask); + DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); return OPERATOR_FINISHED; @@ -365,6 +369,7 @@ static int select_exec(bContext *C, wmOperator *op) ED_mask_select_flush_all(mask); + DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); return OPERATOR_FINISHED; @@ -374,6 +379,7 @@ static int select_exec(bContext *C, wmOperator *op) ED_mask_select_flush_all(mask); + DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); return OPERATOR_FINISHED; @@ -488,6 +494,7 @@ static int box_select_exec(bContext *C, wmOperator *op) if (changed) { ED_mask_select_flush_all(mask); + DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); return OPERATOR_FINISHED; @@ -592,6 +599,7 @@ static bool do_lasso_select_mask(bContext *C, if (changed) { ED_mask_select_flush_all(mask); + DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); } @@ -719,6 +727,7 @@ static int circle_select_exec(bContext *C, wmOperator *op) if (changed) { ED_mask_select_flush_all(mask); + DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); return OPERATOR_FINISHED; @@ -783,6 +792,7 @@ static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE if (changed) { ED_mask_select_flush_all(mask); + DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); return OPERATOR_FINISHED; @@ -840,6 +850,7 @@ static int mask_select_linked_exec(bContext *C, wmOperator *UNUSED(op)) if (changed) { ED_mask_select_flush_all(mask); + DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); return OPERATOR_FINISHED; @@ -940,6 +951,7 @@ static int mask_select_more_less(bContext *C, bool more) } } + DEG_id_tag_update(&mask->id, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); return OPERATOR_FINISHED; |