Animation: Only update timeline header during playback

The header of all SPACE_ACTIONs are tagged for redraw. Only when the
action editor is showing the timeline it is needed. No noticeable
performance increase. But better to save some CPU cycles.

Reviewed By: Sybren Stüvel

Differential Revision: https://developer.blender.org/D8074
This commit is contained in:
Jeroen Bakker 2020-06-23 13:17:31 +02:00 committed by Jeroen Bakker
parent 072a224a28
commit cc3e808ab4
Notes: blender-bot 2023-02-14 07:39:44 +01:00
Referenced by issue #79619, Sequencer window not updating whilst playing animation
Referenced by issue #78176, Sequencer renders playhead line twice
Referenced by issue #75124, ActionEditor: Keyframes Drawing
1 changed files with 7 additions and 3 deletions

View File

@ -4281,11 +4281,12 @@ static bool screen_animation_region_supports_time_follow(eSpace_Type spacetype,
(spacetype == SPACE_CLIP && regiontype == RGN_TYPE_PREVIEW);
}
static bool match_region_with_redraws(eSpace_Type spacetype,
static bool match_region_with_redraws(const ScrArea *area,
eRegionType regiontype,
eScreen_Redraws_Flag redraws,
bool from_anim_edit)
{
const eSpace_Type spacetype = area->spacetype;
if (regiontype == RGN_TYPE_WINDOW) {
switch (spacetype) {
@ -4352,7 +4353,10 @@ static bool match_region_with_redraws(eSpace_Type spacetype,
}
else if (regiontype == RGN_TYPE_HEADER) {
if (spacetype == SPACE_ACTION) {
return true;
/* The timeline shows the current frame in the header. Other headers
* don't need to be updated. */
SpaceAction *saction = (SpaceAction *)area->spacedata.first;
return saction->mode == SACTCONT_TIMELINE;
}
}
else if (regiontype == RGN_TYPE_PREVIEW) {
@ -4581,7 +4585,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv
redraw = true;
}
else if (match_region_with_redraws(
area->spacetype, region->regiontype, sad->redraws, sad->from_anim_edit)) {
area, region->regiontype, sad->redraws, sad->from_anim_edit)) {
redraw = true;
}