diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2010-12-06 16:44:36 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2010-12-06 16:44:36 +0300 |
commit | 997338b5cb0eac243438e53539f6c91913f2e52a (patch) | |
tree | 19d7b81b93acf2cef980265195e35701368f8151 /source/blender/editors/curve | |
parent | 25bd57b0a1512037070d9e6c85694ab8fa82ec1b (diff) |
Curves shape keys:
fixed memory corruption after creating new CVs and switching direction
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 57c614336a4..2f87e1b4650 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -490,8 +490,8 @@ static void keyIndex_swap(EditNurb *editnurb, void *a, void *b) 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 keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu) 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 @@ static void switch_keys_direction(Curve *cu, Nurb *actnu) 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; } |