Consolidate create brushtip dialogs

The predefined brushtip chooser's create stamp/clipboard brush widgets are merged into a single class, KisCustomBrushWidget, and a single button, "Create New".

There's now a "Source" combobox to choose between using the image and the clipboard. The source paint device(s) are cached and only update when changing the source, switching to animated mode, or clicking the new "Reload" button next to the "Source", to prevent accidental changes. That also prevents the clipboard paste source dialog from reappearing every time something changes. It also uses the currently active image when reloading now; previously the active image would only change when reopening the brush editor.

The dialog has been made non-modal, so the user can interact with the canvas while it's open. A new instance of the dialog is made when clicking the button rather than keeping the same one around.

KisCustomBrushWidget now embeds the .gbr/.gih brush export widget, KisWdgOptionsBrush, and calls the .gbr/.gih export function, rather than duplicating these. The brushtip is saved to a temporarily file and then imported, since the resource importer won't import from the resource folder.

As a result of this de-duplication, the .gbr/.gih export dialog gained the preserve alpha setting, and the custom brushtip dialog gained the dimensions/ranks settings and the velocity animated mode.

The brush export widget now shows the number of frames when exporting as animated.

custombrushtip-beforeafter2-fs8

Also, pasting image files works correctly without a Krita clip in the clipboard; it just needed to check KisClipboard::hasImage() instead of hasClip().

BUG:505280

Issues:

  • Safe asserts when creating nodes in slotAddPredefined() SAFE ASSERT (krita): "!m_d->parent || !parent" in file /libs/image/kis_paint_device.cc, line 1196. Probably doing something wrong when caching the paint devices?
  • Importing the brushtip warns Could not open "~/Library/Application Support/krita/brushes/test.gih" for reading for some reason (the import still works)

Test Plan

Test everything...

  • Test "Create New" in the Brush Editor's Predefined brushtip tab.
  • Test File->Export as .gbr and .gih.

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.
  • Does the patch add a user-visible feature? If yes, is there a documentation MR ready for it at Krita Documentation Repository?

Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.

Merge request reports

Loading
Loading