21#include <QImageReader>
23#include <QTemporaryDir>
26#include "vectorimage.h"
27#include "bitmapimage.h"
29#include "layerbitmap.h"
30#include "layervector.h"
31#include "layercamera.h"
32#include "undoredocommand.h"
34#include "colormanager.h"
35#include "filemanager.h"
36#include "toolmanager.h"
37#include "layermanager.h"
38#include "playbackmanager.h"
39#include "viewmanager.h"
40#include "preferencemanager.h"
41#include "soundmanager.h"
42#include "selectionmanager.h"
43#include "overlaymanager.h"
44#include "clipboardmanager.h"
45#include "undoredomanager.h"
47#include "scribblearea.h"
96 mIsAutosave = mPreferenceManager->isOn(SETTING::AUTO_SAVE);
97 mAutosaveNumber = mPreferenceManager->getInt(SETTING::AUTO_SAVE_NUMBER);
102int Editor::currentFrame()
const
109 return mPlaybackManager->fps();
112void Editor::setFps(
int fps)
114 mPreferenceManager->set(SETTING::FPS, fps);
115 emit fpsChanged(fps);
118void Editor::makeConnections()
120 connect(mPreferenceManager, &PreferenceManager::optionChanged,
this, &Editor::settingUpdated);
121 connect(mUndoRedoManager, &UndoRedoManager::didUpdateUndoStack,
this, &Editor::updateAutoSaveCounter);
122 connect(mPreferenceManager, &PreferenceManager::optionChanged, mUndoRedoManager, &UndoRedoManager::onSettingChanged);
126 connect(mLayerManager, &LayerManager::currentLayerWillChange,
this, &Editor::onCurrentLayerWillChange);
129void Editor::settingUpdated(SETTING setting)
133 case SETTING::AUTO_SAVE:
134 mIsAutosave = mPreferenceManager->isOn(SETTING::AUTO_SAVE);
136 case SETTING::AUTO_SAVE_NUMBER:
137 mAutosaveNumber = mPreferenceManager->getInt(SETTING::AUTO_SAVE_NUMBER);
139 case SETTING::ONION_TYPE:
141 emit updateTimeLineCached();
143 case SETTING::FRAME_POOL_SIZE:
144 mObject->setActiveFramePoolSize(mPreferenceManager->getInt(SETTING::FRAME_POOL_SIZE));
146 case SETTING::LAYER_VISIBILITY:
147 mScribbleArea->setLayerVisibility(
static_cast<LayerVisibility
>(mPreferenceManager->getInt(SETTING::LAYER_VISIBILITY)));
148 emit updateTimeLine();
155void Editor::onCurrentLayerWillChange(
int index)
157 Layer* newLayer = layers()->getLayer(index);
158 Layer* currentLayer = layers()->currentLayer();
159 Q_ASSERT(newLayer && currentLayer);
160 if (currentLayer->type() != newLayer->type()) {
162 mScribbleArea->applyTransformedSelection();
164 if (currentLayer->type() == Layer::VECTOR) {
165 auto keyFrame =
static_cast<VectorImage*
>(currentLayer->getLastKeyFrameAtPosition(mFrame));
172 select()->resetSelectionProperties();
176void Editor::updateAutoSaveCounter()
178 if (mIsAutosave ==
false)
182 if (mAutosaveCounter >= mAutosaveNumber)
184 resetAutoSaveCounter();
189void Editor::resetAutoSaveCounter()
191 mAutosaveCounter = 0;
196 Layer* currentLayer = layers()->currentLayer();
198 Q_ASSERT(currentLayer !=
nullptr);
200 if (!canCopy()) {
return; }
204 if (currentLayer->hasAnySelectedFrames() && !select()->somethingSelected()) {
206 }
else if (currentLayer->type() == Layer::BITMAP) {
207 BitmapImage* bitmapImage =
static_cast<BitmapImage*
>(currentLayer->getLastKeyFrameAtPosition(currentFrame()));
208 clipboards()->
copyBitmapImage(bitmapImage, select()->mySelectionRect());
209 }
else if (currentLayer->type() == Layer::VECTOR) {
210 VectorImage* vectorImage =
static_cast<VectorImage*
>(currentLayer->getLastKeyFrameAtPosition(currentFrame()));
215void Editor::copyAndCut()
219 Layer* currentLayer = layers()->currentLayer();
221 if (currentLayer->hasAnySelectedFrames() && !select()->somethingSelected()) {
223 currentLayer->removeKeyFrame(pos);
225 emit layers()->currentLayerChanged(currentLayerIndex());
226 emit updateTimeLine();
230 if (currentLayer->type() == Layer::BITMAP || currentLayer->type() == Layer::VECTOR) {
231 mScribbleArea->deleteSelection();
236void Editor::pasteFromPreviousFrame()
238 Layer* currentLayer = layers()->currentLayer();
239 int prevFrame = currentLayer->getPreviousKeyFramePosition(mFrame);
240 if (!currentLayer->keyExists(mFrame) || prevFrame == mFrame)
245 if (currentLayer->type() == Layer::BITMAP)
247 backup(
tr(
"Paste from Previous Keyframe"));
249 if (select()->somethingSelected())
252 pasteToCanvas(©, mFrame);
256 pasteToCanvas(bitmapImage, mFrame);
259 else if (currentLayer->type() == Layer::VECTOR)
261 backup(
tr(
"Paste from Previous Keyframe"));
263 pasteToCanvas(vectorImage, mFrame);
267void Editor::pasteToCanvas(
BitmapImage* bitmapImage,
int frameNumber)
269 Layer* currentLayer = layers()->currentLayer();
271 Q_ASSERT(currentLayer->type() == Layer::BITMAP);
273 if (select()->somethingSelected())
275 QRectF selection = select()->mySelectionRect();
276 if (bitmapImage->width() <= selection.
width() && bitmapImage->height() <= selection.
height())
278 bitmapImage->moveTopLeft(selection.
topLeft());
282 bitmapImage->transform(selection,
true);
286 BitmapImage *canvasImage =
static_cast<BitmapImage*
>(currentLayer->getLastKeyFrameAtPosition(frameNumber));
289 canvasImage->paste(bitmapImage);
293 select()->setSelection(bitmapImage->bounds());
297void Editor::pasteToCanvas(
VectorImage* vectorImage,
int frameNumber)
299 Layer* currentLayer = layers()->currentLayer();
301 Q_ASSERT(currentLayer->type() == Layer::VECTOR);
305 VectorImage* canvasImage =
static_cast<VectorImage*
>(currentLayer->getLastKeyFrameAtPosition(frameNumber));
306 canvasImage->
paste(*vectorImage);
307 select()->setSelection(vectorImage->getSelectionRect());
311void Editor::pasteToFrames()
313 auto clipboardFrames = clipboards()->getClipboardFrames();
314 Q_ASSERT(!clipboardFrames.empty());
315 Layer* currentLayer = layers()->currentLayer();
317 currentLayer->deselectAll();
319 int newPositionOffset = mFrame - clipboardFrames.cbegin()->first;
320 for (
auto it = clipboardFrames.cbegin(); it != clipboardFrames.cend(); ++it)
322 int newPosition = it->first + newPositionOffset;
324 KeyFrame* keyFrameNewPos = currentLayer->getKeyFrameWhichCovers(newPosition);
326 if (keyFrameNewPos !=
nullptr) {
330 currentLayer->moveSelectedFrames(1);
334 Q_ASSERT(it->second !=
nullptr);
337 KeyFrame* keyClone = it->second->clone();
339 if (currentLayer->type() == Layer::SOUND)
341 auto soundClip =
static_cast<SoundClip*
>(keyClone);
342 sound()->loadSound(soundClip, soundClip->fileName());
345 currentLayer->setFrameSelected(keyClone->pos(),
true);
351 Layer* currentLayer = layers()->currentLayer();
353 Q_ASSERT(currentLayer !=
nullptr);
355 if (!canPaste()) {
return; }
357 if (clipboards()->getClipboardFrames().empty()) {
361 clipboards()->setFromSystemClipboard(mScribbleArea->getCentralPoint(), currentLayer);
363 BitmapImage clipboardImage = clipboards()->getBitmapClipboard();
364 VectorImage clipboardVectorImage = clipboards()->getVectorClipboard();
365 if (currentLayer->type() == Layer::BITMAP && clipboardImage.isLoaded()) {
366 pasteToCanvas(&clipboardImage, mFrame);
367 }
else if (currentLayer->type() == Layer::VECTOR && !clipboardVectorImage.isEmpty()) {
368 pasteToCanvas(&clipboardVectorImage, mFrame);
378void Editor::flipSelection(
bool flipVertical)
381 backup(
tr(
"Flip selection vertically"));
383 backup(
tr(
"Flip selection horizontally"));
385 mScribbleArea->flipSelection(flipVertical);
388void Editor::repositionImage(
QPoint transform,
int frame)
390 if (layers()->currentLayer()->type() == Layer::BITMAP)
394 QRect reposRect = layer->getFrameBounds(frame);
395 select()->setSelection(reposRect);
398 layer->repositionFrame(point, frame);
399 backup(layer->id(), frame,
tr(
"Reposition frame"));
403void Editor::setModified(
int layerNumber,
int frameNumber)
405 Layer* layer = object()->getLayer(layerNumber);
406 if (layer ==
nullptr) {
return; }
408 layer->setModified(frameNumber,
true);
409 undoRedo()->rememberLastModifiedFrame(layerNumber, frameNumber);
414void Editor::clipboardChanged()
416 Layer* layer = layers()->currentLayer();
418 clipboards()->setFromSystemClipboard(mScribbleArea->getCentralPoint(), layer);
420 bool canCopyState = canCopy();
421 bool canPasteState = canPaste();
423 emit canCopyChanged(canCopyState);
424 emit canPasteChanged(canPasteState);
428 mScribbleArea->setLayerVisibility(visibility);
429 emit updateTimeLine();
432LayerVisibility Editor::layerVisibility()
434 return mScribbleArea->getLayerVisibility();
437qreal Editor::viewScaleInversed()
439 return view()->getViewScaleInverse();
442void Editor::increaseLayerVisibilityIndex()
444 mScribbleArea->increaseLayerVisibilityIndex();
445 emit updateTimeLine();
448void Editor::decreaseLayerVisibilityIndex()
450 mScribbleArea->decreaseLayerVisibilityIndex();
451 emit updateTimeLine();
456 mTemporaryDirs.
append(dir);
459void Editor::clearTemporary()
461 while(!mTemporaryDirs.
isEmpty())
469Status Editor::openObject(
const QString& strFilePath,
const std::function<
void(
int)>& progressChanged,
const std::function<
void(
int)>& progressRangeChanged)
472 Q_ASSERT(!strFilePath.
isEmpty());
475 dd <<
QString(
"Raw file path: %1").
arg(strFilePath);
476 dd <<
QString(
"Resolved file path: %1").
arg(fileInfo.absoluteFilePath());
477 if (fileInfo.isDir())
479 return Status(Status::ERROR_FILE_CANNOT_OPEN,
481 tr(
"Could not open file"),
482 tr(
"The file you have selected is a directory, so we are unable to open it. "
483 "If you are are trying to open a project that uses the old structure, "
484 "please open the file ending with .pcl, not the data folder."));
486 if (!fileInfo.exists())
488 return Status(Status::FILE_NOT_FOUND,
490 tr(
"Could not open file"),
491 tr(
"The file you have selected does not exist, so we are unable to open it. "
492 "Please make sure that you've entered the correct path and that the file is accessible and try again."));
494 if (!fileInfo.isReadable())
496 dd <<
QString(
"Permissions: 0x%1").
arg(fileInfo.permissions(), 0, 16);
497 return Status(Status::ERROR_FILE_CANNOT_OPEN,
499 tr(
"Could not open file"),
500 tr(
"This program does not have permission to read the file you have selected. "
501 "Please check that you have read permissions for this file and try again."));
506 connect(&fm, &FileManager::progressChanged, [&progress, &progressChanged](
int p)
508 progressChanged(progress = p);
510 connect(&fm, &FileManager::progressRangeChanged, [&progressRangeChanged](
int max)
512 progressRangeChanged(max + 3);
515 QString fullPath = fileInfo.absoluteFilePath();
517 Object*
object = fm.load(fullPath);
519 Status fmStatus = fm.error();
522 dd.collect(fmStatus.details());
523 fmStatus.setDetails(dd);
527 if (
object ==
nullptr)
529 return Status(Status::ERROR_FILE_CANNOT_OPEN,
531 tr(
"Could not open file"),
532 tr(
"An unknown error occurred while trying to load the file and we are not able to load your file."));
537 progressChanged(progress + 1);
540 setFps(playback()->fps());
549 if (newObject == mObject.get())
554 mObject.reset(newObject);
561 m->load(mObject.get());
568void Editor::updateObject()
570 setCurrentLayerIndex(mObject->data()->getCurrentLayer());
571 scrubTo(mObject->data()->getCurrentFrame());
573 mAutosaveCounter = 0;
574 mAutosaveNeverAskAgain =
false;
576 if (mPreferenceManager)
578 mObject->setActiveFramePoolSize(mPreferenceManager->getInt(SETTING::FRAME_POOL_SIZE));
581 emit updateLayerCount();
588 Q_ASSERT(layers()->currentLayer()->type() == Layer::BITMAP);
589 const auto layer =
static_cast<LayerBitmap*
>(layers()->currentLayer());
591 if (!layer->visible())
593 mScribbleArea->showLayerNotVisibleWarning();
597 Status status = Status::OK;
599 dd <<
QString(
"Raw file path: %1").
arg(filePath);
602 if (!reader.read(&img)) {
603 QString format = reader.format();
606 dd <<
QString(
"QImageReader format: %1").
arg(format);
608 dd <<
QString(
"QImageReader ImageReaderError type: %1").
arg(reader.errorString());
611 switch(reader.error())
613 case QImageReader::ImageReaderError::FileNotFoundError:
614 errorDesc =
tr(
"File not found at path \"%1\". Please check the image is present at the specified location and try again.").
arg(filePath);
617 errorDesc =
tr(
"Image format is not supported. Please convert the image file to one of the following formats and try again:\n%1")
621 errorDesc =
tr(
"An error has occurred while reading the image. Please check that the file is a valid image and try again.");
624 status =
Status(Status::FAIL, dd,
tr(
"Import failed"), errorDesc);
627 const QPoint pos(view()->getImportView().dx() - (img.width() / 2),
628 view()->getImportView().dy() - (img.height() / 2));
630 if (!layer->keyExists(mFrame))
635 BitmapImage* bitmapImage = layer->getBitmapImageAtFrame(mFrame);
637 bitmapImage->paste(&importedBitmapImage);
642 backup(
tr(
"Import Image"));
649 Q_ASSERT(layers()->currentLayer()->type() == Layer::VECTOR);
651 auto layer =
static_cast<LayerVector*
>(layers()->currentLayer());
653 Status status = Status::OK;
655 dd <<
QString(
"Raw file path: %1").
arg(filePath);
657 VectorImage* vectorImage = layer->getVectorImageAtFrame(currentFrame());
658 if (vectorImage ==
nullptr)
661 vectorImage = layer->getVectorImageAtFrame(currentFrame());
665 bool ok = importedVectorImage.
read(filePath);
669 vectorImage->
paste(importedVectorImage);
672 backup(
tr(
"Import Image"));
675 status =
Status(Status::FAIL, dd,
tr(
"Import failed"),
tr(
"You cannot import images into a vector layer."));
683 Layer* layer = layers()->currentLayer();
686 dd <<
QString(
"Raw file path: %1").
arg(filePath);
688 if (view()->getImportFollowsCamera())
692 QTransform transform = camera->getViewAtFrame(currentFrame());
693 view()->setImportView(transform);
695 switch (layer->type())
698 return importBitmapImage(filePath);
701 return importVectorImage(filePath);
704 dd <<
QString(
"Current layer: %1").
arg(layer->type());
705 return Status(Status::ERROR_INVALID_LAYER_TYPE, dd,
tr(
"Import failed"),
tr(
"You can only import images to a bitmap layer."));
709Status Editor::importAnimatedImage(
const QString& filePath,
int frameSpacing,
const std::function<
void(
int)>& progressChanged,
const std::function<
bool()>& wasCanceled)
711 frameSpacing = qMax(1, frameSpacing);
714 dd <<
QString(
"Raw file path: %1").
arg(filePath);
716 Layer* layer = layers()->currentLayer();
717 if (layer->type() != Layer::BITMAP)
719 dd <<
QString(
"Current layer: %1").
arg(layer->type());
720 return Status(Status::ERROR_INVALID_LAYER_TYPE, dd,
tr(
"Import failed"),
tr(
"You can only import images to a bitmap layer."));
726 if (!reader.supportsAnimation()) {
727 return Status(Status::ERROR_INVALID_LAYER_TYPE, dd,
tr(
"Import failed"),
tr(
"The selected image has a format that does not support animation."));
731 const QPoint pos(view()->getImportView().dx() - (img.width() / 2),
732 view()->getImportView().dy() - (img.height() / 2));
733 int totalFrames = reader.imageCount();
734 while (reader.read(&img))
738 dd <<
QString(
"QImageReader ImageReaderError type: %1").
arg(reader.errorString());
741 switch(reader.error())
743 case QImageReader::ImageReaderError::FileNotFoundError:
744 errorDesc =
tr(
"File not found at path \"%1\". Please check the image is present at the specified location and try again.").
arg(filePath);
747 errorDesc =
tr(
"Image format is not supported. Please convert the image file to one of the following formats and try again:\n%1")
748 .
arg((
QString)reader.supportedImageFormats().join(
", "));
751 errorDesc =
tr(
"An error has occurred while reading the image. Please check that the file is a valid image and try again.");
754 return Status(Status::FAIL, dd,
tr(
"Import failed"), errorDesc);
757 if (!bitmapLayer->keyExists(mFrame))
761 BitmapImage* bitmapImage = bitmapLayer->getBitmapImageAtFrame(mFrame);
763 bitmapImage->paste(&importedBitmapImage);
771 scrubTo(mFrame + frameSpacing);
773 backup(
tr(
"Import Image"));
775 progressChanged(qFloor(qMin(
static_cast<double>(reader.currentImageNumber()) / totalFrames, 1.0) * 100));
781void Editor::selectAll()
const
783 Layer* layer = layers()->currentLayer();
786 if (layer->type() == Layer::BITMAP)
791 if (bitmapImage ==
nullptr) {
return; }
793 rect = bitmapImage->bounds();
795 else if (layer->type() == Layer::VECTOR)
798 if (vectorImage !=
nullptr)
801 rect = vectorImage->getSelectionRect();
804 select()->setSelection(rect,
false);
807void Editor::deselectAll()
const
809 select()->resetSelectionProperties();
811 Layer* layer = layers()->currentLayer();
812 if (layer ==
nullptr) {
return; }
814 if (layer->type() == Layer::VECTOR)
817 if (vectorImage !=
nullptr)
823 if (layer->hasAnySelectedFrames()) {
824 layer->deselectAll();
825 emit updateTimeLine();
834void Editor::setCurrentLayerIndex(
int i)
836 mCurrentLayerIndex = i;
838 Layer* layer = mObject->getLayer(i);
839 for (
auto mgr : mAllManagers)
841 mgr->workingLayerChanged(layer);
845void Editor::scrubTo(
int frame)
847 if (frame < 1) { frame = 1; }
855 if (mPlaybackManager && !mPlaybackManager->isPlaying())
857 emit updateTimeLineCached();
859 mObject->updateActiveFrames(frame);
862void Editor::scrubForward()
864 int nextFrame = mFrame + 1;
865 if (!playback()->isPlaying()) {
866 playback()->playScrub(nextFrame);
871void Editor::scrubBackward()
873 if (currentFrame() > 1)
875 int previousFrame = mFrame - 1;
876 if (!playback()->isPlaying()) {
877 playback()->playScrub(previousFrame);
879 scrubTo(previousFrame);
885 return addKeyFrame(layers()->currentLayerIndex(), currentFrame());
890 Layer* layer = mObject->getLayer(layerNumber);
893 if (!layer->visible())
895 mScribbleArea->showLayerNotVisibleWarning();
900 while (layer->keyExists(frameIndex))
902 if (layer->type() == Layer::SOUND
903 && layer->getKeyFrameAt(frameIndex)->fileName().
isEmpty()
904 && layer->removeKeyFrame(frameIndex))
919 return layer->getKeyFrameAt(frameIndex);
922void Editor::removeKey()
924 Layer* layer = layers()->currentLayer();
925 Q_ASSERT(layer !=
nullptr);
927 if (!layer->visible())
929 mScribbleArea->showLayerNotVisibleWarning();
933 if (!layer->keyExistsWhichCovers(currentFrame()))
939 backup(
tr(
"Remove frame"));
942 layer->removeKeyFrame(currentFrame());
944 emit layers()->currentLayerChanged(layers()->currentLayerIndex());
947void Editor::scrubNextKeyFrame()
949 Layer* currentLayer = layers()->currentLayer();
950 Q_ASSERT(currentLayer);
952 int nextPosition = currentLayer->getNextKeyFramePosition(currentFrame());
953 if (currentFrame() >= currentLayer->getMaxKeyFramePosition()) nextPosition = currentFrame() + 1;
954 scrubTo(nextPosition);
957void Editor::scrubPreviousKeyFrame()
959 Layer* layer = mObject->getLayer(layers()->currentLayerIndex());
962 int prevPosition = layer->getPreviousKeyFramePosition(currentFrame());
963 scrubTo(prevPosition);
966void Editor::switchVisibilityOfLayer(
int layerNumber)
968 Layer* layer = mObject->getLayer(layerNumber);
969 if (layer !=
nullptr) layer->switchVisibility();
972 emit updateTimeLine();
975void Editor::swapLayers(
int i,
int j)
977 bool didSwapLayer = mObject->swapLayers(i, j);
978 if (!didSwapLayer) {
return; }
982 layers()->setCurrentLayer(j + 1);
986 layers()->setCurrentLayer(j - 1);
988 emit updateTimeLine();
992bool Editor::canSwapLayers(
int layerIndexLeft,
int layerIndexRight)
const
994 return mObject->canSwapLayers(layerIndexLeft, layerIndexRight);
997void Editor::prepareSave()
999 for (
auto mgr : mAllManagers)
1001 mgr->save(mObject.get());
1005void Editor::clearCurrentFrame()
1007 mScribbleArea->clearImage();
1010bool Editor::canCopy()
const
1012 Layer* layer = layers()->currentLayer();
1013 KeyFrame* keyframe = layer->getLastKeyFrameAtPosition(mFrame);
1015 switch (layer->type())
1019 return canCopyFrames(layer);
1021 return canCopyBitmapImage(
static_cast<BitmapImage*
>(keyframe)) || canCopyFrames(layer);
1023 return canCopyVectorImage(
static_cast<VectorImage*
>(keyframe)) || canCopyFrames(layer);
1029bool Editor::canPaste()
const
1031 Layer* layer = layers()->currentLayer();
1032 auto clipboardMan = clipboards();
1033 auto layerType = layer->type();
1035 return (layerType == clipboardMan->framesLayerType() && !clipboardMan->framesIsEmpty()) ||
1036 (layerType == Layer::BITMAP && clipboardMan->getBitmapClipboard().isLoaded()) ||
1037 (layerType == Layer::VECTOR && !clipboardMan->getVectorClipboard().isEmpty());
1040bool Editor::canCopyFrames(
const Layer* layer)
const
1042 Q_ASSERT(layer !=
nullptr);
1043 return layer->hasAnySelectedFrames();
1046bool Editor::canCopyBitmapImage(
BitmapImage* bitmapImage)
const
1048 return bitmapImage !=
nullptr && bitmapImage->isLoaded() && !bitmapImage->bounds().
isEmpty();
1051bool Editor::canCopyVectorImage(
const VectorImage* vectorImage)
const
1053 return vectorImage !=
nullptr && !vectorImage->isEmpty();
1056void Editor::backup(
const QString &undoText)
1058 undoRedo()->legacyBackup(undoText);
1059 updateAutoSaveCounter();
1062bool Editor::backup(
int layerNumber,
int frameNumber,
const QString &undoText)
1064 bool didBackup = undoRedo()->legacyBackup(layerNumber, frameNumber, undoText);
1066 updateAutoSaveCounter();
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.
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