Adding a Collapsible Footer Bar to the Graph Editor

Can someone please direct me to a good code example for adding a footer bar at the bottom of the Graph Editor with collapsing behavior to the status bar? I would like to also add a button similar to the one for the User Prefs’ Header [^].

Would it be best to go by space_statusbar.c?

/* regions: footer */
  art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
  art->regionid = RGN_TYPE_UI;
  art->prefsizey = 0.8f * HEADERY;
  art->listener = graph_footer_listener;
  art->init = graph_footer_region_init;
  art->draw = graph_footer_region_draw;


Thank you!

The text and spreadsheet editors have footers, those are better examples. The window status bar is an entire editor by itself, it’s quite different.

1 Like

Thank you!

So, following the Text Editor footer examples (1 & 2), I am adding the following to space_graph.c

SpaceLine *graph_create()

  /* footer */
  region = MEM_callocN(sizeof(ARegion), "footer for graphedit");
  BLI_addtail(&sipo->regionbase, region);
  region->regiontype = RGN_TYPE_FOOTER;
  region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM;


  /* regions: footer */
  art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
  art->regionid = RGN_TYPE_FOOTER;
  art->prefsizey = HEADERY;
  art->init = graph_header_region_init;
  art->draw = graph_header_region_draw;
  BLI_addhead(&st->regiontypes, art);

I’m not getting any errors, but I’m also not seeing anything in the Graph Editor. I haven’t worked with the draw code in C before. Can you please let me know what I need to do to see my Footer region? Thank you!

Nevermind, I think it’s working. I had to create a new Editor window and make it a Graph Editor. There is still an issue: the context menu for the Text Editor shows a checkbox while the Graph Editor’s is text-only:

How can I show the checkbox instead? I looked in, but didn’t see anything about the Footer. I am also getting this error:

uiItemR: property not found: SpaceGraphEditor.show_region_footer

Searching show_region_footer takes me to rna_def_space_generic_show_region_toggles, which will need to be adjusted for the graph editor.

1 Like

Thank you very much! I saw rna_def_space_generic_show_region_toggles on searching, but didn’t realize it was being called per space. It’s working now :smile:

Nice! Glad to help :slight_smile:

1 Like

The create() callback will not be called for existing editors that are saved and loaded from files. Neither is it when opening an editor that was open in that area (basically the sub-window rectangle containing the editors) before, where we just re-activate an editor. It’s only called when an editor is opened for the first time in an area.

To add the footer to editors stored in files, you have to write versioning code. Best search for do_versions_add_region_if_not_found() and see how that’s used.