Blender  V3.3
Classes | Macros | Typedefs | Enumerations | Functions
BKE_fcurve.h File Reference
#include "DNA_curve_types.h"

Go to the source code of this file.

Classes

struct  CfraElem
 
struct  FModifierTypeInfo
 
struct  FModifiersStackStorage
 

Macros

#define BEZT_BINARYSEARCH_THRESH   0.01f /* was 0.00001, but giving errors */
 

Typedefs

typedef struct CfraElem CfraElem
 
typedef struct FModifierTypeInfo FModifierTypeInfo
 
typedef enum eFMI_Action_Types eFMI_Action_Types
 
typedef enum eFMI_Requirement_Flags eFMI_Requirement_Flags
 
typedef struct FModifiersStackStorage FModifiersStackStorage
 
typedef enum eFCU_Cycle_Type eFCU_Cycle_Type
 
typedef float(* FcuSampleFunc) (struct FCurve *fcu, void *data, float evaltime)
 

Enumerations

enum  eFMI_Action_Types { FMI_TYPE_EXTRAPOLATION = 0 , FMI_TYPE_INTERPOLATION , FMI_TYPE_REPLACE_VALUES , FMI_TYPE_GENERATE_CURVE }
 
enum  eFMI_Requirement_Flags { FMI_REQUIRES_ORIGINAL_DATA = (1 << 0) , FMI_REQUIRES_NOTHING = (1 << 1) , FMI_REQUIRES_RUNTIME_CHECK = (1 << 2) }
 
enum  eFCU_Cycle_Type { FCU_CYCLE_NONE = 0 , FCU_CYCLE_PERFECT , FCU_CYCLE_OFFSET }
 

Functions

const FModifierTypeInfofmodifier_get_typeinfo (const struct FModifier *fcm)
 
const FModifierTypeInfoget_fmodifier_typeinfo (int type)
 
struct FModifieradd_fmodifier (ListBase *modifiers, int type, struct FCurve *owner_fcu)
 
struct FModifiercopy_fmodifier (const struct FModifier *src)
 
void copy_fmodifiers (ListBase *dst, const ListBase *src)
 
bool remove_fmodifier (ListBase *modifiers, struct FModifier *fcm)
 
void free_fmodifiers (ListBase *modifiers)
 
struct FModifierfind_active_fmodifier (ListBase *modifiers)
 
void set_active_fmodifier (ListBase *modifiers, struct FModifier *fcm)
 
bool list_has_suitable_fmodifier (ListBase *modifiers, int mtype, short acttype)
 
uint evaluate_fmodifiers_storage_size_per_modifier (ListBase *modifiers)
 
float evaluate_time_fmodifiers (FModifiersStackStorage *storage, ListBase *modifiers, struct FCurve *fcu, float cvalue, float evaltime)
 
void evaluate_value_fmodifiers (FModifiersStackStorage *storage, ListBase *modifiers, struct FCurve *fcu, float *cvalue, float evaltime)
 
void fcurve_bake_modifiers (struct FCurve *fcu, int start, int end)
 
int BKE_fcm_envelope_find_index (struct FCM_EnvelopeData *array, float frame, int arraylen, bool *r_exists)
 
struct FCurveBKE_fcurve_create (void)
 
void BKE_fcurve_free (struct FCurve *fcu)
 
struct FCurveBKE_fcurve_copy (const struct FCurve *fcu)
 
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)
 
struct FCurveBKE_fcurve_find (ListBase *list, const char rna_path[], int array_index)
 
struct FCurveBKE_fcurve_iter_step (struct FCurve *fcu_iter, const char rna_path[])
 
struct FCurveid_data_find_fcurve (ID *id, void *data, struct StructRNA *type, const char *prop_name, int index, bool *r_driven)
 
int BKE_fcurves_filter (ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName)
 
struct FCurveBKE_animadata_fcurve_find_by_rna_path (struct AnimData *animdata, const char *rna_path, const int rna_index, struct bAction **r_action, bool *r_driven)
 
struct FCurveBKE_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)
 
struct FCurveBKE_fcurve_find_by_rna_context_ui (struct bContext *C, const struct PointerRNA *ptr, struct PropertyRNA *prop, int rnaindex, struct AnimData **r_animdata, struct bAction **r_action, bool *r_driven, bool *r_special)
 
int BKE_fcurve_bezt_binarysearch_index (const struct BezTriple array[], float frame, int arraylen, bool *r_replace)
 
struct FCurvePathCacheBKE_fcurve_pathcache_create (ListBase *list)
 
void BKE_fcurve_pathcache_destroy (struct FCurvePathCache *fcache)
 
struct FCurveBKE_fcurve_pathcache_find (struct FCurvePathCache *fcache, const char rna_path[], int array_index)
 
int BKE_fcurve_pathcache_find_array (struct FCurvePathCache *fcache, const char *rna_path, struct FCurve **fcurve_result, int fcurve_result_len)
 
