89 const bool only_selected,
90 const bool include_handles,
94 if (!anim_data.first_) {
97 constexpr float inf = std::numeric_limits<float>::infinity();
101 r_bounds.
ymax = -inf;
121 ac.
scene, ale.
id, fcu, mapping_flag, &offset);
122 fcu_bounds.
ymin += offset;
123 fcu_bounds.
ymax += offset;
124 fcu_bounds.
ymin *= unitFac;
125 fcu_bounds.
ymax *= unitFac;
137 const bool do_sel_only,
138 const bool include_handles)
143 anim_data, *ac, do_sel_only, include_handles, fcurve_bounds);
161 *xmin = fcurve_bounds.
xmin;
162 *xmax = fcurve_bounds.
xmax;
164 *ymin = fcurve_bounds.
ymin;
167 *ymax = fcurve_bounds.
ymax;
175 ListBaseT<bAnimListElem> &anim_data,
180 if (!pad_x && !pad_y) {
191 ac.
scene, ale.
id, fcu, mapping_flag, &offset);
197 const float2 key(bezt->
vec[1][0], (bezt->
vec[1][1] + offset) * unit_factor);
202 (fcu->
bezt[i - 1].
vec[1][1] + offset) * unit_factor);
204 const float pad = (key.x - prev_key.x) / 2.0;
208 const float pad =
fabsf(prev_key.y - key.y) / 2.0;
216 (fcu->
bezt[i + 1].
vec[1][1] + offset) * unit_factor);
218 const float pad = (next_key.x - key.x) / 2.0;
222 const float pad =
fabsf(next_key.y - key.y) / 2.0;
239 const bool only_selected,
240 const bool include_handles)
244 anim_data, *ac, only_selected, include_handles, r_bounds);
288 if (ac.
scene ==
nullptr) {
310 ot->
name =
"Set Preview Range to Selected";
311 ot->
idname =
"GRAPH_OT_previewrange_set";
312 ot->
description =
"Set Preview Range based on range of selected keyframes";
339 const bool do_sel_only,
340 const bool include_handles,
341 const int smooth_viewtx)
404 ot->
name =
"Frame All";
405 ot->
idname =
"GRAPH_OT_view_all";
406 ot->
description =
"Reset viewable area to show full keyframe range";
420 "Include handles of keyframes when calculating extents");
426 ot->
name =
"Frame Selected";
427 ot->
idname =
"GRAPH_OT_view_selected";
428 ot->
description =
"Reset viewable area to show selected keyframe range";
442 "Include handles of keyframes when calculating extents");
461 ot->
name =
"Go to Current Frame";
462 ot->
idname =
"GRAPH_OT_view_frame";
463 ot->
description =
"Move the view to the current frame";
486 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
494 printf(
"Error: Frame range for Ghost F-Curve creation is inappropriate\n");
510 float unitFac, offset;
524 gcu->
totvert = end - start + 1;
527 for (cfra = start; cfra <= end; cfra++, fpt++) {
583 ot->
name =
"Create Ghost Curves";
584 ot->
idname =
"GRAPH_OT_ghost_curves_create";
586 "Create snapshot (Ghosts) of selected F-Curves as background aid for active Graph Editor";
633 ot->
name =
"Clear Ghost Curves";
634 ot->
idname =
"GRAPH_OT_ghost_curves_clear";
635 ot->
description =
"Clear F-Curve snapshots (Ghosts) for active Graph Editor";
664 if ((local_view_bits & (1 << i)) == 0) {
678 const ListBaseT<bAnimListElem> &anim_data,
679 const bool frame_selected)
681 bool is_selected =
false;
704 if (frame_selected) {
717 const ListBaseT<bAnimListElem> &anim_data,
718 const bool frame_selected)
720 bool changed =
false;
731 if (frame_selected) {
742 ListBaseT<bAnimListElem> anim_data = {
nullptr,
nullptr};
766 const bool changed = enter_local_view ?
794 ot->
name =
"Local View";
795 ot->
idname =
"GRAPH_OT_local_view";
796 ot->
description =
"Isolate selected F-Curves in Graph Editor view";
811 "Zoom current view to draw selected fcurves in visible range");
#define BEZT_BINARYSEARCH_THRESH
#define BEZT_ISSEL_ANY(bezt)
Read Blender memory allocation and freeing.
#define UI_MARKER_MARGIN_Y
#define V2D_SCROLL_HANDLE_HEIGHT
#define UI_TIME_SCRUB_MARGIN_Y
int pad[32 - sizeof(int)]
constexpr IndexRange()=default
ListBaseT< bAnimListElem > get_editable_fcurves(bAnimContext &ac)
void view2d_smooth_view(const bContext *C, ARegion *region, const rctf *cur, int smooth_viewtx)
void void GRAPH_OT_previewrange_set(wmOperatorType *ot)
ScrArea * CTX_wm_area(const bContext *C)
static bool local_view_enter(bContext *C, SpaceGraph &sipo, const ARegion ®ion, const ListBaseT< bAnimListElem > &anim_data, const bool frame_selected)
bool ED_operator_graphedit_active(bContext *C)
static wmOperatorStatus graphkeys_viewall(bContext *C, const bool do_sel_only, const bool include_handles, const int smooth_viewtx)
bool graphop_visible_keyframes_poll(bContext *C)
ListBaseT< TimeMarker > * ED_context_get_markers(const bContext *C)
MINLINE int round_fl_to_int(float a)
static wmOperatorStatus graphkeys_viewall_exec(bContext *C, wmOperator *op)
void BKE_fcurves_free(ListBaseT< FCurve > *list)
void GRAPH_OT_ghost_curves_clear(wmOperatorType *ot)
bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
int WM_operator_smooth_viewtx_get(const wmOperator *op)
float ANIM_nla_tweakedit_remap(bAnimListElem *ale, const float cframe, const eNlaTime_ConvertModes mode)
static void get_graph_view_bounds(bAnimContext *ac, rctf &r_bounds, const bool only_selected, const bool include_handles)
static wmOperatorStatus graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
constexpr float2 zoom_threshold(BEZT_BINARYSEARCH_THRESH, 0.0001f)
rctf ANIM_frame_range_view2d_add_xmargin(const View2D &view_2d, const rctf view_rect)
void BLI_rctf_sanitize(struct rctf *rect)
static void add_contextual_padding(bAnimContext &ac, ListBaseT< bAnimListElem > &anim_data, const bool pad_x, const bool pad_y, rctf &r_bounds)
static void create_ghost_curves(bAnimContext *ac, int start, int end)
static bool local_view_exit(bContext *C, SpaceGraph &sipo, ARegion ®ion, const ListBaseT< bAnimListElem > &anim_data, const bool frame_selected)
static wmOperatorStatus graph_local_view_exec(bContext *C, wmOperator *op)
ScenePlaybackRange BKE_scene_get_playback_range(const Scene *scene)
static bool graph_local_view_poll(bContext *C)
static wmOperatorStatus graphkeys_view_selected_exec(bContext *C, wmOperator *op)
bool BLI_rctf_is_valid(const struct rctf *rect)
static wmOperatorStatus graphkeys_view_frame_exec(bContext *C, wmOperator *op)
void ANIM_center_frame(bContext *C, int smooth_viewtx)
VecBase< float, 2 > float2
size_t ANIM_animdata_filter(bAnimContext *ac, ListBaseT< bAnimListElem > *anim_data, const eAnimFilter_Flags filter_mode, void *data, const eAnimCont_Types datatype)
@ ANIMFILTER_DATA_VISIBLE
@ ANIMFILTER_CURVE_VISIBLE
@ ANIMFILTER_LIST_CHANNELS
bool BKE_fcurve_calc_bounds(const FCurve *fcu, bool selected_keys_only, bool include_handles, const float frame_range[2], rctf *r_bounds)
void BLI_rctf_resize_y(struct rctf *rect, float y)
void BLI_rctf_pad_y(struct rctf *rect, float boundary_size, float pad_min, float pad_max)
void BLI_rctf_union_y(struct rctf *rct, float y)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
static wmOperatorStatus graphkeys_previewrange_exec(bContext *C, wmOperator *)
void GRAPH_OT_view_frame(wmOperatorType *ot)
static bool calculate_keyframe_bounds(const ListBaseT< bAnimListElem > &anim_data, bAnimContext &ac, const bool only_selected, const bool include_handles, rctf &r_bounds)
static wmOperatorStatus graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *)
SpaceGraph * CTX_wm_space_graph(const bContext *C)
void BLI_rctf_union_x(struct rctf *rct, float x)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void BLI_rctf_union(struct rctf *rct_a, const struct rctf *rct_b)
static bool graphkeys_viewall_poll(bContext *C)
void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax, bool do_sel_only, bool include_handles) ATTR_NONNULL(2
static void keyframe_bounds_defaults(bAnimContext &ac, rctf &r_bounds)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Main * CTX_data_main(const bContext *C)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
MINLINE float max_ff(float a, float b)
void GRAPH_OT_ghost_curves_create(wmOperatorType *ot)
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)
void GRAPH_OT_view_selected(wmOperatorType *ot)
float fcurve_samplingcb_evalcurve(FCurve *fcu, void *data, float evaltime)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
static uint16_t find_free_localview_bit(const Main *bmain)
void GRAPH_OT_local_view(wmOperatorType *ot)
ARegion * CTX_wm_region(const bContext *C)
bool ED_operator_region_graphedit_active(bContext *C)
FCurve * BKE_fcurve_create()
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void ED_area_tag_redraw(ScrArea *area)
void GRAPH_OT_view_all(wmOperatorType *ot)
short ANIM_get_normalization_flags(SpaceLink *space_link)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
ListBaseT< bScreen > screens
ListBaseT< ARegion > regionbase
ListBaseT< SpaceLink > spacedata
ListBaseT< FCurve > ghost_curves
rctf local_view_visible_region_before
SpaceGraph_Runtime runtime
ListBaseT< struct ScrArea > areabase
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT