2
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
#ifndef KIS_SPRAY_SHAPE_DYNAMICS_OPTION_H
20
#define KIS_SPRAY_SHAPE_DYNAMICS_OPTION_H
22
#include <kis_paintop_option.h>
24
const QString SHAPE_DYNAMICS_VERSION = "ShapeDynamicsVersion";
26
// Old Krita 2.2.x strings for backward compatibility
27
const QString SPRAYSHAPE_RANDOM_SIZE = "SprayShape/randomSize";
28
const QString SPRAYSHAPE_FIXED_ROTATION = "SprayShape/fixedRotation";
29
const QString SPRAYSHAPE_FIXED_ANGEL = "SprayShape/fixedAngle";
30
const QString SPRAYSHAPE_RANDOM_ROTATION = "SprayShape/randomRotation";
31
const QString SPRAYSHAPE_RANDOM_ROTATION_WEIGHT = "SprayShape/randomRotationWeight";
32
const QString SPRAYSHAPE_FOLLOW_CURSOR = "SprayShape/followCursor";
33
const QString SPRAYSHAPE_FOLLOW_CURSOR_WEIGHT = "SprayShape/followCursorWeigth";
34
const QString SPRAYSHAPE_DRAWING_ANGLE = "SprayShape/followDrawingAngle";
35
const QString SPRAYSHAPE_DRAWING_ANGLE_WEIGHT = "SprayShape/followDrawingAngleWeigth";
37
// My intention is to have the option dialog more general so that it can be share
38
// hence the suffix ShapeDynamics
39
const QString SHAPE_DYNAMICS_ENABLED = "ShapeDynamics/enabled";
40
const QString SHAPE_DYNAMICS_RANDOM_SIZE = "ShapeDynamics/randomSize";
41
const QString SHAPE_DYNAMICS_FIXED_ROTATION = "ShapeDynamics/fixedRotation";
42
const QString SHAPE_DYNAMICS_FIXED_ANGEL = "ShapeDynamics/fixedAngle";
43
const QString SHAPE_DYNAMICS_RANDOM_ROTATION = "ShapeDynamics/randomRotation";
44
const QString SHAPE_DYNAMICS_RANDOM_ROTATION_WEIGHT = "ShapeDynamics/randomRotationWeight";
45
const QString SHAPE_DYNAMICS_FOLLOW_CURSOR = "ShapeDynamics/followCursor";
46
const QString SHAPE_DYNAMICS_FOLLOW_CURSOR_WEIGHT = "ShapeDynamics/followCursorWeigth";
47
const QString SHAPE_DYNAMICS_DRAWING_ANGLE = "ShapeDynamics/followDrawingAngle";
48
const QString SHAPE_DYNAMICS_DRAWING_ANGLE_WEIGHT = "ShapeDynamics/followDrawingAngleWeigth";
50
class KisShapeDynamicsOptionsWidget;
52
class KisSprayShapeDynamicsOption : public KisPaintOpOption
56
KisSprayShapeDynamicsOption();
57
~KisSprayShapeDynamicsOption();
59
void writeOptionSetting(KisPropertiesConfiguration* setting) const;
60
void readOptionSetting(const KisPropertiesConfiguration* setting);
63
void setupBrushPreviewSignals();
66
KisShapeDynamicsOptionsWidget * m_options;
70
class KisShapeDynamicsProperties{
73
// particle size dynamics
79
bool followDrawingAngle;
81
qreal randomRotationWeight;
82
qreal followCursorWeigth;
83
qreal followDrawingAngleWeight;
87
void loadSettings(const KisPropertiesConfiguration* settings){
89
if (settings->getString(SHAPE_DYNAMICS_VERSION, "2.2") == "2.2")
91
randomSize = settings->getBool(SPRAYSHAPE_RANDOM_SIZE);
93
fixedRotation = settings->getBool(SPRAYSHAPE_FIXED_ROTATION);
94
randomRotation = settings->getBool(SPRAYSHAPE_RANDOM_ROTATION);
95
followCursor = settings->getBool(SPRAYSHAPE_FOLLOW_CURSOR);
96
followDrawingAngle = settings->getBool(SPRAYSHAPE_DRAWING_ANGLE);
97
fixedAngle = settings->getInt(SPRAYSHAPE_FIXED_ANGEL);
98
randomRotationWeight = settings->getDouble(SPRAYSHAPE_RANDOM_ROTATION_WEIGHT);
99
followCursorWeigth = settings->getDouble(SPRAYSHAPE_FOLLOW_CURSOR_WEIGHT);
100
followDrawingAngleWeight = settings->getDouble(SPRAYSHAPE_DRAWING_ANGLE_WEIGHT);
106
enabled = settings->getBool(SHAPE_DYNAMICS_ENABLED);
107
// particle type size
108
randomSize = settings->getBool(SHAPE_DYNAMICS_RANDOM_SIZE);
110
fixedRotation = settings->getBool(SHAPE_DYNAMICS_FIXED_ROTATION);
111
randomRotation = settings->getBool(SHAPE_DYNAMICS_RANDOM_ROTATION);
112
followCursor = settings->getBool(SHAPE_DYNAMICS_FOLLOW_CURSOR);
113
followDrawingAngle = settings->getBool(SHAPE_DYNAMICS_DRAWING_ANGLE);
114
fixedAngle = settings->getInt(SHAPE_DYNAMICS_FIXED_ANGEL);
115
randomRotationWeight = settings->getDouble(SHAPE_DYNAMICS_RANDOM_ROTATION_WEIGHT);
116
followCursorWeigth = settings->getDouble(SHAPE_DYNAMICS_FOLLOW_CURSOR_WEIGHT);
117
followDrawingAngleWeight = settings->getDouble(SHAPE_DYNAMICS_DRAWING_ANGLE_WEIGHT);
122
#endif // KIS_SPRAY_SHAPE_DYNAMICS_OPTION_H