Commit 95b6a46e authored by Timothée Giet's avatar Timothée Giet

Revert "Implement some sort of frame dragging in the UI."

This reverts commit c0d7207af1896afb0a4342e9b15abd5e176a4217.
I reverted all commits related to frame drag/drop as in current state it's not working well. Without it animation plugin is basically usable.
parent ed4aaf35
......@@ -53,40 +53,6 @@ void KisAnimationFrame::paintEvent(QPaintEvent *event)
}
}
void KisAnimationFrame::mouseMoveEvent(QMouseEvent *event)
{
if(m_mousePressed) {
if(this->m_type == KisAnimationFrame::SELECTION) {
return;
}
int x = event->globalX();
int displacement = x - m_mousePressStartPoint;
this->setGeometry(m_startPoint + displacement, this->y(), this->width(), this->height());
}
}
void KisAnimationFrame::mousePressEvent(QMouseEvent *event)
{
m_mousePressed = true;
m_mousePressStartPoint = event->globalX();
m_startPoint = this->geometry().x();
}
void KisAnimationFrame::mouseReleaseEvent(QMouseEvent *event)
{
m_mousePressed = false;
m_mousePressEndPoint = event->globalX();
int x = (this->geometry().x() / 10);
x *= 10;
m_startPoint = x;
this->setGeometry(x, this->y(), this->width(), this->height());
}
int KisAnimationFrame::getWidth()
{
return m_width;
......
......@@ -53,12 +53,6 @@ public:
protected:
void paintEvent(QPaintEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
public:
static const int SELECTION = 0;
static const int FRAME = 1;
......@@ -67,10 +61,6 @@ private:
int m_type;
int m_width;
KisLayerContents* m_parent;
bool m_mousePressed;
int m_mousePressStartPoint;
int m_mousePressEndPoint;
int m_startPoint;
};
#endif // KIS_ANIMATION_FRAME_H
......@@ -138,6 +138,10 @@ void KisTimeline::init()
QToolBar* frameButtons = new QToolBar(this);
KisAction* addFrameAction = new KisAction(koIcon("list-add"), i18n("Insert Frame"), this);
actionManager->addAction("insert_frame", addFrameAction, actionCollection);
connect(addFrameAction, SIGNAL(triggered()), this, SLOT(addframePressed()));
KisAction* addKeyFrameAction = new KisAction(koIcon("list-add"), i18n("Insert Keyframe"), this);
actionManager->addAction("insert_key_frame", addKeyFrameAction, actionCollection);
connect(addKeyFrameAction, SIGNAL(triggered()), this, SLOT(keyFramePressed()));
......@@ -150,6 +154,7 @@ void KisTimeline::init()
actionManager->addAction("remove_frame", removeFrameAction, actionCollection);
connect(removeFrameAction, SIGNAL(triggered()), this, SLOT(removeFramePressed()));
frameButtons->addAction(addFrameAction);
frameButtons->addAction(addKeyFrameAction);
frameButtons->addAction(addBlankFrameAction);
frameButtons->addAction(removeFrameAction);
......@@ -419,6 +424,14 @@ void KisTimeline::keyFramePressed()
}
}
void KisTimeline::addframePressed()
{
if(m_cells->getSelectedFrame()) {
this->m_cells->getSelectedFrame()->expandWidth();
this->m_cells->setSelectedFrame();
}
}
void KisTimeline::removeFramePressed()
{
if(m_cells->getSelectedFrame()) {
......
......@@ -83,6 +83,7 @@ private:
private slots:
void blankFramePressed();
void keyFramePressed();
void addframePressed();
void removeFramePressed();
void frameSelectionChanged(QRect frame);
......
......@@ -39,6 +39,8 @@
#define APP_MIMETYPE "application/x-krita-animation"
static const char CURRENT_DTD_VERSION[] = "1.0";
class KisAnimationDoc::KisAnimationDocPrivate
{
......
......@@ -133,6 +133,7 @@ public:
QList<KisPaintingAssistant*> assistants;
QString flipbook;
QString animation;
};
......
......@@ -47,6 +47,9 @@ void KisOnionSkinLoader::loadOnionSkins(QHash<int, bool> states)
QBitArray prevChanFlags = this->prevFramesChannelFlags();
QBitArray nextChanFlags = this->nextFramesChannelFlags();
QList<int>* prevOnionSkinOpacityVal = animation->prevOnionSkinOpacityValues();
QList<int>* nextOnionSkinOpacityVal = animation->nextOnionSkinOpacityValues();
int currentFrame;
int numberOfOnionSkins;
......@@ -64,7 +67,7 @@ void KisOnionSkinLoader::loadOnionSkins(QHash<int, bool> states)
}
currentFrame = frame.x();
numberOfOnionSkins = animation->prevOnionSkinOpacityValues()->length();
numberOfOnionSkins = prevOnionSkinOpacityVal->length();
for(int j = 0 ; j < numberOfOnionSkins ; j++) {
......@@ -81,7 +84,7 @@ void KisOnionSkinLoader::loadOnionSkins(QHash<int, bool> states)
KisLayerSP newLayer = new KisPaintLayer(image.data(), image->nextLayerName(), animation->bgColor().opacityU8(), animation->colorSpace());
newLayer->setName("Onion Skin " + QString::number(i + 1));
newLayer->setPercentOpacity(animation->prevOnionSkinOpacityValues()->at(numberOfOnionSkins - j - 1));
newLayer->setPercentOpacity(prevOnionSkinOpacityVal->at(numberOfOnionSkins - j - 1));
newLayer->setChannelFlags(prevChanFlags);
newLayer->setUserLocked(true);
......@@ -96,9 +99,9 @@ void KisOnionSkinLoader::loadOnionSkins(QHash<int, bool> states)
}
currentFrame = frame.x();
numberOfOnionSkins = animation->nextOnionSkinOpacityValues()->length();
numberOfOnionSkins = nextOnionSkinOpacityVal->length();
for(int j = 0 ; j < numberOfOnionSkins ; j++) {
for(int j = 0 ; j < nextOnionSkinOpacityVal->length() ; j++) {
// A hack to prevent same onion skin multiple times
// when there are no next onion skins left.
......@@ -114,7 +117,7 @@ void KisOnionSkinLoader::loadOnionSkins(QHash<int, bool> states)
KisLayerSP newLayer = new KisPaintLayer(image.data(), image->nextLayerName(), animation->bgColor().opacityU8(), animation->colorSpace());
newLayer->setName("Onion Skin " + QString::number(i + 1));
newLayer->setPercentOpacity(animation->nextOnionSkinOpacityValues()->at(j));
newLayer->setPercentOpacity(nextOnionSkinOpacityVal->at(j));
newLayer->setChannelFlags(nextChanFlags);
newLayer->setUserLocked(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