Krita Source Code Documentation
Loading...
Searching...
No Matches
KisAnimationRenderingOptions.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2019 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6
8
9#include <QStandardPaths>
10#include <QFileInfo>
11
12#include <KisFileUtils.h>
13
15 : videoMimeType("video/mp4"),
16 frameMimeType("image/png"),
17 basename("frame"),
18 directory("")
19{
20
21}
22
23QString KisAnimationRenderingOptions::resolveAbsoluteDocumentFilePath(const QString &documentPath) const
24{
25 return
26 !documentPath.isEmpty() ?
27 documentPath :
28 QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
29}
30
31QString KisAnimationRenderingOptions::resolveAbsoluteVideoFilePath(const QString &documentPath) const
32{
33 const QString basePath = resolveAbsoluteDocumentFilePath(documentPath);
35}
36
37QString KisAnimationRenderingOptions::resolveAbsoluteFramesDirectory(const QString &documentPath) const
38{
40 return QFileInfo(resolveAbsoluteVideoFilePath()).absolutePath();
41 }
42
43 const QString basePath = resolveAbsoluteDocumentFilePath(documentPath);
45}
46
51
56
69
71{
73
74 config->setProperty("basename", basename);
75 config->setProperty("last_document_path", lastDocumentPath);
76 config->setProperty("directory", directory);
77 config->setProperty("first_frame", firstFrame);
78 config->setProperty("last_frame", lastFrame);
79 config->setProperty("sequence_start", sequenceStart);
80 config->setProperty("video_mimetype", videoMimeType);
81 config->setProperty("frame_mimetype", frameMimeType);
82
83 config->setProperty("encode_video", shouldEncodeVideo);
84 config->setProperty("delete_sequence", shouldDeleteSequence);
85 config->setProperty("only_unique_frames", wantsOnlyUniqueFrameSequence);
86
87 config->setProperty("ffmpeg_path", ffmpegPath);
88 config->setProperty("framerate", frameRate);
89 config->setProperty("height", height);
90 config->setProperty("width", width);
91 config->setProperty("include_audio", includeAudio);
92 config->setProperty("filename", videoFileName);
93 config->setProperty("custom_ffmpeg_options", customFFMpegOptions);
94
95 config->setPrefixedProperties("frame_export/", frameExportConfig);
96
97 return config;
98}
99
101{
102 basename = config->getPropertyLazy("basename", basename);
103 lastDocumentPath = config->getPropertyLazy("last_document_path", "");
104 directory = config->getPropertyLazy("directory", directory);
105 firstFrame = config->getPropertyLazy("first_frame", 0);
106 lastFrame = config->getPropertyLazy("last_frame", 0);
107 sequenceStart = config->getPropertyLazy("sequence_start", 0);
108 videoMimeType = config->getPropertyLazy("video_mimetype", videoMimeType);
109 frameMimeType = config->getPropertyLazy("frame_mimetype", frameMimeType);
110
111 shouldEncodeVideo = config->getPropertyLazy("encode_video", false);
112 shouldDeleteSequence = config->getPropertyLazy("delete_sequence", false);
113 wantsOnlyUniqueFrameSequence = config->getPropertyLazy("only_unique_frames", false);
114
115 ffmpegPath = config->getPropertyLazy("ffmpeg_path", "");
116 frameRate = config->getPropertyLazy("framerate", 25);
117 height = config->getPropertyLazy("height", 0);
118 width = config->getPropertyLazy("width", 0);
119 includeAudio = config->getPropertyLazy("include_audio", true);
120 videoFileName = config->getPropertyLazy("filename", "");
121 customFFMpegOptions = config->getPropertyLazy("custom_ffmpeg_options", "");
122
124 frameExportConfig->setPrefixedProperties("frame_export/", frameExportConfig);
125
126}
QString resolveAbsoluteDocumentFilePath(const QString &documentPath) const
void fromProperties(KisPropertiesConfigurationSP config)
KisPropertiesConfigurationSP frameExportConfig
KisPropertiesConfigurationSP toProperties() const
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130
QString resolveAbsoluteFilePath(const QString &baseDir, const QString &fileName)
Resolve absolute file path from a file path and base dir.