Bug 499389 - Animation cache not updating after layer opacity change
Summary: Animation cache not updating after layer opacity change
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Animation (other bugs)
Version First Reported In: 5.2.6
Platform: NixOS Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-01 16:55 UTC by cromachina
Modified: 2025-06-20 21:11 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cromachina 2025-02-01 16:55:25 UTC
SUMMARY
If you change a layer’s opacity, the animation cache does not get cleared and displays stale data when playing the animation. Only the currently selected frame’s cache entry is cleared when the opacity slider of the layer is touched. Every other layer property change seems to correctly clear the entire animation cache.

STEPS TO REPRODUCE
1. Make an animation layer with several frames of data.
2. Change the layer’s opacity.

OBSERVED RESULT
The animation cache only clears for the current frame.

EXPECTED RESULT
The animation cache should clear for all frames.

SOFTWARE/OS VERSIONS
Operating System: NixOS 25.05
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1
Kernel Version: 6.6.71 (64-bit)
Graphics Platform: X11
Processors: 24 × AMD Ryzen 9 3900X 12-Core Processor
Memory: 62.7 GiB of RAM
Graphics Processor: AMD Radeon RX 7900 XTX

ADDITIONAL INFORMATION
A quick workaround to get the animation cache to clear would be to change another layer property, like toggling visibility off and on again.
Comment 1 Emmet O'Neill 2025-05-29 22:15:44 UTC
Confirming this, thank you for the report, cromachina.

Note: This bug is referring to a general layer opacity change on any raster animated later, and not animated opacity parameter changes via the curves docker.
Comment 2 Emmet O'Neill 2025-05-29 22:17:12 UTC
Also, a second workaround is to right click on the timing header (the ruler section with the numbers in it above the frame view grid), and select "Clear Cache". This forces the animation cache to be entirely regenerated.
Comment 3 Emmet O'Neill 2025-06-20 21:09:25 UTC
Git commit b7ed819bee73f9f8fc3207dd67154b8a401ce51e by Emmet O'Neill.
Committed on 20/06/2025 at 21:00.
Pushed by emmetoneill into branch 'master'.

BUGFIX: Static opacity changes now properly clear animation cache.

Note: This fix is referring to the changing of the general layer opacity of
a RASTER animated layer, NOT a layer with scalar/curves opacity animation.

This bug fixes an issue where if the user changes the overall layer
opacity of a layer with multiple drawn frames of RASTER animation,
the cache would only be invalidated for 1 of the frames, despite non-animated
layer opacity being something that should apply to all frames equally.

Now chaging the opacity will invalidate the entire animation cache, so that
layer opacity changes will be immediately reflected as expected.

HACK: As noted in the comment, this fix is something of a hack, as the frames
are being invalidated directly within the KisNodeOpacityCommand. A better
fix would be to slightly refactor KisNode::setDirty, KisImage::requestProjectionUpdate,
and/or KisProjectionUpdateFlags, to handle more variations of cache invalidation
behavior.

M  +6    -0    libs/image/commands/kis_node_opacity_command.cpp

https://invent.kde.org/graphics/krita/-/commit/b7ed819bee73f9f8fc3207dd67154b8a401ce51e
Comment 4 Emmet O'Neill 2025-06-20 21:11:33 UTC
Git commit dc8734f1cf8c3d4bcdc2237148279743b6150ae3 by Emmet O'Neill.
Committed on 20/06/2025 at 21:11.
Pushed by emmetoneill into branch 'krita/5.2'.

BUGFIX: Static opacity changes now properly clear animation cache.

Note: This fix is referring to the changing of the general layer opacity of
a RASTER animated layer, NOT a layer with scalar/curves opacity animation.

This bug fixes an issue where if the user changes the overall layer
opacity of a layer with multiple drawn frames of RASTER animation,
the cache would only be invalidated for 1 of the frames, despite non-animated
layer opacity being something that should apply to all frames equally.

Now chaging the opacity will invalidate the entire animation cache, so that
layer opacity changes will be immediately reflected as expected.

HACK: As noted in the comment, this fix is something of a hack, as the frames
are being invalidated directly within the KisNodeOpacityCommand. A better
fix would be to slightly refactor KisNode::setDirty, KisImage::requestProjectionUpdate,
and/or KisProjectionUpdateFlags, to handle more variations of cache invalidation
behavior.
(cherry picked from commit b7ed819bee73f9f8fc3207dd67154b8a401ce51e)

M  +6    -0    libs/image/commands/kis_node_opacity_command.cpp

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