Page MenuHome

Performance: Draw play head as an overlay

Authored by Jeroen Bakker (jbakker) on Thu, Jun 18, 4:34 PM.



When playing back animations a playhead is updated in all the animation editors.
The drawing of the playhead is part of the drawing of the main region RGN_TYPE_WINDOW that redraws the whole region.

This change will draw the play head and window scrollers when updating the screen. This affects the Action editor, Timeline, Graph editor, NLA editor and Sequence editor. There is noticeable speedup when using complex animation files.

Spring 02_020_A.anim.blend fps went from 11.8 to 12.5 when showing a timeline and a action editor on a Ryzen 1700.

This patch relates to D8073 as drawing channel region adds a RGN_DRAW_NO_REBUILD to the RGN_TYPE_WINDOW.

Functional changes

  • When playing back animation the markers don't jump up/down when near the frame. This could be added back.

TODO after commit

  • The NLA editor is redrawn on frame change. But doesn't have to. The cause of this isn't animation playback. it could have been the channel region. Need to retest.
  • Rename region->do_draw_overlay to region->do_draw_paint_cursor to remove naming conflict with draw_overlay

Diff Detail

rB Blender

Event Timeline

Jeroen Bakker (jbakker) requested review of this revision.Thu, Jun 18, 4:34 PM
Jeroen Bakker (jbakker) created this revision.

drawing of all play heads in an display overlay

Jeroen Bakker (jbakker) retitled this revision from [WIP] Fix T75124: Draw action editor current frame as cursor to Performance: Draw play head as an overlay.Fri, Jun 19, 12:59 PM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)

Fixed follow time

Jeroen Bakker (jbakker) planned changes to this revision.Fri, Jun 19, 3:03 PM
This comment was removed by Jeroen Bakker (jbakker).

Updated with latest master

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Fri, Jun 19, 4:18 PM

Seems generally fine.


This could be named draw_overlay, for consistent terminology with region->do_draw_overlay which has the same purpose.

This term of course has a different meaning in the 3D viewport, but maybe that's ok.


Maybe merge this in the paint cursors loop below.

Also for paint cursors there is wmWindowViewport to reset the OpenGL viewport to the whole window. I would guess this is needed for the draw_display case as well.

Brecht Van Lommel (brecht) requested changes to this revision.Fri, Jun 19, 5:19 PM
This revision now requires changes to proceed.Fri, Jun 19, 5:19 PM
Jeroen Bakker (jbakker) marked 2 inline comments as done.

Code review + rebase with master

  • renamed draw_display to draw_overlay
  • merged draw loop with paint cursor.

updated draw_overlay comment


The region->do_draw_overlay isn't connected with draw_overlay but with draw_paint_cursor. IMO we should rename do_draw_overlay to do_draw_paint_cursor for more consistency in a separate commit.


Done, for draw_overlay the wm_region_draw_display resets the window viewport to its original state. Another wmWindowViewport was not needed. This part could be rechecked to reduce gl setup calls that aren't necessary.

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Tue, Jun 23, 8:57 AM
Brecht Van Lommel (brecht) added inline comments.

Sounds good.

This revision is now accepted and ready to land.Tue, Jun 23, 11:32 AM
This revision was automatically updated to reflect the committed changes.