diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-06 21:22:54 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-06 21:22:54 +0400 |
commit | ffed654ff2a1349b735026aafde6f8937a4a3f15 (patch) | |
tree | aee57d96cc5f5a3e425bf0f17477101ab899a87c /source/blender/blenkernel/intern/fcurve.c | |
parent | 1118b3fe3f6a9597403e8eb61f33e7a877098145 (diff) |
style cleanup: blenkernel
Diffstat (limited to 'source/blender/blenkernel/intern/fcurve.c')
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 798 |
1 files changed, 399 insertions, 399 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index f1942b24810..9d878cd185f 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -107,19 +107,19 @@ void free_fcurves(ListBase *list) * as we store reference to next, and freeing only touches the curve * it's given */ - for (fcu= list->first; fcu; fcu= fcn) { - fcn= fcu->next; + for (fcu = list->first; fcu; fcu = fcn) { + fcn = fcu->next; free_fcurve(fcu); } /* clear pointers just in case */ - list->first= list->last= NULL; + list->first = list->last = NULL; } /* ---------------------- Copy --------------------------- */ /* duplicate an F-Curve */ -FCurve *copy_fcurve (FCurve *fcu) +FCurve *copy_fcurve(FCurve *fcu) { FCurve *fcu_d; @@ -128,20 +128,20 @@ FCurve *copy_fcurve (FCurve *fcu) return NULL; /* make a copy */ - fcu_d= MEM_dupallocN(fcu); + fcu_d = MEM_dupallocN(fcu); - fcu_d->next= fcu_d->prev= NULL; - fcu_d->grp= NULL; + fcu_d->next = fcu_d->prev = NULL; + fcu_d->grp = NULL; /* copy curve data */ - fcu_d->bezt= MEM_dupallocN(fcu_d->bezt); - fcu_d->fpt= MEM_dupallocN(fcu_d->fpt); + fcu_d->bezt = MEM_dupallocN(fcu_d->bezt); + fcu_d->fpt = MEM_dupallocN(fcu_d->fpt); /* copy rna-path */ - fcu_d->rna_path= MEM_dupallocN(fcu_d->rna_path); + fcu_d->rna_path = MEM_dupallocN(fcu_d->rna_path); /* copy driver */ - fcu_d->driver= fcurve_copy_driver(fcu_d->driver); + fcu_d->driver = fcurve_copy_driver(fcu_d->driver); /* copy modifiers */ copy_fmodifiers(&fcu_d->modifiers, &fcu->modifiers); @@ -160,11 +160,11 @@ void copy_fcurves(ListBase *dst, ListBase *src) return; /* clear destination list first */ - dst->first= dst->last= NULL; + dst->first = dst->last = NULL; /* copy one-by-one */ - for (sfcu= src->first; sfcu; sfcu= sfcu->next) { - dfcu= copy_fcurve(sfcu); + for (sfcu = src->first; sfcu; sfcu = sfcu->next) { + dfcu = copy_fcurve(sfcu); BLI_addtail(dst, dfcu); } } @@ -175,8 +175,8 @@ void copy_fcurves(ListBase *dst, ListBase *src) FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *prop_name, int index, char *driven) { /* anim vars */ - AnimData *adt= BKE_animdata_from_id(id); - FCurve *fcu= NULL; + AnimData *adt = BKE_animdata_from_id(id); + FCurve *fcu = NULL; /* rna vars */ PointerRNA ptr; @@ -194,16 +194,16 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro prop = RNA_struct_find_property(&ptr, prop_name); if (prop) { - path= RNA_path_from_ID_to_property(&ptr, prop); + path = RNA_path_from_ID_to_property(&ptr, prop); if (path) { /* animation takes priority over drivers */ if ((adt->action) && (adt->action->curves.first)) - fcu= list_find_fcurve(&adt->action->curves, path, index); + fcu = list_find_fcurve(&adt->action->curves, path, index); /* if not animated, check if driven */ if ((fcu == NULL) && (adt->drivers.first)) { - fcu= list_find_fcurve(&adt->drivers, path, index); + fcu = list_find_fcurve(&adt->drivers, path, index); if (fcu && driven) *driven = TRUE; fcu = NULL; @@ -218,16 +218,16 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro /* Find the F-Curve affecting the given RNA-access path + index, in the list of F-Curves provided */ -FCurve *list_find_fcurve (ListBase *list, const char rna_path[], const int array_index) +FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int array_index) { FCurve *fcu; /* sanity checks */ - if ( ELEM(NULL, list, rna_path) || (array_index < 0) ) + if (ELEM(NULL, list, rna_path) || (array_index < 0) ) return NULL; /* check paths of curves, then array indices... */ - for (fcu= list->first; fcu; fcu= fcu->next) { + for (fcu = list->first; fcu; fcu = fcu->next) { /* simple string-compare (this assumes that they have the same root...) */ if (fcu->rna_path && !strcmp(fcu->rna_path, rna_path)) { /* now check indices */ @@ -241,7 +241,7 @@ FCurve *list_find_fcurve (ListBase *list, const char rna_path[], const int array } /* quick way to loop over all fcurves of a given 'path' */ -FCurve *iter_step_fcurve (FCurve *fcu_iter, const char rna_path[]) +FCurve *iter_step_fcurve(FCurve *fcu_iter, const char rna_path[]) { FCurve *fcu; @@ -250,7 +250,7 @@ FCurve *iter_step_fcurve (FCurve *fcu_iter, const char rna_path[]) return NULL; /* check paths of curves, then array indices... */ - for (fcu= fcu_iter; fcu; fcu= fcu->next) { + for (fcu = fcu_iter; fcu; fcu = fcu->next) { /* simple string-compare (this assumes that they have the same root...) */ if (fcu->rna_path && !strcmp(fcu->rna_path, rna_path)) { return fcu; @@ -267,8 +267,8 @@ FCurve *iter_step_fcurve (FCurve *fcu_iter, const char rna_path[]) * List must be freed after use, and is assumed to be empty when passed. * - src: list of F-Curves to search through * Filters... - * - dataPrefix: i.e. 'pose.bones[' or 'nodes[' - * - dataName: name of entity within "" immediately following the prefix + * - dataPrefix: i.e. 'pose.bones[' or 'nodes[' + * - dataName: name of entity within "" immediately following the prefix */ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName) { @@ -282,17 +282,17 @@ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, return 0; /* search each F-Curve one by one */ - for (fcu= src->first; fcu; fcu= fcu->next) { + for (fcu = src->first; fcu; fcu = fcu->next) { /* check if quoted string matches the path */ if ((fcu->rna_path) && strstr(fcu->rna_path, dataPrefix)) { - char *quotedName= BLI_getQuotedStr(fcu->rna_path, dataPrefix); + char *quotedName = BLI_getQuotedStr(fcu->rna_path, dataPrefix); if (quotedName) { /* check if the quoted name matches the required name */ if (strcmp(quotedName, dataName) == 0) { - LinkData *ld= MEM_callocN(sizeof(LinkData), "list_find_data_fcurves"); + LinkData *ld = MEM_callocN(sizeof(LinkData), "list_find_data_fcurves"); - ld->data= fcu; + ld->data = fcu; BLI_addtail(dst, ld); matches++; @@ -308,37 +308,37 @@ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, return matches; } -FCurve *rna_get_fcurve (PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction **action, int *driven) +FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction **action, int *driven) { - FCurve *fcu= NULL; + FCurve *fcu = NULL; - *driven= 0; + *driven = 0; /* there must be some RNA-pointer + property combon */ if (prop && ptr->id.data && RNA_property_animateable(ptr, prop)) { - AnimData *adt= BKE_animdata_from_id(ptr->id.data); + AnimData *adt = BKE_animdata_from_id(ptr->id.data); char *path; if (adt) { if ((adt->action && adt->action->curves.first) || (adt->drivers.first)) { /* XXX this function call can become a performance bottleneck */ - path= RNA_path_from_ID_to_property(ptr, prop); + path = RNA_path_from_ID_to_property(ptr, prop); if (path) { /* animation takes priority over drivers */ if (adt->action && adt->action->curves.first) - fcu= list_find_fcurve(&adt->action->curves, path, rnaindex); + fcu = list_find_fcurve(&adt->action->curves, path, rnaindex); /* if not animated, check if driven */ if (!fcu && (adt->drivers.first)) { - fcu= list_find_fcurve(&adt->drivers, path, rnaindex); + fcu = list_find_fcurve(&adt->drivers, path, rnaindex); if (fcu) - *driven= 1; + *driven = 1; } if (fcu && action) - *action= adt->action; + *action = adt->action; MEM_freeN(path); } @@ -352,18 +352,18 @@ FCurve *rna_get_fcurve (PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bActio /* ----------------- Finding Keyframes/Extents -------------------------- */ /* threshold for binary-searching keyframes - threshold here should be good enough for now, but should become userpref */ -#define BEZT_BINARYSEARCH_THRESH 0.01f /* was 0.00001, but giving errors */ +#define BEZT_BINARYSEARCH_THRESH 0.01f /* was 0.00001, but giving errors */ /* Binary search algorithm for finding where to insert BezTriple. (for use by insert_bezt_fcurve) * Returns the index to insert at (data already at that index will be offset if replace is 0) */ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short *replace) { - int start=0, end=arraylen; - int loopbreaker= 0, maxloop= arraylen * 2; + int start = 0, end = arraylen; + int loopbreaker = 0, maxloop = arraylen * 2; /* initialize replace-flag first */ - *replace= 0; + *replace = 0; /* sneaky optimisations (don't go through searching process if...): * - keyframe to be added is to be added out of current bounds @@ -378,7 +378,7 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short float framenum; /* 'First' Keyframe (when only one keyframe, this case is used) */ - framenum= array[0].vec[1][0]; + framenum = array[0].vec[1][0]; if (IS_EQT(frame, framenum, BEZT_BINARYSEARCH_THRESH)) { *replace = 1; return 0; @@ -387,9 +387,9 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short return 0; /* 'Last' Keyframe */ - framenum= array[(arraylen-1)].vec[1][0]; + framenum = array[(arraylen - 1)].vec[1][0]; if (IS_EQT(frame, framenum, BEZT_BINARYSEARCH_THRESH)) { - *replace= 1; + *replace = 1; return (arraylen - 1); } else if (frame > framenum) @@ -400,10 +400,10 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short /* most of the time, this loop is just to find where to put it * 'loopbreaker' is just here to prevent infinite loops */ - for (loopbreaker=0; (start <= end) && (loopbreaker < maxloop); loopbreaker++) { + for (loopbreaker = 0; (start <= end) && (loopbreaker < maxloop); loopbreaker++) { /* compute and get midpoint */ - int mid = start + ((end - start) / 2); /* we calculate the midpoint this way to avoid int overflows... */ - float midfra= array[mid].vec[1][0]; + int mid = start + ((end - start) / 2); /* we calculate the midpoint this way to avoid int overflows... */ + float midfra = array[mid].vec[1][0]; /* check if exactly equal to midpoint */ if (IS_EQT(frame, midfra, BEZT_BINARYSEARCH_THRESH)) { @@ -413,13 +413,13 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short /* repeat in upper/lower half */ if (frame > midfra) - start= mid + 1; + start = mid + 1; else if (frame < midfra) - end= mid - 1; + end = mid - 1; } /* print error if loop-limit exceeded */ - if (loopbreaker == (maxloop-1)) { + if (loopbreaker == (maxloop - 1)) { printf("Error: binarysearch_bezt_index() was taking too long\n"); // include debug info @@ -433,8 +433,8 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short /* ...................................... */ /* helper for calc_fcurve_* functions -> find first and last BezTriple to be used */ -static void get_fcurve_end_keyframes (FCurve *fcu, BezTriple **first, BezTriple **last, - const short do_sel_only) +static void get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple **last, + const short do_sel_only) { /* init outputs */ *first = NULL; @@ -451,18 +451,18 @@ static void get_fcurve_end_keyframes (FCurve *fcu, BezTriple **first, BezTriple /* find first selected */ bezt = fcu->bezt; - for (i=0; i < fcu->totvert; bezt++, i++) { + for (i = 0; i < fcu->totvert; bezt++, i++) { if (BEZSELECTED(bezt)) { - *first= bezt; + *first = bezt; break; } } /* find last selected */ bezt = ARRAY_LAST_ITEM(fcu->bezt, BezTriple, sizeof(BezTriple), fcu->totvert); - for (i=0; i < fcu->totvert; bezt--, i++) { + for (i = 0; i < fcu->totvert; bezt--, i++) { if (BEZSELECTED(bezt)) { - *last= bezt; + *last = bezt; break; } } @@ -479,14 +479,14 @@ static void get_fcurve_end_keyframes (FCurve *fcu, BezTriple **first, BezTriple void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax, const short do_sel_only) { - float xminv=999999999.0f, xmaxv=-999999999.0f; - float yminv=999999999.0f, ymaxv=-999999999.0f; - short foundvert= FALSE; + float xminv = 999999999.0f, xmaxv = -999999999.0f; + float yminv = 999999999.0f, ymaxv = -999999999.0f; + short foundvert = FALSE; unsigned int i; if (fcu->totvert) { if (fcu->bezt) { - BezTriple *bezt_first= NULL, *bezt_last= NULL; + BezTriple *bezt_first = NULL, *bezt_last = NULL; if (xmin || xmax) { /* get endpoint keyframes */ @@ -495,8 +495,8 @@ void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa if (bezt_first) { BLI_assert(bezt_last != NULL); - xminv= MIN2(xminv, bezt_first->vec[1][0]); - xmaxv= MAX2(xmaxv, bezt_last->vec[1][0]); + xminv = MIN2(xminv, bezt_first->vec[1][0]); + xmaxv = MAX2(xmaxv, bezt_last->vec[1][0]); } } @@ -504,13 +504,13 @@ void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa if (ymin || ymax) { BezTriple *bezt; - for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) { + for (bezt = fcu->bezt, i = 0; i < fcu->totvert; bezt++, i++) { if ((do_sel_only == 0) || BEZSELECTED(bezt)) { if (bezt->vec[1][1] < yminv) - yminv= bezt->vec[1][1]; + yminv = bezt->vec[1][1]; if (bezt->vec[1][1] > ymaxv) - ymaxv= bezt->vec[1][1]; - foundvert= TRUE; + ymaxv = bezt->vec[1][1]; + foundvert = TRUE; } } } @@ -518,42 +518,42 @@ void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa else if (fcu->fpt) { /* frame range can be directly calculated from end verts */ if (xmin || xmax) { - xminv= MIN2(xminv, fcu->fpt[0].vec[0]); - xmaxv= MAX2(xmaxv, fcu->fpt[fcu->totvert-1].vec[0]); + xminv = MIN2(xminv, fcu->fpt[0].vec[0]); + xmaxv = MAX2(xmaxv, fcu->fpt[fcu->totvert - 1].vec[0]); } /* only loop over keyframes to find extents for values if needed */ if (ymin || ymax) { FPoint *fpt; - for (fpt=fcu->fpt, i=0; i < fcu->totvert; fpt++, i++) { + for (fpt = fcu->fpt, i = 0; i < fcu->totvert; fpt++, i++) { if (fpt->vec[1] < yminv) - yminv= fpt->vec[1]; + yminv = fpt->vec[1]; if (fpt->vec[1] > ymaxv) - ymaxv= fpt->vec[1]; + ymaxv = fpt->vec[1]; - foundvert= TRUE; + foundvert = TRUE; } } } } if (foundvert) { - if (xmin) *xmin= xminv; - if (xmax) *xmax= xmaxv; + if (xmin) *xmin = xminv; + if (xmax) *xmax = xmaxv; - if (ymin) *ymin= yminv; - if (ymax) *ymax= ymaxv; + if (ymin) *ymin = yminv; + if (ymax) *ymax = ymaxv; } else { if (G.debug & G_DEBUG) printf("F-Curve calc bounds didn't find anything, so assuming minimum bounds of 1.0\n"); - if (xmin) *xmin= 0.0f; - if (xmax) *xmax= 1.0f; + if (xmin) *xmin = 0.0f; + if (xmax) *xmax = 1.0f; - if (ymin) *ymin= 0.0f; - if (ymax) *ymax= 1.0f; + if (ymin) *ymin = 0.0f; + if (ymax) *ymax = 1.0f; } } @@ -561,12 +561,12 @@ void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa void calc_fcurve_range(FCurve *fcu, float *start, float *end, const short do_sel_only, const short do_min_length) { - float min=999999999.0f, max=-999999999.0f; - short foundvert= FALSE; + float min = 999999999.0f, max = -999999999.0f; + short foundvert = FALSE; if (fcu->totvert) { if (fcu->bezt) { - BezTriple *bezt_first= NULL, *bezt_last= NULL; + BezTriple *bezt_first = NULL, *bezt_last = NULL; /* get endpoint keyframes */ get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, do_sel_only); @@ -574,23 +574,23 @@ void calc_fcurve_range(FCurve *fcu, float *start, float *end, if (bezt_first) { BLI_assert(bezt_last != NULL); - min= MIN2(min, bezt_first->vec[1][0]); - max= MAX2(max, bezt_last->vec[1][0]); + min = MIN2(min, bezt_first->vec[1][0]); + max = MAX2(max, bezt_last->vec[1][0]); - foundvert= TRUE; + foundvert = TRUE; } } else if (fcu->fpt) { - min= MIN2(min, fcu->fpt[0].vec[0]); - max= MAX2(max, fcu->fpt[fcu->totvert-1].vec[0]); + min = MIN2(min, fcu->fpt[0].vec[0]); + max = MAX2(max, fcu->fpt[fcu->totvert - 1].vec[0]); - foundvert= TRUE; + foundvert = TRUE; } } if (foundvert == FALSE) { - min= max= 0.0f; + min = max = 0.0f; } if (do_min_length) { @@ -600,8 +600,8 @@ void calc_fcurve_range(FCurve *fcu, float *start, float *end, } } - *start= min; - *end= max; + *start = min; + *end = max; } /* ----------------- Status Checks -------------------------- */ @@ -628,7 +628,7 @@ short fcurve_are_keyframes_usable(FCurve *fcu) // TODO: optionally, only check modifier if it is the active one... for (fcm = fcu->modifiers.last; fcm; fcm = fcm->prev) { /* ignore if muted/disabled */ - if (fcm->flag & (FMODIFIER_FLAG_DISABLED|FMODIFIER_FLAG_MUTED)) + if (fcm->flag & (FMODIFIER_FLAG_DISABLED | FMODIFIER_FLAG_MUTED)) continue; /* type checks */ @@ -647,7 +647,7 @@ short fcurve_are_keyframes_usable(FCurve *fcu) if ((data->flag & FCM_GENERATOR_ADDITIVE) == 0) return 0; } - break; + break; case FMODIFIER_TYPE_FN_GENERATOR: { FMod_FunctionGenerator *data = (FMod_FunctionGenerator *)fcm->data; @@ -655,7 +655,7 @@ short fcurve_are_keyframes_usable(FCurve *fcu) if ((data->flag & FCM_GENERATOR_ADDITIVE) == 0) return 0; } - break; + break; /* always harmful - cannot allow */ default: @@ -692,10 +692,10 @@ void bezt_add_to_cfra_elem(ListBase *lb, BezTriple *bezt) { CfraElem *ce, *cen; - for (ce= lb->first; ce; ce= ce->next) { + for (ce = lb->first; ce; ce = ce->next) { /* double key? */ if (ce->cfra == bezt->vec[1][0]) { - if (bezt->f2 & SELECT) ce->sel= bezt->f2; + if (bezt->f2 & SELECT) ce->sel = bezt->f2; return; } /* should key be inserted before this column? */ @@ -703,12 +703,12 @@ void bezt_add_to_cfra_elem(ListBase *lb, BezTriple *bezt) } /* create a new column */ - cen= MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem"); + cen = MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem"); if (ce) BLI_insertlinkbefore(lb, ce, cen); else BLI_addtail(lb, cen); - cen->cfra= bezt->vec[1][0]; - cen->sel= bezt->f2; + cen->cfra = bezt->vec[1][0]; + cen->sel = bezt->f2; } /* ***************************** Samples Utilities ******************************* */ @@ -748,12 +748,12 @@ void fcurve_store_samples(FCurve *fcu, void *data, int start, int end, FcuSample } /* set up sample data */ - fpt= new_fpt= MEM_callocN(sizeof(FPoint)*(end-start+1), "FPoint Samples"); + fpt = new_fpt = MEM_callocN(sizeof(FPoint) * (end - start + 1), "FPoint Samples"); /* use the sampling callback at 1-frame intervals from start to end frames */ - for (cfra= start; cfra <= end; cfra++, fpt++) { - fpt->vec[0]= (float)cfra; - fpt->vec[1]= sample_cb(fcu, data, (float)cfra); + for (cfra = start; cfra <= end; cfra++, fpt++) { + fpt->vec[0] = (float)cfra; + fpt->vec[1] = sample_cb(fcu, data, (float)cfra); } /* free any existing sample/keyframe data on curve */ @@ -761,9 +761,9 @@ void fcurve_store_samples(FCurve *fcu, void *data, int start, int end, FcuSample if (fcu->fpt) MEM_freeN(fcu->fpt); /* store the samples */ - fcu->bezt= NULL; - fcu->fpt= new_fpt; - fcu->totvert= end - start + 1; + fcu->bezt = NULL; + fcu->fpt = new_fpt; + fcu->totvert = end - start + 1; } /* ***************************** F-Curve Sanity ********************************* */ @@ -778,7 +778,7 @@ void fcurve_store_samples(FCurve *fcu, void *data, int start, int end, FcuSample void calchandles_fcurve(FCurve *fcu) { BezTriple *bezt, *prev, *next; - int a= fcu->totvert; + int a = fcu->totvert; /* Error checking: * - need at least two points @@ -789,33 +789,33 @@ void calchandles_fcurve(FCurve *fcu) return; /* get initial pointers */ - bezt= fcu->bezt; - prev= NULL; - next= (bezt + 1); + bezt = fcu->bezt; + prev = NULL; + next = (bezt + 1); /* loop over all beztriples, adjusting handles */ while (a--) { /* clamp timing of handles to be on either side of beztriple */ - if (bezt->vec[0][0] > bezt->vec[1][0]) bezt->vec[0][0]= bezt->vec[1][0]; - if (bezt->vec[2][0] < bezt->vec[1][0]) bezt->vec[2][0]= bezt->vec[1][0]; + if (bezt->vec[0][0] > bezt->vec[1][0]) bezt->vec[0][0] = bezt->vec[1][0]; + if (bezt->vec[2][0] < bezt->vec[1][0]) bezt->vec[2][0] = bezt->vec[1][0]; /* calculate auto-handles */ - BKE_nurb_handle_calc(bezt, prev, next, 1); /* 1==special autohandle */ + BKE_nurb_handle_calc(bezt, prev, next, 1); /* 1==special autohandle */ /* for automatic ease in and out */ if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) { /* only do this on first or last beztriple */ - if ((a == 0) || (a == fcu->totvert-1)) { + if ((a == 0) || (a == fcu->totvert - 1)) { /* set both handles to have same horizontal value as keyframe */ if (fcu->extend == FCURVE_EXTRAPOLATE_CONSTANT) { - bezt->vec[0][1]= bezt->vec[2][1]= bezt->vec[1][1]; + bezt->vec[0][1] = bezt->vec[2][1] = bezt->vec[1][1]; } } } /* advance pointers for next iteration */ - prev= bezt; - if (a == 1) next= NULL; + prev = bezt; + if (a == 1) next = NULL; else next++; bezt++; } @@ -824,8 +824,8 @@ void calchandles_fcurve(FCurve *fcu) /* Use when F-Curve with handles has changed * It treats all BezTriples with the following rules: * - PHASE 1: do types have to be altered? - * -> Auto handles: become aligned when selection status is NOT(000 || 111) - * -> Vector handles: become 'nothing' when (one half selected AND other not) + * -> Auto handles: become aligned when selection status is NOT(000 || 111) + * -> Vector handles: become 'nothing' when (one half selected AND other not) * - PHASE 2: recalculate handles */ void testhandles_fcurve(FCurve *fcu, const short use_handle) @@ -838,41 +838,41 @@ void testhandles_fcurve(FCurve *fcu, const short use_handle) return; /* loop over beztriples */ - for (a=0, bezt=fcu->bezt; a < fcu->totvert; a++, bezt++) { - short flag= 0; + for (a = 0, bezt = fcu->bezt; a < fcu->totvert; a++, bezt++) { + short flag = 0; /* flag is initialized as selection status * of beztriple control-points (labelled 0,1,2) */ - if (bezt->f2 & SELECT) flag |= (1<<1); // == 2 + if (bezt->f2 & SELECT) flag |= (1 << 1); // == 2 if (use_handle == FALSE) { if (flag & 2) { - flag |= (1<<0) | (1<<2); + flag |= (1 << 0) | (1 << 2); } } else { - if (bezt->f1 & SELECT) flag |= (1<<0); // == 1 - if (bezt->f3 & SELECT) flag |= (1<<2); // == 4 + if (bezt->f1 & SELECT) flag |= (1 << 0); // == 1 + if (bezt->f3 & SELECT) flag |= (1 << 2); // == 4 } /* one or two handles selected only */ - if (ELEM(flag, 0, 7)==0) { + if (ELEM(flag, 0, 7) == 0) { /* auto handles become aligned */ if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM)) - bezt->h1= HD_ALIGN; + bezt->h1 = HD_ALIGN; if (ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) - bezt->h2= HD_ALIGN; + bezt->h2 = HD_ALIGN; /* vector handles become 'free' when only one half selected */ - if (bezt->h1==HD_VECT) { + if (bezt->h1 == HD_VECT) { /* only left half (1 or 2 or 1+2) */ if (flag < 4) - bezt->h1= 0; + bezt->h1 = 0; } - if (bezt->h2==HD_VECT) { + if (bezt->h2 == HD_VECT) { /* only right half (4 or 2+4) */ if (flag > 3) - bezt->h2= 0; + bezt->h2 = 0; } } } @@ -886,11 +886,11 @@ void testhandles_fcurve(FCurve *fcu, const short use_handle) */ void sort_time_fcurve(FCurve *fcu) { - short ok= 1; + short ok = 1; /* keep adjusting order of beztriples until nothing moves (bubble-sort) */ while (ok) { - ok= 0; + ok = 0; /* currently, will only be needed when there are beztriples */ if (fcu->bezt) { @@ -898,13 +898,13 @@ void sort_time_fcurve(FCurve *fcu) unsigned int a; /* loop over ALL points to adjust position in array and recalculate handles */ - for (a=0, bezt=fcu->bezt; a < fcu->totvert; a++, bezt++) { + for (a = 0, bezt = fcu->bezt; a < fcu->totvert; a++, bezt++) { /* check if thee's a next beztriple which we could try to swap with current */ - if (a < (fcu->totvert-1)) { + if (a < (fcu->totvert - 1)) { /* swap if one is after the other (and indicate that order has changed) */ - if (bezt->vec[1][0] > (bezt+1)->vec[1][0]) { - SWAP(BezTriple, *bezt, *(bezt+1)); - ok= 1; + if (bezt->vec[1][0] > (bezt + 1)->vec[1][0]) { + SWAP(BezTriple, *bezt, *(bezt + 1)); + ok = 1; } /* if either one of both of the points exceeds crosses over the keyframe time... */ @@ -916,9 +916,9 @@ void sort_time_fcurve(FCurve *fcu) else { /* clamp handles */ if (bezt->vec[0][0] > bezt->vec[1][0]) - bezt->vec[0][0]= bezt->vec[1][0]; + bezt->vec[0][0] = bezt->vec[1][0]; if (bezt->vec[2][0] < bezt->vec[1][0]) - bezt->vec[2][0]= bezt->vec[1][0]; + bezt->vec[2][0] = bezt->vec[1][0]; } } } @@ -940,8 +940,8 @@ short test_time_fcurve(FCurve *fcu) BezTriple *bezt; /* loop through all BezTriples, stopping when one exceeds the one after it */ - for (a=0, bezt= fcu->bezt; a < (fcu->totvert - 1); a++, bezt++) { - if (bezt->vec[1][0] > (bezt+1)->vec[1][0]) + for (a = 0, bezt = fcu->bezt; a < (fcu->totvert - 1); a++, bezt++) { + if (bezt->vec[1][0] > (bezt + 1)->vec[1][0]) return 1; } } @@ -949,8 +949,8 @@ short test_time_fcurve(FCurve *fcu) FPoint *fpt; /* loop through all FPoints, stopping when one exceeds the one after it */ - for (a=0, fpt= fcu->fpt; a < (fcu->totvert - 1); a++, fpt++) { - if (fpt->vec[0] > (fpt+1)->vec[0]) + for (a = 0, fpt = fcu->fpt; a < (fcu->totvert - 1); a++, fpt++) { + if (fpt->vec[0] > (fpt + 1)->vec[0]) return 1; } } @@ -969,9 +969,9 @@ typedef struct DriverVarTypeInfo { float (*get_value)(ChannelDriver *driver, DriverVar *dvar); /* allocation of target slots */ - int num_targets; /* number of target slots required */ - const char *target_names[MAX_DRIVER_TARGETS]; /* UI names that should be given to the slots */ - int target_flags[MAX_DRIVER_TARGETS]; /* flags defining the requirements for each slot */ + int num_targets; /* number of target slots required */ + const char *target_names[MAX_DRIVER_TARGETS]; /* UI names that should be given to the slots */ + int target_flags[MAX_DRIVER_TARGETS]; /* flags defining the requirements for each slot */ } DriverVarTypeInfo; /* Macro to begin definitions */ @@ -986,25 +986,25 @@ typedef struct DriverVarTypeInfo { static ID *dtar_id_ensure_proxy_from(ID *id) { - if (id && GS(id->name)==ID_OB && ((Object *)id)->proxy_from) + if (id && GS(id->name) == ID_OB && ((Object *)id)->proxy_from) return (ID *)(((Object *)id)->proxy_from); return id; } /* Helper function to obtain a value using RNA from the specified source (for evaluating drivers) */ -static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar) +static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar) { PointerRNA id_ptr, ptr; PropertyRNA *prop; ID *id; int index; - float value= 0.0f; + float value = 0.0f; /* sanity check */ if (ELEM(NULL, driver, dtar)) return 0.0f; - id= dtar_id_ensure_proxy_from(dtar->id); + id = dtar_id_ensure_proxy_from(dtar->id); /* error check for missing pointer... */ // TODO: tag the specific target too as having issues @@ -1024,37 +1024,37 @@ static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar) /* array */ if (index < RNA_property_array_length(&ptr, prop)) { switch (RNA_property_type(prop)) { + case PROP_BOOLEAN: + value = (float)RNA_property_boolean_get_index(&ptr, prop, index); + break; + case PROP_INT: + value = (float)RNA_property_int_get_index(&ptr, prop, index); + break; + case PROP_FLOAT: + value = RNA_property_float_get_index(&ptr, prop, index); + break; + default: + break; + } + } + } + else { + /* not an array */ + switch (RNA_property_type(prop)) { case PROP_BOOLEAN: - value= (float)RNA_property_boolean_get_index(&ptr, prop, index); + value = (float)RNA_property_boolean_get(&ptr, prop); break; case PROP_INT: - value= (float)RNA_property_int_get_index(&ptr, prop, index); + value = (float)RNA_property_int_get(&ptr, prop); break; case PROP_FLOAT: - value= RNA_property_float_get_index(&ptr, prop, index); + value = RNA_property_float_get(&ptr, prop); + break; + case PROP_ENUM: + value = (float)RNA_property_enum_get(&ptr, prop); break; default: break; - } - } - } - else { - /* not an array */ - switch (RNA_property_type(prop)) { - case PROP_BOOLEAN: - value= (float)RNA_property_boolean_get(&ptr, prop); - break; - case PROP_INT: - value= (float)RNA_property_int_get(&ptr, prop); - break; - case PROP_FLOAT: - value= RNA_property_float_get(&ptr, prop); - break; - case PROP_ENUM: - value= (float)RNA_property_enum_get(&ptr, prop); - break; - default: - break; } } @@ -1071,18 +1071,18 @@ static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar) } /* Helper function to obtain a pointer to a Pose Channel (for evaluating drivers) */ -static bPoseChannel *dtar_get_pchan_ptr (ChannelDriver *driver, DriverTarget *dtar) +static bPoseChannel *dtar_get_pchan_ptr(ChannelDriver *driver, DriverTarget *dtar) { ID *id; /* sanity check */ if (ELEM(NULL, driver, dtar)) return NULL; - id= dtar_id_ensure_proxy_from(dtar->id); + id = dtar_id_ensure_proxy_from(dtar->id); /* check if the ID here is a valid object */ if (id && GS(id->name)) { - Object *ob= (Object *)id; + Object *ob = (Object *)id; /* get pose, and subsequently, posechannel */ return BKE_pose_channel_find_name(ob->pose, dtar->pchan_name); @@ -1096,21 +1096,21 @@ static bPoseChannel *dtar_get_pchan_ptr (ChannelDriver *driver, DriverTarget *dt /* ......... */ /* evaluate 'single prop' driver variable */ -static float dvar_eval_singleProp (ChannelDriver *driver, DriverVar *dvar) +static float dvar_eval_singleProp(ChannelDriver *driver, DriverVar *dvar) { /* just evaluate the first target slot */ return dtar_get_prop_val(driver, &dvar->targets[0]); } /* evaluate 'rotation difference' driver variable */ -static float dvar_eval_rotDiff (ChannelDriver *driver, DriverVar *dvar) +static float dvar_eval_rotDiff(ChannelDriver *driver, DriverVar *dvar) { bPoseChannel *pchan, *pchan2; float q1[4], q2[4], quat[4], angle; /* get pose channels, and check if we've got two */ - pchan= dtar_get_pchan_ptr(driver, &dvar->targets[0]); - pchan2= dtar_get_pchan_ptr(driver, &dvar->targets[1]); + pchan = dtar_get_pchan_ptr(driver, &dvar->targets[0]); + pchan2 = dtar_get_pchan_ptr(driver, &dvar->targets[1]); if (ELEM(NULL, pchan, pchan2)) { /* disable this driver, since it doesn't work correctly... */ @@ -1135,14 +1135,14 @@ static float dvar_eval_rotDiff (ChannelDriver *driver, DriverVar *dvar) invert_qt(q1); mul_qt_qtqt(quat, q1, q2); angle = 2.0f * (saacos(quat[0])); - angle= ABS(angle); + angle = ABS(angle); return (angle > (float)M_PI) ? (float)((2.0f * (float)M_PI) - angle) : (float)(angle); } /* evaluate 'location difference' driver variable */ // TODO: this needs to take into account space conversions... -static float dvar_eval_locDiff (ChannelDriver *driver, DriverVar *dvar) +static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar) { float loc1[3] = {0.0f, 0.0f, 0.0f}; float loc2[3] = {0.0f, 0.0f, 0.0f}; @@ -1152,7 +1152,7 @@ static float dvar_eval_locDiff (ChannelDriver *driver, DriverVar *dvar) DRIVER_TARGETS_USED_LOOPER(dvar) { /* get pointer to loc values to store in */ - Object *ob= (Object *)dtar_id_ensure_proxy_from(dtar->id); + Object *ob = (Object *)dtar_id_ensure_proxy_from(dtar->id); bPoseChannel *pchan; float tmp_loc[3]; @@ -1164,7 +1164,7 @@ static float dvar_eval_locDiff (ChannelDriver *driver, DriverVar *dvar) } /* try to get posechannel */ - pchan= BKE_pose_channel_find_name(ob->pose, dtar->pchan_name); + pchan = BKE_pose_channel_find_name(ob->pose, dtar->pchan_name); /* check if object or bone */ if (pchan) { @@ -1234,14 +1234,14 @@ static float dvar_eval_locDiff (ChannelDriver *driver, DriverVar *dvar) } /* evaluate 'transform channel' driver variable */ -static float dvar_eval_transChan (ChannelDriver *driver, DriverVar *dvar) +static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar) { - DriverTarget *dtar= &dvar->targets[0]; - Object *ob= (Object *)dtar_id_ensure_proxy_from(dtar->id); + DriverTarget *dtar = &dvar->targets[0]; + Object *ob = (Object *)dtar_id_ensure_proxy_from(dtar->id); bPoseChannel *pchan; float mat[4][4]; float oldEul[3] = {0.0f, 0.0f, 0.0f}; - short useEulers=0, rotOrder=ROT_MODE_EUL; + short useEulers = 0, rotOrder = ROT_MODE_EUL; /* check if this target has valid data */ if ((ob == NULL) || (GS(ob->id.name) != ID_OB)) { @@ -1251,7 +1251,7 @@ static float dvar_eval_transChan (ChannelDriver *driver, DriverVar *dvar) } /* try to get posechannel */ - pchan= BKE_pose_channel_find_name(ob->pose, dtar->pchan_name); + pchan = BKE_pose_channel_find_name(ob->pose, dtar->pchan_name); /* check if object or bone, and get transform matrix accordingly * - "useEulers" code is used to prevent the problems associated with non-uniqueness @@ -1263,7 +1263,7 @@ static float dvar_eval_transChan (ChannelDriver *driver, DriverVar *dvar) /* bone */ if (pchan->rotmode > 0) { copy_v3_v3(oldEul, pchan->eul); - rotOrder= pchan->rotmode; + rotOrder = pchan->rotmode; useEulers = 1; } @@ -1290,7 +1290,7 @@ static float dvar_eval_transChan (ChannelDriver *driver, DriverVar *dvar) /* object */ if (ob->rotmode > 0) { copy_v3_v3(oldEul, ob->rot); - rotOrder= ob->rotmode; + rotOrder = ob->rotmode; useEulers = 1; } @@ -1353,36 +1353,36 @@ static float dvar_eval_transChan (ChannelDriver *driver, DriverVar *dvar) /* Table of Driver Varaiable Type Info Data */ static DriverVarTypeInfo dvar_types[MAX_DVAR_TYPES] = { BEGIN_DVAR_TYPEDEF(DVAR_TYPE_SINGLE_PROP) - dvar_eval_singleProp, /* eval callback */ - 1, /* number of targets used */ - {"Property"}, /* UI names for targets */ - {0} /* flags */ + dvar_eval_singleProp, /* eval callback */ + 1, /* number of targets used */ + {"Property"}, /* UI names for targets */ + {0} /* flags */ END_DVAR_TYPEDEF, BEGIN_DVAR_TYPEDEF(DVAR_TYPE_ROT_DIFF) - dvar_eval_rotDiff, /* eval callback */ - 2, /* number of targets used */ - {"Bone 1", "Bone 2"}, /* UI names for targets */ - {DTAR_FLAG_STRUCT_REF|DTAR_FLAG_ID_OB_ONLY, DTAR_FLAG_STRUCT_REF|DTAR_FLAG_ID_OB_ONLY} /* flags */ + dvar_eval_rotDiff, /* eval callback */ + 2, /* number of targets used */ + {"Bone 1", "Bone 2"}, /* UI names for targets */ + {DTAR_FLAG_STRUCT_REF | DTAR_FLAG_ID_OB_ONLY, DTAR_FLAG_STRUCT_REF | DTAR_FLAG_ID_OB_ONLY} /* flags */ END_DVAR_TYPEDEF, BEGIN_DVAR_TYPEDEF(DVAR_TYPE_LOC_DIFF) - dvar_eval_locDiff, /* eval callback */ - 2, /* number of targets used */ - {"Object/Bone 1", "Object/Bone 2"}, /* UI names for targets */ - {DTAR_FLAG_STRUCT_REF|DTAR_FLAG_ID_OB_ONLY, DTAR_FLAG_STRUCT_REF|DTAR_FLAG_ID_OB_ONLY} /* flags */ + dvar_eval_locDiff, /* eval callback */ + 2, /* number of targets used */ + {"Object/Bone 1", "Object/Bone 2"}, /* UI names for targets */ + {DTAR_FLAG_STRUCT_REF | DTAR_FLAG_ID_OB_ONLY, DTAR_FLAG_STRUCT_REF | DTAR_FLAG_ID_OB_ONLY} /* flags */ END_DVAR_TYPEDEF, BEGIN_DVAR_TYPEDEF(DVAR_TYPE_TRANSFORM_CHAN) - dvar_eval_transChan, /* eval callback */ - 1, /* number of targets used */ - {"Object/Bone"}, /* UI names for targets */ - {DTAR_FLAG_STRUCT_REF|DTAR_FLAG_ID_OB_ONLY} /* flags */ + dvar_eval_transChan, /* eval callback */ + 1, /* number of targets used */ + {"Object/Bone"}, /* UI names for targets */ + {DTAR_FLAG_STRUCT_REF | DTAR_FLAG_ID_OB_ONLY} /* flags */ END_DVAR_TYPEDEF, }; /* Get driver variable typeinfo */ -static DriverVarTypeInfo *get_dvar_typeinfo (int type) +static DriverVarTypeInfo *get_dvar_typeinfo(int type) { /* check if valid type */ if ((type >= 0) && (type < MAX_DVAR_TYPES)) @@ -1403,7 +1403,7 @@ void driver_free_variable(ChannelDriver *driver, DriverVar *dvar) /* free target vars * - need to go over all of them, not just up to the ones that are used * currently, since there may be some lingering RNA paths from - * previous users needing freeing + * previous users needing freeing */ DRIVER_TARGETS_LOOPER(dvar) { @@ -1418,7 +1418,7 @@ void driver_free_variable(ChannelDriver *driver, DriverVar *dvar) #ifdef WITH_PYTHON /* since driver variables are cached, the expression needs re-compiling too */ - if (driver->type==DRIVER_TYPE_PYTHON) + if (driver->type == DRIVER_TYPE_PYTHON) driver->flag |= DRIVER_FLAG_RENAMEVAR; #endif } @@ -1426,15 +1426,15 @@ void driver_free_variable(ChannelDriver *driver, DriverVar *dvar) /* Change the type of driver variable */ void driver_change_variable_type(DriverVar *dvar, int type) { - DriverVarTypeInfo *dvti= get_dvar_typeinfo(type); + DriverVarTypeInfo *dvti = get_dvar_typeinfo(type); /* sanity check */ if (ELEM(NULL, dvar, dvti)) return; /* set the new settings */ - dvar->type= type; - dvar->num_targets= dvti->num_targets; + dvar->type = type; + dvar->num_targets = dvti->num_targets; /* make changes to the targets based on the defines for these types * NOTE: only need to make sure the ones we're using here are valid... @@ -1448,13 +1448,13 @@ void driver_change_variable_type(DriverVar *dvar, int type) /* object ID types only, or idtype not yet initialized*/ if ((flags & DTAR_FLAG_ID_OB_ONLY) || (dtar->idtype == 0)) - dtar->idtype= ID_OB; + dtar->idtype = ID_OB; } DRIVER_TARGETS_LOOPER_END } /* Add a new driver variable */ -DriverVar *driver_add_new_variable (ChannelDriver *driver) +DriverVar *driver_add_new_variable(ChannelDriver *driver) { DriverVar *dvar; @@ -1463,7 +1463,7 @@ DriverVar *driver_add_new_variable (ChannelDriver *driver) return NULL; /* make a new variable */ - dvar= MEM_callocN(sizeof(DriverVar), "DriverVar"); + dvar = MEM_callocN(sizeof(DriverVar), "DriverVar"); BLI_addtail(&driver->variables, dvar); /* give the variable a 'unique' name */ @@ -1475,7 +1475,7 @@ DriverVar *driver_add_new_variable (ChannelDriver *driver) #ifdef WITH_PYTHON /* since driver variables are cached, the expression needs re-compiling too */ - if (driver->type==DRIVER_TYPE_PYTHON) + if (driver->type == DRIVER_TYPE_PYTHON) driver->flag |= DRIVER_FLAG_RENAMEVAR; #endif @@ -1492,11 +1492,11 @@ void fcurve_free_driver(FCurve *fcu) /* sanity checks */ if (ELEM(NULL, fcu, fcu->driver)) return; - driver= fcu->driver; + driver = fcu->driver; /* free driver targets */ - for (dvar= driver->variables.first; dvar; dvar= dvarn) { - dvarn= dvar->next; + for (dvar = driver->variables.first; dvar; dvar = dvarn) { + dvarn = dvar->next; driver_free_variable(driver, dvar); } @@ -1508,11 +1508,11 @@ void fcurve_free_driver(FCurve *fcu) /* free driver itself, then set F-Curve's point to this to NULL (as the curve may still be used) */ MEM_freeN(driver); - fcu->driver= NULL; + fcu->driver = NULL; } /* This makes a copy of the given driver */ -ChannelDriver *fcurve_copy_driver (ChannelDriver *driver) +ChannelDriver *fcurve_copy_driver(ChannelDriver *driver) { ChannelDriver *ndriver; DriverVar *dvar; @@ -1522,14 +1522,14 @@ ChannelDriver *fcurve_copy_driver (ChannelDriver *driver) return NULL; /* copy all data */ - ndriver= MEM_dupallocN(driver); - ndriver->expr_comp= NULL; + ndriver = MEM_dupallocN(driver); + ndriver->expr_comp = NULL; /* copy variables */ - ndriver->variables.first= ndriver->variables.last= NULL; + ndriver->variables.first = ndriver->variables.last = NULL; BLI_duplicatelist(&ndriver->variables, &driver->variables); - for (dvar= ndriver->variables.first; dvar; dvar= dvar->next) { + for (dvar = ndriver->variables.first; dvar; dvar = dvar->next) { /* need to go over all targets so that we don't leave any dangling paths */ DRIVER_TARGETS_LOOPER(dvar) { @@ -1559,21 +1559,21 @@ float driver_get_variable_value(ChannelDriver *driver, DriverVar *dvar) * using the variable type info, storing the obtained value * in dvar->curval so that drivers can be debugged */ - dvti= get_dvar_typeinfo(dvar->type); + dvti = get_dvar_typeinfo(dvar->type); if (dvti && dvti->get_value) - dvar->curval= dvti->get_value(driver, dvar); + dvar->curval = dvti->get_value(driver, dvar); else - dvar->curval= 0.0f; + dvar->curval = 0.0f; return dvar->curval; } /* Evaluate an Channel-Driver to get a 'time' value to use instead of "evaltime" * - "evaltime" is the frame at which F-Curve is being evaluated - * - has to return a float value + * - has to return a float value */ -static float evaluate_driver (ChannelDriver *driver, const float evaltime) +static float evaluate_driver(ChannelDriver *driver, const float evaltime) { DriverVar *dvar; @@ -1588,8 +1588,8 @@ static float evaluate_driver (ChannelDriver *driver, const float evaltime) /* check how many variables there are first (i.e. just one?) */ if (driver->variables.first == driver->variables.last) { /* just one target, so just use that */ - dvar= driver->variables.first; - driver->curval= driver_get_variable_value(driver, dvar); + dvar = driver->variables.first; + driver->curval = driver_get_variable_value(driver, dvar); } else { /* more than one target, so average the values of the targets */ @@ -1597,19 +1597,19 @@ static float evaluate_driver (ChannelDriver *driver, const float evaltime) int tot = 0; /* loop through targets, adding (hopefully we don't get any overflow!) */ - for (dvar= driver->variables.first; dvar; dvar=dvar->next) { + for (dvar = driver->variables.first; dvar; dvar = dvar->next) { value += driver_get_variable_value(driver, dvar); tot++; } /* perform operations on the total if appropriate */ if (driver->type == DRIVER_TYPE_AVERAGE) - driver->curval= (value / (float)tot); + driver->curval = (value / (float)tot); else - driver->curval= value; + driver->curval = value; } } - break; + break; case DRIVER_TYPE_MIN: /* smallest value */ case DRIVER_TYPE_MAX: /* largest value */ @@ -1617,9 +1617,9 @@ static float evaluate_driver (ChannelDriver *driver, const float evaltime) float value = 0.0f; /* loop through the variables, getting the values and comparing them to existing ones */ - for (dvar= driver->variables.first; dvar; dvar= dvar->next) { + for (dvar = driver->variables.first; dvar; dvar = dvar->next) { /* get value */ - float tmp_val= driver_get_variable_value(driver, dvar); + float tmp_val = driver_get_variable_value(driver, dvar); /* store this value if appropriate */ if (dvar->prev) { @@ -1627,51 +1627,51 @@ static float evaluate_driver (ChannelDriver *driver, const float evaltime) if (driver->type == DRIVER_TYPE_MAX) { /* max? */ if (tmp_val > value) - value= tmp_val; + value = tmp_val; } else { /* min? */ if (tmp_val < value) - value= tmp_val; + value = tmp_val; } } else { /* first item - make this the baseline for comparisons */ - value= tmp_val; + value = tmp_val; } } /* store value in driver */ - driver->curval= value; + driver->curval = value; } - break; + break; case DRIVER_TYPE_PYTHON: /* expression */ { #ifdef WITH_PYTHON /* check for empty or invalid expression */ if ( (driver->expression[0] == '\0') || - (driver->flag & DRIVER_FLAG_INVALID) ) + (driver->flag & DRIVER_FLAG_INVALID) ) { - driver->curval= 0.0f; + driver->curval = 0.0f; } else { /* this evaluates the expression using Python, and returns its result: - * - on errors it reports, then returns 0.0f + * - on errors it reports, then returns 0.0f */ - driver->curval= BPY_driver_exec(driver, evaltime); + driver->curval = BPY_driver_exec(driver, evaltime); } #else /* WITH_PYTHON*/ - (void)evaltime; + (void)evaltime; #endif /* WITH_PYTHON*/ } - break; + break; default: { /* special 'hack' - just use stored value * This is currently used as the mechanism which allows animated settings to be able - * to be changed via the UI. + * to be changed via the UI. */ } } @@ -1691,127 +1691,127 @@ void correct_bezpart(float v1[2], float v2[2], float v3[2], float v4[2]) float h1[2], h2[2], len1, len2, len, fac; /* calculate handle deltas */ - h1[0]= v1[0] - v2[0]; - h1[1]= v1[1] - v2[1]; + h1[0] = v1[0] - v2[0]; + h1[1] = v1[1] - v2[1]; - h2[0]= v4[0] - v3[0]; - h2[1]= v4[1] - v3[1]; + h2[0] = v4[0] - v3[0]; + h2[1] = v4[1] - v3[1]; /* calculate distances: - * - len = span of time between keyframes + * - len = span of time between keyframes * - len1 = length of handle of start key - * - len2 = length of handle of end key + * - len2 = length of handle of end key */ - len= v4[0]- v1[0]; - len1= fabsf(h1[0]); - len2= fabsf(h2[0]); + len = v4[0] - v1[0]; + len1 = fabsf(h1[0]); + len2 = fabsf(h2[0]); /* if the handles have no length, no need to do any corrections */ - if ((len1+len2) == 0.0f) + if ((len1 + len2) == 0.0f) return; /* the two handles cross over each other, so force them * apart using the proportion they overlap */ - if ((len1+len2) > len) { - fac= len / (len1+len2); + if ((len1 + len2) > len) { + fac = len / (len1 + len2); - v2[0]= (v1[0] - fac*h1[0]); - v2[1]= (v1[1] - fac*h1[1]); + v2[0] = (v1[0] - fac * h1[0]); + v2[1] = (v1[1] - fac * h1[1]); - v3[0]= (v4[0] - fac*h2[0]); - v3[1]= (v4[1] - fac*h2[1]); + v3[0] = (v4[0] - fac * h2[0]); + v3[1] = (v4[1] - fac * h2[1]); } } /* find root ('zero') */ -static int findzero (float x, float q0, float q1, float q2, float q3, float *o) +static int findzero(float x, float q0, float q1, float q2, float q3, float *o) { double c0, c1, c2, c3, a, b, c, p, q, d, t, phi; - int nr= 0; + int nr = 0; - c0= q0 - x; - c1= 3.0f * (q1 - q0); - c2= 3.0f * (q0 - 2.0f*q1 + q2); - c3= q3 - q0 + 3.0f * (q1 - q2); + c0 = q0 - x; + c1 = 3.0f * (q1 - q0); + c2 = 3.0f * (q0 - 2.0f * q1 + q2); + c3 = q3 - q0 + 3.0f * (q1 - q2); if (c3 != 0.0) { - a= c2/c3; - b= c1/c3; - c= c0/c3; - a= a/3; - - p= b/3 - a*a; - q= (2*a*a*a - a*b + c) / 2; - d= q*q + p*p*p; + a = c2 / c3; + b = c1 / c3; + c = c0 / c3; + a = a / 3; + + p = b / 3 - a * a; + q = (2 * a * a * a - a * b + c) / 2; + d = q * q + p * p * p; if (d > 0.0) { - t= sqrt(d); - o[0]= (float)(sqrt3d(-q+t) + sqrt3d(-q-t) - a); + t = sqrt(d); + o[0] = (float)(sqrt3d(-q + t) + sqrt3d(-q - t) - a); if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) return 1; else return 0; } else if (d == 0.0) { - t= sqrt3d(-q); - o[0]= (float)(2*t - a); + t = sqrt3d(-q); + o[0] = (float)(2 * t - a); if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) nr++; - o[nr]= (float)(-t-a); + o[nr] = (float)(-t - a); - if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) return nr+1; + if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) return nr + 1; else return nr; } else { - phi= acos(-q / sqrt(-(p*p*p))); - t= sqrt(-p); - p= cos(phi/3); - q= sqrt(3 - 3*p*p); - o[0]= (float)(2*t*p - a); + phi = acos(-q / sqrt(-(p * p * p))); + t = sqrt(-p); + p = cos(phi / 3); + q = sqrt(3 - 3 * p * p); + o[0] = (float)(2 * t * p - a); if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) nr++; - o[nr]= (float)(-t * (p + q) - a); + o[nr] = (float)(-t * (p + q) - a); if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) nr++; - o[nr]= (float)(-t * (p - q) - a); + o[nr] = (float)(-t * (p - q) - a); - if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) return nr+1; + if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) return nr + 1; else return nr; } } else { - a=c2; - b=c1; - c=c0; + a = c2; + b = c1; + c = c0; if (a != 0.0) { // discriminant - p= b*b - 4*a*c; + p = b * b - 4 * a * c; if (p > 0) { - p= sqrt(p); - o[0]= (float)((-b-p) / (2 * a)); + p = sqrt(p); + o[0] = (float)((-b - p) / (2 * a)); if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) nr++; - o[nr]= (float)((-b+p)/(2*a)); + o[nr] = (float)((-b + p) / (2 * a)); - if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) return nr+1; + if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) return nr + 1; else return nr; } else if (p == 0) { - o[0]= (float)(-b / (2 * a)); + o[0] = (float)(-b / (2 * a)); if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) return 1; else return 0; } } else if (b != 0.0) { - o[0]= (float)(-c/b); + o[0] = (float)(-c / b); if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) return 1; else return 0; } else if (c == 0.0) { - o[0]= 0.0; + o[0] = 0.0; return 1; } @@ -1819,36 +1819,36 @@ static int findzero (float x, float q0, float q1, float q2, float q3, float *o) } } -static void berekeny (float f1, float f2, float f3, float f4, float *o, int b) +static void berekeny(float f1, float f2, float f3, float f4, float *o, int b) { float t, c0, c1, c2, c3; int a; - c0= f1; - c1= 3.0f * (f2 - f1); - c2= 3.0f * (f1 - 2.0f*f2 + f3); - c3= f4 - f1 + 3.0f * (f2 - f3); - - for (a=0; a < b; a++) { - t= o[a]; - o[a]= c0 + t*c1 + t*t*c2 + t*t*t*c3; + c0 = f1; + c1 = 3.0f * (f2 - f1); + c2 = 3.0f * (f1 - 2.0f * f2 + f3); + c3 = f4 - f1 + 3.0f * (f2 - f3); + + for (a = 0; a < b; a++) { + t = o[a]; + o[a] = c0 + t * c1 + t * t * c2 + t * t * t * c3; } } #if 0 -static void berekenx (float *f, float *o, int b) +static void berekenx(float *f, float *o, int b) { float t, c0, c1, c2, c3; int a; - c0= f[0]; - c1= 3.0f * (f[3] - f[0]); - c2= 3.0f * (f[0] - 2.0f*f[3] + f[6]); - c3= f[9] - f[0] + 3.0f * (f[3] - f[6]); - - for (a=0; a < b; a++) { - t= o[a]; - o[a]= c0 + t*c1 + t*t*c2 + t*t*t*c3; + c0 = f[0]; + c1 = 3.0f * (f[3] - f[0]); + c2 = 3.0f * (f[0] - 2.0f * f[3] + f[6]); + c3 = f[9] - f[0] + 3.0f * (f[3] - f[6]); + + for (a = 0; a < b; a++) { + t = o[a]; + o[a] = c0 + t * c1 + t * t * c2 + t * t * t * c3; } } #endif @@ -1857,7 +1857,7 @@ static void berekenx (float *f, float *o, int b) /* -------------------------- */ /* Calculate F-Curve value for 'evaltime' using BezTriple keyframes */ -static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltime) +static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime) { BezTriple *bezt, *prevbezt, *lastbezt; float v1[2], v2[2], v3[2], v4[2], opl[32], dx, fac; @@ -1866,37 +1866,37 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim float cvalue = 0.0f; /* get pointers */ - a= fcu->totvert-1; - prevbezt= bezts; - bezt= prevbezt+1; - lastbezt= prevbezt + a; + a = fcu->totvert - 1; + prevbezt = bezts; + bezt = prevbezt + 1; + lastbezt = prevbezt + a; /* evaluation time at or past endpoints? */ if (prevbezt->vec[1][0] >= evaltime) { /* before or on first keyframe */ if ( (fcu->extend == FCURVE_EXTRAPOLATE_LINEAR) && (prevbezt->ipo != BEZT_IPO_CONST) && - !(fcu->flag & FCURVE_DISCRETE_VALUES) ) + !(fcu->flag & FCURVE_DISCRETE_VALUES) ) { /* linear or bezier interpolation */ - if (prevbezt->ipo==BEZT_IPO_LIN) { + if (prevbezt->ipo == BEZT_IPO_LIN) { /* Use the next center point instead of our own handle for * linear interpolated extrapolate */ if (fcu->totvert == 1) { - cvalue= prevbezt->vec[1][1]; + cvalue = prevbezt->vec[1][1]; } else { - bezt = prevbezt+1; - dx= prevbezt->vec[1][0] - evaltime; - fac= bezt->vec[1][0] - prevbezt->vec[1][0]; + bezt = prevbezt + 1; + dx = prevbezt->vec[1][0] - evaltime; + fac = bezt->vec[1][0] - prevbezt->vec[1][0]; /* prevent division by zero */ if (fac) { - fac= (bezt->vec[1][1] - prevbezt->vec[1][1]) / fac; - cvalue= prevbezt->vec[1][1] - (fac * dx); + fac = (bezt->vec[1][1] - prevbezt->vec[1][1]) / fac; + cvalue = prevbezt->vec[1][1] - (fac * dx); } else { - cvalue= prevbezt->vec[1][1]; + cvalue = prevbezt->vec[1][1]; } } } @@ -1904,16 +1904,16 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim /* Use the first handle (earlier) of first BezTriple to calculate the * gradient and thus the value of the curve at evaltime */ - dx= prevbezt->vec[1][0] - evaltime; - fac= prevbezt->vec[1][0] - prevbezt->vec[0][0]; + dx = prevbezt->vec[1][0] - evaltime; + fac = prevbezt->vec[1][0] - prevbezt->vec[0][0]; /* prevent division by zero */ if (fac) { - fac= (prevbezt->vec[1][1] - prevbezt->vec[0][1]) / fac; - cvalue= prevbezt->vec[1][1] - (fac * dx); + fac = (prevbezt->vec[1][1] - prevbezt->vec[0][1]) / fac; + cvalue = prevbezt->vec[1][1] - (fac * dx); } else { - cvalue= prevbezt->vec[1][1]; + cvalue = prevbezt->vec[1][1]; } } } @@ -1921,34 +1921,34 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim /* constant (BEZT_IPO_HORIZ) extrapolation or constant interpolation, * so just extend first keyframe's value */ - cvalue= prevbezt->vec[1][1]; + cvalue = prevbezt->vec[1][1]; } } else if (lastbezt->vec[1][0] <= evaltime) { /* after or on last keyframe */ if ( (fcu->extend == FCURVE_EXTRAPOLATE_LINEAR) && (lastbezt->ipo != BEZT_IPO_CONST) && - !(fcu->flag & FCURVE_DISCRETE_VALUES) ) + !(fcu->flag & FCURVE_DISCRETE_VALUES) ) { /* linear or bezier interpolation */ - if (lastbezt->ipo==BEZT_IPO_LIN) { + if (lastbezt->ipo == BEZT_IPO_LIN) { /* Use the next center point instead of our own handle for * linear interpolated extrapolate */ if (fcu->totvert == 1) { - cvalue= lastbezt->vec[1][1]; + cvalue = lastbezt->vec[1][1]; } else { prevbezt = lastbezt - 1; - dx= evaltime - lastbezt->vec[1][0]; - fac= lastbezt->vec[1][0] - prevbezt->vec[1][0]; + dx = evaltime - lastbezt->vec[1][0]; + fac = lastbezt->vec[1][0] - prevbezt->vec[1][0]; /* prevent division by zero */ if (fac) { - fac= (lastbezt->vec[1][1] - prevbezt->vec[1][1]) / fac; - cvalue= lastbezt->vec[1][1] + (fac * dx); + fac = (lastbezt->vec[1][1] - prevbezt->vec[1][1]) / fac; + cvalue = lastbezt->vec[1][1] + (fac * dx); } else { - cvalue= lastbezt->vec[1][1]; + cvalue = lastbezt->vec[1][1]; } } } @@ -1956,16 +1956,16 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim /* Use the gradient of the second handle (later) of last BezTriple to calculate the * gradient and thus the value of the curve at evaltime */ - dx= evaltime - lastbezt->vec[1][0]; - fac= lastbezt->vec[2][0] - lastbezt->vec[1][0]; + dx = evaltime - lastbezt->vec[1][0]; + fac = lastbezt->vec[2][0] - lastbezt->vec[1][0]; /* prevent division by zero */ if (fac) { - fac= (lastbezt->vec[2][1] - lastbezt->vec[1][1]) / fac; - cvalue= lastbezt->vec[1][1] + (fac * dx); + fac = (lastbezt->vec[2][1] - lastbezt->vec[1][1]) / fac; + cvalue = lastbezt->vec[1][1] + (fac * dx); } else { - cvalue= lastbezt->vec[1][1]; + cvalue = lastbezt->vec[1][1]; } } } @@ -1973,57 +1973,57 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim /* constant (BEZT_IPO_HORIZ) extrapolation or constant interpolation, * so just extend last keyframe's value */ - cvalue= lastbezt->vec[1][1]; + cvalue = lastbezt->vec[1][1]; } } else { /* evaltime occurs somewhere in the middle of the curve */ - for (a=0; prevbezt && bezt && (a < fcu->totvert-1); a++, prevbezt=bezt, bezt++) { + for (a = 0; prevbezt && bezt && (a < fcu->totvert - 1); a++, prevbezt = bezt, bezt++) { /* use if the key is directly on the frame, rare cases this is needed else we get 0.0 instead. */ if (fabsf(bezt->vec[1][0] - evaltime) < SMALL_NUMBER) { - cvalue= bezt->vec[1][1]; + cvalue = bezt->vec[1][1]; } /* evaltime occurs within the interval defined by these two keyframes */ else if ((prevbezt->vec[1][0] <= evaltime) && (bezt->vec[1][0] >= evaltime)) { /* value depends on interpolation mode */ if ((prevbezt->ipo == BEZT_IPO_CONST) || (fcu->flag & FCURVE_DISCRETE_VALUES)) { /* constant (evaltime not relevant, so no interpolation needed) */ - cvalue= prevbezt->vec[1][1]; + cvalue = prevbezt->vec[1][1]; } else if (prevbezt->ipo == BEZT_IPO_LIN) { /* linear - interpolate between values of the two keyframes */ - fac= bezt->vec[1][0] - prevbezt->vec[1][0]; + fac = bezt->vec[1][0] - prevbezt->vec[1][0]; /* prevent division by zero */ if (fac) { - fac= (evaltime - prevbezt->vec[1][0]) / fac; - cvalue= prevbezt->vec[1][1] + (fac * (bezt->vec[1][1] - prevbezt->vec[1][1])); + fac = (evaltime - prevbezt->vec[1][0]) / fac; + cvalue = prevbezt->vec[1][1] + (fac * (bezt->vec[1][1] - prevbezt->vec[1][1])); } else { - cvalue= prevbezt->vec[1][1]; + cvalue = prevbezt->vec[1][1]; } } else { /* bezier interpolation */ - /* v1,v2 are the first keyframe and its 2nd handle */ - v1[0]= prevbezt->vec[1][0]; - v1[1]= prevbezt->vec[1][1]; - v2[0]= prevbezt->vec[2][0]; - v2[1]= prevbezt->vec[2][1]; - /* v3,v4 are the last keyframe's 1st handle + the last keyframe */ - v3[0]= bezt->vec[0][0]; - v3[1]= bezt->vec[0][1]; - v4[0]= bezt->vec[1][0]; - v4[1]= bezt->vec[1][1]; + /* v1,v2 are the first keyframe and its 2nd handle */ + v1[0] = prevbezt->vec[1][0]; + v1[1] = prevbezt->vec[1][1]; + v2[0] = prevbezt->vec[2][0]; + v2[1] = prevbezt->vec[2][1]; + /* v3,v4 are the last keyframe's 1st handle + the last keyframe */ + v3[0] = bezt->vec[0][0]; + v3[1] = bezt->vec[0][1]; + v4[0] = bezt->vec[1][0]; + v4[1] = bezt->vec[1][1]; /* adjust handles so that they don't overlap (forming a loop) */ correct_bezpart(v1, v2, v3, v4); /* try to get a value for this position - if failure, try another set of points */ - b= findzero(evaltime, v1[0], v2[0], v3[0], v4[0], opl); + b = findzero(evaltime, v1[0], v2[0], v3[0], v4[0], opl); if (b) { berekeny(v1[1], v2[1], v3[1], v4[1], opl, 1); - cvalue= opl[0]; + cvalue = opl[0]; break; } } @@ -2036,35 +2036,35 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim } /* Calculate F-Curve value for 'evaltime' using FPoint samples */ -static float fcurve_eval_samples (FCurve *fcu, FPoint *fpts, float evaltime) +static float fcurve_eval_samples(FCurve *fcu, FPoint *fpts, float evaltime) { FPoint *prevfpt, *lastfpt, *fpt; - float cvalue= 0.0f; + float cvalue = 0.0f; /* get pointers */ - prevfpt= fpts; - lastfpt= prevfpt + fcu->totvert-1; + prevfpt = fpts; + lastfpt = prevfpt + fcu->totvert - 1; /* evaluation time at or past endpoints? */ if (prevfpt->vec[0] >= evaltime) { /* before or on first sample, so just extend value */ - cvalue= prevfpt->vec[1]; + cvalue = prevfpt->vec[1]; } else if (lastfpt->vec[0] <= evaltime) { /* after or on last sample, so just extend value */ - cvalue= lastfpt->vec[1]; + cvalue = lastfpt->vec[1]; } else { - float t= (float)abs(evaltime - (int)evaltime); + float t = (float)abs(evaltime - (int)evaltime); /* find the one on the right frame (assume that these are spaced on 1-frame intervals) */ - fpt= prevfpt + (int)(evaltime - prevfpt->vec[0]); + fpt = prevfpt + (int)(evaltime - prevfpt->vec[0]); /* if not exactly on the frame, perform linear interpolation with the next one */ if (t != 0.0f) - cvalue= interpf(fpt->vec[1], (fpt+1)->vec[1], t); + cvalue = interpf(fpt->vec[1], (fpt + 1)->vec[1], t); else - cvalue= fpt->vec[1]; + cvalue = fpt->vec[1]; } /* return value */ @@ -2078,7 +2078,7 @@ static float fcurve_eval_samples (FCurve *fcu, FPoint *fpts, float evaltime) */ float evaluate_fcurve(FCurve *fcu, float evaltime) { - float cvalue= 0.0f; + float cvalue = 0.0f; float devaltime; /* if there is a driver (only if this F-Curve is acting as 'driver'), evaluate it to find value to use as "evaltime" @@ -2087,20 +2087,20 @@ float evaluate_fcurve(FCurve *fcu, float evaltime) */ if (fcu->driver) { /* evaltime now serves as input for the curve */ - evaltime= cvalue= evaluate_driver(fcu->driver, evaltime); + evaltime = cvalue = evaluate_driver(fcu->driver, evaltime); } /* evaluate modifiers which modify time to evaluate the base curve at */ - devaltime= evaluate_time_fmodifiers(&fcu->modifiers, fcu, cvalue, evaltime); + devaltime = evaluate_time_fmodifiers(&fcu->modifiers, fcu, cvalue, evaltime); /* evaluate curve-data * - 'devaltime' instead of 'evaltime', as this is the time that the last time-modifying * F-Curve modifier on the stack requested the curve to be evaluated at */ if (fcu->bezt) - cvalue= fcurve_eval_keyframes(fcu, fcu->bezt, devaltime); + cvalue = fcurve_eval_keyframes(fcu, fcu->bezt, devaltime); else if (fcu->fpt) - cvalue= fcurve_eval_samples(fcu, fcu->fpt, devaltime); + cvalue = fcurve_eval_samples(fcu, fcu->fpt, devaltime); /* evaluate modifiers */ evaluate_value_fmodifiers(&fcu->modifiers, fcu, &cvalue, evaltime); @@ -2109,7 +2109,7 @@ float evaluate_fcurve(FCurve *fcu, float evaltime) * here so that the curve can be sampled correctly */ if (fcu->flag & FCURVE_INT_VALUES) - cvalue= floorf(cvalue + 0.5f); + cvalue = floorf(cvalue + 0.5f); /* return evaluated value */ return cvalue; @@ -2125,7 +2125,7 @@ void calculate_fcurve(FCurve *fcu, float ctime) list_has_suitable_fmodifier(&fcu->modifiers, 0, FMI_TYPE_GENERATE_CURVE)) { /* calculate and set curval (evaluates driver too if necessary) */ - fcu->curval= evaluate_fcurve(fcu, ctime); + fcu->curval = evaluate_fcurve(fcu, ctime); } } |