Commit c1a43435 authored by Wolthera van Hövell's avatar Wolthera van Hövell 🛍

Brush Settings: Try a bit harder to select the default paintop

This is for creating a brus from scratch. Old code only changes the engine,
new code tries to first check if there's a default preset, and if not, then
change the engine. This leads to less 'randomness'.
parent 97a034fd
......@@ -808,10 +808,18 @@ void KisPaintopBox::slotInputDeviceChanged(const KoInputDevice& inputDevice)
void KisPaintopBox::slotCreatePresetFromScratch(QString paintop)
{
slotSetPaintop(paintop); // change the paintop settings area and update the UI
m_presetsPopup->setCreatingBrushFromScratch(true); // disable UI elements while creating from scratch
KisPaintOpPresetSP preset = m_resourceProvider->currentPreset();
//First try to select an available default preset for that engine. If it doesn't exist, then
//manually set the engine to use a new preset.
KoID id(paintop, KisPaintOpRegistry::instance()->get(paintop)->name());
KisPaintOpPresetSP preset = defaultPreset(id);
if (!preset) {
slotSetPaintop(paintop); // change the paintop settings area and update the UI
m_presetsPopup->setCreatingBrushFromScratch(true); // disable UI elements while creating from scratch
preset = m_resourceProvider->currentPreset();
} else {
m_resourceProvider->setPaintOpPreset(preset);
preset->setOptionsWidget(m_optionWidget);
}
m_presetsPopup->resourceSelected(preset.data()); // this helps update the UI on the brush editor
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment