Fix T65032: selection conflicts between motion tracks and masks in clip editor

This commit is contained in:
Brecht Van Lommel 2019-06-04 14:47:29 +02:00
parent 5158896d7d
commit 5916b09670
Notes: blender-bot 2023-02-14 06:42:54 +01:00
Referenced by issue #65032, Selection in Mask mode in Clip Editor does not work correctly
5 changed files with 33 additions and 12 deletions

View File

@ -1177,10 +1177,10 @@ def km_mask_editing(params):
("mask.add_feather_vertex_slide", {"type": params.action_mouse, "value": 'PRESS', "shift": True, "ctrl": True}, None),
("mask.delete", {"type": 'X', "value": 'PRESS'}, None),
("mask.delete", {"type": 'DEL', "value": 'PRESS'}, None),
("mask.select", {"type": params.select_mouse, "value": params.select_mouse_value},
("mask.select", {"type": params.select_mouse, "value": 'PRESS'},
{"properties": [("extend", False), ("deselect", False), ("toggle", False),
("deselect_all", not params.legacy)]}),
("mask.select", {"type": params.select_mouse, "value": params.select_mouse_value, "shift": True},
("mask.select", {"type": params.select_mouse, "value": 'PRESS', "shift": True},
{"properties": [("extend", False), ("deselect", False), ("toggle", True)]}),
*_template_items_select_actions(params, "mask.select_all"),
("mask.select_linked", {"type": 'L', "value": 'PRESS', "ctrl": True}, None),
@ -1201,7 +1201,7 @@ def km_mask_editing(params):
{"properties": [("unselected", False)]}),
("mask.hide_view_set", {"type": 'H', "value": 'PRESS', "shift": True},
{"properties": [("unselected", True)]}),
("clip.select", {"type": params.select_mouse, "value": params.select_mouse_value, "ctrl": True},
("clip.select", {"type": params.select_mouse, "value": 'PRESS', "ctrl": True},
{"properties": [("extend", False)]}),
("mask.cyclic_toggle", {"type": 'C', "value": 'PRESS', "alt": True}, None),
("mask.slide_point", {"type": params.action_mouse, "value": 'PRESS'}, None),

View File

@ -68,6 +68,7 @@ void ED_clip_update_frame(const struct Main *mainp, int cfra);
bool ED_clip_view_selection(const struct bContext *C, struct ARegion *ar, bool fit);
void ED_clip_select_all(struct SpaceClip *sc, int action, bool *r_has_selection);
bool ED_clip_can_select(struct bContext *C);
void ED_clip_point_undistorted_pos(struct SpaceClip *sc, const float co[2], float r_co[2]);
void ED_clip_point_stable_pos(

View File

@ -50,6 +50,8 @@ void ED_mask_point_pos__reverse(
void ED_mask_cursor_location_get(struct ScrArea *sa, float cursor[2]);
bool ED_mask_selected_minmax(const struct bContext *C, float min[2], float max[2]);
void ED_mask_deselect_all(const struct bContext *C);
void ED_operatortypes_mask(void);
void ED_keymap_mask(struct wmKeyConfig *keyconf);
void ED_operatormacros_mask(void);

View File

@ -36,6 +36,7 @@
#include "WM_api.h"
#include "WM_types.h"
#include "ED_clip.h"
#include "ED_screen.h"
#include "ED_select_utils.h"
#include "ED_mask.h" /* own include */
@ -211,6 +212,17 @@ void ED_mask_select_flush_all(Mask *mask)
}
}
void ED_mask_deselect_all(const bContext *C)
{
Mask *mask = CTX_data_edit_mask(C);
if (mask) {
ED_mask_select_toggle_all(mask, SEL_DESELECT);
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);
}
}
/** \} */
/* -------------------------------------------------------------------- */
@ -375,14 +387,11 @@ static int select_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else if (deselect_all) {
ED_mask_select_toggle_all(mask, SEL_DESELECT);
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;
/* For clip editor tracks, leave deselect all to clip editor. */
if (!ED_clip_can_select(C)) {
ED_mask_deselect_all(C);
return OPERATOR_FINISHED;
}
}
}

View File

@ -37,9 +37,10 @@
#include "WM_api.h"
#include "WM_types.h"
#include "ED_clip.h"
#include "ED_mask.h"
#include "ED_screen.h"
#include "ED_select_utils.h"
#include "ED_clip.h"
#include "RNA_access.h"
#include "RNA_define.h"
@ -364,6 +365,8 @@ static int mouse_select(bContext *C, float co[2], const bool extend, const bool
else if (deselect_all) {
ed_tracking_deselect_all_tracks(tracksbase);
ed_tracking_deselect_all_plane_tracks(plane_tracks_base);
/* Mask as well if we are in combined mask / track view. */
ED_mask_deselect_all(C);
}
if (!extend) {
@ -472,6 +475,12 @@ void CLIP_OT_select(wmOperatorType *ot)
100.0f);
}
bool ED_clip_can_select(bContext *C)
{
/* To avoid conflicts with mask select deselect all in empty space. */
return select_poll(C);
}
/********************** box select operator *********************/
static int box_select_exec(bContext *C, wmOperator *op)