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 @@
#include "krita_utils.h"
#include "kis_refresh_subtree_walker.h"
#include "kis_async_merger.h"
struct KisProjectionLeaf::Private
{
......@@ -46,6 +49,13 @@ struct KisProjectionLeaf::Private
bool checkThisPassThrough() {
return checkPassThrough(node);
}
void temporarySetPassThrough(bool value) {
KisGroupLayer *group = qobject_cast<KisGroupLayer*>(node);
if (!group) return;
group->setPassThroughMode(value);
}
};
KisProjectionLeaf::KisProjectionLeaf(KisNode *node)
......@@ -247,3 +257,25 @@ bool KisProjectionLeaf::isDroppedMask() const
return qobject_cast<KisMask*>(m_d->node) &&
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:
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:
struct Private;
const QScopedPointer<Private> m_d;
......
......@@ -33,6 +33,8 @@
#include "kis_transform_mask_adapter.h"
#include "kis_transform_utils.h"
#include "kis_projection_leaf.h"
class ModifyTransformMaskCommand : public KUndo2Command {
public:
......@@ -102,8 +104,8 @@ TransformStrokeStrategy::TransformStrokeStrategy(KisNodeSP rootNode,
* taken into account.
*/
m_selection = 0;
} else {
rootNode->projectionLeaf()->explicitlyRegeneratePassThroughProjection();
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