Bug 476472 - Merging a non-animated layer into an animated one only works for the first two frames
Summary: Merging a non-animated layer into an animated one only works for the first tw...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Animation (show other bugs)
Version: 5.2.1
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: regression, release_blocker
Depends on:
Blocks:
 
Reported: 2023-11-02 15:01 UTC by paleh
Modified: 2023-11-03 15:48 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
video recording of the bug (245.28 KB, video/webm)
2023-11-03 11:37 UTC, paleh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description paleh 2023-11-02 15:01:45 UTC
STEPS TO REPRODUCE
1. Create a paint layer with 3 or more frames
2. Add a layer above, draw something on this layer
3. In the animation timeline docker select the third (or any further) frame
4. Merge down the layer created in step 2 into the animated one

OBSERVED RESULT
The contents of the non animated layer disappear.

EXPECTED RESULT
The non animated layer is merged into the frame selected in step 3.

SOFTWARE/OS VERSIONS
Linux: Ubuntu 22.04
Qt Version: 5.15.7
Appimage
Comment 1 Dmitry Kazakov 2023-11-03 08:28:08 UTC
Hi, paleh!

The merging behavior of the non-animated layers has changed in Krita 5.2.1. Now non-animated layer is now merged into the **current frame** instead of **all the frames**. This change has been requested by multiple reports that users accidentally destroyed their images by merging a copy-pasted layer into all the frames. 

Could you recheck if your layer from step 2 has actually been merged into the current frame?

PS:
To emulate the old behavior just create a single frame at the zero position of the layer from step 2. Then the layer becomes an "animated" one and merged using the "animated" strategy.
Comment 2 paleh 2023-11-03 09:37:27 UTC
Hi, Dmitry, I've reported the bug precisely after going through the commits to see what's new in 5.2.1 and trying it out for myself. Have you tried reproducing the bug and were unable to? I do confirm that, when merged on frame >= 3, the non-animated layer's pixels disappear (on all the frames) instead of getting merged into the animated one, as I stated in the report. But maybe I'm misunderstanding and you're asking for something else? Or maybe I wasn't clear in the report?
Comment 3 paleh 2023-11-03 09:52:39 UTC
Oh, I should add that the bug is present in 5.2.1 (release version on krita.org) but not on master (5.3.0-7258fce19ce).
Comment 4 paleh 2023-11-03 10:04:13 UTC
Sorry, disregard my previous comment, it does also happen on 5.3. It's just that there's some order of selecting frames when the merging happens as expected (into the current frame), but I can't figure out what it is.
Comment 5 paleh 2023-11-03 11:37:26 UTC
Created attachment 162839 [details]
video recording of the bug

Here's the screen capture of me reproducing the bug. I've noticed two more things:
- there's some non-determinism involved - sometimes the merger happens correctly, and sometimes it happens on an incorrect frame (once the non-animated layer got merged into frame 2 when I was merging it on frame 3, but I couldn't reproduce that). The most common scenario is the one I'm showing here, when the top layer disappears.
- I couldn't reproduce the bug on the windows version with wine
Comment 6 Dmitry Kazakov 2023-11-03 14:46:56 UTC
New info was added
Comment 7 Dmitry Kazakov 2023-11-03 15:20:17 UTC
Hi, paleh!

Thank you for the video. It seems like the frame can randomly be merged into a wrong keyframe on the layer below.
Comment 8 Dmitry Kazakov 2023-11-03 15:48:16 UTC
Git commit f6cd27df77bb6b919ccdf2a9023e75a79d4b9f44 by Dmitry Kazakov.
Committed on 03/11/2023 at 16:48.
Pushed by dkazakov into branch 'master'.

Fix a race condition when merging non-animatied layer over an animated one

M  +7    -1    libs/image/kis_layer_utils.cpp

https://invent.kde.org/graphics/krita/-/commit/f6cd27df77bb6b919ccdf2a9023e75a79d4b9f44
Comment 9 Dmitry Kazakov 2023-11-03 15:48:32 UTC
Git commit f819e294268d94a8f0f8833a2c7263624db2c604 by Dmitry Kazakov.
Committed on 03/11/2023 at 16:48.
Pushed by dkazakov into branch 'krita/5.2'.

Fix a race condition when merging non-animatied layer over an animated one

M  +7    -1    libs/image/kis_layer_utils.cpp

https://invent.kde.org/graphics/krita/-/commit/f819e294268d94a8f0f8833a2c7263624db2c604