Commit e4eec95e authored by Dmitry Kazakov's avatar Dmitry Kazakov

Make a transform tool work with Pass Through group layers

BUG:351548
parent cc49bd2d
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
#include "krita_utils.h" #include "krita_utils.h"
#include "kis_refresh_subtree_walker.h"
#include "kis_async_merger.h"
struct KisProjectionLeaf::Private struct KisProjectionLeaf::Private
{ {
...@@ -46,6 +49,13 @@ struct KisProjectionLeaf::Private ...@@ -46,6 +49,13 @@ struct KisProjectionLeaf::Private
bool checkThisPassThrough() { bool checkThisPassThrough() {
return checkPassThrough(node); return checkPassThrough(node);
} }
void temporarySetPassThrough(bool value) {
KisGroupLayer *group = qobject_cast<KisGroupLayer*>(node);
if (!group) return;
group->setPassThroughMode(value);
}
}; };
KisProjectionLeaf::KisProjectionLeaf(KisNode *node) KisProjectionLeaf::KisProjectionLeaf(KisNode *node)
...@@ -247,3 +257,25 @@ bool KisProjectionLeaf::isDroppedMask() const ...@@ -247,3 +257,25 @@ bool KisProjectionLeaf::isDroppedMask() const
return qobject_cast<KisMask*>(m_d->node) && return qobject_cast<KisMask*>(m_d->node) &&
m_d->checkParentPassThrough(); m_d->checkParentPassThrough();
} }
/**
* This method is rather slow and dangerous. It should be executes in
* exclusive environment only.
*/
void KisProjectionLeaf::explicitlyRegeneratePassThroughProjection()
{
if (!m_d->checkThisPassThrough()) return;
m_d->temporarySetPassThrough(false);
const QRect updateRect = projection()->defaultBounds()->bounds();
KisRefreshSubtreeWalker walker(updateRect);
walker.collectRects(m_d->node, updateRect);
KisAsyncMerger merger;
merger.startMerge(walker);
m_d->temporarySetPassThrough(true);
}
...@@ -62,6 +62,15 @@ public: ...@@ -62,6 +62,15 @@ public:
bool isDroppedMask() const; bool isDroppedMask() const;
/**
* Regenerate projection of the current group layer iff it is
* pass-through mode.
*
* WARNING: must be called either under the image lock held
* or in the context of an exclusive stroke job.
*/
void explicitlyRegeneratePassThroughProjection();
private: private:
struct Private; struct Private;
const QScopedPointer<Private> m_d; const QScopedPointer<Private> m_d;
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include "kis_transform_mask_adapter.h" #include "kis_transform_mask_adapter.h"
#include "kis_transform_utils.h" #include "kis_transform_utils.h"
#include "kis_projection_leaf.h"
class ModifyTransformMaskCommand : public KUndo2Command { class ModifyTransformMaskCommand : public KUndo2Command {
public: public:
...@@ -102,8 +104,8 @@ TransformStrokeStrategy::TransformStrokeStrategy(KisNodeSP rootNode, ...@@ -102,8 +104,8 @@ TransformStrokeStrategy::TransformStrokeStrategy(KisNodeSP rootNode,
* taken into account. * taken into account.
*/ */
m_selection = 0; m_selection = 0;
} else { } else {
rootNode->projectionLeaf()->explicitlyRegeneratePassThroughProjection();
device = rootNode->projection(); device = rootNode->projection();
} }
......
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