Refactor: Anim: rename animrig::action_fcurve_find to fcurve_find_in_action

This makes the naming a bit closer to the `BKE_fcurve_find()` function,
and opens op the naming for two upcoming functions
`fcurve_find_in_action_slot` and `fcurve_find_in_assigned_slot`.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/128036
This commit is contained in:
Sybren A. Stüvel
2024-09-23 15:21:58 +02:00
parent 559c39c889
commit 038eb3ed53
4 changed files with 13 additions and 8 deletions

View File

@@ -1299,9 +1299,14 @@ FCurve *action_fcurve_ensure(Main *bmain,
FCurveDescriptor fcurve_descriptor);
/**
* Find the F-Curve from the given Action. This assumes that all the destinations are valid.
* Find the F-Curve in the given Action.
*
* All the Action slots are searched for this F-Curve. To limit to a single
* slot, use fcurve_find_in_action_slot().
*
* \see blender::animrig::fcurve_find_in_action_slot
*/
FCurve *action_fcurve_find(bAction *act, FCurveDescriptor fcurve_descriptor);
FCurve *fcurve_find_in_action(bAction *act, FCurveDescriptor fcurve_descriptor);
/**
* Remove the given FCurve from the action by searching for it in all channelbags.

View File

@@ -2158,7 +2158,7 @@ Span<const FCurve *> fcurves_for_action_slot(const Action &action, const slot_ha
return bag->fcurves();
}
FCurve *action_fcurve_find(bAction *act, FCurveDescriptor fcurve_descriptor)
FCurve *fcurve_find_in_action(bAction *act, FCurveDescriptor fcurve_descriptor)
{
if (act == nullptr) {
return nullptr;

View File

@@ -523,7 +523,7 @@ static SingleKeyingResult insert_keyframe_fcurve_value(Main *bmain,
FCurve *fcu = key_insertion_may_create_fcurve(flag) ?
action_fcurve_ensure(bmain, act, group, ptr, {rna_path, array_index}) :
action_fcurve_find(act, {rna_path, array_index});
fcurve_find_in_action(act, {rna_path, array_index});
/* We may not have a F-Curve when we're replacing only. */
if (!fcu) {
@@ -645,7 +645,7 @@ int delete_keyframe(Main *bmain, ReportList *reports, ID *id, const RNAPath &rna
else {
/* Will only loop once unless the array index was -1. */
for (; array_index < array_index_max; array_index++) {
FCurve *fcu = action_fcurve_find(act, {rna_path.path, array_index});
FCurve *fcu = fcurve_find_in_action(act, {rna_path.path, array_index});
if (fcu == nullptr) {
continue;
@@ -749,7 +749,7 @@ int clear_keyframe(Main *bmain, ReportList *reports, ID *id, const RNAPath &rna_
}
/* Will only loop once unless the array index was -1. */
for (; array_index < array_index_max; array_index++) {
FCurve *fcu = action_fcurve_find(act, {rna_path.path, array_index});
FCurve *fcu = fcurve_find_in_action(act, {rna_path.path, array_index});
if (fcu == nullptr) {
continue;
@@ -1046,7 +1046,7 @@ CombinedKeyingResult insert_keyframes(Main *bmain,
/* Determine if at least one element would succeed getting keyed. */
bool at_least_one_would_succeed = false;
for (int i = 0; i < rna_values.size(); i++) {
const FCurve *fcu = action_fcurve_find(dna_action, {*rna_path_id_to_prop, i});
const FCurve *fcu = fcurve_find_in_action(dna_action, {*rna_path_id_to_prop, i});
if (!fcu) {
continue;
}

View File

@@ -1108,7 +1108,7 @@ static FCurve *rna_Action_fcurve_new(bAction *act,
# endif
/* Annoying, check if this exists. */
if (blender::animrig::action_fcurve_find(act, fcurve_descriptor)) {
if (blender::animrig::fcurve_find_in_action(act, fcurve_descriptor)) {
BKE_reportf(reports,
RPT_ERROR,
"F-Curve '%s[%d]' already exists in action '%s'",