bool BKE_fcurve_calc_range (struct FCurve *fcu, float *min, float *max, bool do_sel_only, bool do_min_length)
 
bool BKE_fcurve_calc_bounds (struct FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax, bool do_sel_only, bool include_handles)
 
floatBKE_fcurves_calc_keyed_frames_ex (struct FCurve **fcurve_array, int fcurve_array_len, float interval, int *r_frames_len)
 
floatBKE_fcurves_calc_keyed_frames (struct FCurve **fcurve_array, int fcurve_array_len, int *r_frames_len)
 
void BKE_fcurve_active_keyframe_set (struct FCurve *fcu, const struct BezTriple *active_bezt)
 
int BKE_fcurve_active_keyframe_index (const struct FCurve *fcu)
 
void BKE_fcurve_keyframe_move_value_with_handles (struct BezTriple *keyframe, float new_value)
 
bool BKE_fcurve_are_keyframes_usable (struct FCurve *fcu)
 
bool BKE_fcurve_is_keyframable (struct FCurve *fcu)
 
bool BKE_fcurve_is_protected (struct FCurve *fcu)
 
bool BKE_fcurve_is_cyclic (struct FCurve *fcu)
 
eFCU_Cycle_Type BKE_fcurve_get_cycle_type (struct FCurve *fcu)
 
bool BKE_fcurve_bezt_subdivide_handles (struct BezTriple *bezt, struct BezTriple *prev, struct BezTriple *next, float *r_pdelta)
 
void BKE_fcurve_delete_key (struct FCurve *fcu, int index)
 
bool BKE_fcurve_delete_keys_selected (struct FCurve *fcu)
 
void BKE_fcurve_delete_keys_all (struct FCurve *fcu)
 
void BKE_fcurve_handles_recalc (struct FCurve *fcu)
 
void BKE_fcurve_handles_recalc_ex (struct FCurve *fcu, eBezTriple_Flag handle_sel_flag)
 
void testhandles_fcurve (struct FCurve *fcu, eBezTriple_Flag sel_flag, bool use_handle)
 
void sort_time_fcurve (struct FCurve *fcu)
 
bool test_time_fcurve (struct FCurve *fcu)
 
void BKE_fcurve_correct_bezpart (const float v1[2], float v2[2], float v3[2], const float v4[2])
 
float evaluate_fcurve (struct FCurve *fcu, float evaltime)
 
float evaluate_fcurve_only_curve (struct FCurve *fcu, float evaltime)
 
float evaluate_fcurve_driver (struct PathResolvedRNA *anim_rna, struct FCurve *fcu, struct ChannelDriver *driver_orig, const struct AnimationEvalContext *anim_eval_context)
 
bool BKE_fcurve_is_empty (struct FCurve *fcu)
 
float calculate_fcurve (struct PathResolvedRNA *anim_rna, struct FCurve *fcu, const struct AnimationEvalContext *anim_eval_context)
 
float fcurve_samplingcb_evalcurve (struct FCurve *fcu, void *data, float evaltime)
 
void fcurve_store_samples (struct FCurve *fcu, void *data, int start, int end, FcuSampleFunc sample_cb)
 
void fcurve_samples_to_keyframes (struct FCurve *fcu, int start, int end)
 
void BKE_fmodifiers_blend_write (struct BlendWriter *writer, struct ListBase *fmodifiers)
 
void BKE_fmodifiers_blend_read_data (struct BlendDataReader *reader, ListBase *fmodifiers, struct FCurve *curve)
 
void BKE_fmodifiers_blend_read_lib (struct BlendLibReader *reader, struct ID *id, struct ListBase *fmodifiers)
 
void BKE_fmodifiers_blend_read_expand (struct BlendExpander *expander, struct ListBase *fmodifiers)
 
void BKE_fcurve_blend_write (struct BlendWriter *writer, struct ListBase *fcurves)
 
void BKE_fcurve_blend_read_data (struct BlendDataReader *reader, struct ListBase *fcurves)
 
void BKE_fcurve_blend_read_lib (struct BlendLibReader *reader, struct ID *id, struct ListBase *fcurves)
 
void BKE_fcurve_blend_read_expand (struct BlendExpander *expander, struct ListBase *fcurves)
 

Macro Definition Documentation

◆ BEZT_BINARYSEARCH_THRESH

#define BEZT_BINARYSEARCH_THRESH   0.01f /* was 0.00001, but giving errors */

Definition at line 222 of file BKE_fcurve.h.

Typedef Documentation

◆ CfraElem

typedef struct CfraElem CfraElem

◆ eFCU_Cycle_Type

◆ eFMI_Action_Types

◆ eFMI_Requirement_Flags

◆ FcuSampleFunc

typedef float(* FcuSampleFunc) (struct FCurve *fcu, void *data, float evaltime)

Basic signature for F-Curve sample-creation function.

Parameters
fcuthe F-Curve being operated on.
datapointer to some specific data that may be used by one of the callbacks.

Definition at line 561 of file BKE_fcurve.h.

◆ FModifiersStackStorage

