Commit 787b29d4 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remove the animation code again

BUG:342908

We're going to have to redesign the animation code yet again, for the
fourth time :-(
parent 24f1bda7
......@@ -26,18 +26,4 @@
</magic>
<glob pattern="*.r8"/>
</mime-type>
<mime-type type="application/x-krita-animation">
<comment xml:lang="en">Krita Animation</comment>
<magic priority="50">
<match type="string" value="!DOCTYPE krita-animation" offset="1"/>
</magic>
<glob pattern="*.kranim"/>
</mime-type>
<mime-type type="application/x-kranim-sequence">
<comment xml:lang="en">Animation Sequence</comment>
<magic priority="50">
<match type="string" value="kranimseq" offset="40"/>
</magic>
<glob pattern="*.kranimseq"/>
</mime-type>
</mime-info>
......@@ -31,7 +31,7 @@ class DisableUIUpdatesCommand : public KUndo2Command
{
public:
DisableUIUpdatesCommand(KisImageWSP image,
bool finalUpdate)
bool finalUpdate)
: m_image(image),
m_finalUpdate(finalUpdate)
{
......@@ -188,8 +188,8 @@ KisProcessingApplicator::KisProcessingApplicator(KisImageWSP image,
m_finalSignalsEmitted(false)
{
KisStrokeStrategyUndoCommandBased *strategy =
new KisStrokeStrategyUndoCommandBased(name, false,
m_image->postExecutionUndoAdapter());
new KisStrokeStrategyUndoCommandBased(name, false,
m_image->postExecutionUndoAdapter());
if (m_flags.testFlag(SUPPORTS_WRAPAROUND_MODE)) {
strategy->setSupportsWrapAroundMode(true);
......@@ -255,11 +255,10 @@ void KisProcessingApplicator::applyCommand(KUndo2Command *command,
KIS_ASSERT_RECOVER_RETURN(!m_finalSignalsEmitted);
m_image->addJob(m_strokeId,
new KisStrokeStrategyUndoCommandBased::
Data(KUndo2CommandSP(command),
false,
sequentiality,
exclusivity));
new KisStrokeStrategyUndoCommandBased::Data(KUndo2CommandSP(command),
false,
sequentiality,
exclusivity));
}
void KisProcessingApplicator::explicitlyEmitFinalSignals()
......
......@@ -13,6 +13,5 @@ install(TARGETS kritathumbnail DESTINATION ${PLUGIN_INSTALL_DIR})
install(
FILES
krita_kra_thumbnail.desktop
kritaanimation_kranim_thumbnail.desktop
DESTINATION ${SERVICES_INSTALL_DIR}
)
[Desktop Entry]
Type=Service
Name=Krita Animation Documents
Name[ca]=Documents d'animació del Krita
Name[cs]=Dokumenty animace Krita
Name[de]=Krita-Animationsdokumente
Name[en_GB]=Krita Animation Documents
Name[es]=Documentos de Krita animación
Name[fi]=Krita-animaatiotiedostot
Name[ia]=Documentos de animation de Krita
Name[it]=Documenti di animazione di Krita
Name[ja]=Krita Animation 文書
Name[nb]=Krita animasjonsdokumenter
Name[nl]=Animatiedocumenten van Krita
Name[pl]=Dokumenty animacji Krita
Name[pt]=Documentos do Krita Animação
Name[pt_BR]=Documentos de animação do Krita
Name[sk]=Dokumenty animácií Krita
Name[sv]=Krita-animeringsdokument
Name[uk]=Документи анімації Krita
Name[x-test]=xxKrita Animation Documentsxx
X-KDE-ServiceTypes=ThumbCreator
MimeType=application/x-krita-animation;
X-KDE-Library=kritathumbnail
CacheThumbnail=true
......@@ -94,7 +94,7 @@ GenericName[sv]=Digital målning
GenericName[ug]=سىفىرلىق رەسىم سىزغۇ
GenericName[uk]=Цифрове малювання
GenericName[x-test]=xxDigital Paintingxx
MimeType=application/x-krita;image/openraster;application/x-krita-paintoppreset;application/x-krita-animation;
MimeType=application/x-krita;image/openraster;application/x-krita-paintoppreset
Comment=Digital Painting
Comment[bs]=Digitalno Bojenje
Comment[ca]=Dibuix digital
......
......@@ -11,7 +11,6 @@ add_subdirectory(artisticcolorselector)
add_subdirectory(tasksetdocker)
add_subdirectory(compositiondocker)
add_subdirectory(patterndocker)
add_subdirectory(animator)
if(HAVE_OCIO)
add_subdirectory(lut)
endif(HAVE_OCIO)
......
set(KRITA_ANIMATOR_PART_SRCS animator.cpp
animator_dock.cpp
animator_settings_dialog.cpp
animator_playback_dialog.cpp
kis_layer_contents.cpp
kis_timeline_header.cpp
kis_frame_box.cpp
kis_animation_frame_widget.cpp
kis_animation_layerbox.cpp
kis_animation_layer_widget.cpp
kis_timeline.cpp
onionskin_dock.cpp
kis_opacity_selector.cpp
kis_opacity_selector_view.cpp
TimelineView.cpp
TimelineItemDelegate.cpp
)
kde4_add_plugin(kritaanimator ${KRITA_ANIMATOR_PART_SRCS})
target_link_libraries(kritaanimator kritaui)
#install(TARGETS kritaanimator DESTINATION ${PLUGIN_INSTALL_DIR})
########### install files ###############
#install( FILES krita_animator.desktop DESTINATION ${SERVICES_INSTALL_DIR}/calligra)
/*
* Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2.1 of the License, or (at your option)
* any later version.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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 "TimelineItemDelegate.h"
#include <QPainter>
#include <QStyleOptionViewItem>
#include <QModelIndex>
#include <QGradient>
#include <kis_config.h>
#include <kis_animation_frame.h>
TimelineItemDelegate::TimelineItemDelegate(QObject *parent) :
QStyledItemDelegate(parent)
{
}
void TimelineItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
KisAnimationFrame *frame = qobject_cast<KisAnimationFrame*>(index.data().value<QObject*>());
if (option.state & QStyle::State_Selected) {
painter->fillRect(option.rect, option.palette.highlight());
}
else {
painter->fillRect(option.rect, option.palette.base());
}
if (frame) {
QRect rc = option.rect.adjusted(4, 4, -4, -4);
painter->setBrush(option.palette.buttonText());
painter->setPen(QPen(option.palette.button(), 2));
painter->drawRect(rc);
}
else {
QStyledItemDelegate::paint(painter, option, index);
}
}
/*
* Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2.1 of the License, or (at your option)
* any later version.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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 TIMELINEITEMDELEGATE_H
#define TIMELINEITEMDELEGATE_H
#include <QStyledItemDelegate>
class TimelineItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit TimelineItemDelegate(QObject *parent = 0);
virtual void paint(QPainter *painter, const QStyleOptionViewItem &optionViewItem, const QModelIndex & index) const;
};
#endif // TIMELINEITEMDELEGATE_H
/*
* Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2.1 of the License, or (at your option)
* any later version.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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 "TimelineView.h"
#include <QHeaderView>
#include <kis_config.h>
#include "TimelineItemDelegate.h"
TimelineView::TimelineView(QWidget *parent)
: QTableView(parent)
{
TimelineItemDelegate *delegate = new TimelineItemDelegate(this);
setItemDelegate(delegate);
KisConfig cfg;
horizontalHeader()->setDefaultSectionSize(cfg.readEntry("TimelineFrameWidth", 20));
horizontalHeader()->setResizeMode(QHeaderView::Fixed);
verticalHeader()->setResizeMode(QHeaderView::Fixed);
}
/*
* Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2.1 of the License, or (at your option)
* any later version.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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 TIMELINEVIEW_H
#define TIMELINEVIEW_H
#include <QTableView>
/**
* @brief The TimelineView class shows an animation timeline in tabular form.
*/
class TimelineView : public QTableView
{
Q_OBJECT
public:
explicit TimelineView(QWidget *parent = 0);
signals:
public slots:
};
#endif // TIMELINEVIEW_H
/*
* Copyright (c) 2013 Somsubhra Bairi <somsubhra.bairi@gmail.com>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2.1 of the License, or (at your option)
* any later version.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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 "animator.h"
#include <stdlib.h>
#include <QTimer>
#include <kis_debug.h>
#include <kpluginfactory.h>
#include <klocale.h>
#include <KoDockFactoryBase.h>
#include <KoDockRegistry.h>
#include "kis_config.h"
#include "kis_cursor.h"
#include "kis_global.h"
#include "kis_types.h"
#include "KisViewManager.h"
#include "animator_dock.h"
#include "onionskin_dock.h"
K_PLUGIN_FACTORY(AnimatorPluginFactory, registerPlugin<AnimatorPlugin>();)
K_EXPORT_PLUGIN(AnimatorPluginFactory("krita"))
class AnimatorDockFactory : public KoDockFactoryBase {
public:
AnimatorDockFactory()
{
}
virtual QString id() const
{
return QString("Animator");
}
virtual Qt::DockWidgetArea defaultDockWidgetArea() const
{
return Qt::TopDockWidgetArea;
}
virtual QDockWidget* createDockWidget()
{
AnimatorDock * dockWidget = new AnimatorDock();
dockWidget->setObjectName(id());
return dockWidget;
}
DockPosition defaultDockPosition() const
{
return DockMinimized;
}
};
class OnionSkinDockFactory : public KoDockFactoryBase {
public:
OnionSkinDockFactory()
{
}
virtual QString id() const
{
return QString("Onion Skin");
}
virtual Qt::DockWidgetArea defaultDockWidgetArea() const
{
return Qt::LeftDockWidgetArea;
}
virtual QDockWidget* createDockWidget()
{
OnionSkinDock* dockWidget = new OnionSkinDock();
dockWidget->setObjectName(id());
return dockWidget;
}
DockPosition defaultDockPosition() const
{
return DockMinimized;
}
};
AnimatorPlugin::AnimatorPlugin(QObject *parent, const QVariantList &)
: QObject(parent)
{
KoDockRegistry::instance()->add(new AnimatorDockFactory());
KoDockRegistry::instance()->add(new OnionSkinDockFactory());
}
AnimatorPlugin::~AnimatorPlugin()
{
m_view = 0;
}
#include "animator.moc"
/*
* Copyright (c) 2013 Somsubhra Bairi <somsubhra.bairi@gmail.com>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2.1 of the License, or (at your option)
* any later version.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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 _ANIMATOR_H_
#define _ANIMATOR_H_
#include <QVariant>
#include <QObject>
class KisViewManager;
/**
* The animator plugin class
*/
class AnimatorPlugin : public QObject
{
Q_OBJECT
public:
AnimatorPlugin(QObject *parent, const QVariantList &);
virtual ~AnimatorPlugin();
private:
KisViewManager* m_view;
};
#endif
/*
* Copyright (c) 2013 Somsubhra Bairi <somsubhra.bairi@gmail.com>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2.1 of the License, or (at your option)
* any later version.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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 "animator_dock.h"
#include <QWidget>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QToolBar>
#include <klocale.h>
#include <kis_action.h>
#include <KisViewManager.h>
#include <kis_animation.h>
#include <kis_canvas2.h>
#include <kis_animation_doc.h>
#include <KisPart.h>
#include <kis_animation_model.h>
#include "kis_timeline.h"
AnimatorDock::AnimatorDock()
: QDockWidget(i18n("Animator"))
{
setMinimumHeight(120);
m_timeLine = new KisTimelineWidget(this);
this->setWidget(m_timeLine);
}
void AnimatorDock::setCanvas(KoCanvasBase *canvasBase)
{
setEnabled(canvasBase != 0);
KisCanvas2 *canvas = dynamic_cast<KisCanvas2*>(canvasBase);
if (canvas && canvas->viewManager() && canvas->viewManager()->document()) {
m_timeLine->setCanvas(canvas);
}
}
void AnimatorDock::unsetCanvas()
{
setEnabled(false);
m_timeLine->unsetCanvas();
}
#include "animator_dock.moc"
/*
* Copyright (c) 2013 Somsubhra Bairi <somsubhra.bairi@gmail.com>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2.1 of the License, or (at your option)
* any later version.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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 _ANIMATOR_DOCK_H_
#define _ANIMATOR_DOCK_H_
#include <QDockWidget>
#include <KoCanvasObserverBase.h>
class QLabel;
class KisCanvas2;
class KisAnimationModel;
class KisTimelineWidget;
/**
* The animator docker class
*/
class AnimatorDock : public QDockWidget, public KoCanvasObserverBase {
Q_OBJECT
public:
AnimatorDock();
QString observerName() { return "AnimatorDock"; }
virtual void setCanvas(KoCanvasBase *canvasBase);
virtual void unsetCanvas();
private:
KisTimelineWidget *m_timeLine;
};
#endif
/*
* Copyright (c) 2014 Somsubhra Bairi <somsubhra.bairi@gmail.com>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2.1 of the License, or (at your option)
* any later version.
*
* This library 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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 "animator_playback_dialog.h"
#include <QCheckBox>
#include <QSpinBox>
#include <QLabel>
#include <QGridLayout>
#include <QDialogButtonBox>
#include <QPushButton>
#include "kis_config.h"
AnimatorPlaybackDialog::AnimatorPlaybackDialog(QWidget *parent)
: QDialog(parent)
{
this->setWindowTitle(i18n("Playback options"));
this->setMaximumSize(300, 200);
KisConfig cfg;
m_loopState = new QCheckBox(this);
m_loopState->setText(i18n("Enable Looping"));
m_loopState->setChecked(cfg.defLoopingEnabled());
QLabel* fpsLabel = new QLabel(i18n("Frame per second:"), this);
m_fpsInput = new QSpinBox(this);
m_fpsInput->setRange(1, 30);
m_fpsInput->setValue(cfg.defFps());
QLabel* localPlaybackRangeLabel = new QLabel(i18n("Local playback range:"), this);
m_localPlaybackRangeInput = new QSpinBox(this);
m_localPlaybackRangeInput->setRange(1, 10000);
m_localPlaybackRangeInput->setValue(cfg.defLocalPlaybackRange());
QDialogButtonBox* buttonBox = new QDialogButtonBox();
buttonBox->addButton(QDialogButtonBox::Ok);
QPushButton* okButton = buttonBox->button(QDialogButtonBox::Ok);
connect(okButton, SIGNAL(clicked()), this, SLOT(okClicked()));
buttonBox->addButton(QDialogButtonBox::Cancel);
QPushButton* cancelButton = buttonBox->button(QDialogButtonBox::Cancel);
connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked()));
QGridLayout* mainLayout = new QGridLayout(this);
mainLayout->addWidget(m_loopState, 0, 0);
mainLayout->addWidget(fpsLabel, 1, 0);
mainLayout->addWidget(m_fpsInput, 1, 1);
mainLayout->addWidget(localPlaybackRangeLabel, 2, 0);
mainLayout->addWidget(m_localPlaybackRangeInput, 2, 1);
mainLayout->addWidget(buttonBox, 3, 1);
this->setLayout(mainLayout);
}
void AnimatorPlaybackDialog::setModel(KisAnimation *model)
{
m_model = model;
}
void AnimatorPlaybackDialog::okClicked()
{
m_model->enableLooping(m_loopState->isChecked());
m_model->setFps(m_fpsInput->value());
emit playbackStateChanged();
m_model->setLocalPlaybackRange(m_localPlaybackRangeInput->value());
this->close();
}
void AnimatorPlaybackDialog::cancelClicked()
{
this->close();
}
/*
* Copyright (c) 2014 Somsubhra Bairi <somsubhra.bairi@gmail.com>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 2.1 of the License, or (at your option)
* any later version.
*
* This library 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
<