diff options
author | Tianwei Shen <shentianweipku@gmail.com> | 2016-07-13 06:24:16 +0300 |
---|---|---|
committer | Tianwei Shen <shentianweipku@gmail.com> | 2016-07-13 06:24:16 +0300 |
commit | 3f21869c8937713d1cb34c1fcef1e9fedb9a00fc (patch) | |
tree | d3ce6233fd061d9f4f767c68ee80a8742734557f /source/blender/editors/space_clip | |
parent | 7910bd844f595afb3acc7b146532a7abe28a931d (diff) |
mark linked tracks with another color
* currently this implementation has known bugs:
- colors for linked tracks and selected linked tracks are not correct
- linked tracks in witness tracks are not shown correctly
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r-- | source/blender/editors/space_clip/clip_draw.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 695d04d3850..38d795e62d7 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -547,7 +547,20 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT glPopMatrix(); } -static void track_colors(MovieTrackingTrack *track, int act, float col[3], float scol[3]) +// return whether the track is a linked track +// by iterating the correpsondence base in tracking. +static bool is_track_linked(MovieTracking *tracking, MovieTrackingTrack *track) +{ + MovieTrackingCorrespondence *corr = tracking->correspondences.first; + while (corr) { + if (corr->self_track == track || corr->other_track == track) + return true; + corr = corr->next; + } + return false; +} + +static void track_colors(MovieTrackingTrack *track, int act, int link, float col[3], float scol[3]) { if (track->flag & TRACK_CUSTOMCOLOR) { if (act) @@ -558,12 +571,18 @@ static void track_colors(MovieTrackingTrack *track, int act, float col[3], float mul_v3_v3fl(col, track->color, 0.5f); } else { - UI_GetThemeColor3fv(TH_MARKER, col); + if (link) + UI_GetThemeColor3fv(TH_LINKED_MARKER, col); + else + UI_GetThemeColor3fv(TH_MARKER, col); if (act) UI_GetThemeColor3fv(TH_ACT_MARKER, scol); else - UI_GetThemeColor3fv(TH_SEL_MARKER, scol); + if (link) + UI_GetThemeColor3fv(TH_SEL_LINKED_MARKER, scol); + else + UI_GetThemeColor3fv(TH_SEL_MARKER, scol); } } @@ -574,7 +593,9 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra bool show_search = false; float col[3], scol[3], px[2]; - track_colors(track, act, col, scol); + MovieTracking *tracking = &sc->clip->tracking; + bool link = is_track_linked(tracking, track); + track_colors(track, act, link, col, scol); px[0] = 1.0f / width / sc->zoom; px[1] = 1.0f / height / sc->zoom; @@ -798,7 +819,9 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo if (!TRACK_VIEW_SELECTED(sc, track) || track->flag & TRACK_LOCKED) return; - track_colors(track, act, col, scol); + MovieTracking *tracking = &sc->clip->tracking; + bool link = is_track_linked(tracking, track); + track_colors(track, act, link, col, scol); if (outline) { UI_ThemeColor(TH_MARKER_OUTLINE); |