<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>476514</bug_id>
          
          <creation_ts>2023-11-03 16:27:08 +0000</creation_ts>
          <short_desc>Flattening a layer detaches its clones</short_desc>
          <delta_ts>2024-09-16 12:31:56 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>krita</product>
          <component>Layer Stack</component>
          <version>5.2.1</version>
          <rep_platform>Ubuntu</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="paleh">paleh21669</reporter>
          <assigned_to name="Dmitry Kazakov">dimula73</assigned_to>
          <cc>dimula73</cc>
          
          <cf_commitlink>https://invent.kde.org/graphics/krita/-/commit/49c4395642ef9a4b6239aa5209404d1746b9fcc9</cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2263324</commentid>
    <comment_count>0</comment_count>
    <who name="paleh">paleh21669</who>
    <bug_when>2023-11-03 16:27:08 +0000</bug_when>
    <thetext>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&apos;re not talking about merging together two layers, one of which has a clone, but about flattening a container, which doesn&apos;t change the projection and thus doesn&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2263340</commentid>
    <comment_count>1</comment_count>
    <who name="Dmitry Kazakov">dimula73</who>
    <bug_when>2023-11-03 17:06:09 +0000</bug_when>
    <thetext>We have some kind of functionality for that in `KisImageLayerRemoveCommandImpl::Private::processClones` but it is not used in flattening.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2354760</commentid>
    <comment_count>2</comment_count>
    <who name="Dmitry Kazakov">dimula73</who>
    <bug_when>2024-09-16 12:27:02 +0000</bug_when>
    <thetext>Git commit 979965d84c56d118baa9825eebd4d32b3a72d2a7 by Dmitry Kazakov.
Committed on 16/09/2024 at 12:10.
Pushed by dkazakov into branch &apos;master&apos;.

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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2354763</commentid>
    <comment_count>3</comment_count>
    <who name="Dmitry Kazakov">dimula73</who>
    <bug_when>2024-09-16 12:31:56 +0000</bug_when>
    <thetext>Git commit 49c4395642ef9a4b6239aa5209404d1746b9fcc9 by Dmitry Kazakov.
Committed on 16/09/2024 at 12:31.
Pushed by dkazakov into branch &apos;krita/5.2&apos;.

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</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>