◆ FModifierTypeInfo

F-Curve Modifier Type-Info (fmi): This struct provides function pointers for runtime, so that functions can be written more generally (with fewer/no special exceptions for various modifiers).

Callers of these functions must check that they actually point to something useful, as some constraints don't define some of these.

Warning
it is not too advisable to reorder order of members of this struct, as you'll have to edit quite a few (FMODIFIER_NUM_TYPES) of these structs.

Enumeration Type Documentation

◆ eFCU_Cycle_Type

Enumerator
FCU_CYCLE_NONE 
FCU_CYCLE_PERFECT 
FCU_CYCLE_OFFSET 

Definition at line 440 of file BKE_fcurve.h.

◆ eFMI_Action_Types

Enumerator
FMI_TYPE_EXTRAPOLATION 
FMI_TYPE_INTERPOLATION 
FMI_TYPE_REPLACE_VALUES 
FMI_TYPE_GENERATE_CURVE 

Definition at line 96 of file BKE_fcurve.h.

◆ eFMI_Requirement_Flags

Enumerator
FMI_REQUIRES_ORIGINAL_DATA 
FMI_REQUIRES_NOTHING 
FMI_REQUIRES_RUNTIME_CHECK 

Definition at line 108 of file BKE_fcurve.h.

Function Documentation

◆ add_fmodifier()

struct FModifier* add_fmodifier ( ListBase modifiers,
int  type,
struct FCurve owner_fcu 
)

◆ BKE_animadata_fcurve_find_by_rna_path()

struct FCurve* BKE_animadata_fcurve_find_by_rna_path ( struct AnimData animdata,
const char *  rna_path,
const int  rna_index,
struct bAction **  r_action,
bool r_driven 
)

Find an F-Curve from its rna path and index.

If there is an action assigned to the animdata, it will be searched for a matching F-curve first. Drivers are searched only if no valid action F-curve could be found.

Note
Typically, indices in RNA arrays are stored separately in F-curves, so the rna_path should not include them (e.g. ‘rna_path='location[0]’will not match any F-Curve on an Object, butrna_path='location', rna_index=0` will if it exists).
Return pointer parameters (r_action, r_driven and r_special) are all optional and may be NULL.

Definition at line 339 of file fcurve.c.

References AnimData::action, BKE_fcurve_find(), BLI_listbase_is_empty(), bAction::curves, AnimData::drivers, and NULL.

Referenced by BKE_fcurve_find_by_rna_context_ui(), BKE_lib_override_library_property_is_animated(), and id_data_find_fcurve().

◆ BKE_fcm_envelope_find_index()

int BKE_fcm_envelope_find_index ( struct FCM_EnvelopeData array,
float  frame,
int  arraylen,
bool r_exists 
)

◆ BKE_fcurve_active_keyframe_index()

int BKE_fcurve_active_keyframe_index ( const struct FCurve fcu)

Get the active keyframe index, with sanity checks for point bounds.

Referenced by draw_fcurve_active_handle_vertices(), draw_fcurve_active_vertex(), get_active_fcurve_keyframe_edit(), mouse_graph_keys(), and blender::bke::tests::TEST().

◆ BKE_fcurve_active_keyframe_set()

void BKE_fcurve_active_keyframe_set ( struct FCurve fcu,
const struct BezTriple active_bezt 
)

Set the index that stores the FCurve's active keyframe, assuming that active_bezt is already part of fcu->bezt. If NULL, set active keyframe index to "none."

Referenced by insert_vert_fcurve(), mouse_graph_keys(), and blender::bke::tests::TEST().

◆ BKE_fcurve_are_keyframes_usable()

bool BKE_fcurve_are_keyframes_usable ( struct FCurve fcu)

Are keyframes on F-Curve of any use (to final result, and to show in editors)? Usability of keyframes refers to whether they should be displayed, and also whether they will have any influence on the final result.

Definition at line 903 of file fcurve.c.

References data, FModifier::data, FCM_GENERATOR_ADDITIVE, ListBase::first, FModifier::flag, FMODIFIER_FLAG_DISABLED, FMODIFIER_FLAG_MUTED, FMODIFIER_TYPE_CYCLES, FMODIFIER_TYPE_FN_GENERATOR, FMODIFIER_TYPE_GENERATOR, FMODIFIER_TYPE_NOISE, FMODIFIER_TYPE_STEPPED, FCurve::fpt, if(), ListBase::last, FCurve::modifiers, NULL, FModifier::prev, and FModifier::type.

Referenced by BKE_fcurve_is_keyframable(), draw_fcurve(), and graphop_visible_keyframes_poll().

◆ BKE_fcurve_bezt_binarysearch_index()

int BKE_fcurve_bezt_binarysearch_index ( const struct BezTriple  array[],
float  frame,
int  arraylen,
bool r_replace 
)

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)

Definition at line 561 of file fcurve.c.

References BEZT_BINARYSEARCH_THRESH, and BKE_fcurve_bezt_binarysearch_index_ex().

