Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey@blender.org>2022-05-13 18:14:28 +0300
committerSergey Sharybin <sergey@blender.org>2022-05-13 18:18:25 +0300
commita80ad0a54578d6e92695dced22538bdca3c8e1a7 (patch)
tree748b479579585a806ce0e7dfdaa9a51b7c062453 /source/blender/editors/space_clip
parent4680331749aa716fe01445c473308f3ff80ec8c9 (diff)
Refactor: Use coordinate in API for track selection
Currently no functional changes. Prepares for a change which will allow to more consistently redo the track selection operator.
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r--source/blender/editors/space_clip/clip_intern.h2
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c12
-rw-r--r--source/blender/editors/space_clip/tracking_select.c7
3 files changed, 9 insertions, 12 deletions
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index 8e1df133189..ec3d098e68f 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -190,7 +190,7 @@ void clip_draw_sfra_efra(struct View2D *v2d, struct Scene *scene);
/* Find track which can be slid 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_slidable_track_in_proximity(struct bContext *C,
- const struct wmEvent *event);
+ const float co[2]);
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 8cddd0ab23b..ca224b04da5 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -528,11 +528,10 @@ static bool slide_check_corners(float (*corners)[2])
}
static MovieTrackingTrack *tracking_marker_check_slide(
- bContext *C, const wmEvent *event, int *r_area, eSlideAction *r_action, int *r_corner)
+ bContext *C, const float co[2], int *r_area, eSlideAction *r_action, int *r_corner)
{
const float distance_clip_squared = 12.0f * 12.0f;
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *region = CTX_wm_region(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
const int framenr = ED_space_clip_get_clip_frame_number(sc);
@@ -549,9 +548,6 @@ static MovieTrackingTrack *tracking_marker_check_slide(
return NULL;
}
- float co[2];
- ED_clip_mouse_pos(sc, region, event->mval, co);
-
LISTBASE_FOREACH (MovieTrackingTrack *, track, tracksbase) {
if (!TRACK_VIEW_SELECTED(sc, track) || (track->flag & TRACK_LOCKED)) {
continue;
@@ -640,9 +636,9 @@ static MovieTrackingTrack *tracking_marker_check_slide(
}
struct MovieTrackingTrack *tracking_find_slidable_track_in_proximity(struct bContext *C,
- const struct wmEvent *event)
+ const float co[2])
{
- return tracking_marker_check_slide(C, event, NULL, NULL, NULL);
+ return tracking_marker_check_slide(C, co, NULL, NULL, NULL);
}
static void *slide_marker_customdata(bContext *C, const wmEvent *event)
@@ -666,7 +662,7 @@ static void *slide_marker_customdata(bContext *C, const wmEvent *event)
ED_clip_mouse_pos(sc, region, event->mval, co);
- track = tracking_marker_check_slide(C, event, &area, &action, &corner);
+ track = tracking_marker_check_slide(C, co, &area, &action, &corner);
if (track != NULL) {
MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
customdata = create_slide_marker_data(
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index 1f6ec7de978..db985ae67e5 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -402,15 +402,17 @@ static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
SpaceClip *sc = CTX_wm_space_clip(C);
ARegion *region = CTX_wm_region(C);
- float co[2];
const bool extend = RNA_boolean_get(op->ptr, "extend");
+ float co[2];
+ ED_clip_mouse_pos(sc, region, event->mval, co);
+
/* Special code which allows to slide a marker which belongs to currently selected but not yet
* active track. If such track is found activate it and return pass-though so that marker slide
* operator can be used immediately after.
* This logic makes it convenient to slide markers when left mouse selection is used. */
if (!extend) {
- MovieTrackingTrack *track = tracking_find_slidable_track_in_proximity(C, event);
+ MovieTrackingTrack *track = tracking_find_slidable_track_in_proximity(C, co);
if (track != NULL) {
MovieClip *clip = ED_space_clip_get_clip(sc);
@@ -423,7 +425,6 @@ static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
}
- ED_clip_mouse_pos(sc, region, event->mval, co);
RNA_float_set_array(op->ptr, "location", co);
return select_exec(C, op);