[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38327] branches/soc-2011-pepper/source/ blender/editors: Bugfix [#27548] Timeline view - 2D drawing issues

Joshua Leung aligorith at gmail.com
Tue Jul 12 14:04:28 CEST 2011


Revision: 38327
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38327
Author:   aligorith
Date:     2011-07-12 12:04:27 +0000 (Tue, 12 Jul 2011)
Log Message:
-----------
Bugfix [#27548] Timeline view - 2D drawing issues

* Keyframe lines were being drawn too short when frame number box was
enabled. The code for drawing this was modifying the View2D view-space
to get it's stuff in the right place, but the timeline code was not
accounting for this.

* In order to make the time ticks more visible outside the frame
range, I've moved the start/end frame drawing stuff in timeline to
occur after the grid drawing, and to draw semi-transparent, just like
the preview range curtains in the other animation editors

Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/editors/animation/anim_draw.c
    branches/soc-2011-pepper/source/blender/editors/space_time/space_time.c

Modified: branches/soc-2011-pepper/source/blender/editors/animation/anim_draw.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/animation/anim_draw.c	2011-07-12 11:46:46 UTC (rev 38326)
+++ branches/soc-2011-pepper/source/blender/editors/animation/anim_draw.c	2011-07-12 12:04:27 UTC (rev 38327)
@@ -243,13 +243,13 @@
 			// XXX ob->ipoflag is depreceated!
 			if ((ob->ipoflag & OB_OFFS_OB) && (timeoffset != 0.0f)) {
 				vec[0]-= timeoffset; /* could avoid calling twice */
-			
+				
 				UI_ThemeColorShade(TH_CFRAME, -30);
-			
+				
 				glBegin(GL_LINE_STRIP);
 					/*vec[1]= v2d->cur.ymax;*/ // this is set already. this line is only included
 					glVertex2fv(vec);
-				
+					
 					vec[1]= v2d->cur.ymin;
 					glVertex2fv(vec);
 				glEnd();

Modified: branches/soc-2011-pepper/source/blender/editors/space_time/space_time.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/space_time/space_time.c	2011-07-12 11:46:46 UTC (rev 38326)
+++ branches/soc-2011-pepper/source/blender/editors/space_time/space_time.c	2011-07-12 12:04:27 UTC (rev 38327)
@@ -71,17 +71,21 @@
 static void time_draw_sfra_efra(Scene *scene, View2D *v2d)
 {	
 	/* draw darkened area outside of active timeline 
-	 * frame range used is preview range or scene range */
-	UI_ThemeColorShade(TH_BACK, -25);
+	 * frame range used is preview range or scene range 
+	 */
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+	glEnable(GL_BLEND);
+		glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
+		
+		if (PSFRA < PEFRA) {
+			glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax);
+			glRectf((float)PEFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
+		}
+		else {
+			glRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
+		}
+	glDisable(GL_BLEND);
 
-	if (PSFRA < PEFRA) {
-		glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax);
-		glRectf((float)PEFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
-	}
-	else {
-		glRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
-	}
-
 	UI_ThemeColorShade(TH_BACK, -60);
 	/* thin lines where the actual frames are */
 	fdrawline((float)PSFRA, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax);
@@ -303,8 +307,8 @@
 			 (ak) && (ak->cfra <= v2d->cur.xmax); 
 			  ak=ak->next ) 
 		{
-			glVertex2f(ak->cfra, v2d->cur.ymin);
-			glVertex2f(ak->cfra, v2d->cur.ymax);
+			glVertex2f(ak->cfra, v2d->tot.ymin);
+			glVertex2f(ak->cfra, v2d->tot.ymax);
 		}
 	glEnd(); // GL_LINES
 		
@@ -457,9 +461,6 @@
 	glClear(GL_COLOR_BUFFER_BIT);
 	
 	UI_view2d_view_ortho(v2d);
-
-	/* start and end frame */
-	time_draw_sfra_efra(scene, v2d);
 	
 	/* grid */
 	unit= (stime->flag & TIME_DRAWFRAMES)? V2D_UNIT_FRAMES: V2D_UNIT_SECONDS;
@@ -467,11 +468,16 @@
 	UI_view2d_grid_draw(v2d, grid, (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS));
 	UI_view2d_grid_free(grid);
 	
+	/* start and end frame */
+	time_draw_sfra_efra(scene, v2d);
+	
 	/* current frame */
 	if ((stime->flag & TIME_DRAWFRAMES)==0) 	flag |= DRAWCFRA_UNIT_SECONDS;
 	if (stime->flag & TIME_CFRA_NUM) 			flag |= DRAWCFRA_SHOW_NUMBOX;
 	ANIM_draw_cfra(C, v2d, flag);
 	
+	UI_view2d_view_ortho(v2d);
+	
 	/* keyframes */
 	if(!G.rendering) /* ANIM_nla_mapping_apply_fcurve() modifies curve data while rendering, possible race condition */
 		time_draw_keyframes(C, stime, ar);




More information about the Bf-blender-cvs mailing list