Commit e9f34a0e authored by Boudewijn Rempt's avatar Boudewijn Rempt

Don't add selections masks to the projection

Add the first of any selection masks that are children of the projection
to the parent at the end of adding all the other child nodes. Otherwise
it won't be seen as the global selection.

BUG:408963
(cherry picked from commit 23a48da3c40102198eadf53a5e28e578841a68e5)
parent 32c42605
......@@ -630,10 +630,19 @@ KisNodeSP KisKraLoader::loadNodes(const KoXmlElement& element, KisImageSP image,
if (node.isElement()) {
// See https://bugs.kde.org/show_bug.cgi?id=408963, where there is a selection mask that is a child of the
// the projection. That needs to be treated as a global selection, so we keep track of those.
vKisNodeSP topLevelSelectionMasks;
if (node.nodeName().toUpper() == LAYERS.toUpper() || node.nodeName().toUpper() == MASKS.toUpper()) {
for (child = node.lastChild(); !child.isNull(); child = child.previousSibling()) {
KisNodeSP node = loadNode(child.toElement(), image);
if (node) {
if (node && parent.data() == image->rootLayer().data() && node->inherits("KisSelectionMask") && image->rootLayer()->childCount() > 0) {
topLevelSelectionMasks << node;
continue;
}
if (node ) {
image->nextLayerName(); // Make sure the nameserver is current with the number of nodes.
image->addNode(node, parent);
if (node->inherits("KisLayer") && KoXml::childNodesCount(child) > 0) {
......@@ -641,6 +650,9 @@ KisNodeSP KisKraLoader::loadNodes(const KoXmlElement& element, KisImageSP image,
}
}
}
if (!topLevelSelectionMasks.isEmpty()) {
image->addNode(topLevelSelectionMasks.first(), parent);
}
}
}
}
......
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