74#define GVERTSEL_TOL (10 * U.pixelsize)
106 int screen_co[2], dist;
112 bezt->
vec[hpoint + 1][0],
113 (bezt->
vec[hpoint + 1][1] + offset) * unit_scale,
120 bool replace =
false;
124 if ((nvi) && (nvi->
fcu == fcu)) {
162 ListBase anim_data = {
nullptr,
nullptr};
167 short mapping_flag = 0;
187 ac->
scene, ale->
id, fcu, mapping_flag, &offset);
191 ale,
static_cast<FCurve *
>(ale->key_data),
false,
false);
197 for (
i = 0;
i < fcu->
totvert;
i++, prevbezt = bezt1, bezt1++) {
250 ale,
static_cast<FCurve *
>(ale->key_data),
true,
false);
281 nvi_first_selected = nvi;
291 if (nvi == nvi_first_selected) {
308 return nvi_to_select;
325 ListBase matches = {
nullptr,
nullptr};
353 ListBase anim_data = {
nullptr,
nullptr};
374 &ked,
static_cast<FCurve *
>(ale->key_data),
nullptr, test_cb,
nullptr))
391 &ked,
static_cast<FCurve *
>(ale->key_data),
nullptr, sel_cb,
nullptr);
466 ale_active =
nullptr;
478 ot->name =
"Select All";
479 ot->idname =
"GRAPH_OT_select_all";
480 ot->description =
"Toggle selection of all keyframes";
531 ListBase anim_data = {
nullptr,
nullptr};
550 r_ked->
data = data_lasso;
556 r_ked->
data = data_circle;
560 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;
623 ac->
scene, ale->
id, fcu, mapping_flag, &offset);
633 scaled_rectf.
ymin = rectf.
ymin / unit_scale - offset;
634 scaled_rectf.
ymax = rectf.
ymax / unit_scale - offset;
653 any_key_selection_changed =
true;
672 return any_key_selection_changed;
690 const float unit_scale,
702 const float unit_scale,
714 const float eval_step = (mapped_max - mapped_min) / num_steps;
726 prev.eval_x = mapped_min;
728 if (prev.zone ==
INSIDE) {
732 while (num_steps--) {
733 cur.eval_x = prev.eval_x + eval_step;
735 if (cur.zone != prev.zone) {
755 const rctf *rectf_view,
758 const bool incl_handles,
767 incl_handles, mode, ac,
data, &scaled_rectf, &ked, &mapping_flag);
769 FCurve *last_selected_curve =
nullptr;
780 ac->
scene, ale->
id, fcu, mapping_flag, &offset);
791 scaled_rectf.
ymin = rectf.
ymin / unit_scale - offset;
792 scaled_rectf.
ymax = rectf.
ymax / unit_scale - offset;
798 last_selected_curve = fcu;
808 if (last_selected_curve !=
nullptr) {
835 bool mouse_is_over_element = under_mouse !=
nullptr;
840 if (mouse_is_over_element) {
896 &ac, &rect_fl, mode, selectmode, incl_handles,
nullptr);
898 if (use_curve_selection && !any_key_selection_changed) {
910 ot->name =
"Box Select";
911 ot->idname =
"GRAPH_OT_select_box";
912 ot->description =
"Select all keyframes within the specified region";
935 "Are handles tested individually against the selection criteria, independently from their "
936 "keys. When unchecked, handles are (de)selected in unison with their keys");
940 ot->srna,
"tweak",
false,
"Tweak",
"Operator has been activated using a click-drag event");
945 "use_curve_selection",
948 "Allow selecting all the keyframes of a curve by selecting the calculated F-curve");
972 if (data_lasso.
mcoords.is_empty()) {
993 if (use_curve_selection && !any_key_selection_changed) {
1007 ot->name =
"Lasso Select";
1008 ot->description =
"Select keyframe points using lasso selection";
1009 ot->idname =
"GRAPH_OT_select_lasso";
1031 "Are handles tested individually against the selection criteria, independently from their "
1032 "keys. When unchecked, handles are (de)selected in unison with their keys");
1037 "use_curve_selection",
1040 "Allow selecting all the keyframes of a curve by selecting the curve itself");
1072 data.radius_squared = radius * radius;
1073 data.rectf_view = &rect_fl;
1075 rect_fl.
xmin =
x - radius;
1076 rect_fl.
xmax =
x + radius;
1077 rect_fl.
ymin =
y - radius;
1078 rect_fl.
ymax =
y + radius;
1086 if (any_key_selection_changed) {
1093 if (use_curve_selection && !any_key_selection_changed) {
1105 ot->name =
"Circle Select";
1106 ot->description =
"Select keyframe points using circle selection";
1107 ot->idname =
"GRAPH_OT_select_circle";
1129 "Are handles tested individually against the selection criteria, independently from their "
1130 "keys. When unchecked, handles are (de)selected in unison with their keys");
1135 "use_curve_selection",
1138 "Allow selecting all the keyframes of a curve by selecting the curve itself");
1162 "Between Min/Max Selected Markers",
1164 {0,
nullptr, 0,
nullptr,
nullptr},
1174 ListBase anim_data = {
nullptr,
nullptr};
1202 ale,
static_cast<FCurve *
>(ale->key_data),
false,
true);
1204 &ked,
static_cast<FCurve *
>(ale->key_data), ok_cb, select_cb,
nullptr);
1215 ListBase anim_data = {
nullptr,
nullptr};
1281 &ked,
static_cast<FCurve *
>(ale->key_data), ok_cb, select_cb,
nullptr);
1321 ot->name =
"Select All";
1322 ot->idname =
"GRAPH_OT_select_column";
1323 ot->description =
"Select all keyframes on the specified frame(s)";
1347 ListBase anim_data = {
nullptr,
nullptr};
1386 ot->name =
"Select Linked";
1387 ot->idname =
"GRAPH_OT_select_linked";
1388 ot->description =
"Select keyframes occurring in the same F-Curves as selected ones";
1407 ListBase anim_data = {
nullptr,
nullptr};
1427 if (fcu->
bezt ==
nullptr) {
1470 ot->name =
"Select More";
1471 ot->idname =
"GRAPH_OT_select_more";
1472 ot->description =
"Select keyframes beside already selected ones";
1505 ot->name =
"Select Less";
1506 ot->idname =
"GRAPH_OT_select_less";
1507 ot->description =
"Deselect keyframes on ends of selection islands";
1530 {0,
nullptr, 0,
nullptr,
nullptr},
1539 ListBase anim_data = {
nullptr,
nullptr};
1577 ale,
static_cast<FCurve *
>(ale->key_data),
false,
true);
1579 &ked,
static_cast<FCurve *
>(ale->key_data), ok_cb, select_cb,
nullptr);
1661 ot->name =
"Select Left/Right";
1662 ot->idname =
"GRAPH_OT_select_leftright";
1663 ot->description =
"Select keyframes to the left or the right of the current frame";
1700 const bool deselect_all,
1701 const bool curves_only,
1702 bool wait_to_deselect_others)
1707 bool run_modal =
false;
1715 wait_to_deselect_others =
false;
1721 const bool already_selected =
1726 if (wait_to_deselect_others && nvi && already_selected) {
1732 else if ((nvi !=
nullptr && select_mode ==
SELECT_REPLACE) || (nvi ==
nullptr && deselect_all)) {
1746 if (nvi ==
nullptr) {
1752 bool something_was_selected =
false;
1760 something_was_selected = (bezt->
f2 &
SELECT);
1765 something_was_selected = (bezt->
f1 &
SELECT);
1770 something_was_selected = (bezt->
f3 &
SELECT);
1783 something_was_selected =
true;
1787 const bool may_activate = !already_selected ||
1795 else if (nvi->
fpt) {
1875 bool wait_to_deselect_others)
1877 ListBase anim_data = {
nullptr,
nullptr};
1879 bool run_modal =
false;
1889 if (nvi ==
nullptr) {
1895 const float selx = nvi->
frame;
1900 else if (wait_to_deselect_others && (nvi->
bezt->
f2 &
SELECT)) {
1936 &ked,
static_cast<FCurve *
>(ale->key_data), ok_cb, select_cb,
nullptr);
1967 const bool wait_to_deselect_others =
RNA_boolean_get(op->
ptr,
"wait_to_deselect_others");
1992 wait_to_deselect_others);
2009 ot->name =
"Select Keyframes";
2010 ot->idname =
"GRAPH_OT_clickselect";
2011 ot->description =
"Select keyframes by clicking on them";
2030 "Toggle keyframe selection instead of leaving newly selected "
2037 "Deselect On Nothing",
2038 "Deselect all when nothing under the cursor");
2046 "Select all keyframes that occur on the same frame as the one under "
2052 ot->srna,
"curves",
false,
"Only Curves",
"Select all the keyframes in the curve");
2067 {0,
nullptr, 0,
nullptr,
nullptr},
2086 ListBase anim_data = {
nullptr,
nullptr};
2096 if (fcu->
bezt ==
nullptr) {
2107 switch (left_handle_action) {
2119 switch (key_action) {
2131 switch (right_handle_action) {
2175 ot->name =
"Select Key / Handles";
2176 ot->idname =
"GRAPH_OT_select_key_handles";
2178 "For selected keyframes, select/deselect any combination of the key itself and its handles";
2188 "left_handle_action",
2192 "Effect on the left handle");
2194 "right_handle_action",
2198 "Effect on the right handle");
2204 "Effect on the key itself");
int BKE_fcurve_active_keyframe_index(const FCurve *fcu)
float evaluate_fcurve_only_curve(const FCurve *fcu, float evaltime)
void BKE_fcurve_active_keyframe_set(FCurve *fcu, const BezTriple *active_bezt)
void BLI_lasso_boundbox(rcti *rect, blender::Span< blender::int2 > mcoords)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void void BLI_listbase_rotate_last(ListBase *lb, void *vlink) ATTR_NONNULL(1
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void * BLI_pophead(ListBase *listbase) ATTR_NONNULL(1)
void void BLI_INLINE bool BLI_listbase_is_single(const ListBase *lb)
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
@ KEYFRAME_ITER_HANDLES_INVISIBLE
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
static const EnumPropertyItem prop_column_select_types[]
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)
void ANIM_nla_mapping_apply_if_needed_fcurve(bAnimListElem *ale, FCurve *fcu, const bool restore, const bool only_keys)
float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short flag, float *r_offset)
float ANIM_nla_tweakedit_remap(bAnimListElem *ale, const float cframe, const eNlaTime_ConvertModes mode)
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)
BMesh const char void * data
@ 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 wmOperatorStatus graphkeys_box_select_exec(bContext *C, wmOperator *op)
static wmOperatorStatus graphkeys_deselectall_exec(bContext *C, wmOperator *op)
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)
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 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 const EnumPropertyItem prop_graphkeys_leftright_select_types[]
static short ok_bezier_always_ok(KeyframeEditData *, BezTriple *)
void GRAPH_OT_select_lasso(wmOperatorType *ot)
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 wmOperatorStatus graphkeys_select_linked_exec(bContext *C, wmOperator *)
static wmOperatorStatus graphkeys_box_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus graphkeys_columnselect_exec(bContext *C, wmOperator *op)
void GRAPH_OT_select_circle(wmOperatorType *ot)
void GRAPH_OT_clickselect(wmOperatorType *ot)
void GRAPH_OT_select_more(wmOperatorType *ot)
static void graphkeys_select_leftright(bAnimContext *ac, short leftright, eEditKeyframes_Select select_mode)
static wmOperatorStatus graphkeys_clickselect_exec(bContext *C, wmOperator *op)
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)
static wmOperatorStatus graphkeys_lassoselect_exec(bContext *C, wmOperator *op)
void GRAPH_OT_select_key_handles(wmOperatorType *ot)
static int initialize_animdata_selection_filter()
static wmOperatorStatus graphkeys_select_key_handles_exec(bContext *C, wmOperator *op)
void GRAPH_OT_select_leftright(wmOperatorType *ot)
static wmOperatorStatus 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 ListBase initialize_box_select_anim_data(const int filter, bAnimContext *ac)
static bool fcurve_handle_sel_check(SpaceGraph *sipo, BezTriple *bezt)
static wmOperatorStatus graphkeys_select_less_exec(bContext *C, wmOperator *)
static wmOperatorStatus graph_circle_select_exec(bContext *C, wmOperator *op)
static wmOperatorStatus graphkeys_mselect_column(bAnimContext *ac, const int mval[2], eEditKeyframes_Select select_mode, bool wait_to_deselect_others)
static wmOperatorStatus graphkeys_select_more_exec(bContext *C, wmOperator *)
static void select_moreless_graph_keys(bAnimContext *ac, short mode)
static wmOperatorStatus graphkeys_select_leftright_exec(bContext *C, wmOperator *op)
static bool rectf_curve_intersection(const float offset, const float unit_scale, const rctf *rectf, bAnimListElem *ale, const FCurve *fcu)
void GRAPH_OT_select_all(wmOperatorType *ot)
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 wmOperatorStatus graphkeys_select_leftright_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void GRAPH_OT_select_less(wmOperatorType *ot)
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_callocN(size_t len, const char *str)
void MEM_freeN(void *vmemh)
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
blender::Array< blender::int2 > mcoords
SpaceGraph_Runtime runtime
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)
wmOperatorStatus WM_gesture_circle_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Array< int2 > WM_gesture_lasso_path_to_array(bContext *, wmOperator *op)
wmOperatorStatus WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void WM_gesture_circle_cancel(bContext *C, wmOperator *op)
void WM_gesture_lasso_cancel(bContext *C, wmOperator *op)
wmOperatorStatus WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus 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)
wmOperatorStatus WM_generic_select_modal(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus WM_generic_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)