[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17313] trunk/blender/source/blender: Added a new interpolation type for colorbands: Constant

Matt Ebb matt at mke3.net
Tue Nov 4 01:15:27 CET 2008


Revision: 17313
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17313
Author:   broken
Date:     2008-11-04 01:15:27 +0100 (Tue, 04 Nov 2008)

Log Message:
-----------
Added a new interpolation type for colorbands: Constant
This can be useful for toon shading etc.

Example: http://mke3.net/blender/etc/constant_ss.png

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/texture.c
    trunk/blender/source/blender/src/buttons_shading.c

Modified: trunk/blender/source/blender/blenkernel/intern/texture.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/texture.c	2008-11-03 23:35:41 UTC (rev 17312)
+++ trunk/blender/source/blender/blenkernel/intern/texture.c	2008-11-04 00:15:27 UTC (rev 17313)
@@ -348,6 +348,15 @@
 				else
 					fac= 0.0f;
 				
+				if (coba->ipotype==4) {
+					/* constant */
+					out[0]= cbd1->r;
+					out[1]= cbd1->g;
+					out[2]= cbd1->b;
+					out[3]= cbd1->a;
+					return 1;
+				}
+				
 				if(coba->ipotype>=2) {
 					/* ipo from right to left: 3 2 1 0 */
 					

Modified: trunk/blender/source/blender/src/buttons_shading.c
===================================================================
--- trunk/blender/source/blender/src/buttons_shading.c	2008-11-03 23:35:41 UTC (rev 17312)
+++ trunk/blender/source/blender/src/buttons_shading.c	2008-11-04 00:15:27 UTC (rev 17313)
@@ -1468,10 +1468,9 @@
 	uiDefButS(block, NUM, redraw,		"Cur:",		117+xoffs,95+yoffs,81,20, &coba->cur, 0.0, (float)(coba->tot-1), 0, 0, "Displays the active color from the colorband");
 	bt= uiDefBut(block, BUT, redraw,		"Del",		199+xoffs,95+yoffs,37,20, 0, 0, 0, 0, 0, "Deletes the active position");
 	uiButSetFunc(bt, colorband_del_cb, coba, NULL);
-	uiDefButS(block, ROW, redraw,		 "E",		236+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 1.0, 0, 0, "Sets interpolation type 'Ease' (quadratic) ");
-	uiDefButS(block, ROW, redraw,		"C",		252+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 3.0, 0, 0, "Sets interpolation type Cardinal");
-	uiDefButS(block, ROW, redraw,		"L",		268+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 0.0, 0, 0, "Sets interpolation type Linear");
-	uiDefButS(block, ROW, redraw,		"S",		284+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 2.0, 0, 0, "Sets interpolation type B-Spline");
+	
+	uiDefButS(block, MENU, redraw,		"Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4",
+		236+xoffs, 95+yoffs, 64, 20,		&coba->ipotype, 0.0, 0.0, 0, 0, "Sets interpolation type");
 
 	uiDefBut(block, BUT_COLORBAND, redraw, "", 	xoffs,65+yoffs,300,30, coba, 0, 0, 0, 0, "");
 	
@@ -1506,11 +1505,10 @@
 	uiButSetFunc(bt, colorband_add_cb, coba, NULL);
 	bt= uiDefBut(block, BUT, event,	"Del",		xs+8.0f*unit,butr->ymin+20.0f,2.0f*unit,20,	NULL, 0, 0, 0, 0, "Deletes the active position");
 	uiButSetFunc(bt, colorband_del_cb, coba, NULL);
-	uiDefButS(block, ROW, event,		"E",		xs+10.0f*unit,butr->ymin+20.0f,unit,20,		&coba->ipotype, 5.0, 1.0, 0, 0, "Sets interpolation type 'Ease' (quadratic) ");
-	uiDefButS(block, ROW, event,		"C",		xs+11.0f*unit,butr->ymin+20.0f,unit,20,		&coba->ipotype, 5.0, 3.0, 0, 0, "Sets interpolation type Cardinal");
-	uiDefButS(block, ROW, event,		"L",		xs+12.0f*unit,butr->ymin+20.0f,unit,20,		&coba->ipotype, 5.0, 0.0, 0, 0, "Sets interpolation type Linear");
-	uiDefButS(block, ROW, event,		"S",		xs+13.0f*unit,butr->ymin+20.0f,unit,20,		&coba->ipotype, 5.0, 2.0, 0, 0, "Sets interpolation type B-Spline");
-	
+
+	uiDefButS(block, MENU, event,		"Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4",
+		xs+10.0f*unit, butr->ymin+20.0f, unit*4, 20,		&coba->ipotype, 0.0, 0.0, 0, 0, "Sets interpolation type");
+
 	uiDefBut(block, BUT_COLORBAND, event, "",		xs,butr->ymin,butr->xmax-butr->xmin,20.0f, coba, 0, 0, 0, 0, "");
 	uiBlockEndAlign(block);
 	





More information about the Bf-blender-cvs mailing list