Fix no canvas resources interface set on a preset
requested to merge tymond/krita:tiar/fix_setting_resource_interface_for_gradient_tip_brushes into master
Before this commit, presets with gradient brush tips wouldn't work
correctly because the gradient was null, because the canvas resources
interface would be null (see
KisBrushOptionProperties::readOptionSettingResourceImpl
where it attempts to set a gradient, but doesn't do it if the interface
is null).
This commit sets the canvas resources interface to the preset
before it can be selected as the current preset, which makes it
possible to set a gradient.
Course of action that led to empty interface
(to get a crash log, put an assert in
KisBrushOptionProperties::readOptionSettingResourceImpl
)
- KisPaintopBox::setCurrentPaintop
- KisCanvasResourceProvider::setPaintOpPreset
- (this commit adds setting the interface here)
- KoResourceManager::setResource
- KoResourceManager::notifyResourceChangeAttempted
- KoResourceManager::notifyDerivedResourcesChangeAttempted
- KoDerivedResourceConverter::readFromSource
- KisSizeResourceConverter::fromSource
- KisBrushBasedPaintOpSettings::paintOpSize
- KisBrushBasedPaintOpSettings::brush
- BrushReader::BrushReader
- KisPaintopPropertiesCanvasResourcesBase::readOptionSetting
- KisBrushOptionProperties::readOptionSettingResourceImpl
- (here would be the assert, but without it, it just never goes to the 13. step. This commit fixes it so it can reach it).
- KisBrush::setGradient
https://bugs.kde.org/show_bug.cgi?id=446088
Test Plan
- Select for example
m)_RGBA_06_Rock.kpp
brush preset. - Change the brush tip option from Lightness Map to Gradient.
- See that before this MR it would paint in red, and after this MR, it would paint in the current color (since the default gradient is foreground to transparent). If you change the gradient to be more interesting, it will also change in the brush. So, finally it works! :)
Formalities Checklist
-
I confirmed this builds. -
I confirmed Krita ran and the relevant functions work. -
I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!) -
I made sure my commits build individually and have good descriptions as per KDE guidelines. -
I made sure my code conforms to the standards set in the HACKING file. -
I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Agata Cacko