Bug 437071

Summary: Python setHDR Exposure and Gamma don't work
Product: [Applications] krita Reporter: keyth_qcfx2 <keyth2363214>
Component: ScriptingAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 4.4.3   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description keyth_qcfx2 2021-05-14 05:26:23 UTC
SUMMARY
the Python commands setHDRExposure() and setHDRGamma() do not apply any exposure or gamma.


STEPS TO REPRODUCE
1. Open any image
2. Go to LUT Management and activate OpenColorIO and check gamma values if it changes the image then place it back to 1.0
3. Run this basic script inside the scripter plugin
"""
import krita

n = 2

av = Krita.instance().activeWindow().activeView()
av.setHDRGamma(n)
s = av.HDRGamma()
print(s)
"""
4. Image remains unchanged

OBSERVED RESULT
It sets a Gamma value to be used in Krita. When reading the amount of Gamma is it is correctly read the change of amount 2. However no change can be seen on the image itself to reflect it. This is also valid for HDRExposure as it behaves the same.


EXPECTED RESULT
see change to the image after applying a change in Gamma or Exposure to the equivalent value set.


SOFTWARE/OS VERSIONS
Windows: 10
Qt Version: 5.12.9
Comment 1 Halla Rempt 2021-05-14 09:28:17 UTC
Git commit b7380bcedd29bbc9b203cac8ef737ccc144127ee by Halla Rempt.
Committed on 14/05/2021 at 09:27.
Pushed by rempt into branch 'rempt/437071-exposure_gamma'.

Try to keep the lut docker updated when setting exposure/gamma from a script

M  +14   -0    libs/libkis/View.cpp
M  +4    -0    libs/ui/canvas/kis_display_filter.h
M  +2    -0    libs/ui/kis_canvas_resource_provider.cpp
M  +3    -0    libs/ui/kis_canvas_resource_provider.h
M  +9    -0    plugins/dockers/lut/lutdocker_dock.cpp
M  +13   -12   plugins/dockers/lut/ocio_display_filter.h

https://invent.kde.org/graphics/krita/commit/b7380bcedd29bbc9b203cac8ef737ccc144127ee
Comment 2 keyth_qcfx2 2021-05-14 15:24:13 UTC
wow that was so fast. Thank you Halla.

I will keep the code for those commands for the plugin I am trying to make at the moment. I was pondering if I should use it or not or make a update of it later.

Thank you again.
Comment 3 Dmitry Kazakov 2021-05-18 05:44:35 UTC
Git commit 3ba765652091945f50cca1d026e66cad37ee23cb by Dmitry Kazakov.
Committed on 18/05/2021 at 05:42.
Pushed by dkazakov into branch 'rempt/437071-exposure_gamma'.

Fix Gamma/Exposure updates when set via Python scripting

Just use the same interface that keyboard actions use

M  +9    -4    libs/libkis/View.cpp

https://invent.kde.org/graphics/krita/commit/3ba765652091945f50cca1d026e66cad37ee23cb