[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17438] branches/animsys2/source/blender/ src/drawaction.c: AnimSys2: Bugfix for frame number indicator

Joshua Leung aligorith at gmail.com
Thu Nov 13 05:15:26 CET 2008


Revision: 17438
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17438
Author:   aligorith
Date:     2008-11-13 05:15:19 +0100 (Thu, 13 Nov 2008)

Log Message:
-----------
AnimSys2: Bugfix for frame number indicator

Fixed the OpenGL voodoo needed to get the frame indicator showing in the right place in the IPO Editor.

Modified Paths:
--------------
    branches/animsys2/source/blender/src/drawaction.c

Modified: branches/animsys2/source/blender/src/drawaction.c
===================================================================
--- branches/animsys2/source/blender/src/drawaction.c	2008-11-13 03:44:14 UTC (rev 17437)
+++ branches/animsys2/source/blender/src/drawaction.c	2008-11-13 04:15:19 UTC (rev 17438)
@@ -393,7 +393,7 @@
 
 void draw_cfra_number(float cfra)
 {
-	float xscale, yscale, x, y;
+	float xscale, yscale, yspace, ypixels, x;
 	short slen, time=0;
 	char str[32];
 	
@@ -422,6 +422,14 @@
 			return;
 	}
 	
+	/* move ortho view to align with slider in bottom */
+	glTranslatef(0.0f, G.v2d->cur.ymin, 0.0f);
+	
+	/* bad hacks in drawing markers... inverse correct that as well */
+	yspace= G.v2d->cur.ymax - G.v2d->cur.ymin;
+	ypixels= G.v2d->mask.ymax - G.v2d->mask.ymin;
+	glTranslatef(0.0f, 5.0*yspace/ypixels, 0.0f);
+	
 	/* because the frame number text is subject to the same scaling as the contents of the view */
 	view2d_getscale(G.v2d, &xscale, &yscale);
 	glScalef(1.0/xscale, 1.0/yscale, 1.0);
@@ -434,20 +442,21 @@
 	
 	/* get starting coordinates for drawing */
 	x= cfra * xscale;
-	y= G.v2d->cur.ymin;
 	
 	/* draw green box around/behind text */
 	BIF_ThemeColor(TH_CFRAME);
 	BIF_ThemeColorShadeAlpha(TH_CFRAME, 0, -100);
-	glRectf(x,  y,  x+slen,  y+20);
+	glRectf(x,  0,  x+slen,  20);
 	
 	/* draw current frame number - black text */
 	BIF_ThemeColor(TH_TEXT);
-	ui_rasterpos_safe(x, y+3, 1.0);
+	ui_rasterpos_safe(x, 3, 1.0);
 	BIF_DrawString(G.fonts, str, 0);
 	
-	/* restore scaling */
+	/* restore view transform */
 	glScalef(xscale, yscale, 1.0);
+	glTranslatef(0.0f, -G.v2d->cur.ymin, 0.0f);
+	glTranslatef(0.0f, -5.0*yspace/ypixels, 0.0f);
 }
 
 void draw_cfra_action (void)





More information about the Bf-blender-cvs mailing list