Blender V4.5
graph_slider_ops.cc File Reference
#include <cfloat>
#include <cstring>
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "DEG_depsgraph.hh"
#include "DNA_anim_types.h"
#include "DNA_curve_types.h"
#include "DNA_scene_types.h"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "BLT_translation.hh"
#include "BKE_context.hh"
#include "BKE_report.hh"
#include "UI_interface.hh"
#include "ED_anim_api.hh"
#include "ED_keyframes_edit.hh"
#include "ED_numinput.hh"
#include "ED_screen.hh"
#include "ED_util.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "ANIM_fcurve.hh"
#include <fmt/format.h>
#include "graph_intern.hh"

Go to the source code of this file.

Classes

struct  tGraphSliderOp
struct  tBeztCopyData
struct  tGaussOperatorData
struct  tBtwOperatorData

Macros

Internal Struct & Defines
#define OPERATOR_DATA_FILTER

Functions

Utility Functions
static void apply_fcu_segment_function (bAnimContext *ac, const float factor, void(*segment_function)(FCurve *fcu, FCurveSegment *segment, const float factor))
static void common_draw_status_header (bContext *C, tGraphSliderOp *gso)
static void store_original_bezt_arrays (tGraphSliderOp *gso)
static void reset_bezts (tGraphSliderOp *gso)
static float slider_factor_get_and_remember (wmOperator *op)
Common Modal Functions
static void graph_slider_exit (bContext *C, wmOperator *op)
static void update_depsgraph (tGraphSliderOp *gso)
static wmOperatorStatus graph_slider_modal (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus graph_slider_invoke (bContext *C, wmOperator *op, const wmEvent *event)
Blend to Neighbor Operator
static void blend_to_neighbor_graph_keys (bAnimContext *ac, const float factor)
static void blend_to_neighbor_modal_update (bContext *C, wmOperator *op)
static wmOperatorStatus blend_to_neighbor_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus blend_to_neighbor_exec (bContext *C, wmOperator *op)
void GRAPH_OT_blend_to_neighbor (wmOperatorType *ot)
Breakdown Operator
static void breakdown_graph_keys (bAnimContext *ac, float factor)
static void breakdown_modal_update (bContext *C, wmOperator *op)
static wmOperatorStatus breakdown_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus breakdown_exec (bContext *C, wmOperator *op)
void GRAPH_OT_breakdown (wmOperatorType *ot)
Blend to Default Value Operator
static void blend_to_default_graph_keys (bAnimContext *ac, const float factor)
static void blend_to_default_modal_update (bContext *C, wmOperator *op)
static wmOperatorStatus blend_to_default_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus blend_to_default_exec (bContext *C, wmOperator *op)
void GRAPH_OT_blend_to_default (wmOperatorType *ot)
Ease Operator
static void ease_graph_keys (bAnimContext *ac, const float factor, const float width)
static void ease_draw_status_header (bContext *C, wmOperator *op)
static void ease_modal_update (bContext *C, wmOperator *op)
static wmOperatorStatus ease_modal (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus ease_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus ease_exec (bContext *C, wmOperator *op)
void GRAPH_OT_ease (wmOperatorType *ot)
Blend Offset Operator
static void blend_offset_graph_keys (bAnimContext *ac, const float factor)
static void blend_offset_draw_status_header (bContext *C, tGraphSliderOp *gso)
static void blend_offset_modal_update (bContext *C, wmOperator *op)
static wmOperatorStatus blend_offset_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus blend_offset_exec (bContext *C, wmOperator *op)
void GRAPH_OT_blend_offset (wmOperatorType *ot)
Blend to Ease Operator
static void blend_to_ease_graph_keys (bAnimContext *ac, const float factor)
static void blend_to_ease_draw_status_header (bContext *C, tGraphSliderOp *gso)
static void blend_to_ease_modal_update (bContext *C, wmOperator *op)
static wmOperatorStatus blend_to_ease_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus blend_to_ease_exec (bContext *C, wmOperator *op)
void GRAPH_OT_blend_to_ease (wmOperatorType *ot)
Match Slope
static void match_slope_graph_keys (bAnimContext *ac, const float factor)
static void match_slope_draw_status_header (bContext *C, tGraphSliderOp *gso)
static void match_slope_modal_update (bContext *C, wmOperator *op)
static wmOperatorStatus match_slope_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus match_slope_exec (bContext *C, wmOperator *op)
void GRAPH_OT_match_slope (wmOperatorType *ot)
Time Offset
static void time_offset_graph_keys (bAnimContext *ac, const float factor)
static void time_offset_draw_status_header (bContext *C, tGraphSliderOp *gso)
static void time_offset_modal_update (bContext *C, wmOperator *op)
static wmOperatorStatus time_offset_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus time_offset_exec (bContext *C, wmOperator *op)
void GRAPH_OT_time_offset (wmOperatorType *ot)
Scale Average Operator
static void scale_average_graph_keys (bAnimContext *ac, const float factor)
static void scale_average_modal_update (bContext *C, wmOperator *op)
static wmOperatorStatus scale_average_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus scale_average_exec (bContext *C, wmOperator *op)
void GRAPH_OT_scale_average (wmOperatorType *ot)
Gauss Smooth Operator
static float * back_up_key_y_values (const FCurveSegment *segment, const FCurve *fcu)
static void gaussian_smooth_allocate_operator_data (tGraphSliderOp *gso, const int filter_width, const float sigma)
static void gaussian_smooth_free_operator_data (void *operator_data)
static void gaussian_smooth_modal_update (bContext *C, wmOperator *op)
static wmOperatorStatus gaussian_smooth_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static void gaussian_smooth_graph_keys (bAnimContext *ac, const float factor, double *kernel, const int filter_width)
static wmOperatorStatus gaussian_smooth_exec (bContext *C, wmOperator *op)
void GRAPH_OT_gaussian_smooth (wmOperatorType *ot)
Butterworth Smooth Operator
static int btw_calculate_sample_count (const BezTriple *right_bezt, const BezTriple *left_bezt, const int filter_order, const int samples_per_frame)
static void btw_smooth_allocate_operator_data (tGraphSliderOp *gso, const int filter_order, const int samples_per_frame)
static void btw_smooth_free_operator_data (void *operator_data)
static void btw_smooth_modal_update (bContext *C, wmOperator *op)
static wmOperatorStatus btw_smooth_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static void btw_smooth_graph_keys (bAnimContext *ac, const float factor, const int blend_in_out, float cutoff_frequency, const int filter_order, const int samples_per_frame)
static wmOperatorStatus btw_smooth_exec (bContext *C, wmOperator *op)
void GRAPH_OT_butterworth_smooth (wmOperatorType *ot)
Push-Pull Operator
static void push_pull_graph_keys (bAnimContext *ac, const float factor)
static void push_pull_modal_update (bContext *C, wmOperator *op)
static wmOperatorStatus push_pull_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus push_pull_exec (bContext *C, wmOperator *op)
void GRAPH_OT_push_pull (wmOperatorType *ot)

Decimate Keyframes Operator

enum  tDecimModes { DECIM_RATIO = 1 , DECIM_ERROR }
static const EnumPropertyItem decimate_mode_items []
static void decimate_graph_keys (bAnimContext *ac, float factor, float error_sq_max)
static void decimate_draw_status (bContext *C, tGraphSliderOp *gso)
static void decimate_modal_update (bContext *C, wmOperator *op)
static wmOperatorStatus decimate_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus decimate_exec (bContext *C, wmOperator *op)
static bool decimate_poll_property (const bContext *, wmOperator *op, const PropertyRNA *prop)
static std::string decimate_get_description (bContext *, wmOperatorType *, PointerRNA *ptr)
void GRAPH_OT_decimate (wmOperatorType *ot)

Shear Operator

static const EnumPropertyItem shear_direction_items []
static void shear_graph_keys (bAnimContext *ac, const float factor, tShearDirection direction)
static void shear_draw_status_header (bContext *C, tGraphSliderOp *gso, tShearDirection direction)
static void shear_modal_update (bContext *C, wmOperator *op)
static wmOperatorStatus shear_modal (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus shear_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus shear_exec (bContext *C, wmOperator *op)
void GRAPH_OT_shear (wmOperatorType *ot)

Scale from Left Operator

static const EnumPropertyItem scale_anchor_items []
static void scale_from_neighbor_graph_keys (bAnimContext *ac, const float factor, const FCurveSegmentAnchor anchor)
static void scale_from_neighbor_draw_status_header (bContext *C, wmOperator *op)
static void scale_from_neighbor_modal_update (bContext *C, wmOperator *op)
static wmOperatorStatus scale_from_neighbor_modal (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus scale_from_neighbor_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus scale_from_neighbor_exec (bContext *C, wmOperator *op)
void GRAPH_OT_scale_from_neighbor (wmOperatorType *ot)

Detailed Description

Graph Slider Operators

This file contains a collection of operators to modify keyframes in the graph editor. All operators are modal and use a slider that allows the user to define a percentage to modify the operator.

Definition in file graph_slider_ops.cc.

Macro Definition Documentation

◆ OPERATOR_DATA_FILTER

Enumeration Type Documentation

◆ tDecimModes

Enumerator
DECIM_RATIO 
DECIM_ERROR 

Definition at line 427 of file graph_slider_ops.cc.

Function Documentation

◆ apply_fcu_segment_function()

void apply_fcu_segment_function ( bAnimContext * ac,
const float factor,
void(* segment_function )(FCurve *fcu, FCurveSegment *segment, const float factor) )
static

◆ back_up_key_y_values()

float * back_up_key_y_values ( const FCurveSegment * segment,
const FCurve * fcu )
static

◆ blend_offset_draw_status_header()

void blend_offset_draw_status_header ( bContext * C,
tGraphSliderOp * gso )
static

◆ blend_offset_exec()

◆ blend_offset_graph_keys()

void blend_offset_graph_keys ( bAnimContext * ac,
const float factor )
static

◆ blend_offset_invoke()

◆ blend_offset_modal_update()

◆ blend_to_default_exec()

◆ blend_to_default_graph_keys()

◆ blend_to_default_invoke()

◆ blend_to_default_modal_update()

◆ blend_to_ease_draw_status_header()

void blend_to_ease_draw_status_header ( bContext * C,
tGraphSliderOp * gso )
static

◆ blend_to_ease_exec()

◆ blend_to_ease_graph_keys()

void blend_to_ease_graph_keys ( bAnimContext * ac,
const float factor )
static

◆ blend_to_ease_invoke()

◆ blend_to_ease_modal_update()

◆ blend_to_neighbor_exec()

◆ blend_to_neighbor_graph_keys()

void blend_to_neighbor_graph_keys ( bAnimContext * ac,
const float factor )
static

◆ blend_to_neighbor_invoke()

◆ blend_to_neighbor_modal_update()

◆ breakdown_exec()

◆ breakdown_graph_keys()

void breakdown_graph_keys ( bAnimContext * ac,
float factor )
static

◆ breakdown_invoke()

◆ breakdown_modal_update()

◆ btw_calculate_sample_count()

int btw_calculate_sample_count ( const BezTriple * right_bezt,
const BezTriple * left_bezt,
const int filter_order,
const int samples_per_frame )
static

◆ btw_smooth_allocate_operator_data()

◆ btw_smooth_exec()

◆ btw_smooth_free_operator_data()

◆ btw_smooth_graph_keys()

◆ btw_smooth_invoke()

◆ btw_smooth_modal_update()

◆ common_draw_status_header()

◆ decimate_draw_status()

◆ decimate_exec()

◆ decimate_get_description()

std::string decimate_get_description ( bContext * ,
wmOperatorType * ,
PointerRNA * ptr )
static

◆ decimate_graph_keys()

◆ decimate_invoke()

◆ decimate_modal_update()

◆ decimate_poll_property()

bool decimate_poll_property ( const bContext * ,
wmOperator * op,
const PropertyRNA * prop )
static

◆ ease_draw_status_header()

◆ ease_exec()

◆ ease_graph_keys()

◆ ease_invoke()

◆ ease_modal()

◆ ease_modal_update()

◆ gaussian_smooth_allocate_operator_data()

◆ gaussian_smooth_exec()

◆ gaussian_smooth_free_operator_data()

◆ gaussian_smooth_graph_keys()

◆ gaussian_smooth_invoke()

◆ gaussian_smooth_modal_update()

◆ GRAPH_OT_blend_offset()

◆ GRAPH_OT_blend_to_default()

◆ GRAPH_OT_blend_to_ease()

◆ GRAPH_OT_blend_to_neighbor()

◆ GRAPH_OT_breakdown()

◆ GRAPH_OT_butterworth_smooth()

◆ GRAPH_OT_decimate()

◆ GRAPH_OT_ease()

◆ GRAPH_OT_gaussian_smooth()

◆ GRAPH_OT_match_slope()

◆ GRAPH_OT_push_pull()

◆ GRAPH_OT_scale_average()

◆ GRAPH_OT_scale_from_neighbor()

◆ GRAPH_OT_shear()

◆ GRAPH_OT_time_offset()

◆ graph_slider_exit()

◆ graph_slider_invoke()

◆ graph_slider_modal()

◆ match_slope_draw_status_header()

void match_slope_draw_status_header ( bContext * C,
tGraphSliderOp * gso )
static

◆ match_slope_exec()

◆ match_slope_graph_keys()

◆ match_slope_invoke()

◆ match_slope_modal_update()

◆ push_pull_exec()

◆ push_pull_graph_keys()

void push_pull_graph_keys ( bAnimContext * ac,
const float factor )
static

◆ push_pull_invoke()

◆ push_pull_modal_update()

◆ reset_bezts()

◆ scale_average_exec()

◆ scale_average_graph_keys()

void scale_average_graph_keys ( bAnimContext * ac,
const float factor )
static

◆ scale_average_invoke()

◆ scale_average_modal_update()

◆ scale_from_neighbor_draw_status_header()

◆ scale_from_neighbor_exec()

◆ scale_from_neighbor_graph_keys()

◆ scale_from_neighbor_invoke()

◆ scale_from_neighbor_modal()

◆ scale_from_neighbor_modal_update()

◆ shear_draw_status_header()

◆ shear_exec()

◆ shear_graph_keys()

◆ shear_invoke()

◆ shear_modal()

◆ shear_modal_update()

◆ slider_factor_get_and_remember()

◆ store_original_bezt_arrays()

void store_original_bezt_arrays ( tGraphSliderOp * gso)
static

◆ time_offset_draw_status_header()

void time_offset_draw_status_header ( bContext * C,
tGraphSliderOp * gso )
static

◆ time_offset_exec()

◆ time_offset_graph_keys()

void time_offset_graph_keys ( bAnimContext * ac,
const float factor )
static

◆ time_offset_invoke()

◆ time_offset_modal_update()

◆ update_depsgraph()

Variable Documentation

◆ decimate_mode_items

const EnumPropertyItem decimate_mode_items[]
static
Initial value:
= {
"RATIO",
0,
"Ratio",
"Use a percentage to specify how many keyframes you want to remove"},
"ERROR",
0,
"Error Margin",
"Use an error margin to specify how much the curve is allowed to deviate from the original "
"path"},
{0, nullptr, 0, nullptr, nullptr},
}
@ DECIM_RATIO
@ DECIM_ERROR

Definition at line 575 of file graph_slider_ops.cc.

Referenced by GRAPH_OT_decimate().

◆ scale_anchor_items

const EnumPropertyItem scale_anchor_items[]
static
Initial value:
= {
{int(FCurveSegmentAnchor::LEFT), "LEFT", 0, "From Left", ""},
{int(FCurveSegmentAnchor::RIGHT), "RIGHT", 0, "From Right", ""},
{0, nullptr, 0, nullptr, nullptr},
}

Definition at line 2410 of file graph_slider_ops.cc.

Referenced by GRAPH_OT_scale_from_neighbor().

◆ shear_direction_items

const EnumPropertyItem shear_direction_items[]
static
Initial value:
= {
"FROM_LEFT",
0,
"From Left",
"Shear the keys using the left key as reference"},
"FROM_RIGHT",
0,
"From Right",
"Shear the keys using the right key as reference"},
{0, nullptr, 0, nullptr, nullptr},
}
@ SHEAR_FROM_RIGHT
@ SHEAR_FROM_LEFT

Definition at line 1517 of file graph_slider_ops.cc.

Referenced by GRAPH_OT_shear().