[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17376] branches/animsys2/source/blender/ src: AnimSys2: IPO-Smooth Tool

Joshua Leung aligorith at gmail.com
Sun Nov 9 10:51:25 CET 2008


Revision: 17376
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17376
Author:   aligorith
Date:     2008-11-09 10:51:24 +0100 (Sun, 09 Nov 2008)

Log Message:
-----------
AnimSys2: IPO-Smooth Tool 

* Added option to only flatten the handles
* Added to toolbox

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

Modified: branches/animsys2/source/blender/src/editipo.c
===================================================================
--- branches/animsys2/source/blender/src/editipo.c	2008-11-09 09:43:32 UTC (rev 17375)
+++ branches/animsys2/source/blender/src/editipo.c	2008-11-09 09:51:24 UTC (rev 17376)
@@ -2556,10 +2556,13 @@
 void smooth_ipo(void)
 {
 	EditIpo *ei;
-	short ok;
+	short ok, mode;
 	int b;
 	
 	get_status_editipo();
+	
+	mode= pupmenu("Smooth IPO%t|Tweak Points%x1|Flatten Handles%x2");
+	if (mode <= 0) return;
 
 	ei= G.sipo->editipo;
 	for(b=0; b<G.sipo->totipo; b++, ei++) {
@@ -2574,22 +2577,24 @@
 				BezTriple *bezt;
 				int i, x, totSel = 0;
 				
-				/* check if enough points */
-				if (icu->totvert >= 3) {
-					/* first loop through - count how many verts are selected, and fix up handles */
-					bezt= icu->bezt;
-					for (i=0; i < icu->totvert; i++, bezt++) {						
-						if (BEZSELECTED(bezt)) {							
-							/* line point's handles up with point's vertical position */
-							bezt->vec[0][1]= bezt->vec[2][1]= bezt->vec[1][1];
-							if ((bezt->h1==HD_AUTO) || (bezt->h1==HD_VECT)) bezt->h1= HD_ALIGN;
-							if ((bezt->h2==HD_AUTO) || (bezt->h2==HD_VECT)) bezt->h2= HD_ALIGN;
-							
-							/* add value to total */
-							totSel++;
-						}
+				/* first loop through - count how many verts are selected, and fix up handles 
+				 *	for both modes
+				 */
+				bezt= icu->bezt;
+				for (i=0; i < icu->totvert; i++, bezt++) {						
+					if (BEZSELECTED(bezt)) {							
+						/* line point's handles up with point's vertical position */
+						bezt->vec[0][1]= bezt->vec[2][1]= bezt->vec[1][1];
+						if ((bezt->h1==HD_AUTO) || (bezt->h1==HD_VECT)) bezt->h1= HD_ALIGN;
+						if ((bezt->h2==HD_AUTO) || (bezt->h2==HD_VECT)) bezt->h2= HD_ALIGN;
+						
+						/* add value to total */
+						totSel++;
 					}
-					
+				}
+				
+				/* check if adjust values too... */
+				if (mode == 2) {
 					/* if any points were selected, allocate tSmooth_Bezt points to work on */
 					if (totSel >= 3) {
 						tSmooth_Bezt *tarray, *tsb;

Modified: branches/animsys2/source/blender/src/toolbox.c
===================================================================
--- branches/animsys2/source/blender/src/toolbox.c	2008-11-09 09:43:32 UTC (rev 17375)
+++ branches/animsys2/source/blender/src/toolbox.c	2008-11-09 09:51:24 UTC (rev 17376)
@@ -1724,6 +1724,8 @@
 	{	0, "SEPR", 		0, NULL},
 	{	0, "Duplicate|Shift D", TB_SHIFT|'d', NULL},
 	{	0, "Delete|X", 'x', 		NULL},
+	{	0, "Smooth|Shift O", TB_SHIFT|'o', 		NULL},
+	{	0, "Clean|O", 'o', 		NULL},
 	{	0, "SEPR", 		0, NULL},
 	{	0, "Interpolation|T", 't', NULL},
 	{	0, "Handle Type", 		0, tb_ipo_edit_handles},





More information about the Bf-blender-cvs mailing list