Blender V4.3
ED_keyframes_edit.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2008 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#pragma once
10
11#include "BLI_array.hh"
13
14#include "ED_anim_api.hh" /* for enum eAnimFilter_Flags */
15
16#include "DNA_curve_types.h"
17
18struct BezTriple;
20struct FCurve;
21struct Scene;
22struct bAnimContext;
23struct bAnimListElem;
24struct bDopeSheet;
25
26/* ************************************************ */
27/* Common Macros and Defines */
28
29/* -------------------------------------------------------------------- */
35 /* Frame range */
38 /* Selection status */
40 /* Values (y-val) only */
43 /* For graph editor keyframes (2D tests) */
47 /* Only for keyframes a certain Dopesheet channel */
50};
51
54/* select modes */
56 /* SELECT_SUBTRACT for all, followed by SELECT_ADD for some */
57 SELECT_REPLACE = (1 << 0),
58 /* add ok keyframes to selection */
59 SELECT_ADD = (1 << 1),
60 /* remove ok keyframes from selection */
61 SELECT_SUBTRACT = (1 << 2),
62 /* flip ok status of keyframes based on key status */
63 SELECT_INVERT = (1 << 3),
65};
66
67/* "selection map" building modes. */
72
73/* snapping tools */
83
84/* equalizing tools */
90
91/* mirroring tools */
100
101/* use with BEZT_OK_REGION_LASSO */
107
108/* use with BEZT_OK_REGION_CIRCLE */
115
116/* ************************************************ */
117/* Non-Destructive Editing API (keyframes_edit.cc) */
118
119/* -------------------------------------------------------------------- */
123/* which verts of a keyframe is active (after polling) */
126 /* 'key' itself is ok */
127 KEYFRAME_OK_KEY = (1 << 0),
128 /* 'handle 1' is ok */
129 KEYFRAME_OK_H1 = (1 << 1),
130 /* 'handle 2' is ok */
131 KEYFRAME_OK_H2 = (1 << 2),
132 /* all flags */
134};
135
136/* Flags for use during iteration */
138 /* consider handles in addition to key itself */
140
141 /* Perform NLA time remapping (global -> strip) for the "f1" parameter
142 * (e.g. used for selection tools on summary tracks)
143 */
145
146 /* Perform NLA time remapping (global -> strip) for the "f2" parameter */
148
149 /* Set this when handles aren't visible by default and you want to perform additional checks to
150 * get the actual visibility state. E.g. in some cases handles are only drawn if either a handle
151 * or their control point is selected. The selection state will have to be checked in the
152 * iterator callbacks then. */
154};
156
157
159/* -------------------------------------------------------------------- */
167struct CfraElem {
168 CfraElem *next, *prev;
169 float cfra;
170 int sel;
171};
172
174 /* generic properties/data access */
180 void *data;
182 float f1, f2;
184 int i1, i2;
185
186 /* current iteration data */
193
194 /* flags */
199};
200
203/* -------------------------------------------------------------------- */
208using FcuEditFunc = void (*)(FCurve *fcu);
210using KeyframeEditFunc = short (*)(KeyframeEditData *ked, BezTriple *bezt);
211
214/* -------------------------------------------------------------------- */
220 float oldMin, oldMax; /* old range */
221 float newMin, newMax; /* new range */
222};
223
235
248
259
269
272/* -------------------------------------------------------------------- */
286 FCurve *fcu,
287 KeyframeEditFunc key_ok,
288 KeyframeEditFunc key_cb,
289 FcuEditFunc fcu_cb);
299 float handle_length,
300 bool flatten);
301
306 bDopeSheet *ads,
307 bAnimListElem *ale,
308 KeyframeEditFunc key_ok,
309 KeyframeEditFunc key_cb,
310 FcuEditFunc fcu_cb);
316 bDopeSheet *ads,
317 void *data,
318 int keytype,
319 KeyframeEditFunc key_ok,
320 KeyframeEditFunc key_cb,
321 FcuEditFunc fcu_cb);
322
328 eAnimFilter_Flags filter,
329 KeyframeEditFunc callback_fn);
330
335
338/* -------------------------------------------------------------------- */
342/* accessories */
344
345/* edit */
362
365/* -------------------------------------------------------------------- */
374
380
383/* -------------------------------------------------------------------- */
391
396
402
405/* -------------------------------------------------------------------- */
409/* XXX: These are temporary,
410 * until we can unify GP/Mask Keyframe handling and standard FCurve Keyframe handling */
411
412bool keyframe_region_lasso_test(const KeyframeEdit_LassoData *data_lasso, const float xy[2]);
413
414bool keyframe_region_circle_test(const KeyframeEdit_CircleData *data_circle, const float xy[2]);
415
416/* ************************************************ */
417/* Destructive Editing API `keyframes_general.cc`. */
418
420float get_default_rna_value(const FCurve *fcu, PropertyRNA *prop, PointerRNA *ptr);
421
426
435 bAnimListElem *ale,
436 float thresh,
437 bool cleardefault,
438 bool only_selected_keys);
439void blend_to_neighbor_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor);
440void breakdown_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor);
441void scale_average_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor);
442void push_pull_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor);
446 FCurveSegment *segment,
447 float factor,
448 FCurveSegmentAnchor anchor);
454void ED_ANIM_get_1d_gauss_kernel(const float sigma, int kernel_size, double *r_kernel);
455
458void ED_anim_calculate_butterworth_coefficients(float cutoff_frequency,
459 float sampling_frequency,
460 ButterworthCoefficients *bw_coeff);
466 FCurveSegment *segment,
467 float *samples,
468 int sample_count,
469 float factor,
470 int blend_in_out,
471 int sample_rate,
472 ButterworthCoefficients *bw_coeff);
474 FCurveSegment *segment,
475 float *samples,
476 float factor,
477 int kernel_size,
478 double *kernel);
483void ease_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor, float width);
484
490 FCurveSegment *segment,
491 float factor,
492 tShearDirection direction);
500void blend_offset_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor);
501void blend_to_ease_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor);
502void time_offset_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float frame_offset);
503bool decimate_fcurve(bAnimListElem *ale, float remove_ratio, float error_sq_max);
504bool match_slope_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor);
505
509void blend_to_default_fcurve(PointerRNA *id_ptr, FCurve *fcu, float factor);
513void smooth_fcurve(FCurve *fcu);
514
515/* ----------- */
516
518short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data);
520 ListBase *anim_data,
521 eKeyPasteOffset offset_mode,
522 eKeyPasteValueOffset value_offset_mode,
523 eKeyMergeMode merge_mode,
524 bool flip);
525
526/* ************************************************ */
527
#define ENUM_OPERATORS(_type, _max)
eBezTriple_KeyframeType
eAnimFilter_Flags
void scale_average_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor)
tShearDirection
@ SHEAR_FROM_RIGHT
@ SHEAR_FROM_LEFT
eEditKeyframes_Mirror
@ MIRROR_KEYS_VALUE
@ MIRROR_KEYS_YAXIS
@ MIRROR_KEYS_MARKER
@ MIRROR_KEYS_CURFRAME
@ MIRROR_KEYS_XAXIS
@ MIRROR_KEYS_TIME
void shear_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor, tShearDirection direction)
KeyframeEditFunc ANIM_editkeyframes_mirror(short mode)
short bezt_selmap_flush(KeyframeEditData *ked, BezTriple *bezt)
void time_offset_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float frame_offset)
float get_default_rna_value(const FCurve *fcu, PropertyRNA *prop, PointerRNA *ptr)
eEditKeyframes_Equalize
@ EQUALIZE_HANDLES_LEFT
@ EQUALIZE_HANDLES_RIGHT
@ EQUALIZE_HANDLES_BOTH
void ANIM_editkeyframes_refresh(bAnimContext *ac)
bool decimate_fcurve(bAnimListElem *ale, float remove_ratio, float error_sq_max)
KeyframeEditFunc ANIM_editkeyframes_easing(short mode)
short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
KeyframeEditFunc ANIM_editkeyframes_select(eEditKeyframes_Select selectmode)
KeyframeEditFunc ANIM_editkeyframes_ipo(short mode)
bool keyframe_region_lasso_test(const KeyframeEdit_LassoData *data_lasso, const float xy[2])
@ KEYFRAME_PASTE_MERGE_OVER_RANGE_ALL
@ KEYFRAME_PASTE_MERGE_OVER_RANGE
@ KEYFRAME_PASTE_MERGE_OVER
@ KEYFRAME_PASTE_MERGE_MIX
ButterworthCoefficients * ED_anim_allocate_butterworth_coefficients(const int filter_order)
void butterworth_smooth_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float *samples, int sample_count, float factor, int blend_in_out, int sample_rate, ButterworthCoefficients *bw_coeff)
void ANIM_fcurve_equalize_keyframes_loop(FCurve *fcu, eEditKeyframes_Equalize mode, float handle_length, bool flatten)
eKeyframeVertOk
@ KEYFRAME_NONE
@ KEYFRAME_OK_KEY
@ KEYFRAME_OK_H1
@ KEYFRAME_OK_H2
@ KEYFRAME_OK_ALL
void blend_to_ease_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor)
eKeyPasteValueOffset
@ KEYFRAME_PASTE_VALUE_OFFSET_RIGHT_KEY
@ KEYFRAME_PASTE_VALUE_OFFSET_NONE
@ KEYFRAME_PASTE_VALUE_OFFSET_CURSOR
@ KEYFRAME_PASTE_VALUE_OFFSET_CFRA
@ KEYFRAME_PASTE_VALUE_OFFSET_LEFT_KEY
eKeyPasteOffset
@ KEYFRAME_PASTE_OFFSET_NONE
@ KEYFRAME_PASTE_OFFSET_CFRA_END
@ KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE
@ KEYFRAME_PASTE_OFFSET_CFRA_START
void smooth_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float *samples, float factor, int kernel_size, double *kernel)
void ease_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor, float width)
void ANIM_fcurves_copybuf_free()
eEditKeyframes_Validate
@ BEZT_OK_CHANNEL_CIRCLE
@ BEZT_OK_FRAMERANGE
@ BEZT_OK_FRAME
@ BEZT_OK_VALUERANGE
@ BEZT_OK_SELECTED
@ BEZT_OK_REGION_LASSO
@ BEZT_OK_VALUE
@ BEZT_OK_REGION_CIRCLE
@ BEZT_OK_CHANNEL_LASSO
@ BEZT_OK_REGION
KeyframeEditFunc ANIM_editkeyframes_keytype(eBezTriple_KeyframeType keyframe_type)
eKeyframeIterFlags
@ KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE
@ KED_F1_NLA_UNMAP
@ KEYFRAME_ITER_INCL_HANDLES
@ KED_F2_NLA_UNMAP
eKeyPasteError paste_animedit_keys(bAnimContext *ac, ListBase *anim_data, eKeyPasteOffset offset_mode, eKeyPasteValueOffset value_offset_mode, eKeyMergeMode merge_mode, bool flip)
void blend_to_neighbor_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor)
short bezt_to_cfraelem(KeyframeEditData *ked, BezTriple *bezt)
KeyframeEditFunc ANIM_editkeyframes_buildselmap(short mode)
eEditKeyframes_Snap
@ SNAP_KEYS_CURFRAME
@ SNAP_KEYS_NEARFRAME
@ SNAP_KEYS_NEARMARKER
@ SNAP_KEYS_TIME
@ SNAP_KEYS_NEARSEC
@ SNAP_KEYS_HORIZONTAL
@ SNAP_KEYS_VALUE
short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, void *data, int keytype, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb)
void smooth_fcurve(FCurve *fcu)
void ED_ANIM_get_1d_gauss_kernel(const float sigma, int kernel_size, double *r_kernel)
short(*)(KeyframeEditData *ked, BezTriple *bezt) KeyframeEditFunc
short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, bAnimListElem *ale, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb)
bool keyframe_region_circle_test(const KeyframeEdit_CircleData *data_circle, const float xy[2])
void bezt_remap_times(KeyframeEditData *ked, BezTriple *bezt)
short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb)
void blend_offset_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor)
eEditKeyframes_SelMap
@ SELMAP_MORE
@ SELMAP_LESS
eEditKeyframes_Select
@ SELECT_INVERT
@ SELECT_EXTEND_RANGE
@ SELECT_SUBTRACT
@ SELECT_REPLACE
@ SELECT_ADD
KeyframeEditFunc ANIM_editkeyframes_ok(short mode)
void(*)(FCurve *fcu) FcuEditFunc
@ KEYFRAME_PASTE_NOTHING_TO_PASTE
@ KEYFRAME_PASTE_OK
@ KEYFRAME_PASTE_NOWHERE_TO_PASTE
ListBase find_fcurve_segments(FCurve *fcu)
bool duplicate_fcurve_keys(FCurve *fcu)
KeyframeEditFunc ANIM_editkeyframes_snap(short mode)
void blend_to_default_fcurve(PointerRNA *id_ptr, FCurve *fcu, float factor)
void scale_from_fcurve_segment_neighbor(FCurve *fcu, FCurveSegment *segment, float factor, FCurveSegmentAnchor anchor)
void breakdown_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor)
void push_pull_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor)
void clean_fcurve(bAnimContext *ac, bAnimListElem *ale, float thresh, bool cleardefault, bool only_selected_keys)
void ANIM_animdata_keyframe_callback(bAnimContext *ac, eAnimFilter_Flags filter, KeyframeEditFunc callback_fn)
void ED_anim_calculate_butterworth_coefficients(float cutoff_frequency, float sampling_frequency, ButterworthCoefficients *bw_coeff)
short bezt_calc_average(KeyframeEditData *ked, BezTriple *bezt)
FCurveSegmentAnchor
void ED_anim_free_butterworth_coefficients(ButterworthCoefficients *bw_coeff)
bool match_slope_fcurve_segment(FCurve *fcu, FCurveSegment *segment, float factor)
KeyframeEditFunc ANIM_editkeyframes_handles(short mode)
CfraElem * next
FCurveSegment * next
FCurveSegment * prev
eKeyframeIterFlags iterflags
eKeyframeVertOk curflags
blender::Array< blender::int2 > mcoords
int xy[2]
Definition wm_draw.cc:170
PointerRNA * ptr
Definition wm_files.cc:4126