[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12648] trunk/blender/source/blender/src/ drawarmature.c: == Armature Path Drawing Tweak ==

Joshua Leung aligorith at gmail.com
Thu Nov 22 01:58:59 CET 2007


Revision: 12648
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12648
Author:   aligorith
Date:     2007-11-22 01:58:57 +0100 (Thu, 22 Nov 2007)

Log Message:
-----------
== Armature Path Drawing Tweak ==

Peach Request: Bone path lines are now drawn using two colours to show the parts of the path before and after the current frame. Those before the current frame are drawn darker, while those after are drawn in a blue colour. 

Modified Paths:
--------------
    trunk/blender/source/blender/src/drawarmature.c

Modified: trunk/blender/source/blender/src/drawarmature.c
===================================================================
--- trunk/blender/source/blender/src/drawarmature.c	2007-11-21 23:22:56 UTC (rev 12647)
+++ trunk/blender/source/blender/src/drawarmature.c	2007-11-22 00:58:57 UTC (rev 12648)
@@ -1737,8 +1737,8 @@
 	CfraElem *ce;
 	ListBase ak;
 	float *fp;
-	int a;
-	int stepsize, sfra;
+	int a, stepsize;
+	int sfra, efra;
 	
 	if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
 	
@@ -1758,16 +1758,39 @@
 					pchan->pathef= EFRA;
 				}
 				
-				/* get start frame of calculated range */
+				/* get frame ranges */
 				sfra= pchan->pathsf;
+				efra = sfra + pchan->pathlen;
 				
 				/* draw curve-line of path */
-				// TODO: show before/after with slight difference in colour intensity
-				BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.7);
-				glBegin(GL_LINE_STRIP);
-				for(a=0, fp= pchan->path; a<pchan->pathlen; a++, fp+=3)
-					glVertex3fv(fp);
-				glEnd();
+				if ((CFRA > sfra) && (CFRA < efra)) {
+					/* Show before/after current frame with slight difference in colour intensity 
+					 * This is done in two loops, as there seems to be some problems with changing color
+					 * or something during a loop (noted somewhere in the codebase)
+					 */
+					
+					/* 	before cfra (darker) */
+					BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.2);
+					glBegin(GL_LINE_STRIP);
+					for (a=0, fp=pchan->path; (sfra+a)<=CFRA; a++, fp+=3)
+						glVertex3fv(fp);
+					glEnd();
+					
+					/* after cfra (lighter) - backtrack a bit so that we don't have gaps */
+					BIF_ThemeColorBlend(TH_WIRE, TH_BONE_POSE, 0.7);
+					glBegin(GL_LINE_STRIP);
+					for (--a, fp-=3; a<pchan->pathlen; a++, fp+=3)
+						glVertex3fv(fp);
+					glEnd();
+				}
+				else {
+					/* show both directions with same intensity (cfra somewhere else) */
+					BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.7);
+					glBegin(GL_LINE_STRIP);
+					for (a=0, fp= pchan->path; a<pchan->pathlen; a++, fp+=3)
+						glVertex3fv(fp);
+					glEnd();
+				}
 				
 				glPointSize(1.0);
 				
@@ -1791,7 +1814,7 @@
 					for(a=0, fp= pchan->path; a<pchan->pathlen; a+=stepsize, fp+=(stepsize*3)) {
 						char str[32];
 						
-						/* only draw framenum if several consecutive highlighted points occur on same point */
+						/* only draw framenum if several consecutive highlighted points don't occur on same point */
 						if (a == 0) {
 							glRasterPos3fv(fp);
 							sprintf(str, "  %d\n", (a+sfra));





More information about the Bf-blender-cvs mailing list