Bug 389928

Summary: Saving GIH brush doesn't save the "create mask from color" property
Product: [Applications] krita Reporter: Scott Petrovic <scottpetrovic>
Component: Resource ManagementAssignee: vanyossi <ghevan>
Status: RESOLVED FIXED    
Severity: normal CC: ghevan, halla, ken, mail
Priority: NOR Keywords: triaged
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:

Description Scott Petrovic 2018-02-05 20:28:40 UTC
I am on the nightly builds for Windows. 

I think the issue has to do with saving the GIH brush. The original GIH brushes seemed to load the "create mask from color" ok, but after saving new versions of the GIH brush, this property always seems to be set to false.

Steps:
1. Open a GIH brush in Krita
2. Click Save as and check the "create mask from color" option
3. save brush tip.

Restart Krita and go to brush editor. Select tip. The tip's "create mask from color" option is not checked.
Comment 1 Scott Petrovic 2018-02-05 21:36:00 UTC
If it wasn't clear, in step 2, save as a GIH brush again so it would be replacing the existing file.
Comment 2 Scott Petrovic 2018-02-06 14:27:19 UTC
It looks like the "auto" checkbox and spacing is also not saving/loading right.

Before this is "fixed", we might want to have a discussion on this. With creating all these brushes for 4.0, it is usually undesirable that the spacing, brush size, and use color as mask, is changing every time a tip is changed. Usually changing a tip is because you want to get a different shape. 

It can be a bit annoying when you are experimenting with different tip shapes. One example...you are trying out different tips for a pencil brush. You have the brush size set to small and tight spacing. Every time you switch tips, it increases the brush size a lot and also increases the spacing a lot. You have to constantly readjust the settings every time to see how it compares.

One proposal might be that changing a tip does not change any of the settings. Not sure if there is a use case with why that needs to change when changing the tip.
Comment 3 Scott Petrovic 2018-02-06 15:18:09 UTC
talked with deevad over IRC a bit

deevad: about "size, spacing, rotation" of brush tip ; it's because Krita load the gbr and gih format as brush tips ; and in the design of those tips you can save more than just bitmap tips ; size, spacing, rotation ... 

deevad: But I agree: brush tips ; in a ideal world; would be perfectly just loading a bitmap/vector/shape tip.
Comment 4 Kenneth Evans 2018-11-18 22:58:43 UTC
I was going to submit this as a bug, but this seems to be the same issue.  The bottom line is that GIH files saved in Krita default to not being masks, even if the "Use color as mask" is checked.  This happens with some GDquest brushes as well as my own.  I am on Krita 4.1.5 on Windows.

Here is what I was going to submit.

SUMMARY
Brushes saved as GIH in Krita with "Use color as mask" checked, default to having this unchecked and don't behave as masks when this brush is selected for the tip.  It can be fixed by checking "Use color as mask" for the tip.  However, this has to be rechecked every time you go back to this brush.

This may be a problem with the GIH save in Krita as other brushes which are GIH files do open as masks but have "Use color as mask unchecked", as well).  E.g. bristles_circle_random.  I did not test all the GIH brushes.  I note ones by GDQuest also have this problem.

STEPS TO REPRODUCE
1. Create a GIH file in Krita from, say, the Texture 256x256 Predefined option.
2. Save it as 1 layer Regular or multiple layer Random (either gives the problem), checking the "Use color as mask" option.
3. Import it in the Brush Editor and use it as a tip.

OBSERVED RESULT
Shows white background.  (Can see in the preview.)

EXPECTED RESULT
Acts as a mask.
Comment 5 Kenneth Evans 2018-11-18 23:08:29 UTC
There seems to be more to it than just in saving the GIH.  "Use color as mask" is unchecked for the brushes saved in Krita _and_ the default GIH brushes, but the latter work as masks anyway.
Comment 6 Kenneth Evans 2018-11-19 13:22:24 UTC
There is an additional problem with the GIH save operation in that it asks for the name twice, once in the file selection dialog and again in the following options dialog.  If you neglect to enter the name in the second one, the file is .gih, not what you entered in the file selection dialog. And you don't notice this at the time.

The name in the file selection dialog should be passed to the second dialog.
Comment 7 vanyossi 2019-06-17 04:12:46 UTC
Git commit 2952d53e0c7b53024be3165ac7e41e6751420a96 by Ivan Yossi.
Committed on 17/06/2019 at 04:11.
Pushed by ivany into branch 'master'.

Fix colorAsMaskExport in Gih and Gbr export.

This also makes the predefined chooser remember the toggled state
of useColorAsMaskCheckbox, to reduce clicking when use only wants
to change tip shapes.

M  +17   -7    plugins/impex/brush/kis_brush_export.cpp
M  +3    -1    plugins/paintops/libpaintop/kis_brush_chooser.cpp

https://invent.kde.org/kde/krita/commit/2952d53e0c7b53024be3165ac7e41e6751420a96
Comment 8 Halla Rempt 2019-06-17 08:18:08 UTC
Git commit 6eafe96a1c7d03f97b4004e7e15e9c62dc46dd29 by Boudewijn Rempt, on behalf of Ivan Yossi.
Committed on 17/06/2019 at 08:17.
Pushed by rempt into branch 'krita/4.2'.

Fix colorAsMaskExport in Gih and Gbr export.

This also makes the predefined chooser remember the toggled state
of useColorAsMaskCheckbox, to reduce clicking when use only wants
to change tip shapes.

M  +17   -7    plugins/impex/brush/kis_brush_export.cpp
M  +3    -1    plugins/paintops/libpaintop/kis_brush_chooser.cpp

https://invent.kde.org/kde/krita/commit/6eafe96a1c7d03f97b4004e7e15e9c62dc46dd29