[Bf-blender-cvs] [3f21869] soc-2016-multiview: 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
Tianwei Shen
noreply at git.blender.org
Wed Jul 13 05:26:02 CEST 2016
Commit: 3f21869c8937713d1cb34c1fcef1e9fedb9a00fc
Author: Tianwei Shen
Date: Wed Jul 13 11:24:16 2016 +0800
Branches: soc-2016-multiview
https://developer.blender.org/rB3f21869c8937713d1cb34c1fcef1e9fedb9a00fc
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
===================================================================
M source/blender/editors/interface/resources.c
M source/blender/editors/space_clip/clip_draw.c
===================================================================
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 09f086c..5177686 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1192,8 +1192,8 @@ void ui_theme_init_default(void)
rgba_char_args_set(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
rgba_char_args_set(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
rgba_char_args_set(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
- rgba_char_args_set(btheme->tclip.linked_marker, 0x00, 0x00, 0xff, 255);
- rgba_char_args_set(btheme->tclip.sel_linked_marker, 0xff, 0x00, 0x00, 255);
+ rgba_char_args_set(btheme->tclip.linked_marker, 0x85, 0xc1, 0xe9, 255);
+ rgba_char_args_set(btheme->tclip.sel_linked_marker, 0xcb, 0x43, 0x35, 255);
rgba_char_args_set(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
rgba_char_args_set(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
rgba_char_args_set(btheme->tclip.path_after, 0x00, 0x00, 0xff, 255);
@@ -2127,8 +2127,8 @@ void init_userdef_do_versions(void)
rgba_char_args_set(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
rgba_char_args_set(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
rgba_char_args_set(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
- rgba_char_args_set(btheme->tclip.linked_marker, 0x00, 0x00, 0xff, 255);
- rgba_char_args_set(btheme->tclip.sel_linked_marker, 0xff, 0x00, 0x00, 255);
+ rgba_char_args_set(btheme->tclip.linked_marker, 0x85, 0xc1, 0xe9, 255);
+ rgba_char_args_set(btheme->tclip.sel_linked_marker, 0xcb, 0x43, 0x35, 255);
rgba_char_args_set(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
rgba_char_args_set(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
rgba_char_args_set(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 695d04d..38d795e 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);
More information about the Bf-blender-cvs
mailing list