50 #define OPERATOR_DATA_FILTER \
51 (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FCURVESONLY | \
52 ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS)
99 for (ale = anim_data.
first; ale; ale = ale->
next) {
113 memcpy(bezts_copy, fcu->
bezt, arr_size);
115 copy->bezt = bezts_copy;
158 memcpy(fcu->
bezt,
data->bezt, arr_size);
160 link_bezt = link_bezt->
next;
224 switch (event->
type) {
254 if (has_numinput ==
false) {
268 value = percentage * 100.0f;
271 percentage = value / 100.0f;
343 for (ale = anim_data.
first; ale; ale = ale->
next) {
365 strcpy(mode_str,
TIP_(
"Decimate Keyframes"));
372 BLI_snprintf(status_str,
sizeof(status_str),
"%s: %s", mode_str, str_ofs);
375 BLI_snprintf(status_str,
sizeof(status_str),
"%s: %s", mode_str, slider_string);
395 const float error_sq_max = FLT_MAX;
413 return invoke_result;
429 float error_sq_max = FLT_MAX;
438 error_sq_max *= error_sq_max;
443 if (factor == 0.0f || error_sq_max == 0.0f) {
481 TIP_(
"Decimate F-Curves by specifying how much they can deviate from the original curve"));
493 "Use a percentage to specify how many keyframes you want to remove"},
498 "Use an error margin to specify how much the curve is allowed to deviate from the original "
506 ot->
name =
"Decimate Keyframes";
509 "Decimate F-Curves by removing keyframes that influence the curve shape the least";
528 "Which mode to use for decimation");
536 "The ratio of remaining keyframes after the operation",
540 "remove_error_margin",
545 "How much the new decimated curve is allowed to deviate from the original",
565 for (ale = anim_data.
first; ale; ale = ale->
next) {
587 strcpy(mode_str,
TIP_(
"Blend to Neighbor"));
594 BLI_snprintf(status_str,
sizeof(status_str),
"%s: %s", mode_str, str_ofs);
597 BLI_snprintf(status_str,
sizeof(status_str),
"%s: %s", mode_str, slider_string);
623 return invoke_result;
631 return invoke_result;
655 ot->
name =
"Blend to Neighbor";
656 ot->
idname =
"GRAPH_OT_blend_to_neighbor";
657 ot->
description =
"Blend selected keyframes to their left or right neighbor";
674 "The blend factor with 0.5 being the current frame",
692 for (ale = anim_data.
first; ale; ale = ale->
next) {
714 strcpy(mode_str,
TIP_(
"Breakdown"));
721 BLI_snprintf(status_str,
sizeof(status_str),
"%s: %s", mode_str, str_ofs);
724 BLI_snprintf(status_str,
sizeof(status_str),
"%s: %s", mode_str, slider_string);
748 return invoke_result;
756 return invoke_result;
782 ot->
description =
"Move selected keyframes to an inbetween position relative to adjacent keys";
799 "Favor either the left or the right key",
842 strcpy(mode_str,
TIP_(
"Blend to Default Value"));
849 BLI_snprintf(status_str,
sizeof(status_str),
"%s: %s", mode_str, str_ofs);
852 BLI_snprintf(status_str,
sizeof(status_str),
"%s: %s", mode_str, slider_string);
877 return invoke_result;
885 return invoke_result;
909 ot->
name =
"Blend to Default Value";
910 ot->
idname =
"GRAPH_OT_blend_to_default";
911 ot->
description =
"Blend selected keys to their default value from their current position";
928 "How much to blend to the default value",
struct ScrArea * CTX_wm_area(const bContext *C)
struct Scene * CTX_data_scene(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
#define LISTBASE_FOREACH(type, var, list)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
struct BezTriple BezTriple
#define ANIM_UPDATE_DEFAULT
void ED_area_status_text(ScrArea *area, const char *str)
void ED_workspace_status_text(struct bContext *C, const char *str)
void ED_slider_init(struct tSlider *slider, const struct wmEvent *event)
void ED_slider_allow_overshoot_set(struct tSlider *slider, bool value)
void ED_slider_status_string_get(const struct tSlider *slider, char *status_string, size_t size_of_status_string)
float ED_slider_factor_get(struct tSlider *slider)
bool ED_slider_modal(struct tSlider *slider, const struct wmEvent *event)
void ED_slider_factor_set(struct tSlider *slider, float factor)
void ED_slider_destroy(struct bContext *C, struct tSlider *slider)
struct tSlider * ED_slider_create(struct bContext *C)
Read Guarded memory(de)allocation.
void ANIM_animdata_freelist(ListBase *anim_data)
void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data)
bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_Flags filter_mode, void *data, eAnimCont_Types datatype)
SyclQueue void void size_t num_bytes void
bool graphop_editable_keyframes_poll(struct bContext *C)
struct tGraphSliderOp tGraphSliderOp
static int blend_to_neighbor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void breakdown_draw_status_header(bContext *C, tGraphSliderOp *gso)
static int decimate_exec(bContext *C, wmOperator *op)
static int blend_to_default_exec(bContext *C, wmOperator *op)
static void reset_bezts(tGraphSliderOp *gso)
void GRAPH_OT_blend_to_neighbor(wmOperatorType *ot)
static const EnumPropertyItem decimate_mode_items[]
static int breakdown_exec(bContext *C, wmOperator *op)
static void blend_to_neighbor_graph_keys(bAnimContext *ac, float factor)
static void blend_to_default_modal_update(bContext *C, wmOperator *op)
static int graph_slider_modal(bContext *C, wmOperator *op, const wmEvent *event)
static int decimate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int blend_to_default_invoke(bContext *C, wmOperator *op, const wmEvent *event)
#define OPERATOR_DATA_FILTER
static char * decimate_desc(bContext *UNUSED(C), wmOperatorType *UNUSED(op), PointerRNA *ptr)
static void blend_to_default_draw_status_header(bContext *C, tGraphSliderOp *gso)
static bool decimate_poll_property(const bContext *UNUSED(C), wmOperator *op, const PropertyRNA *prop)
static void decimate_modal_update(bContext *C, wmOperator *op)
void GRAPH_OT_breakdown(wmOperatorType *ot)
static float slider_factor_get_and_remember(wmOperator *op)
static void blend_to_default_graph_keys(bAnimContext *ac, const float factor)
static void breakdown_modal_update(bContext *C, wmOperator *op)
static void blend_to_neighbor_modal_update(bContext *C, wmOperator *op)
static int blend_to_neighbor_exec(bContext *C, wmOperator *op)
static void decimate_graph_keys(bAnimContext *ac, float factor, float error_sq_max)
static int graph_slider_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void GRAPH_OT_decimate(wmOperatorType *ot)
static void breakdown_graph_keys(bAnimContext *ac, float factor)
static void blend_to_neighbor_draw_status_header(bContext *C, tGraphSliderOp *gso)
static int breakdown_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void GRAPH_OT_blend_to_default(wmOperatorType *ot)
static void graph_slider_exit(bContext *C, wmOperator *op)
static void store_original_bezt_arrays(tGraphSliderOp *gso)
static void decimate_draw_status(bContext *C, tGraphSliderOp *gso)
struct tBeztCopyData tBeztCopyData
bool decimate_fcurve(bAnimListElem *ale, float remove_ratio, float error_sq_max)
void breakdown_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const float factor)
void blend_to_default_fcurve(PointerRNA *id_ptr, FCurve *fcu, const float factor)
ListBase find_fcurve_segments(FCurve *fcu)
void blend_to_neighbor_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const float factor)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
Segment< FEdge *, Vec3r > segment
static void area(int d1, int d2, int e1, int e2, float weights[2])
static void copy(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node)
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
const char * RNA_property_identifier(const PropertyRNA *prop)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
struct bAnimListElem * next
void(* modal_update)(struct bContext *, struct wmOperator *)
PropertyRNA * factor_prop
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
char *(* get_description)(struct bContext *C, struct wmOperatorType *, struct PointerRNA *)
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
bool(* poll_property)(const struct bContext *C, struct wmOperator *op, const PropertyRNA *prop) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
void WM_cursor_modal_set(wmWindow *win, int val)
void WM_cursor_modal_restore(wmWindow *win)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_report(eReportType type, const char *message)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)