[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28566] branches/render25/source/blender/ blenkernel/intern/particle.c: fixed drawing of weights in strand particle edit mode, yay

Joseph Eagar joeedh at gmail.com
Tue May 4 12:16:32 CEST 2010


Revision: 28566
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28566
Author:   joeedh
Date:     2010-05-04 12:16:32 +0200 (Tue, 04 May 2010)

Log Message:
-----------
fixed drawing of weights in strand particle edit mode, yay

Modified Paths:
--------------
    branches/render25/source/blender/blenkernel/intern/particle.c

Modified: branches/render25/source/blender/blenkernel/intern/particle.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/particle.c	2010-05-04 08:59:32 UTC (rev 28565)
+++ branches/render25/source/blender/blenkernel/intern/particle.c	2010-05-04 10:16:32 UTC (rev 28566)
@@ -2950,7 +2950,7 @@
 	float birthtime = 0.0, dietime = 0.0;
 	float t, time = 0.0, keytime = 0.0, frs_sec;
 	float hairmat[4][4], rotmat[3][3], prev_tangent[3];
-	int k,i;
+	int k, i;
 	int steps = (int)pow(2.0, (double)pset->draw_step);
 	int totpart = edit->totpoint, recalc_set=0;
 	float sel_col[3];
@@ -3097,17 +3097,26 @@
 
 			/* selection coloring in edit mode */
 			if(pset->brushtype==PE_BRUSH_WEIGHT){
-				if(k==0)
+				float t2;
+
+				if(k==0) {
 					weight_to_rgb(pind.hkey[1]->weight, ca->col, ca->col+1, ca->col+2);
-				else if(k >= steps - 1)
-					weight_to_rgb(pind.hkey[0]->weight, ca->col, ca->col+1, ca->col+2);
-				else
-					weight_to_rgb((1.0f - keytime) * pind.hkey[0]->weight + keytime * pind.hkey[1]->weight, ca->col, ca->col+1, ca->col+2);
+				} else {
+					float w1[3], w2[3];
+					keytime = (t - (*pind.ekey[0]->time))/((*pind.ekey[1]->time) - (*pind.ekey[0]->time));
 
+					weight_to_rgb(pind.hkey[0]->weight, w1, w1+1, w1+2);
+					weight_to_rgb(pind.hkey[1]->weight, w2, w2+1, w2+2);
+
+					interp_v3_v3v3(ca->col, w1, w2, keytime);
+				}
+
 				/* at the moment this is only used for weight painting.
 				 * will need to move out of this check if its used elsewhere. */
-				pind.hkey[0] = pind.hkey[1];
-				pind.hkey[1]++;
+				t2 = birthtime + ((float)(k+1)/(float)steps) * (dietime - birthtime);
+
+				while (pind.hkey[1]->time < t2) pind.hkey[1]++;
+				pind.hkey[0] = pind.hkey[1] - 1;
 			}
 			else {
 				if((ekey + (pind.ekey[0] - point->keys))->flag & PEK_SELECT){





More information about the Bf-blender-cvs mailing list