diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-26 10:47:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-26 12:25:25 +0300 |
commit | 40f8ddf8297a062968fc6a1523aa210d69c22626 (patch) | |
tree | 27e26dd44f3e8778ad06012d184fcb11ed175c94 /source/blender/editors/sculpt_paint | |
parent | 30fbf905ef8bd587eef43030b81d75b9eb704bec (diff) |
3D View: move deselect all logic into an option
This removes `VIEW3D_OT_select_or_deselect_all`, adding a
deselect_all option to the `VIEW3D_OT_select` operator.
- Add utility functions to simplify de-selecting all.
- Return true from selection functions when they change the selection
to avoid redundant updates.
- Use arrays of bases when passing objects between selection utility
functions since some users require bases.
- Fix logical error in box selection that updated all objects after
the first hit.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_mask.c | 4 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_utils.c | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index 2f9706db636..b88ae861229 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -249,7 +249,7 @@ static void mask_box_select_task_cb( } BKE_pbvh_vertex_iter_end; } -int ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti *rect, bool select) +bool ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti *rect, bool select) { Depsgraph *depsgraph = CTX_data_depsgraph(C); Sculpt *sd = vc->scene->toolsettings->sculpt; @@ -321,7 +321,7 @@ int ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti *r WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); - return OPERATOR_FINISHED; + return true; } typedef struct LassoMaskData { diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 2f7cd3fceba..35401c470cc 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -650,9 +650,11 @@ void PAINT_OT_face_select_linked_pick(wmOperatorType *ot) static int face_select_all_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); - paintface_deselect_all_visible(C, ob, RNA_enum_get(op->ptr, "action"), true); - ED_region_tag_redraw(CTX_wm_region(C)); - return OPERATOR_FINISHED; + if (paintface_deselect_all_visible(C, ob, RNA_enum_get(op->ptr, "action"), true)) { + ED_region_tag_redraw(CTX_wm_region(C)); + return OPERATOR_FINISHED; + } + return OPERATOR_CANCELLED; } |