Referenced by delete_key_button_exec(), delete_keyframe_fcurve(), fcurve_frame_has_keyframe(), gather_frames_to_render_for_adt(), insert_bezt_fcurve(), pose_propagate_fcurve(), and pyrna_struct_keyframe_delete().

◆ BKE_fcurve_bezt_subdivide_handles()

bool BKE_fcurve_bezt_subdivide_handles ( struct BezTriple bezt,
struct BezTriple prev,
struct BezTriple next,
float r_pdelta 
)

Recompute bezier handles of all three given BezTriples, so that bezt can be inserted between prev and next without changing the resulting curve shape.

Parameters
r_pdeltareturn Y difference between bezt and the original curve value at its X position.
Returns
Whether the split was successful.

Definition at line 1600 of file fcurve.c.

References add_v2_v2v2(), BKE_fcurve_correct_bezpart(), copy_v2_v2(), findzero(), interp_v2_v2v2(), next, blender::meshintersect::prev(), sub_v2_v2v2(), t, and BezTriple::vec.

Referenced by subdivide_nonauto_handles(), and blender::bke::tests::TEST().

◆ BKE_fcurve_blend_read_data()

void BKE_fcurve_blend_read_data ( struct BlendDataReader reader,
struct ListBase fcurves 
)

◆ BKE_fcurve_blend_read_expand()

void BKE_fcurve_blend_read_expand ( struct BlendExpander expander,
struct ListBase fcurves 
)

◆ BKE_fcurve_blend_read_lib()

void BKE_fcurve_blend_read_lib ( struct BlendLibReader reader,
struct ID id,
struct ListBase fcurves 
)

◆ BKE_fcurve_blend_write()

void BKE_fcurve_blend_write ( struct BlendWriter writer,
struct ListBase fcurves 
)

◆ BKE_fcurve_calc_bounds()

bool BKE_fcurve_calc_bounds ( struct FCurve fcu,
float xmin,
float xmax,
float ymin,
float ymax,
bool  do_sel_only,
bool  include_handles 
)

◆ BKE_fcurve_calc_range()

bool BKE_fcurve_calc_range ( struct FCurve fcu,
float min,
float max,
bool  do_sel_only,
bool  do_min_length 
)

Calculate the extents of F-Curve's keyframes.

Definition at line 754 of file fcurve.c.

References FCurve::bezt, BLI_assert, FCurve::fpt, get_fcurve_end_keyframes(), max, max_ff(), min, min_ff(), NULL, FCurve::totvert, FPoint::vec, and BezTriple::vec.

Referenced by calc_action_range(), draw_fcurve_curve(), and get_keyframe_extents().

◆ BKE_fcurve_copy()

struct FCurve* BKE_fcurve_copy ( const struct FCurve fcu)

◆ BKE_fcurve_correct_bezpart()

void BKE_fcurve_correct_bezpart ( const float  v1[2],
float  v2[2],
float  v3[2],
const float  v4[2] 
)

The length of each handle is not allowed to be more than the horizontal distance between (v1-v4). This is to prevent curve loops.

This function is very similar to BKE_curve_correct_bezpart(), but allows a steeper tangent for more snappy animations. This is not desired for other areas in which curves are used, though.

Definition at line 1410 of file fcurve.c.

References fabsf, len, v1, and v2.

Referenced by BKE_fcurve_bezt_subdivide_handles(), draw_fcurve_curve_bezts(), fcurve_eval_keyframes_interpolate(), and normalization_factor_get().

◆ BKE_fcurve_create()

struct FCurve* BKE_fcurve_create ( void  )

◆ BKE_fcurve_delete_key()

void BKE_fcurve_delete_key ( struct FCurve fcu,
int  index 
)

◆ BKE_fcurve_delete_keys_all()

void BKE_fcurve_delete_keys_all ( struct FCurve fcu)

Delete all keyframes from an F-curve.

Definition at line 1719 of file fcurve.c.

References fcurve_bezt_free().

Referenced by clean_fcurve(), and paste_animedit_keys_fcurve().

◆ BKE_fcurve_delete_keys_selected()

bool BKE_fcurve_delete_keys_selected ( struct FCurve fcu)

◆ BKE_fcurve_find()

struct FCurve* BKE_fcurve_find ( ListBase list,
const char  rna_path[],
int  array_index 
)

◆ BKE_fcurve_find_by_rna()

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 
)

Find an f-curve based on an rna property.

Definition at line 380 of file fcurve.c.

References BKE_fcurve_find_by_rna_context_ui(), NULL, and ptr.

Referenced by RNA_property_animated().

◆ BKE_fcurve_find_by_rna_context_ui()

