16#include <QRegularExpression>
41 : m_image(doc->savingImage())
43 , m_batchMode(batchMode)
69 KisCursorOverrideLock cursorLock(Qt::WaitCursor);
78 if (path.right(4).toUpper() ==
".CSV")
79 path = path.left(path.size() - 4);
85 path = path.left(path.size() - 4);
88 path.append(
".frames");
107 if (node->inherits(
"KisLayer")) {
108 KisLayer* paintLayer = qobject_cast<KisLayer*>(node.
data());
110 layers.prepend(layerRecord);
112 layerRecord->
name = paintLayer->
name();
113 layerRecord->
name.replace(QRegularExpression(
"[\"\\r\\n]"),
"_");
115 if (layerRecord->
name.isEmpty())
116 layerRecord->
name= QString(
"Unnamed-%1").arg(idx);
121 layerRecord->
layer = paintLayer;
123 layerRecord->
last =
"";
124 layerRecord->
frame = 0;
137 if (end < start) end = start;
143 for (idx = 0; idx < layers.size(); idx++) {
149 if ( (channel->
keyframeAt(keyframeTime)) && (keyframeTime > end) )
171 qApp->processEvents();
181 if (io->write(
"UTF-8, TVPaint, \"CSV 1.0\"\r\n") < 0) {
187 if (io->write(
"Project Name, Width, Height, Frame Count, Layer Count, Frame Rate, Pixel Aspect Ratio, Field Mode\r\n") < 0) {
193 ba = QString(
"\"%1\", ").arg(
m_image->objectName()).toUtf8();
194 if (io->write(ba.data()) < 0) {
199 if (io->write(ba.data()) < 0) {
204 ba = QString(
"%1, %2, ").arg(end - start + 1).arg(layers.size()).toUtf8();
205 if (io->write(ba.data()) < 0) {
210 ba = QString(
"%1, ").arg((
double)(animation->
framerate()),0,
'f',6).toUtf8();
211 if (io->write(ba.data()) < 0) {
216 if (io->write(ba.data()) < 0) {
223 if (io->write(
"#Layers") < 0) {
228 for (idx = 0; idx < layers.size(); idx++) {
229 ba = QString(
", \"%1\"").arg(layers.at(idx)->name).toUtf8();
230 if (io->write(ba.data()) < 0)
236 if (io->write(
"\r\n#Density") < 0) {
240 for (idx = 0; idx < layers.size(); idx++) {
241 ba = QString(
", %1").arg((
double)(layers.at(idx)->density), 0,
'f', 6).toUtf8();
242 if (io->write(ba.data()) < 0)
248 if (io->write(
"\r\n#Blending") < 0) {
252 for (idx = 0; idx < layers.size(); idx++) {
253 ba = QString(
", \"%1\"").arg(layers.at(idx)->blending).toUtf8();
254 if (io->write(ba.data()) < 0)
260 if (io->write(
"\r\n#Visible") < 0) {
264 for (idx = 0; idx < layers.size(); idx++) {
265 ba = QString(
", %1").arg(layers.at(idx)->visible).toUtf8();
266 if (io->write(ba.data()) < 0)
269 if (idx < layers.size()) {
277 if (io->write(
"\r\n") < 0)
284 ba = QString(
"\r\n#%1").arg(frame, 5, 10, QChar(
'0')).toUtf8();
285 if (io->write(ba.data()) < 0) {
290 for (idx = 0; idx < layers.size(); idx++) {
295 if (frame == start) {
304 if ( keyframe || (frame == start) ) {
310 retval =
getLayer(layer, exportDoc.data(), keyframe, path, frame, idx);
315 ba = QString(
", \"%1\"").arg(layer->
last).toUtf8();
317 if (io->write(ba.data()) < 0)
320 if (idx < layers.size())
328 }
while((retval.
isOk()) && (step < 8));
386 if (!keyframe.isNull()) {
388 if (rasterKeyframe) {
389 rasterKeyframe->writeFrameToDevice(device);
400 layer->
last = QString(
"frame%1-%2.png").arg(idx + 1,5,10,QChar(
'0')).arg(frame,5,10,QChar(
'0'));
402 QString filename = path;
403 filename.append(layer->
last);
409 bool isThereAlpha =
false;
423 options.
alpha = isThereAlpha;
const quint8 OPACITY_OPAQUE_U8
const QString COMPOSITE_OVER
const QString COMPOSITE_DARKEN
const QString COMPOSITE_OVERLAY
const QString COMPOSITE_DIVIDE
const QString COMPOSITE_DODGE
const QString COMPOSITE_SOFT_LIGHT_SVG
const QString COMPOSITE_ADD
const QString COMPOSITE_LIGHTEN
const QString COMPOSITE_GRAIN_MERGE
const QString COMPOSITE_SOFT_LIGHT_PHOTOSHOP
const QString COMPOSITE_INVERSE_SUBTRACT
const QString COMPOSITE_MULT
const QString COMPOSITE_SATURATION
const QString COMPOSITE_LINEAR_LIGHT
const QString COMPOSITE_COLORIZE
const QString COMPOSITE_HARD_LIGHT
const QString COMPOSITE_SCREEN
const QString COMPOSITE_DIFF
const QString COMPOSITE_ERASE
const QString COMPOSITE_HUE
const QString COMPOSITE_BEHIND
const QString COMPOSITE_SUBTRACT
const QString COMPOSITE_BURN
const QString COMPOSITE_LINEAR_DODGE
const QString COMPOSITE_GRAIN_EXTRACT
KisRasterKeyframeChannel * channel
CSVSaver(KisDocument *doc, bool batchMode)
KisImportExportErrorCode buildAnimation(QIODevice *io)
KisImportExportErrorCode encode(QIODevice *io)
QString convertToBlending(const QString &)
void createTempImage(KisDocument *)
KisImportExportErrorCode getLayer(CSVLayerRecord *, KisDocument *, KisKeyframeSP, const QString &, int, int)
KisUndoStore * createUndoStore()
void setFileBatchMode(const bool batchMode)
QString localFilePath() const
void setCurrentImage(KisImageSP image, bool forceInitialUpdate=true, KisNodeSP preActivatedNode=nullptr)
void setInfiniteAutoSaveInterval()
const KisTimeSpan & documentPlaybackRange() const
documentPlaybackRange
vKisAnnotationSP_it endAnnotations()
KisGroupLayerSP rootLayer() const
const KoColorSpace * colorSpace() const
KisImageAnimationInterface * animationInterface() const
QRect bounds() const override
vKisAnnotationSP_it beginAnnotations()
void setResolution(double xres, double yres)
KisKeyframeSP keyframeAt(int time) const
Get a keyframe at specified time. Used primarily when the value of a given keyframe is needed.
KisKeyframeSP activeKeyframeAt(int time) const
int lastKeyframeTime() const
static bool isColorSpaceSupported(const KoColorSpace *cs)
KisImportExportErrorCode buildFile(const QString &filename, const QRect &imageRect, const qreal xRes, const qreal yRes, KisPaintDeviceSP device, vKisAnnotationSP_it annotationsStart, vKisAnnotationSP_it annotationsEnd, KisPNGOptions options, KisMetaData::Store *metaData)
KisRasterKeyframeChannel * keyframeChannel() const
QRect exactBounds() const
const KoColorSpace * colorSpace() const
void convertTo(const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent=KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::ConversionFlags conversionFlags=KoColorConversionTransformation::internalConversionFlags(), KUndo2Command *parentCommand=nullptr, KoUpdater *progressUpdater=nullptr)
void makeCloneFrom(KisPaintDeviceSP src, const QRect &rect)
static KisPart * instance()
The KisRasterKeyframeChannel is a concrete KisKeyframeChannel subclass that stores and manages KisRas...
The KisRasterKeyframe class is a concrete subclass of KisKeyframe that wraps a physical raster image ...
ALWAYS_INLINE const quint8 * oldRawData() const
virtual quint8 opacityU8(const quint8 *pixel) const =0
This file is part of the Krita application in calligra.
#define KIS_ASSERT_RECOVER_RETURN_VALUE(cond, val)
#define KIS_SAFE_ASSERT_RECOVER(cond)
KisDocument * createDocument(QList< KisNodeSP > nodes, KisImageSP srcImage, const QRect &copiedBounds)
virtual KisPaintDeviceSP projection() const =0
const QString & compositeOpId() const
virtual bool visible(bool recursive=false) const
KisPaintDeviceSP projection() const override
KisPaintDeviceSP original() const override=0
bool addNode(KisNodeSP node, KisNodeSP parent=KisNodeSP(), KisNodeAdditionFlags flags=KisNodeAdditionFlag::None)
KisNodeSP firstChild() const
KisNodeSP nextSibling() const
QColor transparencyFillColor
static KoColorSpaceRegistry * instance()