Fix #29260: Missing "Extend" parameter for Border Select
Added "Extend" flag to border select operators for editors: - UV Editor - Sequencer - NLA - Info Space - Graph Editor - File Browser - Clip Editor - Action Editor - Channels and markers regions Can be used for custom keymaps.
This commit is contained in:
@@ -1917,7 +1917,7 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
|
||||
bAnimContext ac;
|
||||
rcti rect;
|
||||
short selectmode=0;
|
||||
int gesture_mode;
|
||||
int gesture_mode, extend;
|
||||
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
@@ -1928,8 +1928,13 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
|
||||
rect.ymin= RNA_int_get(op->ptr, "ymin");
|
||||
rect.xmax= RNA_int_get(op->ptr, "xmax");
|
||||
rect.ymax= RNA_int_get(op->ptr, "ymax");
|
||||
|
||||
|
||||
gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
|
||||
extend= RNA_boolean_get(op->ptr, "extend");
|
||||
|
||||
if(!extend)
|
||||
ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, 1, ACHANNEL_SETFLAG_CLEAR);
|
||||
|
||||
if (gesture_mode == GESTURE_MODAL_SELECT)
|
||||
selectmode = ACHANNEL_SETFLAG_ADD;
|
||||
else
|
||||
@@ -1963,7 +1968,7 @@ static void ANIM_OT_channels_select_border(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_border(ot, FALSE);
|
||||
WM_operator_properties_gesture_border(ot, TRUE);
|
||||
}
|
||||
|
||||
/* ******************* Rename Operator ***************************** */
|
||||
|
||||
@@ -1147,6 +1147,7 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
|
||||
int xmax= RNA_int_get(op->ptr, "xmax");
|
||||
int ymin= RNA_int_get(op->ptr, "ymin");
|
||||
int ymax= RNA_int_get(op->ptr, "ymax");
|
||||
int extend= RNA_boolean_get(op->ptr, "extend");
|
||||
|
||||
UI_view2d_region_to_view(v2d, xmin, ymin, &xminf, &yminf);
|
||||
UI_view2d_region_to_view(v2d, xmax, ymax, &xmaxf, &ymaxf);
|
||||
@@ -1166,6 +1167,9 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!extend) {
|
||||
marker->flag &= ~SELECT;
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
|
||||
@@ -1198,7 +1202,7 @@ static void MARKER_OT_select_border(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_border(ot, FALSE);
|
||||
WM_operator_properties_gesture_border(ot, TRUE);
|
||||
}
|
||||
|
||||
/* *********************** (de)select all ***************** */
|
||||
|
||||
@@ -269,11 +269,16 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
|
||||
bAnimContext ac;
|
||||
rcti rect;
|
||||
short mode=0, selectmode=0;
|
||||
int gesture_mode;
|
||||
int gesture_mode, extend;
|
||||
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
/* clear all selection if not extending selection */
|
||||
extend= RNA_boolean_get(op->ptr, "extend");
|
||||
if (!extend)
|
||||
deselect_action_keys(&ac, 1, SELECT_SUBTRACT);
|
||||
|
||||
/* get settings from operator */
|
||||
rect.xmin= RNA_int_get(op->ptr, "xmin");
|
||||
@@ -330,7 +335,7 @@ void ACTION_OT_select_border(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_border(ot, FALSE);
|
||||
WM_operator_properties_gesture_border(ot, TRUE);
|
||||
|
||||
ot->prop= RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
|
||||
}
|
||||
|
||||
@@ -869,7 +869,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
|
||||
MovieTrackingTrack *track;
|
||||
rcti rect;
|
||||
rctf rectf;
|
||||
int change= 0, mode;
|
||||
int change= 0, mode, extend;
|
||||
|
||||
/* get rectangle from operator */
|
||||
rect.xmin= RNA_int_get(op->ptr, "xmin");
|
||||
@@ -881,6 +881,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
|
||||
ED_clip_point_stable_pos(C, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
|
||||
|
||||
mode= RNA_int_get(op->ptr, "gesture_mode");
|
||||
extend= RNA_boolean_get(op->ptr, "extend");
|
||||
|
||||
/* do actual selection */
|
||||
track= clip->tracking.tracks.first;
|
||||
@@ -888,8 +889,13 @@ static int border_select_exec(bContext *C, wmOperator *op)
|
||||
if((track->flag&TRACK_HIDDEN)==0) {
|
||||
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, sc->user.framenr);
|
||||
|
||||
if(MARKER_VISIBLE(sc, marker) && BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) {
|
||||
BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode!=GESTURE_MODAL_SELECT);
|
||||
if(MARKER_VISIBLE(sc, marker)) {
|
||||
if(BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) {
|
||||
BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode!=GESTURE_MODAL_SELECT);
|
||||
}
|
||||
else if(!extend) {
|
||||
BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, 1);
|
||||
}
|
||||
|
||||
change= 1;
|
||||
}
|
||||
@@ -921,10 +927,10 @@ void CLIP_OT_select_border(wmOperatorType *ot)
|
||||
ot->poll= ED_space_clip_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
ot->flag= OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
WM_operator_properties_gesture_border(ot, FALSE);
|
||||
WM_operator_properties_gesture_border(ot, TRUE);
|
||||
}
|
||||
|
||||
/********************** circle select operator *********************/
|
||||
|
||||
@@ -273,13 +273,20 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
rcti rect;
|
||||
FileSelect ret;
|
||||
|
||||
int extend= RNA_boolean_get(op->ptr, "extend");
|
||||
short select= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
|
||||
|
||||
rect.xmin= RNA_int_get(op->ptr, "xmin");
|
||||
rect.ymin= RNA_int_get(op->ptr, "ymin");
|
||||
rect.xmax= RNA_int_get(op->ptr, "xmax");
|
||||
rect.ymax= RNA_int_get(op->ptr, "ymax");
|
||||
|
||||
if(!extend) {
|
||||
SpaceFile *sfile= CTX_wm_space_file(C);
|
||||
|
||||
file_deselect_all(sfile, SELECTED_FILE);
|
||||
}
|
||||
|
||||
BLI_isect_rcti(&(ar->v2d.mask), &rect, &rect);
|
||||
|
||||
ret = file_select(C, &rect, select ? FILE_SEL_ADD : FILE_SEL_REMOVE, 0);
|
||||
@@ -306,7 +313,7 @@ void FILE_OT_select_border(wmOperatorType *ot)
|
||||
ot->cancel= WM_border_select_cancel;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_border(ot, 0);
|
||||
WM_operator_properties_gesture_border(ot, 1);
|
||||
}
|
||||
|
||||
static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
|
||||
@@ -289,11 +289,17 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
|
||||
rcti rect;
|
||||
short mode=0, selectmode=0;
|
||||
short incl_handles;
|
||||
int extend;
|
||||
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
|
||||
/* clear all selection if not extending selection */
|
||||
extend= RNA_boolean_get(op->ptr, "extend");
|
||||
if (!extend)
|
||||
deselect_graph_keys(&ac, 1, SELECT_SUBTRACT, TRUE);
|
||||
|
||||
/* get select mode
|
||||
* - 'gesture_mode' from the operator specifies how to select
|
||||
* - 'include_handles' from the operator specifies whether to include handles in the selection
|
||||
@@ -354,7 +360,7 @@ void GRAPH_OT_select_border(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_border(ot, FALSE);
|
||||
WM_operator_properties_gesture_border(ot, TRUE);
|
||||
|
||||
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");
|
||||
|
||||
@@ -220,6 +220,7 @@ static int borderselect_exec(bContext *C, wmOperator *op)
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
ReportList *reports= CTX_wm_reports(C);
|
||||
int report_mask= info_report_mask(sinfo);
|
||||
int extend= RNA_boolean_get(op->ptr, "extend");
|
||||
Report *report_min, *report_max, *report;
|
||||
|
||||
//View2D *v2d= UI_view2d_fromcontext(C);
|
||||
@@ -244,6 +245,16 @@ static int borderselect_exec(bContext *C, wmOperator *op)
|
||||
UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmax, &rectf.ymax);
|
||||
*/
|
||||
|
||||
if(!extend) {
|
||||
for(report= reports->list.first; report; report= report->next) {
|
||||
|
||||
if((report->type & report_mask)==0)
|
||||
continue;
|
||||
|
||||
report->flag &= ~SELECT;
|
||||
}
|
||||
}
|
||||
|
||||
report_min= info_text_pick(sinfo, ar, reports, rect.ymax);
|
||||
report_max= info_text_pick(sinfo, ar, reports, rect.ymin);
|
||||
|
||||
@@ -308,7 +319,7 @@ void INFO_OT_select_border(wmOperatorType *ot)
|
||||
/* ot->flag= OPTYPE_REGISTER; */
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_border(ot, FALSE);
|
||||
WM_operator_properties_gesture_border(ot, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -282,11 +282,17 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op)
|
||||
bAnimContext ac;
|
||||
rcti rect;
|
||||
short mode=0, selectmode=0;
|
||||
int extend;
|
||||
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
|
||||
/* clear all selection if not extending selection */
|
||||
extend= RNA_boolean_get(op->ptr, "extend");
|
||||
if (!extend)
|
||||
deselect_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_SUBTRACT);
|
||||
|
||||
/* get settings from operator */
|
||||
rect.xmin= RNA_int_get(op->ptr, "xmin");
|
||||
rect.ymin= RNA_int_get(op->ptr, "ymin");
|
||||
@@ -341,7 +347,7 @@ void NLA_OT_select_border(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_border(ot, 0);
|
||||
WM_operator_properties_gesture_border(ot, 1);
|
||||
|
||||
RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
|
||||
}
|
||||
|
||||
@@ -164,6 +164,7 @@ static int node_borderselect_exec(bContext *C, wmOperator *op)
|
||||
rcti rect;
|
||||
rctf rectf;
|
||||
int gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
|
||||
int extend= RNA_boolean_get(op->ptr, "extend");
|
||||
|
||||
rect.xmin= RNA_int_get(op->ptr, "xmin");
|
||||
rect.ymin= RNA_int_get(op->ptr, "ymin");
|
||||
@@ -180,6 +181,9 @@ static int node_borderselect_exec(bContext *C, wmOperator *op)
|
||||
else
|
||||
node->flag &= ~SELECT;
|
||||
}
|
||||
else if(!extend) {
|
||||
node->flag &= ~SELECT;
|
||||
}
|
||||
}
|
||||
|
||||
node_sort(snode->edittree);
|
||||
@@ -228,7 +232,7 @@ void NODE_OT_select_border(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_border(ot, FALSE);
|
||||
WM_operator_properties_gesture_border(ot, TRUE);
|
||||
RNA_def_boolean(ot->srna, "tweak", 0, "Tweak", "Only activate when mouse is not over a node - useful for tweak gesture");
|
||||
}
|
||||
|
||||
|
||||
@@ -827,6 +827,7 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
|
||||
rcti rect;
|
||||
rctf rectf, rq;
|
||||
short selecting = (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
|
||||
int extend = RNA_boolean_get(op->ptr, "extend");
|
||||
int mval[2];
|
||||
|
||||
if(ed==NULL)
|
||||
@@ -852,6 +853,10 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
|
||||
else seq->flag &= ~SEQ_ALLSEL;
|
||||
recurs_sel_seq(seq);
|
||||
}
|
||||
else if(!extend) {
|
||||
seq->flag &= ~SEQ_ALLSEL;
|
||||
recurs_sel_seq(seq);
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
|
||||
@@ -880,7 +885,7 @@ void SEQUENCER_OT_select_border(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
/* rna */
|
||||
WM_operator_properties_gesture_border(ot, FALSE);
|
||||
WM_operator_properties_gesture_border(ot, TRUE);
|
||||
}
|
||||
|
||||
/* ****** Selected Grouped ****** */
|
||||
|
||||
@@ -1490,7 +1490,7 @@ static void UV_OT_stitch(wmOperatorType *ot)
|
||||
|
||||
/* ******************** (de)select all operator **************** */
|
||||
|
||||
static int select_all_exec(bContext *C, wmOperator *op)
|
||||
static void select_all_perform(bContext *C, int action)
|
||||
{
|
||||
Scene *scene;
|
||||
ToolSettings *ts;
|
||||
@@ -1499,7 +1499,6 @@ static int select_all_exec(bContext *C, wmOperator *op)
|
||||
EditFace *efa;
|
||||
Image *ima;
|
||||
MTFace *tf;
|
||||
int action = RNA_enum_get(op->ptr, "action");
|
||||
|
||||
scene= CTX_data_scene(C);
|
||||
ts= CTX_data_tool_settings(C);
|
||||
@@ -1560,6 +1559,15 @@ static int select_all_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int select_all_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
|
||||
int action= RNA_enum_get(op->ptr, "action");
|
||||
|
||||
select_all_perform(C, action);
|
||||
|
||||
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
|
||||
|
||||
@@ -2275,7 +2283,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
|
||||
MTFace *tface;
|
||||
rcti rect;
|
||||
rctf rectf;
|
||||
int change, pinned, select, faces;
|
||||
int change, pinned, select, faces, extend;
|
||||
|
||||
/* get rectangle from operator */
|
||||
rect.xmin= RNA_int_get(op->ptr, "xmin");
|
||||
@@ -2289,6 +2297,10 @@ static int border_select_exec(bContext *C, wmOperator *op)
|
||||
/* figure out what to select/deselect */
|
||||
select= (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
|
||||
pinned= RNA_boolean_get(op->ptr, "pinned");
|
||||
extend= RNA_boolean_get(op->ptr, "extend");
|
||||
|
||||
if(!extend)
|
||||
select_all_perform(C, SEL_DESELECT);
|
||||
|
||||
if(ts->uv_flag & UV_SYNC_SELECTION)
|
||||
faces= (ts->selectmode == SCE_SELECT_FACE);
|
||||
@@ -2411,7 +2423,7 @@ static void UV_OT_select_border(wmOperatorType *ot)
|
||||
/* properties */
|
||||
RNA_def_boolean(ot->srna, "pinned", 0, "Pinned", "Border select pinned UVs only");
|
||||
|
||||
WM_operator_properties_gesture_border(ot, FALSE);
|
||||
WM_operator_properties_gesture_border(ot, TRUE);
|
||||
}
|
||||
|
||||
/* ******************** circle select operator **************** */
|
||||
|
||||
Reference in New Issue
Block a user