diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2020-06-05 10:30:15 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2020-06-05 10:30:15 +0300 |
commit | e8b8e16b24ade2ca0861cb40a8b4e800a3fb0729 (patch) | |
tree | e67319705fec014344ddff39fc6a92c1cc85b5bc /source/blender/blenkernel | |
parent | fe6be70875bca64e555d1cbedf1c2160493cf0e2 (diff) |
Code Cleanup: fcurve function naming
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_fcurve.h | 69 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim_data.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 85 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/ipo.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/nla.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 4 |
9 files changed, 92 insertions, 98 deletions
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index b310d66d4bd..c3a597e29b9 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -180,18 +180,18 @@ int BKE_fcm_envelope_find_index(struct FCM_EnvelopeData *array, /* -------- Data Management -------- */ struct FCurve *BKE_fcurve_create(void); -void free_fcurve(struct FCurve *fcu); -struct FCurve *copy_fcurve(const struct FCurve *fcu); +void BKE_fcurve_free(struct FCurve *fcu); +struct FCurve *BKE_fcurve_copy(const struct FCurve *fcu); -void free_fcurves(ListBase *list); -void copy_fcurves(ListBase *dst, ListBase *src); +void BKE_fcurves_free(ListBase *list); +void BKE_fcurves_copy(ListBase *dst, ListBase *src); void BKE_fcurve_foreach_id(struct FCurve *fcu, struct LibraryForeachIDData *data); /* find matching F-Curve in the given list of F-Curves */ -struct FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int array_index); +struct FCurve *BKE_fcurve_find(ListBase *list, const char rna_path[], const int array_index); -struct FCurve *iter_step_fcurve(struct FCurve *fcu_iter, const char rna_path[]); +struct FCurve *BKE_fcurve_iter_step(struct FCurve *fcu_iter, const char rna_path[]); /* high level function to get an fcurve from C without having the rna */ struct FCurve *id_data_find_fcurve( @@ -199,31 +199,28 @@ struct FCurve *id_data_find_fcurve( /* Get list of LinkData's containing pointers to the F-Curves which control the types of data * indicated - * e.g. numMatches = list_find_data_fcurves(matches, &act->curves, "pose.bones[", "MyFancyBone"); + * e.g. numMatches = BKE_fcurves_filter(matches, &act->curves, "pose.bones[", "MyFancyBone"); */ -int list_find_data_fcurves(ListBase *dst, - ListBase *src, - const char *dataPrefix, - const char *dataName); +int BKE_fcurves_filter(ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName); /* Find an f-curve based on an rna property. */ -struct FCurve *rna_get_fcurve(struct PointerRNA *ptr, - struct PropertyRNA *prop, - int rnaindex, - struct AnimData **r_adt, - struct bAction **r_action, - bool *r_driven, - bool *r_special); +struct FCurve *BKE_fcurve_find_by_rna(struct PointerRNA *ptr, + struct PropertyRNA *prop, + int rnaindex, + struct AnimData **r_adt, + struct bAction **r_action, + bool *r_driven, + bool *r_special); /* Same as above, but takes a context data, * temp hack needed for complex paths like texture ones. */ -struct FCurve *rna_get_fcurve_context_ui(struct bContext *C, - struct PointerRNA *ptr, - struct PropertyRNA *prop, - int rnaindex, - struct AnimData **r_animdata, - struct bAction **r_action, - bool *r_driven, - bool *r_special); +struct FCurve *BKE_fcurve_find_by_rna_context_ui(struct bContext *C, + struct PointerRNA *ptr, + struct PropertyRNA *prop, + int rnaindex, + struct AnimData **r_animdata, + struct bAction **r_action, + bool *r_driven, + bool *r_special); /* Binary search algorithm for finding where to 'insert' BezTriple with given frame number. * Returns the index to insert at (data already at that index will be offset if replace is 0) @@ -231,25 +228,25 @@ struct FCurve *rna_get_fcurve_context_ui(struct bContext *C, int binarysearch_bezt_index(struct BezTriple array[], float frame, int arraylen, bool *r_replace); /* get the time extents for F-Curve */ -bool calc_fcurve_range( +bool BKE_fcurve_calc_range( struct FCurve *fcu, float *min, float *max, const bool do_sel_only, const bool do_min_length); /* get the bounding-box extents for F-Curve */ -bool calc_fcurve_bounds(struct FCurve *fcu, - float *xmin, - float *xmax, - float *ymin, - float *ymax, - const bool do_sel_only, - const bool include_handles); +bool BKE_fcurve_calc_bounds(struct FCurve *fcu, + float *xmin, + float *xmax, + float *ymin, + float *ymax, + const bool do_sel_only, + const bool include_handles); /* .............. */ /* Are keyframes on F-Curve of any use (to final result, and to show in editors)? */ -bool fcurve_are_keyframes_usable(struct FCurve *fcu); +bool BKE_fcurve_are_keyframes_usable(struct FCurve *fcu); /* Can keyframes be added to F-Curve? */ -bool fcurve_is_keyframable(struct FCurve *fcu); +bool BKE_fcurve_is_keyframable(struct FCurve *fcu); bool BKE_fcurve_is_protected(struct FCurve *fcu); /* The curve is an infinite cycle via Cycles modifier */ diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index ca58b69689c..c776f0d077d 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -116,7 +116,7 @@ static void action_copy_data(Main *UNUSED(bmain), /* XXX TODO pass subdata flag? * But surprisingly does not seem to be doing any ID refcounting... */ - fcurve_dst = copy_fcurve(fcurve_src); + fcurve_dst = BKE_fcurve_copy(fcurve_src); BLI_addtail(&action_dst->curves, fcurve_dst); @@ -146,7 +146,7 @@ static void action_free_data(struct ID *id) /* No animdata here. */ /* Free F-Curves. */ - free_fcurves(&action->curves); + BKE_fcurves_free(&action->curves); /* Free groups. */ BLI_freelistN(&action->groups); @@ -1310,7 +1310,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_ * single-keyframe curves will increase the overall length by * a phantom frame (T50354) */ - calc_fcurve_range(fcu, &nmin, &nmax, false, false); + BKE_fcurve_calc_range(fcu, &nmin, &nmax, false, false); /* compare to the running tally */ min = min_ff(min, nmin); diff --git a/source/blender/blenkernel/intern/anim_data.c b/source/blender/blenkernel/intern/anim_data.c index 726753a4e70..9ab4e5c028d 100644 --- a/source/blender/blenkernel/intern/anim_data.c +++ b/source/blender/blenkernel/intern/anim_data.c @@ -256,7 +256,7 @@ void BKE_animdata_free(ID *id, const bool do_id_user) BKE_nla_tracks_free(&adt->nla_tracks, do_id_user); /* free drivers - stored as a list of F-Curves */ - free_fcurves(&adt->drivers); + BKE_fcurves_free(&adt->drivers); /* free driver array cache */ MEM_SAFE_FREE(adt->driver_array); @@ -345,7 +345,7 @@ AnimData *BKE_animdata_copy(Main *bmain, AnimData *adt, const int flag) BKE_nla_tracks_copy(bmain, &dadt->nla_tracks, &adt->nla_tracks, flag); /* duplicate drivers (F-Curves) */ - copy_fcurves(&dadt->drivers, &adt->drivers); + BKE_fcurves_copy(&dadt->drivers, &adt->drivers); dadt->driver_array = NULL; /* don't copy overrides */ @@ -447,7 +447,7 @@ void BKE_animdata_merge_copy( if (src->drivers.first) { ListBase drivers = {NULL, NULL}; - copy_fcurves(&drivers, &src->drivers); + BKE_fcurves_copy(&drivers, &src->drivers); /* Fix up all driver targets using the old target id * - This assumes that the src ID is being merged into the dst ID @@ -1101,7 +1101,7 @@ static bool fcurves_path_remove_fix(const char *prefix, ListBase *curves) if (fcu->rna_path) { if (STRPREFIX(fcu->rna_path, prefix)) { BLI_remlink(curves, fcu); - free_fcurve(fcu); + BKE_fcurve_free(fcu); any_removed = true; } } diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 5eb1b756ac7..d4754615c7f 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -66,7 +66,7 @@ FCurve *BKE_fcurve_create(void) /* ---------------------- Freeing --------------------------- */ /* Frees the F-Curve itself too, so make sure BLI_remlink is called before calling this... */ -void free_fcurve(FCurve *fcu) +void BKE_fcurve_free(FCurve *fcu) { if (fcu == NULL) { return; @@ -88,7 +88,7 @@ void free_fcurve(FCurve *fcu) } /* Frees a list of F-Curves */ -void free_fcurves(ListBase *list) +void BKE_fcurves_free(ListBase *list) { FCurve *fcu, *fcn; @@ -103,7 +103,7 @@ void free_fcurves(ListBase *list) */ for (fcu = list->first; fcu; fcu = fcn) { fcn = fcu->next; - free_fcurve(fcu); + BKE_fcurve_free(fcu); } /* clear pointers just in case */ @@ -113,7 +113,7 @@ void free_fcurves(ListBase *list) /* ---------------------- Copy --------------------------- */ /* duplicate an F-Curve */ -FCurve *copy_fcurve(const FCurve *fcu) +FCurve *BKE_fcurve_copy(const FCurve *fcu) { FCurve *fcu_d; @@ -146,7 +146,7 @@ FCurve *copy_fcurve(const FCurve *fcu) } /* duplicate a list of F-Curves */ -void copy_fcurves(ListBase *dst, ListBase *src) +void BKE_fcurves_copy(ListBase *dst, ListBase *src) { FCurve *dfcu, *sfcu; @@ -160,7 +160,7 @@ void copy_fcurves(ListBase *dst, ListBase *src) /* copy one-by-one */ for (sfcu = src->first; sfcu; sfcu = sfcu->next) { - dfcu = copy_fcurve(sfcu); + dfcu = BKE_fcurve_copy(sfcu); BLI_addtail(dst, dfcu); } } @@ -234,12 +234,12 @@ FCurve *id_data_find_fcurve( /* animation takes priority over drivers */ if (adt->action && adt->action->curves.first) { - fcu = list_find_fcurve(&adt->action->curves, path, index); + fcu = BKE_fcurve_find(&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 = BKE_fcurve_find(&adt->drivers, path, index); if (fcu && r_driven) { *r_driven = true; } @@ -253,7 +253,7 @@ FCurve *id_data_find_fcurve( /* 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 *BKE_fcurve_find(ListBase *list, const char rna_path[], const int array_index) { FCurve *fcu; @@ -278,7 +278,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 *BKE_fcurve_iter_step(FCurve *fcu_iter, const char rna_path[]) { FCurve *fcu; @@ -311,10 +311,7 @@ FCurve *iter_step_fcurve(FCurve *fcu_iter, const char rna_path[]) * - 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) +int BKE_fcurves_filter(ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName) { FCurve *fcu; int matches = 0; @@ -356,26 +353,26 @@ int list_find_data_fcurves(ListBase *dst, return matches; } -FCurve *rna_get_fcurve(PointerRNA *ptr, - PropertyRNA *prop, - int rnaindex, - AnimData **r_adt, - bAction **r_action, - bool *r_driven, - bool *r_special) +FCurve *BKE_fcurve_find_by_rna(PointerRNA *ptr, + PropertyRNA *prop, + int rnaindex, + AnimData **r_adt, + bAction **r_action, + bool *r_driven, + bool *r_special) { - return rna_get_fcurve_context_ui( + return BKE_fcurve_find_by_rna_context_ui( NULL, ptr, prop, rnaindex, r_adt, r_action, r_driven, r_special); } -FCurve *rna_get_fcurve_context_ui(bContext *C, - PointerRNA *ptr, - PropertyRNA *prop, - int rnaindex, - AnimData **r_animdata, - bAction **r_action, - bool *r_driven, - bool *r_special) +FCurve *BKE_fcurve_find_by_rna_context_ui(bContext *C, + PointerRNA *ptr, + PropertyRNA *prop, + int rnaindex, + AnimData **r_animdata, + bAction **r_action, + bool *r_driven, + bool *r_special) { FCurve *fcu = NULL; PointerRNA tptr = *ptr; @@ -400,7 +397,7 @@ FCurve *rna_get_fcurve_context_ui(bContext *C, *r_special = true; /* The F-Curve either exists or it doesn't here... */ - fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), rnaindex); + fcu = BKE_fcurve_find(&strip->fcurves, RNA_property_identifier(prop), rnaindex); return fcu; } @@ -436,7 +433,7 @@ FCurve *rna_get_fcurve_context_ui(bContext *C, // XXX: the logic here is duplicated with a function up above /* animation takes priority over drivers */ if (adt->action && adt->action->curves.first) { - fcu = list_find_fcurve(&adt->action->curves, path, rnaindex); + fcu = BKE_fcurve_find(&adt->action->curves, path, rnaindex); if (fcu && r_action) { *r_action = adt->action; @@ -445,7 +442,7 @@ FCurve *rna_get_fcurve_context_ui(bContext *C, /* if not animated, check if driven */ if (!fcu && (adt->drivers.first)) { - fcu = list_find_fcurve(&adt->drivers, path, rnaindex); + fcu = BKE_fcurve_find(&adt->drivers, path, rnaindex); if (fcu) { if (r_animdata) { @@ -635,13 +632,13 @@ static short get_fcurve_end_keyframes(FCurve *fcu, } /* Calculate the extents of F-Curve's data */ -bool calc_fcurve_bounds(FCurve *fcu, - float *xmin, - float *xmax, - float *ymin, - float *ymax, - const bool do_sel_only, - const bool include_handles) +bool BKE_fcurve_calc_bounds(FCurve *fcu, + float *xmin, + float *xmax, + float *ymin, + float *ymax, + const bool do_sel_only, + const bool include_handles) { float xminv = 999999999.0f, xmaxv = -999999999.0f; float yminv = 999999999.0f, ymaxv = -999999999.0f; @@ -765,7 +762,7 @@ bool calc_fcurve_bounds(FCurve *fcu, } /* Calculate the extents of F-Curve's keyframes */ -bool calc_fcurve_range( +bool BKE_fcurve_calc_range( FCurve *fcu, float *start, float *end, const bool do_sel_only, const bool do_min_length) { float min = 999999999.0f, max = -999999999.0f; @@ -818,7 +815,7 @@ bool calc_fcurve_range( * Usability of keyframes refers to whether they should be displayed, * and also whether they will have any influence on the final result. */ -bool fcurve_are_keyframes_usable(FCurve *fcu) +bool BKE_fcurve_are_keyframes_usable(FCurve *fcu) { /* F-Curve must exist */ if (fcu == NULL) { @@ -886,10 +883,10 @@ bool BKE_fcurve_is_protected(FCurve *fcu) /* Can keyframes be added to F-Curve? * Keyframes can only be added if they are already visible */ -bool fcurve_is_keyframable(FCurve *fcu) +bool BKE_fcurve_is_keyframable(FCurve *fcu) { /* F-Curve's keyframes must be "usable" (i.e. visible + have an effect on final result) */ - if (fcurve_are_keyframes_usable(fcu) == 0) { + if (BKE_fcurve_are_keyframes_usable(fcu) == 0) { return false; } diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index a2dfbefdb2c..7bf9cb2d0a1 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1420,7 +1420,7 @@ static void icu_to_fcurves(ID *id, /* make a copy of existing base-data if not the last curve */ if (b < (totbits - 1)) { - fcurve = copy_fcurve(fcu); + fcurve = BKE_fcurve_copy(fcu); } else { fcurve = fcu; @@ -2396,7 +2396,7 @@ void do_versions_ipos_to_animato(Main *bmain) } /* free unused drivers from actions + ipos */ - free_fcurves(&drivers); + BKE_fcurves_free(&drivers); if (G.debug & G_DEBUG) { printf("INFO: Animato convert done\n"); diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 97b09d10ede..7012688686b 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -92,7 +92,7 @@ void BKE_nlastrip_free(ListBase *strips, NlaStrip *strip, bool do_id_user) // BKE_animremap_free(); /* free own F-Curves */ - free_fcurves(&strip->fcurves); + BKE_fcurves_free(&strip->fcurves); /* free own F-Modifiers */ free_fmodifiers(&strip->modifiers); @@ -198,7 +198,7 @@ NlaStrip *BKE_nlastrip_copy(Main *bmain, } /* copy F-Curves and modifiers */ - copy_fcurves(&strip_d->fcurves, &strip->fcurves); + BKE_fcurves_copy(&strip_d->fcurves, &strip->fcurves); copy_fmodifiers(&strip_d->modifiers, &strip->modifiers); /* make a copy of all the child-strips, one at a time */ @@ -1494,7 +1494,7 @@ void BKE_nlastrip_validate_fcurves(NlaStrip *strip) /* if controlling influence... */ if (strip->flag & NLASTRIP_FLAG_USR_INFLUENCE) { /* try to get F-Curve */ - fcu = list_find_fcurve(&strip->fcurves, "influence", 0); + fcu = BKE_fcurve_find(&strip->fcurves, "influence", 0); /* add one if not found */ if (fcu == NULL) { @@ -1525,7 +1525,7 @@ void BKE_nlastrip_validate_fcurves(NlaStrip *strip) /* if controlling time... */ if (strip->flag & NLASTRIP_FLAG_USR_TIME) { /* try to get F-Curve */ - fcu = list_find_fcurve(&strip->fcurves, "strip_time", 0); + fcu = BKE_fcurve_find(&strip->fcurves, "strip_time", 0); /* add one if not found */ if (fcu == NULL) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 3e2629f8272..e7a8d04e0b8 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2087,8 +2087,8 @@ void BKE_object_copy_proxy_drivers(Object *ob, Object *target) } /* make a copy of all the drivers (for now), then correct any links that need fixing */ - free_fcurves(&ob->adt->drivers); - copy_fcurves(&ob->adt->drivers, &target->adt->drivers); + BKE_fcurves_free(&ob->adt->drivers); + BKE_fcurves_copy(&ob->adt->drivers, &target->adt->drivers); for (fcu = ob->adt->drivers.first; fcu; fcu = fcu->next) { ChannelDriver *driver = fcu->driver; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 7447971e7c5..aa2a1b14841 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -621,7 +621,7 @@ static void remove_sequencer_fcurves(Scene *sce) if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) { action_groups_remove_channel(adt->action, fcu); - free_fcurve(fcu); + BKE_fcurve_free(fcu); } } } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 954dca0f679..90edebfaa97 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -5119,7 +5119,7 @@ void BKE_sequencer_dupe_animdata(Scene *scene, const char *name_src, const char for (fcu = scene->adt->action->curves.first; fcu && fcu->prev != fcu_last; fcu = fcu->next) { if (STREQLEN(fcu->rna_path, str_from, str_from_len)) { - fcu_cpy = copy_fcurve(fcu); + fcu_cpy = BKE_fcurve_copy(fcu); BLI_addtail(&lb, fcu_cpy); } } @@ -5152,7 +5152,7 @@ static void seq_free_animdata(Scene *scene, Sequence *seq) FCurve *next_fcu = fcu->next; BLI_remlink(&scene->adt->action->curves, fcu); - free_fcurve(fcu); + BKE_fcurve_free(fcu); fcu = next_fcu; } |