diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-05-12 12:30:16 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-05-12 12:37:05 +0300 |
commit | 87dd8dc7406750bb1622ac84a04aded93c2670a4 (patch) | |
tree | 4117255614a0d65b948eb911f1330eec8bef752e /source/blender/editors/space_clip | |
parent | 993d17af90112ad62d98ccdfa110bd97dd0516d8 (diff) |
Cleanup: Hide slide operator specific logic
Use a more semantically clear function in the tracking API.
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r-- | source/blender/editors/space_clip/clip_intern.h | 6 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_select.c | 5 |
3 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h index dd01c095479..90ede7e951b 100644 --- a/source/blender/editors/space_clip/clip_intern.h +++ b/source/blender/editors/space_clip/clip_intern.h @@ -187,8 +187,10 @@ void clip_draw_sfra_efra(struct View2D *v2d, struct Scene *scene); /* tracking_ops.c */ -struct MovieTrackingTrack *tracking_marker_check_slide( - struct bContext *C, const struct wmEvent *event, int *r_area, int *r_action, int *r_corner); +/* Find track in a proximity of the given event. + * Uses the same rules w.r.t distance tolerances for track sliding and selection operators. */ +struct MovieTrackingTrack *tracking_find_track_in_proximity(struct bContext *C, + const struct wmEvent *event); void CLIP_OT_add_marker(struct wmOperatorType *ot); void CLIP_OT_add_marker_at_click(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 39a151ce3c9..407ddc04dcc 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -534,7 +534,7 @@ static bool slide_check_corners(float (*corners)[2]) return true; } -MovieTrackingTrack *tracking_marker_check_slide( +static MovieTrackingTrack *tracking_marker_check_slide( bContext *C, const wmEvent *event, int *r_area, int *r_action, int *r_corner) { const float distance_clip_squared = 12.0f * 12.0f; @@ -645,6 +645,12 @@ MovieTrackingTrack *tracking_marker_check_slide( return NULL; } +struct MovieTrackingTrack *tracking_find_track_in_proximity(struct bContext *C, + const struct wmEvent *event) +{ + return tracking_marker_check_slide(C, event, NULL, NULL, NULL); +} + static void *slide_marker_customdata(bContext *C, const wmEvent *event) { SpaceClip *sc = CTX_wm_space_clip(C); diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c index 5f940b817a9..3ef32886995 100644 --- a/source/blender/editors/space_clip/tracking_select.c +++ b/source/blender/editors/space_clip/tracking_select.c @@ -406,9 +406,8 @@ static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event) const bool extend = RNA_boolean_get(op->ptr, "extend"); if (!extend) { - MovieTrackingTrack *track = tracking_marker_check_slide(C, event, NULL, NULL, NULL); - - if (track) { + MovieTrackingTrack *track = tracking_find_track_in_proximity(C, event); + if (track != NULL) { MovieClip *clip = ED_space_clip_get_clip(sc); clip->tracking.act_track = track; |