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)) {
164 ListBaseT<tNearestVertInfo> *matches)
166 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
171 short mapping_flag = 0;
194 &ale,
static_cast<FCurve *
>(ale.key_data),
false,
false);
200 for (i = 0; i < fcu->
totvert; i++, prevbezt = bezt1, bezt1++) {
253 &ale,
static_cast<FCurve *
>(ale.key_data),
true,
false);
264 if (matches->is_empty()) {
269 if (matches->is_single()) {
284 nvi_first_selected = &nvi;
294 if (&nvi == nvi_first_selected) {
299 nvi_to_select = &nvi;
304 nvi_to_select = &nvi;
311 return nvi_to_select;
328 ListBaseT<tNearestVertInfo> matches = {
nullptr,
nullptr};
337 matches.free_no_destruct();
356 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
377 &ked,
static_cast<FCurve *
>(ale.key_data),
nullptr, test_cb,
nullptr))
394 &ked,
static_cast<FCurve *
>(ale.key_data),
nullptr, sel_cb,
nullptr);
468 MEM_delete(ale_active);
469 ale_active =
nullptr;
481 ot->
name =
"Select All";
482 ot->
idname =
"GRAPH_OT_select_all";
483 ot->
description =
"Toggle selection of all keyframes";
534 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
553 r_ked->
data = data_lasso;
559 r_ked->
data = data_circle;
563 r_ked->
data = scaled_rectf;
599 const rctf *rectf_view,
612 incl_handles, mode, ac,
data, &scaled_rectf, &ked, &mapping_flag);
619 bool any_key_selection_changed =
false;
626 ac->
scene, ale.
id, fcu, mapping_flag, &offset);
636 scaled_rectf.
ymin = rectf.
ymin / unit_scale - offset;
637 scaled_rectf.
ymax = rectf.
ymax / unit_scale - offset;
656 any_key_selection_changed =
true;
675 return any_key_selection_changed;
693 const float unit_scale,
705 const float unit_scale,
717 const float eval_step = (mapped_max - mapped_min) / num_steps;
729 prev.eval_x = mapped_min;
731 if (prev.zone ==
INSIDE) {
735 while (num_steps--) {
736 cur.eval_x = prev.eval_x + eval_step;
738 if (cur.zone != prev.zone) {
758 const rctf *rectf_view,
761 const bool incl_handles,
770 incl_handles, mode, ac,
data, &scaled_rectf, &ked, &mapping_flag);
772 FCurve *last_selected_curve =
nullptr;
783 ac->
scene, ale.
id, fcu, mapping_flag, &offset);
794 scaled_rectf.
ymin = rectf.
ymin / unit_scale - offset;
795 scaled_rectf.
ymax = rectf.
ymax / unit_scale - offset;
801 last_selected_curve = fcu;
811 if (last_selected_curve !=
nullptr) {
838 bool mouse_is_over_element = under_mouse !=
nullptr;
840 MEM_delete(under_mouse);
843 if (mouse_is_over_element) {
899 &ac, &rect_fl, mode, selectmode, incl_handles,
nullptr);
901 if (use_curve_selection && !any_key_selection_changed) {
913 ot->
name =
"Box Select";
914 ot->
idname =
"GRAPH_OT_select_box";
915 ot->
description =
"Select all keyframes within the specified region";
938 "Are handles tested individually against the selection criteria, independently from their "
939 "keys. When unchecked, handles are (de)selected in unison with their keys");
943 ot->
srna,
"tweak",
false,
"Tweak",
"Operator has been activated using a click-drag event");
948 "use_curve_selection",
951 "Allow selecting all the keyframes of a curve by selecting the calculated F-curve");
975 if (data_lasso.
mcoords.is_empty()) {
996 if (use_curve_selection && !any_key_selection_changed) {
1010 ot->
name =
"Lasso Select";
1011 ot->
description =
"Select keyframe points using lasso selection";
1012 ot->
idname =
"GRAPH_OT_select_lasso";
1034 "Are handles tested individually against the selection criteria, independently from their "
1035 "keys. When unchecked, handles are (de)selected in unison with their keys");
1040 "use_curve_selection",
1043 "Allow selecting all the keyframes of a curve by selecting the curve itself");
1075 data.radius_squared = radius * radius;
1076 data.rectf_view = &rect_fl;
1078 rect_fl.
xmin =
x - radius;
1079 rect_fl.
xmax =
x + radius;
1080 rect_fl.
ymin =
y - radius;
1081 rect_fl.
ymax =
y + radius;
1089 if (any_key_selection_changed) {
1096 if (use_curve_selection && !any_key_selection_changed) {
1108 ot->
name =
"Circle Select";
1109 ot->
description =
"Select keyframe points using circle selection";
1110 ot->
idname =
"GRAPH_OT_select_circle";
1132 "Are handles tested individually against the selection criteria, independently from their "
1133 "keys. When unchecked, handles are (de)selected in unison with their keys");
1138 "use_curve_selection",
1141 "Allow selecting all the keyframes of a curve by selecting the curve itself");
1165 "Between Min/Max Selected Markers",
1167 {0,
nullptr, 0,
nullptr,
nullptr},
1177 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
1205 &ale,
static_cast<FCurve *
>(ale.key_data),
false,
true);
1207 &ked,
static_cast<FCurve *
>(ale.key_data), ok_cb, select_cb,
nullptr);
1218 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
1284 &ked,
static_cast<FCurve *
>(ale.key_data), ok_cb, select_cb,
nullptr);
1325 ot->
name =
"Select All";
1326 ot->
idname =
"GRAPH_OT_select_column";
1327 ot->
description =
"Select all keyframes on the specified frame(s)";
1351 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
1390 ot->
name =
"Select Linked";
1391 ot->
idname =
"GRAPH_OT_select_linked";
1392 ot->
description =
"Select keyframes occurring in the same F-Curves as selected ones";
1411 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
1431 if (fcu->
bezt ==
nullptr) {
1474 ot->
name =
"Select More";
1475 ot->
idname =
"GRAPH_OT_select_more";
1476 ot->
description =
"Select keyframes beside already selected ones";
1509 ot->
name =
"Select Less";
1510 ot->
idname =
"GRAPH_OT_select_less";
1511 ot->
description =
"Deselect keyframes on ends of selection islands";
1534 {0,
nullptr, 0,
nullptr,
nullptr},
1543 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
1581 &ale,
static_cast<FCurve *
>(ale.key_data),
false,
true);
1583 &ked,
static_cast<FCurve *
>(ale.key_data), ok_cb, select_cb,
nullptr);
1665 ot->
name =
"Select Left/Right";
1666 ot->
idname =
"GRAPH_OT_select_leftright";
1667 ot->
description =
"Select keyframes to the left or the right of the current frame";
1704 const bool deselect_all,
1705 const bool curves_only,
1706 bool wait_to_deselect_others)
1711 bool run_modal =
false;
1719 wait_to_deselect_others =
false;
1725 const bool already_selected =
1730 if (wait_to_deselect_others && nvi && already_selected) {
1736 else if ((nvi !=
nullptr && select_mode ==
SELECT_REPLACE) || (nvi ==
nullptr && deselect_all)) {
1750 if (nvi ==
nullptr) {
1756 bool something_was_selected =
false;
1764 something_was_selected = (bezt->
f2 &
SELECT);
1769 something_was_selected = (bezt->
f1 &
SELECT);
1774 something_was_selected = (bezt->
f3 &
SELECT);
1787 something_was_selected =
true;
1791 const bool may_activate = !already_selected ||
1799 else if (nvi->
fpt) {
1880 bool wait_to_deselect_others)
1882 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
1884 bool run_modal =
false;
1894 if (nvi ==
nullptr) {
1900 const float selx = nvi->
frame;
1905 else if (wait_to_deselect_others && (nvi->
bezt->
f2 &
SELECT)) {
1941 &ked,
static_cast<FCurve *
>(ale.key_data), ok_cb, select_cb,
nullptr);
1973 const bool wait_to_deselect_others =
RNA_boolean_get(op->
ptr,
"wait_to_deselect_others");
1998 wait_to_deselect_others);
2015 ot->
name =
"Select Keyframes";
2016 ot->
idname =
"GRAPH_OT_clickselect";
2017 ot->
description =
"Select keyframes by clicking on them";
2036 "Toggle keyframe selection instead of leaving newly selected "
2043 "Deselect On Nothing",
2044 "Deselect all when nothing under the cursor");
2052 "Select all keyframes that occur on the same frame as the one under "
2058 ot->
srna,
"curves",
false,
"Only Curves",
"Select all the keyframes in the curve");
2073 {0,
nullptr, 0,
nullptr,
nullptr},
2092 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
2102 if (fcu->
bezt ==
nullptr) {
2106 for (
int i = 0; i < fcu->
totvert; i++) {
2113 switch (left_handle_action) {
2125 switch (key_action) {
2137 switch (right_handle_action) {
2181 ot->
name =
"Select Key / Handles";
2182 ot->
idname =
"GRAPH_OT_select_key_handles";
2184 "For selected keyframes, select/deselect any combination of the key itself and its handles";
2194 "left_handle_action",
2198 "Effect on the left handle");
2200 "right_handle_action",
2204 "Effect on the right handle");
2210 "Effect on the key itself");
#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)
#define SEL_OP_USE_PRE_DESELECT(sel_op)
Read Blender memory allocation and freeing.
bool view2d_view_to_region_clip(const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL()
float view2d_region_to_view_x(const View2D *v2d, float x)
void view2d_region_to_view_rctf(const View2D *v2d, const rctf *rect_src, rctf *rect_dst) ATTR_NONNULL()
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
std::string ED_select_circle_get_name(wmOperatorType *ot, PointerRNA *ptr)
KeyframeEditFunc ANIM_editkeyframes_ok(short mode)
static tNearestVertInfo * find_nearest_fcurve_vert(bAnimContext *ac, const int mval[2])
void WM_operator_properties_gesture_circle(wmOperatorType *ot)
int RNA_enum_get(PointerRNA *ptr, const char *name)
void GRAPH_OT_select_column(wmOperatorType *ot)
void GRAPH_OT_select_linked(wmOperatorType *ot)
void GRAPH_OT_select_all(wmOperatorType *ot)
void ED_markers_make_cfra_list(ListBaseT< TimeMarker > *markers, ListBaseT< CfraElem > *lb, const bool only_selected)
@ GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN
@ GRAPHKEYS_COLUMNSEL_CFRA
@ GRAPHKEYS_COLUMNSEL_KEYS
@ GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN
wmOperatorStatus WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
short bezt_to_cfraelem(KeyframeEditData *ked, BezTriple *bezt)
static void markers_selectkeys_between(bAnimContext *ac)
static wmOperatorStatus graphkeys_columnselect_exec(bContext *C, wmOperator *op)
eSelectOp ED_select_op_modal(eSelectOp sel_op, bool is_first)
bool graphop_visible_keyframes_poll(bContext *C)
void ANIM_anim_channels_select_set(bAnimContext *ac, eAnimChannels_SetFlag sel)
static void select_moreless_graph_keys(bAnimContext *ac, short mode)
void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datatype, eAnimFilter_Flags filter, void *channel_data, eAnim_ChannelType channel_type)
static wmOperatorStatus graphkeys_select_more_exec(bContext *C, wmOperator *)
void WM_gesture_lasso_cancel(bContext *C, wmOperator *op)
MINLINE float len_v2v2_int(const int v1[2], const int v2[2])
static bool fcurve_handle_sel_check(SpaceGraph *sipo, BezTriple *bezt)
bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
float ANIM_nla_tweakedit_remap(bAnimListElem *ale, const float cframe, const eNlaTime_ConvertModes mode)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
int RNA_int_get(PointerRNA *ptr, const char *name)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
static wmOperatorStatus graphkeys_box_select_exec(bContext *C, wmOperator *op)
static int initialize_animdata_selection_filter()
void GRAPH_OT_select_circle(wmOperatorType *ot)
wmOperatorStatus WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
@ USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS
wmOperatorStatus WM_generic_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], ListBaseT< tNearestVertInfo > *matches)
void WM_gesture_circle_cancel(bContext *C, wmOperator *op)
static wmOperatorStatus graphkeys_select_leftright_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void void BLI_listbase_rotate_last(ListBase *lb, void *vlink) ATTR_NONNULL(1
short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb)
void MEM_delete_void(void *vmemh)
void GRAPH_OT_select_less(wmOperatorType *ot)
static short ok_bezier_always_ok(KeyframeEditData *, BezTriple *)
void ANIM_nla_mapping_apply_if_needed_fcurve(bAnimListElem *ale, FCurve *fcu, const bool restore, const bool only_keys)
void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src)
void GRAPH_OT_select_leftright(wmOperatorType *ot)
void WM_operator_properties_select_all(wmOperatorType *ot)
void * BLI_pophead(ListBase *listbase) ATTR_NONNULL(1)
static wmOperatorStatus graphkeys_select_less_exec(bContext *C, wmOperator *)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
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 wmOperatorStatus graphkeys_select_key_handles_exec(bContext *C, wmOperator *op)
size_t ANIM_animdata_filter(bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, const eAnimFilter_Flags filter_mode, void *data, const eAnimCont_Types datatype)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
@ ANIMFILTER_DATA_VISIBLE
@ ANIMFILTER_CURVE_VISIBLE
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
BMesh const char void * data
void GRAPH_OT_select_key_handles(wmOperatorType *ot)
void WM_operator_properties_border_to_rcti(wmOperator *op, rcti *r_rect)
wmOperatorStatus WM_gesture_circle_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus graphkeys_deselectall_exec(bContext *C, wmOperator *op)
static int rectf_curve_zone_y(const FCurve *fcu, const rctf *rectf, const float offset, const float unit_scale, const float eval_x)
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)
KeyframeEditFunc ANIM_editkeyframes_select(const eEditKeyframes_Select selectmode)
void GRAPH_OT_clickselect(wmOperatorType *ot)
static wmOperatorStatus graphkeys_select_leftright_exec(bContext *C, wmOperator *op)
void WM_operator_properties_gesture_box(wmOperatorType *ot)
static wmOperatorStatus graphkeys_box_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
bAnimListElem * get_active_fcurve_channel(bAnimContext *ac)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
static void columnselect_graph_keys(bAnimContext *ac, short mode)
static wmOperatorStatus graphkeys_mselect_column(bAnimContext *ac, const int mval[2], eEditKeyframes_Select select_mode, bool wait_to_deselect_others)
wmOperatorStatus WM_generic_select_modal(bContext *C, wmOperator *op, const wmEvent *event)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_event_drag_start_mval(const wmEvent *event, const ARegion *region, int r_mval[2])
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
static bool box_select_graphkeys(bAnimContext *ac, const rctf *rectf_view, short mode, eEditKeyframes_Select selectmode, bool incl_handles, void *data)
KeyframeEditFunc ANIM_editkeyframes_buildselmap(short mode)
short(*)(KeyframeEditData *ked, BezTriple *bezt) KeyframeEditFunc
wmOperatorStatus WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void GRAPH_OT_select_box(wmOperatorType *ot)
float evaluate_fcurve_only_curve(const FCurve *fcu, float evaltime)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
static tNearestVertInfo * get_best_nearest_fcurve_vert(ListBaseT< tNearestVertInfo > *matches)
@ SIPO_RUNTIME_FLAG_TWEAK_HANDLES_RIGHT
@ SIPO_RUNTIME_FLAG_TWEAK_HANDLES_LEFT
void BKE_fcurve_active_keyframe_set(FCurve *fcu, const BezTriple *active_bezt)
int BKE_fcurve_active_keyframe_index(const FCurve *fcu)
wmOperatorStatus WM_gesture_lasso_invoke(bContext *C, wmOperator *op, const wmEvent *event)
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 deselect_graph_keys(bAnimContext *ac, bool test, eEditKeyframes_Select sel, bool do_channels)
static wmOperatorStatus graph_circle_select_exec(bContext *C, wmOperator *op)
void ANIM_animdata_freelist(ListBaseT< bAnimListElem > *anim_data)
float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short flag, float *r_offset)
Array< int2 > WM_gesture_lasso_path_to_array(bContext *, wmOperator *op)
static const EnumPropertyItem prop_graphkeys_select_key_handles_actions[]
void WM_gesture_box_cancel(bContext *C, wmOperator *op)
static wmOperatorStatus graphkeys_clickselect_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem prop_graphkeys_leftright_select_types[]
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)
void WM_operator_properties_select_operation_simple(wmOperatorType *ot)
short bezt_selmap_flush(KeyframeEditData *ked, BezTriple *bezt)
static void graphkeys_select_leftright(bAnimContext *ac, short leftright, eEditKeyframes_Select select_mode)
@ OPTYPE_DEPENDS_ON_CURSOR
static rctf initialize_box_select_coords(const bAnimContext *ac, const rctf *rectf_view)
static wmOperatorStatus graphkeys_select_linked_exec(bContext *C, wmOperator *)
bool WM_gesture_is_modal_first(const wmGesture *gesture)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
static bool rectf_curve_intersection(const float offset, const float unit_scale, const rctf *rectf, bAnimListElem *ale, const FCurve *fcu)
void GRAPH_OT_select_lasso(wmOperatorType *ot)
static wmOperatorStatus graphkeys_lassoselect_exec(bContext *C, wmOperator *op)
wmOperatorStatus WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
void ED_markers_get_minmax(ListBaseT< TimeMarker > *markers, short sel, float *r_first, float *r_last)
static void nearest_fcurve_vert_store(ListBaseT< tNearestVertInfo > *matches, View2D *v2d, FCurve *fcu, eAnim_ChannelType ctype, BezTriple *bezt, FPoint *fpt, short hpoint, const int mval[2], float unit_scale, float offset)
void GRAPH_OT_select_more(wmOperatorType *ot)
void WM_operator_properties_generic_select(wmOperatorType *ot)
@ KEYFRAME_ITER_HANDLES_INVISIBLE
@ KEYFRAME_ITER_INCL_HANDLES
@ KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE
void BLI_lasso_boundbox(rcti *rect, Span< int2 > mcoords)
static const EnumPropertyItem prop_column_select_types[]
eGraphKey_SelectKeyHandles_Action
@ GRAPHKEYS_KEYHANDLESSEL_SELECT
@ GRAPHKEYS_KEYHANDLESSEL_KEEP
@ GRAPHKEYS_KEYHANDLESSEL_DESELECT
short ANIM_get_normalization_flags(SpaceLink *space_link)
void WM_operator_properties_gesture_lasso(wmOperatorType *ot)
static ListBaseT< bAnimListElem > initialize_box_select_anim_data(const int filter, bAnimContext *ac)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
eBezTriple_Interpolation ipo
ListBaseT< TimeMarker > time_marker_list
ListBaseT< CfraElem > cfra_elem_list
eKeyframeIterFlags iterflags
SpaceGraph_Runtime runtime
ListBaseT< TimeMarker > * markers
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(*) cancel(bContext *C, wmOperator *op)
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
std::string(*) get_name(wmOperatorType *ot, PointerRNA *ptr)