From cc3e808ab47887c002faaa8a28318a2b4f47e02a Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Tue, 23 Jun 2020 13:17:31 +0200 Subject: Animation: Only update timeline header during playback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- source/blender/editors/screen/screen_ops.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 4b4287722ba..b7af353a606 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -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; } -- cgit v1.2.3