Commit a0caf30f authored by Dmitry Kazakov's avatar Dmitry Kazakov

Strikethrough (and disable) a clone, whose source is a pass-through group

Clone layers in Krita copy the projection of the source layer (and apply
some effects to it, like offset, masks and etc). But pass-through group
layers don't have any projection by definition, so clone layers cannot
copy them.

The only way to allow clone layers to copy pass-through groups is to
copy their "projection plane" and "projection leaf" instead of projection
device. But then there will be problems with masks, blending mode
and other funny problems we never thought about.

This patch just disables a clone layer that is connected to a pass-through
group and notifies the user about it by striking-through its name.

CCBUG:409949
parent 9939ba35
......@@ -31,6 +31,7 @@
#include "kis_refresh_subtree_walker.h"
#include "kis_async_merger.h"
#include "kis_node_graph_listener.h"
#include "kis_clone_layer.h"
struct Q_DECL_HIDDEN KisProjectionLeaf::Private
......@@ -284,7 +285,7 @@ bool KisProjectionLeaf::dependsOnLowerNodes() const
bool KisProjectionLeaf::visible() const
{
if (m_d->isTemporaryHidden) return false;
if (m_d->isTemporaryHidden || isDroppedNode()) return false;
// TODO: check opacity as well!
......@@ -350,10 +351,29 @@ bool KisProjectionLeaf::hasClones() const
return layer ? layer->hasClones() : false;
}
bool KisProjectionLeaf::isDroppedMask() const
bool KisProjectionLeaf::isDroppedNode() const
{
return qobject_cast<KisMask*>(m_d->node.data()) &&
m_d->checkParentPassThrough();
return dropReason() != NodeAvailable;
}
KisProjectionLeaf::NodeDropReason KisProjectionLeaf::dropReason() const
{
if (qobject_cast<KisMask*>(m_d->node.data()) &&
m_d->checkParentPassThrough()) {
return DropPassThroughMask;
}
KisCloneLayer *cloneLayer = qobject_cast<KisCloneLayer*>(m_d->node.data());
if (cloneLayer && cloneLayer->copyFrom()) {
KisProjectionLeafSP leaf = cloneLayer->copyFrom()->projectionLeaf();
if (leaf->m_d->checkThisPassThrough()) {
return DropPassThroughClone;
}
}
return NodeAvailable;
}
bool KisProjectionLeaf::isOverlayProjectionLeaf() const
......
......@@ -59,7 +59,15 @@ public:
bool isStillInGraph() const;
bool hasClones() const;
bool isDroppedMask() const;
bool isDroppedNode() const;
enum NodeDropReason {
NodeAvailable,
DropPassThroughMask,
DropPassThroughClone
};
NodeDropReason dropReason() const;
bool isOverlayProjectionLeaf() const;
/**
......
......@@ -476,10 +476,10 @@ QVariant KisNodeModel::data(const QModelIndex &index, int role) const
case Qt::SizeHintRole: return m_d->image->size(); // FIXME
case Qt::TextColorRole:
return belongsToIsolatedGroup(node) &&
!node->projectionLeaf()->isDroppedMask() ? QVariant() : QVariant(QColor(Qt::gray));
!node->projectionLeaf()->isDroppedNode() ? QVariant() : QVariant(QColor(Qt::gray));
case Qt::FontRole: {
QFont baseFont;
if (node->projectionLeaf()->isDroppedMask()) {
if (node->projectionLeaf()->isDroppedNode()) {
baseFont.setStrikeOut(true);
}
if (m_d->activeNodeIndex == index) {
......
......@@ -476,7 +476,7 @@ QVariant TimelineFramesModel::headerData(int section, Qt::Orientation orientatio
KisNodeSP node = dummy->node();
QFont baseFont;
if (node->projectionLeaf()->isDroppedMask()) {
if (node->projectionLeaf()->isDroppedNode()) {
baseFont.setStrikeOut(true);
} else if (m_d->image && m_d->image->isolatedModeRoot() &&
KisNodeModel::belongsToIsolatedGroup(m_d->image, node, m_d->dummiesFacade)) {
......
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