Blender  V3.3
Classes | Typedefs | Functions | Variables
keyframes_general.c File Reference
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_action.h"
#include "BKE_curve.h"
#include "BKE_fcurve.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "RNA_access.h"
#include "RNA_enum_types.h"
#include "RNA_path.h"
#include "ED_anim_api.h"
#include "ED_keyframes_edit.h"
#include "ED_keyframing.h"

Go to the source code of this file.

Classes

struct  tSmooth_Bezt
 
struct  TempFrameValCache
 
struct  tAnimCopybufItem
 

Typedefs

typedef struct tSmooth_Bezt tSmooth_Bezt
 
typedef struct TempFrameValCache TempFrameValCache
 
typedef struct tAnimCopybufItem tAnimCopybufItem
 

Functions

bool duplicate_fcurve_keys (FCurve *fcu)
 
void clean_fcurve (struct bAnimContext *ac, bAnimListElem *ale, float thresh, bool cleardefault)
 
static bool find_fcurve_segment (FCurve *fcu, const int start_index, int *r_segment_start_idx, int *r_segment_len)
 
ListBase find_fcurve_segments (FCurve *fcu)
 
static BezTriple fcurve_segment_start_get (FCurve *fcu, int index)
 
static BezTriple fcurve_segment_end_get (FCurve *fcu, int index)
 
void blend_to_neighbor_fcurve_segment (FCurve *fcu, FCurveSegment *segment, const float factor)
 
float get_default_rna_value (FCurve *fcu, PropertyRNA *prop, PointerRNA *ptr)
 
void blend_to_default_fcurve (PointerRNA *id_ptr, FCurve *fcu, const float factor)
 
void breakdown_fcurve_segment (FCurve *fcu, FCurveSegment *segment, const float factor)
 
static bool prepare_for_decimate (FCurve *fcu, int i)
 
static void decimate_fcurve_segment (FCurve *fcu, int bezt_segment_start_idx, int bezt_segment_len, float remove_ratio, float error_sq_max)
 
bool decimate_fcurve (bAnimListElem *ale, float remove_ratio, float error_sq_max)
 
void smooth_fcurve (FCurve *fcu)
 
void sample_fcurve (FCurve *fcu)
 
void ANIM_fcurves_copybuf_free (void)
 
short copy_animedit_keys (bAnimContext *ac, ListBase *anim_data)
 
static void flip_names (tAnimCopybufItem *aci, char **r_name)
 
static tAnimCopybufItempastebuf_match_path_full (FCurve *fcu, const short from_single, const short to_simple, bool flip)
 
static tAnimCopybufItempastebuf_match_path_property (Main *bmain, FCurve *fcu, const short from_single, const short UNUSED(to_simple))
 
static tAnimCopybufItempastebuf_match_index_only (FCurve *fcu, const short from_single, const short UNUSED(to_simple))
 
static void do_curve_mirror_flippping (tAnimCopybufItem *aci, BezTriple *bezt)
 
static void paste_animedit_keys_fcurve (FCurve *fcu, tAnimCopybufItem *aci, float offset, const eKeyMergeMode merge_mode, bool flip)
 
eKeyPasteError paste_animedit_keys (bAnimContext *ac, ListBase *anim_data, const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode, bool flip)
 

Variables

static ListBase animcopybuf = {NULL, NULL}
 
static float animcopy_firstframe = 999999999.0f
 
static float animcopy_lastframe = -999999999.0f
 
static float animcopy_cfra = 0.0
 
const EnumPropertyItem rna_enum_keyframe_paste_offset_items []
 
const EnumPropertyItem rna_enum_keyframe_paste_merge_items []
 

Typedef Documentation

◆ tAnimCopybufItem

◆ TempFrameValCache

◆ tSmooth_Bezt

typedef struct tSmooth_Bezt tSmooth_Bezt

Function Documentation

◆ ANIM_fcurves_copybuf_free()

void ANIM_fcurves_copybuf_free ( void  )

◆ blend_to_default_fcurve()

void blend_to_default_fcurve ( PointerRNA id_ptr,
FCurve fcu,
const float  factor 
)

◆ blend_to_neighbor_fcurve_segment()

void blend_to_neighbor_fcurve_segment ( FCurve fcu,
FCurveSegment segment,
const float  factor 
)

◆ breakdown_fcurve_segment()

void breakdown_fcurve_segment ( FCurve fcu,
FCurveSegment segment,
const float  factor 
)

◆ clean_fcurve()

void clean_fcurve ( struct bAnimContext ac,
bAnimListElem ale,
float  thresh,
bool  cleardefault 
)

◆ copy_animedit_keys()

short copy_animedit_keys ( bAnimContext ac,
ListBase anim_data 
)

◆ decimate_fcurve()

bool decimate_fcurve ( bAnimListElem ale,
float  remove_ratio,
float  error_sq_max 
)

◆ decimate_fcurve_segment()

static void decimate_fcurve_segment ( FCurve fcu,
int  bezt_segment_start_idx,
int  bezt_segment_len,
float  remove_ratio,
float  error_sq_max 
)
static

◆ do_curve_mirror_flippping()

static void do_curve_mirror_flippping ( tAnimCopybufItem aci,
BezTriple bezt 
)
static

◆ duplicate_fcurve_keys()

bool duplicate_fcurve_keys ( FCurve fcu)

◆ fcurve_segment_end_get()

static BezTriple fcurve_segment_end_get ( FCurve fcu,
int  index 
)
static

◆ fcurve_segment_start_get()

static BezTriple fcurve_segment_start_get ( FCurve fcu,
int  index 
)
static

Definition at line 285 of file keyframes_general.c.

