[Bf-blender-cvs] [19015958984] master: Tool System: use set/add/subtract for all lasso select operators
Campbell Barton
noreply at git.blender.org
Thu Mar 7 13:57:27 CET 2019
Commit: 190159589840547c9b58b8d639a76313cee9478b
Author: Campbell Barton
Date: Thu Mar 7 23:41:32 2019 +1100
Branches: master
https://developer.blender.org/rB190159589840547c9b58b8d639a76313cee9478b
Tool System: use set/add/subtract for all lasso select operators
===================================================================
M release/scripts/presets/keyconfig/keymap_data/blender_default.py
M release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M source/blender/editors/mask/mask_select.c
M source/blender/editors/space_action/action_select.c
M source/blender/editors/space_clip/tracking_select.c
M source/blender/editors/space_graph/graph_select.c
M source/blender/editors/space_node/node_select.c
M source/blender/windowmanager/WM_api.h
M source/blender/windowmanager/intern/wm_operator_props.c
===================================================================
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 3377dea4a97..793488761f9 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -1213,9 +1213,9 @@ def km_mask_editing(params):
("mask.select_box", {"type": 'B', "value": 'PRESS'}, None),
("mask.select_circle", {"type": 'C', "value": 'PRESS'}, None),
("mask.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True, "alt": True},
- {"properties": [("deselect", False)]}),
+ {"properties": [("mode", 'ADD')]}),
("mask.select_lasso", {"type": params.action_tweak, "value": 'ANY', "shift": True, "ctrl": True, "alt": True},
- {"properties": [("deselect", True)]}),
+ {"properties": [("mode", 'SUB')]}),
("mask.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True}, None),
("mask.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True}, None),
("mask.hide_view_clear", {"type": 'H', "value": 'PRESS', "alt": True}, None),
@@ -1357,9 +1357,9 @@ def km_graph_editor(params):
("graph.select_box", {"type": 'B', "value": 'PRESS', "ctrl": True, "alt": True},
{"properties": [("axis_range", True), ("include_handles", True)]}),
("graph.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True},
- {"properties": [("deselect", False)]}),
+ {"properties": [("mode", 'ADD')]}),
("graph.select_lasso", {"type": params.action_tweak, "value": 'ANY', "shift": True, "ctrl": True},
- {"properties": [("deselect", True)]}),
+ {"properties": [("mode", 'SUB')]}),
("graph.select_circle", {"type": 'C', "value": 'PRESS'}, None),
("graph.select_column", {"type": 'K', "value": 'PRESS'},
{"properties": [("mode", 'KEYS')]}),
@@ -1576,9 +1576,9 @@ def km_node_editor(params):
("node.select_box", {"type": params.select_tweak, "value": 'ANY'},
{"properties": [("tweak", True)]}),
("node.select_lasso", {"type": 'EVT_TWEAK_L', "value": 'ANY', "ctrl": True, "alt": True},
- {"properties": [("deselect", False)]}),
+ {"properties": [("mode", 'ADD')]}),
("node.select_lasso", {"type": 'EVT_TWEAK_L', "value": 'ANY', "shift": True, "ctrl": True, "alt": True},
- {"properties": [("deselect", True)]}),
+ {"properties": [("mode", 'SUB')]}),
("node.select_circle", {"type": 'C', "value": 'PRESS'}, None),
("node.link", {"type": 'LEFTMOUSE', "value": 'PRESS'},
{"properties": [("detach", False)]}),
@@ -1877,9 +1877,9 @@ def km_dopesheet(params):
("action.select_box", {"type": 'B', "value": 'PRESS', "alt": True},
{"properties": [("axis_range", True)]}),
("action.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True},
- {"properties": [("deselect", False)]}),
+ {"properties": [("mode", 'ADD')]}),
("action.select_lasso", {"type": params.action_tweak, "value": 'ANY', "shift": True, "ctrl": True},
- {"properties": [("deselect", True)]}),
+ {"properties": [("mode", 'SUB')]}),
("action.select_circle", {"type": 'C', "value": 'PRESS'}, None),
("action.select_column", {"type": 'K', "value": 'PRESS'},
{"properties": [("mode", 'KEYS')]}),
@@ -2574,9 +2574,9 @@ def km_clip_editor(params):
("clip.select_circle", {"type": 'C', "value": 'PRESS'}, None),
op_menu("CLIP_MT_select_grouped", {"type": 'G', "value": 'PRESS', "shift": True}),
("clip.select_lasso", {"type": params.action_tweak, "value": 'ANY', "ctrl": True, "alt": True},
- {"properties": [("deselect", False)]}),
+ {"properties": [("mode", 'ADD')]}),
("clip.select_lasso", {"type": params.action_tweak, "value": 'ANY', "shift": True, "ctrl": True, "alt": True},
- {"properties": [("deselect", True)]}),
+ {"properties": [("mode", 'SUB')]}),
("clip.add_marker_slide", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, None),
("clip.delete_marker", {"type": 'X', "value": 'PRESS', "shift": True}, None),
("clip.delete_marker", {"type": 'DEL', "value": 'PRESS', "shift": True}, None),
@@ -5180,12 +5180,10 @@ def km_node_editor_tool_select_lasso(params):
return (
"Node Tool: Select Lasso",
{"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'},
- {"items": [
- ("node.select_lasso", {"type": params.tool_mouse, "value": 'PRESS'},
- {"properties": [("deselect", False), ("tweak", True)]}),
- ("node.select_lasso", {"type": params.tool_mouse, "value": 'PRESS', "ctrl": True},
- {"properties": [("deselect", True), ("tweak", True)]}),
- ]},
+ {"items": _template_items_tool_select_actions_simple(
+ "node.select_lasso", type=params.tool_mouse, value='PRESS',
+ properties=[("tweak", True)],
+ )},
)
def km_node_editor_tool_select_circle(params):
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 4ba53778dc9..22f44cca81a 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -1351,8 +1351,7 @@ class _defs_node_select:
def lasso():
def draw_settings(context, layout, tool):
props = tool.operator_properties("node.select_lasso")
- layout.prop(props, "deselect")
- pass
+ layout.prop(props, "mode", expand=True)
return dict(
text="Select Lasso",
icon="ops.generic.select_lasso",
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c
index 9bda6f7a92d..34a43946fc6 100644
--- a/source/blender/editors/mask/mask_select.c
+++ b/source/blender/editors/mask/mask_select.c
@@ -474,7 +474,7 @@ void MASK_OT_select_box(wmOperatorType *ot)
WM_operator_properties_select_operation_simple(ot);
}
-static bool do_lasso_select_mask(bContext *C, const int mcords[][2], short moves, bool select, bool extend)
+static bool do_lasso_select_mask(bContext *C, const int mcords[][2], short moves, const eSelectOp sel_op)
{
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
@@ -486,6 +486,12 @@ static bool do_lasso_select_mask(bContext *C, const int mcords[][2], short moves
rcti rect;
bool changed = false;
+ const bool select = (sel_op != SEL_OP_SUB);
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
+ ED_mask_select_toggle_all(mask, SEL_DESELECT);
+ changed = true;
+ }
+
/* get rectangle from operator */
BLI_lasso_boundbox(&rect, mcords, moves);
@@ -507,7 +513,7 @@ static bool do_lasso_select_mask(bContext *C, const int mcords[][2], short moves
/* TODO: handles? */
/* TODO: uw? */
- if (MASKPOINT_ISSEL_ANY(point) && select && extend) {
+ if (MASKPOINT_ISSEL_ANY(point) && select) {
continue;
}
@@ -525,11 +531,6 @@ static bool do_lasso_select_mask(bContext *C, const int mcords[][2], short moves
BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, select);
changed = true;
}
- else if (select && !extend) {
- BKE_mask_point_select_set(point, false);
- BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, false);
- changed = true;
- }
}
}
}
@@ -549,9 +550,8 @@ static int clip_lasso_select_exec(bContext *C, wmOperator *op)
const int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
if (mcords) {
- const bool select = !RNA_boolean_get(op->ptr, "deselect");
- const bool extend = RNA_boolean_get(op->ptr, "extend");
- do_lasso_select_mask(C, mcords, mcords_tot, select, extend);
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ do_lasso_select_mask(C, mcords, mcords_tot, sel_op);
MEM_freeN((void *)mcords);
@@ -578,7 +578,8 @@ void MASK_OT_select_lasso(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_lasso_select(ot);
+ WM_operator_properties_gesture_lasso(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/********************** circle select operator *********************/
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index ed63cb523de..872f889e8b4 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -542,9 +542,6 @@ static int actkeys_lassoselect_exec(bContext *C, wmOperator *op)
rcti rect;
rctf rect_fl;
- short selectmode;
- bool extend;
-
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
@@ -554,15 +551,11 @@ static int actkeys_lassoselect_exec(bContext *C, wmOperator *op)
if (data_lasso.mcords == NULL)
return OPERATOR_CANCELLED;
- /* clear all selection if not extending selection */
- extend = RNA_boolean_get(op->ptr, "extend");
- if (!extend)
+ const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const int selectmode = (sel_op != SEL_OP_SUB) ? SELECT_ADD : SELECT_SUBTRACT;
+ if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
deselect_action_keys(&ac, 1, SELECT_SUBTRACT);
-
- if (!RNA_boolean_get(op->ptr, "deselect"))
- selectmode = SELECT_ADD;
- else
- selectmode = SELECT_SUBTRACT;
+ }
/* get settings from operator */
BLI_lasso_boundbox(&rect, data_lasso.mcords, data_lasso.mcords_tot);
@@ -597,7 +590,8 @@ void ACTION_OT_select_lasso(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- WM_operator_properties_gesture_lasso_select(ot);
+ WM_operator_properties_gesture_lasso(ot);
+ WM_operator_properties_select_operation_simple(ot);
}
/* ------------------- */
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index e25bf22db91..0c0fe60108f 100644
--- a/source/blender/editors/space_clip/tracking_s
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list