[graphics/krita] plugins/tools/tool_transform2: Remove work recursively button
Dmitry Kazakov
null at kde.org
Mon May 31 13:54:27 BST 2021
Git commit 93faf98fb81b8a674bf5200469b35a88149a0470 by Dmitry Kazakov, on behalf of Srirupa Datta.
Committed on 31/05/2021 at 12:54.
Pushed by dkazakov into branch 'master'.
Remove work recursively button
All layers and groups work recursively now. To achieve unrecursive
behaviour, lock the layer/mask.
GUI:
BUG: 429501
FIXED IN: 5.0.0
M +9 -15 plugins/tools/tool_transform2/kis_tool_transform.cc
M +1 -2 plugins/tools/tool_transform2/kis_tool_transform.h
M +2 -11 plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp
M +1 -2 plugins/tools/tool_transform2/kis_tool_transform_config_widget.h
M +4 -4 plugins/tools/tool_transform2/kis_transform_utils.cpp
M +1 -1 plugins/tools/tool_transform2/kis_transform_utils.h
M +1 -4 plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.cpp
M +0 -1 plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.h
M +2 -3 plugins/tools/tool_transform2/strokes/transform_stroke_strategy.cpp
M +0 -2 plugins/tools/tool_transform2/strokes/transform_stroke_strategy.h
M +18 -31 plugins/tools/tool_transform2/wdg_tool_transform.ui
https://invent.kde.org/graphics/krita/commit/93faf98fb81b8a674bf5200469b35a88149a0470
diff --git a/plugins/tools/tool_transform2/kis_tool_transform.cc b/plugins/tools/tool_transform2/kis_tool_transform.cc
index 08b055e772..3e71437705 100644
--- a/plugins/tools/tool_transform2/kis_tool_transform.cc
+++ b/plugins/tools/tool_transform2/kis_tool_transform.cc
@@ -83,7 +83,6 @@
KisToolTransform::KisToolTransform(KoCanvasBase * canvas)
: KisTool(canvas, KisCursor::rotateCursor())
- , m_workRecursively(true)
, m_warpStrategy(
new KisWarpTransformStrategy(
dynamic_cast<KisCanvas2*>(canvas)->coordinatesConverter(),
@@ -845,11 +844,6 @@ void KisToolTransform::startStroke(ToolTransformArgs::TransformMode mode, bool f
return;
}
- if (m_optionsWidget) {
- m_workRecursively = m_optionsWidget->workRecursively() ||
- !currentNode->paintDevice();
- }
-
KisSelectionSP selection = resources->activeSelection();
/**
@@ -873,7 +867,7 @@ void KisToolTransform::startStroke(ToolTransformArgs::TransformMode mode, bool f
KisStrokeStrategy *strategy = 0;
if (m_currentlyUsingOverlayPreviewStyle) {
- TransformStrokeStrategy *transformStrategy = new TransformStrokeStrategy(mode, m_workRecursively, m_currentArgs.filterId(), forceReset, currentNode, selection, image().data(), image().data());
+ TransformStrokeStrategy *transformStrategy = new TransformStrokeStrategy(mode, m_currentArgs.filterId(), forceReset, currentNode, selection, image().data(), image().data());
connect(transformStrategy, SIGNAL(sigPreviewDeviceReady(KisPaintDeviceSP)), SLOT(slotPreviewDeviceGenerated(KisPaintDeviceSP)));
connect(transformStrategy, SIGNAL(sigTransactionGenerated(TransformTransactionProperties, ToolTransformArgs, void*)), SLOT(slotTransactionGenerated(TransformTransactionProperties, ToolTransformArgs, void*)));
strategy = transformStrategy;
@@ -885,7 +879,7 @@ void KisToolTransform::startStroke(ToolTransformArgs::TransformMode mode, bool f
m_strokeStrategyCookie = transformStrategy;
} else {
- InplaceTransformStrokeStrategy *transformStrategy = new InplaceTransformStrokeStrategy(mode, m_workRecursively, m_currentArgs.filterId(), forceReset, currentNode, selection, externalSource, image().data(), image().data(), image()->root(), m_forceLodMode);
+ InplaceTransformStrokeStrategy *transformStrategy = new InplaceTransformStrokeStrategy(mode, m_currentArgs.filterId(), forceReset, currentNode, selection, externalSource, image().data(), image().data(), image()->root(), m_forceLodMode);
connect(transformStrategy, SIGNAL(sigTransactionGenerated(TransformTransactionProperties, ToolTransformArgs, void*)), SLOT(slotTransactionGenerated(TransformTransactionProperties, ToolTransformArgs, void*)));
strategy = transformStrategy;
@@ -1023,7 +1017,7 @@ void KisToolTransform::slotTrackerChangedConfig(KisToolChangesTrackerDataSP stat
updateOptionWidget();
}
-QList<KisNodeSP> KisToolTransform::fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool recursive)
+QList<KisNodeSP> KisToolTransform::fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool isExternalSourcePresent)
{
QList<KisNodeSP> result;
@@ -1038,10 +1032,10 @@ QList<KisNodeSP> KisToolTransform::fetchNodesList(ToolTransformArgs::TransformMo
}
};
- if (recursive) {
- KisLayerUtils::recursiveApplyNodes(root, fetchFunc);
- } else {
+ if (isExternalSourcePresent) {
fetchFunc(root);
+ } else {
+ KisLayerUtils::recursiveApplyNodes(root, fetchFunc);
}
return result;
@@ -1050,8 +1044,8 @@ QList<KisNodeSP> KisToolTransform::fetchNodesList(ToolTransformArgs::TransformMo
QWidget* KisToolTransform::createOptionWidget()
{
if (!m_canvas) return 0;
-
- m_optionsWidget = new KisToolTransformConfigWidget(&m_transaction, m_canvas, m_workRecursively, 0);
+
+ m_optionsWidget = new KisToolTransformConfigWidget(&m_transaction, m_canvas, 0);
Q_CHECK_PTR(m_optionsWidget);
m_optionsWidget->setObjectName(toolId() + " option widget");
@@ -1104,7 +1098,7 @@ QWidget* KisToolTransform::createOptionWidget()
}
void KisToolTransform::updateOptionWidget()
-{
+{
if (!m_optionsWidget) return;
if (!currentNode()) {
diff --git a/plugins/tools/tool_transform2/kis_tool_transform.h b/plugins/tools/tool_transform2/kis_tool_transform.h
index 8337385512..eaa2c17516 100644
--- a/plugins/tools/tool_transform2/kis_tool_transform.h
+++ b/plugins/tools/tool_transform2/kis_tool_transform.h
@@ -230,7 +230,7 @@ public Q_SLOTS:
void imageTooBigRequested(bool value);
private:
- QList<KisNodeSP> fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool recursive);
+ QList<KisNodeSP> fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool isExternalSourcePresent);
QScopedPointer<QMenu> m_contextMenu;
void startStroke(ToolTransformArgs::TransformMode mode, bool forceReset);
@@ -268,7 +268,6 @@ private:
bool m_preferOverlayPreviewStyle {false};
bool m_forceLodMode {false};
- bool m_workRecursively {false};
QPainterPath m_selectionPath; // original (unscaled) selection outline, used for painting decorations
diff --git a/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp b/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp
index 94a565a037..ec8aba6c3a 100644
--- a/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp
+++ b/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp
@@ -24,7 +24,7 @@ template<typename T> inline T sign(T x) {
const int KisToolTransformConfigWidget::DEFAULT_POINTS_PER_LINE = 3;
-KisToolTransformConfigWidget::KisToolTransformConfigWidget(TransformTransactionProperties *transaction, KisCanvas2 *canvas, bool workRecursively, QWidget *parent)
+KisToolTransformConfigWidget::KisToolTransformConfigWidget(TransformTransactionProperties *transaction, KisCanvas2 *canvas, QWidget *parent)
: QWidget(parent),
m_transaction(transaction),
m_notificationsBlocked(0),
@@ -32,15 +32,11 @@ KisToolTransformConfigWidget::KisToolTransformConfigWidget(TransformTransactionP
m_configChanged(false)
{
setupUi(this);
- chkWorkRecursively->setIcon(KisIconUtils::loadIcon("krita_tool_transform_recursive"));
flipXButton->setIcon(KisIconUtils::loadIcon("transform_icons_mirror_x"));
flipYButton->setIcon(KisIconUtils::loadIcon("transform_icons_mirror_y"));
rotateCWButton->setIcon(KisIconUtils::loadIcon("transform_icons_rotate_cw"));
rotateCCWButton->setIcon(KisIconUtils::loadIcon("transform_icons_rotate_ccw"));
- chkWorkRecursively->setChecked(workRecursively);
- connect(chkWorkRecursively, SIGNAL(toggled(bool)), this, SIGNAL(sigRestartTransform()));
-
// Granularity can only be specified in the power of 2's
QStringList granularityValues{"4","8","16","32"};
changeGranularity->addItems(granularityValues);
@@ -499,7 +495,7 @@ void KisToolTransformConfigWidget::liquifyReverseDirectionChanged(bool value)
void KisToolTransformConfigWidget::updateConfig(const ToolTransformArgs &config)
{
blockUiSlots();
-
+
if (config.mode() == ToolTransformArgs::FREE_TRANSFORM ||
config.mode() == ToolTransformArgs::PERSPECTIVE_4POINT) {
@@ -670,11 +666,6 @@ void KisToolTransformConfigWidget::resetRotationCenterButtons()
}
}
-bool KisToolTransformConfigWidget::workRecursively() const
-{
- return chkWorkRecursively->isChecked();
-}
-
void KisToolTransformConfigWidget::setTooBigLabelVisible(bool value)
{
tooBigLabelWidget->setVisible(value);
diff --git a/plugins/tools/tool_transform2/kis_tool_transform_config_widget.h b/plugins/tools/tool_transform2/kis_tool_transform_config_widget.h
index fec6ea2d6e..a054383b27 100644
--- a/plugins/tools/tool_transform2/kis_tool_transform_config_widget.h
+++ b/plugins/tools/tool_transform2/kis_tool_transform_config_widget.h
@@ -19,13 +19,12 @@ class KisToolTransformConfigWidget : public QWidget, private Ui::WdgToolTransfor
Q_OBJECT
public:
- KisToolTransformConfigWidget(TransformTransactionProperties *transaction, KisCanvas2 *canvas, bool workRecursively, QWidget *parent);
+ KisToolTransformConfigWidget(TransformTransactionProperties *transaction, KisCanvas2 *canvas, QWidget *parent);
void setApplyResetDisabled(bool disabled);
void resetRotationCenterButtons();
void setDefaultWarpPoints(int pointsPerLine = -1);
void setTooBigLabelVisible(bool value);
- bool workRecursively() const;
public Q_SLOTS:
void updateConfig(const ToolTransformArgs &config);
diff --git a/plugins/tools/tool_transform2/kis_transform_utils.cpp b/plugins/tools/tool_transform2/kis_transform_utils.cpp
index 4acac3d25d..54b689ad1a 100644
--- a/plugins/tools/tool_transform2/kis_transform_utils.cpp
+++ b/plugins/tools/tool_transform2/kis_transform_utils.cpp
@@ -609,7 +609,7 @@ KisNodeSP KisTransformUtils::tryOverrideRootToTransformMask(KisNodeSP root)
return root;
}
-QList<KisNodeSP> KisTransformUtils::fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool recursive)
+QList<KisNodeSP> KisTransformUtils::fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool isExternalSourcePresent)
{
QList<KisNodeSP> result;
@@ -634,10 +634,10 @@ QList<KisNodeSP> KisTransformUtils::fetchNodesList(ToolTransformArgs::TransformM
}
};
- if (recursive) {
- KisLayerUtils::recursiveApplyNodes(root, fetchFunc);
- } else {
+ if (isExternalSourcePresent) {
fetchFunc(root);
+ } else {
+ KisLayerUtils::recursiveApplyNodes(root, fetchFunc);
}
return result;
diff --git a/plugins/tools/tool_transform2/kis_transform_utils.h b/plugins/tools/tool_transform2/kis_transform_utils.h
index 22cac99eae..5438430304 100644
--- a/plugins/tools/tool_transform2/kis_transform_utils.h
+++ b/plugins/tools/tool_transform2/kis_transform_utils.h
@@ -182,7 +182,7 @@ public:
static KisNodeSP tryOverrideRootToTransformMask(KisNodeSP root);
- static QList<KisNodeSP> fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool recursive);
+ static QList<KisNodeSP> fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool isExternalSourcePresent);
static bool tryInitArgsFromNode(KisNodeSP node, ToolTransformArgs *args);
static bool tryFetchArgsFromCommandAndUndo(ToolTransformArgs *outArgs, ToolTransformArgs::TransformMode mode, KisNodeSP currentNode, KisNodeList selectedNodes, KisStrokeUndoFacade *undoFacade, QVector<KisStrokeJobData *> *undoJobs, const KisSavedMacroCommand **overriddenCommand);
diff --git a/plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.cpp b/plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.cpp
index 34762dfd6d..4970c44768 100644
--- a/plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.cpp
+++ b/plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.cpp
@@ -54,7 +54,6 @@ struct InplaceTransformStrokeStrategy::Private
KisUpdatesFacade *updatesFacade;
KisStrokeUndoFacade *undoFacade;
ToolTransformArgs::TransformMode mode;
- bool workRecursively;
QString filterId;
bool forceReset;
KisNodeSP rootNode;
@@ -119,7 +118,6 @@ struct InplaceTransformStrokeStrategy::Private
InplaceTransformStrokeStrategy::InplaceTransformStrokeStrategy(ToolTransformArgs::TransformMode mode,
- bool workRecursively,
const QString &filterId,
bool forceReset,
KisNodeSP rootNode,
@@ -134,7 +132,6 @@ InplaceTransformStrokeStrategy::InplaceTransformStrokeStrategy(ToolTransformArgs
{
m_d->mode = mode;
- m_d->workRecursively = workRecursively;
m_d->filterId = filterId;
m_d->forceReset = forceReset;
m_d->rootNode = rootNode;
@@ -286,7 +283,7 @@ void InplaceTransformStrokeStrategy::initStrokeCallback()
m_d->rootNode = KisTransformUtils::tryOverrideRootToTransformMask(m_d->rootNode);
// When placing an external source image, we never work recursively on any layer masks
- m_d->processedNodes = KisTransformUtils::fetchNodesList(m_d->mode, m_d->rootNode, m_d->workRecursively && !m_d->externalSource);
+ m_d->processedNodes = KisTransformUtils::fetchNodesList(m_d->mode, m_d->rootNode, m_d->externalSource);
bool argsAreInitialized = false;
QVector<KisStrokeJobData *> lastCommandUndoJobs;
diff --git a/plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.h b/plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.h
index a209f67cca..b2591f3cb8 100644
--- a/plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.h
+++ b/plugins/tools/tool_transform2/strokes/inplace_transform_stroke_strategy.h
@@ -90,7 +90,6 @@ public:
public:
InplaceTransformStrokeStrategy(ToolTransformArgs::TransformMode mode,
- bool workRecursively,
const QString &filterId,
bool forceReset,
KisNodeSP rootNode,
diff --git a/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.cpp b/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.cpp
index dbdb5a544d..8906164e86 100644
--- a/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.cpp
+++ b/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.cpp
@@ -44,7 +44,6 @@
TransformStrokeStrategy::TransformStrokeStrategy(ToolTransformArgs::TransformMode mode,
- bool workRecursively,
const QString &filterId,
bool forceReset,
KisNodeSP rootNode,
@@ -54,7 +53,6 @@ TransformStrokeStrategy::TransformStrokeStrategy(ToolTransformArgs::TransformMod
: KisStrokeStrategyUndoCommandBased(kundo2_i18n("Transform"), false, undoFacade),
m_updatesFacade(updatesFacade),
m_mode(mode),
- m_workRecursively(workRecursively),
m_filterId(filterId),
m_forceReset(forceReset),
m_selection(selection)
@@ -392,7 +390,8 @@ void TransformStrokeStrategy::initStrokeCallback()
}
ToolTransformArgs initialTransformArgs;
- m_processedNodes = KisTransformUtils::fetchNodesList(m_mode, m_rootNode, m_workRecursively);
+ bool isExternalSourcePresent = false;
+ m_processedNodes = KisTransformUtils::fetchNodesList(m_mode, m_rootNode, isExternalSourcePresent);
bool argsAreInitialized = false;
QVector<KisStrokeJobData *> lastCommandUndoJobs;
diff --git a/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.h b/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.h
index f30ff32e9a..b2f0976b50 100644
--- a/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.h
+++ b/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.h
@@ -78,7 +78,6 @@ public:
public:
TransformStrokeStrategy(ToolTransformArgs::TransformMode mode,
- bool workRecursively,
const QString &filterId,
bool forceReset,
KisNodeSP rootNode,
@@ -118,7 +117,6 @@ private:
private:
KisUpdatesFacade *m_updatesFacade;
ToolTransformArgs::TransformMode m_mode;
- bool m_workRecursively;
QString m_filterId;
bool m_forceReset;
diff --git a/plugins/tools/tool_transform2/wdg_tool_transform.ui b/plugins/tools/tool_transform2/wdg_tool_transform.ui
index 4263b69ade..117d2118f8 100644
--- a/plugins/tools/tool_transform2/wdg_tool_transform.ui
+++ b/plugins/tools/tool_transform2/wdg_tool_transform.ui
@@ -11,7 +11,7 @@
<x>0</x>
<y>0</y>
<width>515</width>
- <height>724</height>
+ <height>780</height>
</rect>
</property>
<property name="sizePolicy">
@@ -371,6 +371,12 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
</spacer>
</item>
<item>
@@ -565,6 +571,12 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
</spacer>
</item>
</layout>
@@ -1173,6 +1185,9 @@
<height>16777215</height>
</size>
</property>
+ <property name="focusPolicy">
+ <enum>Qt::TabFocus</enum>
+ </property>
<property name="toolTip">
<string>Flip selection horizontally</string>
</property>
@@ -2112,35 +2127,7 @@
</widget>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1,0">
- <item>
- <widget class="QPushButton" name="chkWorkRecursively">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>32</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Work Recursively</string>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,0">
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
@@ -2210,8 +2197,8 @@
<resources/>
<connections/>
<buttongroups>
- <buttongroup name="cageTransformButtonGroup"/>
<buttongroup name="freeTransformRadioGroup"/>
<buttongroup name="buttonGroup"/>
+ <buttongroup name="cageTransformButtonGroup"/>
</buttongroups>
</ui>
More information about the kde-doc-english
mailing list