Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Krita
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tusooa Zhu
Krita
Commits
4814ee73
Commit
4814ee73
authored
Oct 15, 2014
by
Dmitry Kazakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let liquify transform tool save the values of the options into the config file
parent
8ceed52e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
269 additions
and
140 deletions
+269
-140
krita/plugins/tools/tool_transform2/CMakeLists.txt
krita/plugins/tools/tool_transform2/CMakeLists.txt
+1
-0
krita/plugins/tools/tool_transform2/kis_liquify_paint_helper.cpp
...lugins/tools/tool_transform2/kis_liquify_paint_helper.cpp
+4
-2
krita/plugins/tools/tool_transform2/kis_liquify_paint_helper.h
.../plugins/tools/tool_transform2/kis_liquify_paint_helper.h
+5
-5
krita/plugins/tools/tool_transform2/kis_liquify_paintop.cpp
krita/plugins/tools/tool_transform2/kis_liquify_paintop.cpp
+23
-18
krita/plugins/tools/tool_transform2/kis_liquify_paintop.h
krita/plugins/tools/tool_transform2/kis_liquify_paintop.h
+5
-4
krita/plugins/tools/tool_transform2/kis_liquify_properties.cpp
.../plugins/tools/tool_transform2/kis_liquify_properties.cpp
+77
-0
krita/plugins/tools/tool_transform2/kis_liquify_properties.h
krita/plugins/tools/tool_transform2/kis_liquify_properties.h
+108
-0
krita/plugins/tools/tool_transform2/kis_tool_transform.cc
krita/plugins/tools/tool_transform2/kis_tool_transform.cc
+4
-0
krita/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp
...ools/tool_transform2/kis_tool_transform_config_widget.cpp
+30
-27
krita/plugins/tools/tool_transform2/tool_transform_args.cc
krita/plugins/tools/tool_transform2/tool_transform_args.cc
+6
-0
krita/plugins/tools/tool_transform2/tool_transform_args.h
krita/plugins/tools/tool_transform2/tool_transform_args.h
+6
-84
No files found.
krita/plugins/tools/tool_transform2/CMakeLists.txt
View file @
4814ee73
...
...
@@ -10,6 +10,7 @@ set(kritatooltransform_PART_SRCS
kis_liquify_transform_strategy.cpp
kis_liquify_paint_helper.cpp
kis_liquify_paintop.cpp
kis_liquify_properties.cpp
kis_free_transform_strategy.cpp
kis_free_transform_strategy_gsl_helpers.cpp
kis_perspective_transform_strategy.cpp
...
...
krita/plugins/tools/tool_transform2/kis_liquify_paint_helper.cpp
View file @
4814ee73
...
...
@@ -25,6 +25,8 @@
#include "kis_paintop_utils.h"
#include "kis_coordinates_converter.h"
#include "kis_liquify_paintop.h"
#include "kis_liquify_properties.h"
#include "kis_paintop_utils.h"
...
...
@@ -72,7 +74,7 @@ void KisLiquifyPaintHelper::Private::updatePreviousPaintInfo(const KisPaintInfor
previousPaintInfo
=
info
;
}
QPainterPath
KisLiquifyPaintHelper
::
brushOutline
(
const
ToolTransformArgs
::
LiquifyProperties
&
props
)
const
QPainterPath
KisLiquifyPaintHelper
::
brushOutline
(
const
Kis
LiquifyProperties
&
props
)
const
{
KisPaintInformation
::
DistanceInformationRegistrar
registrar
=
m_d
->
previousPaintInfo
.
registerDistanceInformation
(
&
m_d
->
previousDistanceInfo
);
...
...
@@ -80,7 +82,7 @@ QPainterPath KisLiquifyPaintHelper::brushOutline(const ToolTransformArgs::Liquif
return
KisLiquifyPaintop
::
brushOutline
(
props
,
m_d
->
previousPaintInfo
);
}
void
KisLiquifyPaintHelper
::
configurePaintOp
(
const
ToolTransformArgs
::
LiquifyProperties
&
props
,
void
KisLiquifyPaintHelper
::
configurePaintOp
(
const
Kis
LiquifyProperties
&
props
,
KisLiquifyTransformWorker
*
worker
)
{
m_d
->
paintOp
.
reset
(
new
KisLiquifyPaintop
(
props
,
worker
));
...
...
krita/plugins/tools/tool_transform2/kis_liquify_paint_helper.h
View file @
4814ee73
...
...
@@ -21,13 +21,13 @@
#include <QScopedPointer>
// FIXME: for liquifyprops only
#include "tool_transform_args.h"
class
KisPaintInformation
;
class
KisLiquifyTransformWorker
;
class
KisCoordinatesConverter
;
class
KoPointerEvent
;
class
KisLiquifyProperties
;
class
QPainterPath
;
class
KisLiquifyPaintHelper
{
...
...
@@ -35,7 +35,7 @@ public:
KisLiquifyPaintHelper
(
const
KisCoordinatesConverter
*
converter
);
~
KisLiquifyPaintHelper
();
void
configurePaintOp
(
const
ToolTransformArgs
::
LiquifyProperties
&
_props
,
void
configurePaintOp
(
const
Kis
LiquifyProperties
&
_props
,
KisLiquifyTransformWorker
*
worker
);
void
startPaint
(
KoPointerEvent
*
event
);
...
...
@@ -44,7 +44,7 @@ public:
void
hoverPaint
(
KoPointerEvent
*
event
);
QPainterPath
brushOutline
(
const
ToolTransformArgs
::
LiquifyProperties
&
props
)
const
;
QPainterPath
brushOutline
(
const
Kis
LiquifyProperties
&
props
)
const
;
private:
struct
Private
;
...
...
krita/plugins/tools/tool_transform2/kis_liquify_paintop.cpp
View file @
4814ee73
...
...
@@ -18,21 +18,26 @@
#include "kis_liquify_paintop.h"
#include <QPainterPath>
#include <QTransform>
#include "kis_paint_information.h"
#include "kis_liquify_transform_worker.h"
#include "kis_algebra_2d.h"
#include "kis_liquify_properties.h"
struct
KisLiquifyPaintop
::
Private
{
Private
(
const
ToolTransformArgs
::
LiquifyProperties
&
_props
,
KisLiquifyTransformWorker
*
_worker
)
Private
(
const
Kis
LiquifyProperties
&
_props
,
KisLiquifyTransformWorker
*
_worker
)
:
props
(
_props
),
worker
(
_worker
)
{}
ToolTransformArgs
::
LiquifyProperties
props
;
Kis
LiquifyProperties
props
;
KisLiquifyTransformWorker
*
worker
;
};
KisLiquifyPaintop
::
KisLiquifyPaintop
(
const
ToolTransformArgs
::
LiquifyProperties
&
props
,
KisLiquifyTransformWorker
*
worker
)
KisLiquifyPaintop
::
KisLiquifyPaintop
(
const
Kis
LiquifyProperties
&
props
,
KisLiquifyTransformWorker
*
worker
)
:
m_d
(
new
Private
(
props
,
worker
))
{
}
...
...
@@ -41,7 +46,7 @@ KisLiquifyPaintop::~KisLiquifyPaintop()
{
}
QPainterPath
KisLiquifyPaintop
::
brushOutline
(
const
ToolTransformArgs
::
LiquifyProperties
&
props
,
QPainterPath
KisLiquifyPaintop
::
brushOutline
(
const
Kis
LiquifyProperties
&
props
,
const
KisPaintInformation
&
info
)
{
const
qreal
diameter
=
props
.
size
();
...
...
@@ -51,11 +56,11 @@ QPainterPath KisLiquifyPaintop::brushOutline(const ToolTransformArgs::LiquifyPro
outline
.
addEllipse
(
-
0.5
*
diameter
,
-
0.5
*
diameter
,
diameter
,
diameter
);
switch
(
props
.
currentM
ode
())
{
case
ToolTransformArgs
::
LiquifyProperties
::
MOVE
:
case
ToolTransformArgs
::
LiquifyProperties
::
SCALE
:
switch
(
props
.
m
ode
())
{
case
Kis
LiquifyProperties
::
MOVE
:
case
Kis
LiquifyProperties
::
SCALE
:
break
;
case
ToolTransformArgs
::
LiquifyProperties
::
ROTATE
:
{
case
Kis
LiquifyProperties
::
ROTATE
:
{
QPainterPath
p
;
p
.
lineTo
(
-
3.0
,
4.0
);
p
.
moveTo
(
0.0
,
0.0
);
...
...
@@ -75,7 +80,7 @@ QPainterPath KisLiquifyPaintop::brushOutline(const ToolTransformArgs::LiquifyPro
break
;
}
case
ToolTransformArgs
::
LiquifyProperties
::
OFFSET
:
{
case
Kis
LiquifyProperties
::
OFFSET
:
{
qreal
normalAngle
=
info
.
drawingAngle
()
+
reverseCoeff
*
0.5
*
M_PI
;
QPainterPath
p
=
KisAlgebra2D
::
smallArrow
();
...
...
@@ -91,7 +96,7 @@ QPainterPath KisLiquifyPaintop::brushOutline(const ToolTransformArgs::LiquifyPro
break
;
}
case
ToolTransformArgs
::
LiquifyProperties
::
UNDO
:
case
Kis
LiquifyProperties
::
UNDO
:
break
;
}
...
...
@@ -109,8 +114,8 @@ KisSpacingInformation KisLiquifyPaintop::paintAt(const KisPaintInformation &pi)
const
qreal
spacing
=
m_d
->
props
.
spacing
()
*
size
;
const
qreal
reverseCoeff
=
m_d
->
props
.
currentM
ode
()
!=
ToolTransformArgs
::
LiquifyProperties
::
UNDO
&&
m_d
->
props
.
m
ode
()
!=
Kis
LiquifyProperties
::
UNDO
&&
m_d
->
props
.
reverseDirection
()
?
-
1.0
:
1.0
;
const
qreal
amount
=
m_d
->
props
.
amountHasPressure
()
?
pi
.
pressure
()
*
reverseCoeff
*
m_d
->
props
.
amount
()
:
...
...
@@ -118,8 +123,8 @@ KisSpacingInformation KisLiquifyPaintop::paintAt(const KisPaintInformation &pi)
switch
(
m_d
->
props
.
currentM
ode
())
{
case
ToolTransformArgs
::
LiquifyProperties
::
MOVE
:
{
switch
(
m_d
->
props
.
m
ode
())
{
case
Kis
LiquifyProperties
::
MOVE
:
{
const
qreal
offsetLength
=
size
*
amount
;
m_d
->
worker
->
translatePoints
(
pi
.
pos
(),
pi
.
drawingDirectionVector
()
*
offsetLength
,
...
...
@@ -127,24 +132,24 @@ KisSpacingInformation KisLiquifyPaintop::paintAt(const KisPaintInformation &pi)
break
;
}
case
ToolTransformArgs
::
LiquifyProperties
::
SCALE
:
case
Kis
LiquifyProperties
::
SCALE
:
m_d
->
worker
->
scalePoints
(
pi
.
pos
(),
amount
,
size
);
break
;
case
ToolTransformArgs
::
LiquifyProperties
::
ROTATE
:
case
Kis
LiquifyProperties
::
ROTATE
:
m_d
->
worker
->
rotatePoints
(
pi
.
pos
(),
2.0
*
M_PI
*
amount
,
size
);
break
;
case
ToolTransformArgs
::
LiquifyProperties
::
OFFSET
:
{
case
Kis
LiquifyProperties
::
OFFSET
:
{
const
qreal
offsetLength
=
size
*
amount
;
m_d
->
worker
->
translatePoints
(
pi
.
pos
(),
KisAlgebra2D
::
rightUnitNormal
(
pi
.
drawingDirectionVector
())
*
offsetLength
,
size
);
break
;
}
case
ToolTransformArgs
::
LiquifyProperties
::
UNDO
:
case
Kis
LiquifyProperties
::
UNDO
:
m_d
->
worker
->
undoPoints
(
pi
.
pos
(),
amount
,
size
);
...
...
krita/plugins/tools/tool_transform2/kis_liquify_paintop.h
View file @
4814ee73
...
...
@@ -21,22 +21,23 @@
#include <QScopedPointer>
#include "tool_transform_args.h"
class
KisLiquifyTransformWorker
;
class
KisPaintInformation
;
class
KisSpacingInformation
;
class
KisLiquifyProperties
;
class
QPainterPath
;
class
KisLiquifyPaintop
{
public:
KisLiquifyPaintop
(
const
ToolTransformArgs
::
LiquifyProperties
&
props
,
KisLiquifyPaintop
(
const
Kis
LiquifyProperties
&
props
,
KisLiquifyTransformWorker
*
worker
);
~
KisLiquifyPaintop
();
KisSpacingInformation
paintAt
(
const
KisPaintInformation
&
pi
);
static
QPainterPath
brushOutline
(
const
ToolTransformArgs
::
LiquifyProperties
&
props
,
static
QPainterPath
brushOutline
(
const
Kis
LiquifyProperties
&
props
,
const
KisPaintInformation
&
info
);
private:
...
...
krita/plugins/tools/tool_transform2/kis_liquify_properties.cpp
0 → 100644
View file @
4814ee73
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_liquify_properties.h"
#include <kglobal.h>
#include <kglobalsettings.h>
#include <kconfig.h>
#include <kconfiggroup.h>
#include "kis_debug.h"
QString
liquifyModeString
(
KisLiquifyProperties
::
LiquifyMode
mode
)
{
QString
result
;
switch
(
mode
)
{
case
KisLiquifyProperties
::
MOVE
:
result
=
"Move"
;
break
;
case
KisLiquifyProperties
::
SCALE
:
result
=
"Scale"
;
break
;
case
KisLiquifyProperties
::
ROTATE
:
result
=
"Rotate"
;
break
;
case
KisLiquifyProperties
::
OFFSET
:
result
=
"Offset"
;
break
;
case
KisLiquifyProperties
::
UNDO
:
result
=
"Undo"
;
break
;
}
return
QString
(
"LiquifyTool/%1"
).
arg
(
result
);
}
void
KisLiquifyProperties
::
saveMode
()
const
{
KConfigGroup
cfg
=
KGlobal
::
config
()
->
group
(
liquifyModeString
(
m_mode
));
cfg
.
writeEntry
(
"size"
,
m_size
);
cfg
.
writeEntry
(
"amount"
,
m_amount
);
cfg
.
writeEntry
(
"spacing"
,
m_spacing
);
cfg
.
writeEntry
(
"sizeHasPressure"
,
m_sizeHasPressure
);
cfg
.
writeEntry
(
"amountHasPressure"
,
m_amountHasPressure
);
cfg
.
writeEntry
(
"reverseDirection"
,
m_reverseDirection
);
}
void
KisLiquifyProperties
::
loadMode
()
{
KConfigGroup
cfg
=
KGlobal
::
config
()
->
group
(
liquifyModeString
(
m_mode
));
m_size
=
cfg
.
readEntry
(
"size"
,
m_size
);
m_amount
=
cfg
.
readEntry
(
"amount"
,
m_amount
);
m_spacing
=
cfg
.
readEntry
(
"spacing"
,
m_spacing
);
m_sizeHasPressure
=
cfg
.
readEntry
(
"sizeHasPressure"
,
m_sizeHasPressure
);
m_amountHasPressure
=
cfg
.
readEntry
(
"amountHasPressure"
,
m_amountHasPressure
);
m_reverseDirection
=
cfg
.
readEntry
(
"reverseDirection"
,
m_reverseDirection
);
}
krita/plugins/tools/tool_transform2/kis_liquify_properties.h
0 → 100644
View file @
4814ee73
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_LIQUIFY_PROPERTIES_H
#define __KIS_LIQUIFY_PROPERTIES_H
#include <QtGlobal>
class
KisLiquifyProperties
{
public:
enum
LiquifyMode
{
MOVE
,
SCALE
,
ROTATE
,
OFFSET
,
UNDO
};
KisLiquifyProperties
()
:
m_mode
(
MOVE
),
m_size
(
50
),
m_amount
(
0.2
),
m_spacing
(
0.2
),
m_sizeHasPressure
(
false
),
m_amountHasPressure
(
false
),
m_reverseDirection
(
false
)
{
}
LiquifyMode
mode
()
const
{
return
m_mode
;
}
void
setMode
(
LiquifyMode
value
)
{
m_mode
=
value
;
}
qreal
size
()
const
{
return
m_size
;
}
void
setSize
(
qreal
value
)
{
m_size
=
value
;
}
qreal
amount
()
const
{
return
m_amount
;
}
void
setAmount
(
qreal
value
)
{
m_amount
=
value
;
}
qreal
spacing
()
const
{
return
m_spacing
;
}
void
setSpacing
(
qreal
value
)
{
m_spacing
=
value
;
}
bool
sizeHasPressure
()
const
{
return
m_sizeHasPressure
;
}
void
setSizeHasPressure
(
bool
value
)
{
m_sizeHasPressure
=
value
;
}
bool
amountHasPressure
()
const
{
return
m_amountHasPressure
;
}
void
setAmountHasPressure
(
bool
value
)
{
m_amountHasPressure
=
value
;
}
bool
reverseDirection
()
const
{
return
m_reverseDirection
;
}
void
setReverseDirection
(
bool
value
)
{
m_reverseDirection
=
value
;
}
void
saveMode
()
const
;
void
loadMode
();
private:
LiquifyMode
m_mode
;
qreal
m_size
;
qreal
m_amount
;
qreal
m_spacing
;
bool
m_sizeHasPressure
;
bool
m_amountHasPressure
;
bool
m_reverseDirection
;
};
#endif
/* __KIS_LIQUIFY_PROPERTIES_H */
krita/plugins/tools/tool_transform2/kis_tool_transform.cc
View file @
4814ee73
...
...
@@ -908,6 +908,10 @@ void KisToolTransform::slotUiChangedConfig()
currentStrategy
()
->
externalConfigChanged
();
if
(
m_currentArgs
.
mode
()
==
ToolTransformArgs
::
LIQUIFY
)
{
m_currentArgs
.
saveLiquifyTransformMode
();
}
outlineChanged
();
updateApplyResetAvailability
();
}
...
...
krita/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp
View file @
4814ee73
...
...
@@ -22,6 +22,7 @@
#include "rotation_icons.h"
#include "kis_canvas2.h"
#include <QSignalMapper>
#include "kis_liquify_properties.h"
template
<
typename
T
>
inline
T
sign
(
T
x
)
{
...
...
@@ -167,11 +168,11 @@ KisToolTransformConfigWidget::KisToolTransformConfigWidget(TransformTransactionP
connect
(
liquifyRotate
,
SIGNAL
(
toggled
(
bool
)),
liquifyModeMapper
,
SLOT
(
map
()));
connect
(
liquifyOffset
,
SIGNAL
(
toggled
(
bool
)),
liquifyModeMapper
,
SLOT
(
map
()));
connect
(
liquifyUndo
,
SIGNAL
(
toggled
(
bool
)),
liquifyModeMapper
,
SLOT
(
map
()));
liquifyModeMapper
->
setMapping
(
liquifyMove
,
(
int
)
ToolTransformArgs
::
LiquifyProperties
::
MOVE
);
liquifyModeMapper
->
setMapping
(
liquifyScale
,
(
int
)
ToolTransformArgs
::
LiquifyProperties
::
SCALE
);
liquifyModeMapper
->
setMapping
(
liquifyRotate
,
(
int
)
ToolTransformArgs
::
LiquifyProperties
::
ROTATE
);
liquifyModeMapper
->
setMapping
(
liquifyOffset
,
(
int
)
ToolTransformArgs
::
LiquifyProperties
::
OFFSET
);
liquifyModeMapper
->
setMapping
(
liquifyUndo
,
(
int
)
ToolTransformArgs
::
LiquifyProperties
::
UNDO
);
liquifyModeMapper
->
setMapping
(
liquifyMove
,
(
int
)
Kis
LiquifyProperties
::
MOVE
);
liquifyModeMapper
->
setMapping
(
liquifyScale
,
(
int
)
Kis
LiquifyProperties
::
SCALE
);
liquifyModeMapper
->
setMapping
(
liquifyRotate
,
(
int
)
Kis
LiquifyProperties
::
ROTATE
);
liquifyModeMapper
->
setMapping
(
liquifyOffset
,
(
int
)
Kis
LiquifyProperties
::
OFFSET
);
liquifyModeMapper
->
setMapping
(
liquifyUndo
,
(
int
)
Kis
LiquifyProperties
::
UNDO
);
connect
(
liquifyModeMapper
,
SIGNAL
(
mapped
(
int
)),
SLOT
(
slotLiquifyModeChanged
(
int
)));
liquifyMove
->
setToolTip
(
i18nc
(
"@info:tooltip"
,
"Drag the image along the brush stroke"
));
...
...
@@ -260,7 +261,7 @@ void KisToolTransformConfigWidget::updateLiquifyControls()
blockUiSlots
();
ToolTransformArgs
*
config
=
m_transaction
->
currentConfig
();
ToolTransformArgs
::
LiquifyProperties
*
props
=
Kis
LiquifyProperties
*
props
=
config
->
liquifyProperties
();
liquifySizeSlider
->
setValue
(
props
->
size
());
...
...
@@ -271,11 +272,11 @@ void KisToolTransformConfigWidget::updateLiquifyControls()
liquifyReverseDirectionChk
->
setChecked
(
props
->
reverseDirection
());
ToolTransformArgs
::
LiquifyProperties
::
LiquifyMode
mode
=
static_cast
<
ToolTransformArgs
::
LiquifyProperties
::
LiquifyMode
>
(
props
->
currentM
ode
());
Kis
LiquifyProperties
::
LiquifyMode
mode
=
static_cast
<
KisLiquifyProperties
::
LiquifyMode
>
(
props
->
m
ode
());
bool
canInverseDirection
=
mode
!=
ToolTransformArgs
::
LiquifyProperties
::
UNDO
;
mode
!=
Kis
LiquifyProperties
::
UNDO
;
liquifyReverseDirectionChk
->
setEnabled
(
canInverseDirection
);
...
...
@@ -288,15 +289,17 @@ void KisToolTransformConfigWidget::slotLiquifyModeChanged(int value)
ToolTransformArgs
*
config
=
m_transaction
->
currentConfig
();
ToolTransformArgs
::
LiquifyProperties
*
props
=
Kis
LiquifyProperties
*
props
=
config
->
liquifyProperties
();
ToolTransformArgs
::
LiquifyProperties
::
LiquifyMode
mode
=
static_cast
<
ToolTransformArgs
::
LiquifyProperties
::
LiquifyMode
>
(
value
);
Kis
LiquifyProperties
::
LiquifyMode
mode
=
static_cast
<
Kis
LiquifyProperties
::
LiquifyMode
>
(
value
);
if
(
mode
==
props
->
currentMode
())
return
;
if
(
mode
==
props
->
mode
())
return
;
props
->
setMode
(
mode
);
props
->
loadMode
();
props
->
setCurrentMode
(
mode
);
updateLiquifyControls
();
notifyConfigChanged
();
...
...
@@ -307,7 +310,7 @@ void KisToolTransformConfigWidget::liquifySizeChanged(qreal value)
if
(
m_uiSlotsBlocked
)
return
;
ToolTransformArgs
*
config
=
m_transaction
->
currentConfig
();
ToolTransformArgs
::
LiquifyProperties
*
props
=
Kis
LiquifyProperties
*
props
=
config
->
liquifyProperties
();
props
->
setSize
(
value
);
...
...
@@ -319,7 +322,7 @@ void KisToolTransformConfigWidget::liquifyAmountChanged(qreal value)
if
(
m_uiSlotsBlocked
)
return
;
ToolTransformArgs
*
config
=
m_transaction
->
currentConfig
();
ToolTransformArgs
::
LiquifyProperties
*
props
=
Kis
LiquifyProperties
*
props
=
config
->
liquifyProperties
();
props
->
setAmount
(
value
);
...
...
@@ -331,7 +334,7 @@ void KisToolTransformConfigWidget::liquifySpacingChanged(qreal value)
if
(
m_uiSlotsBlocked
)
return
;
ToolTransformArgs
*
config
=
m_transaction
->
currentConfig
();
ToolTransformArgs
::
LiquifyProperties
*
props
=
Kis
LiquifyProperties
*
props
=
config
->
liquifyProperties
();
props
->
setSpacing
(
value
);
...
...
@@ -343,7 +346,7 @@ void KisToolTransformConfigWidget::liquifySizePressureChanged(bool value)
if
(
m_uiSlotsBlocked
)
return
;
ToolTransformArgs
*
config
=
m_transaction
->
currentConfig
();
ToolTransformArgs
::
LiquifyProperties
*
props
=
Kis
LiquifyProperties
*
props
=
config
->
liquifyProperties
();
props
->
setSizeHasPressure
(
value
);
...
...
@@ -355,7 +358,7 @@ void KisToolTransformConfigWidget::liquifyAmountPressureChanged(bool value)
if
(
m_uiSlotsBlocked
)
return
;
ToolTransformArgs
*
config
=
m_transaction
->
currentConfig
();
ToolTransformArgs
::
LiquifyProperties
*
props
=
Kis
LiquifyProperties
*
props
=
config
->
liquifyProperties
();
props
->
setAmountHasPressure
(
value
);
...
...
@@ -367,7 +370,7 @@ void KisToolTransformConfigWidget::liquifyReverseDirectionChanged(bool value)
if
(
m_uiSlotsBlocked
)
return
;
ToolTransformArgs
*
config
=
m_transaction
->
currentConfig
();
ToolTransformArgs
::
LiquifyProperties
*
props
=
Kis
LiquifyProperties
*
props
=
config
->
liquifyProperties
();
props
->
setReverseDirection
(
value
);
...
...
@@ -451,23 +454,23 @@ void KisToolTransformConfigWidget::updateConfig(const ToolTransformArgs &config)
stackedWidget
->
setCurrentIndex
(
3
);
liquifyButton
->
setChecked
(
true
);
const
ToolTransformArgs
::
LiquifyProperties
*
props
=
const
Kis
LiquifyProperties
*
props
=
config
.
liquifyProperties
();
switch
(
props
->
currentM
ode
())
{
case
ToolTransformArgs
::
LiquifyProperties
::
MOVE
:
switch
(
props
->
m
ode
())
{
case
Kis
LiquifyProperties
::
MOVE
:
liquifyMove
->
setChecked
(
true
);
break
;
case
ToolTransformArgs
::
LiquifyProperties
::
SCALE
:
case
Kis
LiquifyProperties
::
SCALE
:
liquifyScale
->
setChecked
(
true
);
break
;
case
ToolTransformArgs
::
LiquifyProperties
::
ROTATE
:
case
Kis
LiquifyProperties
::
ROTATE
:
liquifyRotate
->
setChecked
(
true
);
break
;
case
ToolTransformArgs
::
LiquifyProperties
::
OFFSET
:
case
Kis
LiquifyProperties
::
OFFSET
:
liquifyOffset
->
setChecked
(
true
);
break
;
case
ToolTransformArgs
::
LiquifyProperties
::
UNDO
:
case
Kis
LiquifyProperties
::
UNDO
:
liquifyUndo
->
setChecked
(
true
);
break
;
}
...
...
krita/plugins/tools/tool_transform2/tool_transform_args.cc
View file @
4814ee73
...
...
@@ -167,5 +167,11 @@ bool ToolTransformArgs::isIdentity() const
void
ToolTransformArgs
::
initLiquifyTransformMode
(
const
QRect
&
srcRect
)
{
m_liquifyWorker
.
reset
(
new
KisLiquifyTransformWorker
(
srcRect
,
0
,
8
));
m_liquifyProperties
.
loadMode
();
}
void
ToolTransformArgs
::
saveLiquifyTransformMode
()
const
{
m_liquifyProperties
.
saveMode
();
}
krita/plugins/tools/tool_transform2/tool_transform_args.h
View file @
4814ee73
...
...
@@ -25,6 +25,8 @@
#include <QVector3D>
#include <kis_warptransform_worker.h>
#include <kis_filter_strategy.h>
#include "kis_liquify_properties.h"
#include <QScopedPointer>
class
KisLiquifyTransformWorker
;
...
...
@@ -243,96 +245,16 @@ public:
m_editTransformPoints
=
value
;
}
class
LiquifyProperties
{
public:
enum
LiquifyMode
{
MOVE
,
SCALE
,
ROTATE
,
OFFSET
,
UNDO
};
LiquifyProperties
()
:
m_currentMode
(
MOVE
),
m_size
(
50
),
m_amount
(
1.0
),
m_spacing
(
0.2
),
m_sizeHasPressure
(
false
),
m_amountHasPressure
(
false
),
m_reverseDirection
(
false
)
{
}