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 -------- */
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 */

View File

@ -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);

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);
/* 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;
}
}

View File

@ -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;
}

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 */
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");

View File

@ -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) {

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 */
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;

View File

@ -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);
}
}
}

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) {
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;
}

View File

@ -759,7 +759,7 @@ static void do_version_bbone_scale_fcurve_fix(ListBase *curves, FCurve *fcu)
/* Update F-Curve's path. */
if (replace_bbone_scale_rnapath(&fcu->rna_path)) {
/* 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';

View File

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

View File

@ -988,7 +988,7 @@ static bAnimListElem *make_new_animlistelem(void *data,
* then free the MEM_alloc'd string
*/
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);
}
}

View File

@ -92,7 +92,7 @@ FCurve *verify_driver_fcurve(ID *id,
* - add if not found and allowed to add one
* 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) {
/* 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 */
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 */
fcu_iter = fcu->next;
/* remove F-Curve from driver stack, then free it */
BLI_remlink(&adt->drivers, fcu);
free_fcurve(fcu);
BKE_fcurve_free(fcu);
/* done successfully */
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);
if (fcu) {
BLI_remlink(&adt->drivers, fcu);
free_fcurve(fcu);
BKE_fcurve_free(fcu);
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 */
if (channeldriver_copypaste_buf) {
free_fcurve(channeldriver_copypaste_buf);
BKE_fcurve_free(channeldriver_copypaste_buf);
}
channeldriver_copypaste_buf = NULL;
}
@ -662,7 +662,7 @@ bool ANIM_copy_driver(
fcu->rna_path = NULL;
/* make a copy of the F-Curve with */
channeldriver_copypaste_buf = copy_fcurve(fcu);
channeldriver_copypaste_buf = BKE_fcurve_copy(fcu);
/* restore the 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. */
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);
}

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)) {
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
* 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) {
/* use default settings to make a F-Curve */
@ -1120,7 +1120,7 @@ static bool insert_keyframe_value(ReportList *reports,
eInsertKeyFlags flag)
{
/* F-Curve not editable? */
if (fcurve_is_keyframable(fcu) == 0) {
if (BKE_fcurve_is_keyframable(fcu) == 0) {
BKE_reportf(
reports,
RPT_ERROR,
@ -2400,7 +2400,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
* not have any effect.
*/
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) {
changed = insert_keyframe_direct(
@ -2417,7 +2417,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
FCurve *fcu;
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) {
changed = insert_keyframe_direct(
@ -2560,7 +2560,7 @@ static int delete_key_button_exec(bContext *C, wmOperator *op)
*/
ID *id = ptr.owner_id;
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 (BKE_fcurve_is_protected(fcu)) {
@ -3001,7 +3001,8 @@ bool ED_autokeyframe_property(
bool special;
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) {
return changed;

View File

@ -516,11 +516,11 @@ static void updateDuplicateActionConstraintSettings(EditBone *dup_bone,
/* See if there is any channels that uses this bone */
ListBase 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 */
for (LinkData *ld = ani_curves.first; ld; ld = ld->next) {
FCurve *old_curve = ld->data;
FCurve *new_curve = copy_fcurve(old_curve);
FCurve *new_curve = BKE_fcurve_copy(old_curve);
bActionGroup *agrp;
char *old_path = new_curve->rna_path;

View File

@ -936,13 +936,13 @@ static void fcurve_path_rename(AnimData *adt,
nextfcu = fcu->next;
if (STREQLEN(fcu->rna_path, orig_rna_path, len)) {
char *spath, *suffix = fcu->rna_path + len;
nfcu = copy_fcurve(fcu);
nfcu = BKE_fcurve_copy(fcu);
spath = nfcu->rna_path;
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.
* As a result, the group's 'channels' pointers will be wrong, which is fixed by calling
* `action_groups_reconstruct(action)` later, after all fcurves have been renamed. */
/* BKE_fcurve_copy() sets nfcu->grp to NULL. To maintain the groups, we need to keep the
* pointer. As a result, the group's 'channels' pointers will be wrong, which is fixed by
* calling `action_groups_reconstruct(action)` later, after all fcurves have been renamed. */
nfcu->grp = fcu->grp;
BLI_addtail(curves, nfcu);
@ -956,7 +956,7 @@ static void fcurve_path_rename(AnimData *adt,
BLI_remlink(&adt->drivers, fcu);
}
free_fcurve(fcu);
BKE_fcurve_free(fcu);
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);
}
free_fcurve(fcu);
BKE_fcurve_free(fcu);
}
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->action) {
free_fcurves(&ad->action->curves);
copy_fcurves(&ad->action->curves, &ucu->fcurves);
BKE_fcurves_free(&ad->action->curves);
BKE_fcurves_copy(&ad->action->curves, &ucu->fcurves);
}
free_fcurves(&ad->drivers);
copy_fcurves(&ad->drivers, &ucu->drivers);
BKE_fcurves_free(&ad->drivers);
BKE_fcurves_copy(&ad->drivers, &ucu->drivers);
}
/* copy */
@ -132,10 +132,10 @@ static void undocurve_from_editcurve(UndoCurve *ucu, Curve *cu, const short shap
if (ad) {
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 */
@ -167,8 +167,8 @@ static void undocurve_free_data(UndoCurve *uc)
BKE_curve_editNurb_keyIndex_free(&uc->undoIndex);
free_fcurves(&uc->fcurves);
free_fcurves(&uc->drivers);
BKE_fcurves_free(&uc->fcurves);
BKE_fcurves_free(&uc->drivers);
}
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 */
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);
}

View File

@ -1061,7 +1061,7 @@ static int followpath_path_animate_exec(bContext *C, wmOperator *op)
Curve *cu = (Curve *)data->tar->data;
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 */
act = ED_id_action_ensure(bmain, &cu->id);
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;
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) {
/* Isolate this F-Curve... */
bAnimContext ac;

View File

@ -218,7 +218,7 @@ static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
float tmin, tmax;
/* 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) {
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;
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);
/* 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.
*/
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 */
if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) {
switch (fcm->type) {

View File

@ -126,7 +126,8 @@ void get_graph_keyframe_extents(bAnimContext *ac,
float unitFac, offset;
/* 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);
/* apply NLA scaling */
@ -409,7 +410,7 @@ static void create_ghost_curves(bAnimContext *ac, int start, int end)
int filter;
/* free existing ghost curves */
free_fcurves(&sipo->runtime.ghost_curves);
BKE_fcurves_free(&sipo->runtime.ghost_curves);
/* sanity check */
if (start >= end) {
@ -536,7 +537,7 @@ static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
}
/* free ghost curves */
free_fcurves(&sipo->runtime.ghost_curves);
BKE_fcurves_free(&sipo->runtime.ghost_curves);
/* update this editor only */
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
* keyframes if these will be visible after doing so...
*/
if (fcurve_is_keyframable(fcu)) {
if (BKE_fcurve_is_keyframable(fcu)) {
ListBase anim_data;
ToolSettings *ts = ac.scene->toolsettings;

View File

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

View File

@ -145,7 +145,7 @@ static void graph_free(SpaceLink *sl)
}
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 -------------------------- */
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;
/* 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;
/* 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);
}

View File

@ -274,7 +274,7 @@ AnimationImporter::~AnimationImporter()
/* free unused FCurves */
for (std::vector<FCurve *>::iterator it = unused_curves.begin(); it != unused_curves.end();
it++) {
free_fcurve(*it);
BKE_fcurve_free(*it);
}
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]);
free_fcurve(eulcu[i]);
BKE_fcurve_free(eulcu[i]);
}
chan->rotmode = ROT_MODE_QUAT;

View File

@ -89,7 +89,7 @@ void BCAnimationCurve::init_pointer_rna(Object *ob)
void BCAnimationCurve::delete_fcurve(FCurve *fcu)
{
free_fcurve(fcu);
BKE_fcurve_free(fcu);
}
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++) {
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;
}
}

View File

@ -147,7 +147,7 @@ static FCurve *rna_Action_fcurve_find(bAction *act,
}
/* 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)
@ -164,7 +164,7 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, PointerR
}
action_groups_remove_channel(act, fcu);
free_fcurve(fcu);
BKE_fcurve_free(fcu);
RNA_POINTER_INVALIDATE(fcu_ptr);
}
else {
@ -174,7 +174,7 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, PointerR
}
BLI_remlink(&act->curves, fcu);
free_fcurve(fcu);
BKE_fcurve_free(fcu);
RNA_POINTER_INVALIDATE(fcu_ptr);
}

View File

@ -648,7 +648,7 @@ static FCurve *rna_Driver_from_existing(AnimData *adt, bContext *C, FCurve *src_
}
else {
/* 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 */
BLI_addtail(&adt->drivers, new_fcu);
@ -664,7 +664,7 @@ static FCurve *rna_Driver_new(
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);
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");
return;
}
free_fcurve(fcu);
BKE_fcurve_free(fcu);
DEG_relations_tag_update(bmain);
}
@ -698,7 +698,7 @@ static FCurve *rna_Driver_find(AnimData *adt,
}
/* 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),

View File

@ -579,7 +579,7 @@ static void rna_FCurve_group_set(PointerRNA *ptr,
/* calculate time extents of F-Curve */
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)

View File

@ -382,7 +382,7 @@ static FCurve *rna_NlaStrip_fcurve_find(NlaStrip *strip,
}
/* 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,

View File

@ -354,7 +354,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
if (prop) {
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);
}
@ -462,7 +462,7 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
if (prop) {
ID *id = ptr.owner_id;
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. */
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 */
int i = 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);
PyList_APPEND(ret, pyrna_struct_CreatePyObject(&tptr));
}
}
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);
ret = pyrna_struct_CreatePyObject(&tptr);
}

View File

@ -34,7 +34,7 @@ TEST(evaluate_fcurve, EmptyFCurve)
{
FCurve *fcu = BKE_fcurve_create();
EXPECT_EQ(evaluate_fcurve(fcu, 47.0f), 0.0f);
free_fcurve(fcu);
BKE_fcurve_free(fcu);
}
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);
free_fcurve(fcu);
BKE_fcurve_free(fcu);
}
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.50f), 7.0f, EPSILON);
free_fcurve(fcu);
BKE_fcurve_free(fcu);
}
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.75f), 11.5f, EPSILON);
free_fcurve(fcu);
BKE_fcurve_free(fcu);
}
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.75f), 11.088551f, EPSILON);
free_fcurve(fcu);
BKE_fcurve_free(fcu);
}
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.8f), 11.184999f, EPSILON);
free_fcurve(fcu);
BKE_fcurve_free(fcu);
}
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, 3.50f), 13.0f, EPSILON);
free_fcurve(fcu);
BKE_fcurve_free(fcu);
}
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, 3.50f), 13.0f, EPSILON);
free_fcurve(fcu);
BKE_fcurve_free(fcu);
}