Bug 441865

Summary: "Switch to Previous Preset" changes brush's opacity accidentally
Product: [Applications] krita Reporter: Yu-Hsuan Lai <raincolee>
Component: ToolsAssignee: Eoin O'Neill <eoinoneill1991>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73, eoinoneill1991, hesap6817, ss93078
Priority: NOR Keywords: regression, release_blocker
Version First Reported In: 5.0.0-beta1   
Target Milestone: ---   
Platform: Compiled Sources   
OS: All   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Yu-Hsuan Lai 2021-09-01 13:07:50 UTC
SUMMARY
"Switch to Previous Preset" changes brush's opacity accidentally if transform tool is activated. It can be reliably reproduced (see below).

STEPS TO REPRODUCE
1. Activate freehand brush tool
2. Select built-in brush "c)_Pencil-3_Large_4B"
3. Select built-in brush "a)_Eraser_Small"
4. Select built-in brush "c)_Pencil-3_Large_4B" again
5. Activate transform tool
6. Execute "Switch to Previous Preset" action
7. Activate freehand brush tool

OBSERVED RESULT
"a)_Eraser_Small" is the active brush, and its opacity is changed from 100 to 15

EXPECTED RESULT
"a)_Eraser_Small" is the active brush, and its opacity remains 100

SOFTWARE/OS VERSIONS
Krita

 Version: 5.0.0-beta1
 Languages: en_US, en
 Hidpi: true

Qt

  Version (compiled): 5.12.11
  Version (loaded): 5.12.11

OS Information

  Build ABI: x86_64-little_endian-llp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: winnt
  Kernel Version: 10.0.22000
  Pretty Productname: Windows 10 (10.0)
  Product Type: windows
  Product Version: 10

ADDITIONAL INFORMATION
Comment 1 Protoniv 2021-12-03 02:09:14 UTC
*** Bug 444360 has been marked as a duplicate of this bug. ***
Comment 2 Eoin O'Neill 2021-12-03 21:01:35 UTC
Git commit dc9bcf9374182c43cbac746593ddc0410a834d4f by Eoin O'Neill.
Committed on 03/12/2021 at 20:57.
Pushed by eoinoneill into branch 'master'.

Fix bug where previous_preset invocation in non-paint tool would
erroneously keep the old opacity values when switching back to
a paint tool.

We need to keep track of the preset when we reactivate tool_paint
to ensure that we are switching back to the same tool and are
interested in restoring any opacity changes from before.

M  +5    -2    libs/ui/tool/kis_tool_paint.cc
M  +1    -0    libs/ui/tool/kis_tool_paint.h

https://invent.kde.org/graphics/krita/commit/dc9bcf9374182c43cbac746593ddc0410a834d4f
Comment 3 Protoniv 2021-12-03 23:48:52 UTC
*** Bug 438346 has been marked as a duplicate of this bug. ***
Comment 4 Eoin O'Neill 2021-12-08 23:58:53 UTC
Git commit 1e88fb2434ac74704ef4398655d4e449d800a7a1 by Eoin O'Neill.
Committed on 08/12/2021 at 23:58.
Pushed by eoinoneill into branch 'krita/5.0'.

Fix bug where previous_preset invocation in non-paint tool would
erroneously keep the old opacity values when switching back to
a paint tool.

We need to keep track of the preset when we reactivate tool_paint
to ensure that we are switching back to the same tool and are
interested in restoring any opacity changes from before.
(cherry picked from commit dc9bcf9374182c43cbac746593ddc0410a834d4f)

M  +5    -2    libs/ui/tool/kis_tool_paint.cc
M  +1    -0    libs/ui/tool/kis_tool_paint.h

https://invent.kde.org/graphics/krita/commit/1e88fb2434ac74704ef4398655d4e449d800a7a1