Commit 30c2f3c9 authored by Blackbeard (alberto flores)'s avatar Blackbeard (alberto flores) 🚢
Browse files

Populate brushesPipe with VectorShapeObjects

parent d1afdb40
...@@ -37,37 +37,49 @@ ...@@ -37,37 +37,49 @@
// helper Class to hold all the KisVectorShape Objects // helper Class to hold all the KisVectorShape Objects
class KisVectorHelperPipe : public KisBrushesPipe<KisVectorShapeObject> class KisVectorHelperPipe : public KisBrushesPipe<KisVectorShapeObject>
{ {
public: public:
KisVectorHelperPipe() KisVectorHelperPipe()
: m_currentIndex(0) : m_currentIndex(0)
{ {
m_parasite.setIndex(0); m_parasite.setIndex(0);
} }
public: public:
int currentBrushIndex() override { int currentBrushIndex() override
{
return m_currentIndex; return m_currentIndex;
} }
int chooseNextBrush(const KisPaintInformation& info) override {
int chooseNextBrush(const KisPaintInformation& info) override
{
Q_UNUSED(info) Q_UNUSED(info)
m_currentIndex = m_parasite.index(); m_currentIndex = m_parasite.index();
qDebug() << "dab" << m_currentIndex; qDebug() << "dab" << m_currentIndex;
m_parasite.nextIndex(); m_parasite.nextIndex();
return m_currentIndex; return m_currentIndex;
} }
void updateBrushIndexes(const KisPaintInformation& info, int seqNo) override {
Q_UNUSED(info) void updateBrushIndexes(const KisPaintInformation& info, int seqNo) override
Q_UNUSED(seqNo) {
// m_parasite.nextIndex(); Q_UNUSED(info)
// m_currentIndex = m_parasite.index(); Q_UNUSED(seqNo)
// qDebug() << "dab" << m_currentIndex; // m_parasite.nextIndex();
} // m_currentIndex = m_parasite.index();
// qDebug() << "dab" << m_currentIndex;
}
void notifyStrokeStarted() override { void notifyStrokeStarted() override {
qDebug() << "stroke"; qDebug() << "stroke";
} }
void setParasite(const KisVectorBrushParasite& parasite) { void setParasite(const KisVectorBrushParasite& parasite) {
m_parasite = parasite; m_parasite = parasite;
} }
void addShapeBrush(KisVectorShapeObject* brush)
{
addBrush(brush);
}
private: private:
int m_currentIndex; int m_currentIndex;
...@@ -143,20 +155,26 @@ bool KisVectorAnimatedBrush::loadFromDevice(QIODevice *dev) ...@@ -143,20 +155,26 @@ bool KisVectorAnimatedBrush::loadFromDevice(QIODevice *dev)
m_d->brushesPipe.setParasite(m_parasite); m_d->brushesPipe.setParasite(m_parasite);
// clean de brush // clean de brush
m_vectorObjects.clear(); // m_vectorObjects.clear();
// convert the shapes to KisVectorShapeObjects // convert the shapes to KisVectorShapeObjects
for(int i = 0; i<m_shapes.count(); i++) for (int i = 0; i<m_shapes.count(); i++) {
{ m_d->brushesPipe.addShapeBrush(new KisVectorShapeObject(m_shapes.at(i)));
m_vectorObjects.append(KisVectorShapeObject(m_shapes.at(i)));
} }
KisVectorShapeObject currentVectorObject = m_vectorObjects.at(m_parasite.index()); // KisVectorShapeObject currentVectorObject = m_vectorObjects.at(m_parasite.index());
QImage tip = currentVectorObject.image(); // QImage tip = currentVectorObject.image();
setBrushTipImage(tip); // for(int i = 0; i<m_shapes.count(); i++)
// {
// KisVectorShapeObject* brush = new KisVectorShapeObject(name() + '_' + QString().setNum(i),
// m_vectorObjects.at(m_parasite.)
// }
// // setBrushTipImage(tip);
setBrushTipImage(m_d->brushesPipe.firstBrush()->brushTipImage());
setValid(true); setValid(true);
......
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