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);
354 Layer* currentLayer = layers()->currentLayer();
356 Q_ASSERT(currentLayer !=
nullptr);
358 if (!canPaste()) {
return; }
360 if (clipboards()->framesIsEmpty()) {
364 clipboards()->setFromSystemClipboard(mScribbleArea->getCentralPoint(), currentLayer);
366 BitmapImage clipboardImage = clipboards()->getBitmapClipboard();
367 VectorImage clipboardVectorImage = clipboards()->getVectorClipboard();
368 if (currentLayer->type() == Layer::BITMAP && clipboardImage.isLoaded()) {
369 pasteToCanvas(&clipboardImage, mFrame);
370 }
else if (currentLayer->type() == Layer::VECTOR && !clipboardVectorImage.isEmpty()) {
371 pasteToCanvas(&clipboardVectorImage, mFrame);
381void Editor::flipSelection(
bool flipVertical)
384 backup(
tr(
"Flip selection vertically"));
386 backup(
tr(
"Flip selection horizontally"));
388 mScribbleArea->flipSelection(flipVertical);
391void Editor::repositionImage(
QPoint transform,
int frame)
393 if (layers()->currentLayer()->type() == Layer::BITMAP)
397 QRect reposRect = layer->getFrameBounds(frame);
398 select()->setSelection(reposRect);
401 layer->repositionFrame(point, frame);
402 backup(layer->id(), frame,
tr(
"Reposition frame"));
406void Editor::setModified(
int layerNumber,
int frameNumber)
408 Layer* layer = object()->getLayer(layerNumber);
409 if (layer ==
nullptr) {
return; }
411 layer->setModified(frameNumber,
true);
412 undoRedo()->rememberLastModifiedFrame(layerNumber, frameNumber);
417void Editor::clipboardChanged()
419 Layer* layer = layers()->currentLayer();
421 clipboards()->setFromSystemClipboard(mScribbleArea->getCentralPoint(), layer);
423 bool canCopyState = canCopy();
424 bool canPasteState = canPaste();
426 emit canCopyChanged(canCopyState);
427 emit canPasteChanged(canPasteState);
431 mScribbleArea->setLayerVisibility(visibility);
432 emit updateTimeLine();
435LayerVisibility Editor::layerVisibility()
437 return mScribbleArea->getLayerVisibility();
440qreal Editor::viewScaleInversed()
445void Editor::increaseLayerVisibilityIndex()
447 mScribbleArea->increaseLayerVisibilityIndex();
448 emit updateTimeLine();
451void Editor::decreaseLayerVisibilityIndex()
453 mScribbleArea->decreaseLayerVisibilityIndex();
454 emit updateTimeLine();
459 mTemporaryDirs.
append(dir);
462void Editor::clearTemporary()
464 while(!mTemporaryDirs.
isEmpty())
472Status Editor::openObject(
const QString& strFilePath,
const std::function<
void(
int)>& progressChanged,
const std::function<
void(
int)>& progressRangeChanged)
475 Q_ASSERT(!strFilePath.
isEmpty());
478 dd <<
QString(
"Raw file path: %1").
arg(strFilePath);
479 dd <<
QString(
"Resolved file path: %1").
arg(fileInfo.absoluteFilePath());
480 if (fileInfo.isDir())
482 return Status(Status::ERROR_FILE_CANNOT_OPEN,
484 tr(
"Could not open file"),
485 tr(
"The file you have selected is a directory, so we are unable to open it. "
486 "If you are are trying to open a project that uses the old structure, "
487 "please open the file ending with .pcl, not the data folder."));
489 if (!fileInfo.exists())
491 return Status(Status::FILE_NOT_FOUND,
493 tr(
"Could not open file"),
494 tr(
"The file you have selected does not exist, so we are unable to open it. "
495 "Please make sure that you've entered the correct path and that the file is accessible and try again."));
497 if (!fileInfo.isReadable())
499 dd <<
QString(
"Permissions: 0x%1").
arg(
static_cast<int>(fileInfo.permissions()), 0, 16);
500 return Status(Status::ERROR_FILE_CANNOT_OPEN,
502 tr(
"Could not open file"),
503 tr(
"This program does not have permission to read the file you have selected. "
504 "Please check that you have read permissions for this file and try again."));
509 connect(&fm, &FileManager::progressChanged, [&progress, &progressChanged](
int p)
511 progressChanged(progress = p);
513 connect(&fm, &FileManager::progressRangeChanged, [&progressRangeChanged](
int max)
515 progressRangeChanged(max + 3);
518 QString fullPath = fileInfo.absoluteFilePath();
520 Object*
object = fm.load(fullPath);
522 Status fmStatus = fm.error();
525 dd.collect(fmStatus.details());
526 fmStatus.setDetails(dd);
530 if (
object ==
nullptr)
532 return Status(Status::ERROR_FILE_CANNOT_OPEN,
534 tr(
"Could not open file"),
535 tr(
"An unknown error occurred while trying to load the file and we are not able to load your file."));
540 progressChanged(progress + 1);
543 setFps(playback()->fps());
552 if (newObject == mObject.get())
557 mObject.reset(newObject);
564 m->load(mObject.get());
571void Editor::updateObject()
573 setCurrentLayerIndex(mObject->data()->getCurrentLayer());
574 scrubTo(mObject->data()->getCurrentFrame());
576 mAutosaveCounter = 0;
577 mAutosaveNeverAskAgain =
false;
579 if (mPreferenceManager)
581 mObject->setActiveFramePoolSize(mPreferenceManager->getInt(SETTING::FRAME_POOL_SIZE));
584 emit updateLayerCount();
591 Q_ASSERT(layers()->currentLayer()->type() == Layer::BITMAP);
592 const auto layer =
static_cast<LayerBitmap*
>(layers()->currentLayer());
594 if (!layer->visible())
596 mScribbleArea->showLayerNotVisibleWarning();
600 Status status = Status::OK;
602 dd <<
QString(
"Raw file path: %1").
arg(filePath);
605 if (!reader.read(&img)) {
606 QString format = reader.format();
609 dd <<
QString(
"QImageReader format: %1").
arg(format);
611 dd <<
QString(
"QImageReader ImageReaderError type: %1").
arg(reader.errorString());
614 switch(reader.error())
616 case QImageReader::ImageReaderError::FileNotFoundError:
617 errorDesc =
tr(
"File not found at path \"%1\". Please check the image is present at the specified location and try again.").
arg(filePath);
620 errorDesc =
tr(
"Image format is not supported. Please convert the image file to one of the following formats and try again:\n%1")
624 errorDesc =
tr(
"An error has occurred while reading the image. Please check that the file is a valid image and try again.");
627 status =
Status(Status::FAIL, dd,
tr(
"Import failed"), errorDesc);
633 if (!layer->keyExists(mFrame))
638 BitmapImage* bitmapImage = layer->getBitmapImageAtFrame(mFrame);
640 bitmapImage->paste(&importedBitmapImage);
645 backup(
tr(
"Import Image"));
652 Q_ASSERT(layers()->currentLayer()->type() == Layer::VECTOR);
654 auto layer =
static_cast<LayerVector*
>(layers()->currentLayer());
656 Status status = Status::OK;
658 dd <<
QString(
"Raw file path: %1").
arg(filePath);
660 VectorImage* vectorImage = layer->getVectorImageAtFrame(currentFrame());
661 if (vectorImage ==
nullptr)
664 vectorImage = layer->getVectorImageAtFrame(currentFrame());
668 bool ok = importedVectorImage.
read(filePath);
672 vectorImage->
paste(importedVectorImage);
675 backup(
tr(
"Import Image"));
678 status =
Status(Status::FAIL, dd,
tr(
"Import failed"),
tr(
"You cannot import images into a vector layer."));
686 Layer* layer = layers()->currentLayer();
689 dd <<
QString(
"Raw file path: %1").
arg(filePath);
692 switch (importConfig.positionType)
694 case ImportImageConfig::CenterOfCamera: {
697 transform = layerCam->getViewAtFrame(importConfig.importFrame).
inverted();
700 case ImportImageConfig::CenterOfCameraFollowed: {
703 transform = camera->getViewAtFrame(currentFrame()).
inverted();
706 case ImportImageConfig::CenterOfView: {
707 QPointF centralPoint = mScribbleArea->getCentralPoint();
711 case ImportImageConfig::CenterOfCanvas:
712 case ImportImageConfig::None: {
718 switch (layer->type())
721 return importBitmapImage(filePath, transform);
724 return importVectorImage(filePath);
727 dd <<
QString(
"Current layer: %1").
arg(layer->type());
728 return Status(Status::ERROR_INVALID_LAYER_TYPE, dd,
tr(
"Import failed"),
tr(
"You can only import images to a bitmap layer."));
732Status Editor::importAnimatedImage(
const QString& filePath,
int frameSpacing,
const std::function<
void(
int)>& progressChanged,
const std::function<
bool()>& wasCanceled)
734 frameSpacing = qMax(1, frameSpacing);
737 dd <<
QString(
"Raw file path: %1").
arg(filePath);
739 Layer* layer = layers()->currentLayer();
740 if (layer->type() != Layer::BITMAP)
742 dd <<
QString(
"Current layer: %1").
arg(layer->type());
743 return Status(Status::ERROR_INVALID_LAYER_TYPE, dd,
tr(
"Import failed"),
tr(
"You can only import images to a bitmap layer."));
749 if (!reader.supportsAnimation()) {
750 return Status(Status::ERROR_INVALID_LAYER_TYPE, dd,
tr(
"Import failed"),
tr(
"The selected image has a format that does not support animation."));
754 const QPoint pos(view()->getView().dx() - (img.width() / 2),
755 view()->getView().dy() - (img.height() / 2));
756 int totalFrames = reader.imageCount();
757 while (reader.read(&img))
761 dd <<
QString(
"QImageReader ImageReaderError type: %1").
arg(reader.errorString());
764 switch(reader.error())
766 case QImageReader::ImageReaderError::FileNotFoundError:
767 errorDesc =
tr(
"File not found at path \"%1\". Please check the image is present at the specified location and try again.").
arg(filePath);
770 errorDesc =
tr(
"Image format is not supported. Please convert the image file to one of the following formats and try again:\n%1")
771 .
arg((
QString)reader.supportedImageFormats().join(
", "));
774 errorDesc =
tr(
"An error has occurred while reading the image. Please check that the file is a valid image and try again.");
777 return Status(Status::FAIL, dd,
tr(
"Import failed"), errorDesc);
780 if (!bitmapLayer->keyExists(mFrame))
784 BitmapImage* bitmapImage = bitmapLayer->getBitmapImageAtFrame(mFrame);
786 bitmapImage->paste(&importedBitmapImage);
794 scrubTo(mFrame + frameSpacing);
796 backup(
tr(
"Import Image"));
798 progressChanged(qFloor(qMin(
static_cast<double>(reader.currentImageNumber()) / totalFrames, 1.0) * 100));
804void Editor::selectAll()
const
806 Layer* layer = layers()->currentLayer();
809 if (layer->type() == Layer::BITMAP)
814 if (bitmapImage ==
nullptr) {
return; }
816 rect = bitmapImage->bounds();
818 else if (layer->type() == Layer::VECTOR)
821 if (vectorImage !=
nullptr)
824 rect = vectorImage->getSelectionRect();
827 select()->setSelection(rect,
false);
830void Editor::deselectAll()
const
832 select()->resetSelectionProperties();
834 Layer* layer = layers()->currentLayer();
835 if (layer ==
nullptr) {
return; }
837 if (layer->type() == Layer::VECTOR)
840 if (vectorImage !=
nullptr)
846 if (layer->hasAnySelectedFrames()) {
847 layer->deselectAll();
848 emit updateTimeLine();
857void Editor::setCurrentLayerIndex(
int i)
859 mCurrentLayerIndex = i;
861 Layer* layer = mObject->getLayer(i);
862 for (
auto mgr : mAllManagers)
864 mgr->workingLayerChanged(layer);
868void Editor::scrubTo(
int frame)
870 if (frame < 1) { frame = 1; }
876 if (mPlaybackManager && !mPlaybackManager->isPlaying())
878 emit updateTimeLineCached();
880 mObject->updateActiveFrames(frame);
884void Editor::scrubForward()
886 int nextFrame = mFrame + 1;
887 if (!playback()->isPlaying()) {
888 playback()->playScrub(nextFrame);
893void Editor::scrubBackward()
895 if (currentFrame() > 1)
897 int previousFrame = mFrame - 1;
898 if (!playback()->isPlaying()) {
899 playback()->playScrub(previousFrame);
901 scrubTo(previousFrame);
907 return addKeyFrame(layers()->currentLayerIndex(), currentFrame());
912 Layer* layer = mObject->getLayer(layerNumber);
915 if (!layer->visible())
917 mScribbleArea->showLayerNotVisibleWarning();
922 while (layer->keyExists(frameIndex))
924 if (layer->type() == Layer::SOUND
925 && layer->getKeyFrameAt(frameIndex)->fileName().
isEmpty()
926 && layer->removeKeyFrame(frameIndex))
941 return layer->getKeyFrameAt(frameIndex);
944void Editor::removeKey()
946 Layer* layer = layers()->currentLayer();
947 Q_ASSERT(layer !=
nullptr);
949 if (!layer->visible())
951 mScribbleArea->showLayerNotVisibleWarning();
955 if (!layer->keyExistsWhichCovers(currentFrame()))
961 backup(
tr(
"Remove frame"));
964 layer->removeKeyFrame(currentFrame());
966 emit layers()->currentLayerChanged(layers()->currentLayerIndex());
969void Editor::scrubNextKeyFrame()
971 Layer* currentLayer = layers()->currentLayer();
972 Q_ASSERT(currentLayer);
974 int nextPosition = currentLayer->getNextKeyFramePosition(currentFrame());
975 if (currentFrame() >= currentLayer->getMaxKeyFramePosition()) nextPosition = currentFrame() + 1;
976 scrubTo(nextPosition);
979void Editor::scrubPreviousKeyFrame()
981 Layer* layer = mObject->getLayer(layers()->currentLayerIndex());
984 int prevPosition = layer->getPreviousKeyFramePosition(currentFrame());
985 scrubTo(prevPosition);
988void Editor::switchVisibilityOfLayer(
int layerNumber)
990 Layer* layer = mObject->getLayer(layerNumber);
991 if (layer !=
nullptr) layer->switchVisibility();
994 emit updateTimeLine();
997void Editor::swapLayers(
int i,
int j)
999 bool didSwapLayer = mObject->swapLayers(i, j);
1000 if (!didSwapLayer) {
return; }
1004 layers()->setCurrentLayer(j + 1);
1008 layers()->setCurrentLayer(j - 1);
1010 emit updateTimeLine();
1014bool Editor::canSwapLayers(
int layerIndexLeft,
int layerIndexRight)
const
1016 return mObject->canSwapLayers(layerIndexLeft, layerIndexRight);
1019void Editor::prepareSave()
1021 for (
auto mgr : mAllManagers)
1023 mgr->save(mObject.get());
1027void Editor::clearCurrentFrame()
1029 mScribbleArea->clearImage();
1032bool Editor::canCopy()
const
1034 Layer* layer = layers()->currentLayer();
1035 KeyFrame* keyframe = layer->getLastKeyFrameAtPosition(mFrame);
1037 switch (layer->type())
1041 return canCopyFrames(layer);
1043 return canCopyBitmapImage(
static_cast<BitmapImage*
>(keyframe)) || canCopyFrames(layer);
1045 return canCopyVectorImage(
static_cast<VectorImage*
>(keyframe)) || canCopyFrames(layer);
1051bool Editor::canPaste()
const
1053 Layer* layer = layers()->currentLayer();
1054 auto clipboardMan = clipboards();
1055 auto layerType = layer->type();
1057 return (layerType == clipboardMan->framesLayerType() && !clipboardMan->framesIsEmpty()) ||
1058 (layerType == Layer::BITMAP && clipboardMan->getBitmapClipboard().isLoaded()) ||
1059 (layerType == Layer::VECTOR && !clipboardMan->getVectorClipboard().isEmpty());
1062bool Editor::canCopyFrames(
const Layer* layer)
const
1064 Q_ASSERT(layer !=
nullptr);
1065 return layer->hasAnySelectedFrames();
1068bool Editor::canCopyBitmapImage(
BitmapImage* bitmapImage)
const
1070 return bitmapImage !=
nullptr && bitmapImage->isLoaded() && !bitmapImage->bounds().
isEmpty();
1073bool Editor::canCopyVectorImage(
const VectorImage* vectorImage)
const
1075 return vectorImage !=
nullptr && !vectorImage->isEmpty();
1078void Editor::backup(
const QString &undoText)
1080 undoRedo()->legacyBackup(undoText);
1081 updateAutoSaveCounter();
1084bool Editor::backup(
int layerNumber,
int frameNumber,
const QString &undoText)
1086 bool didBackup = undoRedo()->legacyBackup(layerNumber, frameNumber, undoText);
1088 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