<?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>409949</bug_id>
          
          <creation_ts>2019-07-18 11:43:31 +0000</creation_ts>
          <short_desc>Clone layers cannot copy contents from pass-through group layers</short_desc>
          <delta_ts>2019-09-21 12:09:08 +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>4.2.2</version>
          <rep_platform>openSUSE</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CONFIRMED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>wishlist</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Andrei Alexeyev">akari</reporter>
          <assigned_to name="Krita Bugs">krita-bugs-null</assigned_to>
          <cc>dimula73</cc>
    
    <cc>halla</cc>
          
          <cf_commitlink></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>1869710</commentid>
    <comment_count>0</comment_count>
      <attachid>121605</attachid>
    <who name="Andrei Alexeyev">akari</who>
    <bug_when>2019-07-18 11:43:31 +0000</bug_when>
    <thetext>Created attachment 121605
Test script

Projection updates are actually all kinds of broken, apparently. Described in the summary is just a case that happened to completely ruin my workflow. This is a big deal for me, because it makes batch exports unreliable.

Attached is a script that demonstrates the issue. It&apos;s a very simplified version of my actual export script, and is meant to be used with this document (too big to attach): https://akari.alienslab.net/krita-bug/cirno.kra


STEPS TO REPRODUCE
1. $ PYTHONPATH=. kritarunner -s export_alphamaps cirno.kra
2. Grab a coffee, it&apos;s really slow.
3. Find the files `alphamap_normal.png` and `alphamap_defeated.png` in the working directory.
4. Open and compare them.


OBSERVED RESULT
The exported images are identical.


EXPECTED RESULT
The exported images must differ slightly. This is what `alphamap_defeated.png` is supposed to look like: https://akari.alienslab.net/krita-bug/alphamap_defeated_correct.png


SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.16.2
KDE Frameworks Version: 5.59.0
Qt Version: 5.13.0


ADDITIONAL INFORMATION
This particular problem is caused by the clone layer (root)-&gt;&quot;alphamap&quot;-&gt;&quot;base mask group&quot;-&gt;&quot;variant mask&quot;, which refers to the group layer (root)-&gt;&quot;variant&quot;, failing to update its contents when (root)-&gt;&quot;variant&quot;-&gt;&quot;defeated&quot; becomes visible, in spite of the refreshProjection() call. This problem occurs in the GUI as well, though the behavior seems to be more inconsistent.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1881020</commentid>
    <comment_count>1</comment_count>
    <who name="Dmitry Kazakov">dimula73</who>
    <bug_when>2019-09-19 19:21:33 +0000</bug_when>
    <thetext>The problem happens because layers &quot;variant&quot; &quot;defeated&quot; use Pass-through mode. Clone layers just copy the projection of the source layers, but pass-through nodes cannot have any projection by definition. I&apos;ll check if it is actually possible to implement such copying technically.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1881173</commentid>
    <comment_count>2</comment_count>
    <who name="Dmitry Kazakov">dimula73</who>
    <bug_when>2019-09-20 09:47:37 +0000</bug_when>
    <thetext>Git commit a0caf30f820581733b65b5b97d1641560531ad46 by Dmitry Kazakov.
Committed on 20/09/2019 at 09:47.
Pushed by dkazakov into branch &apos;master&apos;.

Strikethrough (and disable) a clone, whose source is a pass-through group

Clone layers in Krita copy the projection of the source layer (and apply
some effects to it, like offset, masks and etc). But pass-through group
layers don&apos;t have any projection by definition, so clone layers cannot
copy them.

The only way to allow clone layers to copy pass-through groups is to
copy their &quot;projection plane&quot; and &quot;projection leaf&quot; instead of projection
device. But then there will be problems with masks, blending mode
and other funny problems we never thought about.

This patch just disables a clone layer that is connected to a pass-through
group and notifies the user about it by striking-through its name.

M  +24   -4    libs/image/kis_projection_leaf.cpp
M  +9    -1    libs/image/kis_projection_leaf.h
M  +2    -2    libs/ui/kis_node_model.cpp
M  +1    -1    plugins/dockers/animation/timeline_frames_model.cpp

