76#define GVERTSEL_TOL (10 * U.pixelsize)
108 int screen_co[2], dist;
114 bezt->
vec[hpoint + 1][0],
115 (bezt->
vec[hpoint + 1][1] + offset) * unit_scale,
122 bool replace =
false;
126 if ((nvi) && (nvi->
fcu == fcu)) {
165 ListBase anim_data = {
nullptr,
nullptr};
170 short mapping_flag = 0;
191 ac->
scene, ale->
id, fcu, mapping_flag, &offset);
202 for (i = 0; i < fcu->
totvert; i++, prevbezt = bezt1, bezt1++) {
287 nvi_first_selected = nvi;
297 if (nvi == nvi_first_selected) {
314 return nvi_to_select;
331 ListBase matches = {
nullptr,
nullptr};
359 ListBase anim_data = {
nullptr,
nullptr};
380 &ked,
static_cast<FCurve *
>(ale->key_data),
nullptr, test_cb,
nullptr))
397 &ked,
static_cast<FCurve *
>(ale->key_data),
nullptr, sel_cb,
nullptr);
408 fcu->
flag &= ~FCURVE_SELECTED;
416 fcu->
flag &= ~FCURVE_ACTIVE;
472 ale_active =
nullptr;
537 ListBase anim_data = {
nullptr,
nullptr};
556 r_ked->
data = data_lasso;
562 r_ked->
data = data_circle;
566 r_ked->
data = scaled_rectf;
596 const rctf *rectf_view,
609 incl_handles, mode, ac, data, &scaled_rectf, &ked, &mapping_flag);
616 bool any_key_selection_changed =
false;
624 ac->
scene, ale->
id, fcu, mapping_flag, &offset);
631 adt,
static_cast<FCurve *
>(ale->key_data),
false, incl_handles == 0);
636 scaled_rectf.
ymin = rectf.
ymin / unit_scale - offset;
637 scaled_rectf.
ymax = rectf.
ymax / unit_scale - offset;
656 any_key_selection_changed =
true;
670 adt,
static_cast<FCurve *
>(ale->key_data),
true, incl_handles == 0);
677 return any_key_selection_changed;
695 const float unit_scale,
698 const float fcurve_y = (
evaluate_fcurve(fcu, eval_x) + offset) * unit_scale;
707 const float unit_scale,
719 const float eval_step = (mapped_max - mapped_min) / num_steps;
731 prev.eval_x = mapped_min;
733 if (prev.zone ==
INSIDE) {
737 while (num_steps--) {
738 cur.eval_x = prev.eval_x + eval_step;
740 if (cur.zone != prev.zone) {
760 const rctf *rectf_view,
763 const bool incl_handles,
772 incl_handles, mode, ac, data, &scaled_rectf, &ked, &mapping_flag);
774 FCurve *last_selected_curve =
nullptr;
786 ac->
scene, ale->
id, fcu, mapping_flag, &offset);
797 scaled_rectf.
ymin = rectf.
ymin / unit_scale - offset;
798 scaled_rectf.
ymax = rectf.
ymax / unit_scale - offset;
804 last_selected_curve = fcu;
807 fcu->
flag &= ~FCURVE_SELECTED;
814 if (last_selected_curve !=
nullptr) {
839 bool mouse_is_over_element = under_mouse !=
nullptr;
844 if (mouse_is_over_element) {
900 &ac, &rect_fl, mode, selectmode, incl_handles,
nullptr);
902 if (use_curve_selection && !any_key_selection_changed) {
916 ot->
description =
"Select all keyframes within the specified region";
938 "Are handles tested individually against the selection criteria");
942 ot->
srna,
"tweak",
false,
"Tweak",
"Operator has been activated using a click-drag event");
947 "use_curve_selection",
950 "Allow selecting all the keyframes of a curve by selecting the calculated F-curve");
974 data_lasso.rectf_view = &rect_fl;
976 if (data_lasso.mcoords.is_empty()) {
1004 if (use_curve_selection && !any_key_selection_changed) {
1018 ot->
name =
"Lasso Select";
1019 ot->
description =
"Select keyframe points using lasso selection";
1020 ot->
idname =
"GRAPH_OT_select_lasso";
1037 "use_curve_selection",
1040 "Allow selecting all the keyframes of a curve by selecting the curve itself");
1049 bool incl_handles =
false;
1073 data.radius_squared = radius * radius;
1074 data.rectf_view = &rect_fl;
1076 rect_fl.
xmin = x - radius;
1077 rect_fl.
xmax = x + radius;
1078 rect_fl.
ymin = y - radius;
1079 rect_fl.
ymax = y + radius;
1094 if (any_key_selection_changed) {
1101 if (use_curve_selection && !any_key_selection_changed) {
1113 ot->
name =
"Circle Select";
1114 ot->
description =
"Select keyframe points using circle selection";
1115 ot->
idname =
"GRAPH_OT_select_circle";
1132 "use_curve_selection",
1135 "Allow selecting all the keyframes of a curve by selecting the curve itself");
1159 "Between Min/Max Selected Markers",
1161 {0,
nullptr, 0,
nullptr,
nullptr},
1171 ListBase anim_data = {
nullptr,
nullptr};
1203 &ked,
static_cast<FCurve *
>(ale->key_data), ok_cb, select_cb,
nullptr);
1208 &ked,
static_cast<FCurve *
>(ale->key_data), ok_cb, select_cb,
nullptr);
1219 ListBase anim_data = {
nullptr,
nullptr};
1286 &ked,
static_cast<FCurve *
>(ale->key_data), ok_cb, select_cb,
nullptr);
1327 ot->
idname =
"GRAPH_OT_select_column";
1328 ot->
description =
"Select all keyframes on the specified frame(s)";
1352 ListBase anim_data = {
nullptr,
nullptr};
1391 ot->
name =
"Select Linked";
1392 ot->
idname =
"GRAPH_OT_select_linked";
1393 ot->
description =
"Select keyframes occurring in the same F-Curves as selected ones";
1412 ListBase anim_data = {
nullptr,
nullptr};
1432 if (fcu->
bezt ==
nullptr) {
1475 ot->
name =
"Select More";
1476 ot->
idname =
"GRAPH_OT_select_more";
1477 ot->
description =
"Select keyframes beside already selected ones";
1510 ot->
name =
"Select Less";
1511 ot->
idname =
"GRAPH_OT_select_less";
1512 ot->
description =
"Deselect keyframes on ends of selection islands";
1535 {0,
nullptr, 0,
nullptr,
nullptr},
1544 ListBase anim_data = {
nullptr,
nullptr};
1567 ked.
f2 =
float(scene->r.cfra + 0.1f);
1570 ked.
f1 =
float(scene->r.cfra - 0.1f);
1586 &ked,
static_cast<FCurve *
>(ale->key_data), ok_cb, select_cb,
nullptr);
1591 &ked,
static_cast<FCurve *
>(ale->key_data), ok_cb, select_cb,
nullptr);
1649 View2D *v2d = ®ion->v2d;
1671 ot->
name =
"Select Left/Right";
1672 ot->
idname =
"GRAPH_OT_select_leftright";
1673 ot->
description =
"Select keyframes to the left or the right of the current frame";
1710 const bool deselect_all,
1711 const bool curves_only,
1712 bool wait_to_deselect_others)
1717 bool run_modal =
false;
1725 wait_to_deselect_others =
false;
1731 const bool already_selected =
1736 if (wait_to_deselect_others && nvi && already_selected) {
1742 else if ((nvi !=
nullptr && select_mode ==
SELECT_REPLACE) || (nvi ==
nullptr && deselect_all)) {
1756 if (nvi ==
nullptr) {
1762 bool something_was_selected =
false;
1770 something_was_selected = (bezt->
f2 &
SELECT);
1775 something_was_selected = (bezt->
f1 &
SELECT);
1780 something_was_selected = (bezt->
f3 &
SELECT);
1793 something_was_selected =
true;
1797 const bool may_activate = !already_selected ||
1805 else if (nvi->
fpt) {
1834 nvi->
fcu->
flag &= ~FCURVE_SELECTED;
1885 bool wait_to_deselect_others)
1887 ListBase anim_data = {
nullptr,
nullptr};
1889 bool run_modal =
false;
1899 if (nvi ==
nullptr) {
1905 const float selx = nvi->
frame;
1910 else if (wait_to_deselect_others && (nvi->
bezt->
f2 &
SELECT)) {
1953 &ked,
static_cast<FCurve *
>(ale->key_data), ok_cb, select_cb,
nullptr);
1984 const bool wait_to_deselect_others =
RNA_boolean_get(op->
ptr,
"wait_to_deselect_others");
2009 wait_to_deselect_others);
2026 ot->
name =
"Select Keyframes";
2027 ot->
idname =
"GRAPH_OT_clickselect";
2047 "Toggle keyframe selection instead of leaving newly selected "
2054 "Deselect On Nothing",
2055 "Deselect all when nothing under the cursor");
2063 "Select all keyframes that occur on the same frame as the one under "
2069 ot->
srna,
"curves",
false,
"Only Curves",
"Select all the keyframes in the curve");
2084 {0,
nullptr, 0,
nullptr,
nullptr},
2103 ListBase anim_data = {
nullptr,
nullptr};
2114 if (fcu->
bezt ==
nullptr) {
2118 for (
int i = 0; i < fcu->
totvert; i++) {
2125 switch (left_handle_action) {
2137 switch (key_action) {
2149 switch (right_handle_action) {
2193 ot->
name =
"Select Key / Handles";
2194 ot->
idname =
"GRAPH_OT_select_key_handles";
2196 "For selected keyframes, select/deselect any combination of the key itself and its handles";
2206 "left_handle_action",
2210 "Effect on the left handle");
2212 "right_handle_action",
2216 "Effect on the right handle");
2222 "Effect on the key itself");
int BKE_fcurve_active_keyframe_index(const FCurve *fcu)
void BKE_fcurve_active_keyframe_set(FCurve *fcu, const BezTriple *active_bezt)
float evaluate_fcurve(const FCurve *fcu, float evaltime)
float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, short mode)
void BLI_lasso_boundbox(rcti *rect, blender::Span< blender::int2 > mcoords)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
void void BLI_listbase_rotate_last(struct ListBase *lb, void *vlink) ATTR_NONNULL(1
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)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void * BLI_pophead(ListBase *listbase) ATTR_NONNULL(1)
MINLINE float len_v2v2_int(const int v1[2], const int v2[2])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src)
#define FCURVE_ACTIVE_KEYFRAME_NONE
#define BEZT_DESEL_IDX(bezt, i)
#define BEZT_ISSEL_IDX(bezt, i)
#define BEZT_ISSEL_ANY(bezt)
#define BEZT_SEL_IDX(bezt, i)
@ SIPO_RUNTIME_FLAG_TWEAK_HANDLES_RIGHT
@ SIPO_RUNTIME_FLAG_TWEAK_HANDLES_LEFT
@ USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS
@ ANIMFILTER_DATA_VISIBLE
@ ANIMFILTER_CURVE_VISIBLE
@ KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE
@ KEYFRAME_ITER_INCL_HANDLES
short(*)(KeyframeEditData *ked, BezTriple *bezt) KeyframeEditFunc
eSelectOp ED_select_op_modal(eSelectOp sel_op, bool is_first)
#define SEL_OP_USE_PRE_DESELECT(sel_op)
std::string ED_select_circle_get_name(wmOperatorType *ot, PointerRNA *ptr)
Read Guarded memory(de)allocation.
bool UI_view2d_view_to_region_clip(const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL()
float UI_view2d_region_to_view_x(const View2D *v2d, float x)
void UI_view2d_region_to_view_rctf(const View2D *v2d, const rctf *rect_src, rctf *rect_dst) ATTR_NONNULL()
@ OPTYPE_DEPENDS_ON_CURSOR
void ANIM_anim_channels_select_set(bAnimContext *ac, eAnimChannels_SetFlag sel)
void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datatype, eAnimFilter_Flags filter, void *channel_data, eAnim_ChannelType channel_type)
void ANIM_animdata_freelist(ListBase *anim_data)
short ANIM_get_normalization_flags(SpaceLink *space_link)
AnimData * ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale)
void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, bool restore, bool only_keys)
float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short flag, float *r_offset)
bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, const eAnimFilter_Flags filter_mode, void *data, const eAnimCont_Types datatype)
void ED_markers_get_minmax(ListBase *markers, short sel, float *r_first, float *r_last)
void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, const bool only_selected)
draw_view in_light_buf[] float
@ GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN
@ GRAPHKEYS_COLUMNSEL_KEYS
@ GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN
@ GRAPHKEYS_COLUMNSEL_CFRA
bool graphop_visible_keyframes_poll(bContext *C)
bAnimListElem * get_active_fcurve_channel(bAnimContext *ac)
eGraphKey_SelectKeyHandles_Action
@ GRAPHKEYS_KEYHANDLESSEL_KEEP
@ GRAPHKEYS_KEYHANDLESSEL_SELECT
@ GRAPHKEYS_KEYHANDLESSEL_DESELECT
static void initialize_box_select_key_editing_data(const bool incl_handles, const short mode, bAnimContext *ac, void *data, rctf *scaled_rectf, KeyframeEditData *r_ked, int *r_mapping_flag)
void GRAPH_OT_select_box(wmOperatorType *ot)
static int graphkeys_box_select_exec(bContext *C, wmOperator *op)
void GRAPH_OT_select_column(wmOperatorType *ot)
static void nearest_fcurve_vert_store(ListBase *matches, View2D *v2d, FCurve *fcu, eAnim_ChannelType ctype, BezTriple *bezt, FPoint *fpt, short hpoint, const int mval[2], float unit_scale, float offset)
static int graphkeys_select_linked_exec(bContext *C, wmOperator *)
static tNearestVertInfo * get_best_nearest_fcurve_vert(ListBase *matches)
static void graphkeys_select_key_handles(bAnimContext *ac, const enum eGraphKey_SelectKeyHandles_Action left_handle_action, const enum eGraphKey_SelectKeyHandles_Action key_action, const enum eGraphKey_SelectKeyHandles_Action right_handle_action)
static rctf initialize_box_select_coords(const bAnimContext *ac, const rctf *rectf_view)
static const EnumPropertyItem prop_graphkeys_select_key_handles_actions[]
static int graphkeys_clickselect_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem prop_graphkeys_leftright_select_types[]
static short ok_bezier_always_ok(KeyframeEditData *, BezTriple *)
void GRAPH_OT_select_lasso(wmOperatorType *ot)
static int graphkeys_select_leftright_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int graphkeys_select_less_exec(bContext *C, wmOperator *)
static bool rectf_curve_intersection(const float offset, const float unit_scale, const rctf *rectf, AnimData *adt, const FCurve *fcu)
static void box_select_graphcurves(bAnimContext *ac, const rctf *rectf_view, const short mode, const eEditKeyframes_Select selectmode, const bool incl_handles, void *data)
static bool box_select_graphkeys(bAnimContext *ac, const rctf *rectf_view, short mode, eEditKeyframes_Select selectmode, bool incl_handles, void *data)
static int graphkeys_select_leftright_exec(bContext *C, wmOperator *op)
static int graphkeys_lassoselect_exec(bContext *C, wmOperator *op)
void GRAPH_OT_select_circle(wmOperatorType *ot)
void GRAPH_OT_clickselect(wmOperatorType *ot)
static int graphkeys_mselect_column(bAnimContext *ac, const int mval[2], eEditKeyframes_Select select_mode, bool wait_to_deselect_others)
void GRAPH_OT_select_more(wmOperatorType *ot)
static void graphkeys_select_leftright(bAnimContext *ac, short leftright, eEditKeyframes_Select select_mode)
static int graphkeys_deselectall_exec(bContext *C, wmOperator *op)
static int mouse_graph_keys(bAnimContext *ac, const int mval[2], eEditKeyframes_Select select_mode, const bool deselect_all, const bool curves_only, bool wait_to_deselect_others)
static int graphkeys_select_more_exec(bContext *C, wmOperator *)
void GRAPH_OT_select_linked(wmOperatorType *ot)
static tNearestVertInfo * find_nearest_fcurve_vert(bAnimContext *ac, const int mval[2])
static int rectf_curve_zone_y(const FCurve *fcu, const rctf *rectf, const float offset, const float unit_scale, const float eval_x)
static void markers_selectkeys_between(bAnimContext *ac)
void deselect_graph_keys(bAnimContext *ac, bool test, eEditKeyframes_Select sel, bool do_channels)
void GRAPH_OT_select_key_handles(wmOperatorType *ot)
static int graphkeys_select_key_handles_exec(bContext *C, wmOperator *op)
static int graph_circle_select_exec(bContext *C, wmOperator *op)
static int initialize_animdata_selection_filter()
void GRAPH_OT_select_leftright(wmOperatorType *ot)
static int graphkeys_box_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static ListBase initialize_box_select_anim_data(const int filter, bAnimContext *ac)
static bool fcurve_handle_sel_check(SpaceGraph *sipo, BezTriple *bezt)
static void select_moreless_graph_keys(bAnimContext *ac, short mode)
void GRAPH_OT_select_all(wmOperatorType *ot)
static const EnumPropertyItem prop_column_select_types[]
static void columnselect_graph_keys(bAnimContext *ac, short mode)
static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], ListBase *matches)
static int graphkeys_columnselect_exec(bContext *C, wmOperator *op)
void GRAPH_OT_select_less(wmOperatorType *ot)
DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
short bezt_selmap_flush(KeyframeEditData *ked, BezTriple *bezt)
short bezt_to_cfraelem(KeyframeEditData *ked, BezTriple *bezt)
KeyframeEditFunc ANIM_editkeyframes_buildselmap(short mode)
short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb)
KeyframeEditFunc ANIM_editkeyframes_ok(short mode)
KeyframeEditFunc ANIM_editkeyframes_select(const eEditKeyframes_Select selectmode)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
int RNA_int_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
eKeyframeIterFlags iterflags
SpaceGraph_Runtime runtime
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* modal)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
std::string(* get_name)(wmOperatorType *ot, PointerRNA *ptr)
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(* cancel)(bContext *C, wmOperator *op)
void WM_event_drag_start_mval(const wmEvent *event, const ARegion *region, int r_mval[2])
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
bool WM_gesture_is_modal_first(const wmGesture *gesture)
void WM_gesture_box_cancel(bContext *C, wmOperator *op)
int WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
int WM_gesture_circle_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Array< int2 > WM_gesture_lasso_path_to_array(bContext *, wmOperator *op)
void WM_gesture_circle_cancel(bContext *C, wmOperator *op)
int WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
void WM_gesture_lasso_cancel(bContext *C, wmOperator *op)
int WM_gesture_lasso_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void WM_operator_properties_border_to_rcti(wmOperator *op, rcti *r_rect)
void WM_operator_properties_gesture_box(wmOperatorType *ot)
void WM_operator_properties_select_operation_simple(wmOperatorType *ot)
void WM_operator_properties_generic_select(wmOperatorType *ot)
void WM_operator_properties_gesture_lasso(wmOperatorType *ot)
void WM_operator_properties_gesture_circle(wmOperatorType *ot)
void WM_operator_properties_select_all(wmOperatorType *ot)
int WM_generic_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
int WM_generic_select_modal(bContext *C, wmOperator *op, const wmEvent *event)