Commit 8cd5fbb7 authored by Agata Cacko's avatar Agata Cacko

Fix merging layers with not active selection masks

Before this commit, there was an assumption in the merging code
that a layer can have only one selection mask (which can be
gathered using ->selectionMask() function). This caused all non-active
selection mask to disappear during/after the merging.
This commit fixes that behaviour by taking all children of the merged
layer that happen to be KisSelectionMasks into account.

Note: it doesn't mean all of the selection masks will be preserved;
for now only the immediate child nodes of the selected layers are
considered.

BUG:402070
parent d1435c13
......@@ -61,12 +61,13 @@ namespace KisLayerUtils {
void fetchSelectionMasks(KisNodeList mergedNodes, QVector<KisSelectionMaskSP> &selectionMasks)
{
foreach (KisNodeSP node, mergedNodes) {
KisLayerSP layer = qobject_cast<KisLayer*>(node.data());
KisSelectionMaskSP mask;
Q_FOREACH(KisNodeSP child, node->childNodes(QStringList("KisSelectionMask"), KoProperties())) {
if (layer && (mask = layer->selectionMask())) {
selectionMasks.append(mask);
KisSelectionMaskSP mask = qobject_cast<KisSelectionMask*>(child.data());
if (mask) {
selectionMasks.append(mask);
}
}
}
}
......
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