Bug 476514 - Flattening a layer detaches its clones
Summary: Flattening a layer detaches its clones
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (show other bugs)
Version: 5.2.1
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-03 16:27 UTC by paleh
Modified: 2024-09-16 12:31 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 paleh 2023-11-03 16:27:08 UTC
SUMMARY
Flattening a layer with masks or merging a group unlinks the clones of this layer. This is different from bug 351577 as here we're not talking about merging together two layers, one of which has a clone, but about flattening a container, which doesn't change the projection and thus doesn't require any update of the clone other than changing its source. Strictly speaking, this could be a feature request, but I find the absence of this unreasonable enough to be considered a bug.

STEPS TO REPRODUCE
1. Create a paint or a group layer.
2. Create a clone of this layer.
3. Flatten or merge the original layer.

OBSERVED RESULT
The clone is no longer linked to anything, regardless of whether the original layer had any children.

EXPECTED RESULT
The clone is linked to the layer that results from flattening/merging.
Comment 1 Dmitry Kazakov 2023-11-03 17:06:09 UTC
We have some kind of functionality for that in `KisImageLayerRemoveCommandImpl::Private::processClones` but it is not used in flattening.
Comment 2 Dmitry Kazakov 2024-09-16 12:27:02 UTC
Git commit 979965d84c56d118baa9825eebd4d32b3a72d2a7 by Dmitry Kazakov.
Committed on 16/09/2024 at 12:10.
Pushed by dkazakov into branch 'master'.

Relink clones to the new layer when flattening

When flattening a layer we can easily relink all the clones of the
source into the new layer.

M  +1    -0    libs/image/CMakeLists.txt
R  +0    -0    libs/image/commands_new/KisChangeCloneLayersCommand.cpp [from: libs/ui/KisChangeCloneLayersCommand.cpp - 100% similarity]
R  +2    -1    libs/image/commands_new/KisChangeCloneLayersCommand.h [from: libs/ui/KisChangeCloneLayersCommand.h - 085% similarity]
M  +25   -4    libs/image/kis_layer_utils.cpp
M  +1    -0    libs/image/kis_layer_utils.h
M  +0    -1    libs/ui/CMakeLists.txt
M  +1    -1    libs/ui/dialogs/KisDlgChangeCloneSource.cpp

https://invent.kde.org/graphics/krita/-/commit/979965d84c56d118baa9825eebd4d32b3a72d2a7
Comment 3 Dmitry Kazakov 2024-09-16 12:31:56 UTC
Git commit 49c4395642ef9a4b6239aa5209404d1746b9fcc9 by Dmitry Kazakov.
Committed on 16/09/2024 at 12:31.
Pushed by dkazakov into branch 'krita/5.2'.

Relink clones to the new layer when flattening

When flattening a layer we can easily relink all the clones of the
source into the new layer.

M  +1    -0    libs/image/CMakeLists.txt
R  +0    -0    libs/image/commands_new/KisChangeCloneLayersCommand.cpp [from: libs/ui/KisChangeCloneLayersCommand.cpp - 100% similarity]
R  +2    -1    libs/image/commands_new/KisChangeCloneLayersCommand.h [from: libs/ui/KisChangeCloneLayersCommand.h - 085% similarity]
M  +25   -4    libs/image/kis_layer_utils.cpp
M  +1    -0    libs/image/kis_layer_utils.h
M  +0    -1    libs/ui/CMakeLists.txt
M  +1    -1    libs/ui/dialogs/KisDlgChangeCloneSource.cpp

https://invent.kde.org/graphics/krita/-/commit/49c4395642ef9a4b6239aa5209404d1746b9fcc9