21#include <QImageReader>
23#include <QTemporaryDir>
26#include "vectorimage.h"
27#include "bitmapimage.h"
30#include "layerbitmap.h"
31#include "layervector.h"
32#include "layercamera.h"
33#include "undoredocommand.h"
35#include "colormanager.h"
36#include "filemanager.h"
37#include "toolmanager.h"
38#include "layermanager.h"
39#include "playbackmanager.h"
40#include "viewmanager.h"
41#include "preferencemanager.h"
42#include "soundmanager.h"
43#include "selectionmanager.h"
44#include "overlaymanager.h"
45#include "clipboardmanager.h"
46#include "undoredomanager.h"
48#include "scribblearea.h"
97 mIsAutosave = mPreferenceManager->isOn(SETTING::AUTO_SAVE);
98 mAutosaveNumber = mPreferenceManager->getInt(SETTING::AUTO_SAVE_NUMBER);
103int Editor::currentFrame()
const
110 return mPlaybackManager->fps();
113void Editor::setFps(
int fps)
115 mPreferenceManager->set(SETTING::FPS, fps);
116 emit fpsChanged(fps);
119void Editor::makeConnections()
121 connect(mPreferenceManager, &PreferenceManager::optionChanged,
this, &Editor::settingUpdated);
122 connect(mUndoRedoManager, &UndoRedoManager::didUpdateUndoStack,
this, &Editor::updateAutoSaveCounter);
123 connect(mPreferenceManager, &PreferenceManager::optionChanged, mUndoRedoManager, &UndoRedoManager::onSettingChanged);
127 connect(mLayerManager, &LayerManager::currentLayerWillChange,
this, &Editor::onCurrentLayerWillChange);
130void Editor::settingUpdated(SETTING setting)
134 case SETTING::AUTO_SAVE:
135 mIsAutosave = mPreferenceManager->isOn(SETTING::AUTO_SAVE);
137 case SETTING::AUTO_SAVE_NUMBER:
138 mAutosaveNumber = mPreferenceManager->getInt(SETTING::AUTO_SAVE_NUMBER);
140 case SETTING::ONION_TYPE:
142 emit updateTimeLineCached();
144 case SETTING::FRAME_POOL_SIZE:
145 mObject->setActiveFramePoolSize(mPreferenceManager->getInt(SETTING::FRAME_POOL_SIZE));
147 case SETTING::LAYER_VISIBILITY:
148 mScribbleArea->setLayerVisibility(
static_cast<LayerVisibility
>(mPreferenceManager->getInt(SETTING::LAYER_VISIBILITY)));
149 emit updateTimeLine();
156void Editor::onCurrentLayerWillChange(
int index)
158 Layer* newLayer = layers()->getLayer(index);
159 Layer* currentLayer = layers()->currentLayer();
160 Q_ASSERT(newLayer && currentLayer);
161 if (currentLayer->type() != newLayer->type()) {
163 mScribbleArea->applyTransformedSelection();
165 if (currentLayer->type() == Layer::VECTOR) {
166 auto keyFrame =
static_cast<VectorImage*
>(currentLayer->getLastKeyFrameAtPosition(mFrame));
173 select()->resetSelectionProperties();
177void Editor::updateAutoSaveCounter()
179 if (mIsAutosave ==
false)
183 if (mAutosaveCounter >= mAutosaveNumber)
185 resetAutoSaveCounter();
190void Editor::resetAutoSaveCounter()
192 mAutosaveCounter = 0;
197 Layer* currentLayer = layers()->currentLayer();
199 Q_ASSERT(currentLayer !=
nullptr);
201 if (!canCopy()) {
return; }
205 if (currentLayer->hasAnySelectedFrames() && !select()->somethingSelected()) {
207 }
else if (currentLayer->type() == Layer::BITMAP) {
208 BitmapImage* bitmapImage =
static_cast<BitmapImage*
>(currentLayer->getLastKeyFrameAtPosition(currentFrame()));
209 clipboards()->
copyBitmapImage(bitmapImage, select()->mySelectionRect());
210 }
else if (currentLayer->type() == Layer::VECTOR) {
211 VectorImage* vectorImage =
static_cast<VectorImage*
>(currentLayer->getLastKeyFrameAtPosition(currentFrame()));
216void Editor::copyAndCut()
220 Layer* currentLayer = layers()->currentLayer();
222 if (currentLayer->hasAnySelectedFrames() && !select()->somethingSelected()) {
224 currentLayer->removeKeyFrame(pos);
226 emit layers()->currentLayerChanged(currentLayerIndex());
227 emit updateTimeLine();
231 if (currentLayer->type() == Layer::BITMAP || currentLayer->type() == Layer::VECTOR) {
232 mScribbleArea->deleteSelection();
237void Editor::pasteFromPreviousFrame()
239 Layer* currentLayer = layers()->currentLayer();
240 int prevFrame = currentLayer->getPreviousKeyFramePosition(mFrame);
241 if (!currentLayer->keyExists(mFrame) || prevFrame == mFrame)
246 if (currentLayer->type() == Layer::BITMAP)
248 backup(
tr(
"Paste from Previous Keyframe"));
250 if (select()->somethingSelected())
253 pasteToCanvas(©, mFrame);
257 pasteToCanvas(bitmapImage, mFrame);
260 else if (currentLayer->type() == Layer::VECTOR)
262 backup(
tr(
"Paste from Previous Keyframe"));
264 pasteToCanvas(vectorImage, mFrame);
268void Editor::pasteToCanvas(
BitmapImage* bitmapImage,
int frameNumber)
270 Layer* currentLayer = layers()->currentLayer();
272 Q_ASSERT(currentLayer->type() == Layer::BITMAP);
274 if (select()->somethingSelected())
276 QRectF selection = select()->mySelectionRect();
277 if (bitmapImage->width() <= selection.
width() && bitmapImage->height() <= selection.
height())
279 bitmapImage->moveTopLeft(selection.
topLeft());
283 bitmapImage->transform(selection,
true);
287 BitmapImage *canvasImage =
static_cast<BitmapImage*
>(currentLayer->getLastKeyFrameAtPosition(frameNumber));
290 canvasImage->paste(bitmapImage);
294 select()->setSelection(bitmapImage->bounds());
298void Editor::pasteToCanvas(
VectorImage* vectorImage,
int frameNumber)
300 Layer* currentLayer = layers()->currentLayer();
302 Q_ASSERT(currentLayer->type() == Layer::VECTOR);
306 VectorImage* canvasImage =
static_cast<VectorImage*
>(currentLayer->getLastKeyFrameAtPosition(frameNumber));
307 canvasImage->
paste(*vectorImage);
308 select()->setSelection(vectorImage->getSelectionRect());
312void Editor::pasteToFrames()
315 Q_ASSERT(!clipboardFrames.empty());
316 Layer* currentLayer = layers()->currentLayer();
318 currentLayer->deselectAll();
320 int newPositionOffset = mFrame - clipboardFrames.cbegin()->first;
321 for (
auto it = clipboardFrames.cbegin(); it != clipboardFrames.cend(); ++it)
323 int newPosition = it->first + newPositionOffset;
325 KeyFrame* keyFrameNewPos = currentLayer->getKeyFrameWhichCovers(newPosition);
327 if (keyFrameNewPos !=
nullptr) {
331 currentLayer->moveSelectedFrames(1);
336 Q_ASSERT(key !=
nullptr);
340 if (currentLayer->type() == Layer::SOUND)
342 auto soundClip =
static_cast<SoundClip*
>(key);
343 sound()->loadSound(soundClip, soundClip->fileName());
346 currentLayer->setFrameSelected(key->pos(),
true);
352 Layer* currentLayer = layers()->currentLayer();
354 Q_ASSERT(currentLayer !=
nullptr);
356 if (!canPaste()) {
return; }
358 if (clipboards()->framesIsEmpty()) {
362 clipboards()->setFromSystemClipboard(mScribbleArea->getCentralPoint(), currentLayer);
364 BitmapImage clipboardImage = clipboards()->getBitmapClipboard();
365 VectorImage clipboardVectorImage = clipboards()->getVectorClipboard();
366 if (currentLayer->type() == Layer::BITMAP && clipboardImage.isLoaded()) {
367 pasteToCanvas(&clipboardImage, mFrame);
368 }
else if (currentLayer->type() == Layer::VECTOR && !clipboardVectorImage.isEmpty()) {
369 pasteToCanvas(&clipboardVectorImage, mFrame);
379void Editor::flipSelection(
bool flipVertical)
382 backup(
tr(
"Flip selection vertically"));
384 backup(
tr(
"Flip selection horizontally"));
386 mScribbleArea->flipSelection(flipVertical);
389void Editor::repositionImage(
QPoint transform,
int frame)
391 if (layers()->currentLayer()->type() == Layer::BITMAP)
395 QRect reposRect = layer->getFrameBounds(frame);
396 select()->setSelection(reposRect);
399 layer->repositionFrame(point, frame);
400 backup(layer->id(), frame,
tr(
"Reposition frame"));
404void Editor::setModified(
int layerNumber,
int frameNumber)
406 Layer* layer = object()->getLayer(layerNumber);
407 if (layer ==
nullptr) {
return; }
409 layer->setModified(frameNumber,
true);
410 undoRedo()->rememberLastModifiedFrame(layerNumber, frameNumber);
415void Editor::clipboardChanged()
417 Layer* layer = layers()->currentLayer();
419 clipboards()->setFromSystemClipboard(mScribbleArea->getCentralPoint(), layer);
421 bool canCopyState = canCopy();
422 bool canPasteState = canPaste();
424 emit canCopyChanged(canCopyState);
425 emit canPasteChanged(canPasteState);
429 mScribbleArea->setLayerVisibility(visibility);
430 emit updateTimeLine();
433LayerVisibility Editor::layerVisibility()
435 return mScribbleArea->getLayerVisibility();
438qreal Editor::viewScaleInversed()
443void Editor::increaseLayerVisibilityIndex()
445 mScribbleArea->increaseLayerVisibilityIndex();
446 emit updateTimeLine();
449void Editor::decreaseLayerVisibilityIndex()
451 mScribbleArea->decreaseLayerVisibilityIndex();
452 emit updateTimeLine();
457 mTemporaryDirs.
append(dir);
460void Editor::clearTemporary()
462 while(!mTemporaryDirs.
isEmpty())
470Status Editor::openObject(
const QString& strFilePath,
const std::function<
void(
int)>& progressChanged,
const std::function<
void(
int)>& progressRangeChanged)
473 Q_ASSERT(!strFilePath.
isEmpty());
476 dd <<
QString(
"Raw file path: %1").
arg(strFilePath);
477 dd <<
QString(
"Resolved file path: %1").
arg(fileInfo.absoluteFilePath());
478 if (fileInfo.isDir())
480 return Status(Status::ERROR_FILE_CANNOT_OPEN,
482 tr(
"Could not open file"),
483 tr(
"The file you have selected is a directory, so we are unable to open it. "
484 "If you are are trying to open a project that uses the old structure, "
485 "please open the file ending with .pcl, not the data folder."));
487 if (!fileInfo.exists())
489 return Status(Status::FILE_NOT_FOUND,
491 tr(
"Could not open file"),
492 tr(
"The file you have selected does not exist, so we are unable to open it. "
493 "Please make sure that you've entered the correct path and that the file is accessible and try again."));
495 if (!fileInfo.isReadable())
497 dd <<
QString(
"Permissions: 0x%1").
arg(fileInfo.permissions(), 0, 16);
498 return Status(Status::ERROR_FILE_CANNOT_OPEN,
500 tr(
"Could not open file"),
501 tr(
"This program does not have permission to read the file you have selected. "
502 "Please check that you have read permissions for this file and try again."));
507 connect(&fm, &FileManager::progressChanged, [&progress, &progressChanged](
int p)
509 progressChanged(progress = p);
511 connect(&fm, &FileManager::progressRangeChanged, [&progressRangeChanged](
int max)
513 progressRangeChanged(max + 3);
516 QString fullPath = fileInfo.absoluteFilePath();
518 Object*
object = fm.load(fullPath);
520 Status fmStatus = fm.error();
523 dd.collect(fmStatus.details());
524 fmStatus.setDetails(dd);
528 if (
object ==
nullptr)
530 return Status(Status::ERROR_FILE_CANNOT_OPEN,
532 tr(
"Could not open file"),
533 tr(
"An unknown error occurred while trying to load the file and we are not able to load your file."));
538 progressChanged(progress + 1);
541 setFps(playback()->fps());
550 if (newObject == mObject.get())
555 mObject.reset(newObject);
562 m->load(mObject.get());
569void Editor::updateObject()
571 setCurrentLayerIndex(mObject->data()->getCurrentLayer());
572 scrubTo(mObject->data()->getCurrentFrame());
574 mAutosaveCounter = 0;
575 mAutosaveNeverAskAgain =
false;
577 if (mPreferenceManager)
579 mObject->setActiveFramePoolSize(mPreferenceManager->getInt(SETTING::FRAME_POOL_SIZE));
582 emit updateLayerCount();
589 Q_ASSERT(layers()->currentLayer()->type() == Layer::BITMAP);
590 const auto layer =
static_cast<LayerBitmap*
>(layers()->currentLayer());
592 if (!layer->visible())
594 mScribbleArea->showLayerNotVisibleWarning();
598 Status status = Status::OK;
600 dd <<
QString(
"Raw file path: %1").
arg(filePath);
603 if (!reader.read(&img)) {
604 QString format = reader.format();
607 dd <<
QString(
"QImageReader format: %1").
arg(format);
609 dd <<
QString(
"QImageReader ImageReaderError type: %1").
arg(reader.errorString());
612 switch(reader.error())
614 case QImageReader::ImageReaderError::FileNotFoundError:
615 errorDesc =
tr(
"File not found at path \"%1\". Please check the image is present at the specified location and try again.").
arg(filePath);
618 errorDesc =
tr(
"Image format is not supported. Please convert the image file to one of the following formats and try again:\n%1")
622 errorDesc =
tr(
"An error has occurred while reading the image. Please check that the file is a valid image and try again.");
625 status =
Status(Status::FAIL, dd,
tr(
"Import failed"), errorDesc);
631 if (!layer->keyExists(mFrame))
636 BitmapImage* bitmapImage = layer->getBitmapImageAtFrame(mFrame);
638 bitmapImage->paste(&importedBitmapImage);
643 backup(
tr(
"Import Image"));
650 Q_ASSERT(layers()->currentLayer()->type() == Layer::VECTOR);
652 auto layer =
static_cast<LayerVector*
>(layers()->currentLayer());
654 Status status = Status::OK;
656 dd <<
QString(
"Raw file path: %1").
arg(filePath);
658 VectorImage* vectorImage = layer->getVectorImageAtFrame(currentFrame());
659 if (vectorImage ==
nullptr)
662 vectorImage = layer->getVectorImageAtFrame(currentFrame());
666 bool ok = importedVectorImage.
read(filePath);
670 vectorImage->
paste(importedVectorImage);
673 backup(
tr(
"Import Image"));
676 status =
Status(Status::FAIL, dd,
tr(
"Import failed"),
tr(
"You cannot import images into a vector layer."));
684 Layer* layer = layers()->currentLayer();
687 dd <<
QString(
"Raw file path: %1").
arg(filePath);
690 switch (importConfig.positionType)
692 case ImportImageConfig::CenterOfCamera: {
695 transform = layerCam->getViewAtFrame(importConfig.importFrame).
inverted();
698 case ImportImageConfig::CenterOfCameraFollowed: {
701 transform = camera->getViewAtFrame(currentFrame()).
inverted();
704 case ImportImageConfig::CenterOfView: {
705 QPointF centralPoint = mScribbleArea->getCentralPoint();
709 case ImportImageConfig::CenterOfCanvas:
710 case ImportImageConfig::None: {
716 switch (layer->type())
719 return importBitmapImage(filePath, transform);
722 return importVectorImage(filePath);
725 dd <<
QString(
"Current layer: %1").
arg(layer->type());
726 return Status(Status::ERROR_INVALID_LAYER_TYPE, dd,
tr(
"Import failed"),
tr(
"You can only import images to a bitmap layer."));
730Status Editor::importAnimatedImage(
const QString& filePath,
int frameSpacing,
const std::function<
void(
int)>& progressChanged,
const std::function<
bool()>& wasCanceled)
732 frameSpacing = qMax(1, frameSpacing);
735 dd <<
QString(
"Raw file path: %1").
arg(filePath);
737 Layer* layer = layers()->currentLayer();
738 if (layer->type() != Layer::BITMAP)
740 dd <<
QString(
"Current layer: %1").
arg(layer->type());
741 return Status(Status::ERROR_INVALID_LAYER_TYPE, dd,
tr(
"Import failed"),
tr(
"You can only import images to a bitmap layer."));
747 if (!reader.supportsAnimation()) {
748 return Status(Status::ERROR_INVALID_LAYER_TYPE, dd,
tr(
"Import failed"),
tr(
"The selected image has a format that does not support animation."));
752 const QPoint pos(view()->getView().dx() - (img.width() / 2),
753 view()->getView().dy() - (img.height() / 2));
754 int totalFrames = reader.imageCount();
755 while (reader.read(&img))
759 dd <<
QString(
"QImageReader ImageReaderError type: %1").
arg(reader.errorString());
762 switch(reader.error())
764 case QImageReader::ImageReaderError::FileNotFoundError:
765 errorDesc =
tr(
"File not found at path \"%1\". Please check the image is present at the specified location and try again.").
arg(filePath);
768 errorDesc =
tr(
"Image format is not supported. Please convert the image file to one of the following formats and try again:\n%1")
769 .
arg((
QString)reader.supportedImageFormats().join(
", "));
772 errorDesc =
tr(
"An error has occurred while reading the image. Please check that the file is a valid image and try again.");
775 return Status(Status::FAIL, dd,
tr(
"Import failed"), errorDesc);
778 if (!bitmapLayer->keyExists(mFrame))
782 BitmapImage* bitmapImage = bitmapLayer->getBitmapImageAtFrame(mFrame);
784 bitmapImage->paste(&importedBitmapImage);
792 scrubTo(mFrame + frameSpacing);
794 backup(
tr(
"Import Image"));
796 progressChanged(qFloor(qMin(
static_cast<double>(reader.currentImageNumber()) / totalFrames, 1.0) * 100));
802void Editor::selectAll()
const
804 Layer* layer = layers()->currentLayer();
807 if (layer->type() == Layer::BITMAP)
812 if (bitmapImage ==
nullptr) {
return; }
814 rect = bitmapImage->bounds();
816 else if (layer->type() == Layer::VECTOR)
819 if (vectorImage !=
nullptr)
822 rect = vectorImage->getSelectionRect();
825 select()->setSelection(rect,
false);
828void Editor::deselectAll()
const
830 select()->resetSelectionProperties();
832 Layer* layer = layers()->currentLayer();
833 if (layer ==
nullptr) {
return; }
835 if (layer->type() == Layer::VECTOR)
838 if (vectorImage !=
nullptr)
844 if (layer->hasAnySelectedFrames()) {
845 layer->deselectAll();
846 emit updateTimeLine();
855void Editor::setCurrentLayerIndex(
int i)
857 mCurrentLayerIndex = i;
859 Layer* layer = mObject->getLayer(i);
860 for (
auto mgr : mAllManagers)
862 mgr->workingLayerChanged(layer);
866void Editor::scrubTo(
int frame)
868 if (frame < 1) { frame = 1; }
874 if (mPlaybackManager && !mPlaybackManager->isPlaying())
876 emit updateTimeLineCached();
878 mObject->updateActiveFrames(frame);
882void Editor::scrubForward()
884 int nextFrame = mFrame + 1;
885 if (!playback()->isPlaying()) {
886 playback()->playScrub(nextFrame);
891void Editor::scrubBackward()
893 if (currentFrame() > 1)
895 int previousFrame = mFrame - 1;
896 if (!playback()->isPlaying()) {
897 playback()->playScrub(previousFrame);
899 scrubTo(previousFrame);
905 return addKeyFrame(layers()->currentLayerIndex(), currentFrame());
910 Layer* layer = mObject->getLayer(layerNumber);
913 if (!layer->visible())
915 mScribbleArea->showLayerNotVisibleWarning();
920 while (layer->keyExists(frameIndex))
922 if (layer->type() == Layer::SOUND
923 && layer->getKeyFrameAt(frameIndex)->fileName().
isEmpty()
924 && layer->removeKeyFrame(frameIndex))
939 return layer->getKeyFrameAt(frameIndex);
942void Editor::removeKey()
944 Layer* layer = layers()->currentLayer();
945 Q_ASSERT(layer !=
nullptr);
947 if (!layer->visible())
949 mScribbleArea->showLayerNotVisibleWarning();
953 if (!layer->keyExistsWhichCovers(currentFrame()))
959 backup(
tr(
"Remove frame"));
962 layer->removeKeyFrame(currentFrame());
964 emit layers()->currentLayerChanged(layers()->currentLayerIndex());
967void Editor::scrubNextKeyFrame()
969 Layer* currentLayer = layers()->currentLayer();
970 Q_ASSERT(currentLayer);
972 int nextPosition = currentLayer->getNextKeyFramePosition(currentFrame());
973 if (currentFrame() >= currentLayer->getMaxKeyFramePosition()) nextPosition = currentFrame() + 1;
974 scrubTo(nextPosition);
977void Editor::scrubPreviousKeyFrame()
979 Layer* layer = mObject->getLayer(layers()->currentLayerIndex());
982 int prevPosition = layer->getPreviousKeyFramePosition(currentFrame());
983 scrubTo(prevPosition);
986void Editor::switchVisibilityOfLayer(
int layerNumber)
988 Layer* layer = mObject->getLayer(layerNumber);
989 if (layer !=
nullptr) layer->switchVisibility();
992 emit updateTimeLine();
995void Editor::swapLayers(
int i,
int j)
997 bool didSwapLayer = mObject->swapLayers(i, j);
998 if (!didSwapLayer) {
return; }
1002 layers()->setCurrentLayer(j + 1);
1006 layers()->setCurrentLayer(j - 1);
1008 emit updateTimeLine();
1012bool Editor::canSwapLayers(
int layerIndexLeft,
int layerIndexRight)
const
1014 return mObject->canSwapLayers(layerIndexLeft, layerIndexRight);
1017void Editor::prepareSave()
1019 for (
auto mgr : mAllManagers)
1021 mgr->save(mObject.get());
1025void Editor::clearCurrentFrame()
1027 mScribbleArea->clearImage();
1030bool Editor::canCopy()
const
1032 Layer* layer = layers()->currentLayer();
1033 KeyFrame* keyframe = layer->getLastKeyFrameAtPosition(mFrame);
1035 switch (layer->type())
1039 return canCopyFrames(layer);
1041 return canCopyBitmapImage(
static_cast<BitmapImage*
>(keyframe)) || canCopyFrames(layer);
1043 return canCopyVectorImage(
static_cast<VectorImage*
>(keyframe)) || canCopyFrames(layer);
1049bool Editor::canPaste()
const
1051 Layer* layer = layers()->currentLayer();
1052 auto clipboardMan = clipboards();
1053 auto layerType = layer->type();
1055 return (layerType == clipboardMan->framesLayerType() && !clipboardMan->framesIsEmpty()) ||
1056 (layerType == Layer::BITMAP && clipboardMan->getBitmapClipboard().isLoaded()) ||
1057 (layerType == Layer::VECTOR && !clipboardMan->getVectorClipboard().isEmpty());
1060bool Editor::canCopyFrames(
const Layer* layer)
const
1062 Q_ASSERT(layer !=
nullptr);
1063 return layer->hasAnySelectedFrames();
1066bool Editor::canCopyBitmapImage(
BitmapImage* bitmapImage)
const
1068 return bitmapImage !=
nullptr && bitmapImage->isLoaded() && !bitmapImage->bounds().
isEmpty();
1071bool Editor::canCopyVectorImage(
const VectorImage* vectorImage)
const
1073 return vectorImage !=
nullptr && !vectorImage->isEmpty();
1076void Editor::backup(
const QString &undoText)
1078 undoRedo()->legacyBackup(undoText);
1079 updateAutoSaveCounter();
1082bool Editor::backup(
int layerNumber,
int frameNumber,
const QString &undoText)
1084 bool didBackup = undoRedo()->legacyBackup(layerNumber, frameNumber, undoText);
1086 updateAutoSaveCounter();
std::map< int, KeyFrame * > getClipboardFrames()
Return a copy of all clipboard frames keyed by their position.
void copySelectedFrames(const Layer *currentLayer)
Copy selected keyframes of any given layer and remember its type.
void copyVectorImage(const VectorImage *vectorImage)
Copy the entire vector image to clipboard, this operation does not yet support partial selections.
void copyBitmapImage(BitmapImage *image, QRectF selectionRect)
Copy bitmap image to clipboard and save its latest position Additionally only a part of the image wil...
KeyFrame * addNewKey()
Attempts to create a new keyframe at the current frame and layer.
void frameModified(int frameNumber)
This should be emitted after modifying the frame content.
void updateFrame()
Will call update() and update the canvas Only call this directly If you need the cache to be intact a...
void scrubbed(int frameNumber)
This should be emitted after scrubbing.
void setLayerVisibility(LayerVisibility visibility)
The visibility value should match any of the VISIBILITY enum values.
KeyFrame * addKeyFrame(int layerNumber, int frameIndex)
Attempts to create a new keyframe at the given position and layer.
bool newSelectionOfConnectedFrames(int position)
Make a selection from specified position until a blank spot appears The search is only looking forwar...
bool addNewKeyFrameAt(int position)
Creates a new keyframe at the given position, unless one already exists.
QList< int > selectedKeyFramesPositions() const
Get selected keyframe positions sorted by position.
virtual bool addKeyFrame(int position, KeyFrame *pKeyFrame)
Adds a keyframe at the given position, unless one already exists.
void notifyAnimationLengthChanged()
This should be emitted whenever the animation length frames, eg.
void updateFrame()
Update frame.
void handleDrawingOnEmptyFrame()
Call this when starting to use a paint tool.
void onOnionSkinTypeChanged()
Onion skin type changed, all frames will be affected.
void onLayerChanged()
Layer changed, invalidate relevant cache.
void sanitizeLegacyBackupElementsAfterLayerDeletion(int layerIndex)
Restores integrity of the backup elements after a layer has been deleted.
void deselectAll()
VectorImage::deselectAll.
void paste(VectorImage &)
VectorImage::paste.
bool read(QString filePath)
VectorImage::read.
void selectAll()
VectorImage::selectAll.
qreal getScaleInversed() const
void append(const T &value)
bool isEmpty() const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString tr(const char *sourceText, const char *disambiguation, int n)
bool isEmpty() const const
QPoint topLeft() const const
qreal height() const const
QRect toRect() const const
QPointF topLeft() const const
qreal width() const const
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QString fromUtf8(const char *str, int size)
bool isEmpty() const const