References FCurve::bezt.

Referenced by blend_to_neighbor_fcurve_segment(), and breakdown_fcurve_segment().

◆ find_fcurve_segment()

static bool find_fcurve_segment ( FCurve fcu,
const int  start_index,
int *  r_segment_start_idx,
int *  r_segment_len 
)
static

Find the first segment of consecutive selected curve points, starting from start_index. Keys that have BEZT_FLAG_IGNORE_TAG set are treated as unselected.

Parameters
r_segment_start_idxreturns the start index of the segment.
r_segment_lenreturns the number of curve points in the segment.
Returns
whether such a segment was found or not.

Definition at line 234 of file keyframes_general.c.

References FCurve::bezt, BEZT_FLAG_IGNORE_TAG, BezTriple::f2, point_is_selected(), SELECT, and FCurve::totvert.

Referenced by find_fcurve_segments().

◆ find_fcurve_segments()

ListBase find_fcurve_segments ( struct FCurve fcu)

Return a list of FCurveSegment with a start index and a length. A segment is a continuous selection of keyframes. Keys that have BEZT_FLAG_IGNORE_TAG set are treated as unselected. The caller is responsible for freeing the memory.

Definition at line 267 of file keyframes_general.c.

References BLI_addtail(), find_fcurve_segment(), MEM_callocN, and NULL.

Referenced by blend_to_neighbor_graph_keys(), breakdown_graph_keys(), and decimate_fcurve().

◆ flip_names()

static void flip_names ( tAnimCopybufItem aci,
char **  r_name 
)
static

◆ get_default_rna_value()

float get_default_rna_value ( FCurve fcu,
PropertyRNA prop,
PointerRNA ptr 
)

◆ paste_animedit_keys()

eKeyPasteError paste_animedit_keys ( bAnimContext ac,
ListBase anim_data,
const eKeyPasteOffset  offset_mode,
const eKeyMergeMode  merge_mode,
bool  flip 
)

◆ paste_animedit_keys_fcurve()

static void paste_animedit_keys_fcurve ( FCurve fcu,
tAnimCopybufItem aci,
float  offset,
const eKeyMergeMode  merge_mode,
bool  flip 
)
static

◆ pastebuf_match_index_only()

static tAnimCopybufItem* pastebuf_match_index_only ( FCurve fcu,
const short  from_single,
const short   UNUSEDto_simple 
)
static

◆ pastebuf_match_path_full()

static tAnimCopybufItem* pastebuf_match_path_full ( FCurve fcu,
const short  from_single,
const short  to_simple,
bool  flip 
)
static

◆ pastebuf_match_path_property()

static tAnimCopybufItem* pastebuf_match_path_property ( Main bmain,
FCurve fcu,
const short  from_single,
const short   UNUSEDto_simple 
)
static

◆ prepare_for_decimate()

static bool prepare_for_decimate ( FCurve fcu,
int  i 
)
static

◆ sample_fcurve()

void sample_fcurve ( FCurve fcu)

◆ smooth_fcurve()

void smooth_fcurve ( struct FCurve fcu)

Variable Documentation

◆ animcopy_cfra

float animcopy_cfra = 0.0
static

Definition at line 712 of file keyframes_general.c.

Referenced by copy_animedit_keys(), and paste_animedit_keys().

◆ animcopy_firstframe

float animcopy_firstframe = 999999999.0f
static

◆ animcopy_lastframe

float animcopy_lastframe = -999999999.0f
static

◆ animcopybuf

ListBase animcopybuf = {NULL, NULL}
static

◆ rna_enum_keyframe_paste_merge_items

const EnumPropertyItem rna_enum_keyframe_paste_merge_items[]
Initial value:
= {
{KEYFRAME_PASTE_MERGE_MIX, "MIX", 0, "Mix", "Overlay existing with new keys"},
{KEYFRAME_PASTE_MERGE_OVER, "OVER_ALL", 0, "Overwrite All", "Replace all keys"},
"OVER_RANGE",
0,
"Overwrite Range",
"Overwrite keys in pasted range"},
"OVER_RANGE_ALL",
0,
"Overwrite Entire Range",
"Overwrite keys in pasted range, using the range of all copied keys"},
{0, NULL, 0, NULL, NULL},
}
@ KEYFRAME_PASTE_MERGE_OVER_RANGE_ALL
@ KEYFRAME_PASTE_MERGE_OVER_RANGE
@ KEYFRAME_PASTE_MERGE_OVER
@ KEYFRAME_PASTE_MERGE_MIX

Definition at line 1134 of file keyframes_general.c.

Referenced by ACTION_OT_paste(), and GRAPH_OT_paste().

◆ rna_enum_keyframe_paste_offset_items

const EnumPropertyItem rna_enum_keyframe_paste_offset_items[]
Initial value:
= {
"START",
0,
"Frame Start",
"Paste keys starting at current frame"},
{KEYFRAME_PASTE_OFFSET_CFRA_END, "END", 0, "Frame End", "Paste keys ending at current frame"},
"RELATIVE",
0,
"Frame Relative",
"Paste keys relative to the current frame when copying"},
{KEYFRAME_PASTE_OFFSET_NONE, "NONE", 0, "No Offset", "Paste keys from original time"},
{0, NULL, 0, NULL, NULL},
}
@ KEYFRAME_PASTE_OFFSET_NONE
@ KEYFRAME_PASTE_OFFSET_CFRA_END
@ KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE
@ KEYFRAME_PASTE_OFFSET_CFRA_START

Definition at line 1118 of file keyframes_general.c.

Referenced by ACTION_OT_paste(), and GRAPH_OT_paste().