Display solver keyframes in cache line

--
svn merge -r49293:49294 ^/branches/soc-2011-tomato
This commit is contained in:
Sergey Sharybin 2012-07-27 13:49:26 +00:00
parent d623454d2e
commit abeeebd089
2 changed files with 26 additions and 6 deletions

@ -93,13 +93,30 @@ void clip_draw_curfra_label(SpaceClip *sc, float x, float y)
BLF_draw(fontid, numstr, sizeof(numstr));
}
static void draw_keyframe(int frame, int cfra, int sfra, float framelen, int width)
{
int height = (frame == cfra) ? 22 : 10;
int x = (frame - sfra) * framelen;
if (width == 1) {
glBegin(GL_LINES);
glVertex2i(x, 0);
glVertex2i(x, height);
glEnd();
}
else {
glRecti(x, 0, x + width, height);
}
}
static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Scene *scene)
{
float x;
int *points, totseg, i, a;
float sfra = SFRA, efra = EFRA, framelen = ar->winx / (efra - sfra + 1);
MovieTracking *tracking = &clip->tracking;
MovieTrackingTrack *act_track = BKE_tracking_track_get_active(&clip->tracking);
MovieTrackingReconstruction *reconstruction = BKE_tracking_get_active_reconstruction(&clip->tracking);
MovieTrackingReconstruction *reconstruction = BKE_tracking_get_active_reconstruction(tracking);
glEnable(GL_BLEND);
@ -197,6 +214,11 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
clip_draw_curfra_label(sc, x, 8.0f);
/* solver keyframes */
glColor4ub(175, 255, 0, 255);
draw_keyframe(tracking->settings.keyframe1 + clip->start_frame - 1, CFRA, sfra, framelen, 2);
draw_keyframe(tracking->settings.keyframe2 + clip->start_frame - 1, CFRA, sfra, framelen, 2);
/* movie clip animation */
if ((sc->mode == SC_MODE_MASKEDIT) && sc->mask_info.mask) {
MaskLayer *masklay = BKE_mask_layer_active(sc->mask_info.mask);
@ -212,11 +234,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
{
i = masklay_shape->frame;
/* glRecti((i - sfra) * framelen, 0, (i - sfra + 1) * framelen, 4); */
/* use a line so we always see the keyframes */
glVertex2i((i - sfra) * framelen, 0);
glVertex2i((i - sfra) * framelen, (i == CFRA) ? 22 : 10);
draw_keyframe(i, CFRA, sfra, framelen, 1);
}
glEnd();

@ -2867,6 +2867,8 @@ static int set_solver_keyframe_exec(bContext *C, wmOperator *op)
else
settings->keyframe2 = framenr;
WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip);
return OPERATOR_FINISHED;
}