Bug 416793 - API creates broken layer masks
Summary: API creates broken layer masks
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Scripting (other bugs)
Version First Reported In: 4.2.8
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Halla Rempt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-26 16:14 UTC by Kapyia
Modified: 2020-04-17 07:31 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Script to create a mask node (176 bytes, text/plain)
2020-01-26 16:14 UTC, Kapyia
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kapyia 2020-01-26 16:14:29 UTC
Created attachment 125442 [details]
Script to create a mask node

This problem was brought to light thanks to Frohman and tiar over at Krita-Artists.org. There's currently a problem with the libkis API where trying to create a mask node of any kind results in an empty/broken layer mask object. The created node always has the name "effect" (kis_effect_mask.cc, line 27) and has no bounds/size.

From what I can tell, the problem stems from the method 'createNode' in Document.cpp creating mask nodes somewhat incorrectly, resulting in them being "incomplete". On my system it also leads to a crash when I try to make Krita display the mask (eg. trying to isolate the layer).

I've attached a small script that helps reproduce the problem in Krita.
Comment 1 wolthera 2020-01-26 16:43:57 UTC
If tiar and frohman can reproduce it, let's mark it as confirmed.
Comment 2 Halla Rempt 2020-04-15 14:14:33 UTC
Git commit c1e18cedea1e404bc8b1727f22dbe8282d6e1024 by Boudewijn Rempt.
Committed on 15/04/2020 at 14:14.
Pushed by rempt into branch 'master'.

Create masks from python with the given name

The mask itself was fine; but the name wasn't passed through.

M  +2    -2    libs/image/kis_effect_mask.cc
M  +1    -1    libs/image/kis_effect_mask.h
M  +2    -2    libs/image/kis_filter_mask.cpp
M  +1    -1    libs/image/kis_filter_mask.h
M  +1    -1    libs/image/kis_image.cc
M  +1    -1    libs/image/kis_layer_utils.cpp
M  +2    -2    libs/image/kis_selection_mask.cpp
M  +1    -1    libs/image/kis_selection_mask.h
M  +2    -2    libs/image/kis_transform_mask.cpp
M  +2    -2    libs/image/kis_transform_mask.h
M  +2    -2    libs/image/kis_transparency_mask.cc
M  +1    -1    libs/image/kis_transparency_mask.h
M  +3    -2    libs/image/lazybrush/kis_colorize_mask.cpp
M  +1    -1    libs/image/lazybrush/kis_colorize_mask.h
M  +5    -4    libs/libkis/Document.cpp
M  +1    -1    libs/ui/dialogs/kis_dlg_filter.cpp

https://invent.kde.org/kde/krita/commit/c1e18cedea1e404bc8b1727f22dbe8282d6e1024
Comment 3 Halla Rempt 2020-04-17 07:31:52 UTC
Git commit b62d9cdb99adc0cb9e21df80afdeeefbd161cd5a by Boudewijn Rempt.
Committed on 17/04/2020 at 07:22.
Pushed by rempt into branch 'krita/4.3'.

Create masks from python with the given name

The mask itself was fine; but the name wasn't passed through.
(cherry picked from commit c1e18cedea1e404bc8b1727f22dbe8282d6e1024)

M  +2    -2    libs/image/kis_effect_mask.cc
M  +1    -1    libs/image/kis_effect_mask.h
M  +3    -2    libs/image/kis_filter_mask.cpp
M  +1    -1    libs/image/kis_filter_mask.h
M  +1    -1    libs/image/kis_image.cc
M  +1    -1    libs/image/kis_layer_utils.cpp
M  +2    -2    libs/image/kis_selection_mask.cpp
M  +1    -1    libs/image/kis_selection_mask.h
M  +2    -2    libs/image/kis_transform_mask.cpp
M  +2    -2    libs/image/kis_transform_mask.h
M  +2    -2    libs/image/kis_transparency_mask.cc
M  +1    -1    libs/image/kis_transparency_mask.h
M  +3    -2    libs/image/lazybrush/kis_colorize_mask.cpp
M  +1    -1    libs/image/lazybrush/kis_colorize_mask.h
M  +5    -4    libs/libkis/Document.cpp
M  +1    -1    libs/ui/dialogs/kis_dlg_filter.cpp

https://invent.kde.org/kde/krita/commit/b62d9cdb99adc0cb9e21df80afdeeefbd161cd5a