Refactor: Rename functions in animrig to remove prefix #114450

Merged
Christoph Lendenfeld merged 2 commits from ChrisLend/blender:refactor_function_names into main 2023-11-03 12:03:43 +01:00
12 changed files with 32 additions and 36 deletions

View File

@ -20,17 +20,17 @@ namespace blender::animrig {
* Get (or add relevant data to be able to do so) F-Curve from the given Action,
* for the given Animation Data block. This assumes that all the destinations are valid.
*/
FCurve *ED_action_fcurve_ensure(Main *bmain,
bAction *act,
const char group[],
PointerRNA *ptr,
const char rna_path[],
int array_index);
FCurve *action_fcurve_ensure(Main *bmain,
bAction *act,
const char group[],
PointerRNA *ptr,
const char rna_path[],
int array_index);
/**
* Find the F-Curve from the given Action. This assumes that all the destinations are valid.
*/
FCurve *ED_action_fcurve_find(bAction *act, const char rna_path[], int array_index);
FCurve *action_fcurve_find(bAction *act, const char rna_path[], int array_index);
/**
* \note The caller needs to run #BKE_nla_tweakedit_remap to get NLA relative frame.

View File

@ -14,6 +14,6 @@
namespace blender::animrig {
/** Get the values of the given property. Casts non-float properties to float. */
Vector<float> ANIM_setting_get_rna_values(PointerRNA *ptr, PropertyRNA *prop);
Vector<float> get_rna_values(PointerRNA *ptr, PropertyRNA *prop);
} // namespace blender::animrig

View File

