Implement SeExpr reusable scripts
Closed, ResolvedPublic

Description

Today, I pushed a first approach to bundling reusable scripts. (https://invent.kde.org/graphics/krita/-/commit/2d564eec6b0a3503d7671c69c10d18f8901934b9?merge_request_iid=380)

The current implementation is based on Anna Medonosová's work on gamut masks. It uses a Zip container with extension .kse and MIME type application/x-krita-seexpr-script.
There are two files inside: preview.png (that is used as the KoResource image) and script.se (a plaintext file whose contents are used as the expression to render).

UX-wise, it looks like this:

Since there's no way yet to create these bundles inside Krita, I'm opening this task to gather feedback on how this would work.

To kickstart the review, I present you this mock workflow, with some bits of the brush preset dialogs.

I'd add a name field, and detection for dirty presets. Two small buttons for saving the new preset and overwriting the original.

This one is very similar to the brush's; the thumbnail is a QImage (not a paintable area).

I'd want to add a "Render script to thumbnail" button that would render the script to a 512x512 texture, but I don't know yet how to manufacture a pseudo-paint device from said widget.

Feel free to comment!

lsegovia triaged this task as Normal priority.
tymond added a subscriber: tymond.Jun 25 2020, 11:55 AM

I can't find the option to comment on a picture like it's possible on Phabricator mockups, and the option to comment on the image drives me insane with it being both sensitive to arrow clicks and not saving what I wanted to comment, so clicking an arrow (to move through the text) just discarded everything I wanted to say... :/

Anyway. On the third picture: I think it would be better to place those buttons horizontally, vertical space is too precious to waste it.

On fourth picture:

  • you can probably throw away "Load Scratchpad Thumbnail", "Load from Icon Library" and "Clear Thumbnail" (because this is for clearing to paint on it). I don't get "Load Existing Thumbnail" - I guess this is for when you overwrite/copy an existing preset, right? I guess if you model your resources work on brush presets, that's what you got :) So this option is fine, I guess.
  • Render Script to Thumbnail - yes, that's really something that should be there :) And making it happen shouldn't be too difficult either. Just create a new paint device with sRGB (this is easy), fill it with the script (this depends on how you implemented filling, I guess, but I hope you have the possibility to fill a custom paint device or it's not too difficult to add it), then convert to QImage (there is a function for that, so again it's easy), then change the QImage on the widget and make sure to save it with the preset.