Refactor: rename function to evaluate a driver

No functional changes.

In #116823 the function `remap_driver_frame` was moved,
but the name doesn't exactly correspond to what the function is doing.

Since it evaluates the driver, with different parameters, it is now called
`evaluate_driver_from_rna_pointer`.

We could maybe remove the function because it is only called once.

Pull Request: https://projects.blender.org/blender/blender/pulls/117294
This commit is contained in:
Christoph Lendenfeld
2024-01-18 17:19:15 +01:00
committed by Christoph Lendenfeld
parent b5743dcf0a
commit 0b67cc1db4
3 changed files with 9 additions and 9 deletions

View File

@@ -17,9 +17,9 @@ namespace blender::animrig {
/** Evaluates the driver on the frame given in `anim_eval_context` and returns the value. Returns 0
* if the RNA path can't be resolved. */
float remap_driver_frame(const AnimationEvalContext *anim_eval_context,
PointerRNA *ptr,
PropertyRNA *prop,
const FCurve *fcu);
float evaluate_driver_from_rna_pointer(const AnimationEvalContext *anim_eval_context,
PointerRNA *ptr,
PropertyRNA *prop,
const FCurve *fcu);
} // namespace blender::animrig

View File

@@ -14,10 +14,10 @@
namespace blender::animrig {
float remap_driver_frame(const AnimationEvalContext *anim_eval_context,
PointerRNA *ptr,
PropertyRNA *prop,
const FCurve *fcu)
float evaluate_driver_from_rna_pointer(const AnimationEvalContext *anim_eval_context,
PointerRNA *ptr,
PropertyRNA *prop,
const FCurve *fcu)
{
PathResolvedRNA anim_rna;
if (!RNA_path_resolved_create(ptr, prop, fcu->array_index, &anim_rna)) {

View File

@@ -939,7 +939,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
C, &ptr, prop, index, nullptr, nullptr, &driven, &special);
if (fcu && driven) {
const float driver_frame = blender::animrig::remap_driver_frame(
const float driver_frame = blender::animrig::evaluate_driver_from_rna_pointer(
&anim_eval_context, &ptr, prop, fcu);
AnimationEvalContext remapped_context = BKE_animsys_eval_context_construct(
CTX_data_depsgraph_pointer(C), driver_frame);