Files
test/source/blender/animrig/intern/driver.cc
Christoph Lendenfeld 0b67cc1db4 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
2024-01-18 17:19:15 +01:00

29 lines
802 B
C++

/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup animrig
*/
#include "ANIM_driver.hh"
#include "BKE_animsys.h"
#include "BKE_fcurve_driver.h"
#include "DNA_anim_types.h"
#include "RNA_access.hh"
namespace blender::animrig {
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)) {
return 0.0f;
}
return evaluate_driver(&anim_rna, fcu->driver, fcu->driver, anim_eval_context);
}
} // namespace blender::animrig