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:
Diffstat (limited to 'source/blender/editors/space_clip/tracking_select.c')
-rw-r--r--source/blender/editors/space_clip/tracking_select.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index 24282ce0e96..207a0f1aff6 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -58,11 +58,13 @@ static float dist_to_crns(float co[2], float pos[2], float crns[4][2]);
static int mouse_on_side(
float co[2], float x1, float y1, float x2, float y2, float epsx, float epsy)
{
- if (x1 > x2)
+ if (x1 > x2) {
SWAP(float, x1, x2);
+ }
- if (y1 > y2)
+ if (y1 > y2) {
SWAP(float, y1, y2);
+ }
return (co[0] >= x1 - epsx && co[0] <= x2 + epsx) && (co[1] >= y1 - epsy && co[1] <= y2 + epsy);
}
@@ -115,14 +117,17 @@ static int track_mouse_area(const bContext *C, float co[2], MovieTrackingTrack *
epsy = max_ff(epsy, 2.0f / height);
if (sc->flag & SC_SHOW_MARKER_SEARCH) {
- if (mouse_on_rect(co, marker->pos, marker->search_min, marker->search_max, epsx, epsy))
+ if (mouse_on_rect(co, marker->pos, marker->search_min, marker->search_max, epsx, epsy)) {
return TRACK_AREA_SEARCH;
+ }
}
if ((marker->flag & MARKER_DISABLED) == 0) {
- if (sc->flag & SC_SHOW_MARKER_PATTERN)
- if (mouse_on_crns(co, marker->pos, marker->pattern_corners, epsx, epsy))
+ if (sc->flag & SC_SHOW_MARKER_PATTERN) {
+ if (mouse_on_crns(co, marker->pos, marker->pattern_corners, epsx, epsy)) {
return TRACK_AREA_PAT;
+ }
+ }
epsx = 12.0f / width;
epsy = 12.0f / height;
@@ -204,12 +209,14 @@ static MovieTrackingTrack *find_nearest_track(SpaceClip *sc,
(co[1] - marker->pos[1] - cur->offset[1]) * (co[1] - marker->pos[1] - cur->offset[1]));
/* distance to pattern boundbox */
- if (sc->flag & SC_SHOW_MARKER_PATTERN)
+ if (sc->flag & SC_SHOW_MARKER_PATTERN) {
d2 = dist_to_crns(co, marker->pos, marker->pattern_corners);
+ }
/* distance to search boundbox */
- if (sc->flag & SC_SHOW_MARKER_SEARCH && TRACK_VIEW_SELECTED(sc, cur))
+ if (sc->flag & SC_SHOW_MARKER_SEARCH && TRACK_VIEW_SELECTED(sc, cur)) {
d3 = dist_to_rect(co, marker->pos, marker->search_min, marker->search_max);
+ }
/* choose minimal distance. useful for cases of overlapped markers. */
dist = min_fff(d1, d2, d3);
@@ -305,8 +312,9 @@ static int mouse_select(bContext *C, float co[2], int extend)
if (track) {
int area = track_mouse_area(C, co, track);
- if (!extend || !TRACK_VIEW_SELECTED(sc, track))
+ if (!extend || !TRACK_VIEW_SELECTED(sc, track)) {
area = TRACK_AREA_ALL;
+ }
if (extend && TRACK_AREA_SELECTED(track, area)) {
if (track == act_track) {
@@ -318,8 +326,9 @@ static int mouse_select(bContext *C, float co[2], int extend)
}
}
else {
- if (area == TRACK_AREA_POINT)
+ if (area == TRACK_AREA_POINT) {
area = TRACK_AREA_ALL;
+ }
BKE_tracking_track_select(tracksbase, track, area, extend);
clip->tracking.act_track = track;
@@ -584,10 +593,12 @@ static int do_lasso_select_marker(bContext *C,
if (BLI_rcti_isect_pt(&rect, screen_co[0], screen_co[1]) &&
BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], V2D_IS_CLIPPED)) {
- if (select)
+ if (select) {
BKE_tracking_track_flag_set(track, TRACK_AREA_ALL, SELECT);
- else
+ }
+ else {
BKE_tracking_track_flag_clear(track, TRACK_AREA_ALL, SELECT);
+ }
}
changed = true;
@@ -820,8 +831,9 @@ static int select_all_exec(bContext *C, wmOperator *op)
ED_clip_select_all(sc, action, &has_selection);
- if (!has_selection)
+ if (!has_selection) {
sc->flag &= ~SC_LOCK_SELECTION;
+ }
BKE_tracking_dopesheet_tag_update(tracking);
@@ -888,8 +900,9 @@ static int select_grouped_exec(bContext *C, wmOperator *op)
if (act_track) {
ok = (track->flag & TRACK_CUSTOMCOLOR) == (act_track->flag & TRACK_CUSTOMCOLOR);
- if (ok && track->flag & TRACK_CUSTOMCOLOR)
+ if (ok && track->flag & TRACK_CUSTOMCOLOR) {
ok = equals_v3v3(track->color, act_track->color);
+ }
}
}
else if (group == 6) { /* failed */
@@ -898,10 +911,12 @@ static int select_grouped_exec(bContext *C, wmOperator *op)
if (ok) {
track->flag |= SELECT;
- if (sc->flag & SC_SHOW_MARKER_PATTERN)
+ if (sc->flag & SC_SHOW_MARKER_PATTERN) {
track->pat_flag |= SELECT;
- if (sc->flag & SC_SHOW_MARKER_SEARCH)
+ }
+ if (sc->flag & SC_SHOW_MARKER_SEARCH) {
track->search_flag |= SELECT;
+ }
}
track = track->next;