Commit 0355e1ab authored by Agata Cacko's avatar Agata Cacko

Fix converting lonely layer to selection mask

When you have only one layer in the image, you can still convert it
into a mask: filter mask, selection mask or transparency mask.
In case of filter and transparency masks, a new layer was created.
Before this commit, converting to selection mask caused Krita to enter
a state where there was no layers in Layers docker.
This commit makes sure that converting a lonely layer into a selection
mask will trigger creating new layer as well.

Note that the added check is important because the root layer allows
selection mask to be its child because of Global Selection Mask (that
was also the reason why only the selection mask worked the way it
worked) - that's why Krita needs to check the parent node explicitely
for being a root.

BUG:385853
parent b30b3b89
......@@ -109,7 +109,8 @@ void KisMaskManager::adjustMaskPosition(KisNodeSP node, KisNodeSP activeNode, bo
if (!avoidActiveNode && activeNode->allowAsChild(node)) {
parent = activeNode;
above = activeNode->lastChild();
} else if (activeNode->parent() && activeNode->parent()->allowAsChild(node)) {
} else if (activeNode->parent() && activeNode->parent()->allowAsChild(node)
&& activeNode->parent()->parent() /* we don't want to add masks to root */) {
parent = activeNode->parent();
above = activeNode;
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment