Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_clip/tracking_select.c
| Show First 20 Lines • Show All 298 Lines • ▼ Show 20 Lines | static int mouse_select(bContext *C, const float co[2], const bool extend, const bool deselect_all) | ||||
| MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking); | MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking); | ||||
| MovieTrackingTrack *track; | MovieTrackingTrack *track; | ||||
| MovieTrackingPlaneTrack *plane_track; | MovieTrackingPlaneTrack *plane_track; | ||||
| float distance_to_track, distance_to_plane_track; | float distance_to_track, distance_to_plane_track; | ||||
| track = find_nearest_track(sc, tracksbase, co, &distance_to_track); | track = find_nearest_track(sc, tracksbase, co, &distance_to_track); | ||||
| plane_track = find_nearest_plane_track(sc, plane_tracks_base, co, &distance_to_plane_track); | plane_track = find_nearest_plane_track(sc, plane_tracks_base, co, &distance_to_plane_track); | ||||
| ClipViewLockState lock_state; | |||||
| ED_clip_view_lock_state_store(C, &lock_state); | |||||
| /* Do not select beyond some reasonable distance, that is useless and | /* Do not select beyond some reasonable distance, that is useless and | ||||
| * prevents the 'deselect on nothing' behavior. */ | * prevents the 'deselect on nothing' behavior. */ | ||||
| if (distance_to_track > 0.05f) { | if (distance_to_track > 0.05f) { | ||||
| track = NULL; | track = NULL; | ||||
| } | } | ||||
| if (distance_to_plane_track > 0.05f) { | if (distance_to_plane_track > 0.05f) { | ||||
| plane_track = NULL; | plane_track = NULL; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | static int mouse_select(bContext *C, const float co[2], const bool extend, const bool deselect_all) | ||||
| } | } | ||||
| else if (deselect_all) { | else if (deselect_all) { | ||||
| ed_tracking_deselect_all_tracks(tracksbase); | ed_tracking_deselect_all_tracks(tracksbase); | ||||
| ed_tracking_deselect_all_plane_tracks(plane_tracks_base); | ed_tracking_deselect_all_plane_tracks(plane_tracks_base); | ||||
| /* Mask as well if we are in combined mask / track view. */ | /* Mask as well if we are in combined mask / track view. */ | ||||
| ED_mask_deselect_all(C); | ED_mask_deselect_all(C); | ||||
| } | } | ||||
| if (!extend) { | ED_clip_view_lock_state_restore_no_jump(C, &lock_state); | ||||
| sc->xlockof = 0.0f; | |||||
| sc->ylockof = 0.0f; | |||||
| } | |||||
| BKE_tracking_dopesheet_tag_update(tracking); | BKE_tracking_dopesheet_tag_update(tracking); | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); | WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); | ||||
| DEG_id_tag_update(&clip->id, ID_RECALC_SELECT); | DEG_id_tag_update(&clip->id, ID_RECALC_SELECT); | ||||
| /* Pass-through + finished to allow tweak to transform. */ | /* Pass-through + finished to allow tweak to transform. */ | ||||
| return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH; | return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH; | ||||
| ▲ Show 20 Lines • Show All 470 Lines • ▼ Show 20 Lines | |||||
| /********************** select all operator *********************/ | /********************** select all operator *********************/ | ||||
| static int select_all_exec(bContext *C, wmOperator *op) | static int select_all_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| SpaceClip *sc = CTX_wm_space_clip(C); | SpaceClip *sc = CTX_wm_space_clip(C); | ||||
| MovieClip *clip = ED_space_clip_get_clip(sc); | MovieClip *clip = ED_space_clip_get_clip(sc); | ||||
| MovieTracking *tracking = &clip->tracking; | MovieTracking *tracking = &clip->tracking; | ||||
| int action = RNA_enum_get(op->ptr, "action"); | const int action = RNA_enum_get(op->ptr, "action"); | ||||
| bool has_selection = false; | ClipViewLockState lock_state; | ||||
| ED_clip_view_lock_state_store(C, &lock_state); | |||||
| bool has_selection = false; | |||||
| ED_clip_select_all(sc, action, &has_selection); | ED_clip_select_all(sc, action, &has_selection); | ||||
| if (!has_selection) { | if (has_selection) { | ||||
| sc->flag &= ~SC_LOCK_SELECTION; | ED_clip_view_lock_state_restore_no_jump(C, &lock_state); | ||||
| } | } | ||||
| BKE_tracking_dopesheet_tag_update(tracking); | BKE_tracking_dopesheet_tag_update(tracking); | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); | WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL); | ||||
| DEG_id_tag_update(&clip->id, ID_RECALC_SELECT); | DEG_id_tag_update(&clip->id, ID_RECALC_SELECT); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| ▲ Show 20 Lines • Show All 126 Lines • Show Last 20 Lines | |||||