Skip to content
Snippets Groups Projects
Commit 8e19e464 authored by Eoin O'Neill's avatar Eoin O'Neill 🍀
Browse files

Masks Can No Longer Be Added to Locked Layers

This corrects unexpected behavior of being able to add masks to a locked layer even though
you could not edit the masks immediately after. Now, trying to add a mask to a locked layer
will not work.
BUG: 399145
parent cf6a4209
No related branches found
No related tags found
No related merge requests found
......@@ -194,6 +194,10 @@ void KisMaskManager::createMaskCommon(KisMaskSP mask,
KisNodeSP KisMaskManager::createSelectionMask(KisNodeSP activeNode, KisPaintDeviceSP copyFrom, bool convertActiveNode)
{
if (!activeNode->isEditable()) {
return 0;
}
KisSelectionMaskSP mask = new KisSelectionMask(m_view->image());
createMaskCommon(mask, activeNode, copyFrom, kundo2_i18n("Add Selection Mask"), "KisSelectionMask", i18n("Selection"), false, convertActiveNode, false);
mask->setActive(true);
......@@ -205,6 +209,10 @@ KisNodeSP KisMaskManager::createSelectionMask(KisNodeSP activeNode, KisPaintDevi
KisNodeSP KisMaskManager::createTransparencyMask(KisNodeSP activeNode, KisPaintDeviceSP copyFrom, bool convertActiveNode)
{
if (!activeNode->isEditable()) {
return 0;
}
KisMaskSP mask = new KisTransparencyMask();
createMaskCommon(mask, activeNode, copyFrom, kundo2_i18n("Add Transparency Mask"), "KisTransparencyMask", i18n("Transparency Mask"), false, convertActiveNode);
if (convertActiveNode) {
......@@ -216,6 +224,10 @@ KisNodeSP KisMaskManager::createTransparencyMask(KisNodeSP activeNode, KisPaintD
KisNodeSP KisMaskManager::createFilterMask(KisNodeSP activeNode, KisPaintDeviceSP copyFrom, bool quiet, bool convertActiveNode)
{
if (!activeNode->isEditable()) {
return 0;
}
KisFilterMaskSP mask = new KisFilterMask();
createMaskCommon(mask, activeNode, copyFrom, kundo2_i18n("Add Filter Mask"), "KisFilterMask", i18n("Filter Mask"), false, convertActiveNode);
......@@ -265,6 +277,10 @@ KisNodeSP KisMaskManager::createFilterMask(KisNodeSP activeNode, KisPaintDeviceS
KisNodeSP KisMaskManager::createColorizeMask(KisNodeSP activeNode)
{
if (!activeNode->isEditable()) {
return 0;
}
KisColorizeMaskSP mask = new KisColorizeMask();
createMaskCommon(mask, activeNode, 0, kundo2_i18n("Add Colorize Mask"), "KisColorizeMask", i18n("Colorize Mask"), true, false);
mask->setImage(m_view->image());
......@@ -276,6 +292,10 @@ KisNodeSP KisMaskManager::createColorizeMask(KisNodeSP activeNode)
KisNodeSP KisMaskManager::createTransformMask(KisNodeSP activeNode)
{
if (!activeNode->isEditable()) {
return 0;
}
KisTransformMaskSP mask = new KisTransformMask();
createMaskCommon(mask, activeNode, 0, kundo2_i18n("Add Transform Mask"), "KisTransformMask", i18n("Transform Mask"), true, false);
return mask;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment