Commit c05b3acd authored by Scott Petrovic's avatar Scott Petrovic
Browse files

BUG:406036 Allow group layers to be transformed and improve logic for layers...

BUG:406036 Allow group layers to be transformed and improve logic for layers that do not support transforms
parent d8abbc50
......@@ -841,15 +841,6 @@ void KisToolTransform::startStroke(ToolTransformArgs::TransformMode mode, bool f
{
Q_ASSERT(!m_strokeData.strokeId());
KisResourcesSnapshotSP resources =
new KisResourcesSnapshot(image(), currentNode(), this->canvas()->resourceManager());
KisNodeSP currentNode = resources->currentNode();
if (!currentNode || !currentNode->isEditable()) {
return;
}
/**
* FIXME: The transform tool is not completely asynchronous, it
* needs the content of the layer for creation of the stroke
......@@ -860,23 +851,44 @@ void KisToolTransform::startStroke(ToolTransformArgs::TransformMode mode, bool f
* just disable starting a new stroke asynchronously
*/
if(nodePaintAbility() == NodePaintAbility::UNPAINTABLE) {
KisCanvas2 *kisCanvas = dynamic_cast<KisCanvas2*>(canvas());
kisCanvas->viewManager()->
showFloatingMessage(
i18nc("floating message in transformation tool",
"Unable to transform the layer"),
QIcon(), 4000, KisFloatingMessage::High);
return;
}
if (image()->tryBarrierLock()) {
image()->unlock();
} else {
return;
}
// set up and null checks before we do anything
KisResourcesSnapshotSP resources =
new KisResourcesSnapshot(image(), currentNode(), this->canvas()->resourceManager());
KisNodeSP currentNode = resources->currentNode();
if (!currentNode || !currentNode->isEditable()) return;
// some layer types cannot be transformed. Give a message and return if a user tries it
if (currentNode->inherits("KisColorizeMask") ||
currentNode->inherits("KisFileLayer") ||
currentNode->inherits("KisCloneLayer")) {
KisCanvas2 *kisCanvas = dynamic_cast<KisCanvas2*>(canvas());
kisCanvas->viewManager()->
showFloatingMessage(
i18nc("floating message in transformation tool",
"Layer type cannot use the transform tool"),
koIcon("object-locked"), 4000, KisFloatingMessage::High);
// force-reset transform mode to default
initTransformMode(mode);
return;
}
// this goes after the floating message check since the fetchNodesList()
// says a file layer is "empty" and messes up the floating message check above
QList<KisNodeSP> nodesList = fetchNodesList(mode, currentNode, m_workRecursively);
if (nodesList.isEmpty()) return;
/**
* We must ensure that the currently selected subtree
* has finished all its updates.
......@@ -895,22 +907,6 @@ void KisToolTransform::startStroke(ToolTransformArgs::TransformMode mode, bool f
!currentNode->paintDevice();
}
QList<KisNodeSP> nodesList = fetchNodesList(mode, currentNode, m_workRecursively);
if (nodesList.isEmpty()) {
KisCanvas2 *kisCanvas = dynamic_cast<KisCanvas2*>(canvas());
kisCanvas->viewManager()->
showFloatingMessage(
i18nc("floating message in transformation tool",
"Selected layer cannot be transformed with active transformation mode "),
koIcon("object-locked"), 4000, KisFloatingMessage::High);
// force-reset transform mode to default
initTransformMode(mode);
return;
}
KisSelectionSP selection = resources->activeSelection();
/**
......
Supports Markdown
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