Commit c0afb21e authored by Boudewijn Rempt's avatar Boudewijn Rempt

Updates for the clone tool

The clone tool can now clone from the projection and it's possible
to change the clone source layer. Press ctrl-alt-click to select a
new clone source on the current layer. ctrl-click to select a new clone
source point on the layer that was active when you selected the clone
op.
parent 463986f6
......@@ -95,7 +95,7 @@ public:
/**
* Create and return an settings object for this paintop.
*/
virtual KisPaintOpSettingsSP settings(KisImageWSP image) = 0;
virtual KisPaintOpSettingsSP settings() = 0;
/**
* create a widget that can display paintop settings
......
......@@ -127,7 +127,7 @@ bool KisPaintOpPreset::load()
bool res = loadFromDevice(&file);
return true;
return res;
}
bool KisPaintOpPreset::loadFromDevice(QIODevice *dev)
......@@ -217,7 +217,7 @@ void KisPaintOpPreset::fromXML(const QDomElement& presetElt)
KoID id(paintopid, "");
KisPaintOpSettingsSP settings = KisPaintOpRegistry::instance()->settings(id, 0);
KisPaintOpSettingsSP settings = KisPaintOpRegistry::instance()->settings(id);
if (!settings) {
setValid(false);
qWarning() << "Could not load settings for preset" << paintopid;
......
......@@ -57,13 +57,11 @@ KisPaintOpRegistry* KisPaintOpRegistry::instance()
if (!s_instance.exists()) {
KoPluginLoader::instance()->load("Krita/Paintop", "(Type == 'Service') and ([X-Krita-Version] == 28)");
KisImageSP img = new KisImage(0, 0, 0, 0, 0, KoColorSpaceRegistry::instance()->alpha8());
QStringList toBeRemoved;
foreach(const QString &id, s_instance->keys()) {
KisPaintOpFactory *factory = s_instance->get(id);
if (!factory->settings(img)) {
if (!factory->settings()) {
toBeRemoved << id;
}
else {
......@@ -117,24 +115,24 @@ KisPaintOp * KisPaintOpRegistry::paintOp(const KisPaintOpPresetSP preset, KisPai
return paintOp(preset->paintOp().id(), preset->settings(), painter, image);
}
KisPaintOpSettingsSP KisPaintOpRegistry::settings(const KoID& id, KisImageWSP image) const
KisPaintOpSettingsSP KisPaintOpRegistry::settings(const KoID& id) const
{
KisPaintOpFactory *f = value(id.id());
Q_ASSERT(f);
if (f) {
KisPaintOpSettingsSP settings = f->settings(image);
KisPaintOpSettingsSP settings = f->settings();
settings->setProperty("paintop", id.id());
return settings;
}
return 0;
}
KisPaintOpPresetSP KisPaintOpRegistry::defaultPreset(const KoID& id, KisImageWSP image) const
KisPaintOpPresetSP KisPaintOpRegistry::defaultPreset(const KoID& id) const
{
KisPaintOpPresetSP preset = new KisPaintOpPreset();
preset->setName(i18n("default"));
KisPaintOpSettingsSP s = settings(id, image);
KisPaintOpSettingsSP s = settings(id);
if (s.isNull()) {
return 0;
......
......@@ -66,12 +66,12 @@ public:
* with the specified parent as widget parent. Returns 0 if there
* are no settings available for the given device.
*/
KisPaintOpSettingsSP settings(const KoID& id, KisImageWSP image = 0) const;
KisPaintOpSettingsSP settings(const KoID& id) const;
/**
* @return a default preset for the given paintop.
*/
KisPaintOpPresetSP defaultPreset(const KoID& id, KisImageWSP image = 0) const;
KisPaintOpPresetSP defaultPreset(const KoID& id) const;
// Whether we should show this paintop in the toolchest
bool userVisible(const KoID & id, const KoColorSpace* cs) const;
......
......@@ -65,9 +65,10 @@
#include "kis_duplicateop_settings_widget.h"
#include "kis_duplicateop_option.h"
KisDuplicateOp::KisDuplicateOp(const KisDuplicateOpSettings *settings, KisPainter *painter)
KisDuplicateOp::KisDuplicateOp(KisImageWSP image, const KisDuplicateOpSettings *settings, KisPainter *painter)
: KisBrushBasedPaintOp(settings, painter)
, settings(settings)
, m_image(image)
, m_settings(settings)
{
Q_ASSERT(settings);
Q_ASSERT(painter);
......@@ -75,6 +76,7 @@ KisDuplicateOp::KisDuplicateOp(const KisDuplicateOpSettings *settings, KisPainte
m_healing = settings->getBool(DUPLICATE_HEALING);
m_perspectiveCorrection = settings->getBool(DUPLICATE_CORRECT_PERSPECTIVE);
m_moveSourcePoint = settings->getBool(DUPLICATE_MOVE_SOURCE_POINT);
m_cloneFromProjection = settings->getBool(DUPLICATE_CLONE_FROM_PROJECTION);
m_srcdev = source()->createCompositionSourceDevice();
}
......@@ -126,7 +128,14 @@ KisSpacingInformation KisDuplicateOp::paintAt(const KisPaintInformation& info)
m_duplicateStart = info.pos();
}
KisPaintDeviceSP realSourceDevice = settings->node()->paintDevice();
KisPaintDeviceSP realSourceDevice;
if (m_cloneFromProjection) {
realSourceDevice = m_image->projection();
}
else {
realSourceDevice = m_settings->node()->paintDevice();
}
qreal scale = m_sizeOption.apply(info);
if (checkSizeTooSmall(scale)) return KisSpacingInformation();
......@@ -149,10 +158,11 @@ KisSpacingInformation KisDuplicateOp::paintAt(const KisPaintInformation& info)
QPoint srcPoint;
if (m_moveSourcePoint) {
srcPoint = (dstRect.topLeft() - settings->offset()).toPoint();
} else {
srcPoint = (dstRect.topLeft() - m_settings->offset()).toPoint();
}
else {
QPointF hotSpot = brush->hotSpot(scale, scale, 0, info);
srcPoint = (settings->position() - hotSpot).toPoint();
srcPoint = (m_settings->position() - hotSpot).toPoint();
}
qint32 sw = dstRect.width();
......@@ -167,14 +177,15 @@ KisSpacingInformation KisDuplicateOp::paintAt(const KisPaintInformation& info)
}
// Perspective correction ?
KisImageWSP image = settings->m_image;
if (m_perspectiveCorrection && image && image->perspectiveGrid()->countSubGrids() == 1) {
if (m_perspectiveCorrection && m_image && m_image->perspectiveGrid()->countSubGrids() == 1) {
Matrix3qreal startM = Matrix3qreal::Identity();
Matrix3qreal endM = Matrix3qreal::Identity();
// First look for the grid corresponding to the start point
KisSubPerspectiveGrid* subGridStart = *image->perspectiveGrid()->begin();
QRect r = QRect(0, 0, image->width(), image->height());
KisSubPerspectiveGrid* subGridStart = *m_image->perspectiveGrid()->begin();
QRect r = QRect(0, 0, m_image->width(), m_image->height());
#if 1
if (subGridStart) {
......@@ -183,7 +194,7 @@ KisSpacingInformation KisDuplicateOp::paintAt(const KisPaintInformation& info)
#endif
#if 1
// Second look for the grid corresponding to the end point
KisSubPerspectiveGrid* subGridEnd = *image->perspectiveGrid()->begin();
KisSubPerspectiveGrid* subGridEnd = *m_image->perspectiveGrid()->begin();
if (subGridEnd) {
endM = KisPerspectiveMath::computeMatrixTransfoToPerspective(*subGridEnd->topLeft(), *subGridEnd->topRight(), *subGridEnd->bottomLeft(), *subGridEnd->bottomRight(), r);
}
......@@ -191,7 +202,7 @@ KisSpacingInformation KisDuplicateOp::paintAt(const KisPaintInformation& info)
// Compute the translation in the perspective transformation space:
QPointF positionStartPaintingT = KisPerspectiveMath::matProd(endM, QPointF(m_duplicateStart));
QPointF duplicateStartPositionT = KisPerspectiveMath::matProd(endM, QPointF(m_duplicateStart) - QPointF(settings->offset()));
QPointF duplicateStartPositionT = KisPerspectiveMath::matProd(endM, QPointF(m_duplicateStart) - QPointF(m_settings->offset()));
QPointF translat = duplicateStartPositionT - positionStartPaintingT;
KisSequentialIterator dstIt(m_srcdev, QRect(0, 0, sw, sh));
......
......@@ -45,7 +45,7 @@ class KisDuplicateOp : public KisBrushBasedPaintOp
public:
KisDuplicateOp(const KisDuplicateOpSettings *settings, KisPainter * painter);
KisDuplicateOp(KisImageWSP image, const KisDuplicateOpSettings *m_settings, KisPainter * painter);
~KisDuplicateOp();
KisSpacingInformation paintAt(const KisPaintInformation& info);
......@@ -56,7 +56,8 @@ private:
private:
const KisDuplicateOpSettings * settings;
KisImageWSP m_image;
const KisDuplicateOpSettings * m_settings;
KisPaintDeviceSP m_srcdev;
KisPaintDeviceSP m_target;
QPointF m_duplicateStart;
......@@ -65,6 +66,7 @@ private:
bool m_healing;
bool m_perspectiveCorrection;
bool m_moveSourcePoint;
bool m_cloneFromProjection;
};
#endif // KIS_DUPLICATEOP_H_
......@@ -49,19 +49,17 @@ KisPaintOp * KisDuplicateOpFactory::createOp(const KisPaintOpSettingsSP settings
KisPainter * painter,
KisImageWSP image)
{
Q_UNUSED(image);
const KisDuplicateOpSettings *duplicateopSettings = dynamic_cast<const KisDuplicateOpSettings *>(settings.data());
Q_ASSERT(settings != 0 && duplicateopSettings != 0);
KisPaintOp * op = new KisDuplicateOp(duplicateopSettings, painter);
KisPaintOp * op = new KisDuplicateOp(image, duplicateopSettings, painter);
Q_CHECK_PTR(op);
return op;
}
KisPaintOpSettingsSP KisDuplicateOpFactory::settings(KisImageWSP image)
KisPaintOpSettingsSP KisDuplicateOpFactory::settings()
{
return new KisDuplicateOpSettings(image);
return new KisDuplicateOpSettings();
}
KisPaintOpSettingsWidget* KisDuplicateOpFactory::createSettingsWidget(QWidget* parent)
......
......@@ -58,7 +58,7 @@ public:
return KisPaintOpFactory::categoryStable();
}
virtual KisPaintOpSettingsSP settings(KisImageWSP image);
virtual KisPaintOpSettingsSP settings();
virtual KisPaintOpSettingsWidget* createSettingsWidget(QWidget* parent);
};
......
......@@ -46,9 +46,11 @@ KisDuplicateOpOption::KisDuplicateOpOption()
{
m_checkable = false;
m_optionWidget = new KisDuplicateOpOptionsWidget();
connect(m_optionWidget->cbHealing, SIGNAL(toggled(bool)), SIGNAL(sigSettingChanged()));
connect(m_optionWidget->cbPerspective, SIGNAL(toggled(bool)), SIGNAL(sigSettingChanged()));
connect(m_optionWidget->cbSourcePoint, SIGNAL(toggled(bool)), SIGNAL(sigSettingChanged()));
connect(m_optionWidget->chkCloneProjection, SIGNAL(toggled(bool)), SIGNAL(sigSettingChanged()));
setConfigurationPage(m_optionWidget);
}
......@@ -88,11 +90,22 @@ void KisDuplicateOpOption::setMoveSourcePoint(bool move)
m_optionWidget->cbSourcePoint->setChecked(move);
}
bool KisDuplicateOpOption::cloneFromProjection() const
{
return m_optionWidget->chkCloneProjection->isChecked();
}
void KisDuplicateOpOption::setCloneFromProjection(bool cloneFromProjection)
{
m_optionWidget->chkCloneProjection->setChecked(cloneFromProjection);
}
void KisDuplicateOpOption::writeOptionSetting(KisPropertiesConfiguration* setting) const
{
setting->setProperty(DUPLICATE_HEALING, healing());
setting->setProperty(DUPLICATE_CORRECT_PERSPECTIVE, correctPerspective());
setting->setProperty(DUPLICATE_MOVE_SOURCE_POINT, moveSourcePoint());
setting->setProperty(DUPLICATE_CLONE_FROM_PROJECTION, cloneFromProjection());
}
void KisDuplicateOpOption::readOptionSetting(const KisPropertiesConfiguration* setting)
......@@ -100,6 +113,7 @@ void KisDuplicateOpOption::readOptionSetting(const KisPropertiesConfiguration* s
m_optionWidget->cbHealing->setChecked(setting->getBool(DUPLICATE_HEALING, false));
m_optionWidget->cbPerspective->setChecked(setting->getBool(DUPLICATE_CORRECT_PERSPECTIVE, false));
m_optionWidget->cbSourcePoint->setChecked(setting->getBool(DUPLICATE_MOVE_SOURCE_POINT, true));
m_optionWidget->chkCloneProjection->setChecked(setting->getBool(DUPLICATE_CLONE_FROM_PROJECTION, false));
emit sigSettingChanged();
}
......
......@@ -24,6 +24,7 @@
const QString DUPLICATE_HEALING = "Duplicateop/Healing";
const QString DUPLICATE_CORRECT_PERSPECTIVE = "Duplicateop/CorrectPerspective";
const QString DUPLICATE_MOVE_SOURCE_POINT = "Duplicateop/MoveSourcePoint";
const QString DUPLICATE_CLONE_FROM_PROJECTION = "Duplicateop/CloneFromProjection";
class KisDuplicateOpOptionsWidget;
......@@ -43,6 +44,9 @@ public:
bool moveSourcePoint() const;
void setMoveSourcePoint(bool move);
bool cloneFromProjection() const;
void setCloneFromProjection(bool cloneFromProjection);
void writeOptionSetting(KisPropertiesConfiguration* setting) const;
void readOptionSetting(const KisPropertiesConfiguration* setting);
......
......@@ -39,9 +39,8 @@
#include <kis_paint_action_type_option.h>
#include <kis_perspective_grid.h>
KisDuplicateOpSettings::KisDuplicateOpSettings(KisImageWSP image)
: m_image(image)
, m_isOffsetNotUptodate(false)
KisDuplicateOpSettings::KisDuplicateOpSettings()
: m_isOffsetNotUptodate(false)
{
}
......@@ -72,6 +71,11 @@ QPointF KisDuplicateOpSettings::position() const
bool KisDuplicateOpSettings::mousePressEvent(const KisPaintInformation &info, Qt::KeyboardModifiers modifiers)
{
bool ignoreEvent = true;
if (modifiers == (Qt::ControlModifier | Qt::AltModifier)) {
KisPaintOpSettings::setNode(m_activeNode);
}
if (modifiers == Qt::ControlModifier) {
m_position = info.pos();
m_isOffsetNotUptodate = true;
......@@ -91,17 +95,6 @@ bool KisDuplicateOpSettings::mousePressEvent(const KisPaintInformation &info, Qt
void KisDuplicateOpSettings::activate()
{
KisDuplicateOpSettingsWidget* options = dynamic_cast<KisDuplicateOpSettingsWidget*>(optionsWidget());
if (!options)
return;
if (m_image && m_image->perspectiveGrid()->countSubGrids() != 1) {
options->m_duplicateOption->setHealing(false);
options->m_duplicateOption->setPerspective(false);
}
else {
options->m_duplicateOption->setPerspective(false);
}
}
void KisDuplicateOpSettings::fromXML(const QDomElement& elt)
......@@ -129,13 +122,11 @@ KisPaintOpSettingsSP KisDuplicateOpSettings::clone() const
{
KisPaintOpSettingsSP setting = KisPaintOpSettings::clone();
KisDuplicateOpSettings* s = dynamic_cast<KisDuplicateOpSettings*>(setting.data());
s->m_image = m_image;
s->m_offset = m_offset;
s->m_isOffsetNotUptodate = m_isOffsetNotUptodate;
s->m_position = m_position;
return setting;
}
QPainterPath KisDuplicateOpSettings::brushOutline(const KisPaintInformation &info, OutlineMode mode) const
......@@ -166,3 +157,13 @@ QPainterPath KisDuplicateOpSettings::brushOutline(const KisPaintInformation &inf
return path;
}
void KisDuplicateOpSettings::setNode(KisNodeSP node)
{
if (KisPaintOpSettings::node()) {
m_activeNode = node;
}
else {
KisPaintOpSettings::setNode(node);
}
}
......@@ -37,7 +37,7 @@ public:
using KisPaintOpSettings::fromXML;
using KisPaintOpSettings::toXML;
KisDuplicateOpSettings(KisImageWSP image);
KisDuplicateOpSettings();
virtual ~KisDuplicateOpSettings();
bool paintIncremental();
......@@ -54,9 +54,16 @@ public:
KisPaintOpSettingsSP clone() const;
QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) const;
// hijack the setNode of the KisPaintopSettings class. We want to be able to
// switch nodes to duplicated onto a new layer without starting to clone from
// the new layer; only if the user ctrl-shift-clicks, we start cloning from the
// currently selected layer.
virtual void setNode(KisNodeSP node);
public:
KisNodeSP m_activeNode;
QPointF m_offset;
KisImageWSP m_image;
bool m_isOffsetNotUptodate;
QPointF m_position; // Give the position of the last alt-click
};
......
......@@ -55,7 +55,7 @@ KisDuplicateOpSettingsWidget::~KisDuplicateOpSettingsWidget()
KisPropertiesConfiguration* KisDuplicateOpSettingsWidget::configuration() const
{
KisDuplicateOpSettings *config = new KisDuplicateOpSettings(0);
KisDuplicateOpSettings *config = new KisDuplicateOpSettings();
config->setOptionsWidget(const_cast<KisDuplicateOpSettingsWidget*>(this));
config->setProperty("paintop", "duplicate"); // XXX: make this a const id string
writeConfiguration(config);
......
......@@ -6,39 +6,95 @@
<rect>
<x>0</x>
<y>0</y>
<width>185</width>
<height>87</height>
<width>474</width>
<height>193</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="cbHealing">
<property name="text">
<string>Healing</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbPerspective">
<property name="text">
<string>Correct the perspective</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbSourcePoint">
<property name="text">
<string>Source point move</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="cbHealing">
<property name="text">
<string>Healing</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbPerspective">
<property name="toolTip">
<string>To correct perspective, first create a perspective grid.</string>
</property>
<property name="text">
<string>Correct the perspective</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbSourcePoint">
<property name="toolTip">
<string>Move the clone origin with the brush. Uncheck to keep cloning from the selected point.</string>
</property>
<property name="text">
<string>Source point move</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkCloneProjection">
<property name="toolTip">
<string>When checked, clone from all visible layers. Otherwise, clone from the active layer.</string>
</property>
<property name="text">
<string>Clone From All Visible Layers</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Clone Brush:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Select the source point with ctrl-click. The clone brush will continue cloning from the layer that was active when you selected the brush. You can select a different layer to clone onto.&lt;/p&gt;&lt;p&gt;If you want to clone from a different layer, select a different layer and press ctrl-alt-click.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>2</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
......
......@@ -44,9 +44,8 @@ KisPaintOp * KisDeformPaintOpFactory::createOp(const KisPaintOpSettingsSP settin
return op;
}
KisPaintOpSettingsSP KisDeformPaintOpFactory::settings(KisImageWSP image)
KisPaintOpSettingsSP KisDeformPaintOpFactory::settings()
{
Q_UNUSED(image);
return new KisDeformPaintOpSettings();
}
......
......@@ -51,7 +51,7 @@ public:
return KisPaintOpFactory::categoryStable();
}
virtual KisPaintOpSettingsSP settings(KisImageWSP image);
virtual KisPaintOpSettingsSP settings();
virtual KisPaintOpSettingsWidget* createSettingsWidget(QWidget* parent);
};
......
......@@ -100,8 +100,7 @@ public:
return op;
}
KisPaintOpSettingsSP settings(KisImageWSP image) {
Q_UNUSED(image);
KisPaintOpSettingsSP settings() {
KisPaintOpSettingsSP settings = new OpSettings();
settings->setModelName(m_model);
return settings;
......
......@@ -85,9 +85,8 @@ KisPaintOp * MyPaintFactory::createOp(const KisPaintOpSettingsSP settings, KisPa
return op;
}
KisPaintOpSettingsSP MyPaintFactory::settings(KisImageWSP image)
KisPaintOpSettingsSP MyPaintFactory::settings()
{
Q_UNUSED(image);
return new MyPaintSettings();
}
......@@ -123,7 +122,7 @@ void MyPaintFactory::processAfterLoading()
if (blackList.contains(i.key())) continue;
//Create a preset for every loaded brush
KisPaintOpSettingsSP s = settings(0);
KisPaintOpSettingsSP s = settings();
s->setProperty("paintop", id());
s->setProperty("filename", i.key());
......
......@@ -63,7 +63,7 @@ public:
return KisPaintOpFactory::categoryStable();
}
virtual KisPaintOpSettingsSP settings(KisImageWSP image);
virtual KisPaintOpSettingsSP settings();
virtual KisPaintOpSettingsWidget* createSettingsWidget(QWidget* parent);
QList<MyPaintBrushResource*> brushes() const;
......
......@@ -51,7 +51,7 @@ public:
KisPaintOpPresetSP preset = new KisPaintOpPreset(path);
if (!preset->load())
preset = KisPaintOpRegistry::instance()->defaultPreset(paintOp, view->image());
preset = KisPaintOpRegistry::instance()->defaultPreset(paintOp);
Q_ASSERT(preset);
Q_ASSERT(preset->valid());
......
......@@ -438,7 +438,7 @@ KisPaintOpPresetSP KisPaintopBox::defaultPreset(const KoID& paintOp)
KisPaintOpPresetSP preset = new KisPaintOpPreset(path);
if (!preset->load()) {
preset = KisPaintOpRegistry::instance()->defaultPreset(paintOp, m_view->image());
preset = KisPaintOpRegistry::instance()->defaultPreset(paintOp);
}
Q_ASSERT(preset);
......@@ -663,7 +663,6 @@ void KisPaintopBox::slotSetupDefaultPreset()
void KisPaintopBox::slotNodeChanged(const KisNodeSP node)
{
// Deconnect colorspace change of previous node
if (m_previousNode && m_previousNode->paintDevice())
disconnect(m_previousNode->paintDevice().data(), SIGNAL(colorSpaceChanged(const KoColorSpace*)), this, SLOT(slotColorSpaceChanged(const KoColorSpace*)));
......@@ -676,9 +675,15 @@ void KisPaintopBox::slotNodeChanged(const KisNodeSP node)
slotColorSpaceChanged(node->colorSpace());
}
for(TabletToolMap::iterator itr=m_tabletToolMap.begin(); itr!=m_tabletToolMap.end(); ++itr) {
if(itr->preset && itr->preset->settings())
for (TabletToolMap::iterator itr = m_tabletToolMap.begin(); itr != m_tabletToolMap.end(); ++itr) {
if(itr->preset && itr->preset->settings()) {
itr->preset->settings()->setNode(node);
}
}
if (m_resourceProvider->currentPreset() && m_resourceProvider->currentPreset()->settings()) {
m_resourceProvider->currentPreset()->settings()->setNode(node);
}
}
......
......@@ -150,8 +150,6 @@ private:
QMap<KoID,KisPaintOpSettingsWidget*> m_paintopOptionWidgets;
KisFavoriteResourceManager* m_favoriteResourceManager;
// KisPaintOpPresetSP m_activePreset;
// KisPaintOpPresetSP m_previousPreset;
QString m_prevCompositeOpID;
QString m_currCompositeOpID;
KisNodeSP m_previousNode;
......
......@@ -121,7 +121,7 @@ void KisRecordedPaintActionEditor::paintOpChanged(int index)
QString id = m_paintops[index];
KisPaintOpPresetSP preset = m_paintOpsToPreset[id];
if (!preset) {
preset = KisPaintOpRegistry::instance()->defaultPreset(KoID(id, ""), 0);
preset = KisPaintOpRegistry::instance()->defaultPreset(KoID(id, ""));
m_paintOpsToPreset[id] = preset;
}
m_action->setPaintOpPreset(preset);
......
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