File indexing completed on 2024-12-22 04:16:21

0001 /*
0002  *  SPDX-FileCopyrightText: 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 #include "KisParticleOpOptionData.h"
0007 
0008 #include "kis_properties_configuration.h"
0009 #include <kis_paintop_lod_limitations.h>
0010 
0011 
0012 const QString PARTICLE_COUNT = "Particle/count";
0013 const QString PARTICLE_GRAVITY = "Particle/gravity";
0014 const QString PARTICLE_WEIGHT = "Particle/weight";
0015 const QString PARTICLE_ITERATIONS = "Particle/iterations";
0016 const QString PARTICLE_SCALE_X = "Particle/scaleX";
0017 const QString PARTICLE_SCALE_Y = "Particle/scaleY";
0018 
0019 
0020 bool KisParticleOpOptionData::read(const KisPropertiesConfiguration *setting)
0021 {
0022     particleCount = setting->getInt(PARTICLE_COUNT, 50);
0023     particleIterations = setting->getInt(PARTICLE_ITERATIONS, 10);
0024     particleGravity = setting->getDouble(PARTICLE_GRAVITY, 0.989);
0025     particleWeight = setting->getDouble(PARTICLE_WEIGHT, 0.2);
0026     particleScaleX = setting->getDouble(PARTICLE_SCALE_X, 0.3);
0027     particleScaleY = setting->getDouble(PARTICLE_SCALE_Y, 0.3);
0028 
0029     return true;
0030 }
0031 
0032 void KisParticleOpOptionData::write(KisPropertiesConfiguration *setting) const
0033 {
0034     setting->setProperty(PARTICLE_COUNT, particleCount);
0035     setting->setProperty(PARTICLE_ITERATIONS, particleIterations);
0036     setting->setProperty(PARTICLE_GRAVITY, particleGravity);
0037     setting->setProperty(PARTICLE_WEIGHT, particleWeight);
0038     setting->setProperty(PARTICLE_SCALE_X, particleScaleX);
0039     setting->setProperty(PARTICLE_SCALE_Y, particleScaleY);
0040 }
0041 
0042 KisPaintopLodLimitations KisParticleOpOptionData::lodLimitations() const
0043 {
0044     KisPaintopLodLimitations l;
0045     l.blockers << KoID("particle-brush", i18nc("PaintOp instant preview limitation", "Particle Brush (not supported)"));
0046     return l;
0047 }