From a735629fd17edd9c0919789dddabee71012fa6a5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Jan 2011 08:00:16 +0000 Subject: no need to define betz in editcurve.c, replace ob_get_key with inline check for anim filter code. --- source/blender/editors/animation/anim_filter.c | 18 +----------------- source/blender/editors/curve/editcurve.c | 14 +++++--------- 2 files changed, 6 insertions(+), 26 deletions(-) (limited to 'source') diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 2cbcc42efa3..791955dcfba 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -105,23 +105,7 @@ static Key *actedit_get_shapekeys (bAnimContext *ac) //if (saction->pin) return NULL; /* shapekey data is stored with geometry data */ - switch (ob->type) { - case OB_MESH: - key= ((Mesh *)ob->data)->key; - break; - - case OB_LATTICE: - key= ((Lattice *)ob->data)->key; - break; - - case OB_CURVE: - case OB_SURF: - key= ((Curve *)ob->data)->key; - break; - - default: - return NULL; - } + key= ob_get_key(ob); if (key) { if (key->type == KEY_RELATIVE) diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 488ec71dde0..5dbff672db9 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -3928,7 +3928,6 @@ static int make_segment_exec(bContext *C, wmOperator *op) Curve *cu= obedit->data; ListBase *nubase= curve_get_editcurve(obedit); Nurb *nu, *nu1=0, *nu2=0; - BezTriple *bezt = NULL; BPoint *bp; float *fp, offset; int a, ok= 0; @@ -3960,12 +3959,10 @@ static int make_segment_exec(bContext *C, wmOperator *op) for(nu= nubase->first; nu; nu= nu->next) { if((nu->flagu & CU_NURB_CYCLIC)==0) { /* not cyclic */ if(nu->type == CU_BEZIER) { - bezt= nu->bezt; if(nu1==0) { - if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) nu1= nu; + if( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) nu1= nu; else { - bezt= bezt+(nu->pntsu-1); - if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu-1])) ) { nu1= nu; switchdirectionNurb(nu); keyData_switchDirectionNurb(cu, nu); @@ -3973,14 +3970,13 @@ static int make_segment_exec(bContext *C, wmOperator *op) } } else if(nu2==0) { - if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) { nu2= nu; switchdirectionNurb(nu); keyData_switchDirectionNurb(cu, nu); } else { - bezt= bezt+(nu->pntsu-1); - if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu-1])) ) { nu2= nu; } } @@ -4021,7 +4017,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) if((nu1 && nu2) && (nu1!=nu2)) { if( nu1->type==nu2->type) { if(nu1->type == CU_BEZIER) { - bezt = + BezTriple *bezt = (BezTriple*)MEM_mallocN((nu1->pntsu+nu2->pntsu) * sizeof(BezTriple), "addsegmentN"); ED_curve_beztcpy(cu->editnurb, bezt, nu2->bezt, nu2->pntsu); ED_curve_beztcpy(cu->editnurb, bezt+nu2->pntsu, nu1->bezt, nu1->pntsu); -- cgit v1.2.3