Bug 394199

Summary: Frame flipping behaviour is inconsistent in isolate layer mode for invisible layers.
Product: [Applications] krita Reporter: Bollebib <kwadraatnope>
Component: AnimationAssignee: Emmet O'Neill <emmetoneill.pdx>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73, emmetoneill.pdx, eoinoneill1991
Priority: NOR    
Version: 4.0.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Bollebib 2018-05-13 11:36:49 UTC
invisible layer ->isolate layer

some layers playback or flipping through frames will work fine and as expected

but sometimes playback is blank,and flipping is stuck on a single frame.






13:30:17 - Bollebib_Laptop: there seems to be an issue where if you isolate layer,on invisible layer, this works fine for a single frame
13:30:17 - Bollebib_Laptop: but flipping through the frames,and playback is very inconsistant
13:30:24 - Bollebib_Laptop: sometimes it works,sometimes it doesnt
13:30:35 - karine has left the room (Quit: Leaving).
13:30:52 - Bollebib_Laptop: dmitryK|log: since you worked to solve some isolate layer issues recently i thought i'd mention it
13:31:00 - Bollebib_Laptop: as well as playback issues
Comment 1 Bollebib 2018-05-18 13:29:14 UTC
After talking about it on the sprint

Dmitry found this only happens when onion skin button is activated on the layer


this does not happen on invisible layers with onion skins disabled
It does happen on invisible layers with onion skins enabled
Comment 2 Dmitry Kazakov 2018-05-26 09:25:45 UTC
The problem is a bit more deep than I thought: some of our layers have internal projections and their regeneration is disabled when the layer is invisible. And making the node isolated root doesn't make it officially visible.

The list of layers/functions that activate internal projections and therefore will not work in Invisible+Isolated mode:

1) Layer with onion skins
2) Layer with any mask
3) Clone layer with an offset (changing the source layer will not update isolated and invisible clone)
4) Shape layers


The solution for this bug would be to implement two kinds of "visibility": visibility for "regeneration updates" and "user visibility". But it needs quite a bit of work, because it will introduce some special initializing and final updates when activating/deactivating isolated mode. It needs thinking.
Comment 3 Eoin O'Neill 2020-05-07 21:34:20 UTC
More notes from dmitry:

---------------------------------

afaict, the following should be done:
1) KisProjectionLeaf should override node visibility if the node is exactly the root of the isolation
2) StartIsolatedModeStroke::initStrokeCallback should check if the node->projectionLeaf()->visible() has changed during assignment of the root
if it has changed, updates should be issued
3) These updates should be done with blockUIUpdates set to false (like it is done in KisProcessingApplicator)
4) notifyProjectionUpdatedInPatches() and all the final updates stuff should go into a separate StartIsolatedModeStroke::finishStrokeCallback(), which should be barrier

this->enableJob(JOB_INIT, true, KisStrokeJobData::BARRIER)

5) It might be that

m_node->projectionLeaf()->explicitlyRegeneratePassThroughProjection(); can be replaced with these new updates, but i'm not sure. It should be a separate patch for sure

6) There should also be an optimization, these updates should not be issued for that layers without any internal projections/caches (not listed in my list in the bug). You might want to add some new method to KisBaseNode, like 'hasProjectionsForUpdateWhileHidden()'
for normal layers it should return "this->needProjection()", for KisShapeLayer it shoudl always return true

-------------------------------
Comment 4 Eoin O'Neill 2020-05-12 21:03:53 UTC
Git commit 207c48948edb94f81fc41898ffd6e55c596155ea by Eoin O'Neill.
Committed on 12/05/2020 at 20:57.
Pushed by eoinoneill into branch 'master'.

Fix: Properly Play Animations / Display Onion Skins During Isolation of Hidden Layers

Also correctly shows onion skins during isolation. Also fixes some edge
cases where drawing on isolated layers didn't work properly.

M  +12   -2    libs/image/kis_base_node.cpp
M  +6    -0    libs/image/kis_base_node.h
M  +47   -19   libs/image/kis_image.cc
M  +1    -1    libs/image/kis_layer.cc
M  +2    -1    libs/image/kis_projection_leaf.cpp

https://invent.kde.org/kde/krita/commit/207c48948edb94f81fc41898ffd6e55c596155ea
Comment 5 Eoin O'Neill 2020-05-12 21:12:36 UTC
Git commit 88342ecc54f0ffd9a9cdc9c2da69b4ff33b0f086 by Eoin O'Neill.
Committed on 12/05/2020 at 21:08.
Pushed by eoinoneill into branch 'krita/4.3'.

Fix: Properly Play Animations / Display Onion Skins During Isolation of Hidden Layers

Also correctly shows onion skins during isolation. Also fixes some edge
cases where drawing on isolated layers didn't work properly.
(cherry-picked from master: commit 207c48948edb94f81fc41898ffd6e55c596155ea)

M  +12   -2    libs/image/kis_base_node.cpp
M  +6    -0    libs/image/kis_base_node.h
M  +47   -19   libs/image/kis_image.cc
M  +1    -1    libs/image/kis_layer.cc
M  +2    -1    libs/image/kis_projection_leaf.cpp

https://invent.kde.org/kde/krita/commit/88342ecc54f0ffd9a9cdc9c2da69b4ff33b0f086