[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13176] trunk/blender/source/blender/src: Bugfix #8021: Delete in Action Editor can remove pydrivers.py refs

Joshua Leung aligorith at gmail.com
Wed Jan 9 01:05:26 CET 2008


Revision: 13176
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13176
Author:   aligorith
Date:     2008-01-09 01:05:26 +0100 (Wed, 09 Jan 2008)

Log Message:
-----------
Bugfix #8021: Delete in Action Editor can remove pydrivers.py refs

Basically, Ipo-Curves are now not removed when deleting keyframes in the Action Editor, if there is still an attached IPO-Driver on that curve.

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

Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c	2008-01-08 23:32:13 UTC (rev 13175)
+++ trunk/blender/source/blender/src/editaction.c	2008-01-09 00:05:26 UTC (rev 13176)
@@ -160,9 +160,9 @@
 				testhandles_ipocurve(icu);
 			}
 		}
-		for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next){
+		for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next) {
 			if (conchan->ipo) {
-				for (icu = conchan->ipo->curve.first; icu; icu=icu->next){
+				for (icu = conchan->ipo->curve.first; icu; icu=icu->next) {
 					sort_time_ipocurve(icu);
 					testhandles_ipocurve(icu);
 				}
@@ -1047,7 +1047,7 @@
 	allqueue(REDRAWNLA, 0);
 }
 
-/* delete selected keyframes */
+/* delete selected action-channels (only achans and conchans are considered) */
 void delete_action_channels (void)
 {
 	ListBase act_data = {NULL, NULL};

Modified: trunk/blender/source/blender/src/editipo.c
===================================================================
--- trunk/blender/source/blender/src/editipo.c	2008-01-08 23:32:13 UTC (rev 13175)
+++ trunk/blender/source/blender/src/editipo.c	2008-01-09 00:05:26 UTC (rev 13176)
@@ -5653,22 +5653,24 @@
 	IpoCurve *icu, *next;
 	int i;
 	
-	if (!ipo)
+	if (ipo == NULL)
 		return;
 	
-	for (icu=ipo->curve.first; icu; icu=next){
+	for (icu= ipo->curve.first; icu; icu= next) {
 		next = icu->next;
-		for (i=0; i<icu->totvert; i++){
-			if (icu->bezt[i].f2 & 1){
-				//	Delete the item
-				memcpy (&icu->bezt[i], &icu->bezt[i+1], sizeof (BezTriple)*(icu->totvert-i-1));
+		
+		/* Delete selected BezTriples */
+		for (i=0; i<icu->totvert; i++) {
+			if (icu->bezt[i].f2 & SELECT) {
+				memcpy(&icu->bezt[i], &icu->bezt[i+1], sizeof(BezTriple)*(icu->totvert-i-1));
 				icu->totvert--;
 				i--;
 			}
 		}
-		if (!icu->totvert){
-			/* Delete the curve */
-			BLI_remlink( &(ipo->curve), icu);
+		
+		/* Only delete if there isn't an ipo-driver still hanging around on an empty curve */
+		if (icu->totvert==0 && icu->driver==NULL) {
+			BLI_remlink(&ipo->curve, icu);
 			free_ipo_curve(icu);
 		}
 	}





More information about the Bf-blender-cvs mailing list