diff --git a/libs/image/kis_base_node.cpp b/libs/image/kis_base_node.cpp index 8e81091..faafd28 100644 --- a/libs/image/kis_base_node.cpp +++ b/libs/image/kis_base_node.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -271,9 +272,21 @@ void KisBaseNode::setUserLocked(bool locked) bool KisBaseNode::isEditable(bool checkVisibility) const { + ENTER_FUNCTION() << ppVar(visible(false)) << ppVar(belongsToIsolatedGraph()); bool editable = true; if (checkVisibility) { editable = (visible(false) && !userLocked()); + if (!userLocked()) { + if (visible(false)) { + editable = true; + } + else { + editable = belongsToIsolatedGraph(); + } + } + else { + editable = false; + } } else { editable = (!userLocked()); @@ -285,6 +298,8 @@ bool KisBaseNode::isEditable(bool checkVisibility) const editable = parentNode->isEditable(checkVisibility); } } + + return editable; } diff --git a/libs/image/kis_base_node.h b/libs/image/kis_base_node.h index 9922f41..3ce885b 100644 --- a/libs/image/kis_base_node.h +++ b/libs/image/kis_base_node.h @@ -528,6 +528,10 @@ protected: virtual void baseNodeInvalidateAllFramesCallback() { } + virtual bool belongsToIsolatedGraph() const { + return true; + } + /** * Add a keyframe channel for this node. The channel will be added * to the common hash table which will be available to the UI. diff --git a/libs/image/kis_image.cc b/libs/image/kis_image.cc index 2ea1b7a..bfb977b 100644 --- a/libs/image/kis_image.cc +++ b/libs/image/kis_image.cc @@ -1574,6 +1574,21 @@ void KisImage::requestTimeSwitch(int time) m_d->animationInterface->requestTimeSwitchNonGUI(time); } +bool KisImage::belongsToIsolatedGraph(const KisNode *node) const +{ + if (m_d->isolatedRootNode.data() == m_d->rootLayer.data()) + return true; + + const KisNode *tmp = node; + while (tmp) { + if (tmp == m_d->isolatedRootNode) + return true; + tmp = tmp->parent().data(); + } + + return false; +} + QList KisImage::compositions() { return m_d->compositions; diff --git a/libs/image/kis_image.h b/libs/image/kis_image.h index bfeb5b5..45bf792 100644 --- a/libs/image/kis_image.h +++ b/libs/image/kis_image.h @@ -95,6 +95,7 @@ public: // KisNodeGraphListener implementation void requestProjectionUpdate(KisNode *node, const QRect& rect, bool resetAnimationCache) override; void invalidateFrames(const KisTimeRange &range, const QRect &rect) override; void requestTimeSwitch(int time) override; + bool belongsToIsolatedGraph(const KisNode *node) const override; public: // KisProjectionUpdateListener implementation void notifyProjectionUpdated(const QRect &rc) override; diff --git a/libs/image/kis_node.cpp b/libs/image/kis_node.cpp index b289fe2..cc9d216 100644 --- a/libs/image/kis_node.cpp +++ b/libs/image/kis_node.cpp @@ -341,6 +341,15 @@ void KisNode::baseNodeInvalidateAllFramesCallback() } } +bool KisNode::belongsToIsolatedGraph() const +{ + if(m_d->graphListener) { + return m_d->graphListener->belongsToIsolatedGraph(this); + } + + return true; +} + void KisNode::addKeyframeChannel(KisKeyframeChannel *channel) { channel->setNode(this); diff --git a/libs/image/kis_node.h b/libs/image/kis_node.h index 86c3f76..bc711b5 100644 --- a/libs/image/kis_node.h +++ b/libs/image/kis_node.h @@ -360,6 +360,8 @@ protected: void notifyParentVisibilityChanged(bool value) override; void baseNodeChangedCallback() override; void baseNodeInvalidateAllFramesCallback() override; +public: + bool belongsToIsolatedGraph() const override; protected: void addKeyframeChannel(KisKeyframeChannel* channel) override; diff --git a/libs/image/kis_node_graph_listener.cpp b/libs/image/kis_node_graph_listener.cpp index 0d04e22..0e51dc9 100644 --- a/libs/image/kis_node_graph_listener.cpp +++ b/libs/image/kis_node_graph_listener.cpp @@ -100,3 +100,10 @@ void KisNodeGraphListener::requestTimeSwitch(int time) { Q_UNUSED(time); } + +bool KisNodeGraphListener::belongsToIsolatedGraph(const KisNode *node) const +{ + Q_UNUSED(node); + + return true; +} diff --git a/libs/image/kis_node_graph_listener.h b/libs/image/kis_node_graph_listener.h index 692359a..2d6dbd8 100644 --- a/libs/image/kis_node_graph_listener.h +++ b/libs/image/kis_node_graph_listener.h @@ -115,6 +115,10 @@ public: */ int graphSequenceNumber() const; + /** + * Checks if node belongs to isolated subgraph in image + */ + virtual bool belongsToIsolatedGraph(const KisNode *node) const; private: struct Private; QScopedPointer m_d; diff --git a/libs/image/kis_projection_leaf.cpp b/libs/image/kis_projection_leaf.cpp index 09d2066..f7edb52 100644 --- a/libs/image/kis_projection_leaf.cpp +++ b/libs/image/kis_projection_leaf.cpp @@ -204,7 +204,12 @@ bool KisProjectionLeaf::visible() const node = node->parent(); } - return m_d->node->visible(false) && + bool isVisible = false; + if (m_d->node->visible(false) == false) + if (m_d->node->belongsToIsolatedGraph()) + isVisible = true; + + return (m_d->node->visible(false) || isVisible) && !m_d->checkThisPassThrough() && !hiddenByParentPassThrough; }