Bug 456463 - [GMIC/Stylise] Krita inverts the way layer are sorted for GMIC between 5.0.x and 5.1betas
Summary: [GMIC/Stylise] Krita inverts the way layer are sorted for GMIC between 5.0.x ...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Unclassified
Component: G'Mic for Krita (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: amyspark
URL:
Keywords:
Depends on: 454516
Blocks:
  Show dependency treegraph
 
Reported: 2022-07-07 22:09 UTC by David REVOY
Modified: 2022-07-10 13:42 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David REVOY 2022-07-07 22:09:54 UTC
Hi, 
I recently made many landscape from photo using the GMIC filter "stylise". It's an amazing filter that apply the style of a picture into another one. For that, this filter require two input layers: the "target photo" and the "style".  I saw in recent 5.1beta, the layer are inverted and it makes working with this filter more difficult (and also impossible to make a tutorial about it).

To reproduce:
===========
Resources:
- Download the castle "target photo" : https://upload.wikimedia.org/wikipedia/commons/e/e8/Neuschwanstein_Castle_LOC_print_rotated.jpg (CC0/public domain)
- Download the watercolor "style" : https://upload.wikimedia.org/wikipedia/commons/thumb/f/f1/Cox-Jnr-98092_-_Hever_Castle_-_circa_1850.jpg/1280px-Cox-Jnr-98092_-_Hever_Castle_-_circa_1850.jpg  (CC0/public domain)

1. Open the "target photo" in Krita.
2. Drag'n'Drop the "style" file over the canvas, and insert it as a paint layer.
3. Select the layer of the bottom "Background" with the "target photo"
4. Call Filter > GMIC panel, and apply filter Artistic > Stylise
5. In "Input Layer" (bottom of the filter options) select All (or other options).

Result (with short videos showing it):
==============================
* For 5.0.5 : https://www.peppercarrot.com/extras/temp/2022-07-07_23-34-31_krita50x_styliseGMIC.mp4  → The "Target Photo" (Background Layer selected/active) is registerd by GMIC as the target image, and the "style" is also the top layer watercolor. The filter works fine.
* For 5.1beta2 : https://www.peppercarrot.com/extras/temp/2022-07-07_23-34-31_krita51beta2_styliseGMIC.mp4 → The "Style" will be registered by GMIC as the target of the effect, and the bottom layer (the castle) will be registered as the "style". This is inverted and unexpected.

Expected:
========
Having "Input Layers: All" working as on 5.0.x, or geting the option "Active and Below" and "Active and Above" working so it is possible to setup the "target photo" and the "style" more easily and less randomly.

Hardware and Spec:
================
2022-07-07_14h35__krita-5.1.0-beta2-683fd6b90b-x86_64.appimage
Fedora 36 KDE. Mesa 
GPU: AMD ATI Radeon RX 5500/5500M / Pro 5500M
CPU: AMD Ryzen 7 3700X (16) @ 3.600GHz
VM: Kwin/X11
DE: KDE Plasma 5.24.5
Krita Version: 5.1.0-beta1
Qt version compiled: 5.12.12, loaded: 5.12.12.
Comment 1 David REVOY 2022-07-07 22:17:33 UTC
ERRATUM
→ Video for  5.1beta2 : https://www.peppercarrot.com/extras/temp/2022-07-07_23-37-30_krita51beta2_styliseGMIC.mp4
(both video are the same on previous post, it's an upload and filenaming issue on my side, sorry, I can't edit.)
Comment 2 Bug Janitor Service 2022-07-08 01:07:23 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1509
Comment 3 amyspark 2022-07-10 13:41:02 UTC
Git commit 4555c6ee2d605e4cc298ba6d0cfc3375ddcf62af by L. E. Segovia.
Committed on 10/07/2022 at 13:39.
Pushed by lsegovia into branch 'master'.

G'MIC: stack images when returning the list

The use of recursiveApplyNodes, introduced in
ca0d473bcd570f0332458b296efce25bf6344631 as part of the refactor that
enabled the rest of the input modes, missed a significant subtlety of
the layer enumeration: recursiveApplyNodes works top-down, while
G'MIC expects layers to be sorted bottom-up.

M  +7    -7    plugins/extensions/qmic/kis_qmic_import_tools.cpp

https://invent.kde.org/graphics/krita/commit/4555c6ee2d605e4cc298ba6d0cfc3375ddcf62af
Comment 4 amyspark 2022-07-10 13:42:04 UTC
Git commit 09d1d958fb76a2d7635b6b6f92696c6c7555809a by L. E. Segovia.
Committed on 10/07/2022 at 13:41.
Pushed by lsegovia into branch 'krita/5.1'.

G'MIC: stack images when returning the list

The use of recursiveApplyNodes, introduced in
ca0d473bcd570f0332458b296efce25bf6344631 as part of the refactor that
enabled the rest of the input modes, missed a significant subtlety of
the layer enumeration: recursiveApplyNodes works top-down, while
G'MIC expects layers to be sorted bottom-up.
(cherry picked from commit 4555c6ee2d605e4cc298ba6d0cfc3375ddcf62af)

M  +7    -7    plugins/extensions/qmic/kis_qmic_import_tools.cpp

https://invent.kde.org/graphics/krita/commit/09d1d958fb76a2d7635b6b6f92696c6c7555809a