Update the brush settings area if there are no presets present in the preset list
AbandonedPublic

Authored by scottpetrovic on Jul 6 2017, 1:06 PM.

Details

Reviewers
rempt
dkazakov
Summary

This is to help in the situation where we have no presets for an engine and we want to make one for it. It forces the right settings area to load the new engine settings.

Test Plan

I don't have any new engines, but I can just change a tag filter or search criteria to easily get into this "no presets shown" state.

It only work when changing engines.

  1. change to deevad-8-2 tag (which has no presets assigned)
  2. Change the brush engine filter to various engines
  3. Watch the settings area on the right get updated with the correct engine

The brush name doesn't seem to update in the brush editor, but it does update in the status bar. If you are saving a new brush, it might not be that big of a deal.

Diff Detail

Repository
R37 Krita
Lint
Lint Skipped
Unit
Unit Tests Skipped
scottpetrovic created this revision.Jul 6 2017, 1:06 PM

it looks like Григорий Танцевов got his watercolor preset made while using this patch. Not sure how urgent this patch is now, but it would probably be good to still use if there aren't any issues with it.

dkazakov requested changes to this revision.Jul 9 2017, 9:32 AM

Hi, @scottpetrovic!

There are two problems actually:

  1. If I remove default preset for the chalk paintop engine, then Krita just crashes on start. You can also test it by removing the default presets from the installation directory, they lay in: $INSTALL_DIR/share/krita/defaultpresents/:
(gdb) bt
#0  KoResource::name (this=this@entry=0x0) at /home/devel5/kde-src/krita2/libs/pigment/resources/KoResource.cpp:117
#1  0x00007ffff3405e81 in KisPaintOpPreset::paintOp (this=0x0) at /home/devel5/kde-src/krita2/libs/image/brushengine/kis_paintop_preset.cpp:110
#2  0x00007ffff77c60e6 in KisPaintOpPresetsPopup::currentPresetChanged (this=0xf1802d0, preset=...) at /home/devel5/kde-src/krita2/libs/ui/widgets/kis_paintop_presets_popup.cpp:592
#3  0x00007ffff76bf7ae in KisPaintopBox::slotCanvasResourceChanged (this=0xf1063e0, key=345681743, value=...) at /home/devel5/kde-src/krita2/libs/ui/kis_paintop_box.cc:820
#4  0x00007ffff797768f in KisPaintopBox::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>)
    at /home/devel5/kde-build/krita2/libs/ui/moc_kis_paintop_box.cpp:232
#5  0x00007ffff5c8b951 in QMetaObject::activate(QObject*, int, int, void**) () from /home/devel5/kde-install/krita2-deps/lib/libQt5Core.so.5
#6  0x00007ffff2ae1c53 in KoCanvasResourceManager::canvasResourceChanged (this=<optimized out>, _t1=345681743, _t2=...) at /home/devel5/kde-build/krita2/libs/flake/moc_KoCanvasResourceManager.cpp:152
#7  0x00007ffff5c8ba04 in QMetaObject::activate(QObject*, int, int, void**) () from /home/devel5/kde-install/krita2-deps/lib/libQt5Core.so.5
#8  0x00007ffff2ae1d83 in KoResourceManager::resourceChanged (this=this@entry=0xef22d80, _t1=_t1@entry=345681743, _t2=...) at /home/devel5/kde-build/krita2/libs/flake/moc_KoResourceManager_p.cpp:136
#9  0x00007ffff29849f1 in KoResourceManager::notifyResourceChanged (this=this@entry=0xef22d80, key=key@entry=345681743, value=...) at /home/devel5/kde-src/krita2/libs/flake/KoResourceManager_p.cpp:74
#10 0x00007ffff298505a in KoResourceManager::setResource (this=0xef22d80, key=key@entry=345681743, value=...) at /home/devel5/kde-src/krita2/libs/flake/KoResourceManager_p.cpp:67
#11 0x00007ffff2987859 in KoCanvasResourceManager::setResource (this=<optimized out>, key=key@entry=345681743, value=...) at /home/devel5/kde-src/krita2/libs/flake/KoCanvasResourceManager.cpp:58
#12 0x00007fffda4119d3 in TextTool::textEditingPluginContainer (this=this@entry=0x108182a0) at /home/devel5/kde-src/krita2/plugins/flake/textshape/TextTool.cpp:1074
#13 0x00007fffda417adf in TextTool::TextTool (this=0x108182a0, canvas=0x1076d8d8) at /home/devel5/kde-src/krita2/plugins/flake/textshape/TextTool.cpp:177
#14 0x00007fffda421341 in TextToolFactory::createTool (this=<optimized out>, canvas=0x1076d8d8) at /home/devel5/kde-src/krita2/plugins/flake/textshape/TextToolFactory.cpp:44
#15 0x00007ffff29eb005 in ToolHelper::createTool (this=this@entry=0xfed690, canvas=<optimized out>) at /home/devel5/kde-src/krita2/libs/flake/KoToolManager_p.cpp:121
#16 0x00007ffff29ecc52 in KoToolManager::createTools (this=0x7ffff2d431c0 <_ZZN12_GLOBAL__N_116Q_QGS_s_instance13innerFunctionEvE6holder>, controller=controller@entry=0x1076d8b0, tool=0xfed690)
    at /home/devel5/kde-src/krita2/libs/flake/KoToolManager.cpp:412
