Code Cleanup: fcurve function naming

This commit is contained in:
Jeroen Bakker 2020-06-05 09:30:15 +02:00
parent fe6be70875
commit e8b8e16b24
37 changed files with 170 additions and 173 deletions

View File

@ -180,18 +180,18 @@ int BKE_fcm_envelope_find_index(struct FCM_EnvelopeData *array,
/* -------- Data Management -------- */ /* -------- Data Management -------- */
struct FCurve *BKE_fcurve_create(void); struct FCurve *BKE_fcurve_create(void);
void free_fcurve(struct FCurve *fcu); void BKE_fcurve_free(struct FCurve *fcu);
struct FCurve *copy_fcurve(const struct FCurve *fcu); struct FCurve *BKE_fcurve_copy(const struct FCurve *fcu);
void free_fcurves(ListBase *list); void BKE_fcurves_free(ListBase *list);
void copy_fcurves(ListBase *dst, ListBase *src); void BKE_fcurves_copy(ListBase *dst, ListBase *src);
void BKE_fcurve_foreach_id(struct FCurve *fcu, struct LibraryForeachIDData *data); void BKE_fcurve_foreach_id(struct FCurve *fcu, struct LibraryForeachIDData *data);
/* find matching F-Curve in the given list of F-Curves */ /* 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 */ /* high level function to get an fcurve from C without having the rna */
struct FCurve *id_data_find_fcurve( 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 /* Get list of LinkData's containing pointers to the F-Curves which control the types of data
* indicated * 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, int BKE_fcurves_filter(ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName);
ListBase *src,
const char *dataPrefix,
const char *dataName);
/* Find an f-curve based on an rna property. */ /* Find an f-curve based on an rna property. */
struct FCurve *rna_get_fcurve(struct PointerRNA *ptr, struct FCurve *BKE_fcurve_find_by_rna(struct PointerRNA *ptr,
struct PropertyRNA *prop, struct PropertyRNA *prop,
int rnaindex, int rnaindex,
struct AnimData **r_adt, struct AnimData **r_adt,
struct bAction **r_action, struct bAction **r_action,
bool *r_driven, bool *r_driven,
bool *r_special); bool *r_special);
/* Same as above, but takes a context data, /* Same as above, but takes a context data,
* temp hack needed for complex paths like texture ones. */ * temp hack needed for complex paths like texture ones. */
struct FCurve *rna_get_fcurve_context_ui(struct bContext *C, struct FCurve *BKE_fcurve_find_by_rna_context_ui(struct bContext *C,
struct PointerRNA *ptr, struct PointerRNA *ptr,
struct PropertyRNA *prop, struct PropertyRNA *prop,
int rnaindex, int rnaindex,
struct AnimData **r_animdata, struct AnimData **r_animdata,
struct bAction **r_action, struct bAction **r_action,
bool *r_driven, bool *r_driven,
bool *r_special); bool *r_special);
/* Binary search algorithm for finding where to 'insert' BezTriple with given frame number. /* 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) * 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); int binarysearch_bezt_index(struct BezTriple array[], float frame, int arraylen, bool *r_replace);
/* get the time extents for F-Curve */ /* 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); 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 */ /* get the bounding-box extents for F-Curve */
bool calc_fcurve_bounds(struct FCurve *fcu, bool BKE_fcurve_calc_bounds(struct FCurve *fcu,
float *xmin, float *xmin,
float *xmax, float *xmax,
float *ymin, float *ymin,
float *ymax, float *ymax,
const bool do_sel_only, const bool do_sel_only,
const bool include_handles); const bool include_handles);
/* .............. */ /* .............. */
/* Are keyframes on F-Curve of any use (to final result, and to show in editors)? */ /* 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? */ /* 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); bool BKE_fcurve_is_protected(struct FCurve *fcu);
/* The curve is an infinite cycle via Cycles modifier */ /* The curve is an infinite cycle via Cycles modifier */

View File

@ -116,7 +116,7 @@ static void action_copy_data(Main *UNUSED(bmain),
/* XXX TODO pass subdata flag? /* XXX TODO pass subdata flag?
* But surprisingly does not seem to be doing any ID refcounting... */ * 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); BLI_addtail(&action_dst->curves, fcurve_dst);
@ -146,7 +146,7 @@ static void action_free_data(struct ID *id)
/* No animdata here. */ /* No animdata here. */
/* Free F-Curves. */ /* Free F-Curves. */
free_fcurves(&action->curves); BKE_fcurves_free(&action->curves);
/* Free groups. */ /* Free groups. */
BLI_freelistN(&action->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 * single-keyframe curves will increase the overall length by
* a phantom frame (T50354) * 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 */ /* compare to the running tally */
min = min_ff(min, nmin); min = min_ff(min, nmin);

View File

@ -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); BKE_nla_tracks_free(&adt->nla_tracks, do_id_user);
/* free drivers - stored as a list of F-Curves */ /* free drivers - stored as a list of F-Curves */
free_fcurves(&adt->drivers); BKE_fcurves_free(&adt->drivers);
/* free driver array cache */ /* free driver array cache */
MEM_SAFE_FREE(adt->driver_array); 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); BKE_nla_tracks_copy(bmain, &dadt->nla_tracks, &adt->nla_tracks, flag);
/* duplicate drivers (F-Curves) */ /* duplicate drivers (F-Curves) */
copy_fcurves(&dadt->drivers, &adt->drivers); BKE_fcurves_copy(&dadt->drivers, &adt->drivers);
dadt->driver_array = NULL; dadt->driver_array = NULL;
/* don't copy overrides */ /* don't copy overrides */
@ -447,7 +447,7 @@ void BKE_animdata_merge_copy(
if (src->drivers.first) { if (src->drivers.first) {
ListBase drivers = {NULL, NULL}; 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 /* Fix up all driver targets using the old target id
* - This assumes that the src ID is being merged into the dst 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 (fcu->rna_path) {
if (STRPREFIX(fcu->rna_path, prefix)) { if (STRPREFIX(fcu->rna_path, prefix)) {
BLI_remlink(curves, fcu); BLI_remlink(curves, fcu);
free_fcurve(fcu); BKE_fcurve_free(fcu);
any_removed = true; any_removed = true;
} }
} }

View File

@ -66,7 +66,7 @@ FCurve *BKE_fcurve_create(void)
/* ---------------------- Freeing --------------------------- */ /* ---------------------- Freeing --------------------------- */
/* Frees the F-Curve itself too, so make sure BLI_remlink is called before calling this... */ /* 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) { if (fcu == NULL) {
return; return;
@ -88,7 +88,7 @@ void free_fcurve(FCurve *fcu)
} }
/* Frees a list of F-Curves */ /* Frees a list of F-Curves */
void free_fcurves(ListBase *list) void BKE_fcurves_free(ListBase *list)
{ {
FCurve *fcu, *fcn; FCurve *fcu, *fcn;
@ -103,7 +103,7 @@ void free_fcurves(ListBase *list)
*/ */
for (fcu = list->first; fcu; fcu = fcn) { for (fcu = list->first; fcu; fcu = fcn) {
fcn = fcu->next; fcn = fcu->next;
free_fcurve(fcu); BKE_fcurve_free(fcu);
} }
/* clear pointers just in case */ /* clear pointers just in case */
@ -113,7 +113,7 @@ void free_fcurves(ListBase *list)
/* ---------------------- Copy --------------------------- */ /* ---------------------- Copy --------------------------- */
/* duplicate an F-Curve */ /* duplicate an F-Curve */
FCurve *copy_fcurve(const FCurve *fcu) FCurve *BKE_fcurve_copy(const FCurve *fcu)
{ {
FCurve *fcu_d; FCurve *fcu_d;
@ -146,7 +146,7 @@ FCurve *copy_fcurve(const FCurve *fcu)
} }
/* duplicate a list of F-Curves */ /* duplicate a list of F-Curves */
void copy_fcurves(ListBase *dst, ListBase *src) void BKE_fcurves_copy(ListBase *dst, ListBase *src)
{ {
FCurve *dfcu, *sfcu; FCurve *dfcu, *sfcu;
@ -160,7 +160,7 @@ void copy_fcurves(ListBase *dst, ListBase *src)
/* copy one-by-one */ /* copy one-by-one */
for (sfcu = src->first; sfcu; sfcu = sfcu->next) { for (sfcu = src->first; sfcu; sfcu = sfcu->next) {
dfcu = copy_fcurve(sfcu); dfcu = BKE_fcurve_copy(sfcu);
BLI_addtail(dst, dfcu); BLI_addtail(dst, dfcu);
} }
} }
@ -234,12 +234,12 @@ FCurve *id_data_find_fcurve(
/* animation takes priority over drivers */ /* animation takes priority over drivers */
if (adt->action && adt->action->curves.first) { 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 not animated, check if driven */
if (fcu == NULL && adt->drivers.first) { 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) { if (fcu && r_driven) {
*r_driven = true; *r_driven = true;
} }
@ -253,7 +253,7 @@ FCurve *id_data_find_fcurve(
/* Find the F-Curve affecting the given RNA-access path + index, /* Find the F-Curve affecting the given RNA-access path + index,
* in the list of F-Curves provided. */ * 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; 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' */ /* 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; FCurve *fcu;
@ -311,10 +311,7 @@ FCurve *iter_step_fcurve(FCurve *fcu_iter, const char rna_path[])
* - dataPrefix: i.e. 'pose.bones[' or 'nodes[' * - dataPrefix: i.e. 'pose.bones[' or 'nodes['
* - dataName: name of entity within "" immediately following the prefix * - dataName: name of entity within "" immediately following the prefix
*/ */
int list_find_data_fcurves(ListBase *dst, int BKE_fcurves_filter(ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName)
ListBase *src,
const char *dataPrefix,
const char *dataName)
{ {
FCurve *fcu; FCurve *fcu;
int matches = 0; int matches = 0;
@ -356,26 +353,26 @@ int list_find_data_fcurves(ListBase *dst,
return matches; return matches;
} }
FCurve *rna_get_fcurve(PointerRNA *ptr, FCurve *BKE_fcurve_find_by_rna(PointerRNA *ptr,
PropertyRNA *prop, PropertyRNA *prop,
int rnaindex, int rnaindex,
AnimData **r_adt, AnimData **r_adt,
bAction **r_action, bAction **r_action,
bool *r_driven, bool *r_driven,
bool *r_special) 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); NULL, ptr, prop, rnaindex, r_adt, r_action, r_driven, r_special);
} }
FCurve *rna_get_fcurve_context_ui(bContext *C, FCurve *BKE_fcurve_find_by_rna_context_ui(bContext *C,
PointerRNA *ptr, PointerRNA *ptr,
PropertyRNA *prop, PropertyRNA *prop,
int rnaindex, int rnaindex,
AnimData **r_animdata, AnimData **r_animdata,
bAction **r_action, bAction **r_action,
bool *r_driven, bool *r_driven,
bool *r_special) bool *r_special)
{ {
FCurve *fcu = NULL; FCurve *fcu = NULL;
PointerRNA tptr = *ptr; PointerRNA tptr = *ptr;
@ -400,7 +397,7 @@ FCurve *rna_get_fcurve_context_ui(bContext *C,
*r_special = true; *r_special = true;
/* The F-Curve either exists or it doesn't here... */ /* 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; 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 // XXX: the logic here is duplicated with a function up above
/* animation takes priority over drivers */ /* animation takes priority over drivers */
if (adt->action && adt->action->curves.first) { 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) { if (fcu && r_action) {
*r_action = adt->action; *r_action = adt->action;
@ -445,7 +442,7 @@ FCurve *rna_get_fcurve_context_ui(bContext *C,
/* if not animated, check if driven */ /* if not animated, check if driven */
if (!fcu && (adt->drivers.first)) { if (!fcu && (adt->drivers.first)) {
fcu = list_find_fcurve(&adt->drivers, path, rnaindex); fcu = BKE_fcurve_find(&adt->drivers, path, rnaindex);
if (fcu) { if (fcu) {
if (r_animdata) { if (r_animdata) {
@ -635,13 +632,13 @@ static short get_fcurve_end_keyframes(FCurve *fcu,
} }
/* Calculate the extents of F-Curve's data */ /* Calculate the extents of F-Curve's data */
bool calc_fcurve_bounds(FCurve *fcu, bool BKE_fcurve_calc_bounds(FCurve *fcu,
float *xmin, float *xmin,
float *xmax, float *xmax,
float *ymin, float *ymin,
float *ymax, float *ymax,
const bool do_sel_only, const bool do_sel_only,
const bool include_handles) const bool include_handles)
{ {
float xminv = 999999999.0f, xmaxv = -999999999.0f; float xminv = 999999999.0f, xmaxv = -999999999.0f;
float yminv = 999999999.0f, ymaxv = -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 */ /* 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) FCurve *fcu, float *start, float *end, const bool do_sel_only, const bool do_min_length)
{ {
float min = 999999999.0f, max = -999999999.0f; 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, * Usability of keyframes refers to whether they should be displayed,
* and also whether they will have any influence on the final result. * 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 */ /* F-Curve must exist */
if (fcu == NULL) { if (fcu == NULL) {
@ -886,10 +883,10 @@ bool BKE_fcurve_is_protected(FCurve *fcu)
/* Can keyframes be added to F-Curve? /* Can keyframes be added to F-Curve?
* Keyframes can only be added if they are already visible * 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) */ /* 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; return false;
} }

View File

@ -1420,7 +1420,7 @@ static void icu_to_fcurves(ID *id,
/* make a copy of existing base-data if not the last curve */ /* make a copy of existing base-data if not the last curve */
if (b < (totbits - 1)) { if (b < (totbits - 1)) {
fcurve = copy_fcurve(fcu); fcurve = BKE_fcurve_copy(fcu);
} }
else { else {
fcurve = fcu; fcurve = fcu;
@ -2396,7 +2396,7 @@ void do_versions_ipos_to_animato(Main *bmain)
} }
/* free unused drivers from actions + ipos */ /* free unused drivers from actions + ipos */
free_fcurves(&drivers); BKE_fcurves_free(&drivers);
if (G.debug & G_DEBUG) { if (G.debug & G_DEBUG) {
printf("INFO: Animato convert done\n"); printf("INFO: Animato convert done\n");

View File

@ -92,7 +92,7 @@ void BKE_nlastrip_free(ListBase *strips, NlaStrip *strip, bool do_id_user)
// BKE_animremap_free(); // BKE_animremap_free();
/* free own F-Curves */ /* free own F-Curves */
free_fcurves(&strip->fcurves); BKE_fcurves_free(&strip->fcurves);
/* free own F-Modifiers */ /* free own F-Modifiers */
free_fmodifiers(&strip->modifiers); free_fmodifiers(&strip->modifiers);
@ -198,7 +198,7 @@ NlaStrip *BKE_nlastrip_copy(Main *bmain,
} }
/* copy F-Curves and modifiers */ /* 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); copy_fmodifiers(&strip_d->modifiers, &strip->modifiers);
/* make a copy of all the child-strips, one at a time */ /* 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 controlling influence... */
if (strip->flag & NLASTRIP_FLAG_USR_INFLUENCE) { if (strip->flag & NLASTRIP_FLAG_USR_INFLUENCE) {
/* try to get F-Curve */ /* 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 */ /* add one if not found */
if (fcu == NULL) { if (fcu == NULL) {
@ -1525,7 +1525,7 @@ void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
/* if controlling time... */ /* if controlling time... */
if (strip->flag & NLASTRIP_FLAG_USR_TIME) { if (strip->flag & NLASTRIP_FLAG_USR_TIME) {
/* try to get F-Curve */ /* 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 */ /* add one if not found */
if (fcu == NULL) { if (fcu == NULL) {

View File

@ -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 */ /* make a copy of all the drivers (for now), then correct any links that need fixing */
free_fcurves(&ob->adt->drivers); BKE_fcurves_free(&ob->adt->drivers);
copy_fcurves(&ob->adt->drivers, &target->adt->drivers); BKE_fcurves_copy(&ob->adt->drivers, &target->adt->drivers);
for (fcu = ob->adt->drivers.first; fcu; fcu = fcu->next) { for (fcu = ob->adt->drivers.first; fcu; fcu = fcu->next) {
ChannelDriver *driver = fcu->driver; ChannelDriver *driver = fcu->driver;

View File

@ -621,7 +621,7 @@ static void remove_sequencer_fcurves(Scene *sce)
if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) { if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
action_groups_remove_channel(adt->action, fcu); action_groups_remove_channel(adt->action, fcu);
free_fcurve(fcu); BKE_fcurve_free(fcu);
} }
} }
} }

View File

@ -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) { 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)) { 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); BLI_addtail(&lb, fcu_cpy);
} }
} }
@ -5152,7 +5152,7 @@ static void seq_free_animdata(Scene *scene, Sequence *seq)
FCurve *next_fcu = fcu->next; FCurve *next_fcu = fcu->next;
BLI_remlink(&scene->adt->action->curves, fcu); BLI_remlink(&scene->adt->action->curves, fcu);
free_fcurve(fcu); BKE_fcurve_free(fcu);
fcu = next_fcu; fcu = next_fcu;
} }

View File

@ -759,7 +759,7 @@ static void do_version_bbone_scale_fcurve_fix(ListBase *curves, FCurve *fcu)
/* Update F-Curve's path. */ /* Update F-Curve's path. */
if (replace_bbone_scale_rnapath(&fcu->rna_path)) { if (replace_bbone_scale_rnapath(&fcu->rna_path)) {
/* If matched, duplicate the curve and tweak name. */ /* If matched, duplicate the curve and tweak name. */
FCurve *second = copy_fcurve(fcu); FCurve *second = BKE_fcurve_copy(fcu);
second->rna_path[strlen(second->rna_path) - 1] = 'y'; second->rna_path[strlen(second->rna_path) - 1] = 'y';

View File

@ -671,7 +671,7 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *f
} }
/* free the F-Curve itself */ /* free the F-Curve itself */
free_fcurve(fcu); BKE_fcurve_free(fcu);
} }
/* If the action has no F-Curves, unlink it from AnimData if it did not /* If the action has no F-Curves, unlink it from AnimData if it did not
@ -1806,7 +1806,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
/* remove from group and action, then free */ /* remove from group and action, then free */
action_groups_remove_channel(adt->action, fcu); action_groups_remove_channel(adt->action, fcu);
free_fcurve(fcu); BKE_fcurve_free(fcu);
} }
/* free the group itself */ /* free the group itself */
@ -1860,7 +1860,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
/* unlink and free the F-Curve */ /* unlink and free the F-Curve */
BLI_remlink(&strip->fcurves, fcu); BLI_remlink(&strip->fcurves, fcu);
free_fcurve(fcu); BKE_fcurve_free(fcu);
tag_update_animation_element(ale); tag_update_animation_element(ale);
break; break;
} }

View File

@ -988,7 +988,7 @@ static bAnimListElem *make_new_animlistelem(void *data,
* then free the MEM_alloc'd string * then free the MEM_alloc'd string
*/ */
if (rna_path) { if (rna_path) {
ale->key_data = (void *)list_find_fcurve(&act->curves, rna_path, 0); ale->key_data = (void *)BKE_fcurve_find(&act->curves, rna_path, 0);
MEM_freeN(rna_path); MEM_freeN(rna_path);
} }
} }

View File

@ -92,7 +92,7 @@ FCurve *verify_driver_fcurve(ID *id,
* - add if not found and allowed to add one * - add if not found and allowed to add one
* TODO: add auto-grouping support? how this works will need to be resolved * TODO: add auto-grouping support? how this works will need to be resolved
*/ */
fcu = list_find_fcurve(&adt->drivers, rna_path, array_index); fcu = BKE_fcurve_find(&adt->drivers, rna_path, array_index);
if (fcu == NULL && creation_mode != DRIVER_FCURVE_LOOKUP_ONLY) { if (fcu == NULL && creation_mode != DRIVER_FCURVE_LOOKUP_ONLY) {
/* use default settings to make a F-Curve */ /* use default settings to make a F-Curve */
@ -570,13 +570,13 @@ bool ANIM_remove_driver(ReportList *UNUSED(reports),
/* step through all drivers, removing all of those with the same base path */ /* step through all drivers, removing all of those with the same base path */
FCurve *fcu_iter = adt->drivers.first; FCurve *fcu_iter = adt->drivers.first;
while ((fcu = iter_step_fcurve(fcu_iter, rna_path)) != NULL) { while ((fcu = BKE_fcurve_iter_step(fcu_iter, rna_path)) != NULL) {
/* store the next fcurve for looping */ /* store the next fcurve for looping */
fcu_iter = fcu->next; fcu_iter = fcu->next;
/* remove F-Curve from driver stack, then free it */ /* remove F-Curve from driver stack, then free it */
BLI_remlink(&adt->drivers, fcu); BLI_remlink(&adt->drivers, fcu);
free_fcurve(fcu); BKE_fcurve_free(fcu);
/* done successfully */ /* done successfully */
success = true; success = true;
@ -590,7 +590,7 @@ bool ANIM_remove_driver(ReportList *UNUSED(reports),
fcu = verify_driver_fcurve(id, rna_path, array_index, DRIVER_FCURVE_LOOKUP_ONLY); fcu = verify_driver_fcurve(id, rna_path, array_index, DRIVER_FCURVE_LOOKUP_ONLY);
if (fcu) { if (fcu) {
BLI_remlink(&adt->drivers, fcu); BLI_remlink(&adt->drivers, fcu);
free_fcurve(fcu); BKE_fcurve_free(fcu);
success = true; success = true;
} }
@ -611,7 +611,7 @@ void ANIM_drivers_copybuf_free(void)
{ {
/* free the buffer F-Curve if it exists, as if it were just another F-Curve */ /* free the buffer F-Curve if it exists, as if it were just another F-Curve */
if (channeldriver_copypaste_buf) { if (channeldriver_copypaste_buf) {
free_fcurve(channeldriver_copypaste_buf); BKE_fcurve_free(channeldriver_copypaste_buf);
} }
channeldriver_copypaste_buf = NULL; channeldriver_copypaste_buf = NULL;
} }
@ -662,7 +662,7 @@ bool ANIM_copy_driver(
fcu->rna_path = NULL; fcu->rna_path = NULL;
/* make a copy of the F-Curve with */ /* make a copy of the F-Curve with */
channeldriver_copypaste_buf = copy_fcurve(fcu); channeldriver_copypaste_buf = BKE_fcurve_copy(fcu);
/* restore the path */ /* restore the path */
fcu->rna_path = tmp_path; fcu->rna_path = tmp_path;
@ -981,7 +981,8 @@ static bool add_driver_button_poll(bContext *C)
} }
/* Don't do anything if there is an fcurve for animation without a driver. */ /* Don't do anything if there is an fcurve for animation without a driver. */
FCurve *fcu = rna_get_fcurve_context_ui(C, &ptr, prop, index, NULL, NULL, &driven, &special); FCurve *fcu = BKE_fcurve_find_by_rna_context_ui(
C, &ptr, prop, index, NULL, NULL, &driven, &special);
return (fcu == NULL || fcu->driver); return (fcu == NULL || fcu->driver);
} }

View File

@ -184,7 +184,7 @@ FCurve *ED_action_fcurve_find(struct bAction *act, const char rna_path[], const
if (ELEM(NULL, act, rna_path)) { if (ELEM(NULL, act, rna_path)) {
return NULL; return NULL;
} }
return list_find_fcurve(&act->curves, rna_path, array_index); return BKE_fcurve_find(&act->curves, rna_path, array_index);
} }
/** /**
@ -210,7 +210,7 @@ FCurve *ED_action_fcurve_ensure(struct Main *bmain,
* - add if not found and allowed to add one * - add if not found and allowed to add one
* TODO: add auto-grouping support? how this works will need to be resolved * TODO: add auto-grouping support? how this works will need to be resolved
*/ */
fcu = list_find_fcurve(&act->curves, rna_path, array_index); fcu = BKE_fcurve_find(&act->curves, rna_path, array_index);
if (fcu == NULL) { if (fcu == NULL) {
/* use default settings to make a F-Curve */ /* use default settings to make a F-Curve */
@ -1120,7 +1120,7 @@ static bool insert_keyframe_value(ReportList *reports,
eInsertKeyFlags flag) eInsertKeyFlags flag)
{ {
/* F-Curve not editable? */ /* F-Curve not editable? */
if (fcurve_is_keyframable(fcu) == 0) { if (BKE_fcurve_is_keyframable(fcu) == 0) {
BKE_reportf( BKE_reportf(
reports, reports,
RPT_ERROR, RPT_ERROR,
@ -2400,7 +2400,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
* not have any effect. * not have any effect.
*/ */
NlaStrip *strip = ptr.data; NlaStrip *strip = ptr.data;
FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), index); FCurve *fcu = BKE_fcurve_find(&strip->fcurves, RNA_property_identifier(prop), index);
if (fcu) { if (fcu) {
changed = insert_keyframe_direct( changed = insert_keyframe_direct(
@ -2417,7 +2417,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
FCurve *fcu; FCurve *fcu;
bool driven, special; bool driven, special;
fcu = rna_get_fcurve_context_ui(C, &ptr, prop, index, NULL, NULL, &driven, &special); fcu = BKE_fcurve_find_by_rna_context_ui(C, &ptr, prop, index, NULL, NULL, &driven, &special);
if (fcu && driven) { if (fcu && driven) {
changed = insert_keyframe_direct( changed = insert_keyframe_direct(
@ -2560,7 +2560,7 @@ static int delete_key_button_exec(bContext *C, wmOperator *op)
*/ */
ID *id = ptr.owner_id; ID *id = ptr.owner_id;
NlaStrip *strip = ptr.data; NlaStrip *strip = ptr.data;
FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), 0); FCurve *fcu = BKE_fcurve_find(&strip->fcurves, RNA_property_identifier(prop), 0);
if (fcu) { if (fcu) {
if (BKE_fcurve_is_protected(fcu)) { if (BKE_fcurve_is_protected(fcu)) {
@ -3001,7 +3001,8 @@ bool ED_autokeyframe_property(
bool special; bool special;
bool changed = false; bool changed = false;
fcu = rna_get_fcurve_context_ui(C, ptr, prop, rnaindex, NULL, &action, &driven, &special); fcu = BKE_fcurve_find_by_rna_context_ui(
C, ptr, prop, rnaindex, NULL, &action, &driven, &special);
if (fcu == NULL) { if (fcu == NULL) {
return changed; return changed;

View File

@ -516,11 +516,11 @@ static void updateDuplicateActionConstraintSettings(EditBone *dup_bone,
/* See if there is any channels that uses this bone */ /* See if there is any channels that uses this bone */
ListBase ani_curves; ListBase ani_curves;
BLI_listbase_clear(&ani_curves); BLI_listbase_clear(&ani_curves);
if (list_find_data_fcurves(&ani_curves, &act->curves, "pose.bones[", orig_bone->name)) { if (BKE_fcurves_filter(&ani_curves, &act->curves, "pose.bones[", orig_bone->name)) {
/* Create a copy and mirror the animation */ /* Create a copy and mirror the animation */
for (LinkData *ld = ani_curves.first; ld; ld = ld->next) { for (LinkData *ld = ani_curves.first; ld; ld = ld->next) {
FCurve *old_curve = ld->data; FCurve *old_curve = ld->data;
FCurve *new_curve = copy_fcurve(old_curve); FCurve *new_curve = BKE_fcurve_copy(old_curve);
bActionGroup *agrp; bActionGroup *agrp;
char *old_path = new_curve->rna_path; char *old_path = new_curve->rna_path;

View File

@ -936,13 +936,13 @@ static void fcurve_path_rename(AnimData *adt,
nextfcu = fcu->next; nextfcu = fcu->next;
if (STREQLEN(fcu->rna_path, orig_rna_path, len)) { if (STREQLEN(fcu->rna_path, orig_rna_path, len)) {
char *spath, *suffix = fcu->rna_path + len; char *spath, *suffix = fcu->rna_path + len;
nfcu = copy_fcurve(fcu); nfcu = BKE_fcurve_copy(fcu);
spath = nfcu->rna_path; spath = nfcu->rna_path;
nfcu->rna_path = BLI_sprintfN("%s%s", rna_path, suffix); nfcu->rna_path = BLI_sprintfN("%s%s", rna_path, suffix);
/* copy_fcurve() sets nfcu->grp to NULL. To maintain the groups, we need to keep the pointer. /* BKE_fcurve_copy() sets nfcu->grp to NULL. To maintain the groups, we need to keep the
* As a result, the group's 'channels' pointers will be wrong, which is fixed by calling * pointer. As a result, the group's 'channels' pointers will be wrong, which is fixed by
* `action_groups_reconstruct(action)` later, after all fcurves have been renamed. */ * calling `action_groups_reconstruct(action)` later, after all fcurves have been renamed. */
nfcu->grp = fcu->grp; nfcu->grp = fcu->grp;
BLI_addtail(curves, nfcu); BLI_addtail(curves, nfcu);
@ -956,7 +956,7 @@ static void fcurve_path_rename(AnimData *adt,
BLI_remlink(&adt->drivers, fcu); BLI_remlink(&adt->drivers, fcu);
} }
free_fcurve(fcu); BKE_fcurve_free(fcu);
MEM_freeN(spath); MEM_freeN(spath);
} }
@ -972,7 +972,7 @@ static void fcurve_remove(AnimData *adt, ListBase *orig_curves, FCurve *fcu)
action_groups_remove_channel(adt->action, fcu); action_groups_remove_channel(adt->action, fcu);
} }
free_fcurve(fcu); BKE_fcurve_free(fcu);
} }
static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves) static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)

View File

@ -88,12 +88,12 @@ static void undocurve_to_editcurve(Main *bmain, UndoCurve *ucu, Curve *cu, short
if (ad) { if (ad) {
if (ad->action) { if (ad->action) {
free_fcurves(&ad->action->curves); BKE_fcurves_free(&ad->action->curves);
copy_fcurves(&ad->action->curves, &ucu->fcurves); BKE_fcurves_copy(&ad->action->curves, &ucu->fcurves);
} }
free_fcurves(&ad->drivers); BKE_fcurves_free(&ad->drivers);
copy_fcurves(&ad->drivers, &ucu->drivers); BKE_fcurves_copy(&ad->drivers, &ucu->drivers);
} }
/* copy */ /* copy */
@ -132,10 +132,10 @@ static void undocurve_from_editcurve(UndoCurve *ucu, Curve *cu, const short shap
if (ad) { if (ad) {
if (ad->action) { if (ad->action) {
copy_fcurves(&ucu->fcurves, &ad->action->curves); BKE_fcurves_copy(&ucu->fcurves, &ad->action->curves);
} }
copy_fcurves(&ucu->drivers, &ad->drivers); BKE_fcurves_copy(&ucu->drivers, &ad->drivers);
} }
/* copy */ /* copy */
@ -167,8 +167,8 @@ static void undocurve_free_data(UndoCurve *uc)
BKE_curve_editNurb_keyIndex_free(&uc->undoIndex); BKE_curve_editNurb_keyIndex_free(&uc->undoIndex);
free_fcurves(&uc->fcurves); BKE_fcurves_free(&uc->fcurves);
free_fcurves(&uc->drivers); BKE_fcurves_free(&uc->drivers);
} }
static Object *editcurve_object_from_context(bContext *C) static Object *editcurve_object_from_context(bContext *C)

View File

@ -61,7 +61,7 @@ static FCurve *ui_but_get_fcurve(
* but works well enough in typical cases */ * but works well enough in typical cases */
int rnaindex = (but->rnaindex == -1) ? 0 : but->rnaindex; int rnaindex = (but->rnaindex == -1) ? 0 : but->rnaindex;
return rna_get_fcurve_context_ui( return BKE_fcurve_find_by_rna_context_ui(
but->block->evil_C, &but->rnapoin, but->rnaprop, rnaindex, adt, action, r_driven, r_special); but->block->evil_C, &but->rnapoin, but->rnaprop, rnaindex, adt, action, r_driven, r_special);
} }

View File

@ -1061,7 +1061,7 @@ static int followpath_path_animate_exec(bContext *C, wmOperator *op)
Curve *cu = (Curve *)data->tar->data; Curve *cu = (Curve *)data->tar->data;
if (ELEM(NULL, cu->adt, cu->adt->action) || if (ELEM(NULL, cu->adt, cu->adt->action) ||
(list_find_fcurve(&cu->adt->action->curves, "eval_time", 0) == NULL)) { (BKE_fcurve_find(&cu->adt->action->curves, "eval_time", 0) == NULL)) {
/* create F-Curve for path animation */ /* create F-Curve for path animation */
act = ED_id_action_ensure(bmain, &cu->id); act = ED_id_action_ensure(bmain, &cu->id);
fcu = ED_action_fcurve_ensure(bmain, act, NULL, NULL, "eval_time", 0); fcu = ED_action_fcurve_ensure(bmain, act, NULL, NULL, "eval_time", 0);

View File

@ -4952,7 +4952,7 @@ static int drivers_editor_show_exec(bContext *C, wmOperator *op)
FCurve *fcu; FCurve *fcu;
bool driven, special; bool driven, special;
fcu = rna_get_fcurve_context_ui(C, &ptr, prop, index, NULL, NULL, &driven, &special); fcu = BKE_fcurve_find_by_rna_context_ui(C, &ptr, prop, index, NULL, NULL, &driven, &special);
if (fcu) { if (fcu) {
/* Isolate this F-Curve... */ /* Isolate this F-Curve... */
bAnimContext ac; bAnimContext ac;

View File

@ -218,7 +218,7 @@ static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
float tmin, tmax; float tmin, tmax;
/* get range and apply necessary scaling before processing */ /* get range and apply necessary scaling before processing */
if (calc_fcurve_range(fcu, &tmin, &tmax, onlySel, false)) { if (BKE_fcurve_calc_range(fcu, &tmin, &tmax, onlySel, false)) {
if (adt) { if (adt) {
tmin = BKE_nla_tweakedit_remap(adt, tmin, NLATIME_CONVERT_MAP); tmin = BKE_nla_tweakedit_remap(adt, tmin, NLATIME_CONVERT_MAP);

View File

@ -1284,7 +1284,7 @@ static void graph_panel_drivers_popover(const bContext *C, Panel *panel)
FCurve *fcu; FCurve *fcu;
bool driven, special; bool driven, special;
fcu = rna_get_fcurve_context_ui( fcu = BKE_fcurve_find_by_rna_context_ui(
(bContext *)C, &ptr, prop, index, NULL, NULL, &driven, &special); (bContext *)C, &ptr, prop, index, NULL, NULL, &driven, &special);
/* Hack: Force all buttons in this panel to be able to know the driver button /* Hack: Force all buttons in this panel to be able to know the driver button

View File

@ -1159,7 +1159,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, shor
* we must obey this. * we must obey this.
*/ */
if (!(sipo->flag & SIPO_SELCUVERTSONLY) || (fcu->flag & FCURVE_SELECTED)) { if (!(sipo->flag & SIPO_SELCUVERTSONLY) || (fcu->flag & FCURVE_SELECTED)) {
if (!fcurve_are_keyframes_usable(fcu) && !(fcu->fpt && fcu->totvert)) { if (!BKE_fcurve_are_keyframes_usable(fcu) && !(fcu->fpt && fcu->totvert)) {
/* only draw controls if this is the active modifier */ /* only draw controls if this is the active modifier */
if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) { if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) {
switch (fcm->type) { switch (fcm->type) {

View File

@ -126,7 +126,8 @@ void get_graph_keyframe_extents(bAnimContext *ac,
float unitFac, offset; float unitFac, offset;
/* get range */ /* get range */
if (calc_fcurve_bounds(fcu, &txmin, &txmax, &tymin, &tymax, do_sel_only, include_handles)) { if (BKE_fcurve_calc_bounds(
fcu, &txmin, &txmax, &tymin, &tymax, do_sel_only, include_handles)) {
short mapping_flag = ANIM_get_normalization_flags(ac); short mapping_flag = ANIM_get_normalization_flags(ac);
/* apply NLA scaling */ /* apply NLA scaling */
@ -409,7 +410,7 @@ static void create_ghost_curves(bAnimContext *ac, int start, int end)
int filter; int filter;
/* free existing ghost curves */ /* free existing ghost curves */
free_fcurves(&sipo->runtime.ghost_curves); BKE_fcurves_free(&sipo->runtime.ghost_curves);
/* sanity check */ /* sanity check */
if (start >= end) { if (start >= end) {
@ -536,7 +537,7 @@ static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
/* free ghost curves */ /* free ghost curves */
free_fcurves(&sipo->runtime.ghost_curves); BKE_fcurves_free(&sipo->runtime.ghost_curves);
/* update this editor only */ /* update this editor only */
ED_area_tag_redraw(CTX_wm_area(C)); ED_area_tag_redraw(CTX_wm_area(C));
@ -806,7 +807,7 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op)
/* when there are F-Modifiers on the curve, only allow adding /* when there are F-Modifiers on the curve, only allow adding
* keyframes if these will be visible after doing so... * keyframes if these will be visible after doing so...
*/ */
if (fcurve_is_keyframable(fcu)) { if (BKE_fcurve_is_keyframable(fcu)) {
ListBase anim_data; ListBase anim_data;
ToolSettings *ts = ac.scene->toolsettings; ToolSettings *ts = ac.scene->toolsettings;

View File

@ -171,7 +171,7 @@ bool graphop_visible_keyframes_poll(bContext *C)
if (fcu->bezt == NULL) { if (fcu->bezt == NULL) {
continue; continue;
} }
if (fcurve_are_keyframes_usable(fcu)) { if (BKE_fcurve_are_keyframes_usable(fcu)) {
found = 1; found = 1;
break; break;
} }
@ -225,7 +225,7 @@ bool graphop_editable_keyframes_poll(bContext *C)
if (fcu->bezt == NULL) { if (fcu->bezt == NULL) {
continue; continue;
} }
if (fcurve_is_keyframable(fcu)) { if (BKE_fcurve_is_keyframable(fcu)) {
found = 1; found = 1;
break; break;
} }

View File

@ -145,7 +145,7 @@ static void graph_free(SpaceLink *sl)
} }
if (si->runtime.ghost_curves.first) { if (si->runtime.ghost_curves.first) {
free_fcurves(&si->runtime.ghost_curves); BKE_fcurves_free(&si->runtime.ghost_curves);
} }
} }

View File

@ -325,7 +325,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uin
/* influence -------------------------- */ /* influence -------------------------- */
if (strip->flag & NLASTRIP_FLAG_USR_INFLUENCE) { if (strip->flag & NLASTRIP_FLAG_USR_INFLUENCE) {
FCurve *fcu = list_find_fcurve(&strip->fcurves, "influence", 0); FCurve *fcu = BKE_fcurve_find(&strip->fcurves, "influence", 0);
float cfra; float cfra;
/* plot the curve (over the strip's main region) */ /* plot the curve (over the strip's main region) */

View File

@ -931,7 +931,7 @@ static void cleardrivers_animdata_cb(int UNUSED(event),
IdAdtTemplate *iat = (IdAdtTemplate *)tselem->id; IdAdtTemplate *iat = (IdAdtTemplate *)tselem->id;
/* just free drivers - stored as a list of F-Curves */ /* just free drivers - stored as a list of F-Curves */
free_fcurves(&iat->adt->drivers); BKE_fcurves_free(&iat->adt->drivers);
DEG_id_tag_update(tselem->id, ID_RECALC_ANIMATION); DEG_id_tag_update(tselem->id, ID_RECALC_ANIMATION);
} }

View File

@ -274,7 +274,7 @@ AnimationImporter::~AnimationImporter()
/* free unused FCurves */ /* free unused FCurves */
for (std::vector<FCurve *>::iterator it = unused_curves.begin(); it != unused_curves.end(); for (std::vector<FCurve *>::iterator it = unused_curves.begin(); it != unused_curves.end();
it++) { it++) {
free_fcurve(*it); BKE_fcurve_free(*it);
} }
if (unused_curves.size()) { if (unused_curves.size()) {
@ -442,7 +442,7 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act)
} }
action_groups_remove_channel(act, eulcu[i]); action_groups_remove_channel(act, eulcu[i]);
free_fcurve(eulcu[i]); BKE_fcurve_free(eulcu[i]);
} }
chan->rotmode = ROT_MODE_QUAT; chan->rotmode = ROT_MODE_QUAT;

View File

@ -89,7 +89,7 @@ void BCAnimationCurve::init_pointer_rna(Object *ob)
void BCAnimationCurve::delete_fcurve(FCurve *fcu) void BCAnimationCurve::delete_fcurve(FCurve *fcu)
{ {
free_fcurve(fcu); BKE_fcurve_free(fcu);
} }
FCurve *BCAnimationCurve::create_fcurve(int array_index, const char *rna_path) FCurve *BCAnimationCurve::create_fcurve(int array_index, const char *rna_path)

View File

@ -2182,7 +2182,7 @@ bool RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop)
} }
for (index = 0; index < len; index++) { for (index = 0; index < len; index++) {
if (rna_get_fcurve(ptr, prop, index, NULL, NULL, &driven, &special)) { if (BKE_fcurve_find_by_rna(ptr, prop, index, NULL, NULL, &driven, &special)) {
return true; return true;
} }
} }

View File

@ -147,7 +147,7 @@ static FCurve *rna_Action_fcurve_find(bAction *act,
} }
/* Returns NULL if not found. */ /* Returns NULL if not found. */
return list_find_fcurve(&act->curves, data_path, index); return BKE_fcurve_find(&act->curves, data_path, index);
} }
static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, PointerRNA *fcu_ptr) static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, PointerRNA *fcu_ptr)
@ -164,7 +164,7 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, PointerR
} }
action_groups_remove_channel(act, fcu); action_groups_remove_channel(act, fcu);
free_fcurve(fcu); BKE_fcurve_free(fcu);
RNA_POINTER_INVALIDATE(fcu_ptr); RNA_POINTER_INVALIDATE(fcu_ptr);
} }
else { else {
@ -174,7 +174,7 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, PointerR
} }
BLI_remlink(&act->curves, fcu); BLI_remlink(&act->curves, fcu);
free_fcurve(fcu); BKE_fcurve_free(fcu);
RNA_POINTER_INVALIDATE(fcu_ptr); RNA_POINTER_INVALIDATE(fcu_ptr);
} }

View File

@ -648,7 +648,7 @@ static FCurve *rna_Driver_from_existing(AnimData *adt, bContext *C, FCurve *src_
} }
else { else {
/* just make a copy of the existing one and add to self */ /* just make a copy of the existing one and add to self */
FCurve *new_fcu = copy_fcurve(src_driver); FCurve *new_fcu = BKE_fcurve_copy(src_driver);
/* XXX: if we impose any ordering on these someday, this will be problematic */ /* XXX: if we impose any ordering on these someday, this will be problematic */
BLI_addtail(&adt->drivers, new_fcu); BLI_addtail(&adt->drivers, new_fcu);
@ -664,7 +664,7 @@ static FCurve *rna_Driver_new(
return NULL; return NULL;
} }
if (list_find_fcurve(&adt->drivers, rna_path, array_index)) { if (BKE_fcurve_find(&adt->drivers, rna_path, array_index)) {
BKE_reportf(reports, RPT_ERROR, "Driver '%s[%d]' already exists", rna_path, array_index); BKE_reportf(reports, RPT_ERROR, "Driver '%s[%d]' already exists", rna_path, array_index);
return NULL; return NULL;
} }
@ -683,7 +683,7 @@ static void rna_Driver_remove(AnimData *adt, Main *bmain, ReportList *reports, F
BKE_report(reports, RPT_ERROR, "Driver not found in this animation data"); BKE_report(reports, RPT_ERROR, "Driver not found in this animation data");
return; return;
} }
free_fcurve(fcu); BKE_fcurve_free(fcu);
DEG_relations_tag_update(bmain); DEG_relations_tag_update(bmain);
} }
@ -698,7 +698,7 @@ static FCurve *rna_Driver_find(AnimData *adt,
} }
/* Returns NULL if not found. */ /* Returns NULL if not found. */
return list_find_fcurve(&adt->drivers, data_path, index); return BKE_fcurve_find(&adt->drivers, data_path, index);
} }
bool rna_AnimaData_override_apply(Main *UNUSED(bmain), bool rna_AnimaData_override_apply(Main *UNUSED(bmain),

View File

@ -579,7 +579,7 @@ static void rna_FCurve_group_set(PointerRNA *ptr,
/* calculate time extents of F-Curve */ /* calculate time extents of F-Curve */
static void rna_FCurve_range(FCurve *fcu, float range[2]) static void rna_FCurve_range(FCurve *fcu, float range[2])
{ {
calc_fcurve_range(fcu, range, range + 1, false, false); BKE_fcurve_calc_range(fcu, range, range + 1, false, false);
} }
static bool rna_FCurve_is_empty_get(PointerRNA *ptr) static bool rna_FCurve_is_empty_get(PointerRNA *ptr)

View File

@ -382,7 +382,7 @@ static FCurve *rna_NlaStrip_fcurve_find(NlaStrip *strip,
} }
/* Returns NULL if not found. */ /* Returns NULL if not found. */
return list_find_fcurve(&strip->fcurves, data_path, index); return BKE_fcurve_find(&strip->fcurves, data_path, index);
} }
static NlaStrip *rna_NlaStrip_new(ID *id, static NlaStrip *rna_NlaStrip_new(ID *id,

View File

@ -354,7 +354,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
if (prop) { if (prop) {
NlaStrip *strip = ptr.data; NlaStrip *strip = ptr.data;
FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), index); FCurve *fcu = BKE_fcurve_find(&strip->fcurves, RNA_property_identifier(prop), index);
result = insert_keyframe_direct(&reports, ptr, prop, fcu, cfra, keytype, NULL, options); result = insert_keyframe_direct(&reports, ptr, prop, fcu, cfra, keytype, NULL, options);
} }
@ -462,7 +462,7 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
if (prop) { if (prop) {
ID *id = ptr.owner_id; ID *id = ptr.owner_id;
NlaStrip *strip = ptr.data; NlaStrip *strip = ptr.data;
FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), index); FCurve *fcu = BKE_fcurve_find(&strip->fcurves, RNA_property_identifier(prop), index);
/* NOTE: This should be true, or else we wouldn't be able to get here. */ /* NOTE: This should be true, or else we wouldn't be able to get here. */
BLI_assert(fcu != NULL); BLI_assert(fcu != NULL);
@ -577,13 +577,13 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
if (index == -1) { /* all, use a list */ if (index == -1) { /* all, use a list */
int i = 0; int i = 0;
ret = PyList_New(0); ret = PyList_New(0);
while ((fcu = list_find_fcurve(&adt->drivers, path_full, i++))) { while ((fcu = BKE_fcurve_find(&adt->drivers, path_full, i++))) {
RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr); RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr);
PyList_APPEND(ret, pyrna_struct_CreatePyObject(&tptr)); PyList_APPEND(ret, pyrna_struct_CreatePyObject(&tptr));
} }
} }
else { else {
fcu = list_find_fcurve(&adt->drivers, path_full, index); fcu = BKE_fcurve_find(&adt->drivers, path_full, index);
RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr); RNA_pointer_create(id, &RNA_FCurve, fcu, &tptr);
ret = pyrna_struct_CreatePyObject(&tptr); ret = pyrna_struct_CreatePyObject(&tptr);
} }

View File

@ -34,7 +34,7 @@ TEST(evaluate_fcurve, EmptyFCurve)
{ {
FCurve *fcu = BKE_fcurve_create(); FCurve *fcu = BKE_fcurve_create();
EXPECT_EQ(evaluate_fcurve(fcu, 47.0f), 0.0f); EXPECT_EQ(evaluate_fcurve(fcu, 47.0f), 0.0f);
free_fcurve(fcu); BKE_fcurve_free(fcu);
} }
TEST(evaluate_fcurve, OnKeys) TEST(evaluate_fcurve, OnKeys)
@ -56,7 +56,7 @@ TEST(evaluate_fcurve, OnKeys)
EXPECT_NEAR(evaluate_fcurve(fcu, 2.0f - time_epsilon), 13.0f, EPSILON); EXPECT_NEAR(evaluate_fcurve(fcu, 2.0f - time_epsilon), 13.0f, EPSILON);
EXPECT_NEAR(evaluate_fcurve(fcu, 2.0f + time_epsilon), 13.0f, EPSILON); EXPECT_NEAR(evaluate_fcurve(fcu, 2.0f + time_epsilon), 13.0f, EPSILON);
free_fcurve(fcu); BKE_fcurve_free(fcu);
} }
TEST(evaluate_fcurve, InterpolationConstant) TEST(evaluate_fcurve, InterpolationConstant)
@ -72,7 +72,7 @@ TEST(evaluate_fcurve, InterpolationConstant)
EXPECT_NEAR(evaluate_fcurve(fcu, 1.25f), 7.0f, EPSILON); EXPECT_NEAR(evaluate_fcurve(fcu, 1.25f), 7.0f, EPSILON);
EXPECT_NEAR(evaluate_fcurve(fcu, 1.50f), 7.0f, EPSILON); EXPECT_NEAR(evaluate_fcurve(fcu, 1.50f), 7.0f, EPSILON);
free_fcurve(fcu); BKE_fcurve_free(fcu);
} }
TEST(evaluate_fcurve, InterpolationLinear) TEST(evaluate_fcurve, InterpolationLinear)
@ -89,7 +89,7 @@ TEST(evaluate_fcurve, InterpolationLinear)
EXPECT_NEAR(evaluate_fcurve(fcu, 1.50f), 10.0f, EPSILON); EXPECT_NEAR(evaluate_fcurve(fcu, 1.50f), 10.0f, EPSILON);
EXPECT_NEAR(evaluate_fcurve(fcu, 1.75f), 11.5f, EPSILON); EXPECT_NEAR(evaluate_fcurve(fcu, 1.75f), 11.5f, EPSILON);
free_fcurve(fcu); BKE_fcurve_free(fcu);
} }
TEST(evaluate_fcurve, InterpolationBezier) TEST(evaluate_fcurve, InterpolationBezier)
@ -122,7 +122,7 @@ TEST(evaluate_fcurve, InterpolationBezier)
EXPECT_NEAR(evaluate_fcurve(fcu, 1.50f), 9.3495407f, EPSILON); EXPECT_NEAR(evaluate_fcurve(fcu, 1.50f), 9.3495407f, EPSILON);
EXPECT_NEAR(evaluate_fcurve(fcu, 1.75f), 11.088551f, EPSILON); EXPECT_NEAR(evaluate_fcurve(fcu, 1.75f), 11.088551f, EPSILON);
free_fcurve(fcu); BKE_fcurve_free(fcu);
} }
TEST(evaluate_fcurve, InterpolationBounce) TEST(evaluate_fcurve, InterpolationBounce)
@ -142,7 +142,7 @@ TEST(evaluate_fcurve, InterpolationBounce)
EXPECT_NEAR(evaluate_fcurve(fcu, 1.5f), 8.4062500f, EPSILON); EXPECT_NEAR(evaluate_fcurve(fcu, 1.5f), 8.4062500f, EPSILON);
EXPECT_NEAR(evaluate_fcurve(fcu, 1.8f), 11.184999f, EPSILON); EXPECT_NEAR(evaluate_fcurve(fcu, 1.8f), 11.184999f, EPSILON);
free_fcurve(fcu); BKE_fcurve_free(fcu);
} }
TEST(evaluate_fcurve, ExtrapolationLinearKeys) TEST(evaluate_fcurve, ExtrapolationLinearKeys)
@ -171,7 +171,7 @@ TEST(evaluate_fcurve, ExtrapolationLinearKeys)
EXPECT_NEAR(evaluate_fcurve(fcu, 2.75f), 13.0f, EPSILON); EXPECT_NEAR(evaluate_fcurve(fcu, 2.75f), 13.0f, EPSILON);
EXPECT_NEAR(evaluate_fcurve(fcu, 3.50f), 13.0f, EPSILON); EXPECT_NEAR(evaluate_fcurve(fcu, 3.50f), 13.0f, EPSILON);
free_fcurve(fcu); BKE_fcurve_free(fcu);
} }
TEST(evaluate_fcurve, ExtrapolationBezierKeys) TEST(evaluate_fcurve, ExtrapolationBezierKeys)
@ -207,5 +207,5 @@ TEST(evaluate_fcurve, ExtrapolationBezierKeys)
EXPECT_NEAR(evaluate_fcurve(fcu, 2.75f), 13.0f, EPSILON); EXPECT_NEAR(evaluate_fcurve(fcu, 2.75f), 13.0f, EPSILON);
EXPECT_NEAR(evaluate_fcurve(fcu, 3.50f), 13.0f, EPSILON); EXPECT_NEAR(evaluate_fcurve(fcu, 3.50f), 13.0f, EPSILON);
free_fcurve(fcu); BKE_fcurve_free(fcu);
} }