@ -6,15 +6,13 @@
* \ingroup animrig
*/
#include "ANIM_rna.hh"
#include "BLI_vector.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "RNA_path.hh"
#include "RNA_types.hh"
namespace blender::animrig {
Vector<float> ANIM_setting_get_rna_values(PointerRNA *ptr, PropertyRNA *prop)
Vector<float> get_rna_values(PointerRNA *ptr, PropertyRNA *prop)
{
Vector<float> values;
if (RNA_property_array_check(prop)) {

View File

@ -18,7 +18,7 @@
namespace blender::animrig {
FCurve *ED_action_fcurve_find(bAction *act, const char rna_path[], const int array_index)
FCurve *action_fcurve_find(bAction *act, const char rna_path[], const int array_index)
{
if (ELEM(nullptr, act, rna_path)) {
return nullptr;
@ -26,12 +26,12 @@ FCurve *ED_action_fcurve_find(bAction *act, const char rna_path[], const int arr
return BKE_fcurve_find(&act->curves, rna_path, array_index);
}
FCurve *ED_action_fcurve_ensure(Main *bmain,
bAction *act,
const char group[],
PointerRNA *ptr,
const char rna_path[],
const int array_index)
FCurve *action_fcurve_ensure(Main *bmain,
bAction *act,
const char group[],
PointerRNA *ptr,
const char rna_path[],
const int array_index)
{
bActionGroup *agrp;
FCurve *fcu;

View File

@ -157,7 +157,7 @@ static Vector<float> get_keyframe_values(ReportList *reports,
values = visualkey_get_values(&ptr, prop);
}
else {
values = ANIM_setting_get_rna_values(&ptr, prop);
values = get_rna_values(&ptr, prop);
}
*r_successful_remaps = BLI_BITMAP_NEW(values.size(), __func__);
@ -530,8 +530,8 @@ static bool insert_keyframe_fcurve_value(Main *bmain,
*/
const bool can_create_curve = (flag & (INSERTKEY_REPLACE | INSERTKEY_AVAILABLE)) == 0;
FCurve *fcu = can_create_curve ?
ED_action_fcurve_ensure(bmain, act, group, ptr, rna_path, array_index) :
ED_action_fcurve_find(act, rna_path, array_index);
action_fcurve_ensure(bmain, act, group, ptr, rna_path, array_index) :
action_fcurve_find(act, rna_path, array_index);
/* We may not have a F-Curve when we're replacing only. */
if (!fcu) {
@ -837,7 +837,7 @@ int delete_keyframe(Main *bmain,
/* Will only loop once unless the array index was -1. */
int key_count = 0;
for (; array_index < array_index_max; array_index++) {
FCurve *fcu = ED_action_fcurve_find(act, rna_path, array_index);
FCurve *fcu = action_fcurve_find(act, rna_path, array_index);
if (fcu == nullptr) {
continue;
@ -920,7 +920,7 @@ int clear_keyframe(Main *bmain,
int key_count = 0;
/* Will only loop once unless the array index was -1. */
for (; array_index < array_index_max; array_index++) {
FCurve *fcu = ED_action_fcurve_find(act, rna_path, array_index);
FCurve *fcu = action_fcurve_find(act, rna_path, array_index);
if (fcu == nullptr) {
continue;

View File

@ -239,7 +239,7 @@ Vector<float> visualkey_get_values(PointerRNA *ptr, PropertyRNA *prop)
}
}
else {
return ANIM_setting_get_rna_values(ptr, prop);
return get_rna_values(ptr, prop);
}
/* Rot/Scale code are common! */
@ -269,6 +269,6 @@ Vector<float> visualkey_get_values(PointerRNA *ptr, PropertyRNA *prop)
}
/* As the function hasn't returned yet, read value from system in the default way. */
return ANIM_setting_get_rna_values(ptr, prop);
return get_rna_values(ptr, prop);
}
} // namespace blender::animrig

View File

@ -5095,8 +5095,7 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi
/* find or create new F-Curve */
/* XXX is the group name for this ok? */
bAction *act = ED_id_action_ensure(bmain, (ID *)key);
FCurve *fcu = blender::animrig::ED_action_fcurve_ensure(
bmain, act, nullptr, &ptr, rna_path, 0);
FCurve *fcu = blender::animrig::action_fcurve_ensure(bmain, act, nullptr, &ptr, rna_path, 0);
/* set the special 'replace' flag if on a keyframe */
if (fcurve_frame_has_keyframe(fcu, remapped_frame)) {

View File

@ -1476,7 +1476,7 @@ bool fcurve_is_changed(PointerRNA ptr,
anim_rna.prop_index = fcu->array_index;
int index = fcu->array_index;
blender::Vector<float> values = blender::animrig::ANIM_setting_get_rna_values(&ptr, prop);
blender::Vector<float> values = blender::animrig::get_rna_values(&ptr, prop);
float fcurve_val = calculate_fcurve(&anim_rna, fcu, anim_eval_context);
float cur_val = (index >= 0 && index < values.size()) ? values[index] : 0.0f;

View File

@ -525,7 +525,7 @@ static void gpencil_stroke_path_animation(bContext *C,
/* Ensure we have an F-Curve to add keyframes to */
act = ED_id_action_ensure(bmain, (ID *)cu);
fcu = blender::animrig::ED_action_fcurve_ensure(bmain, act, nullptr, &ptr, "eval_time", 0);
fcu = blender::animrig::action_fcurve_ensure(bmain, act, nullptr, &ptr, "eval_time", 0);
if (gtd->mode == GP_STROKECONVERT_TIMING_LINEAR) {
float cfra;

View File

@ -1073,8 +1073,7 @@ static int followpath_path_animate_exec(bContext *C, wmOperator *op)
{
/* create F-Curve for path animation */
act = ED_id_action_ensure(bmain, &cu->id);
fcu = blender::animrig::ED_action_fcurve_ensure(
bmain, act, nullptr, nullptr, "eval_time", 0);
fcu = blender::animrig::action_fcurve_ensure(bmain, act, nullptr, nullptr, "eval_time", 0);
/* standard vertical range - 1:1 = 100 frames */
standardRange = 100.0f;
@ -1098,7 +1097,7 @@ static int followpath_path_animate_exec(bContext *C, wmOperator *op)
/* create F-Curve for constraint */
act = ED_id_action_ensure(bmain, &ob->id);
fcu = blender::animrig::ED_action_fcurve_ensure(bmain, act, nullptr, nullptr, path, 0);
fcu = blender::animrig::action_fcurve_ensure(bmain, act, nullptr, nullptr, path, 0);
/* standard vertical range - 0.0 to 1.0 */
standardRange = 1.0f;

View File

@ -562,7 +562,7 @@ bool ED_object_parent_set(ReportList *reports,
if (partype == PAR_FOLLOW) {
/* get or create F-Curve */
bAction *act = ED_id_action_ensure(bmain, &cu->id);
FCurve *fcu = blender::animrig::ED_action_fcurve_ensure(
FCurve *fcu = blender::animrig::action_fcurve_ensure(
bmain, act, nullptr, nullptr, "eval_time", 0);
/* setup dummy 'generator' modifier here to get 1-1 correspondence still working */

View File

@ -112,7 +112,7 @@ static FCurve *rna_Action_fcurve_new(bAction *act,
}
/* Annoying, check if this exists. */
if (blender::animrig::ED_action_fcurve_find(act, data_path, index)) {
if (blender::animrig::action_fcurve_find(act, data_path, index)) {
BKE_reportf(reports,
RPT_ERROR,
"F-Curve '%s[%d]' already exists in action '%s'",
@ -121,7 +121,7 @@ static FCurve *rna_Action_fcurve_new(bAction *act,
act->id.name + 2);
return nullptr;
}
return blender::animrig::ED_action_fcurve_ensure(bmain, act, group, nullptr, data_path, index);
return blender::animrig::action_fcurve_ensure(bmain, act, group, nullptr, data_path, index);
}
static FCurve *rna_Action_fcurve_find(bAction *act,