Bug 409949 - Clone layers cannot copy contents from pass-through group layers
Summary: Clone layers cannot copy contents from pass-through group layers
Status: CONFIRMED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (show other bugs)
Version: 4.2.2
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-18 11:43 UTC by Andrei Alexeyev
Modified: 2019-09-21 12:09 UTC (History)
2 users (show)

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


Attachments
Test script (928 bytes, text/x-python)
2019-07-18 11:43 UTC, Andrei Alexeyev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Alexeyev 2019-07-18 11:43:31 UTC
Created attachment 121605 [details]
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'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'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)->"alphamap"->"base mask group"->"variant mask", which refers to the group layer (root)->"variant", failing to update its contents when (root)->"variant"->"defeated" becomes visible, in spite of the refreshProjection() call. This problem occurs in the GUI as well, though the behavior seems to be more inconsistent.
Comment 1 Dmitry Kazakov 2019-09-19 19:21:33 UTC
The problem happens because layers "variant" "defeated" 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'll check if it is actually possible to implement such copying technically.
Comment 2 Dmitry Kazakov 2019-09-20 09:47:37 UTC
Git commit a0caf30f820581733b65b5b97d1641560531ad46 by Dmitry Kazakov.
Committed on 20/09/2019 at 09:47.
Pushed by dkazakov into branch 'master'.

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'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 "projection plane" and "projection leaf" 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
Comment 3 Dmitry Kazakov 2019-09-20 09:47:37 UTC
Git commit a2a1b600423be2b9ebf545d5bb89ede49c245748 by Dmitry Kazakov.
Committed on 20/09/2019 at 09:47.
Pushed by dkazakov into branch 'master'.

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
Comment 4 Dmitry Kazakov 2019-09-20 09:48:47 UTC
Okay, the user feedback is added. Now I'll downgrade this bug to a "wishlist". Perhaps one day we will implement cloning of pass-through nodes.
Comment 5 Dmitry Kazakov 2019-09-21 12:09:08 UTC
Git commit f78b6082f5c03d88fce513947f81901e6f31a1d4 by Dmitry Kazakov.
Committed on 21/09/2019 at 10:07.
Pushed by dkazakov into branch 'krita/4.2'.

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'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 "projection plane" and "projection leaf" 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