[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49294] branches/soc-2011-tomato/source/ blender/editors/space_clip: Display solver keyframes in cache line

Sergey Sharybin sergey.vfx at gmail.com
Fri Jul 27 15:48:23 CEST 2012


Revision: 49294
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49294
Author:   nazgul
Date:     2012-07-27 13:48:23 +0000 (Fri, 27 Jul 2012)
Log Message:
-----------
Display solver keyframes in cache line

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c

Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c	2012-07-27 13:24:08 UTC (rev 49293)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c	2012-07-27 13:48:23 UTC (rev 49294)
@@ -94,13 +94,30 @@
 	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);
 
@@ -198,6 +215,11 @@
 
 	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);
@@ -213,11 +235,7 @@
 			{
 				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();

Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c	2012-07-27 13:24:08 UTC (rev 49293)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c	2012-07-27 13:48:23 UTC (rev 49294)
@@ -2867,6 +2867,8 @@
 	else
 		settings->keyframe2 = framenr;
 
+	WM_event_add_notifier(C, NC_MOVIECLIP | ND_DISPLAY, clip);
+
 	return OPERATOR_FINISHED;
 }
 




More information about the Bf-blender-cvs mailing list