Blender V5.3
graph_view.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2020 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cmath>
10
11#include "MEM_guardedalloc.h"
12
13#include "BLI_listbase.hh"
14#include "BLI_math_base_c.hh"
15#include "BLI_rect.hh"
16#include "BLI_utildefines.hh"
17
18#include "DNA_anim_types.h"
19#include "DNA_curve_types.h"
20#include "DNA_scene_types.h"
21#include "DNA_space_types.h"
22
23#include "RNA_access.hh"
24#include "RNA_define.hh"
25
26#include "BKE_context.hh"
27#include "BKE_fcurve.hh"
28#include "BKE_main.hh"
29#include "BKE_nla.hh"
30#include "BKE_scene.hh"
31
32#include "UI_view2d.hh"
33
34#include "ED_anim_api.hh"
35#include "ED_markers.hh"
36#include "ED_screen.hh"
37#include "ED_space_graph.hh"
38
39#include "WM_api.hh"
40#include "WM_types.hh"
41
42#include "graph_intern.hh"
43
44namespace blender {
45
46/* -------------------------------------------------------------------- */
49
50/* Used to ensure that the extents are not too extreme that view implodes. We need different
51 * values for x and y due to the nature of the data displayed. The minimum distance on x for
52 * keyframes is BEZT_BINARYSEARCH_THRESH so differences smaller than that cannot occur. For the y
53 * value there is no such limit, so we have to choose a smaller number. The units are frames for
54 * the x-axis and value for the y-axis. */
56
61static void keyframe_bounds_defaults(bAnimContext &ac, rctf &r_bounds)
62{
63 /* Set default range. */
64 if (ac.scene) {
65 const ScenePlaybackRange playback_range = BKE_scene_get_playback_range(ac.scene);
66 r_bounds.xmin = float(playback_range.start_frame);
67 /* The scene range can have the same start and end frame. */
68 r_bounds.xmax = max_ff(float(playback_range.end_frame), r_bounds.xmin + 1);
69 }
70 else {
71 /* The hardcoded values for x and y are completely arbitrary. */
72 r_bounds.xmin = -5;
73 r_bounds.xmax = 100;
74 }
75 r_bounds.ymin = -5;
76 r_bounds.ymax = 5;
77}
78
87static bool calculate_keyframe_bounds(const ListBaseT<bAnimListElem> &anim_data,
88 bAnimContext &ac,
89 const bool only_selected,
90 const bool include_handles,
91 rctf &r_bounds)
92{
93 /* Check if any channels to set range with. */
94 if (!anim_data.first_) {
95 return false;
96 }
97 constexpr float inf = std::numeric_limits<float>::infinity();
98 r_bounds.xmin = inf;
99 r_bounds.xmax = -inf;
100 r_bounds.ymin = inf;
101 r_bounds.ymax = -inf;
102
103 /* Go through channels, finding max extents. */
104 for (bAnimListElem &ale : anim_data) {
105 FCurve *fcu = static_cast<FCurve *>(ale.key_data);
106 rctf fcu_bounds;
107
108 /* Get range. */
109 if (!BKE_fcurve_calc_bounds(fcu, only_selected, include_handles, nullptr, &fcu_bounds)) {
110 continue;
111 }
112 const short mapping_flag = ANIM_get_normalization_flags(ac.sl);
113
114 /* Apply NLA scaling. */
115 fcu_bounds.xmin = ANIM_nla_tweakedit_remap(&ale, fcu_bounds.xmin, NLATIME_CONVERT_MAP);
116 fcu_bounds.xmax = ANIM_nla_tweakedit_remap(&ale, fcu_bounds.xmax, NLATIME_CONVERT_MAP);
117
118 /* Apply unit corrections. */
119 float offset;
120 const float unitFac = ANIM_unit_mapping_get_factor(
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;
126 BLI_rctf_sanitize(&fcu_bounds);
127 BLI_rctf_union(&r_bounds, &fcu_bounds);
128 }
129 return BLI_rctf_is_valid(&r_bounds);
130}
131
133 float *xmin,
134 float *xmax,
135 float *ymin,
136 float *ymax,
137 const bool do_sel_only,
138 const bool include_handles)
139{
140 ListBaseT<bAnimListElem> anim_data = ed::graph::get_editable_fcurves(*ac);
141 rctf fcurve_bounds;
142 const bool foundBounds = calculate_keyframe_bounds(
143 anim_data, *ac, do_sel_only, include_handles, fcurve_bounds);
144 ANIM_animdata_freelist(&anim_data);
145
146 /* Ensure that the extents are not too extreme that view implodes. */
147 if (foundBounds) {
148 if (fabsf(fcurve_bounds.xmax - fcurve_bounds.xmin) < zoom_threshold.x) {
149 fcurve_bounds.xmin -= zoom_threshold.x / 2;
150 fcurve_bounds.xmax += zoom_threshold.x / 2;
151 }
152 if (fabsf(fcurve_bounds.ymax - fcurve_bounds.ymin) < zoom_threshold.y) {
153 fcurve_bounds.ymin -= zoom_threshold.y / 2;
154 fcurve_bounds.ymax += zoom_threshold.y / 2;
155 }
156 }
157 else {
158 keyframe_bounds_defaults(*ac, fcurve_bounds);
159 }
160
161 *xmin = fcurve_bounds.xmin;
162 *xmax = fcurve_bounds.xmax;
163 if (ymin) {
164 *ymin = fcurve_bounds.ymin;
165 }
166 if (ymax) {
167 *ymax = fcurve_bounds.ymax;
168 }
169}
170
175 ListBaseT<bAnimListElem> &anim_data,
176 const bool pad_x,
177 const bool pad_y,
178 rctf &r_bounds)
179{
180 if (!pad_x && !pad_y) {
181 return;
182 }
183 const short mapping_flag = ANIM_get_normalization_flags(ac.sl);
184 for (bAnimListElem &ale : anim_data) {
185 FCurve *fcu = static_cast<FCurve *>(ale.key_data);
186 if (!fcu->bezt || fcu->totvert == 0) {
187 continue;
188 }
189 float offset;
190 const float unit_factor = ANIM_unit_mapping_get_factor(
191 ac.scene, ale.id, fcu, mapping_flag, &offset);
192 for (int i : IndexRange(fcu->totvert)) {
193 BezTriple *bezt = &fcu->bezt[i];
194 if (!BEZT_ISSEL_ANY(bezt)) {
195 continue;
196 }
197 const float2 key(bezt->vec[1][0], (bezt->vec[1][1] + offset) * unit_factor);
198 /* Check the previous/next key if they exist and add half the distance to them as padding to
199 * the bounds. */
200 if (i - 1 >= 0) {
201 const float2 prev_key(fcu->bezt[i - 1].vec[1][0],
202 (fcu->bezt[i - 1].vec[1][1] + offset) * unit_factor);
203 if (pad_x) {
204 const float pad = (key.x - prev_key.x) / 2.0;
205 BLI_rctf_union_x(&r_bounds, key.x - pad);
206 }
207 if (pad_y) {
208 const float pad = fabsf(prev_key.y - key.y) / 2.0;
209 /* Add to top and bottom to keep selection centered. */
210 BLI_rctf_union_y(&r_bounds, key.y - pad);
211 BLI_rctf_union_y(&r_bounds, key.y + pad);
212 }
213 }
214 if (i + 1 < fcu->totvert) {
215 const float2 next_key(fcu->bezt[i + 1].vec[1][0],
216 (fcu->bezt[i + 1].vec[1][1] + offset) * unit_factor);
217 if (pad_x) {
218 const float pad = (next_key.x - key.x) / 2.0;
219 BLI_rctf_union_x(&r_bounds, key.x + pad);
220 }
221 if (pad_y) {
222 const float pad = fabsf(next_key.y - key.y) / 2.0;
223 /* Add to top and bottom to keep selection centered. */
224 BLI_rctf_union_y(&r_bounds, key.y - pad);
225 BLI_rctf_union_y(&r_bounds, key.y + pad);
226 }
227 }
228 }
229 }
230}
231
238 rctf &r_bounds,
239 const bool only_selected,
240 const bool include_handles)
241{
242 ListBaseT<bAnimListElem> anim_data = ed::graph::get_editable_fcurves(*ac);
243 const bool found_bounds = calculate_keyframe_bounds(
244 anim_data, *ac, only_selected, include_handles, r_bounds);
245
246 if (found_bounds) {
247 if (only_selected) {
248 /* Only adding contextual padding when looking at selected keys. When framing all data,
249 * there is no additional information we could possibly use. */
251 anim_data,
252 BLI_rctf_size_x(&r_bounds) < zoom_threshold.x,
253 BLI_rctf_size_y(&r_bounds) < zoom_threshold.y,
254 r_bounds);
255 }
256 if (fabsf(r_bounds.xmax - r_bounds.xmin) < zoom_threshold.x) {
257 r_bounds.xmin -= zoom_threshold.x / 2;
258 r_bounds.xmax += zoom_threshold.x / 2;
259 }
260 if (fabsf(r_bounds.ymax - r_bounds.ymin) < zoom_threshold.y) {
261 r_bounds.ymin -= zoom_threshold.y / 2;
262 r_bounds.ymax += zoom_threshold.y / 2;
263 }
264 }
265 else {
266 keyframe_bounds_defaults(*ac, r_bounds);
267 }
268
269 ANIM_animdata_freelist(&anim_data);
270}
271
273
274/* -------------------------------------------------------------------- */
277
279{
280 bAnimContext ac;
281 Scene *scene;
282 float min, max;
283
284 /* Get editor data. */
285 if (ANIM_animdata_get_context(C, &ac) == 0) {
286 return OPERATOR_CANCELLED;
287 }
288 if (ac.scene == nullptr) {
289 return OPERATOR_CANCELLED;
290 }
291
292 scene = ac.scene;
293
294 /* Set the range directly. */
295 get_graph_keyframe_extents(&ac, &min, &max, nullptr, nullptr, true, false);
296 scene->r.flag |= SCER_PRV_RANGE;
297 scene->r.psfra = round_fl_to_int(min);
298 scene->r.pefra = round_fl_to_int(max);
299
300 /* Set notifier that things have changed. */
301 /* XXX: Err... there's nothing for frame ranges yet, but this should do fine too. */
303
304 return OPERATOR_FINISHED;
305}
306
308{
309 /* Identifiers */
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";
313
314 /* API callbacks */
316 /* XXX: unchecked poll to get F-samples working too, but makes modifier damage trickier. */
318
319 /* Flags */
321}
322
324
325/* -------------------------------------------------------------------- */
328
330{
332 return false;
333 }
334 const ARegion *region = CTX_wm_region(C);
335 return region && ELEM(region->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_CHANNELS);
336}
337
339 const bool do_sel_only,
340 const bool include_handles,
341 const int smooth_viewtx)
342{
343 bAnimContext ac;
344 rctf cur_new;
345
346 /* Get editor data. */
347 if (ANIM_animdata_get_context(C, &ac) == 0) {
348 return OPERATOR_CANCELLED;
349 }
350
351 if (ac.regiontype != RGN_TYPE_WINDOW) {
352 /* It is possible that operator is invoked from other regions like the Graph Editor's channel
353 * list. Main region is required here for smooth view function. */
354 for (ARegion &region : ac.area->regionbase) {
355 if (region.regiontype == RGN_TYPE_WINDOW) {
356 ac.region = &region;
357 break;
358 }
359 }
360 }
361 /* Set the horizontal range, with an extra offset so that the extreme keys will be in view. */
362 get_graph_view_bounds(&ac, cur_new, do_sel_only, include_handles);
363
364 /* Give some more space at the borders. */
365 cur_new = ANIM_frame_range_view2d_add_xmargin(ac.region->v2d, cur_new);
366 BLI_rctf_resize_y(&cur_new, 1.1f * BLI_rctf_size_y(&cur_new));
367
368 /* Take regions into account, that could block the view.
369 * Marker region is supposed to be larger than the scroll-bar, so prioritize it. */
370 float pad_top = UI_TIME_SCRUB_MARGIN_Y;
373 BLI_rctf_pad_y(&cur_new, ac.region->winy, pad_bottom, pad_top);
374
375 ui::view2d_smooth_view(C, ac.region, &cur_new, smooth_viewtx);
376 return OPERATOR_FINISHED;
377}
378
379/* ......... */
380
382{
383 const bool include_handles = RNA_boolean_get(op->ptr, "include_handles");
384 const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
385
386 /* Whole range */
387 return graphkeys_viewall(C, false, include_handles, smooth_viewtx);
388}
389
391{
392 const bool include_handles = RNA_boolean_get(op->ptr, "include_handles");
393 const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
394
395 /* Only selected. */
396 return graphkeys_viewall(C, true, include_handles, smooth_viewtx);
397}
398
399/* ......... */
400
402{
403 /* Identifiers */
404 ot->name = "Frame All";
405 ot->idname = "GRAPH_OT_view_all";
406 ot->description = "Reset viewable area to show full keyframe range";
407
408 /* API callbacks */
411
412 /* Flags */
413 ot->flag = 0;
414
415 /* Props */
416 ot->prop = RNA_def_boolean(ot->srna,
417 "include_handles",
418 true,
419 "Include Handles",
420 "Include handles of keyframes when calculating extents");
421}
422
424{
425 /* Identifiers */
426 ot->name = "Frame Selected";
427 ot->idname = "GRAPH_OT_view_selected";
428 ot->description = "Reset viewable area to show selected keyframe range";
429
430 /* API callbacks */
433
434 /* Flags */
435 ot->flag = 0;
436
437 /* Props */
438 ot->prop = RNA_def_boolean(ot->srna,
439 "include_handles",
440 true,
441 "Include Handles",
442 "Include handles of keyframes when calculating extents");
443}
444
446
447/* -------------------------------------------------------------------- */
450
452{
453 const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
454 ANIM_center_frame(C, smooth_viewtx);
455 return OPERATOR_FINISHED;
456}
457
459{
460 /* Identifiers */
461 ot->name = "Go to Current Frame";
462 ot->idname = "GRAPH_OT_view_frame";
463 ot->description = "Move the view to the current frame";
464
465 /* API callbacks */
468
469 /* Flags */
470 ot->flag = 0;
471}
472
474
475/* -------------------------------------------------------------------- */
481
482/* Bake each F-Curve into a set of samples, and store as a ghost curve. */
483static void create_ghost_curves(bAnimContext *ac, int start, int end)
484{
485 SpaceGraph *sipo = reinterpret_cast<SpaceGraph *>(ac->sl);
486 ListBaseT<bAnimListElem> anim_data = {nullptr, nullptr};
487 int filter;
488
489 /* Free existing ghost curves. */
491
492 /* Sanity check. */
493 if (start >= end) {
494 printf("Error: Frame range for Ghost F-Curve creation is inappropriate\n");
495 return;
496 }
497
498 /* Filter data. */
502 ac, &anim_data, eAnimFilter_Flags(filter), ac->data, eAnimCont_Types(ac->datatype));
503
504 /* Loop through filtered data and add keys between selected keyframes on every frame. */
505 for (bAnimListElem &ale : anim_data) {
506 FCurve *fcu = static_cast<FCurve *>(ale.key_data);
507 FCurve *gcu = BKE_fcurve_create();
508 ChannelDriver *driver = fcu->driver;
509 FPoint *fpt;
510 float unitFac, offset;
511 int cfra;
512 short mapping_flag = ANIM_get_normalization_flags(ac->sl);
513
514 /* Disable driver so that it don't muck up the sampling process. */
515 fcu->driver = nullptr;
516
517 /* Calculate unit-mapping factor. */
518 unitFac = ANIM_unit_mapping_get_factor(ac->scene, ale.id, fcu, mapping_flag, &offset);
519
520 /* Create samples, but store them in a new curve
521 * - we cannot use fcurve_store_samples() as that will only overwrite the original curve.
522 */
523 gcu->fpt = fpt = MEM_new_array_zeroed<FPoint>((end - start + 1), "Ghost FPoint Samples");
524 gcu->totvert = end - start + 1;
525
526 /* Use the sampling callback at 1-frame intervals from start to end frames. */
527 for (cfra = start; cfra <= end; cfra++, fpt++) {
528 const float cfrae = ANIM_nla_tweakedit_remap(&ale, cfra, NLATIME_CONVERT_UNMAP);
529
530 fpt->vec[0] = cfrae;
531 fpt->vec[1] = (fcurve_samplingcb_evalcurve(fcu, nullptr, cfrae) + offset) * unitFac;
532 }
533
534 /* Set color of ghost curve
535 * - make the color slightly darker.
536 */
537 gcu->color[0] = fcu->color[0] - 0.07f;
538 gcu->color[1] = fcu->color[1] - 0.07f;
539 gcu->color[2] = fcu->color[2] - 0.07f;
540
541 /* Store new ghost curve. */
542 BLI_addtail(&sipo->runtime.ghost_curves, gcu);
543
544 /* Restore driver. */
545 fcu->driver = driver;
546 }
547
548 /* Admin and redraws. */
549 ANIM_animdata_freelist(&anim_data);
550}
551
552/* ------------------- */
553
555{
556 bAnimContext ac;
557 View2D *v2d;
558 int start, end;
559
560 /* Get editor data. */
561 if (ANIM_animdata_get_context(C, &ac) == 0) {
562 return OPERATOR_CANCELLED;
563 }
564
565 /* Ghost curves are snapshots of the visible portions of the curves,
566 * so set range to be the visible range. */
567 v2d = &ac.region->v2d;
568 start = int(v2d->cur.xmin);
569 end = int(v2d->cur.xmax);
570
571 /* Bake selected curves into a ghost curve. */
572 create_ghost_curves(&ac, start, end);
573
574 /* Update this editor only. */
576
577 return OPERATOR_FINISHED;
578}
579
581{
582 /* Identifiers */
583 ot->name = "Create Ghost Curves";
584 ot->idname = "GRAPH_OT_ghost_curves_create";
585 ot->description =
586 "Create snapshot (Ghosts) of selected F-Curves as background aid for active Graph Editor";
587
588 /* API callbacks */
591
592 /* Flags */
594
595 /* TODO: add props for start/end frames */
596}
597
599
600/* -------------------------------------------------------------------- */
605
607{
608 bAnimContext ac;
609 SpaceGraph *sipo;
610
611 /* Get editor data. */
612 if (ANIM_animdata_get_context(C, &ac) == 0) {
613 return OPERATOR_CANCELLED;
614 }
615 sipo = reinterpret_cast<SpaceGraph *>(ac.sl);
616
617 /* If no ghost curves, don't do anything. */
618 if (sipo->runtime.ghost_curves.is_empty()) {
619 return OPERATOR_CANCELLED;
620 }
621 /* Free ghost curves. */
623
624 /* Update this editor only. */
626
627 return OPERATOR_FINISHED;
628}
629
631{
632 /* Identifiers */
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";
636
637 /* API callbacks */
640
641 /* Flags */
643}
644
645/* Returns the free bit */
647{
648 uint16_t local_view_bits = 0;
649 static_assert(std::is_same_v<decltype(SpaceGraph::local_view_bit), decltype(local_view_bits)>);
650
651 /* Check all areas to see which local view bits are already in use. */
652 for (const bScreen &screen : bmain->screens) {
653 for (const ScrArea &area : screen.areabase) {
654 for (const SpaceLink &sl : area.spacedata) {
655 if (sl.spacetype == SPACE_GRAPH) {
656 const SpaceGraph *sipo = reinterpret_cast<const SpaceGraph *>(&sl);
657 local_view_bits |= sipo->local_view_bit;
658 }
659 }
660 }
661 }
662
663 for (int i = 0; i < 8 * sizeof(SpaceGraph::local_view_bit); i++) {
664 if ((local_view_bits & (1 << i)) == 0) {
665 return (1 << i);
666 }
667 }
668
669 return 0;
670}
671
676 SpaceGraph &sipo,
677 const ARegion &region,
678 const ListBaseT<bAnimListElem> &anim_data,
679 const bool frame_selected)
680{
681 bool is_selected = false;
682 /* Find a free bit and set local view for graph editor in current context. */
684
685 for (bAnimListElem &ale : anim_data) {
686 FCurve *fcu = static_cast<FCurve *>(ale.key_data);
687 if (ale.type != ANIMTYPE_FCURVE) {
688 continue;
689 }
690 if (ale.flag & FCURVE_SELECTED) {
691 /* Set bit for selected Fcurves to draw them in local view. */
692 fcu->local_view_bits |= free_bit;
693 is_selected = true;
694 }
695 }
696
697 /* Only enter local view when Fcurve is selected. */
698 if (!is_selected) {
699 return false;
700 }
701
702 sipo.local_view_bit = free_bit;
704 if (frame_selected) {
705 graphkeys_viewall(C, false, true, 200);
706 }
707
708 return true;
709}
710
715 SpaceGraph &sipo,
716 ARegion &region,
717 const ListBaseT<bAnimListElem> &anim_data,
718 const bool frame_selected)
719{
720 bool changed = false;
721 for (bAnimListElem &ale : anim_data) {
722 FCurve *fcu = static_cast<FCurve *>(ale.key_data);
723 if (ale.type != ANIMTYPE_FCURVE) {
724 continue;
725 }
726 fcu->local_view_bits &= ~sipo.local_view_bit;
727 changed = true;
728 }
729
730 sipo.local_view_bit = 0;
731 if (frame_selected) {
732 /* Restore view. */
734 }
735
736 return changed;
737}
738
740{
741 bAnimContext ac;
742 ListBaseT<bAnimListElem> anim_data = {nullptr, nullptr};
744 const bool frame_selected = RNA_boolean_get(op->ptr, "frame_selected");
745 const bool enter_local_view = (sipo->local_view_bit == 0);
746
747 if (ANIM_animdata_get_context(C, &ac) == 0) {
748 return OPERATOR_CANCELLED;
749 }
750
751 if (ac.regiontype != RGN_TYPE_WINDOW) {
752 /* It is possible that operator is invoked from other regions like the Graph Editor's channel
753 * list. Main region is required here for current bounds and smooth view function. */
754 for (ARegion &region : ac.area->regionbase) {
755 if (region.regiontype == RGN_TYPE_WINDOW) {
756 ac.region = &region;
757 break;
758 }
759 }
760 }
761
764 ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
765
766 const bool changed = enter_local_view ?
767 local_view_enter(C, *sipo, *ac.region, anim_data, frame_selected) :
768 local_view_exit(C, *sipo, *ac.region, anim_data, frame_selected);
769
770 ANIM_animdata_freelist(&anim_data);
771
772 if (!changed) {
773 return OPERATOR_CANCELLED;
774 }
775
777 return OPERATOR_FINISHED;
778}
779
781{
783 return false;
784 }
785
786 const SpaceGraph *sipo = CTX_wm_space_graph(C);
787 /* Operator is not supported yet in driver editor. */
788 return sipo->mode != SIPO_MODE_DRIVERS;
789}
790
792{
793 /* identifiers */
794 ot->name = "Local View";
795 ot->idname = "GRAPH_OT_local_view";
796 ot->description = "Isolate selected F-Curves in Graph Editor view";
797
798 /* API callbacks. */
801
802 /* flags */
803 ot->flag = OPTYPE_UNDO;
804
805 /* Props */
807 ot->srna,
808 "frame_selected",
809 true,
810 "Frame selected",
811 "Zoom current view to draw selected fcurves in visible range");
813}
814
816
817} // namespace blender
#define BEZT_BINARYSEARCH_THRESH
#define BEZT_ISSEL_ANY(bezt)
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define UI_MARKER_MARGIN_Y
Definition UI_view2d.hh:492
#define V2D_SCROLL_HANDLE_HEIGHT
Definition UI_view2d.hh:92
#define UI_TIME_SCRUB_MARGIN_Y
Definition UI_view2d.hh:493
#define NC_ANIMATION
Definition WM_types.hh:401
#define NC_SCENE
Definition WM_types.hh:391
#define NA_EDITED
Definition WM_types.hh:634
#define ND_FRAME
Definition WM_types.hh:453
#define ND_ANIMCHAN
Definition WM_types.hh:539
int pad[32 - sizeof(int)]
#define ELEM(...)
btScalar max
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)
BMesh Iterators.
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 &region, 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)
@ NLATIME_CONVERT_UNMAP
Definition BKE_nla.hh:560
@ NLATIME_CONVERT_MAP
Definition BKE_nla.hh:563
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)
Definition anim_draw.cc:329
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)
Definition anim_draw.cc:848
void BLI_rctf_sanitize(struct rctf *rect)
Definition rct.cc:448
@ ANIMTYPE_FCURVE
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 &region, 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)
Definition scene.cc:2607
unsigned short uint16_t
Definition BKE_text.h:80
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)
Definition anim_draw.cc:801
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_FCURVESONLY
@ ANIMFILTER_DATA_VISIBLE
@ ANIMFILTER_CURVE_VISIBLE
@ ANIMFILTER_NODUPLIS
@ 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)
Definition rct.cc:665
void BLI_rctf_pad_y(struct rctf *rect, float boundary_size, float pad_min, float pad_max)
Definition rct.cc:703
void BLI_rctf_union_y(struct rctf *rct, float y)
Definition rct.cc:396
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition BLI_rect.hh:215
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)
Definition graph_view.cc:87
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)
Definition rct.cc:390
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)
Definition graph_view.cc:61
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
Main * CTX_data_main(const bContext *C)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition BLI_rect.hh:211
MINLINE float max_ff(float a, float b)
void GRAPH_OT_ghost_curves_create(wmOperatorType *ot)
void ANIM_animdata_freelist(ListBaseT< bAnimListElem > *anim_data)
Definition anim_deps.cc:472
float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short flag, float *r_offset)
Definition anim_draw.cc:636
@ PROP_SKIP_SAVE
Definition RNA_types.hh:414
void GRAPH_OT_view_selected(wmOperatorType *ot)
@ OPTYPE_REGISTER
Definition WM_types.hh:188
@ OPTYPE_UNDO
Definition WM_types.hh:190
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)
Definition area.cc:784
void GRAPH_OT_view_all(wmOperatorType *ot)
short ANIM_get_normalization_flags(SpaceLink *space_link)
Definition anim_draw.cc:420
#define fabsf
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
#define min(a, b)
Definition sort.cc:38
eRegion_Type regiontype
uint16_t local_view_bits
ChannelDriver * driver
unsigned int totvert
ListBaseT< bScreen > screens
Definition BKE_main.hh:400
struct RenderData r
ListBaseT< ARegion > regionbase
ListBaseT< SpaceLink > spacedata
ListBaseT< FCurve > ghost_curves
SpaceGraph_Runtime runtime
eGraphEdit_Mode mode
eRegion_Type regiontype
eAnimCont_Types datatype
ListBaseT< struct ScrArea > areabase
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1125
const char * description
Definition WM_types.hh:1115
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1165