https://invent.kde.org/kde/krita/commit/a0caf30f820581733b65b5b97d1641560531ad46</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1881174</commentid>
    <comment_count>3</comment_count>
    <who name="Dmitry Kazakov">dimula73</who>
    <bug_when>2019-09-20 09:47:37 +0000</bug_when>
    <thetext>Git commit a2a1b600423be2b9ebf545d5bb89ede49c245748 by Dmitry Kazakov.
Committed on 20/09/2019 at 09:47.
Pushed by dkazakov into branch &apos;master&apos;.

Add user explanation about why the mask/clone is disabled

The node tooltip will have an explanation, why the node has been disabled

M  +12   -0    libs/ui/kis_node_model.cpp
M  +5    -0    libs/ui/kis_node_model.h
M  +7    -0    plugins/dockers/layerdocker/NodeToolTip.cpp

https://invent.kde.org/kde/krita/commit/a2a1b600423be2b9ebf545d5bb89ede49c245748</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1881175</commentid>
    <comment_count>4</comment_count>
    <who name="Dmitry Kazakov">dimula73</who>
    <bug_when>2019-09-20 09:48:47 +0000</bug_when>
    <thetext>Okay, the user feedback is added. Now I&apos;ll downgrade this bug to a &quot;wishlist&quot;. Perhaps one day we will implement cloning of pass-through nodes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1881394</commentid>
    <comment_count>5</comment_count>
    <who name="Dmitry Kazakov">dimula73</who>
    <bug_when>2019-09-21 12:09:08 +0000</bug_when>
    <thetext>Git commit f78b6082f5c03d88fce513947f81901e6f31a1d4 by Dmitry Kazakov.
Committed on 21/09/2019 at 10:07.
Pushed by dkazakov into branch &apos;krita/4.2&apos;.

Strikethrough (and disable) a clone, whose source is a pass-through group

Clone layers in Krita copy the projection of the source layer (and apply
some effects to it, like offset, masks and etc). But pass-through group
layers don&apos;t have any projection by definition, so clone layers cannot
copy them.

The only way to allow clone layers to copy pass-through groups is to
copy their &quot;projection plane&quot; and &quot;projection leaf&quot; instead of projection
device. But then there will be problems with masks, blending mode
and other funny problems we never thought about.

This patch just disables a clone layer that is connected to a pass-through
group and notifies the user about it by striking-through its name.

M  +24   -4    libs/image/kis_projection_leaf.cpp
M  +9    -1    libs/image/kis_projection_leaf.h
M  +2    -2    libs/ui/kis_node_model.cpp
M  +1    -1    plugins/dockers/animation/timeline_frames_model.cpp

https://invent.kde.org/kde/krita/commit/f78b6082f5c03d88fce513947f81901e6f31a1d4</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>121605</attachid>
            <date>2019-07-18 11:43:31 +0000</date>
            <delta_ts>2019-07-18 11:43:31 +0000</delta_ts>
            <desc>Test script</desc>
            <filename>export_alphamaps.py</filename>
            <type>text/x-python</type>
            <size>928</size>
            <attacher name="Andrei Alexeyev">akari</attacher>
            
              <data encoding="base64">CmZyb20ga3JpdGEgaW1wb3J0ICoKCgpkZWYgZmluZE5vZGUobm9kZXMsIG5hbWUpOgogICAgZm9y
IG5vZGUgaW4gbm9kZXM6CiAgICAgICAgaWYgbm9kZS5uYW1lKCkgPT0gbmFtZToKICAgICAgICAg
ICAgcmV0dXJuIG5vZGUKCgpkZWYgX19tYWluX18oYXJncyk6CiAgICBrciA9IEtyaXRhLmluc3Rh
bmNlKCkKICAgIGtyLnNldEJhdGNobW9kZShUcnVlKQoKICAgIGRvYyA9IGtyLm9wZW5Eb2N1bWVu
dChhcmdzWzBdKQogICAgZG9jLnNldEJhdGNobW9kZShUcnVlKQoKICAgIHZhcmlhbnRzID0gZmlu
ZE5vZGUoZG9jLnRvcExldmVsTm9kZXMoKSwgJ3ZhcmlhbnQnKQogICAgYWxwaGFtYXA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