Bug 435281

Summary: Making storyboards is enabled by default
Product: [Applications] krita Reporter: Tiar <tamtamy.tymona>
Component: StoryboardAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Mint (Ubuntu based)   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Tiar 2021-04-02 20:01:35 UTC
SUMMARY
I believe rendering storyboards is enabled by default for all documents, which isn't necessary.

Related: bug 435273 (which is how I discovered it was working even though I wasn't working on an animation).

STEPS TO REPRODUCE
1. Build Krita with this diff:
---
diff --git a/plugins/dockers/storyboarddocker/KisStoryboardThumbnailRenderScheduler.cpp b/plugins/dockers/storyboarddocker/KisStoryboardThumbnailRenderScheduler.cpp
index a94ae54028..9e854c5d32 100644
--- a/plugins/dockers/storyboarddocker/KisStoryboardThumbnailRenderScheduler.cpp
+++ b/plugins/dockers/storyboarddocker/KisStoryboardThumbnailRenderScheduler.cpp
@@ -124,6 +124,7 @@ void KisStoryboardThumbnailRenderScheduler::renderNextFrame()
         return;
     }
 
+    ENTER_FUNCTION() << "Cloning the image" << ppVar(m_changedFramesQueue.size()) << ppVar(m_affectedFramesQueue.size());
     KisImageSP image = m_image->clone(false);
     if (!m_changedFramesQueue.isEmpty()) {
         int frame = m_changedFramesQueue.at(0);
---
over the commit 0f0d0deabb.
2. Open Krita from console.
3. Paint something and wait a moment.

OBSERVED RESULT
There is output:
Entering "KisStoryboardThumbnailRenderScheduler::renderNextFrame()" Cloning the image m_changedFramesQueue.size() = 0 m_affectedFramesQueue.size() = 0
Entering "KisStoryboardThumbnailRenderScheduler::renderNextFrame()" Cloning the image m_changedFramesQueue.size() = 0 m_affectedFramesQueue.size() = 0

EXPECTED RESULT
Storyboard should not start doing anything unless explicity asked to (which also means that it should be "locked" by default, and it doesn't seem to be, even though no new storyboard items appear; probably because of lack of animated layers. But even in case of animation layers it should be locked by default).
Even for animation, most animations are just animations, not storyboards. 
And cloning the image all the time for static images is even less necessary.

NOTE:
Fixing this particular part of the code to not clone the image unnecessarily is easy, however I believe this is just a symptom of the storyboarding system working without being asked to (reacting to signals and whatnot) which can be detrimental to the performance, so I think it needs to properly checked.

So to sum up:
- storyboards should be locked by default
- and when locked, nothing should react to signals, nothing should be doing any work


SOFTWARE/OS VERSIONS
Krita

 Version: 5.0.0-prealpha (git 0f0d0deabb)
 Languages: pl, pl_PL, pl
 Hidpi: true

Qt

  Version (compiled): 5.12.8
  Version (loaded): 5.12.8
Comment 1 Tiar 2021-04-09 17:27:57 UTC
Git commit 5766bca3cca0c312a3115357e7224cb744490abb by Agata Cacko.
Committed on 09/04/2021 at 17:26.
Pushed by tymond into branch 'master'.

Avoid cloning the image unnecessarily in Storyboard scheduler

Before this commit, every time a document encountered idle state,
a KisImage would be cloned. This commit ensures it only happens
when it's needed.

M  +5    -1    plugins/dockers/storyboarddocker/KisStoryboardThumbnailRenderScheduler.cpp

https://invent.kde.org/graphics/krita/commit/5766bca3cca0c312a3115357e7224cb744490abb
Comment 2 Eoin O'Neill 2021-08-03 22:20:13 UTC
Git commit 9f2a61826f646407d36dbbd042bd86def60cb089 by Eoin O'Neill.
Committed on 03/08/2021 at 22:19.
Pushed by eoinoneill into branch 'master'.

Cleanup storyboard background rendering.

Reduced code repitition, added more safety to ensure that frames
were never unnecessarily rendered (when storyboard docker is empty.)

M  +13   -24   plugins/dockers/storyboarddocker/KisStoryboardThumbnailRenderScheduler.cpp

https://invent.kde.org/graphics/krita/commit/9f2a61826f646407d36dbbd042bd86def60cb089