Tool System: use set/add/subtract for all box select operators
This commit is contained in:
@@ -5180,9 +5180,11 @@ def km_node_editor_tool_select_box(params):
|
||||
{"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'},
|
||||
{"items": [
|
||||
("node.select_box", {"type": params.tool_tweak, "value": 'ANY'},
|
||||
{"properties": [("tweak", True)]}),
|
||||
{"properties": [("tweak", True)]}),
|
||||
("node.select_box", {"type": params.tool_tweak, "value": 'ANY', "shift": True},
|
||||
{"properties": [("tweak", True), ("mode", 'ADD')]}),
|
||||
("node.select_box", {"type": params.tool_tweak, "value": 'ANY', "ctrl": True},
|
||||
{"properties": [("deselect", True), ("tweak", True)]}),
|
||||
{"properties": [("tweak", True), ("mode", 'SUB')]}),
|
||||
]},
|
||||
)
|
||||
|
||||
|
||||
@@ -1324,7 +1324,7 @@ class _defs_node_select:
|
||||
def box():
|
||||
def draw_settings(context, layout, tool):
|
||||
props = tool.operator_properties("node.select_box")
|
||||
layout.prop(props, "deselect")
|
||||
layout.prop(props, "mode", expand=True)
|
||||
pass
|
||||
return dict(
|
||||
text="Select Box",
|
||||
|
||||
@@ -288,6 +288,28 @@ void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short only_sel)
|
||||
add_marker_to_cfra_elem(lb, marker, only_sel);
|
||||
}
|
||||
|
||||
void ED_markers_deselect_all(ListBase *markers, int action)
|
||||
{
|
||||
if (action == SEL_TOGGLE) {
|
||||
action = ED_markers_get_first_selected(markers) ? SEL_DESELECT : SEL_SELECT;
|
||||
}
|
||||
|
||||
for (TimeMarker *marker = markers->first; marker; marker = marker->next) {
|
||||
if (action == SEL_SELECT) {
|
||||
marker->flag |= SELECT;
|
||||
}
|
||||
else if (action == SEL_DESELECT) {
|
||||
marker->flag &= ~SELECT;
|
||||
}
|
||||
else if (action == SEL_INVERT) {
|
||||
marker->flag ^= SELECT;
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------- */
|
||||
|
||||
/* Get the first selected marker */
|
||||
@@ -1279,9 +1301,6 @@ static int ed_marker_box_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
View2D *v2d = UI_view2d_fromcontext(C);
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
TimeMarker *marker;
|
||||
bool select = !RNA_boolean_get(op->ptr, "deselect");
|
||||
bool extend = RNA_boolean_get(op->ptr, "extend");
|
||||
rctf rect;
|
||||
|
||||
WM_operator_properties_border_to_rctf(op, &rect);
|
||||
@@ -1290,18 +1309,15 @@ static int ed_marker_box_select_exec(bContext *C, wmOperator *op)
|
||||
if (markers == NULL)
|
||||
return 0;
|
||||
|
||||
/* XXX marker context */
|
||||
for (marker = markers->first; marker; marker = marker->next) {
|
||||
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
|
||||
const bool select = (sel_op != SEL_OP_SUB);
|
||||
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
|
||||
ED_markers_deselect_all(markers, SEL_DESELECT);
|
||||
}
|
||||
|
||||
for (TimeMarker *marker = markers->first; marker; marker = marker->next) {
|
||||
if (BLI_rctf_isect_x(&rect, marker->frame)) {
|
||||
if (select) {
|
||||
marker->flag |= SELECT;
|
||||
}
|
||||
else {
|
||||
marker->flag &= ~SELECT;
|
||||
}
|
||||
}
|
||||
else if (!extend) {
|
||||
marker->flag &= ~SELECT;
|
||||
SET_FLAG_FROM_TEST(marker->flag, select, SELECT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1334,8 +1350,9 @@ static void MARKER_OT_select_box(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_box_select(ot);
|
||||
/* properties */
|
||||
WM_operator_properties_gesture_box(ot);
|
||||
WM_operator_properties_select_operation_simple(ot);
|
||||
}
|
||||
|
||||
/* *********************** (de)select all ***************** */
|
||||
@@ -1343,29 +1360,12 @@ static void MARKER_OT_select_box(wmOperatorType *ot)
|
||||
static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
TimeMarker *marker;
|
||||
int action = RNA_enum_get(op->ptr, "action");
|
||||
|
||||
if (markers == NULL)
|
||||
if (markers == NULL) {
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
if (action == SEL_TOGGLE) {
|
||||
action = (ED_markers_get_first_selected(markers) != NULL) ? SEL_DESELECT : SEL_SELECT;
|
||||
}
|
||||
|
||||
for (marker = markers->first; marker; marker = marker->next) {
|
||||
switch (action) {
|
||||
case SEL_SELECT:
|
||||
marker->flag |= SELECT;
|
||||
break;
|
||||
case SEL_DESELECT:
|
||||
marker->flag &= ~SELECT;
|
||||
break;
|
||||
case SEL_INVERT:
|
||||
marker->flag ^= SELECT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int action = RNA_enum_get(op->ptr, "action");
|
||||
ED_markers_deselect_all(markers, action);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
|
||||
|
||||
@@ -1173,9 +1173,9 @@ void GPENCIL_OT_select_box(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_select_operation(ot);
|
||||
/* properties */
|
||||
WM_operator_properties_gesture_box(ot);
|
||||
WM_operator_properties_select_operation(ot);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -56,6 +56,8 @@ void ED_markers_get_minmax(ListBase *markers, short sel, float *first, float *la
|
||||
|
||||
void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short sel);
|
||||
|
||||
void ED_markers_deselect_all(ListBase *markers, int action);
|
||||
|
||||
struct TimeMarker *ED_markers_get_first_selected(ListBase *markers);
|
||||
|
||||
/* Operators ------------------------------ */
|
||||
|
||||
@@ -402,8 +402,13 @@ static int box_select_exec(bContext *C, wmOperator *op)
|
||||
rcti rect;
|
||||
rctf rectf;
|
||||
bool changed = false;
|
||||
const bool select = !RNA_boolean_get(op->ptr, "deselect");
|
||||
const bool extend = RNA_boolean_get(op->ptr, "extend");
|
||||
|
||||
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
|
||||
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 */
|
||||
WM_operator_properties_border_to_rcti(op, &rect);
|
||||
@@ -428,17 +433,11 @@ static int box_select_exec(bContext *C, wmOperator *op)
|
||||
|
||||
/* TODO: handles? */
|
||||
/* TODO: uw? */
|
||||
|
||||
if (BLI_rctf_isect_pt_v(&rectf, point_deform->bezt.vec[1])) {
|
||||
BKE_mask_point_select_set(point, select);
|
||||
BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, select);
|
||||
changed = true;
|
||||
}
|
||||
else if (!extend) {
|
||||
BKE_mask_point_select_set(point, false);
|
||||
BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, false);
|
||||
}
|
||||
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -471,7 +470,8 @@ void MASK_OT_select_box(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
WM_operator_properties_gesture_box_select(ot);
|
||||
WM_operator_properties_gesture_box(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)
|
||||
|
||||
@@ -333,29 +333,22 @@ static int actkeys_box_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
bAnimContext ac;
|
||||
rcti rect;
|
||||
short mode = 0, selectmode = 0;
|
||||
const bool select = !RNA_boolean_get(op->ptr, "deselect");
|
||||
const bool extend = RNA_boolean_get(op->ptr, "extend");
|
||||
short mode = 0;
|
||||
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
/* clear all selection if not extending selection */
|
||||
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);
|
||||
}
|
||||
|
||||
/* get settings from operator */
|
||||
WM_operator_properties_border_to_rcti(op, &rect);
|
||||
|
||||
if (select) {
|
||||
selectmode = SELECT_ADD;
|
||||
}
|
||||
else {
|
||||
selectmode = SELECT_SUBTRACT;
|
||||
}
|
||||
|
||||
/* selection 'mode' depends on whether box_select region only matters on one axis */
|
||||
if (RNA_boolean_get(op->ptr, "axis_range")) {
|
||||
/* mode depends on which axis of the range is larger to determine which axis to use
|
||||
@@ -399,9 +392,11 @@ void ACTION_OT_select_box(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_box_select(ot);
|
||||
|
||||
ot->prop = RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
|
||||
|
||||
/* properties */
|
||||
WM_operator_properties_gesture_box(ot);
|
||||
WM_operator_properties_select_operation_simple(ot);
|
||||
}
|
||||
|
||||
/* ******************** Region Select Operators ***************************** */
|
||||
|
||||
@@ -443,8 +443,12 @@ static int box_select_exec(bContext *C, wmOperator *op)
|
||||
ED_clip_point_stable_pos(sc, ar, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
|
||||
ED_clip_point_stable_pos(sc, ar, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
|
||||
|
||||
const bool select = !RNA_boolean_get(op->ptr, "deselect");
|
||||
const bool extend = RNA_boolean_get(op->ptr, "extend");
|
||||
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
|
||||
const bool select = (sel_op != SEL_OP_SUB);
|
||||
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
|
||||
ED_clip_select_all(sc, SEL_DESELECT, NULL);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
/* do actual selection */
|
||||
track = tracksbase->first;
|
||||
@@ -461,10 +465,6 @@ static int box_select_exec(bContext *C, wmOperator *op)
|
||||
BKE_tracking_track_flag_clear(track, TRACK_AREA_ALL, SELECT);
|
||||
}
|
||||
}
|
||||
else if (!extend) {
|
||||
BKE_tracking_track_flag_clear(track, TRACK_AREA_ALL, SELECT);
|
||||
}
|
||||
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
@@ -490,11 +490,7 @@ static int box_select_exec(bContext *C, wmOperator *op)
|
||||
plane_track->flag &= ~SELECT;
|
||||
}
|
||||
}
|
||||
else if (!extend) {
|
||||
plane_track->flag &= ~SELECT;
|
||||
}
|
||||
}
|
||||
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
@@ -528,7 +524,8 @@ void CLIP_OT_select_box(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
WM_operator_properties_gesture_box_select(ot);
|
||||
WM_operator_properties_gesture_box(ot);
|
||||
WM_operator_properties_select_operation_simple(ot);
|
||||
}
|
||||
|
||||
/********************** lasso select operator *********************/
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
#include "ED_screen.h"
|
||||
#include "ED_fileselect.h"
|
||||
#include "ED_select_utils.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
|
||||
@@ -424,12 +425,12 @@ static int file_box_select_exec(bContext *C, wmOperator *op)
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
rcti rect;
|
||||
FileSelect ret;
|
||||
const bool select = !RNA_boolean_get(op->ptr, "deselect");
|
||||
const bool extend = RNA_boolean_get(op->ptr, "extend");
|
||||
|
||||
WM_operator_properties_border_to_rcti(op, &rect);
|
||||
|
||||
if (!extend) {
|
||||
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
|
||||
const bool select = (sel_op != SEL_OP_SUB);
|
||||
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
|
||||
file_deselect_all(sfile, FILE_SEL_SELECTED);
|
||||
}
|
||||
|
||||
@@ -465,7 +466,8 @@ void FILE_OT_select_box(wmOperatorType *ot)
|
||||
ot->cancel = WM_gesture_box_cancel;
|
||||
|
||||
/* properties */
|
||||
WM_operator_properties_gesture_box_select(ot);
|
||||
WM_operator_properties_gesture_box(ot);
|
||||
WM_operator_properties_select_operation_simple(ot);
|
||||
}
|
||||
|
||||
static int file_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
|
||||
@@ -339,31 +339,20 @@ static int graphkeys_box_select_exec(bContext *C, wmOperator *op)
|
||||
bAnimContext ac;
|
||||
rcti rect;
|
||||
rctf rect_fl;
|
||||
short mode = 0, selectmode = 0;
|
||||
bool incl_handles;
|
||||
const bool select = !RNA_boolean_get(op->ptr, "deselect");
|
||||
const bool extend = RNA_boolean_get(op->ptr, "extend");
|
||||
short mode = 0;
|
||||
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
/* clear all selection if not extending selection */
|
||||
|
||||
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_graph_keys(&ac, 1, SELECT_SUBTRACT, true);
|
||||
|
||||
/* get select mode
|
||||
* - 'include_handles' from the operator specifies whether to include handles in the selection
|
||||
*/
|
||||
if (select) {
|
||||
selectmode = SELECT_ADD;
|
||||
}
|
||||
else {
|
||||
selectmode = SELECT_SUBTRACT;
|
||||
}
|
||||
|
||||
incl_handles = RNA_boolean_get(op->ptr, "include_handles");
|
||||
/* 'include_handles' from the operator specifies whether to include handles in the selection. */
|
||||
const bool incl_handles = RNA_boolean_get(op->ptr, "include_handles");
|
||||
|
||||
/* get settings from operator */
|
||||
WM_operator_properties_border_to_rcti(op, &rect);
|
||||
@@ -412,11 +401,12 @@ void GRAPH_OT_select_box(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_box_select(ot);
|
||||
|
||||
/* properties */
|
||||
ot->prop = RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
|
||||
RNA_def_boolean(ot->srna, "include_handles", 0, "Include Handles", "Are handles tested individually against the selection criteria");
|
||||
|
||||
WM_operator_properties_gesture_box(ot);
|
||||
WM_operator_properties_select_operation_simple(ot);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -217,25 +217,18 @@ static int box_select_exec(bContext *C, wmOperator *op)
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
ReportList *reports = CTX_wm_reports(C);
|
||||
int report_mask = info_report_mask(sinfo);
|
||||
const bool extend = RNA_boolean_get(op->ptr, "extend");
|
||||
Report *report_min, *report_max, *report;
|
||||
|
||||
//View2D *v2d = UI_view2d_fromcontext(C);
|
||||
|
||||
|
||||
Report *report_min, *report_max;
|
||||
rcti rect;
|
||||
//rctf rectf, rq;
|
||||
const bool select = !RNA_boolean_get(op->ptr, "deselect");
|
||||
//int mval[2];
|
||||
|
||||
WM_operator_properties_border_to_rcti(op, &rect);
|
||||
|
||||
if (!extend) {
|
||||
for (report = reports->list.first; report; report = report->next) {
|
||||
|
||||
if ((report->type & report_mask) == 0)
|
||||
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
|
||||
const int select = (sel_op != SEL_OP_SUB);
|
||||
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
|
||||
for (Report *report = reports->list.first; report; report = report->next) {
|
||||
if ((report->type & report_mask) == 0) {
|
||||
continue;
|
||||
|
||||
}
|
||||
report->flag &= ~SELECT;
|
||||
}
|
||||
}
|
||||
@@ -246,7 +239,7 @@ static int box_select_exec(bContext *C, wmOperator *op)
|
||||
/* get the first report if none found */
|
||||
if (report_min == NULL) {
|
||||
// printf("find_min\n");
|
||||
for (report = reports->list.first; report; report = report->next) {
|
||||
for (Report *report = reports->list.first; report; report = report->next) {
|
||||
if (report->type & report_mask) {
|
||||
report_min = report;
|
||||
break;
|
||||
@@ -256,7 +249,7 @@ static int box_select_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if (report_max == NULL) {
|
||||
// printf("find_max\n");
|
||||
for (report = reports->list.last; report; report = report->prev) {
|
||||
for (Report *report = reports->list.last; report; report = report->prev) {
|
||||
if (report->type & report_mask) {
|
||||
report_max = report;
|
||||
break;
|
||||
@@ -264,18 +257,15 @@ static int box_select_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
|
||||
if (report_min == NULL || report_max == NULL)
|
||||
if (report_min == NULL || report_max == NULL) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
for (report = report_min; (report != report_max->next); report = report->next) {
|
||||
|
||||
if ((report->type & report_mask) == 0)
|
||||
for (Report *report = report_min; (report != report_max->next); report = report->next) {
|
||||
if ((report->type & report_mask) == 0) {
|
||||
continue;
|
||||
|
||||
if (select)
|
||||
report->flag |= SELECT;
|
||||
else
|
||||
report->flag &= ~SELECT;
|
||||
}
|
||||
SET_FLAG_FROM_TEST(report->flag, select, SELECT);
|
||||
}
|
||||
|
||||
ED_area_tag_redraw(CTX_wm_area(C));
|
||||
@@ -303,12 +293,11 @@ void INFO_OT_select_box(wmOperatorType *ot)
|
||||
/* flags */
|
||||
/* ot->flag = OPTYPE_REGISTER; */
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_box_select(ot);
|
||||
/* properties */
|
||||
WM_operator_properties_gesture_box(ot);
|
||||
WM_operator_properties_select_operation_simple(ot);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int report_delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
SpaceInfo *sinfo = CTX_wm_space_info(C);
|
||||
|
||||
@@ -284,29 +284,21 @@ static int nlaedit_box_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
bAnimContext ac;
|
||||
rcti rect;
|
||||
short mode = 0, selectmode = 0;
|
||||
const bool select = !RNA_boolean_get(op->ptr, "deselect");
|
||||
const bool extend = RNA_boolean_get(op->ptr, "extend");
|
||||
short mode = 0;
|
||||
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
/* clear all selection if not extending selection */
|
||||
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_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_SUBTRACT);
|
||||
}
|
||||
|
||||
/* get settings from operator */
|
||||
WM_operator_properties_border_to_rcti(op, &rect);
|
||||
|
||||
if (select) {
|
||||
selectmode = SELECT_ADD;
|
||||
}
|
||||
else {
|
||||
selectmode = SELECT_SUBTRACT;
|
||||
}
|
||||
|
||||
/* selection 'mode' depends on whether box_select region only matters on one axis */
|
||||
if (RNA_boolean_get(op->ptr, "axis_range")) {
|
||||
/* mode depends on which axis of the range is larger to determine which axis to use
|
||||
@@ -349,10 +341,11 @@ void NLA_OT_select_box(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_box_select(ot);
|
||||
|
||||
/* properties */
|
||||
RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
|
||||
|
||||
WM_operator_properties_gesture_box(ot);
|
||||
WM_operator_properties_select_operation_simple(ot);
|
||||
}
|
||||
|
||||
/* ******************** Select Left/Right Operator ************************* */
|
||||
|
||||
@@ -540,15 +540,18 @@ static int node_box_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
bNode *node;
|
||||
rctf rectf;
|
||||
const bool select = !RNA_boolean_get(op->ptr, "deselect");
|
||||
const bool extend = RNA_boolean_get(op->ptr, "extend");
|
||||
|
||||
WM_operator_properties_border_to_rctf(op, &rectf);
|
||||
UI_view2d_region_to_view_rctf(&ar->v2d, &rectf, &rectf);
|
||||
|
||||
for (node = snode->edittree->nodes.first; node; node = node->next) {
|
||||
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
|
||||
const bool select = (sel_op != SEL_OP_SUB);
|
||||
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
|
||||
ED_node_select_all(&snode->edittree->nodes, SEL_DESELECT);
|
||||
}
|
||||
|
||||
for (bNode *node = snode->edittree->nodes.first; node; node = node->next) {
|
||||
bool is_inside;
|
||||
if (node->type == NODE_FRAME) {
|
||||
is_inside = BLI_rctf_inside_rctf(&rectf, &node->totr);
|
||||
@@ -560,9 +563,6 @@ static int node_box_select_exec(bContext *C, wmOperator *op)
|
||||
if (is_inside) {
|
||||
nodeSetSelected(node, select);
|
||||
}
|
||||
else if (!extend) {
|
||||
nodeSetSelected(node, false);
|
||||
}
|
||||
}
|
||||
|
||||
ED_node_sort(snode->edittree);
|
||||
@@ -601,9 +601,11 @@ void NODE_OT_select_box(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_box_select(ot);
|
||||
/* properties */
|
||||
RNA_def_boolean(ot->srna, "tweak", 0, "Tweak", "Only activate when mouse is not over a node - useful for tweak gesture");
|
||||
|
||||
WM_operator_properties_gesture_box(ot);
|
||||
WM_operator_properties_select_operation_simple(ot);
|
||||
}
|
||||
|
||||
/* ****** Circle Select ****** */
|
||||
|
||||
@@ -1262,14 +1262,18 @@ static int outliner_box_select_exec(bContext *C, wmOperator *op)
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
SpaceOutliner *soops = CTX_wm_space_outliner(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
TreeElement *te;
|
||||
rctf rectf;
|
||||
bool select = !RNA_boolean_get(op->ptr, "deselect");
|
||||
|
||||
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
|
||||
const bool select = (sel_op != SEL_OP_SUB);
|
||||
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
|
||||
outliner_flag_set(&soops->tree, TSE_SELECTED, 0);
|
||||
}
|
||||
|
||||
WM_operator_properties_border_to_rctf(op, &rectf);
|
||||
UI_view2d_region_to_view_rctf(&ar->v2d, &rectf, &rectf);
|
||||
|
||||
for (te = soops->tree.first; te; te = te->next) {
|
||||
for (TreeElement *te = soops->tree.first; te; te = te->next) {
|
||||
outliner_item_box_select(soops, scene, &rectf, te, select);
|
||||
}
|
||||
|
||||
@@ -1298,8 +1302,9 @@ void OUTLINER_OT_select_box(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_box_ex(ot, true, false);
|
||||
/* properties */
|
||||
WM_operator_properties_gesture_box(ot);
|
||||
WM_operator_properties_select_operation_simple(ot);
|
||||
}
|
||||
|
||||
/* ****************************************************** */
|
||||
|
||||
@@ -881,29 +881,27 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Editing *ed = BKE_sequencer_editing_get(scene, false);
|
||||
if (ed == NULL) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
View2D *v2d = UI_view2d_fromcontext(C);
|
||||
|
||||
Sequence *seq;
|
||||
rctf rectf, rq;
|
||||
const bool select = !RNA_boolean_get(op->ptr, "deselect");
|
||||
const bool extend = RNA_boolean_get(op->ptr, "extend");
|
||||
|
||||
if (ed == NULL)
|
||||
return OPERATOR_CANCELLED;
|
||||
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
|
||||
const bool select = (sel_op != SEL_OP_SUB);
|
||||
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
|
||||
ED_sequencer_deselect_all(scene);
|
||||
}
|
||||
|
||||
rctf rectf;
|
||||
WM_operator_properties_border_to_rctf(op, &rectf);
|
||||
UI_view2d_region_to_view_rctf(v2d, &rectf, &rectf);
|
||||
|
||||
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
||||
for (Sequence *seq = ed->seqbasep->first; seq; seq = seq->next) {
|
||||
rctf rq;
|
||||
seq_rectf(seq, &rq);
|
||||
|
||||
if (BLI_rctf_isect(&rq, &rectf, NULL)) {
|
||||
if (select) seq->flag |= SELECT;
|
||||
else seq->flag &= ~SEQ_ALLSEL;
|
||||
recurs_sel_seq(seq);
|
||||
}
|
||||
else if (!extend) {
|
||||
seq->flag &= ~SEQ_ALLSEL;
|
||||
SET_FLAG_FROM_TEST(seq->flag, select, SELECT);
|
||||
recurs_sel_seq(seq);
|
||||
}
|
||||
}
|
||||
@@ -933,8 +931,9 @@ void SEQUENCER_OT_select_box(wmOperatorType *ot)
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_box_select(ot);
|
||||
/* properties */
|
||||
WM_operator_properties_gesture_box(ot);
|
||||
WM_operator_properties_select_operation_simple(ot);
|
||||
}
|
||||
|
||||
/* ****** Selected Grouped ****** */
|
||||
|
||||
Reference in New Issue
Block a user