Bug 374386

Summary: Invalid composite op/color space combinations are reachable
Product: [Applications] krita Reporter: Nicholas LaPointe <nicholaslapointe8>
Component: UsabilityAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73, halla, o-din13
Priority: NOR    
Version: 3.1.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nicholas LaPointe 2016-12-31 09:47:48 UTC
When composite ops are incompatible with the color space they will affect, they get disabled. However, it is still possible to select invalid combinations in some situations.

The first method to reproduce this involves inconsistent behavior depending on how layers are selected:
1. Create an RGB document with two layers. Convert "Layer 2" to CMYK. It is currently possible to select invalid blending modes for the CMYK layer in both the brush blending mode and the layer blending mode drop-down menus.
2. Click on "Layer 1", then click "Layer 2". It is still possible to use the invalid modes.
3. From "Layer 2", use page-down, then page-up. The invalid modes are now disabled.
4. Click "Layer 1". All modes are enabled for the RGB layer, even though clicking didn't disable any modes for the CMYK layer.

The second method is simpler:
1. Create an RGB document.
2. Set the brush blending mode to "Color HSV" (not available in CMYK).
3. Close the document.
4. Create a new CMYK document. The mode didn't get reset to a safe value.
Comment 1 Nicholas LaPointe 2016-12-31 09:52:42 UTC
I just noticed that, from step 3 in the first method, all blending modes will be enabled if an empty spot in the layers docker is clicked.
Comment 2 Halla Rempt 2017-01-03 11:34:57 UTC
At least if the blending mode is inconsistent, a warning flag is shown :-)
Comment 3 Nicholas LaPointe 2017-04-25 11:37:08 UTC
*** Bug 376723 has been marked as a duplicate of this bug. ***
Comment 4 Dmitry Kazakov 2020-08-20 20:46:57 UTC
Okay, the first method is "expected behavior", because all blending happens in the color space of the parent layer, that is a parent group layer. And all group layers in Krita work in the color space of the image. It means that if the image is RGB, but the layer is CMYK, all RGB modes will still be available.

The second method is not reproducible anymore. I think I've fixed that yesterday.

There is also the third way to reproduce that (which is a real bug): calling Image->Convert Image Color Space doesn't update composite op availability. I will fix that.
Comment 5 Dmitry Kazakov 2020-08-20 21:00:16 UTC
Git commit 53a17bfb34c058392f9c9eeb524b97c0de4e1296 by Dmitry Kazakov.
Committed on 20/08/2020 at 20:59.
Pushed by dkazakov into branch 'krita/4.3'.

Fix layers docker not updating blendmode availability on image cs change

Blending modes available to the layer depend on the color space of the
parent layer (that is the color space where actual blending happens).
Therefore we should connect updateUI to the color space change of the
parent layer.

WARNING: in Krita **all** group layers have the color space of the image,
         you cannot convert them into any specific color space. That is
         a wish-bug that can be fixed.

M  +2    -6    libs/image/kis_group_layer.cc
M  +4    -1    libs/image/kis_selection_based_layer.cpp
M  +15   -4    plugins/dockers/layerdocker/LayerBox.cpp
M  +2    -0    plugins/dockers/layerdocker/LayerBox.h

https://invent.kde.org/graphics/krita/commit/53a17bfb34c058392f9c9eeb524b97c0de4e1296
Comment 6 Dmitry Kazakov 2020-08-20 21:10:43 UTC
Git commit a5520d17e4962555246f9a01cc3494aa4aa24a7a by Dmitry Kazakov.
Committed on 20/08/2020 at 21:02.
Pushed by dkazakov into branch 'master'.

Fix layers docker not updating blendmode availability on image cs change

Blending modes available to the layer depend on the color space of the
parent layer (that is the color space where actual blending happens).
Therefore we should connect updateUI to the color space change of the
parent layer.

WARNING: in Krita **all** group layers have the color space of the image,
         you cannot convert them into any specific color space. That is
         a wish-bug that can be fixed.

# Conflicts:
#	plugins/dockers/layerdocker/LayerBox.h

M  +2    -6    libs/image/kis_group_layer.cc
M  +4    -1    libs/image/kis_selection_based_layer.cpp
M  +15   -4    plugins/dockers/layerdocker/LayerBox.cpp
M  +2    -0    plugins/dockers/layerdocker/LayerBox.h

https://invent.kde.org/graphics/krita/commit/a5520d17e4962555246f9a01cc3494aa4aa24a7a