[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33507] trunk/blender/source/blender/ editors/curve/editcurve.c: Curves shape keys:

Sergey Sharybin g.ulairi at gmail.com
Mon Dec 6 14:44:37 CET 2010


Revision: 33507
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33507
Author:   nazgul
Date:     2010-12-06 14:44:36 +0100 (Mon, 06 Dec 2010)

Log Message:
-----------
Curves shape keys:
fixed memory corruption after creating new CVs and switching direction

Modified Paths:
--------------
    trunk/blender/source/blender/editors/curve/editcurve.c

Modified: trunk/blender/source/blender/editors/curve/editcurve.c
===================================================================
--- trunk/blender/source/blender/editors/curve/editcurve.c	2010-12-06 13:33:45 UTC (rev 33506)
+++ trunk/blender/source/blender/editors/curve/editcurve.c	2010-12-06 13:44:36 UTC (rev 33507)
@@ -490,8 +490,8 @@
 	BLI_ghash_remove(editnurb->keyindex, a, NULL, NULL);
 	BLI_ghash_remove(editnurb->keyindex, b, NULL, NULL);
 
-	BLI_ghash_insert(editnurb->keyindex, a, index2);
-	BLI_ghash_insert(editnurb->keyindex, b, index1);
+	if(index2) BLI_ghash_insert(editnurb->keyindex, a, index2);
+	if(index1) BLI_ghash_insert(editnurb->keyindex, b, index1);
 }
 
 static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
@@ -563,7 +563,8 @@
 static void switch_keys_direction(Curve *cu, Nurb *actnu)
 {
 	KeyBlock *currkey;
-	ListBase *nubase= &cu->editnurb->nurbs;
+	EditNurb *editnurb= cu->editnurb;
+	ListBase *nubase= &editnurb->nurbs;
 	Nurb *nu;
 	float *fp;
 	int a;
@@ -575,20 +576,28 @@
 		nu= nubase->first;
 		while (nu) {
 			if (nu->bezt) {
+				BezTriple *bezt= nu->bezt;
 				a= nu->pntsu;
 				if (nu == actnu) {
 					while (a--) {
-						swap_v3_v3(fp, fp + 6);
-						*(fp+9) = -*(fp+9);
-						fp += 12;
+						if(getKeyIndexOrig_bezt(editnurb, bezt)) {
+							swap_v3_v3(fp, fp + 6);
+							*(fp+9) = -*(fp+9);
+							fp += 12;
+						}
+						bezt++;
 					}
 				} else fp += a * 12;
 			} else {
+				BPoint *bp= nu->bp;
 				a= nu->pntsu * nu->pntsv;
 				if (nu == actnu) {
 					while (a--) {
-						*(fp+3) = -*(fp+3);
-						fp += 4;
+						if(getKeyIndexOrig_bp(editnurb, bp)) {
+							*(fp+3) = -*(fp+3);
+							fp += 4;
+						}
+						bp++;
 					}
 				} else fp += a * 4;
 			}





More information about the Bf-blender-cvs mailing list