Commit a888311a authored by Boudewijn Rempt's avatar Boudewijn Rempt

Set the min/max for range and the default values

The default export range is the selected range for playback
parent 94e1a200
......@@ -26,13 +26,15 @@
#include <kis_node_manager.h>
#include <kis_image_manager.h>
#include <kis_action.h>
#include <kis_image_animation_interface.h>
#include <kis_properties_configuration.h>
#include "DlgAnimationRenderer.h"
K_PLUGIN_FACTORY_WITH_JSON(AnimaterionRendererFactory, "kritaanimationrenderer.json", registerPlugin<AnimaterionRenderer>();)
AnimaterionRenderer::AnimaterionRenderer(QObject *parent, const QVariantList &)
: KisViewPlugin(parent)
: KisViewPlugin(parent)
{
// Shows the big dialog
KisAction *action = createAction("render_animation");
......@@ -53,8 +55,9 @@ void AnimaterionRenderer::slotRenderAnimation()
{
KisImageWSP image = m_view->image();
if (!image) return;
if (!image->animationInterface()->hasAnimation()) return;
DlgAnimaterionRenderer dlgAnimaterionRenderer(m_view->mainWindow());
DlgAnimaterionRenderer dlgAnimaterionRenderer(image, m_view->mainWindow());
dlgAnimaterionRenderer.setCaption(i18n("Render Animation"));
......
......@@ -18,6 +18,7 @@
#include "DlgAnimationRenderer.h"
#include <QStandardPaths>
#include <QPluginLoader>
#include <QJsonObject>
......@@ -29,9 +30,13 @@
#include <KisMimeDatabase.h>
#include <KoJsonTrader.h>
#include <KisImportExportFilter.h>
#include <kis_image.h>
#include <kis_image_animation_interface.h>
#include <kis_time_range.h>
DlgAnimaterionRenderer::DlgAnimaterionRenderer(QWidget *parent)
DlgAnimaterionRenderer::DlgAnimaterionRenderer(KisImageWSP image, QWidget *parent)
: KoDialog(parent)
, m_image(image)
{
setCaption(i18n("Render Animation"));
setButtons(Ok | Cancel);
......@@ -40,6 +45,15 @@ DlgAnimaterionRenderer::DlgAnimaterionRenderer(QWidget *parent)
m_page = new WdgAnimaterionRenderer(this);
m_page->layout()->setMargin(0);
m_page->dirRequester->setMode(KoFileDialog::OpenDirectory);
m_page->intStart->setMinimum(image->animationInterface()->fullClipRange().start());
m_page->intStart->setMaximum(image->animationInterface()->fullClipRange().end());
m_page->intStart->setValue(image->animationInterface()->playbackRange().start());
m_page->intEnd->setMinimum(image->animationInterface()->fullClipRange().start());
m_page->intEnd->setMaximum(image->animationInterface()->fullClipRange().end());
m_page->intEnd->setValue(image->animationInterface()->playbackRange().end());
setMainWidget(m_page);
resize(m_page->sizeHint());
......@@ -95,6 +109,15 @@ KisPropertiesConfigurationSP DlgAnimaterionRenderer::getSequenceConfiguration()
return cfg;
}
void DlgAnimaterionRenderer::setSequenceConfiguration(KisPropertiesConfigurationSP cfg) const
{
m_page->txtBasename->setText(cfg->getString("basename", "frame"));
m_page->dirRequester->setFileName(cfg->getString("directory", QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)));
m_page->intStart->setValue(cfg->getInt("first_frame", m_image->animationInterface()->playbackRange().start()));
m_page->intEnd->setValue(cfg->getInt("last_frame", m_image->animationInterface()->playbackRange().end()));
m_page->sequenceStart->setValue(cfg->getInt("sequence_start", m_image->animationInterface()->playbackRange().start()));
}
KisPropertiesConfigurationSP DlgAnimaterionRenderer::getVideoConfiguration() const
{
if (!m_page->grpRenderOptions->isChecked()) {
......@@ -106,6 +129,11 @@ KisPropertiesConfigurationSP DlgAnimaterionRenderer::getVideoConfiguration() con
return cfg;
}
void DlgAnimaterionRenderer::setVideoConfiguration(KisPropertiesConfigurationSP cfg) const
{
}
KisPropertiesConfigurationSP DlgAnimaterionRenderer::getencoderConfiguration() const
{
if (!m_page->grpRenderOptions->isChecked()) {
......@@ -115,6 +143,11 @@ KisPropertiesConfigurationSP DlgAnimaterionRenderer::getencoderConfiguration() c
return cfg;
}
void DlgAnimaterionRenderer::getencoderConfiguration(KisPropertiesConfigurationSP cfg) const
{
}
void DlgAnimaterionRenderer::selectRenderType(int renderType)
{
// if (renderType >= m_configWidgets->size) return;
......
......@@ -24,7 +24,7 @@
#include "ui_wdg_animationrenderer.h"
#include <QSharedPointer>
#include <kis_types.h>
class KisImportExportFilter;
......@@ -47,12 +47,17 @@ class DlgAnimaterionRenderer: public KoDialog
public:
DlgAnimaterionRenderer(QWidget *parent = 0);
DlgAnimaterionRenderer(KisImageWSP image, QWidget *parent = 0);
~DlgAnimaterionRenderer();
KisPropertiesConfigurationSP getSequenceConfiguration() const;
void setSequenceConfiguration(KisPropertiesConfigurationSP cfg) const;
KisPropertiesConfigurationSP getVideoConfiguration() const;
void setVideoConfiguration(KisPropertiesConfigurationSP cfg) const;
KisPropertiesConfigurationSP getencoderConfiguration() const;
void getencoderConfiguration(KisPropertiesConfigurationSP cfg) const;
private Q_SLOTS:
......@@ -60,9 +65,11 @@ private Q_SLOTS:
private:
KisImageWSP m_image;
WdgAnimaterionRenderer *m_page;
QList<QSharedPointer<KisImportExportFilter>> m_filters;
QList<QWidget> m_configWidgets;
};
#endif // DLG_ANIMATIONRENDERERIMAGE
......@@ -33,7 +33,11 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="txtBasename"/>
<widget class="QLineEdit" name="txtBasename">
<property name="text">
<string>frame</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
......@@ -75,7 +79,7 @@
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Sequence starts with:</string>
<string>Naming sequence starts with:</string>
</property>
</widget>
</item>
......
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