125 m_d(new
Private(paintDevice, QString()))
131 m_d(new
Private(newPaintDevice, rhs.m_d->filenameSuffix))
135 m_d->frameFilenames = rhs.
m_d->frameFilenames;
136 m_d->onionSkinsEnabled = rhs.
m_d->onionSkinsEnabled;
139 foreach (
const int& frame, rhs.
constKeys().keys()) {
141 if (
m_d->frameIDTimesMap.contains(copySource->frameID())){
146 foreach (
const int& time, rhs.
m_d->frameIDTimesMap.values(transferredKey->frameID())) {
147 keys().insert(time, transferredKey);
148 m_d->frameIDTimesMap.insert(transferredKey->frameID(), time);
161 key = activeKeyframeAt<KisRasterKeyframe>(time);
164 key->writeFrameToDevice(targetDevice);
171 m_d->paintDevice->framesInterface()->uploadFrame(keyframe->frameID(), sourceDevice);
181 return m_d->frameFilenames.value(frameId, QString());
186 m_d->filenameSuffix = suffix;
191 Q_ASSERT(!
m_d->frameFilenames.contains(frameId));
192 m_d->frameFilenames.insert(frameId, filename);
199 if (
m_d->frameFilenames.isEmpty()) {
201 filename = layerFilename +
m_d->filenameSuffix;
203 filename = layerFilename +
m_d->filenameSuffix +
".f" + QString::number(frameId);
213 m_d->frameFilenames.clear();
220 m_d->frameFilenames.clear();
232 return m_d->onionSkinsEnabled;
237 return m_d->paintDevice;
244 m_d->frameIDTimesMap.insert(rasterKey->frameID(), time);
256 m_d->frameIDTimesMap.remove(rasterKey->frameID(), time);
292 QList<int> values =
m_d->frameIDTimesMap.values(rasterKey->frameID());
293 QSet<int> clones = QSet<int>(values.cbegin(), values.cend());
301 if (
m_d->frameIDTimesMap.contains(frameID)) {
303 clones = QSet<int>(values.cbegin(), values.cend());
320 clones += chanClones;
330 if (rasterKey &&
clonesOf(time).count() > 0) {
340 relevantFrames.append(keyframeAt<KisRasterKeyframe>(time));
357 int frame = rasterKeyframe->frameID();
360 if (filename.isEmpty()) {
363 keyframeElement.setAttribute(
"frame", filename);
365 QPoint offset =
m_d->paintDevice->framesInterface()->frameOffset(frame);
371 int time = keyframeNode.attribute(
"time").toInt();
380 if (
m_d->frameFilenames.isEmpty()) {
389 m_d->paintDevice->framesInterface()->setFrameOffset(keyframe->frameID(), offset);
396 const int cloneOf =
m_d->frameIDTimesMap.values(frameId).first();
398 return QPair<int, KisKeyframeSP>(time,
instance);
402 m_d->paintDevice->framesInterface()->setFrameOffset(keyframe->frameID(), offset);
408 return QPair<int, KisKeyframeSP>(time, keyframe);
float value(const T *src, size_t ch)
KisMagneticGraph::vertex_descriptor source(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)
PythonPluginManager * instance
KisKeyframeChannel stores and manages KisKeyframes. Maps units of time to virtual keyframe values....
int previousKeyframeTime(const int time) const
virtual void insertKeyframe(int time, KisKeyframeSP keyframe, KUndo2Command *parentUndoCmd=nullptr)
Insert an existing keyframe into the channel at the specified time.
int firstKeyframeTime() const
KisKeyframeSP keyframeAt(int time) const
Get a keyframe at specified time. Used primarily when the value of a given keyframe is needed.
virtual void loadXML(const QDomElement &channelNode)
virtual QDomElement toXML(QDomDocument doc, const QString &layerFilename)
const TimeKeyframeMap & constKeys() const
void addKeyframe(int time, KUndo2Command *parentUndoCmd=nullptr)
Add a new keyframe to the channel at the specified time.
virtual void removeKeyframeImpl(int time, KUndo2Command *parentUndoCmd)
void sigKeyframeAboutToBeRemoved(const KisKeyframeChannel *channel, int time)
This signal is emitted just BEFORE a keyframe is removed from the channel.
int keyframeCount() const
int activeKeyframeTime(int time) const
Get the time of the active keyframe. Useful for snapping any time to that of the most recent keyframe...
Q_DECL_DEPRECATED void workaroundBrokenFrameTimeBug(int *time)
Between Krita 4.1 and 4.4 Krita had a bug which resulted in creating frames with negative time stamp....
Krita's base keyframe class. Mainly contained by KisKeyframeChannels. A core part of Krita's animatio...
void setColorLabel(int colorIndex)
void writeFrameToDevice(int frameId, KisPaintDeviceSP targetDevice)
int createFrame(bool copy, int copySrc, const QPoint &offset, KUndo2Command *parentCommand)
void uploadFrame(int srcFrameId, int dstFrameId, KisPaintDeviceSP srcDevice)
QRect frameBounds(int frameId)
void deleteFrame(int frame, KUndo2Command *parentCommand)
KisPaintDeviceFramesInterface * framesInterface()
The KisRasterKeyframeChannel is a concrete KisKeyframeChannel subclass that stores and manages KisRas...
void loadXML(const QDomElement &channelNode) override
QScopedPointer< Private > m_d
QSet< int > timesForFrameID(int frameID) const
virtual void insertKeyframe(int time, KisKeyframeSP keyframe, KUndo2Command *parentUndoCmd=nullptr) override
Insert an existing keyframe into the channel at the specified time.
virtual void removeKeyframe(int time, KUndo2Command *parentUndoCmd=nullptr) override
Remove a keyframe from the channel at the specified time.
void setOnionSkinsEnabled(bool value)
void writeToDevice(int time, KisPaintDeviceSP targetDevice)
QPair< int, KisKeyframeSP > loadKeyframe(const QDomElement &keyframeNode) override
QSet< int > clonesOf(int time)
void setFilenameSuffix(const QString &suffix)
KisKeyframeSP createKeyframe() override
Virtual keyframe creation function. Derived classes implement this function based on the needs of the...
QRect frameExtents(KisKeyframeSP keyframe)
void makeUnique(int time, KUndo2Command *parentUndoCmd=nullptr)
QDomElement toXML(QDomDocument doc, const QString &layerFilename) override
bool onionSkinsEnabled() const
void cloneKeyframe(int source, int destination, KUndo2Command *parentUndoCmd=nullptr)
QRect affectedRect(int time) const override
void setFrameFilename(int frameId, const QString &filename)
~KisRasterKeyframeChannel() override
void importFrame(int time, KisPaintDeviceSP sourceDevice, KUndo2Command *parentCommand)
KisRasterKeyframeChannel(const KoID &id, const KisPaintDeviceWSP paintDevice, const KisDefaultBoundsBaseSP bounds)
void saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename) override
QString chooseFrameFilename(int frameId, const QString &layerFilename)
QString frameFilename(int frameId) const
bool areClones(int timeA, int timeB)
KisPaintDeviceWSP paintDevice()
The KisRasterKeyframe class is a concrete subclass of KisKeyframe that wraps a physical raster image ...
KisPaintDeviceWSP m_paintDevice
int m_frameID
m_frameID is a handle that references the "physical" frame stored in this keyframe's KisPaintDevice,...
int frameID() const
Get the frameID of the "physical" raster frame on the associated KisPaintDevice.
KisRasterKeyframe(KisPaintDeviceWSP paintDevice)
KisKeyframeSP duplicate(KisKeyframeChannel *newChannel=0) override
void writeFrameToDevice(KisPaintDeviceSP writeTarget)
Write this frame's raster content to another paint device. Useful for things like onion skinning wher...
~KisRasterKeyframe() override
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
#define KIS_ASSERT_RECOVER_NOOP(cond)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
QSharedPointer< T > toQShared(T *ptr)
void saveValue(QDomElement *parent, const QString &tag, const QSize &size)
bool loadValue(const QDomElement &e, float *v)
QMap< QString, KisKeyframeChannel * > keyframeChannels
QMap< int, QString > frameFilenames
KisPaintDeviceWSP paintDevice
Weak pointer to the KisPaintDevice associated with this channel and a single layer of a KisImage....
QMultiHash< int, int > frameIDTimesMap
Private(KisPaintDeviceWSP paintDevice, const QString filenameSuffix)