18#include "legacybackupelement.h"
22#include "layerbitmap.h"
23#include "layervector.h"
25#include "selectionmanager.h"
26#include "layermanager.h"
27#include "undoredomanager.h"
29void BackupLegacyBitmapElement::restore(
Editor* editor)
31 Layer* layer = editor->object()->findLayerById(this->layerId);
33 if (editor->currentFrame() != this->frame) {
34 editor->scrubTo(this->frame);
37 editor->layers()->setCurrentLayer(layer);
39 if (this->frame > 0 && layer->getKeyFrameAt(this->frame) ==
nullptr)
41 editor->undoRedo()->restoreLegacyKey();
47 if (layer->type() == Layer::BITMAP)
49 auto bitmapLayer =
static_cast<LayerBitmap*
>(layer);
50 *bitmapLayer->getLastBitmapImageAtFrame(this->frame, 0) = bitmapImage;
55 auto selectMan = editor->select();
56 selectMan->setSelection(mySelection,
true);
57 selectMan->setTransformAnchor(selectionAnchor);
58 selectMan->setRotation(rotationAngle);
59 selectMan->setScale(scaleX, scaleY);
60 selectMan->setTranslation(translation);
62 selectMan->calculateSelectionTransformation();
67void BackupLegacyVectorElement::restore(
Editor* editor)
69 Layer* layer = editor->object()->findLayerById(this->layerId);
70 for (
int i = 0; i < editor->object()->getLayerCount(); i++)
72 Layer* layer = editor->object()->getLayer(i);
73 if (layer->type() == Layer::VECTOR)
76 if (vectorImage !=
nullptr)
78 vectorImage->modification();
83 if (editor->currentFrame() != this->frame) {
84 editor->scrubTo(this->frame);
87 editor->layers()->setCurrentLayer(layer);
89 if (this->frame > 0 && layer->getKeyFrameAt(this->frame) ==
nullptr)
91 editor->undoRedo()->restoreLegacyKey();
97 if (layer->type() == Layer::VECTOR)
99 auto pVectorImage =
static_cast<LayerVector*
>(layer);
100 *pVectorImage->getLastVectorImageAtFrame(this->frame, 0) = this->vectorImage;
105 auto selectMan = editor->select();
106 selectMan->setSelection(mySelection,
false);
107 selectMan->setTransformAnchor(selectionAnchor);
108 selectMan->setRotation(rotationAngle);
109 selectMan->setScale(scaleX, scaleY);
110 selectMan->setTranslation(translation);
111 selectMan->calculateSelectionTransformation();
117void BackupLegacySoundElement::restore(
Editor* editor)
119 Layer* layer = editor->object()->findLayerById(this->layerId);
121 editor->layers()->setCurrentLayer(layer);
123 if (editor->currentFrame() != this->frame) {
124 editor->scrubTo(this->frame);
129 if (this->frame > 0 && layer->getKeyFrameAt(this->frame) ==
nullptr)
131 editor->undoRedo()->restoreLegacyKey();
void frameModified(int frameNumber)
This should be emitted after modifying the frame content.