#17 0x00007ffff29edc82 in KoToolManager::Private::createCanvasData (this=this@entry=0xee5a5b0, controller=0x1076d8b0, device=...) at /home/devel5/kde-src/krita2/libs/flake/KoToolManager.cpp:488
#18 0x00007ffff29f1359 in KoToolManager::Private::attachCanvas (this=0xee5a5b0, controller=controller@entry=0x1076d8b0) at /home/devel5/kde-src/krita2/libs/flake/KoToolManager.cpp:786
#19 0x00007ffff29f189e in KoToolManager::addController (this=0x7ffff2d431c0 <_ZZN12_GLOBAL__N_116Q_QGS_s_instance13innerFunctionEvE6holder>, controller=controller@entry=0x1076d8b0)
    at /home/devel5/kde-src/krita2/libs/flake/KoToolManager.cpp:276
#20 0x00007ffff78f88c0 in KisView::setViewManager (this=this@entry=0x1076ce80, view=<optimized out>) at /home/devel5/kde-src/krita2/libs/ui/KisView.cpp:326
#21 0x00007ffff78cc64b in KisMainWindow::showView (this=0xed72540, imageView=0x1076ce80) at /home/devel5/kde-src/krita2/libs/ui/KisMainWindow.cpp:551
#22 0x00007ffff78c8aa2 in KisMainWindow::addView (this=this@entry=0xed72540, view=0x1076ce80) at /home/devel5/kde-src/krita2/libs/ui/KisMainWindow.cpp:538
#23 0x00007ffff78c8b8f in KisMainWindow::addViewAndNotifyLoadingCompleted (this=0xed72540, document=0x1071ed20) at /home/devel5/kde-src/krita2/libs/ui/KisMainWindow.cpp:802
#24 0x00007ffff78e3d98 in KisPart::startCustomDocument (this=<optimized out>, doc=<optimized out>) at /home/devel5/kde-src/krita2/libs/ui/KisPart.cpp:481
  1. When all the deafult presets are present and the user switches like you explained in the Test Plan, there is an inconsistent behavior:
    1. When the current tag has some presets, then the right side of the dialog is not switched to the engine
    2. When the current tag doesn't have any presets, then the right side switches.

That is quite inconsistent and can make the user a bit angry. I would propose not to switch the pane automatically, but instead show some "Default Preset" item in the filtered list. That is a bit disputable of course, but after all your refactorings, I guess having a "Default Preset" in the left-side selector might be a natural move we could make.

This revision now requires changes to proceed.Jul 9 2017, 9:32 AM

I think you are explaining a much larger issue that goes on with the brush presets in general. You are right that with removing default presets, Krita cannot start. It has issues in Krita stable as well once you start messing with things directly inside the installation directory. The brush preset management doesn't handle things well when there are no KPP files present. In some cases when Krita starts, it just says it cannot find any presets and will now close.

I originally created this patch by request because of a programmer dilemma. If we want to create a new brush engine (like watercolor), there needs to be a preset. Presets are usually created in Krita, but krita has a hard time managing things where there are no existing or default presets. There is no "create watercolor preset" type button. So you have to configure settings or make certain selections to get in a state to make a first preset. It is not the most intuitive -- I agree.

We really need to sit down with artists and see how they want to manage presets in these situations. I am pretty sure deevad likes to wipe out the normal preset and use his own. This would of course create problems, so I imagine he has to do some trickery to get it working right.

rempt edited edge metadata.Jul 18 2017, 10:23 AM

There are two kinds of default presets: the ones from krita/plugins/paintops/defaultpreset, and those probably should be put in a qrc file and always loaded with Krita. It's what you get when you press default in the brush editor. And then there are the presets we ship by default, and those should all be deletable, from the user's point of view.

scottpetrovic abandoned this revision.Dec 22 2017, 1:33 PM

This hack is not needed any more with another patch that was done. Abandoning