60 for (
int i = 0; i < fcu->
totvert; i++) {
98 (!cleardefault && fcu->
totvert == 1)) {
103 old_bezts = fcu->
bezt;
111 if (!(bezt->f2 &
SELECT)) {
113 lastb->
f1 = lastb->f2 = lastb->f3 = 0;
119 for (i = 1; i < totCount; i++) {
123 if (i < (totCount - 1)) {
124 beztn = (old_bezts + (i + 1));
125 next[0] = beztn->vec[1][0];
126 next[1] = beztn->vec[1][1];
133 bezt = (old_bezts + i);
136 prev[0] = lastb->vec[1][0];
137 prev[1] = lastb->vec[1][1];
138 cur[0] = bezt->vec[1][0];
139 cur[1] = bezt->vec[1][1];
141 if (!(bezt->f2 &
SELECT)) {
144 lastb->f1 = lastb->f2 = lastb->f3 = 0;
156 if (cur[1] >
next[1]) {
179 else if (
IS_EQT(cur[1],
next[1], thresh) == 0) {
201 if (cleardefault && fcu->
totvert == 1) {
202 float default_value = 0.0f;
214 if (fcu->
bezt->
vec[1][1] == default_value) {
235 const int start_index,
236 int *r_segment_start_idx,
239 *r_segment_start_idx = 0;
242 bool in_segment =
false;
244 for (
int i = start_index; i < fcu->
totvert; i++) {
250 *r_segment_start_idx = i;
255 else if (in_segment) {
270 int segment_start_idx = 0;
272 int current_index = 0;
277 segment->start_index = segment_start_idx;
280 current_index = segment_start_idx + segment_len;
301 const float blend_factor =
fabs(factor * 2 - 1);
311 for (
int i =
segment->start_index; i < segment->start_index +
segment->length; i++) {
322 float default_value = 0;
353 return default_value;
371 for (
int i = 0; i < fcu->
totvert; i++) {
385 for (
int i =
segment->start_index; i < segment->start_index +
segment->length; i++) {
430 int bezt_segment_start_idx,
431 int bezt_segment_len,
435 int selected_len = bezt_segment_len;
441 if (bezt_segment_len + bezt_segment_start_idx != fcu->
totvert &&
446 bezt_segment_start_idx--;
450 const int target_fcurve_verts =
ceil(bezt_segment_len - selected_len * remove_ratio);
460 target_fcurve_verts);
473 bool can_decimate_all_selected =
true;
475 for (
int i = 0; i < fcu->
totvert; i++) {
478 can_decimate_all_selected =
false;
488 fcu,
segment->start_index,
segment->length, remove_ratio, error_sq_max);
496 for (
int i = 0; i < old_totvert; i++) {
508 return can_decimate_all_selected;
529 for (
int i = 0; i < fcu->
totvert; i++, bezt++) {
544 for (
int i = 0,
x = 0; (i < fcu->
totvert) && (
x < totSel); i++, bezt++) {
547 tsb->
h1 = &bezt->
vec[0][1];
548 tsb->
h2 = &bezt->
vec[1][1];
549 tsb->
h3 = &bezt->
vec[2][1];
552 if (
x < totSel - 1) {
570 for (
int i = 0; i < totSel; i++, tsb++) {
573 if (
ELEM(i, 0, (totSel - 1)) == 0) {
579 const float p1 = *tP1->
h2;
580 const float p2 = (tP2) ? (*tP2->
h2) : (*tP1->
h2);
581 const float c1 = *tsb->
h2;
582 const float n1 = *tN1->
h2;
583 const float n2 = (tN2) ? (*tN2->
h2) : (*tN1->
h2);
586 tsb->
y1 = (3 * p2 + 5 * p1 + 2 * c1 + n1 + n2) / 12;
587 tsb->
y3 = (p2 + p1 + 2 * c1 + 5 * n1 + 3 * n2) / 12;
589 tsb->
y2 = (tsb->
y1 + tsb->
y3) / 2;
595 for (
int i = 0; i < totSel; i++, tsb++) {
597 if (
ELEM(i, 0, (totSel - 1)) == 0) {
602 *tsb->
h1 = ((*tsb->
h1) * 0.7f) + (tsb->
y1 * 0.3f);
603 *tsb->
h3 = ((*tsb->
h3) * 0.7f) + (tsb->
y3 * 0.3f);
634 for (i = 0, bezt = fcu->
bezt; i < fcu->totvert; i++, bezt++) {
643 if (i < fcu->totvert - 1) {
657 range = (int)(
ceil(end->vec[1][0] - start->
vec[1][0]));
658 sfra = (int)(
floor(start->
vec[1][0]));
664 for (n = 1, fp = value_cache; n < range && fp; n++, fp++) {
665 fp->frame = (
float)(sfra + n);
670 for (n = 1, fp = value_cache; n < range && fp; n++, fp++) {
678 bezt = fcu->
bezt + i + range - 1;
769 for (ale = anim_data->
first; ale; ale = ale->
next) {
799 char bone_name[
sizeof(pchan->name)];
820 memcpy(newbuf, aci->bezt,
sizeof(
BezTriple) * (aci->totvert));
824 nbezt = &newbuf[aci->totvert];
867 char *str_start = aci->
rna_path + ofs_start;
868 const char *str_end = aci->
rna_path + ofs_end;
874 int length, prefix_l, postfix_l;
876 prefix_l = str_start - aci->
rna_path;
878 length = str_end - str_start;
879 postfix_l = strlen(str_end);
887 str_iter = *r_name =
MEM_mallocN(
sizeof(
char) * (prefix_l + postfix_l +
length + 1),
891 str_iter += prefix_l;
895 str_iter[postfix_l] =
'\0';
904 const short from_single,
905 const short to_simple,
937 const short from_single,
938 const short UNUSED(to_simple))
953 printf(
"paste_animedit_keys: error ID has been removed!\n");
963 int len_id = strlen(identifier);
964 int len_path = strlen(fcu->
rna_path);
965 if (len_id <= len_path) {
967 if (
STREQ(identifier, fcu->
rna_path + (len_path - len_id))) {
975 printf(
"paste_animedit_keys: failed to resolve path id:%s, '%s'!\n",
988 const short from_single,
989 const short UNUSED(to_simple))
1008 const size_t slength = strlen(aci->
rna_path);
1047 switch (merge_mode) {
1072 if (f_min < f_max) {
1075 if ((f_min <
bezt[0].vec[1][0]) && (
bezt[0].vec[1][0] < f_max)) {
1123 "Paste keys starting at current frame"},
1129 "Paste keys relative to the current frame when copying"},
1141 "Overwrite keys in pasted range"},
1145 "Overwrite Entire Range",
1146 "Overwrite keys in pasted range, using the range of all copied keys"},
1176 switch (offset_mode) {
1191 if (from_single && to_simple) {
1196 ale = anim_data->
first;
1209 for (pass = 0; pass < 3; pass++) {
1212 for (ale = anim_data->
first; ale; ale = ale->
next) {
typedef float(TangentPoint)[2]
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_find_name(const struct bPose *pose, const char *name)
unsigned int BKE_curve_decimate_bezt_array(struct BezTriple *bezt_array, unsigned int bezt_array_len, unsigned int resolu, bool is_cyclic, char flag_test, char flag_set, float error_sq_max, unsigned int error_target_len)
float evaluate_fcurve(struct FCurve *fcu, float evaltime)
bool BKE_fcurve_is_empty(struct FCurve *fcu)
bool BKE_fcurve_delete_keys_selected(struct FCurve *fcu)
void BKE_fcurve_handles_recalc(struct FCurve *fcu)
void BKE_fcurve_delete_keys_all(struct FCurve *fcu)
struct ListBase * which_libbase(struct Main *bmain, short type)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void void BLI_INLINE bool BLI_listbase_is_single(const struct ListBase *lb)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float interpf(float a, float b, float t)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
bool BLI_str_quoted_substr_range(const char *__restrict str, const char *__restrict prefix, int *__restrict r_start, int *__restrict r_end) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
bool BLI_strn_endswith(const char *__restrict str, const char *__restrict end, size_t length) ATTR_NONNULL()
bool bool BLI_str_quoted_substr(const char *__restrict str, const char *__restrict prefix, char *result, size_t result_maxlen)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
size_t BLI_string_flip_side_name(char *r_name, const char *from_name, bool strip_number, size_t name_len)
@ INSERTKEY_OVERWRITE_FULL
#define BEZT_SEL_ALL(bezt)
#define BEZT_ISSEL_ANY(bezt)
#define BEZT_DESEL_ALL(bezt)
Object is a sort of wrapper for general info.
#define ANIM_UPDATE_DEFAULT
@ KEYFRAME_PASTE_MERGE_OVER_RANGE_ALL
@ KEYFRAME_PASTE_MERGE_OVER_RANGE
@ KEYFRAME_PASTE_MERGE_OVER
@ KEYFRAME_PASTE_MERGE_MIX
@ KEYFRAME_PASTE_OFFSET_NONE
@ KEYFRAME_PASTE_OFFSET_CFRA_END
@ KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE
@ KEYFRAME_PASTE_OFFSET_CFRA_START
@ KEYFRAME_PASTE_NOTHING_TO_PASTE
@ KEYFRAME_PASTE_NOWHERE_TO_PASTE
Read Guarded memory(de)allocation.
void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *fcu)
void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data)
AnimData * ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale)
void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, bool restore, bool only_keys)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb)
KeyframeEditFunc ANIM_editkeyframes_ok(short mode)
static void paste_animedit_keys_fcurve(FCurve *fcu, tAnimCopybufItem *aci, float offset, const eKeyMergeMode merge_mode, bool flip)
struct tSmooth_Bezt tSmooth_Bezt
static float animcopy_cfra
static bool prepare_for_decimate(FCurve *fcu, int i)
const EnumPropertyItem rna_enum_keyframe_paste_offset_items[]
bool decimate_fcurve(bAnimListElem *ale, float remove_ratio, float error_sq_max)
eKeyPasteError paste_animedit_keys(bAnimContext *ac, ListBase *anim_data, const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode, bool flip)
void breakdown_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const float factor)
short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
static bool find_fcurve_segment(FCurve *fcu, const int start_index, int *r_segment_start_idx, int *r_segment_len)
static tAnimCopybufItem * pastebuf_match_path_property(Main *bmain, FCurve *fcu, const short from_single, const short UNUSED(to_simple))
float get_default_rna_value(FCurve *fcu, PropertyRNA *prop, PointerRNA *ptr)
struct tAnimCopybufItem tAnimCopybufItem
const EnumPropertyItem rna_enum_keyframe_paste_merge_items[]
static void flip_names(tAnimCopybufItem *aci, char **r_name)
void sample_fcurve(FCurve *fcu)
struct TempFrameValCache TempFrameValCache
static BezTriple fcurve_segment_end_get(FCurve *fcu, int index)
static void decimate_fcurve_segment(FCurve *fcu, int bezt_segment_start_idx, int bezt_segment_len, float remove_ratio, float error_sq_max)
void smooth_fcurve(FCurve *fcu)
void blend_to_default_fcurve(PointerRNA *id_ptr, FCurve *fcu, const float factor)
void ANIM_fcurves_copybuf_free(void)
static void do_curve_mirror_flippping(tAnimCopybufItem *aci, BezTriple *bezt)
static ListBase animcopybuf
ListBase find_fcurve_segments(FCurve *fcu)
bool duplicate_fcurve_keys(FCurve *fcu)
static float animcopy_firstframe
static BezTriple fcurve_segment_start_get(FCurve *fcu, int index)
void blend_to_neighbor_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const float factor)
static tAnimCopybufItem * pastebuf_match_path_full(FCurve *fcu, const short from_single, const short to_simple, bool flip)
void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, bool cleardefault)
static tAnimCopybufItem * pastebuf_match_index_only(FCurve *fcu, const short from_single, const short UNUSED(to_simple))
static float animcopy_lastframe
int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType keyframe_type, eInsertKeyFlags flag)
Main Key-framing API call.
int insert_bezt_fcurve(FCurve *fcu, const BezTriple *bezt, eInsertKeyFlags flag)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
ccl_device_inline float2 fabs(const float2 &a)
ccl_device_inline float3 ceil(const float3 &a)
Segment< FEdge *, Vec3r > segment
T length(const vec_base< T, Size > &a)
SymEdge< T > * prev(const SymEdge< T > *se)
static bool point_is_selected(PTCacheEditPoint *point)
bool RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
const char * RNA_property_identifier(const PropertyRNA *prop)
float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
PropertyType RNA_property_type(PropertyRNA *prop)
bool RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
int RNA_property_int_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
int RNA_property_int_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
float RNA_property_float_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
bool RNA_path_resolve_property(const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop)
struct bAnimListElem * next
struct tAnimCopybufItem * prev
struct tAnimCopybufItem * next