Blender  V3.3
space_graph.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2008 Blender Foundation. All rights reserved. */
3 
8 #include <stdio.h>
9 #include <string.h>
10 
11 #include "DNA_anim_types.h"
12 #include "DNA_collection_types.h"
13 #include "DNA_scene_types.h"
14 
15 #include "MEM_guardedalloc.h"
16 
17 #include "BLI_blenlib.h"
18 #include "BLI_math.h"
19 #include "BLI_utildefines.h"
20 
21 #include "BKE_context.h"
22 #include "BKE_fcurve.h"
23 #include "BKE_lib_remap.h"
24 #include "BKE_screen.h"
25 
26 #include "ED_anim_api.h"
27 #include "ED_markers.h"
28 #include "ED_screen.h"
29 #include "ED_space_api.h"
30 #include "ED_time_scrub_ui.h"
31 
32 #include "GPU_framebuffer.h"
33 #include "GPU_immediate.h"
34 #include "GPU_state.h"
35 
36 #include "WM_api.h"
37 #include "WM_message.h"
38 #include "WM_types.h"
39 
40 #include "RNA_access.h"
41 #include "RNA_define.h"
42 #include "RNA_enum_types.h"
43 
44 #include "UI_interface.h"
45 #include "UI_resources.h"
46 #include "UI_view2d.h"
47 
48 #include "graph_intern.h" /* own include */
49 
50 /* ******************** default callbacks for ipo space ***************** */
51 
53 {
54  ARegion *region;
55  SpaceGraph *sipo;
56 
57  /* Graph Editor - general stuff */
58  sipo = MEM_callocN(sizeof(SpaceGraph), "init graphedit");
59  sipo->spacetype = SPACE_GRAPH;
60 
61  sipo->autosnap = SACTSNAP_FRAME;
62 
63  /* allocate DopeSheet data for Graph Editor */
64  sipo->ads = MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
65  sipo->ads->source = (ID *)scene;
66 
67  /* settings for making it easier by default to just see what you're interested in tweaking */
70 
71  /* header */
72  region = MEM_callocN(sizeof(ARegion), "header for graphedit");
73 
74  BLI_addtail(&sipo->regionbase, region);
75  region->regiontype = RGN_TYPE_HEADER;
77 
78  /* channels */
79  region = MEM_callocN(sizeof(ARegion), "channels region for graphedit");
80 
81  BLI_addtail(&sipo->regionbase, region);
82  region->regiontype = RGN_TYPE_CHANNELS;
83  region->alignment = RGN_ALIGN_LEFT;
84 
86 
87  /* ui buttons */
88  region = MEM_callocN(sizeof(ARegion), "buttons region for graphedit");
89 
90  BLI_addtail(&sipo->regionbase, region);
91  region->regiontype = RGN_TYPE_UI;
92  region->alignment = RGN_ALIGN_RIGHT;
93 
94  /* main region */
95  region = MEM_callocN(sizeof(ARegion), "main region for graphedit");
96 
97  BLI_addtail(&sipo->regionbase, region);
98  region->regiontype = RGN_TYPE_WINDOW;
99 
100  region->v2d.tot.xmin = 0.0f;
101  region->v2d.tot.ymin = (float)scene->r.sfra - 10.0f;
102  region->v2d.tot.xmax = (float)scene->r.efra;
103  region->v2d.tot.ymax = 10.0f;
104 
105  region->v2d.cur = region->v2d.tot;
106 
107  region->v2d.min[0] = FLT_MIN;
108  region->v2d.min[1] = FLT_MIN;
109 
110  region->v2d.max[0] = MAXFRAMEF;
111  region->v2d.max[1] = FLT_MAX;
112 
115 
116  region->v2d.keeptot = 0;
117 
118  return (SpaceLink *)sipo;
119 }
120 
121 /* not spacelink itself */
122 static void graph_free(SpaceLink *sl)
123 {
124  SpaceGraph *si = (SpaceGraph *)sl;
125 
126  if (si->ads) {
127  BLI_freelistN(&si->ads->chanbase);
128  MEM_freeN(si->ads);
129  }
130 
131  if (si->runtime.ghost_curves.first) {
133  }
134 }
135 
136 /* spacetype; init callback */
137 static void graph_init(struct wmWindowManager *wm, ScrArea *area)
138 {
139  SpaceGraph *sipo = (SpaceGraph *)area->spacedata.first;
140 
141  /* init dopesheet data if non-existent (i.e. for old files) */
142  if (sipo->ads == NULL) {
143  sipo->ads = MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
145  }
146 
147  /* force immediate init of any invalid F-Curve colors */
148  /* XXX: but, don't do SIPO_TEMP_NEEDCHANSYNC (i.e. channel select state sync)
149  * as this is run on each region resize; setting this here will cause selection
150  * state to be lost on area/region resizing. T35744.
151  */
153 }
154 
156 {
157  SpaceGraph *sipon = MEM_dupallocN(sl);
158 
159  memset(&sipon->runtime, 0x0, sizeof(sipon->runtime));
160 
161  /* clear or remove stuff from old */
162  BLI_duplicatelist(&sipon->runtime.ghost_curves, &((SpaceGraph *)sl)->runtime.ghost_curves);
163  sipon->ads = MEM_dupallocN(sipon->ads);
164 
165  return (SpaceLink *)sipon;
166 }
167 
168 /* add handlers, stuff you only do once or on area/region changes */
170 {
171  wmKeyMap *keymap;
172 
173  UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy);
174 
175  /* own keymap */
176  keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor", SPACE_GRAPH, 0);
178  keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_GRAPH, 0);
179  WM_event_add_keymap_handler(&region->handlers, keymap);
180 }
181 
182 static void graph_main_region_draw(const bContext *C, ARegion *region)
183 {
184  /* draw entirely, view changes should be handled here */
187  bAnimContext ac;
188  View2D *v2d = &region->v2d;
189 
190  /* clear and setup matrix */
192 
194 
195  /* grid */
196  bool display_seconds = (sipo->mode == SIPO_MODE_ANIMATION) && (sipo->flag & SIPO_DRAWTIME);
197  UI_view2d_draw_lines_x__frames_or_seconds(v2d, scene, display_seconds);
199 
201 
202  /* start and end frame (in F-Curve mode only) */
203  if (sipo->mode != SIPO_MODE_DRIVERS) {
205  }
206 
207  /* draw data */
208  if (ANIM_animdata_get_context(C, &ac)) {
209  /* draw ghost curves */
210  graph_draw_ghost_curves(&ac, sipo, region);
211 
212  /* draw curves twice - unselected, then selected, so that the are fewer occlusion problems */
213  graph_draw_curves(&ac, sipo, region, 0);
214  graph_draw_curves(&ac, sipo, region, 1);
215 
216  /* XXX(ton): the slow way to set tot rect... but for nice sliders needed. */
218  &ac, &v2d->tot.xmin, &v2d->tot.xmax, &v2d->tot.ymin, &v2d->tot.ymax, false, true);
219  /* extra offset so that these items are visible */
220  v2d->tot.xmin -= 10.0f;
221  v2d->tot.xmax += 10.0f;
222  }
223 
224  if (((sipo->flag & SIPO_NODRAWCURSOR) == 0)) {
226 
228 
229  /* horizontal component of value-cursor (value line before the current frame line) */
230  float y = sipo->cursorVal;
231 
232  /* Draw a line to indicate the cursor value. */
235  GPU_line_width(2.0);
236 
238  immVertex2f(pos, v2d->cur.xmin, y);
239  immVertex2f(pos, v2d->cur.xmax, y);
240  immEnd();
241 
243 
244  /* Vertical component of the cursor. */
245  if (sipo->mode == SIPO_MODE_DRIVERS) {
246  /* cursor x-value */
247  float x = sipo->cursorTime;
248 
249  /* to help differentiate this from the current frame,
250  * draw slightly darker like the horizontal one */
253  GPU_line_width(2.0);
254 
256  immVertex2f(pos, x, v2d->cur.ymin);
257  immVertex2f(pos, x, v2d->cur.ymax);
258  immEnd();
259 
261  }
262 
264  }
265 
266  /* markers */
267  if (sipo->mode != SIPO_MODE_DRIVERS) {
268  UI_view2d_view_orthoSpecial(region, v2d, 1);
269  int marker_draw_flag = DRAW_MARKERS_MARGIN;
270  if (sipo->flag & SIPO_SHOW_MARKERS) {
271  ED_markers_draw(C, marker_draw_flag);
272  }
273  }
274 
275  /* preview range */
276  if (sipo->mode != SIPO_MODE_DRIVERS) {
278  ANIM_draw_previewrange(C, v2d, 0);
279  }
280 
281  /* callback */
284 
285  /* reset view matrix */
287 
288  /* time-scrubbing */
289  ED_time_scrub_draw(region, scene, display_seconds, false);
290 }
291 
292 static void graph_main_region_draw_overlay(const bContext *C, ARegion *region)
293 {
294  /* draw entirely, view changes should be handled here */
295  const SpaceGraph *sipo = CTX_wm_space_graph(C);
296 
297  const Scene *scene = CTX_data_scene(C);
298  View2D *v2d = &region->v2d;
299 
300  /* Driver Editor's X axis is not time. */
301  if (sipo->mode != SIPO_MODE_DRIVERS) {
302  /* scrubbing region */
304  }
305 
306  /* scrollers */
307  /* FIXME: args for scrollers depend on the type of data being shown. */
309 
310  /* scale numbers */
311  {
312  rcti rect;
314  &rect, 0, 15 * UI_DPI_FAC, 15 * UI_DPI_FAC, region->winy - UI_TIME_SCRUB_MARGIN_Y);
315  UI_view2d_draw_scale_y__values(region, v2d, &rect, TH_SCROLL_TEXT);
316  }
317 }
318 
320 {
321  wmKeyMap *keymap;
322 
323  /* make sure we keep the hide flags */
324  region->v2d.scroll |= V2D_SCROLL_RIGHT;
325 
326  /* prevent any noise of past */
328 
331 
332  UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy);
333 
334  /* own keymap */
335  keymap = WM_keymap_ensure(wm->defaultconf, "Animation Channels", 0, 0);
337  keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_GRAPH, 0);
338  WM_event_add_keymap_handler(&region->handlers, keymap);
339 }
340 
341 static void graph_channel_region_draw(const bContext *C, ARegion *region)
342 {
343  bAnimContext ac;
344  View2D *v2d = &region->v2d;
345 
346  /* clear and setup matrix */
348 
350 
351  /* draw channels */
352  if (ANIM_animdata_get_context(C, &ac)) {
353  graph_draw_channel_names((bContext *)C, &ac, region);
354  }
355 
356  /* channel filter next to scrubbing area */
358 
359  /* reset view matrix */
361 
362  /* scrollers */
364 }
365 
366 /* add handlers, stuff you only do once or on area/region changes */
368 {
369  ED_region_header_init(region);
370 }
371 
372 static void graph_header_region_draw(const bContext *C, ARegion *region)
373 {
374  ED_region_header(C, region);
375 }
376 
377 /* add handlers, stuff you only do once or on area/region changes */
379 {
380  wmKeyMap *keymap;
381 
382  ED_region_panels_init(wm, region);
383 
384  keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_GRAPH, 0);
386 }
387 
388 static void graph_buttons_region_draw(const bContext *C, ARegion *region)
389 {
390  ED_region_panels(C, region);
391 }
392 
394 {
395  ARegion *region = params->region;
396  wmNotifier *wmn = params->notifier;
397 
398  /* context changes */
399  switch (wmn->category) {
400  case NC_ANIMATION:
401  ED_region_tag_redraw(region);
402  break;
403  case NC_SCENE:
404  switch (wmn->data) {
405  case ND_RENDER_OPTIONS:
406  case ND_OB_ACTIVE:
407  case ND_FRAME:
408  case ND_FRAME_RANGE:
409  case ND_MARKERS:
410  ED_region_tag_redraw(region);
411  break;
412  case ND_SEQUENCER:
413  if (wmn->action == NA_SELECTED) {
414  ED_region_tag_redraw(region);
415  }
416  break;
417  }
418  break;
419  case NC_OBJECT:
420  switch (wmn->data) {
421  case ND_BONE_ACTIVE:
422  case ND_BONE_SELECT:
423  case ND_KEYS:
424  ED_region_tag_redraw(region);
425  break;
426  case ND_MODIFIER:
427  if (wmn->action == NA_RENAME) {
428  ED_region_tag_redraw(region);
429  }
430  break;
431  }
432  break;
433  case NC_NODE:
434  switch (wmn->action) {
435  case NA_EDITED:
436  case NA_SELECTED:
437  ED_region_tag_redraw(region);
438  break;
439  }
440  break;
441  case NC_ID:
442  if (wmn->action == NA_RENAME) {
443  ED_region_tag_redraw(region);
444  }
445  break;
446  case NC_SCREEN:
447  if (ELEM(wmn->data, ND_LAYER)) {
448  ED_region_tag_redraw(region);
449  }
450  break;
451  default:
452  if (wmn->data == ND_KEYS) {
453  ED_region_tag_redraw(region);
454  }
455  break;
456  }
457 }
458 
460 {
461  struct wmMsgBus *mbus = params->message_bus;
462  Scene *scene = params->scene;
463  bScreen *screen = params->screen;
464  ScrArea *area = params->area;
465  ARegion *region = params->region;
466 
467  PointerRNA ptr;
468  RNA_pointer_create(&screen->id, &RNA_SpaceGraphEditor, area->spacedata.first, &ptr);
469 
470  wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
471  .owner = region,
472  .user_data = region,
474  };
475 
476  /* Timeline depends on scene properties. */
477  {
478  bool use_preview = (scene->r.flag & SCER_PRV_RANGE);
479  const PropertyRNA *props[] = {
480  use_preview ? &rna_Scene_frame_preview_start : &rna_Scene_frame_start,
481  use_preview ? &rna_Scene_frame_preview_end : &rna_Scene_frame_end,
482  &rna_Scene_use_preview_range,
483  &rna_Scene_frame_current,
484  };
485 
486  PointerRNA idptr;
487  RNA_id_pointer_create(&scene->id, &idptr);
488 
489  for (int i = 0; i < ARRAY_SIZE(props); i++) {
490  WM_msg_subscribe_rna(mbus, &idptr, props[i], &msg_sub_value_region_tag_redraw, __func__);
491  }
492  }
493 
494  /* All dopesheet filter settings, etc. affect the drawing of this editor,
495  * also same applies for all animation-related datatypes that may appear here,
496  * so just whitelist the entire structs for updates
497  */
498  {
499  wmMsgParams_RNA msg_key_params = {{0}};
500  StructRNA *type_array[] = {
501  &RNA_DopeSheet, /* dopesheet filters */
502 
503  &RNA_ActionGroup, /* channel groups */
504  &RNA_FCurve, /* F-Curve */
505  &RNA_Keyframe,
506  &RNA_FCurveSample,
507 
508  &RNA_FModifier, /* F-Modifiers (XXX: Why can't we just do all subclasses too?) */
509  &RNA_FModifierCycles,
510  &RNA_FModifierEnvelope,
511  &RNA_FModifierEnvelopeControlPoint,
512  &RNA_FModifierFunctionGenerator,
513  &RNA_FModifierGenerator,
514  &RNA_FModifierLimits,
515  &RNA_FModifierNoise,
516  &RNA_FModifierPython,
517  &RNA_FModifierStepped,
518  };
519 
520  for (int i = 0; i < ARRAY_SIZE(type_array); i++) {
521  msg_key_params.ptr.type = type_array[i];
523  mbus, &msg_key_params, &msg_sub_value_region_tag_redraw, __func__);
524  }
525  }
526 }
527 
528 /* editor level listener */
530 {
531  ScrArea *area = params->area;
532  wmNotifier *wmn = params->notifier;
533  SpaceGraph *sipo = (SpaceGraph *)area->spacedata.first;
534 
535  /* context changes */
536  switch (wmn->category) {
537  case NC_ANIMATION:
538  /* For selection changes of animation data, we can just redraw...
539  * otherwise auto-color might need to be done again. */
540  if (ELEM(wmn->data, ND_KEYFRAME, ND_ANIMCHAN) && (wmn->action == NA_SELECTED)) {
542  }
543  else {
545  }
546  break;
547  case NC_SCENE:
548  switch (wmn->data) {
549  case ND_OB_ACTIVE: /* Selection changed, so force refresh to flush
550  * (needs flag set to do syncing). */
551  case ND_OB_SELECT:
554  break;
555 
556  default: /* just redrawing the view will do */
558  break;
559  }
560  break;
561  case NC_OBJECT:
562  switch (wmn->data) {
563  case ND_BONE_SELECT: /* Selection changed, so force refresh to flush
564  * (needs flag set to do syncing). */
565  case ND_BONE_ACTIVE:
568  break;
569  case ND_TRANSFORM:
570  break; /* Do nothing. */
571 
572  default: /* just redrawing the view will do */
574  break;
575  }
576  break;
577  case NC_NODE:
578  if (wmn->action == NA_SELECTED) {
579  /* selection changed, so force refresh to flush (needs flag set to do syncing) */
582  }
583  break;
584  case NC_SPACE:
585  if (wmn->data == ND_SPACE_GRAPH) {
587  }
588  break;
589  case NC_WINDOW:
590  if (sipo->runtime.flag &
592  /* force redraw/refresh after undo/redo - prevents "black curve" problem */
594  }
595  break;
596 
597 #if 0 /* XXX: restore the case below if not enough updates occur... */
598  default: {
599  if (wmn->data == ND_KEYS) {
601  }
602  }
603 #endif
604  }
605 }
606 
607 /* Update F-Curve colors */
609 {
610  bAnimContext ac;
611 
612  ListBase anim_data = {NULL, NULL};
613  bAnimListElem *ale;
614  size_t items;
615  int filter;
616  int i;
617 
618  if (ANIM_animdata_get_context(C, &ac) == false) {
619  return;
620  }
621 
623 
624  /* build list of F-Curves which will be visible as channels in channel-region
625  * - we don't include ANIMFILTER_CURVEVISIBLE filter, as that will result in a
626  * mismatch between channel-colors and the drawn curves
627  */
629  items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
630 
631  /* loop over F-Curves, assigning colors */
632  for (ale = anim_data.first, i = 0; ale; ale = ale->next, i++) {
633  FCurve *fcu = (FCurve *)ale->data;
634 
635  /* set color of curve here */
636  switch (fcu->color_mode) {
637  case FCURVE_COLOR_CUSTOM: {
638  /* User has defined a custom color for this curve already
639  * (we assume it's not going to cause clashes with text colors),
640  * which should be left alone... Nothing needs to be done here.
641  */
642  break;
643  }
644  case FCURVE_COLOR_AUTO_RGB: {
645  /* F-Curve's array index is automatically mapped to RGB values.
646  * This works best of 3-value vectors.
647  * TODO: find a way to module the hue so that not all curves have same color...
648  */
649  float *col = fcu->color;
650 
651  switch (fcu->array_index) {
652  case 0:
654  break;
655  case 1:
657  break;
658  case 2:
660  break;
661  default:
662  /* 'unknown' color - bluish so as to not conflict with handles */
663  col[0] = 0.3f;
664  col[1] = 0.8f;
665  col[2] = 1.0f;
666  break;
667  }
668  break;
669  }
670  case FCURVE_COLOR_AUTO_YRGB: {
671  /* Like FCURVE_COLOR_AUTO_RGB, except this is for quaternions... */
672  float *col = fcu->color;
673 
674  switch (fcu->array_index) {
675  case 1:
677  break;
678  case 2:
680  break;
681  case 3:
683  break;
684 
685  case 0: {
686  /* Special Case: "W" channel should be yellowish, so blend X and Y channel colors... */
687  float c1[3], c2[3];
688  float h1[3], h2[3];
689  float hresult[3];
690 
691  /* - get colors (rgb) */
694 
695  /* - perform blending in HSV space (to keep brightness similar) */
696  rgb_to_hsv_v(c1, h1);
697  rgb_to_hsv_v(c2, h2);
698 
699  interp_v3_v3v3(hresult, h1, h2, 0.5f);
700 
701  /* - convert back to RGB for display */
702  hsv_to_rgb_v(hresult, col);
703  break;
704  }
705 
706  default:
707  /* 'unknown' color - bluish so as to not conflict with handles */
708  col[0] = 0.3f;
709  col[1] = 0.8f;
710  col[2] = 1.0f;
711  break;
712  }
713  break;
714  }
716  default: {
717  /* determine color 'automatically' using 'magic function' which uses the given args
718  * of current item index + total items to determine some RGB color
719  */
720  getcolor_fcurve_rainbow(i, items, fcu->color);
721  break;
722  }
723  }
724  }
725 
726  /* free temp list */
727  ANIM_animdata_freelist(&anim_data);
728 }
729 
730 static void graph_refresh(const bContext *C, ScrArea *area)
731 {
732  SpaceGraph *sipo = (SpaceGraph *)area->spacedata.first;
733 
734  /* updates to data needed depends on Graph Editor mode... */
735  switch (sipo->mode) {
736  case SIPO_MODE_ANIMATION: /* all animation */
737  {
738  break;
739  }
740 
741  case SIPO_MODE_DRIVERS: /* Drivers only. */
742  {
743  break;
744  }
745  }
746 
747  /* region updates? */
748  /* XXX re-sizing y-extents of tot should go here? */
749 
750  /* Update the state of the animchannels in response to changes from the data they represent
751  * NOTE: the temp flag is used to indicate when this needs to be done,
752  * and will be cleared once handled. */
757  }
758 
759  /* We could check 'SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC_COLOR', but color is recalculated anyway. */
762 #if 0 /* Done below. */
764 #endif
766  }
767 
770 
771  /* init/adjust F-Curve colors */
773 }
774 
776  SpaceLink *slink,
777  const struct IDRemapper *mappings)
778 {
779  SpaceGraph *sgraph = (SpaceGraph *)slink;
780  if (!sgraph->ads) {
781  return;
782  }
783 
785  BKE_id_remapper_apply(mappings, (ID **)&sgraph->ads->source, ID_REMAP_APPLY_DEFAULT);
786 }
787 
789 {
790  SpaceGraph *sgraph = area->spacedata.first;
791  return sgraph->mode;
792 }
793 
794 static void graph_space_subtype_set(ScrArea *area, int value)
795 {
796  SpaceGraph *sgraph = area->spacedata.first;
797  sgraph->mode = value;
798 }
799 
801  EnumPropertyItem **item,
802  int *totitem)
803 {
805 }
806 
808 {
809  SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype ipo");
810  ARegionType *art;
811 
812  st->spaceid = SPACE_GRAPH;
813  strncpy(st->name, "Graph", BKE_ST_MAXNAME);
814 
815  st->create = graph_create;
816  st->free = graph_free;
817  st->init = graph_init;
818  st->duplicate = graph_duplicate;
819  st->operatortypes = graphedit_operatortypes;
820  st->keymap = graphedit_keymap;
821  st->listener = graph_listener;
822  st->refresh = graph_refresh;
823  st->id_remap = graph_id_remap;
824  st->space_subtype_item_extend = graph_space_subtype_item_extend;
825  st->space_subtype_get = graph_space_subtype_get;
826  st->space_subtype_set = graph_space_subtype_set;
827 
828  /* regions: main window */
829  art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
830  art->regionid = RGN_TYPE_WINDOW;
837 
838  BLI_addhead(&st->regiontypes, art);
839 
840  /* regions: header */
841  art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
842  art->regionid = RGN_TYPE_HEADER;
843  art->prefsizey = HEADERY;
848 
849  BLI_addhead(&st->regiontypes, art);
850 
851  /* regions: channels */
852  art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
854  /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */
855  art->prefsizex = 200 + V2D_SCROLL_WIDTH;
861 
862  BLI_addhead(&st->regiontypes, art);
863 
864  /* regions: UI buttons */
865  art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
866  art->regionid = RGN_TYPE_UI;
872 
873  BLI_addhead(&st->regiontypes, art);
874 
876 
877  art = ED_area_type_hud(st->spaceid);
878  BLI_addhead(&st->regiontypes, art);
879 
881 }
typedef float(TangentPoint)[2]
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct SpaceGraph * CTX_wm_space_graph(const bContext *C)
Definition: context.c:887
void BKE_fcurves_free(ListBase *list)
Definition: fcurve.c:86
@ ID_REMAP_APPLY_DEFAULT
IDRemapperApplyResult BKE_id_remapper_apply(const struct IDRemapper *id_remapper, struct ID **r_id_ptr, IDRemapperApplyOptions options)
#define BKE_ST_MAXNAME
Definition: BKE_screen.h:53
void BKE_spacetype_register(struct SpaceType *st)
Definition: screen.c:391
void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:60
void void void void void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src) ATTR_NONNULL(1
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:466
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
Definition: math_color.c:49
void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
Definition: math_color.c:232
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
Definition: math_vector.c:29
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
Definition: rct.c:417
unsigned int uint
Definition: BLI_sys_types.h:67
#define ARRAY_SIZE(arr)
#define UNUSED(x)
#define ELEM(...)
@ ADS_FILTER_ONLYSEL
@ SACTSNAP_FRAME
@ FCURVE_COLOR_AUTO_RGB
@ FCURVE_COLOR_AUTO_RAINBOW
@ FCURVE_COLOR_CUSTOM
@ FCURVE_COLOR_AUTO_YRGB
Object groups, one object can be in many groups at once.
#define SCER_PRV_RANGE
#define MAXFRAMEF
#define HEADERY
@ RGN_TYPE_CHANNELS
@ RGN_TYPE_UI
@ RGN_TYPE_WINDOW
@ RGN_TYPE_HEADER
@ RGN_ALIGN_BOTTOM
@ RGN_ALIGN_LEFT
@ RGN_ALIGN_TOP
@ RGN_ALIGN_RIGHT
@ SPACE_GRAPH
@ SIPO_MODE_DRIVERS
@ SIPO_MODE_ANIMATION
@ SIPO_DRAWTIME
@ SIPO_NODRAWCURSOR
@ SIPO_SELVHANDLESONLY
@ SIPO_SHOW_MARKERS
@ SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC
@ SIPO_RUNTIME_FLAG_NEED_CHAN_SYNC_COLOR
@ SIPO_RUNTIME_FLAG_TWEAK_HANDLES_RIGHT
@ SIPO_RUNTIME_FLAG_TWEAK_HANDLES_LEFT
@ USER_HEADER_BOTTOM
@ V2D_SCROLL_LEFT
@ V2D_SCROLL_HORIZONTAL_HIDE
@ V2D_SCROLL_VERTICAL_HIDE
@ V2D_SCROLL_TOP
@ V2D_SCROLL_VERTICAL_HANDLES
@ V2D_SCROLL_RIGHT
@ V2D_SCROLL_BOTTOM
@ V2D_SCROLL_HORIZONTAL_HANDLES
@ ANIMFILTER_DATA_VISIBLE
Definition: ED_anim_api.h:292
@ ANIMFILTER_NODUPLIS
Definition: ED_anim_api.h:325
@ ANIMFILTER_FCURVESONLY
Definition: ED_anim_api.h:328
@ DRAW_MARKERS_MARGIN
Definition: ED_markers.h:28
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:729
@ ED_KEYMAP_UI
Definition: ED_screen.h:691
@ ED_KEYMAP_ANIMATION
Definition: ED_screen.h:695
@ ED_KEYMAP_HEADER
Definition: ED_screen.h:697
@ ED_KEYMAP_VIEW2D
Definition: ED_screen.h:694
@ ED_KEYMAP_FRAMES
Definition: ED_screen.h:696
void ED_region_header(const struct bContext *C, struct ARegion *region)
void ED_region_do_msg_notify_tag_redraw(struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val)
void ED_region_panels(const struct bContext *C, struct ARegion *region)
struct ARegionType * ED_area_type_hud(int space_type)
void ED_region_panels_init(struct wmWindowManager *wm, struct ARegion *region)
Definition: area.c:3153
void ED_region_tag_redraw(struct ARegion *region)
Definition: area.c:655
void ED_region_header_init(struct ARegion *region)
Definition: area.c:3417
void ED_area_tag_refresh(ScrArea *area)
Definition: area.c:758
#define REGION_DRAW_POST_VIEW
Definition: ED_space_api.h:62
void ED_region_draw_cb_draw(const struct bContext *C, struct ARegion *region, int type)
#define REGION_DRAW_PRE_VIEW
Definition: ED_space_api.h:64
void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset)
void immUnbindProgram(void)
void immVertex2f(uint attr_id, float x, float y)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
GPUVertFormat * immVertexFormat(void)
void immBegin(GPUPrimType, uint vertex_len)
void immEnd(void)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:20
@ GPU_SHADER_2D_UNIFORM_COLOR
Definition: GPU_shader.h:201
@ GPU_BLEND_NONE
Definition: GPU_state.h:60
@ GPU_BLEND_ALPHA
Definition: GPU_state.h:62
void GPU_blend(eGPUBlend blend)
Definition: gpu_state.cc:39
void GPU_line_width(float width)
Definition: gpu_state.cc:158
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
Read Guarded memory(de)allocation.
#define C
Definition: RandGen.cpp:25
#define UI_SIDEBAR_PANEL_WIDTH
Definition: UI_interface.h:242
#define UI_DPI_FAC
Definition: UI_interface.h:305
void UI_GetThemeColor3fv(int colorid, float col[3])
Definition: resources.c:1165
@ TH_BACK
Definition: UI_resources.h:39
@ TH_CFRAME
Definition: UI_resources.h:97
@ TH_SCROLL_TEXT
Definition: UI_resources.h:279
@ TH_AXIS_Y
Definition: UI_resources.h:301
@ TH_AXIS_X
Definition: UI_resources.h:300
@ TH_AXIS_Z
Definition: UI_resources.h:302
void UI_ThemeClearColor(int colorid)
Definition: resources.c:1448
void UI_SetTheme(int spacetype, int regionid)
Definition: resources.c:1045
void UI_view2d_draw_lines_y__values(const struct View2D *v2d)
void UI_view2d_region_reinit(struct View2D *v2d, short type, int winx, int winy)
Definition: view2d.cc:217
#define V2D_SCROLL_WIDTH
Definition: UI_view2d.h:55
void UI_view2d_view_restore(const struct bContext *C)
void UI_view2d_view_orthoSpecial(struct ARegion *region, struct View2D *v2d, bool xaxis)
Definition: view2d.cc:1122
#define UI_TIME_SCRUB_MARGIN_Y
Definition: UI_view2d.h:450
void UI_view2d_view_ortho(const struct View2D *v2d)
void UI_view2d_draw_lines_x__frames_or_seconds(const struct View2D *v2d, const struct Scene *scene, bool display_seconds)
void UI_view2d_scrollers_draw(struct View2D *v2d, const struct rcti *mask_custom)
@ V2D_COMMONVIEW_LIST
Definition: UI_view2d.h:38
@ V2D_COMMONVIEW_CUSTOM
Definition: UI_view2d.h:34
void UI_view2d_draw_scale_y__values(const struct ARegion *region, const struct View2D *v2d, const struct rcti *rect, int colorid)
#define ND_SEQUENCER
Definition: WM_types.h:385
#define NC_WINDOW
Definition: WM_types.h:325
#define NC_ID
Definition: WM_types.h:345
#define NC_NODE
Definition: WM_types.h:344
#define ND_OB_ACTIVE
Definition: WM_types.h:388
#define ND_RENDER_OPTIONS
Definition: WM_types.h:383
#define NC_ANIMATION
Definition: WM_types.h:338
#define NC_SCREEN
Definition: WM_types.h:327
#define ND_OB_SELECT
Definition: WM_types.h:390
#define NC_SCENE
Definition: WM_types.h:328
#define ND_MODIFIER
Definition: WM_types.h:411
#define NA_EDITED
Definition: WM_types.h:523
#define ND_SPACE_GRAPH
Definition: WM_types.h:475
#define ND_FRAME_RANGE
Definition: WM_types.h:399
#define ND_MARKERS
Definition: WM_types.h:381
#define ND_FRAME
Definition: WM_types.h:382
#define ND_BONE_ACTIVE
Definition: WM_types.h:408
#define ND_TRANSFORM
Definition: WM_types.h:405
#define ND_LAYER
Definition: WM_types.h:398
#define ND_KEYS
Definition: WM_types.h:412
#define NA_RENAME
Definition: WM_types.h:527
#define ND_BONE_SELECT
Definition: WM_types.h:409
#define ND_KEYFRAME
Definition: WM_types.h:442
#define NC_OBJECT
Definition: WM_types.h:329
#define ND_ANIMCHAN
Definition: WM_types.h:444
#define NC_SPACE
Definition: WM_types.h:342
#define NA_SELECTED
Definition: WM_types.h:528
void ANIM_animdata_freelist(ListBase *anim_data)
Definition: anim_deps.c:397
void ANIM_sync_animchannels_to_data(const bContext *C)
Definition: anim_deps.c:259
void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width)
Definition: anim_draw.c:79
void ANIM_draw_framerange(Scene *scene, View2D *v2d)
Definition: anim_draw.c:113
bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
Definition: anim_filter.c:379
size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_Flags filter_mode, void *data, eAnimCont_Types datatype)
Definition: anim_filter.c:3447
void getcolor_fcurve_rainbow(int cur, int tot, float out[3])
void ED_markers_draw(const bContext *C, int flag)
Definition: anim_markers.c:535
unsigned int U
Definition: btGjkEpa3.h:78
Scene scene
uint pos
uint col
void graph_buttons_register(ARegionType *art)
void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region)
Definition: graph_draw.c:1385
void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region)
Definition: graph_draw.c:1297
void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, short sel)
Definition: graph_draw.c:1344
void graphedit_keymap(struct wmKeyConfig *keyconf)
Definition: graph_ops.c:508
void graphedit_operatortypes(void)
Definition: graph_ops.c:417
void get_graph_keyframe_extents(struct bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax, bool do_sel_only, bool include_handles)
Definition: graph_view.c:43
DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_dupallocN)(const void *vmemh)
Definition: mallocn.c:28
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
static void area(int d1, int d2, int e1, int e2, float weights[2])
static const pxr::TfToken st("st", pxr::TfToken::Immortal)
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
Definition: rna_access.c:112
void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
Definition: rna_define.c:4465
const EnumPropertyItem rna_enum_space_graph_mode_items[]
Definition: rna_space.c:181
static void graph_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, const struct IDRemapper *mappings)
Definition: space_graph.c:775
static void graph_channel_region_draw(const bContext *C, ARegion *region)
Definition: space_graph.c:341
static void graph_refresh(const bContext *C, ScrArea *area)
Definition: space_graph.c:730
static void graph_main_region_draw_overlay(const bContext *C, ARegion *region)
Definition: space_graph.c:292
static void graph_region_listener(const wmRegionListenerParams *params)
Definition: space_graph.c:393
static void graph_channel_region_init(wmWindowManager *wm, ARegion *region)
Definition: space_graph.c:319
void ED_spacetype_ipo(void)
Definition: space_graph.c:807
static void graph_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
Definition: space_graph.c:367
static SpaceLink * graph_duplicate(SpaceLink *sl)
Definition: space_graph.c:155
static int graph_space_subtype_get(ScrArea *area)
Definition: space_graph.c:788
static void graph_main_region_init(wmWindowManager *wm, ARegion *region)
Definition: space_graph.c:169
static void graph_header_region_draw(const bContext *C, ARegion *region)
Definition: space_graph.c:372
static void graph_space_subtype_item_extend(bContext *UNUSED(C), EnumPropertyItem **item, int *totitem)
Definition: space_graph.c:800
static void graph_listener(const wmSpaceTypeListenerParams *params)
Definition: space_graph.c:529
static void graph_free(SpaceLink *sl)
Definition: space_graph.c:122
static void graph_space_subtype_set(ScrArea *area, int value)
Definition: space_graph.c:794
static void graph_main_region_draw(const bContext *C, ARegion *region)
Definition: space_graph.c:182
static void graph_refresh_fcurve_colors(const bContext *C)
Definition: space_graph.c:608
static void graph_buttons_region_init(wmWindowManager *wm, ARegion *region)
Definition: space_graph.c:378
static void graph_buttons_region_draw(const bContext *C, ARegion *region)
Definition: space_graph.c:388
static void graph_init(struct wmWindowManager *wm, ScrArea *area)
Definition: space_graph.c:137
static SpaceLink * graph_create(const ScrArea *UNUSED(area), const Scene *scene)
Definition: space_graph.c:52
static void graph_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
Definition: space_graph.c:459
void(* draw)(const struct bContext *C, struct ARegion *region)
Definition: BKE_screen.h:151
void(* message_subscribe)(const wmRegionMessageSubscribeParams *params)
Definition: BKE_screen.h:167
void(* draw_overlay)(const struct bContext *C, struct ARegion *region)
Definition: BKE_screen.h:159
void(* listener)(const wmRegionListenerParams *params)
Definition: BKE_screen.h:165
int keymapflag
Definition: BKE_screen.h:208
void(* init)(struct wmWindowManager *wm, struct ARegion *region)
Definition: BKE_screen.h:147
ListBase handlers
short alignment
short regiontype
int color_mode
float color[3]
int array_index
Definition: DNA_ID.h:368
void * first
Definition: DNA_listBase.h:31
struct StructRNA * type
Definition: RNA_types.h:37
struct RenderData r
struct bDopeSheet * ads
SpaceGraph_Runtime runtime
ListBase regionbase
short keeptot
float max[2]
float min[2]
short scroll
struct bDopeSheet * ads
Definition: ED_anim_api.h:79
short datatype
Definition: ED_anim_api.h:62
void * data
Definition: ED_anim_api.h:60
struct bAnimListElem * next
Definition: ED_anim_api.h:127
ListBase chanbase
struct Collection * filter_grp
float xmax
Definition: DNA_vec_types.h:69
float xmin
Definition: DNA_vec_types.h:69
float ymax
Definition: DNA_vec_types.h:70
float ymin
Definition: DNA_vec_types.h:70
unsigned int data
Definition: WM_types.h:308
unsigned int action
Definition: WM_types.h:308
unsigned int category
Definition: WM_types.h:308
struct wmKeyConfig * defaultconf
struct wmWindow * winactive
void ED_time_scrub_draw_current_frame(const ARegion *region, const Scene *scene, bool display_seconds)
void ED_time_scrub_channel_search_draw(const bContext *C, ARegion *region, bDopeSheet *dopesheet)
void ED_time_scrub_draw(const ARegion *region, const Scene *scene, bool display_seconds, bool discrete_frames)
wmEventHandler_Keymap * WM_event_add_keymap_handler_v2d_mask(ListBase *handlers, wmKeyMap *keymap)
wmEventHandler_Keymap * WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
PointerRNA * ptr
Definition: wm_files.c:3480
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition: wm_keymap.c:852
void WM_msg_subscribe_rna_params(struct wmMsgBus *mbus, const wmMsgParams_RNA *msg_key_params, const wmMsgSubscribeValue *msg_val_params, const char *id_repr)
void WM_msg_subscribe_rna(struct wmMsgBus *mbus, PointerRNA *ptr, const PropertyRNA *prop, const wmMsgSubscribeValue *msg_val_params, const char *id_repr)
Scene * WM_window_get_active_scene(const wmWindow *win)
Definition: wm_window.c:2183