68 importDoc->setFileBatchMode(
true);
70 const bool usingPredefinedTimes = !optionalKeyframeTimeList.isEmpty() && !autoAddHoldframes;
71 QQueue<int> predefinedFrameQueue;
72 predefinedFrameQueue.append(optionalKeyframeTimeList);
75 int frame = usingPredefinedTimes ? predefinedFrameQueue.dequeue() : firstFrame;
76 int filesProcessed = 0;
78 if (usingPredefinedTimes) {
79 KIS_ASSERT(files.count() == optionalKeyframeTimeList.count());
83 m_d->updater->setRange(0, files.size());
86 QPair<KisPaintLayerSP, KisRasterKeyframeChannel*> layerRasterChannelPair;
88 const QRegExp rx(QLatin1String(
"(\\d+)"));
93 while ((pos = rx.indexIn(files.at(0), pos)) != -1) {
94 fileNumberRxList << rx.cap(1);
95 pos += rx.matchedLength();
98 int firstFrameNumber = 0;
101 if (!fileNumberRxList.isEmpty()) {
102 fileNumberRxList.last().toInt(&ok);
106 if (firstFrameNumber == 0){
110 fileNumberRxList.clear();
111 const int offset = (startfrom0 ? 1 : 0);
116 Q_FOREACH(QString file, files) {
120 if ( (!usingPredefinedTimes && frame == firstFrame)
121 || (usingPredefinedTimes && frame == optionalKeyframeTimeList.first()) ) {
126 if (
m_d->updater->interrupted()) {
129 m_d->updater->setValue(filesProcessed + 1);
133 qApp->processEvents();
143 importDoc->image()->projection()->crop(
m_d->image->bounds());
145 importDoc->image()->projection()->purgeDefaultPixels();
149 if (!autoAddHoldframes) {
150 layerRasterChannelPair.second->importFrame(frame, importDoc->image()->projection(), NULL);
154 while ((pos = rx.indexIn(file, pos)) != -1) {
155 fileNumberRxList << rx.cap(1);
156 pos += rx.matchedLength();
159 int filenum = fileNumberRxList.last().toInt(&ok);
161 if (isAscending == 0) {
162 autoframe = firstFrame + filenum - offset;
164 autoframe = firstFrame + (firstFrameNumber - filenum);
168 layerRasterChannelPair.second->importFrame(autoframe , importDoc->image()->projection(), NULL);
171 layerRasterChannelPair.second->importFrame(autoframe + 1, importDoc->image()->projection(), NULL);
173 fileNumberRxList.clear();
176 if (usingPredefinedTimes && predefinedFrameQueue.count()) {
177 frame = predefinedFrameQueue.dequeue();
185 if (layerRasterChannelPair.first && assignDocumentProfile) {
187 if (layerRasterChannelPair.first->colorSpace()->colorModelId() ==
m_d->image->colorSpace()->colorModelId()) {
189 const KoColorSpace *srcColorSpace = layerRasterChannelPair.first->colorSpace();
193 ,
m_d->image->colorSpace()->profile());
196 visitor->
visit(layerRasterChannelPair.first.data(), undo);
KisImportExportErrorCode import(QStringList files, int firstFrame, int step, bool autoAddHoldframes=false, bool startfrom0=false, int isAscending=0, bool assignDocumentProfile=false, QList< int > optionalKeyframeTimeList={})