Paste P149

Masterwork From Distant Lands
ActivePublic

Authored by dkazakov on Dec 29 2017, 10:33 AM.
diff --git a/benchmarks/KisAnimationRenderingBenchmark.cpp b/benchmarks/KisAnimationRenderingBenchmark.cpp
index 9c1f6fb..29e2b19 100644
--- a/benchmarks/KisAnimationRenderingBenchmark.cpp
+++ b/benchmarks/KisAnimationRenderingBenchmark.cpp
@@ -54,7 +54,7 @@ void runRenderingTest(KisImageSP image, int numCores, int numClones)
const KisTimeRange range = image->animationInterface()->fullClipRange();
- KisAsyncAnimationFramesSaveDialog dlg(image, range, "temp_frames.png", 0, image->height(), image->width(), 24, 0);
+ KisAsyncAnimationFramesSaveDialog dlg(image, range, "temp_frames.png", 0, 0);
dlg.setBatchMode(true);
// repeat rendering twice!
diff --git a/libs/ui/KisAsyncAnimationFramesSavingRenderer.cpp b/libs/ui/KisAsyncAnimationFramesSavingRenderer.cpp
index 83c4d2f..5478ba8 100644
--- a/libs/ui/KisAsyncAnimationFramesSavingRenderer.cpp
+++ b/libs/ui/KisAsyncAnimationFramesSavingRenderer.cpp
@@ -29,12 +29,9 @@
struct KisAsyncAnimationFramesSavingRenderer::Private
{
- Private(KisImageSP image, const KisTimeRange &_range, int _height, int _width, int _framerate, int _sequenceNumberingOffset, KisPropertiesConfigurationSP _exportConfiguration)
+ Private(KisImageSP image, const KisTimeRange &_range, int _sequenceNumberingOffset, KisPropertiesConfigurationSP _exportConfiguration)
: savingDoc(KisPart::instance()->createDocument()),
range(_range),
- heightExport(_height),
- widthExport(_width),
- fps(_framerate),
sequenceNumberingOffset(_sequenceNumberingOffset),
exportConfiguration(_exportConfiguration)
{
@@ -43,8 +40,8 @@ struct KisAsyncAnimationFramesSavingRenderer::Private
savingDoc->setFileBatchMode(true);
KisImageSP savingImage = new KisImage(savingDoc->createUndoStore(),
- _width,
- _height,
+ image->bounds().width(),
+ image->bounds().height(),
image->colorSpace(),
QString());
@@ -61,9 +58,6 @@ struct KisAsyncAnimationFramesSavingRenderer::Private
KisPaintDeviceSP savingDevice;
KisTimeRange range;
- int heightExport;
- int widthExport;
- int fps;
int sequenceNumberingOffset = 0;
@@ -80,11 +74,8 @@ KisAsyncAnimationFramesSavingRenderer::KisAsyncAnimationFramesSavingRenderer(Kis
const QByteArray &outputMimeType,
const KisTimeRange &range,
const int sequenceNumberingOffset,
- int height,
- int width,
- int framerate,
KisPropertiesConfigurationSP exportConfiguration)
- : m_d(new Private(image, range, height, width, framerate, sequenceNumberingOffset, exportConfiguration))
+ : m_d(new Private(image, range, sequenceNumberingOffset, exportConfiguration))
{
m_d->filenamePrefix = fileNamePrefix;
m_d->filenameSuffix = fileNameSuffix;
diff --git a/libs/ui/KisAsyncAnimationFramesSavingRenderer.h b/libs/ui/KisAsyncAnimationFramesSavingRenderer.h
index b275a09..6dffff6 100644
--- a/libs/ui/KisAsyncAnimationFramesSavingRenderer.h
+++ b/libs/ui/KisAsyncAnimationFramesSavingRenderer.h
@@ -34,9 +34,6 @@ public:
const QByteArray &outputMimeType,
const KisTimeRange &range,
int sequenceNumberingOffset,
- int height,
- int width,
- int framerate,
KisPropertiesConfigurationSP exportConfiguration);
~KisAsyncAnimationFramesSavingRenderer();
diff --git a/libs/ui/dialogs/KisAsyncAnimationFramesSaveDialog.cpp b/libs/ui/dialogs/KisAsyncAnimationFramesSaveDialog.cpp
index 46f9f94..dadcea0 100644
--- a/libs/ui/dialogs/KisAsyncAnimationFramesSaveDialog.cpp
+++ b/libs/ui/dialogs/KisAsyncAnimationFramesSaveDialog.cpp
@@ -35,16 +35,10 @@ struct KisAsyncAnimationFramesSaveDialog::Private {
const KisTimeRange &_range,
const QString &baseFilename,
int _sequenceNumberingOffset,
- int _heightExport,
- int _widthExport,
- int _fps,
KisPropertiesConfigurationSP _exportConfiguration)
: originalImage(_image),
range(_range),
sequenceNumberingOffset(_sequenceNumberingOffset),
- heightExport(_heightExport),
- widthExport(_widthExport),
- fps(_fps),
exportConfiguration(_exportConfiguration)
{
int baseLength = baseFilename.lastIndexOf(".");
@@ -60,10 +54,6 @@ struct KisAsyncAnimationFramesSaveDialog::Private {
KisImageSP originalImage;
KisTimeRange range;
- int heightExport;
- int widthExport;
- int fps;
-
QString filenamePrefix;
QString filenameSuffix;
@@ -77,12 +67,9 @@ KisAsyncAnimationFramesSaveDialog::KisAsyncAnimationFramesSaveDialog(KisImageSP
const KisTimeRange &range,
const QString &baseFilename,
int sequenceNumberingOffset,
- int heightExport,
- int widthExport,
- int fps,
KisPropertiesConfigurationSP exportConfiguration)
: KisAsyncAnimationRenderDialogBase("Saving frames...", originalImage, 0),
- m_d(new Private(originalImage, range, baseFilename, sequenceNumberingOffset, heightExport, widthExport, fps, exportConfiguration))
+ m_d(new Private(originalImage, range, baseFilename, sequenceNumberingOffset, exportConfiguration))
{
@@ -172,9 +159,6 @@ KisAsyncAnimationRendererBase *KisAsyncAnimationFramesSaveDialog::createRenderer
m_d->outputMimeType,
m_d->range,
m_d->sequenceNumberingOffset,
- m_d->heightExport,
- m_d->widthExport,
- m_d->fps,
m_d->exportConfiguration);
}
diff --git a/libs/ui/dialogs/KisAsyncAnimationFramesSaveDialog.h b/libs/ui/dialogs/KisAsyncAnimationFramesSaveDialog.h
index 2534172..dca29ab 100644
--- a/libs/ui/dialogs/KisAsyncAnimationFramesSaveDialog.h
+++ b/libs/ui/dialogs/KisAsyncAnimationFramesSaveDialog.h
@@ -30,9 +30,6 @@ public:
const KisTimeRange &range,
const QString &baseFilename,
int sequenceNumberingOffset,
- int heightExport,
- int widthExport,
- int fps,
KisPropertiesConfigurationSP exportConfiguration);
~KisAsyncAnimationFramesSaveDialog();
diff --git a/libs/ui/tests/kis_animation_exporter_test.cpp b/libs/ui/tests/kis_animation_exporter_test.cpp
index 30e3ccc..f44a2a3 100644
--- a/libs/ui/tests/kis_animation_exporter_test.cpp
+++ b/libs/ui/tests/kis_animation_exporter_test.cpp
@@ -69,9 +69,6 @@ void KisAnimationExporterTest::testAnimationExport()
KisTimeRange::fromTime(0,2),
"export-test.png",
0,
- document->image()->height(),
- document->image()->width(),
- 24,
0);
diff --git a/plugins/extensions/animationrenderer/AnimationRenderer.cpp b/plugins/extensions/animationrenderer/AnimationRenderer.cpp
index 9b9c40f..bb56d32 100644
--- a/plugins/extensions/animationrenderer/AnimationRenderer.cpp
+++ b/plugins/extensions/animationrenderer/AnimationRenderer.cpp
@@ -106,9 +106,6 @@ void AnimaterionRenderer::slotRenderAnimation()
KisTimeRange::fromTime(sequenceConfig->getInt("first_frame"), sequenceConfig->getInt("last_frame")),
baseFileName,
sequenceConfig->getInt("sequence_start"),
- sequenceConfig->getInt("height"),
- sequenceConfig->getInt("width"),
- sequenceConfig->getInt("framerate"),
dlgAnimationRenderer.getFrameExportConfiguration());
exporter.setBatchMode(batchMode);
@@ -198,9 +195,6 @@ void AnimaterionRenderer::slotRenderSequenceAgain()
KisTimeRange::fromTime(sequenceConfig->getInt("first_frame"), sequenceConfig->getInt("last_frame")),
baseFileName,
sequenceConfig->getInt("sequence_start"),
- sequenceConfig->getInt("height"),
- sequenceConfig->getInt("width"),
- sequenceConfig->getInt("framerate"),
0);
exporter.setBatchMode(batchMode);
bool success = exporter.regenerateRange(0) == KisAsyncAnimationFramesSaveDialog::RenderComplete;
diff --git a/plugins/extensions/animationrenderer/DlgAnimationRenderer.cpp b/plugins/extensions/animationrenderer/DlgAnimationRenderer.cpp
index 38650f8..00d070b 100644
--- a/plugins/extensions/animationrenderer/DlgAnimationRenderer.cpp
+++ b/plugins/extensions/animationrenderer/DlgAnimationRenderer.cpp
@@ -251,9 +251,6 @@ KisPropertiesConfigurationSP DlgAnimationRenderer::getSequenceConfiguration() co
cfg->setProperty("directory", fetchRenderingDirectory());
cfg->setProperty("first_frame", m_page->intStart->value());
cfg->setProperty("last_frame", m_page->intEnd->value());
- cfg->setProperty("framerate", m_page->intFramesPerSecond->value());
- cfg->setProperty("height", m_page->intHeight->value());
- cfg->setProperty("width", m_page->intWidth->value());
cfg->setProperty("sequence_start", m_page->sequenceStart->value());
cfg->setProperty("mimetype", m_page->cmbMimetype->currentData().toString());
return cfg;
@@ -267,19 +264,12 @@ void DlgAnimationRenderer::setSequenceConfiguration(KisPropertiesConfigurationSP
cfg->removeProperty("first_frame");
cfg->removeProperty("last_frame");
cfg->removeProperty("sequence_start");
- cfg->removeProperty("height");
- cfg->removeProperty("width");
- cfg->removeProperty("framerate");
}
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()));
- m_page->intHeight->setValue(cfg->getInt("height", int(m_image->height())));
- m_page->intWidth->setValue(cfg->getInt("width", int(m_image->width())));
- m_page->intFramesPerSecond->setValue(cfg->getInt("framerate", int(m_image->animationInterface()->framerate())));
-
QString mimetype = cfg->getString("mimetype");
for (int i = 0; i < m_page->cmbMimetype->count(); ++i) {
@@ -298,9 +288,6 @@ KisPropertiesConfigurationSP DlgAnimationRenderer::getFrameExportConfiguration()
cfg->setProperty("directory", fetchRenderingDirectory());
cfg->setProperty("first_frame", m_page->intStart->value());
cfg->setProperty("last_frame", m_page->intEnd->value());
- cfg->setProperty("framerate", m_page->intFramesPerSecond->value());
- cfg->setProperty("height", m_page->intHeight->value());
- cfg->setProperty("width", m_page->intWidth->value());
cfg->setProperty("sequence_start", m_page->sequenceStart->value());
cfg->setProperty("ffmpeg_path", m_page->ffmpegLocation->fileName());
@@ -321,9 +308,6 @@ KisPropertiesConfigurationSP DlgAnimationRenderer::getVideoConfiguration() const
cfg->setProperty("first_frame", m_page->intStart->value());
cfg->setProperty("last_frame", m_page->intEnd->value());
cfg->setProperty("sequence_start", m_page->sequenceStart->value());
- cfg->setProperty("framerate", m_page->intFramesPerSecond->value());
- cfg->setProperty("height", m_page->intHeight->value());
- cfg->setProperty("width", m_page->intWidth->value());
// delete image sequence if we are only exporting out video
cfg->setProperty("delete_sequence", m_page->shouldExportOnlyVideo->isChecked());
@@ -362,6 +346,10 @@ KisPropertiesConfigurationSP DlgAnimationRenderer::getEncoderConfiguration() con
void DlgAnimationRenderer::setEncoderConfiguration(KisPropertiesConfigurationSP cfg)
{
+ m_page->intHeight->setValue(cfg->getInt("height", int(m_image->height())));
+ m_page->intWidth->setValue(cfg->getInt("width", int(m_image->width())));
+ m_page->intFramesPerSecond->setValue(cfg->getInt("framerate", int(m_image->animationInterface()->framerate())));
+
if (m_encoderConfigWidget) {
m_encoderConfigWidget->setConfiguration(cfg);
}
@@ -538,9 +526,11 @@ void DlgAnimationRenderer::slotExportTypeChanged()
{
KisConfig cfg;
- // if a video format needs to be outputted
- if (m_page->shouldExportAll->isChecked() || m_page->shouldExportOnlyVideo->isChecked()) {
+ bool willEncodeVideo =
+ m_page->shouldExportAll->isChecked() || m_page->shouldExportOnlyVideo->isChecked();
+ // if a video format needs to be outputted
+ if (willEncodeVideo) {
// videos always uses PNG for creating video, so disable the ability to change the format
m_page->cmbMimetype->setEnabled(false);
for (int i = 0; i < m_page->cmbMimetype->count(); ++i) {
@@ -551,14 +541,19 @@ void DlgAnimationRenderer::slotExportTypeChanged()
}
}
+ m_page->intWidth->setVisible(willEncodeVideo);
+ m_page->intHeight->setVisible(willEncodeVideo);
+ m_page->intFramesPerSecond->setVisible(willEncodeVideo);
+ m_page->fpsLabel->setVisible(willEncodeVideo);
+ m_page->lblWidth->setVisible(willEncodeVideo);
+ m_page->lblHeight->setVisible(willEncodeVideo);
+
// if only exporting video
if (m_page->shouldExportOnlyVideo->isChecked()) {
m_page->cmbMimetype->setEnabled(false); // allow to change image format
m_page->imageSequenceOptionsGroup->setVisible(false);
m_page->videoOptionsGroup->setVisible(false); //shrinks the horizontal space temporarily to help resize() work
m_page->videoOptionsGroup->setVisible(true);
- m_page->intFramesPerSecond->setVisible(true);
- m_page->fpsLabel->setVisible(true);
cfg.writeEntry<QString>("AnimationRenderer/export_type", "Video");
}
@@ -568,9 +563,8 @@ void DlgAnimationRenderer::slotExportTypeChanged()
if (m_page->shouldExportOnlyImageSequence->isChecked()) {
m_page->cmbMimetype->setEnabled(true); // allow to change image format
m_page->videoOptionsGroup->setVisible(false);
+ m_page->imageSequenceOptionsGroup->setVisible(false);
m_page->imageSequenceOptionsGroup->setVisible(true);
- m_page->intFramesPerSecond->setVisible(false);
- m_page->fpsLabel->setVisible(false);
cfg.writeEntry<QString>("AnimationRenderer/export_type", "ImageSequence");
}
diff --git a/plugins/extensions/animationrenderer/wdg_animationrenderer.ui b/plugins/extensions/animationrenderer/wdg_animationrenderer.ui
index a633dd4..a6a635b 100644
--- a/plugins/extensions/animationrenderer/wdg_animationrenderer.ui
+++ b/plugins/extensions/animationrenderer/wdg_animationrenderer.ui
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>560</width>
+ <width>621</width>
<height>381</height>
</rect>
</property>
@@ -76,97 +76,115 @@
<item row="0" column="1">
<widget class="QSpinBox" name="intStart">
<property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
- <horstretch>1</horstretch>
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
- <item row="1" column="2">
- <widget class="QLabel" name="label_12">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_3">
<property name="text">
- <string>Width:</string>
+ <string>First frame:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
- <item row="0" column="2">
- <widget class="QLabel" name="label_4">
+ <item row="0" column="4">
+ <widget class="QLabel" name="fpsLabel">
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
<property name="text">
- <string>Last frame:</string>
+ <string>FPS:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_11">
- <property name="text">
- <string>Height:</string>
+ <item row="0" column="5">
+ <widget class="QSpinBox" name="intFramesPerSecond">
+ <property name="minimum">
+ <number>1</number>
</property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ <property name="singleStep">
+ <number>1</number>
</property>
</widget>
</item>
- <item row="0" column="3">
+ <item row="1" column="1">
<widget class="QSpinBox" name="intEnd">
<property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
- <horstretch>1</horstretch>
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
- <item row="0" column="0">
- <widget class="QLabel" name="label_3">
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_4">
<property name="text">
- <string>First frame:</string>
+ <string>Last frame:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
- <item row="1" column="3">
+ <item row="0" column="3">
<widget class="QSpinBox" name="intWidth">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="suffix">
<string> px</string>
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="intHeight">
- <property name="suffix">
- <string> px</string>
+ <item row="0" column="2">
+ <widget class="QLabel" name="lblWidth">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Width:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
- <item row="0" column="4">
- <widget class="QLabel" name="fpsLabel">
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
+ <item row="1" column="2">
+ <widget class="QLabel" name="lblHeight">
<property name="text">
- <string>FPS:</string>
+ <string>Height:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
- <item row="0" column="5">
- <widget class="QSpinBox" name="intFramesPerSecond">
- <property name="minimum">
- <number>1</number>
+ <item row="1" column="3">
+ <widget class="QSpinBox" name="intHeight">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="singleStep">
- <number>1</number>
+ <property name="suffix">
+ <string> px</string>
</property>
</widget>
</item>
diff --git a/plugins/impex/video/video_saver.cpp b/plugins/impex/video/video_saver.cpp
index b24a30d..44d4de4 100644
--- a/plugins/impex/video/video_saver.cpp
+++ b/plugins/impex/video/video_saver.cpp
@@ -229,8 +229,7 @@ KisImageBuilder_Result VideoSaver::encode(const QString &filename, KisProperties
KisImageAnimationInterface *animation = m_image->animationInterface();
const KisTimeRange fullRange = animation->fullClipRange();
- const int frameRate = configuration->getInt("framerate", int(m_image->height()));
-
+ const int frameRate = configuration->getInt("framerate", animation->framerate());
const KisTimeRange clipRange(configuration->getInt("first_frame", fullRange.start()), configuration->getInt("last_frame", fullRange.end()));
const bool includeAudio = configuration->getBool("include_audio", true);
@@ -239,10 +238,8 @@ KisImageBuilder_Result VideoSaver::encode(const QString &filename, KisProperties
const int exportWidth = configuration->getInt("width", int(m_image->width()));
// export dimensions could be off a little bit, so the last force option tweaks the pixels for the export to work
- QString exportDimensions = QString("scale=w=").append(QString::number(exportWidth)).append(":h=")
- .append(QString::number(exportHeight)).append(":force_original_aspect_ratio=decrease");
-
-
+ const QString exportDimensions = QString("scale=w=").append(QString::number(exportWidth)).append(":h=")
+ .append(QString::number(exportHeight)).append(":force_original_aspect_ratio=decrease");
const QDir framesDir(configuration->getString("directory"));
dkazakov edited the content of this paste. (Show Details)Dec 29 2017, 10:33 AM
dkazakov changed the title of this paste from untitled to Masterwork From Distant Lands.
dkazakov updated the paste's language from autodetect to autodetect.