diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2010-03-30 18:33:05 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2010-03-30 18:33:05 +0400 |
commit | d0f8d9f38cfffaa5117930f7724bddf3d4c68d72 (patch) | |
tree | 211a487cc3fdb1da345b9b88be50df6c4d72caee /source/blender/blenkernel | |
parent | 1902de715f15454a5abf6c7972f156d5c6288f9d (diff) |
Fixed segmentation fault when non-curve object is setting as a taper
Deny user to select non-curve objects for taper and bevel lists, also
added some checking into displist and curve modules - object could be
converted from curve to mesh (would be better to unset bevel/taper
object in this case -- will try to implement a bit later).
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 72 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/displist.c | 6 |
2 files changed, 39 insertions, 39 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 9087a7ec4f2..a95714e71d2 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1227,49 +1227,47 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender) /* if a font object is being edited, then do nothing */ // XXX if( ob == obedit && ob->type == OB_FONT ) return; - if(cu->bevobj && cu->bevobj!=ob) { - if(cu->bevobj->type==OB_CURVE) { - bevcu= cu->bevobj->data; - if(bevcu->ext1==0.0 && bevcu->ext2==0.0) { - ListBase bevdisp= {NULL, NULL}; - facx= cu->bevobj->size[0]; - facy= cu->bevobj->size[1]; - - if (forRender) { - makeDispListCurveTypes_forRender(scene, cu->bevobj, &bevdisp, NULL, 0); - dl= bevdisp.first; - } else { + if(cu->bevobj && cu->bevobj!=ob && cu->bevobj->type==OB_CURVE) { + bevcu= cu->bevobj->data; + if(bevcu->ext1==0.0 && bevcu->ext2==0.0) { + ListBase bevdisp= {NULL, NULL}; + facx= cu->bevobj->size[0]; + facy= cu->bevobj->size[1]; + + if (forRender) { + makeDispListCurveTypes_forRender(scene, cu->bevobj, &bevdisp, NULL, 0); + dl= bevdisp.first; + } else { + dl= bevcu->disp.first; + if(dl==0) { + makeDispListCurveTypes(scene, cu->bevobj, 0); dl= bevcu->disp.first; - if(dl==0) { - makeDispListCurveTypes(scene, cu->bevobj, 0); - dl= bevcu->disp.first; - } } + } - while(dl) { - if ELEM(dl->type, DL_POLY, DL_SEGM) { - dlnew= MEM_mallocN(sizeof(DispList), "makebevelcurve1"); - *dlnew= *dl; - dlnew->verts= MEM_mallocN(3*sizeof(float)*dl->parts*dl->nr, "makebevelcurve1"); - memcpy(dlnew->verts, dl->verts, 3*sizeof(float)*dl->parts*dl->nr); - - if(dlnew->type==DL_SEGM) dlnew->flag |= (DL_FRONT_CURVE|DL_BACK_CURVE); - - BLI_addtail(disp, dlnew); - fp= dlnew->verts; - nr= dlnew->parts*dlnew->nr; - while(nr--) { - fp[2]= fp[1]*facy; - fp[1]= -fp[0]*facx; - fp[0]= 0.0; - fp+= 3; - } + while(dl) { + if ELEM(dl->type, DL_POLY, DL_SEGM) { + dlnew= MEM_mallocN(sizeof(DispList), "makebevelcurve1"); + *dlnew= *dl; + dlnew->verts= MEM_mallocN(3*sizeof(float)*dl->parts*dl->nr, "makebevelcurve1"); + memcpy(dlnew->verts, dl->verts, 3*sizeof(float)*dl->parts*dl->nr); + + if(dlnew->type==DL_SEGM) dlnew->flag |= (DL_FRONT_CURVE|DL_BACK_CURVE); + + BLI_addtail(disp, dlnew); + fp= dlnew->verts; + nr= dlnew->parts*dlnew->nr; + while(nr--) { + fp[2]= fp[1]*facy; + fp[1]= -fp[0]*facx; + fp[0]= 0.0; + fp+= 3; } - dl= dl->next; } - - freedisplist(&bevdisp); + dl= dl->next; } + + freedisplist(&bevdisp); } } else if(cu->ext1==0.0 && cu->ext2==0.0) { diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 29ee8aeab45..4defa0e53a1 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1755,8 +1755,10 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba bevp= (BevPoint *)(bl+1); for(a=0; a<bl->nr; a++,bevp++) { float fac=1.0; - if (cu->taperobj==NULL) { - if ( (cu->bevobj!=NULL) || !((cu->flag & CU_FRONT) || (cu->flag & CU_BACK)) ) + if (cu->taperobj==NULL || + cu->taperobj->type != OB_CURVE || cu->taperobj == ob) { + if ( (cu->bevobj!=NULL && cu->bevobj->type == OB_CURVE) || + !((cu->flag & CU_FRONT) || (cu->flag & CU_BACK)) ) fac = bevp->radius; } else { fac = calc_taper(scene, cu->taperobj, a, bl->nr); |