Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2004-10-18 13:43:38 +0400
committerTon Roosendaal <ton@blender.org>2004-10-18 13:43:38 +0400
commita92b7277dc2d9560b95fa3d0327de5fc17cb0e36 (patch)
tree0bc0fa034b852c304505d3a3c3ee37691caff559 /source/blender/src/editcurve.c
parent0be2d97e2e2052f4a123492bb2afe9c4db9b99e7 (diff)
Fixes for #1654 and #1655
- crash when converting nurbs->bezier, with nurbs having <3 points - copying audio strips in sequencer didnt increase ipo user counter
Diffstat (limited to 'source/blender/src/editcurve.c')
-rw-r--r--source/blender/src/editcurve.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/source/blender/src/editcurve.c b/source/blender/src/editcurve.c
index 458c47357c3..ff3fe1dae65 100644
--- a/source/blender/src/editcurve.c
+++ b/source/blender/src/editcurve.c
@@ -1863,7 +1863,7 @@ void setsplinetype(short type)
error("Not implemented yet");
return;
}
-
+
nu= editNurb.first;
while(nu) {
if(isNurbsel(nu)) {
@@ -1908,8 +1908,7 @@ void setsplinetype(short type)
else if((nu->type & 7)==CU_BEZIER) { /* Bezier */
if(type==0 || type==4) { /* to Poly or Nurb */
nr= 3*nu->pntsu;
- nu->bp =
- (BPoint*)MEM_callocN(nr * sizeof(BPoint), "setsplinetype");
+ nu->bp = MEM_callocN(nr * sizeof(BPoint), "setsplinetype");
a= nu->pntsu;
bezt= nu->bezt;
bp= nu->bp;
@@ -1961,30 +1960,33 @@ void setsplinetype(short type)
}
else if(type==CU_BEZIER) { /* to Bezier */
nr= nu->pntsu/3;
- bezt =
- (BezTriple*)MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2");
- nu->bezt= bezt;
- a= nr;
- bp= nu->bp;
- while(a--) {
- VECCOPY(bezt->vec[0], bp->vec);
- bezt->f1= bp->f1;
- bp++;
- VECCOPY(bezt->vec[1], bp->vec);
- bezt->f2= bp->f1;
- bp++;
- VECCOPY(bezt->vec[2], bp->vec);
- bezt->f3= bp->f1;
- bp++;
- bezt++;
+
+ if(nr<2) error("no conversion possible");
+ else {
+ bezt = MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2");
+ nu->bezt= bezt;
+ a= nr;
+ bp= nu->bp;
+ while(a--) {
+ VECCOPY(bezt->vec[0], bp->vec);
+ bezt->f1= bp->f1;
+ bp++;
+ VECCOPY(bezt->vec[1], bp->vec);
+ bezt->f2= bp->f1;
+ bp++;
+ VECCOPY(bezt->vec[2], bp->vec);
+ bezt->f3= bp->f1;
+ bp++;
+ bezt++;
+ }
+ MEM_freeN(nu->bp);
+ nu->bp= 0;
+ MEM_freeN(nu->knotsu);
+ nu->knotsu= 0;
+ nu->pntsu= nr;
+ nu->type &= ~7;
+ nu->type+= 1;
}
- MEM_freeN(nu->bp);
- nu->bp= 0;
- MEM_freeN(nu->knotsu);
- nu->knotsu= 0;
- nu->pntsu= nr;
- nu->type &= ~7;
- nu->type+= 1;
}
}
}