Blender
V3.3
|
#include <float.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "DNA_anim_types.h"
#include "DNA_scene_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "BLT_translation.h"
#include "BKE_context.h"
#include "UI_interface.h"
#include "ED_anim_api.h"
#include "ED_keyframes_edit.h"
#include "ED_numinput.h"
#include "ED_screen.h"
#include "ED_util.h"
#include "WM_api.h"
#include "WM_types.h"
#include "graph_intern.h"
Go to the source code of this file.
Classes | |
struct | tGraphSliderOp |
struct | tBeztCopyData |
Internal Struct & Defines | |
#define | OPERATOR_DATA_FILTER |
typedef struct tGraphSliderOp | tGraphSliderOp |
typedef struct tBeztCopyData | tBeztCopyData |
Decimate Keyframes Operator | |
enum | tDecimModes { DECIM_RATIO = 1 , DECIM_ERROR } |
typedef enum tDecimModes | tDecimModes |
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 int | decimate_invoke (bContext *C, wmOperator *op, const wmEvent *event) |
static int | decimate_exec (bContext *C, wmOperator *op) |
static bool | decimate_poll_property (const bContext *UNUSED(C), wmOperator *op, const PropertyRNA *prop) |
static char * | decimate_desc (bContext *UNUSED(C), wmOperatorType *UNUSED(op), PointerRNA *ptr) |
void | GRAPH_OT_decimate (wmOperatorType *ot) |
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.c.
#define OPERATOR_DATA_FILTER |
Definition at line 50 of file graph_slider_ops.c.
typedef struct tBeztCopyData tBeztCopyData |
typedef enum tDecimModes tDecimModes |
typedef struct tGraphSliderOp tGraphSliderOp |
enum tDecimModes |
Enumerator | |
---|---|
DECIM_RATIO | |
DECIM_ERROR |
Definition at line 329 of file graph_slider_ops.c.
|
static |
Definition at line 834 of file graph_slider_ops.c.
References BLI_snprintf(), C, ED_slider_status_string_get(), ED_workspace_status_text(), hasNumInput(), tGraphSliderOp::num, NUM_STR_REP_LEN, outputNumInput(), tGraphSliderOp::scene, tGraphSliderOp::slider, TIP_, UI_MAX_DRAW_STR, and Scene::unit.
Referenced by blend_to_default_invoke(), and blend_to_default_modal_update().
|
static |
Definition at line 888 of file graph_slider_ops.c.
References ANIM_animdata_get_context(), blend_to_default_graph_keys(), C, NA_EDITED, NC_ANIMATION, ND_KEYFRAME, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::ptr, RNA_float_get(), and WM_event_add_notifier().
Referenced by GRAPH_OT_blend_to_default().
|
static |
Definition at line 810 of file graph_slider_ops.c.
References ANIM_animdata_filter(), ANIM_animdata_freelist(), ANIM_animdata_update(), ANIM_UPDATE_DEFAULT, FCurve::bezt, blend_to_default_fcurve(), bAnimContext::data, bAnimContext::datatype, if(), LISTBASE_FOREACH, NULL, OPERATOR_DATA_FILTER, RNA_id_pointer_create(), and FCurve::totvert.
Referenced by blend_to_default_exec(), and blend_to_default_modal_update().
|
static |
Definition at line 872 of file graph_slider_ops.c.
References blend_to_default_draw_status_header(), blend_to_default_modal_update(), C, wmOperator::customdata, tGraphSliderOp::factor_prop, graph_slider_invoke(), tGraphSliderOp::modal_update, OPERATOR_CANCELLED, wmOperator::ptr, and RNA_struct_find_property().
Referenced by GRAPH_OT_blend_to_default().
|
static |
Definition at line 858 of file graph_slider_ops.c.
References tGraphSliderOp::ac, blend_to_default_draw_status_header(), blend_to_default_graph_keys(), C, wmOperator::customdata, ED_slider_factor_get(), tGraphSliderOp::factor_prop, NA_EDITED, NC_ANIMATION, ND_KEYFRAME, NULL, wmOperator::ptr, reset_bezts(), RNA_property_float_set(), tGraphSliderOp::slider, and WM_event_add_notifier().
Referenced by blend_to_default_invoke().
|
static |
Definition at line 579 of file graph_slider_ops.c.
References BLI_snprintf(), C, ED_slider_status_string_get(), ED_workspace_status_text(), hasNumInput(), tGraphSliderOp::num, NUM_STR_REP_LEN, outputNumInput(), tGraphSliderOp::scene, tGraphSliderOp::slider, TIP_, UI_MAX_DRAW_STR, and Scene::unit.
Referenced by blend_to_neighbor_invoke(), and blend_to_neighbor_modal_update().
|
static |
Definition at line 634 of file graph_slider_ops.c.
References ANIM_animdata_get_context(), blend_to_neighbor_graph_keys(), C, NA_EDITED, NC_ANIMATION, ND_KEYFRAME, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::ptr, RNA_float_get(), and WM_event_add_notifier().
Referenced by GRAPH_OT_blend_to_neighbor().
|
static |
Definition at line 556 of file graph_slider_ops.c.
References ANIM_animdata_filter(), ANIM_animdata_freelist(), ANIM_animdata_update(), ANIM_UPDATE_DEFAULT, blend_to_neighbor_fcurve_segment(), BLI_freelistN(), bAnimContext::data, bAnimContext::datatype, find_fcurve_segments(), ListBase::first, bAnimListElem::key_data, LISTBASE_FOREACH, bAnimListElem::next, NULL, OPERATOR_DATA_FILTER, and bAnimListElem::update.
Referenced by blend_to_neighbor_exec(), and blend_to_neighbor_modal_update().
|
static |
Definition at line 618 of file graph_slider_ops.c.
References blend_to_neighbor_draw_status_header(), blend_to_neighbor_modal_update(), C, wmOperator::customdata, tGraphSliderOp::factor_prop, graph_slider_invoke(), tGraphSliderOp::modal_update, OPERATOR_CANCELLED, wmOperator::ptr, and RNA_struct_find_property().
Referenced by GRAPH_OT_blend_to_neighbor().
|
static |
Definition at line 603 of file graph_slider_ops.c.
References tGraphSliderOp::ac, blend_to_neighbor_draw_status_header(), blend_to_neighbor_graph_keys(), C, wmOperator::customdata, NA_EDITED, NC_ANIMATION, ND_KEYFRAME, NULL, reset_bezts(), slider_factor_get_and_remember(), and WM_event_add_notifier().
Referenced by blend_to_neighbor_invoke().
|
static |
Definition at line 706 of file graph_slider_ops.c.
References BLI_snprintf(), C, ED_slider_status_string_get(), ED_workspace_status_text(), hasNumInput(), tGraphSliderOp::num, NUM_STR_REP_LEN, outputNumInput(), tGraphSliderOp::scene, tGraphSliderOp::slider, TIP_, UI_MAX_DRAW_STR, and Scene::unit.
Referenced by breakdown_invoke(), and breakdown_modal_update().
|
static |
Definition at line 759 of file graph_slider_ops.c.
References ANIM_animdata_get_context(), breakdown_graph_keys(), C, NA_EDITED, NC_ANIMATION, ND_KEYFRAME, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::ptr, RNA_float_get(), and WM_event_add_notifier().
Referenced by GRAPH_OT_breakdown().
|
static |
Definition at line 685 of file graph_slider_ops.c.
References ANIM_animdata_filter(), ANIM_animdata_freelist(), ANIM_animdata_update(), ANIM_UPDATE_DEFAULT, BLI_freelistN(), breakdown_fcurve_segment(), bAnimContext::data, bAnimContext::datatype, find_fcurve_segments(), ListBase::first, bAnimListElem::key_data, LISTBASE_FOREACH, bAnimListElem::next, NULL, OPERATOR_DATA_FILTER, and bAnimListElem::update.
Referenced by breakdown_exec(), and breakdown_modal_update().
|
static |
Definition at line 743 of file graph_slider_ops.c.
References breakdown_draw_status_header(), breakdown_modal_update(), C, wmOperator::customdata, tGraphSliderOp::factor_prop, graph_slider_invoke(), tGraphSliderOp::modal_update, OPERATOR_CANCELLED, wmOperator::ptr, and RNA_struct_find_property().
Referenced by GRAPH_OT_breakdown().
|
static |
Definition at line 730 of file graph_slider_ops.c.
References tGraphSliderOp::ac, breakdown_draw_status_header(), breakdown_graph_keys(), C, wmOperator::customdata, NA_EDITED, NC_ANIMATION, ND_KEYFRAME, NULL, reset_bezts(), slider_factor_get_and_remember(), and WM_event_add_notifier().
Referenced by breakdown_invoke().
|
static |
Definition at line 476 of file graph_slider_ops.c.
References BLI_strdup(), DECIM_ERROR, NULL, ptr, RNA_enum_get(), and TIP_.
Referenced by GRAPH_OT_decimate().
|
static |
Definition at line 357 of file graph_slider_ops.c.
References BLI_snprintf(), C, ED_slider_status_string_get(), ED_workspace_status_text(), hasNumInput(), tGraphSliderOp::num, NUM_STR_REP_LEN, outputNumInput(), tGraphSliderOp::scene, tGraphSliderOp::slider, TIP_, UI_MAX_DRAW_STR, and Scene::unit.
Referenced by decimate_modal_update().
|
static |
Definition at line 416 of file graph_slider_ops.c.
References ANIM_animdata_get_context(), C, DECIM_ERROR, DECIM_RATIO, decimate_graph_keys(), NA_EDITED, NC_ANIMATION, ND_KEYFRAME, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::ptr, RNA_enum_get(), RNA_float_get(), and WM_event_add_notifier().
Referenced by GRAPH_OT_decimate().
|
static |
Definition at line 334 of file graph_slider_ops.c.
References ANIM_animdata_filter(), ANIM_animdata_freelist(), ANIM_animdata_update(), ANIM_UPDATE_DEFAULT, bAnimContext::data, bAnimContext::datatype, decimate_fcurve(), ListBase::first, bAnimListElem::next, NULL, OPERATOR_DATA_FILTER, RPT_WARNING, bAnimListElem::update, and WM_report().
Referenced by decimate_exec(), and decimate_modal_update().
|
static |
Definition at line 400 of file graph_slider_ops.c.
References C, wmOperator::customdata, decimate_modal_update(), ED_slider_allow_overshoot_set(), tGraphSliderOp::factor_prop, graph_slider_invoke(), tGraphSliderOp::modal_update, OPERATOR_CANCELLED, wmOperator::ptr, RNA_struct_find_property(), and tGraphSliderOp::slider.
Referenced by GRAPH_OT_decimate().
|
static |
Definition at line 381 of file graph_slider_ops.c.
References tGraphSliderOp::ac, C, wmOperator::customdata, decimate_draw_status(), decimate_graph_keys(), NA_EDITED, NC_ANIMATION, ND_KEYFRAME, NULL, reset_bezts(), slider_factor_get_and_remember(), and WM_event_add_notifier().
Referenced by decimate_invoke().
|
static |
Definition at line 456 of file graph_slider_ops.c.
References DECIM_ERROR, DECIM_RATIO, wmOperator::ptr, RNA_enum_get(), RNA_property_identifier(), STREQ, and STRPREFIX.
Referenced by GRAPH_OT_decimate().
void GRAPH_OT_blend_to_default | ( | wmOperatorType * | ot | ) |
Definition at line 906 of file graph_slider_ops.c.
References blend_to_default_exec(), blend_to_default_invoke(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, graph_slider_modal(), graphop_editable_keyframes_poll(), wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, RNA_def_float_factor(), and wmOperatorType::srna.
Referenced by graphedit_operatortypes().
void GRAPH_OT_blend_to_neighbor | ( | wmOperatorType * | ot | ) |
Definition at line 652 of file graph_slider_ops.c.
References blend_to_neighbor_exec(), blend_to_neighbor_invoke(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, graph_slider_modal(), graphop_editable_keyframes_poll(), wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, RNA_def_float_factor(), and wmOperatorType::srna.
Referenced by graphedit_operatortypes().
void GRAPH_OT_breakdown | ( | wmOperatorType * | ot | ) |
Definition at line 777 of file graph_slider_ops.c.
References breakdown_exec(), breakdown_invoke(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, graph_slider_modal(), graphop_editable_keyframes_poll(), wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, RNA_def_float_factor(), and wmOperatorType::srna.
Referenced by graphedit_operatortypes().
void GRAPH_OT_decimate | ( | wmOperatorType * | ot | ) |
Definition at line 503 of file graph_slider_ops.c.
References DECIM_RATIO, decimate_desc(), decimate_exec(), decimate_invoke(), decimate_mode_items, decimate_poll_property(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::get_description, graph_slider_modal(), graphop_editable_keyframes_poll(), wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, wmOperatorType::poll_property, RNA_def_enum(), RNA_def_float(), RNA_def_float_factor(), and wmOperatorType::srna.
Referenced by graphedit_operatortypes().
|
static |
Definition at line 184 of file graph_slider_ops.c.
References blender::compositor::area(), tGraphSliderOp::area, tGraphSliderOp::bezt_arr_list, BLI_freelistN(), C, copy(), CTX_wm_window(), wmOperator::customdata, LinkData::data, ED_area_status_text(), ED_slider_destroy(), ListBase::first, MEM_freeN, LinkData::next, NULL, tGraphSliderOp::slider, and WM_cursor_modal_restore().
Referenced by graph_slider_invoke(), and graph_slider_modal().
|
static |
Definition at line 289 of file graph_slider_ops.c.
References tGraphSliderOp::ac, ANIM_animdata_get_context(), tGraphSliderOp::area, tGraphSliderOp::bezt_arr_list, C, CTX_data_scene(), CTX_wm_area(), CTX_wm_region(), CTX_wm_window(), wmOperator::customdata, ED_slider_create(), ED_slider_init(), ListBase::first, graph_slider_exit(), MEM_callocN, NULL, OPERATOR_CANCELLED, OPERATOR_RUNNING_MODAL, tGraphSliderOp::region, RPT_ERROR, tGraphSliderOp::scene, tGraphSliderOp::slider, store_original_bezt_arrays(), WM_CURSOR_EW_SCROLL, WM_cursor_modal_set(), WM_event_add_modal_handler(), and WM_report().
Referenced by blend_to_default_invoke(), blend_to_neighbor_invoke(), breakdown_invoke(), and decimate_invoke().
|
static |
Definition at line 216 of file graph_slider_ops.c.
References applyNumInput(), C, wmOperator::customdata, ED_slider_factor_set(), ED_slider_modal(), EVT_ESCKEY, EVT_PADENTER, EVT_RETKEY, tGraphSliderOp::factor_prop, graph_slider_exit(), handleNumInput(), hasNumInput(), KM_PRESS, LEFTMOUSE, tGraphSliderOp::modal_update, MOUSEMOVE, NA_EDITED, NC_ANIMATION, ND_KEYFRAME, NULL, tGraphSliderOp::num, OPERATOR_CANCELLED, OPERATOR_FINISHED, OPERATOR_PASS_THROUGH, OPERATOR_RUNNING_MODAL, wmOperator::ptr, reset_bezts(), RIGHTMOUSE, RNA_property_float_get(), RNA_property_float_set(), tGraphSliderOp::slider, wmEvent::type, wmEvent::val, and WM_event_add_notifier().
Referenced by GRAPH_OT_blend_to_default(), GRAPH_OT_blend_to_neighbor(), GRAPH_OT_breakdown(), and GRAPH_OT_decimate().
|
static |
Definition at line 129 of file graph_slider_ops.c.
References tGraphSliderOp::ac, ANIM_animdata_filter(), ANIM_animdata_freelist(), FCurve::bezt, tGraphSliderOp::bezt_arr_list, data, bAnimContext::data, LinkData::data, bAnimContext::datatype, ListBase::first, if(), bAnimListElem::key_data, MEM_freeN, MEM_mallocN, bAnimListElem::next, LinkData::next, NULL, OPERATOR_DATA_FILTER, and FCurve::totvert.
Referenced by blend_to_default_modal_update(), blend_to_neighbor_modal_update(), breakdown_modal_update(), decimate_modal_update(), and graph_slider_modal().
|
static |
Get factor value and store it in RNA property. Custom data of wmOperator needs to contain tGraphSliderOp.
Definition at line 170 of file graph_slider_ops.c.
References wmOperator::customdata, ED_slider_factor_get(), tGraphSliderOp::factor_prop, wmOperator::ptr, RNA_property_float_set(), and tGraphSliderOp::slider.
Referenced by blend_to_neighbor_modal_update(), breakdown_modal_update(), and decimate_modal_update().
|
static |
Construct a list with the original bezt arrays so we can restore them during modal operation. The data is stored on the struct that is passed.
Definition at line 90 of file graph_slider_ops.c.
References tGraphSliderOp::ac, ANIM_animdata_filter(), ANIM_animdata_freelist(), FCurve::bezt, tGraphSliderOp::bezt_arr_list, BLI_addtail(), copy(), bAnimContext::data, LinkData::data, bAnimContext::datatype, ListBase::first, if(), bAnimListElem::key_data, MEM_callocN, MEM_mallocN, bAnimListElem::next, NULL, OPERATOR_DATA_FILTER, and FCurve::totvert.
Referenced by graph_slider_invoke().
|
static |
Definition at line 488 of file graph_slider_ops.c.
Referenced by GRAPH_OT_decimate().