struct FCurve* BKE_fcurve_find_by_rna_context_ui ( struct bContext C,
const struct PointerRNA ptr,
struct PropertyRNA prop,
int  rnaindex,
struct AnimData **  r_animdata,
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.

Parameters
r_specialOptional, ignored when NULL. Set to true if the given RNA ptr is a NLA strip, and the returned F-curve comes from this NLA strip.

Referenced by add_driver_button_poll(), drivers_editor_show_exec(), ED_autokeyframe_property(), graph_panel_drivers_popover(), insert_key_button_exec(), and ui_but_get_fcurve().

◆ BKE_fcurve_foreach_id()

void BKE_fcurve_foreach_id ( struct FCurve fcu,
struct LibraryForeachIDData data 
)

◆ BKE_fcurve_free()

void BKE_fcurve_free ( struct FCurve fcu)

◆ BKE_fcurve_get_cycle_type()

eFCU_Cycle_Type BKE_fcurve_get_cycle_type ( struct FCurve fcu)

◆ BKE_fcurve_handles_recalc()

void BKE_fcurve_handles_recalc ( struct FCurve fcu)

◆ BKE_fcurve_handles_recalc_ex()

void BKE_fcurve_handles_recalc_ex ( struct FCurve fcu,
eBezTriple_Flag  handle_sel_flag 
)

Variant of BKE_fcurve_handles_recalc() that allows calculating based on a different select flag.

Parameters
handle_sel_flagThe flag (bezt.f1/2/3) value to use to determine selection. Usually SELECT, but may want to use a different one at times (if caller does not operate on selection).

Definition at line 1220 of file fcurve.c.

References Freestyle::a, BezTriple::auto_handle_type, FCurve::auto_smoothing, FCurve::bezt, BEZT_IS_AUTOH, BKE_fcurve_is_cyclic(), BKE_nurb_handle_calc_ex(), BKE_nurb_handle_smooth_fcurve(), cycle_offset_triple(), ELEM, FCurve::extend, FCURVE_EXTRAPOLATE_CONSTANT, FCURVE_SMOOTH_NONE, HD_AUTOTYPE_LOCKED_FINAL, HD_AUTOTYPE_NORMAL, next, NULL, blender::meshintersect::prev(), FCurve::totvert, and BezTriple::vec.

Referenced by action_flip_pchan(), BKE_fcurve_handles_recalc(), and testhandles_fcurve().

◆ BKE_fcurve_is_cyclic()

bool BKE_fcurve_is_cyclic ( struct FCurve fcu)

Checks if the F-Curve has a Cycles modifier with simple settings that warrant transition smoothing.

Definition at line 1192 of file fcurve.c.

References BKE_fcurve_get_cycle_type(), and FCU_CYCLE_NONE.

Referenced by ANIM_fmodifiers_paste_from_buf(), BKE_fcurve_handles_recalc_ex(), and fcurve_to_keylist().

◆ BKE_fcurve_is_empty()

bool BKE_fcurve_is_empty ( struct FCurve fcu)

◆ BKE_fcurve_is_keyframable()

bool BKE_fcurve_is_keyframable ( struct FCurve fcu)

Can keyframes be added to F-Curve? Keyframes can only be added if they are already visible.

Definition at line 968 of file fcurve.c.

References BKE_fcurve_are_keyframes_usable(), and BKE_fcurve_is_protected().

Referenced by graphkeys_click_insert_exec(), graphop_editable_keyframes_poll(), and insert_keyframe_value().

◆ BKE_fcurve_is_protected()

bool BKE_fcurve_is_protected ( struct FCurve fcu)

◆ BKE_fcurve_iter_step()

struct FCurve* BKE_fcurve_iter_step ( struct FCurve fcu_iter,
const char  rna_path[] 
)

Quick way to loop over all f-curves of a given 'path'.

Definition at line 277 of file fcurve.c.

References ELEM, FCurve::next, NULL, FCurve::rna_path, and STREQ.

Referenced by ANIM_remove_driver().

◆ BKE_fcurve_keyframe_move_value_with_handles()

void BKE_fcurve_keyframe_move_value_with_handles ( struct BezTriple keyframe,
float  new_value 
)

Move the indexed keyframe to the given value, and move the handles with it to ensure the slope remains the same.

Definition at line 891 of file fcurve.c.

References BezTriple::vec.

Referenced by euler_filter_multi_channel(), and blender::bke::tests::TEST().

◆ BKE_fcurve_pathcache_create()

struct FCurvePathCache* BKE_fcurve_pathcache_create ( ListBase list)

◆ BKE_fcurve_pathcache_destroy()

void BKE_fcurve_pathcache_destroy ( struct FCurvePathCache fcache)

◆ BKE_fcurve_pathcache_find()

struct FCurve* BKE_fcurve_pathcache_find ( struct FCurvePathCache fcache,
const char  rna_path[],
int  array_index 
)

◆ BKE_fcurve_pathcache_find_array()

int BKE_fcurve_pathcache_find_array ( struct FCurvePathCache fcache,
const char *  rna_path,
struct FCurve **  fcurve_result,
int  fcurve_result_len 
)

Fill in an array of F-Curve, leave NULL when not found.

Returns
The number of F-Curves found.

Definition at line 144 of file fcurve_cache.c.

References FCurve::array_index, BLI_ghash_lookup(), FCurvePathCache::fcurve_array, FCurvePathCache_Span::index, FCurvePathCache_Span::len, len, NULL, and FCurvePathCache::span_from_rna_path.

Referenced by action_flip_pchan_cache_fcurve_assign_array().

◆ BKE_fcurves_calc_keyed_frames()

float* BKE_fcurves_calc_keyed_frames ( struct FCurve **  fcurve_array,
int  fcurve_array_len,
int *  r_frames_len 
)

Definition at line 836 of file fcurve.c.

References BKE_fcurves_calc_keyed_frames_ex().

Referenced by action_flip_pchan().

◆ BKE_fcurves_calc_keyed_frames_ex()

float* BKE_fcurves_calc_keyed_frames_ex ( struct FCurve **  fcurve_array,
int  fcurve_array_len,
float  interval,
int *  r_frames_len 
)

Return an array of keyed frames, rounded to interval.

Parameters
intervalSet to 1.0 to round to whole keyframes, 0.5 for in-between key-frames, etc.
Note
An interval of zero could be supported (this implies no rounding at all), however this risks very small differences in float values being treated as separate keyframes.

Definition at line 801 of file fcurve.c.

References FCurve::bezt, BLI_assert, BLI_gset_add(), BLI_gset_free(), BLI_gset_int_new(), BLI_gset_len(), BLI_gsetIterator_getKey(), BLI_sortutil_cmp_float(), double(), GSET_ITER_INDEX, max_ff(), MEM_mallocN, NULL, POINTER_AS_INT, POINTER_FROM_INT, FCurve::totvert, and BezTriple::vec.

Referenced by BKE_fcurves_calc_keyed_frames().

◆ BKE_fcurves_copy()

void BKE_fcurves_copy ( ListBase dst,
ListBase src 
)

◆ BKE_fcurves_filter()

int BKE_fcurves_filter ( ListBase dst,
ListBase src,
const char *  dataPrefix,
const char *  dataName 
)

Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated. e.g. numMatches = BKE_fcurves_filter(matches, &act->curves, "pose.bones[", "MyFancyBone");

Lists:

Parameters
dstlist of LinkData's matching the criteria returned. List must be freed after use, and is assumed to be empty when passed.
srclist of F-Curves to search through Filters:
dataPrefixi.e. pose.bones[ or nodes[.
dataNamename of entity within "" immediately following the prefix.

Definition at line 297 of file fcurve.c.

References BLI_addtail(), BLI_str_quoted_substr(), LinkData::data, ELEM, MEM_callocN, FCurve::next, NULL, FCurve::rna_path, src, and STREQ.

Referenced by updateDuplicateActionConstraintSettings().

◆ BKE_fcurves_free()

void BKE_fcurves_free ( ListBase list)

◆ BKE_fmodifiers_blend_read_data()

void BKE_fmodifiers_blend_read_data ( struct BlendDataReader reader,
ListBase fmodifiers,
struct FCurve curve 
)

◆ BKE_fmodifiers_blend_read_expand()

void BKE_fmodifiers_blend_read_expand ( struct BlendExpander expander,
struct ListBase fmodifiers 
)

◆ BKE_fmodifiers_blend_read_lib()

void BKE_fmodifiers_blend_read_lib ( struct BlendLibReader reader,
struct ID id,
struct ListBase fmodifiers 
)

Definition at line 2316 of file fcurve.c.

References BLO_read_id_address, data, FMODIFIER_TYPE_PYTHON, id, ID::lib, and LISTBASE_FOREACH.

Referenced by BKE_fcurve_blend_read_lib().

◆ BKE_fmodifiers_blend_write()

void BKE_fmodifiers_blend_write ( struct BlendWriter writer,
struct ListBase fmodifiers 
)

◆ calculate_fcurve()

float calculate_fcurve ( struct PathResolvedRNA anim_rna,
struct FCurve fcu,
const struct AnimationEvalContext anim_eval_context 
)

◆ copy_fmodifier()

struct FModifier* copy_fmodifier ( const struct FModifier src)

Make a copy of the specified F-Modifier.

Referenced by ANIM_fmodifiers_copy_to_buf(), and ANIM_fmodifiers_paste_from_buf().

◆ copy_fmodifiers()

void copy_fmodifiers ( ListBase dst,
const ListBase src 
)

◆ evaluate_fcurve()

float evaluate_fcurve ( struct FCurve fcu,
float  evaltime 
)

◆ evaluate_fcurve_driver()

float evaluate_fcurve_driver ( struct PathResolvedRNA anim_rna,
struct FCurve fcu,
struct ChannelDriver driver_orig,
const struct AnimationEvalContext anim_eval_context 
)

◆ evaluate_fcurve_only_curve()

float evaluate_fcurve_only_curve ( struct FCurve fcu,
float  evaltime 
)

◆ evaluate_fmodifiers_storage_size_per_modifier()

uint evaluate_fmodifiers_storage_size_per_modifier ( ListBase modifiers)

◆ evaluate_time_fmodifiers()

float evaluate_time_fmodifiers ( FModifiersStackStorage storage,
ListBase modifiers,
struct FCurve fcu,
float  cvalue,
float  evaltime 
)

Evaluate time modifications imposed by some F-Curve Modifiers.

  • This step acts as an optimization to prevent the F-Curve stack being evaluated several times by modifiers requesting the time be modified, as the final result would have required using the modified time
  • Modifiers only ever receive the unmodified time, as subsequent modifiers should be working on the 'global' result of the modified curve, not some localized segment, so evaltime gets set to whatever the last time-modifying modifier likes.
  • We start from the end of the stack, as only the last one matters for now.
Parameters
fcuCan be NULL.

Definition at line 1395 of file fmodifier.c.

References FModifiersStackStorage::buffer, FModifier::efra, ELEM, eval_fmodifier_influence(), evaltime, FModifierTypeInfo::evaluate_modifier_time, FCURVE_MOD_OFF, FModifier::flag, FCurve::flag, FMODIFIER_FLAG_DISABLED, FMODIFIER_FLAG_MUTED, FMODIFIER_FLAG_RANGERESTRICT, fmodifier_get_typeinfo(), interpf(), ListBase::last, FModifiersStackStorage::modifier_count, NULL, POINTER_OFFSET, FModifier::prev, FModifier::sfra, and FModifiersStackStorage::size_per_modifier.

Referenced by evaluate_fcurve_ex(), and nlasnapshot_from_action().

◆ evaluate_value_fmodifiers()

void evaluate_value_fmodifiers ( FModifiersStackStorage storage,
ListBase modifiers,
struct FCurve fcu,
float cvalue,
float  evaltime 
)

◆ fcurve_bake_modifiers()

void fcurve_bake_modifiers ( struct FCurve fcu,
int  start,
int  end 
)

Bake modifiers for given F-Curve to curve sample data, in the frame range defined by start and end (inclusive).

Definition at line 1500 of file fmodifier.c.

References CLOG_ERROR, FCurve::driver, ELEM, fcurve_samplingcb_evalcurve(), fcurve_store_samples(), ListBase::first, free_fmodifiers(), LOG, FCurve::modifiers, and NULL.

◆ fcurve_samples_to_keyframes()

void fcurve_samples_to_keyframes ( struct FCurve fcu,
int  start,
int  end 
)

Convert baked/sampled f-curves into bezt/regular f-curves.

Definition at line 1084 of file fcurve.c.

References FCurve::bezt, BKE_fcurve_handles_recalc(), CLOG_ERROR, copy_v2_v2(), float(), FCurve::fpt, init_unbaked_bezt_data(), LOG, MEM_callocN, MEM_freeN, MEM_SAFE_FREE, NULL, FCurve::totvert, FPoint::vec, and BezTriple::vec.

Referenced by unbake_graph_curves().

◆ fcurve_samplingcb_evalcurve()

float fcurve_samplingcb_evalcurve ( struct FCurve fcu,
void data,
float  evaltime 
)

Basic sampling callback which acts as a wrapper for evaluate_fcurve() 'data' arg here is unneeded here.

Referenced by bake_graph_curves(), and fcurve_bake_modifiers().

◆ fcurve_store_samples()

void fcurve_store_samples ( struct FCurve fcu,
void data,
int  start,
int  end,
FcuSampleFunc  sample_cb 
)

Main API function for creating a set of sampled curve data, given some callback function used to retrieve the values to store.

Definition at line 1037 of file fcurve.c.

References FCurve::bezt, CLOG_ERROR, data, ELEM, float(), FCurve::fpt, LOG, MEM_callocN, MEM_freeN, NULL, FCurve::totvert, and FPoint::vec.

Referenced by bake_graph_curves(), and fcurve_bake_modifiers().

◆ find_active_fmodifier()

struct FModifier* find_active_fmodifier ( ListBase modifiers)

Find the active F-Modifier.

Definition at line 1246 of file fmodifier.c.

References ELEM, ListBase::first, FModifier::flag, FMODIFIER_FLAG_ACTIVE, FModifier::next, and NULL.

Referenced by ANIM_fmodifiers_copy_to_buf(), and draw_fcurve().

◆ fmodifier_get_typeinfo()

const FModifierTypeInfo* fmodifier_get_typeinfo ( const struct FModifier fcm)

This function should always be used to get the appropriate type-info, as it has checks which prevent segfaults in some weird cases.

Referenced by BKE_fmodifiers_blend_write(), and fmodifier_panel_header().

◆ free_fmodifiers()

void free_fmodifiers ( ListBase modifiers)

◆ get_fmodifier_typeinfo()

const FModifierTypeInfo* get_fmodifier_typeinfo ( int  type)

This function should be used for getting the appropriate type-info when only a F-Curve modifier type is known.

Definition at line 1052 of file fmodifier.c.

References CLOG_ERROR, FMI_INIT, FMODIFIER_NUM_TYPES, FMODIFIER_TYPE_NULL, fmodifiersTypeInfo, fmods_init_typeinfo(), LOG, NULL, and type.

Referenced by add_fmodifier(), fmodifier_get_typeinfo(), fmodifier_panel_register(), fmodifier_reorder(), graph_fmodifier_itemf(), graph_fmodifier_panel_id(), nla_fmodifier_itemf(), and nla_fmodifier_panel_id().

◆ id_data_find_fcurve()

struct FCurve* id_data_find_fcurve ( ID id,
void data,
struct StructRNA type,
const char *  prop_name,
int  index,
bool r_driven 
)

High level function to get an f-curve from C without having the RNA.

If there is an action assigned to the id's AnimData, it will be searched for a matching F-curve first. Drivers are searched only if no valid action F-curve could be found.

Note
Return pointer parameter (r_driven) is optional and may be NULL.
Warning
In case no animation (from an Action) F-curve is found, returned value is always NULL. This means that this function will set r_driven to True in case a valid driver F-curve is found, but will not return said F-curve. In other words:
  • Animated with FCurve: returns the FCurve* and *r_driven = false.
  • Animated with driver: returns NULL and *r_driven = true.
  • Not animated: returns NULL and *r_driven = false.

Definition at line 201 of file fcurve.c.

References AnimData::action, BKE_animadata_fcurve_find_by_rna_path(), BKE_animdata_from_id(), data, ELEM, MEM_freeN, NULL, ptr, RNA_path_from_ID_to_property(), RNA_pointer_create(), RNA_struct_find_property(), and type.

Referenced by BKE_tracking_track_get_weight_for_marker(), do_versions_sequencer_speed_effect_recursive(), draw_seq_fcurve_overlay(), draw_seq_waveform_overlay(), libmv_tracks_new(), retrieve_stab_animation(), retrieve_track_weight_animation(), seq_effect_speed_speed_factor_curve_get(), seq_render_effect_strip_impl(), sound_update_animation_flags(), and sound_update_animation_flags_fn().

◆ list_has_suitable_fmodifier()

bool list_has_suitable_fmodifier ( ListBase modifiers,
int  mtype,
short  acttype 
)

Do we have any modifiers which match certain criteria.

Parameters
mtypeType of modifier (if 0, doesn't matter).
acttypeType of action to perform (if -1, doesn't matter).

Definition at line 1286 of file fmodifier.c.

References FModifierTypeInfo::acttype, ELEM, ListBase::first, fmodifier_get_typeinfo(), FModifier::next, NULL, and FModifier::type.

Referenced by BKE_fcurve_is_empty(), setexpo_action_keys(), and setexpo_graph_keys().

◆ remove_fmodifier()

bool remove_fmodifier ( ListBase modifiers,
struct FModifier fcm 
)

◆ set_active_fmodifier()

void set_active_fmodifier ( ListBase modifiers,
struct FModifier fcm 
)

Set the active F-Modifier.

Definition at line 1266 of file fmodifier.c.

References ELEM, ListBase::first, FModifier::flag, FMODIFIER_FLAG_ACTIVE, FModifier::next, and NULL.

Referenced by graph_fmodifier_add_exec(), and nla_fmodifier_add_exec().

◆ sort_time_fcurve()

void sort_time_fcurve ( struct FCurve fcu)

This function sorts BezTriples so that they are arranged in chronological order, as tools working on F-Curves expect that the BezTriples are in order.

Definition at line 1327 of file fcurve.c.

References Freestyle::a, FCurve::bezt, CLAMP_MAX, CLAMP_MIN, NULL, SWAP, swap_v2_v2(), FCurve::totvert, and BezTriple::vec.

Referenced by ANIM_animdata_update(), graphedit_activekey_update_cb(), and remake_graph_transdata().

◆ test_time_fcurve()

bool test_time_fcurve ( struct FCurve fcu)

This function tests if any BezTriples are out of order, thus requiring a sort.

Definition at line 1369 of file fcurve.c.

References Freestyle::a, FCurve::bezt, FCurve::fpt, NULL, FCurve::totvert, FPoint::vec, and BezTriple::vec.

◆ testhandles_fcurve()

void testhandles_fcurve ( struct FCurve fcu,
eBezTriple_Flag  sel_flag,
bool  use_handle 
)

Update handles, making sure the handle-types are valid (e.g. correctly deduced from an "Auto" type), and recalculating their position vectors. Use when something has changed handle positions.

Parameters
sel_flagThe flag (bezt.f1/2/3) value to use to determine selection. Usually SELECT, but may want to use a different one at times (if caller does not operate on selection).
use_handleCheck selection state of individual handles, otherwise always update both handles if the key is selected.

Definition at line 1308 of file fcurve.c.

References Freestyle::a, FCurve::bezt, BKE_fcurve_handles_recalc_ex(), BKE_nurb_bezt_handle_test(), ELEM, and NULL.

Referenced by posttrans_fcurve_clean(), and remake_graph_transdata().