[krita] plugins/paintops: Disable "Color" and "Lightness" brush tip modes in engines not supporting them
Dmitry Kazakov
null at kde.org
Wed Apr 15 12:34:49 BST 2020
Git commit de01047aa99befd9a5def426187ba62234e9d453 by Dmitry Kazakov.
Committed on 15/04/2020 at 11:01.
Pushed by dkazakov into branch 'master'.
Disable "Color" and "Lightness" brush tip modes in engines not supporting them
These modes are supported only by "Pixel" and "Tangent-Normal" brushes.
It would be nice to implement that for "ColorSmudge" paintop.
WARNING: some old preset might have had "Color" mode for colorsmudge.
It was a bug in previous versions of Krita. This switch changed the brush
tip a little bit. Now this mode is not supported, all old presets will
automatically switch into Mask mode (there are no such preset in the
default pack of presets).
CC:kimageshop at kde.org
M +4 -0 plugins/paintops/colorsmudge/kis_colorsmudgeop_settings_widget.cpp
M +1 -0 plugins/paintops/defaultpaintops/brush/kis_brushop_settings_widget.cpp
M +5 -0 plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.cpp
M +1 -0 plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.h
M +18 -2 plugins/paintops/libpaintop/kis_brush_chooser.cpp
M +5 -0 plugins/paintops/libpaintop/kis_brush_chooser.h
M +5 -0 plugins/paintops/libpaintop/kis_brush_option_widget.cpp
M +1 -0 plugins/paintops/libpaintop/kis_brush_option_widget.h
M +10 -0 plugins/paintops/libpaintop/kis_brush_selection_widget.cpp
M +4 -0 plugins/paintops/libpaintop/kis_brush_selection_widget.h
M +1 -0 plugins/paintops/tangentnormal/kis_tangent_normal_paintop_settings_widget.cpp
https://invent.kde.org/kde/krita/commit/de01047aa99befd9a5def426187ba62234e9d453
diff --git a/plugins/paintops/colorsmudge/kis_colorsmudgeop_settings_widget.cpp b/plugins/paintops/colorsmudge/kis_colorsmudgeop_settings_widget.cpp
index daccc2fed2..3d0aca64e8 100644
--- a/plugins/paintops/colorsmudge/kis_colorsmudgeop_settings_widget.cpp
+++ b/plugins/paintops/colorsmudge/kis_colorsmudgeop_settings_widget.cpp
@@ -50,6 +50,10 @@ KisColorSmudgeOpSettingsWidget::KisColorSmudgeOpSettingsWidget(QWidget* parent):
setObjectName("brush option widget");
setPrecisionEnabled(true);
+ // ColorSmudge paintoip doesn't support colorful
+ // HSL brushes yet. Though it would be nice feature to have.
+ setHSLBrushTipEnabled(false);
+
addPaintOpOption(new KisCompositeOpOption(true), i18n("Blending Mode"));
addPaintOpOption(new KisCurveOptionWidget(new KisPressureOpacityOption(), i18n("Transparent"), i18n("Opaque")), i18n("Opacity"));
addPaintOpOption(new KisCurveOptionWidget(new KisPressureSizeOption(), i18n("0%"), i18n("100%")), i18n("Size"));
diff --git a/plugins/paintops/defaultpaintops/brush/kis_brushop_settings_widget.cpp b/plugins/paintops/defaultpaintops/brush/kis_brushop_settings_widget.cpp
index 3fdf0710bd..2e3d5710e5 100644
--- a/plugins/paintops/defaultpaintops/brush/kis_brushop_settings_widget.cpp
+++ b/plugins/paintops/defaultpaintops/brush/kis_brushop_settings_widget.cpp
@@ -55,6 +55,7 @@ KisBrushOpSettingsWidget::KisBrushOpSettingsWidget(QWidget* parent)
{
setObjectName("brush option widget");
setPrecisionEnabled(true);
+ setHSLBrushTipEnabled(true);
// Brush tip options
addPaintOpOption(new KisCompositeOpOption(true), i18n("Blending Mode"));
diff --git a/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.cpp b/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.cpp
index 2131213d20..acd1038d02 100644
--- a/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.cpp
+++ b/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.cpp
@@ -37,6 +37,11 @@ void KisBrushBasedPaintopOptionWidget::setPrecisionEnabled(bool value)
m_brushOption->setPrecisionEnabled(value);
}
+void KisBrushBasedPaintopOptionWidget::setHSLBrushTipEnabled(bool value)
+{
+ m_brushOption->setHSLBrusTipEnabled(value);
+}
+
KisBrushSP KisBrushBasedPaintopOptionWidget::brush()
{
return m_brushOption->brush();
diff --git a/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.h b/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.h
index 42a161c91c..2e3b6f10fd 100644
--- a/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.h
+++ b/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.h
@@ -33,6 +33,7 @@ public:
~KisBrushBasedPaintopOptionWidget() override;
void setPrecisionEnabled(bool value);
+ void setHSLBrushTipEnabled(bool value);
KisBrushSP brush();
diff --git a/plugins/paintops/libpaintop/kis_brush_chooser.cpp b/plugins/paintops/libpaintop/kis_brush_chooser.cpp
index eb897f0f60..a37c8664fd 100644
--- a/plugins/paintops/libpaintop/kis_brush_chooser.cpp
+++ b/plugins/paintops/libpaintop/kis_brush_chooser.cpp
@@ -415,7 +415,8 @@ void KisPredefinedBrushChooser::updateBrushTip(KoResourceSP resource, bool isCha
void KisPredefinedBrushChooser::slotUpdateBrushModeButtonsState()
{
KisColorfulBrush *colorfulBrush = dynamic_cast<KisColorfulBrush*>(m_brush.data());
- const bool modeSwitchEnabled = colorfulBrush && colorfulBrush->hasColor();
+ const bool modeSwitchEnabled =
+ m_hslBrushTipEnabled && colorfulBrush && colorfulBrush->hasColor();
if (modeSwitchEnabled) {
if (colorfulBrush->useColorAsMask() && colorfulBrush->preserveLightness()) {
@@ -458,7 +459,12 @@ void KisPredefinedBrushChooser::slotUpdateBrushModeButtonsState()
intAdjustmentMidPoint->setToolTip("");
intBrightnessAdjustment->setToolTip("");
intContrastAdjustment->setToolTip("");
- grpBrushMode->setToolTip("The selected brush tip does not have color channels. The brush will work in \"Mask\" mode.");
+
+ if (m_hslBrushTipEnabled) {
+ grpBrushMode->setToolTip("The selected brush tip does not have color channels. The brush will work in \"Mask\" mode.");
+ } else {
+ grpBrushMode->setToolTip("The selected brush engine does not support \"Color\" or \"Lightness\" modes. The brush will work in \"Mask\" mode.");
+ }
}
@@ -554,6 +560,16 @@ void KisPredefinedBrushChooser::setImage(KisImageWSP image)
m_image = image;
}
+void KisPredefinedBrushChooser::setHSLBrusTipEnabled(bool value)
+{
+ m_hslBrushTipEnabled = value;
+}
+
+bool KisPredefinedBrushChooser::hslBrushTipEnabled() const
+{
+ return m_hslBrushTipEnabled;
+}
+
void KisPredefinedBrushChooser::slotImportNewBrushResource() {
m_itemChooser->slotButtonClicked(KisResourceItemChooser::Button_Import);
}
diff --git a/plugins/paintops/libpaintop/kis_brush_chooser.h b/plugins/paintops/libpaintop/kis_brush_chooser.h
index 196dd1c306..d2aba86c49 100644
--- a/plugins/paintops/libpaintop/kis_brush_chooser.h
+++ b/plugins/paintops/libpaintop/kis_brush_chooser.h
@@ -57,6 +57,9 @@ public:
void setBrushSize(qreal xPixels, qreal yPixels);
void setImage(KisImageWSP image);
+ void setHSLBrusTipEnabled(bool value);
+ bool hslBrushTipEnabled() const;
+
private Q_SLOTS:
void slotResetBrush();
@@ -87,6 +90,8 @@ private:
KisImageWSP m_image;
KisCustomBrushWidget* m_stampBrushWidget;
KisClipboardBrushWidget* m_clipboardBrushWidget;
+
+ bool m_hslBrushTipEnabled = false;
};
#endif // KIS_PREDEFINED_BRUSH_CHOOSER_H_
diff --git a/plugins/paintops/libpaintop/kis_brush_option_widget.cpp b/plugins/paintops/libpaintop/kis_brush_option_widget.cpp
index 1d9f46882d..0d892456f0 100644
--- a/plugins/paintops/libpaintop/kis_brush_option_widget.cpp
+++ b/plugins/paintops/libpaintop/kis_brush_option_widget.cpp
@@ -74,6 +74,11 @@ void KisBrushOptionWidget::setPrecisionEnabled(bool value)
m_brushSelectionWidget->setPrecisionEnabled(value);
}
+void KisBrushOptionWidget::setHSLBrusTipEnabled(bool value)
+{
+ m_brushSelectionWidget->setHSLBrusTipEnabled(value);
+}
+
void KisBrushOptionWidget::writeOptionSetting(KisPropertiesConfigurationSP settings) const
{
m_brushSelectionWidget->writeOptionSetting(settings);
diff --git a/plugins/paintops/libpaintop/kis_brush_option_widget.h b/plugins/paintops/libpaintop/kis_brush_option_widget.h
index 41b9e9667f..c645d388a9 100644
--- a/plugins/paintops/libpaintop/kis_brush_option_widget.h
+++ b/plugins/paintops/libpaintop/kis_brush_option_widget.h
@@ -51,6 +51,7 @@ public:
void setImage(KisImageWSP image) override;
void setPrecisionEnabled(bool value);
+ void setHSLBrusTipEnabled(bool value);
void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
diff --git a/plugins/paintops/libpaintop/kis_brush_selection_widget.cpp b/plugins/paintops/libpaintop/kis_brush_selection_widget.cpp
index 7716bf3314..18b367b77b 100644
--- a/plugins/paintops/libpaintop/kis_brush_selection_widget.cpp
+++ b/plugins/paintops/libpaintop/kis_brush_selection_widget.cpp
@@ -273,6 +273,16 @@ void KisBrushSelectionWidget::hideOptions(const QStringList &options)
}
}
+void KisBrushSelectionWidget::setHSLBrusTipEnabled(bool value)
+{
+ m_predefinedBrushWidget->setHSLBrusTipEnabled(value);
+}
+
+bool KisBrushSelectionWidget::hslBrushTipEnabled() const
+{
+ return m_predefinedBrushWidget->hslBrushTipEnabled();
+}
+
void KisBrushSelectionWidget::setCurrentWidget(QWidget* widget)
{
if (widget == m_currentBrushWidget) return;
diff --git a/plugins/paintops/libpaintop/kis_brush_selection_widget.h b/plugins/paintops/libpaintop/kis_brush_selection_widget.h
index 81a7c395de..ce02905fac 100644
--- a/plugins/paintops/libpaintop/kis_brush_selection_widget.h
+++ b/plugins/paintops/libpaintop/kis_brush_selection_widget.h
@@ -73,6 +73,10 @@ public:
void hideOptions(const QStringList &options);
+ void setHSLBrusTipEnabled(bool value);
+ bool hslBrushTipEnabled() const;
+
+
Q_SIGNALS:
void sigBrushChanged();
diff --git a/plugins/paintops/tangentnormal/kis_tangent_normal_paintop_settings_widget.cpp b/plugins/paintops/tangentnormal/kis_tangent_normal_paintop_settings_widget.cpp
index 6dd556bd1b..8d80e71b1a 100644
--- a/plugins/paintops/tangentnormal/kis_tangent_normal_paintop_settings_widget.cpp
+++ b/plugins/paintops/tangentnormal/kis_tangent_normal_paintop_settings_widget.cpp
@@ -47,6 +47,7 @@ KisTangentNormalPaintOpSettingsWidget::KisTangentNormalPaintOpSettingsWidget(QWi
{
setObjectName("brush option widget");
setPrecisionEnabled(true);
+ setHSLBrushTipEnabled(true);
addPaintOpOption(new KisCompositeOpOption(true), i18n("Blending Mode"));
addPaintOpOption(new KisCurveOptionWidget(new KisPressureOpacityOption(), i18n("Transparent"), i18n("Opaque")), i18n("Opacity"));
More information about the kimageshop
mailing list