From 5916b09670b861117b9c87778c0ddc8bcf0a2c35 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 4 Jun 2019 14:47:29 +0200 Subject: Fix T65032: selection conflicts between motion tracks and masks in clip editor --- source/blender/editors/include/ED_clip.h | 1 + source/blender/editors/include/ED_mask.h | 2 ++ source/blender/editors/mask/mask_select.c | 25 +++++++++++++++------- .../blender/editors/space_clip/tracking_select.c | 11 +++++++++- 4 files changed, 30 insertions(+), 9 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h index 1d9e99eeaf9..7cee5a358f4 100644 --- a/source/blender/editors/include/ED_clip.h +++ b/source/blender/editors/include/ED_clip.h @@ -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( diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h index 3322cf0a863..df4349a9063 100644 --- a/source/blender/editors/include/ED_mask.h +++ b/source/blender/editors/include/ED_mask.h @@ -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); diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index 717ce9fd72e..2b3bd1b72c9 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -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; + } } } diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c index 2b70aec02bb..4532b61f291 100644 --- a/source/blender/editors/space_clip/tracking_select.c +++ b/source/blender/editors/space_clip/tracking_select.c @@ -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) -- cgit v1.2.3