[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12449] trunk/blender/source/blender/src/ editipo.c: Bugfix - Ipo-Editor Scaling:

Joshua Leung aligorith at gmail.com
Thu Nov 1 12:40:57 CET 2007


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

Log Message:
-----------
Bugfix - Ipo-Editor Scaling:

When scaling all the control-points in the IPO Editor with negative scales, the control-points would end up "sticking together", and cancelling/undo would not help. 

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

Modified: trunk/blender/source/blender/src/editipo.c
===================================================================
--- trunk/blender/source/blender/src/editipo.c	2007-11-01 11:08:07 UTC (rev 12448)
+++ trunk/blender/source/blender/src/editipo.c	2007-11-01 11:40:56 UTC (rev 12449)
@@ -5019,28 +5019,47 @@
 	BeztMap *bezm;
 	TransData2D *td;
 	int i, j;
+	char *adjusted;
 	
+	/* dynamically allocate an array of chars to mark whether an TransData's 
+	 * pointers have been fixed already, so that we don't override ones that are
+	 * already done
+ 	 */
+	adjusted= MEM_callocN(sizeof(char), "beztmap_adjusted_map");
+	
 	/* for each beztmap item, find if it is used anywhere */
 	bezm= bezms;
 	for (i= 0; i < totvert; i++, bezm++) {
 		/* loop through transdata, testing if we have a hit */
 		td= t->data2d;
 		for (j= 0; j < t->total; j++, td++) {
+			/* skip item if already marked */
+			if (adjusted[j] != 0) continue;
+			
 			if (totipo_vertsel) {
 				/* only selected verts */
 				if (ei->icu->ipo==IPO_BEZ) {
 					if (bezm->bezt->f1 & 1) {
-						if (td->loc2d == bezm->bezt->vec[0])
+						if (td->loc2d == bezm->bezt->vec[0]) {
 							td->loc2d= (bezts + bezm->newIndex)->vec[0];
+							adjusted[j] = 1;
+							break;
+						}
 					}
 					if (bezm->bezt->f3 & 1) {
-						if (td->loc2d == bezm->bezt->vec[2])
+						if (td->loc2d == bezm->bezt->vec[2]) {
 							td->loc2d= (bezts + bezm->newIndex)->vec[2];
+							adjusted[j] = 1;
+							break;
+						}
 					}
 				}
 				if (bezm->bezt->f2 & 1) {
-					if (td->loc2d == bezm->bezt->vec[1])
+					if (td->loc2d == bezm->bezt->vec[1]) {
 						td->loc2d= (bezts + bezm->newIndex)->vec[1];
+						adjusted[j] = 1;
+						break;
+					}
 				}
 			}
 			else {
@@ -5048,19 +5067,28 @@
 				if (ei->icu->ipo==IPO_BEZ) {
 					if (td->loc2d == bezm->bezt->vec[0]) {
 						td->loc2d= (bezts + bezm->newIndex)->vec[0];
+						adjusted[j] = 1;
+						break;
 					}
 					
 					if (td->loc2d == bezm->bezt->vec[2]) {
 						td->loc2d= (bezts + bezm->newIndex)->vec[2];
+						adjusted[j] = 1;
+						break;
 					}
 				}
 				if (td->loc2d == bezm->bezt->vec[1]) {
 					td->loc2d= (bezts + bezm->newIndex)->vec[1];
+					adjusted[j] = 1;
+					break;
 				}
 			}
 		}
 		
 	}
+	
+	/* free temp memory used for 'adjusted' array */
+	MEM_freeN(adjusted);
 }
 
 /* This function is called by recalcData during the Transform loop to recalculate 





More information about the Bf-blender-cvs mailing list