Commit 4e564297 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Do not let Node Juggler remove locked layers when pressing Shift+Del too quickly

parent 05a64029
......@@ -1218,6 +1218,19 @@ namespace KisLayerUtils {
return visibleNodes;
}
void filterUnlockedNodes(KisNodeList &nodes)
{
KisNodeList::iterator it = nodes.begin();
while (it != nodes.end()) {
if ((*it)->userLocked()) {
it = nodes.erase(it);
} else {
++it;
}
}
}
void changeImageDefaultProjectionColor(KisImageSP image, const KoColor &color)
{
KisImageSignalVector emitSignals;
......
......@@ -41,6 +41,7 @@ namespace KisLayerUtils
KRITAIMAGE_EXPORT KisNodeList sortMergableNodes(KisNodeSP root, KisNodeList nodes);
KRITAIMAGE_EXPORT void filterMergableNodes(KisNodeList &nodes, bool allowMasks = false);
KRITAIMAGE_EXPORT bool checkIsChildOf(KisNodeSP node, const KisNodeList &parents);
KRITAIMAGE_EXPORT void filterUnlockedNodes(KisNodeList &nodes);
/**
* Returns true if:
......
......@@ -644,6 +644,7 @@ struct RemoveLayers : private KisLayerUtils::RemoveNodeHelper, public KisCommand
void populateChildCommands() override {
KisNodeList filteredNodes = m_nodes;
KisLayerUtils::filterMergableNodes(filteredNodes, true);
KisLayerUtils::filterUnlockedNodes(filteredNodes);
if (filteredNodes.isEmpty()) return;
......
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