Krita Source Code Documentation
Loading...
Searching...
No Matches
KisRasterKeyframeChannel Class Reference

The KisRasterKeyframeChannel is a concrete KisKeyframeChannel subclass that stores and manages KisRasterKeyframes. More...

#include <kis_raster_keyframe_channel.h>

+ Inheritance diagram for KisRasterKeyframeChannel:

Classes

struct  Private
 

Public Member Functions

bool areClones (int timeA, int timeB)
 
void cloneKeyframe (int source, int destination, KUndo2Command *parentUndoCmd=nullptr)
 
QSet< int > clonesOf (int time)
 
QRect frameExtents (KisKeyframeSP keyframe)
 
QString frameFilename (int frameId) const
 
void importFrame (int time, KisPaintDeviceSP sourceDevice, KUndo2Command *parentCommand)
 
virtual void insertKeyframe (int time, KisKeyframeSP keyframe, KUndo2Command *parentUndoCmd=nullptr) override
 Insert an existing keyframe into the channel at the specified time.
 
 KisRasterKeyframeChannel (const KisRasterKeyframeChannel &rhs, const KisPaintDeviceWSP newPaintDevice)
 
 KisRasterKeyframeChannel (const KoID &id, const KisPaintDeviceWSP paintDevice, const KisDefaultBoundsBaseSP bounds)
 
void loadXML (const QDomElement &channelNode) override
 
void makeUnique (int time, KUndo2Command *parentUndoCmd=nullptr)
 
bool onionSkinsEnabled () const
 
KisPaintDeviceWSP paintDevice ()
 
virtual void removeKeyframe (int time, KUndo2Command *parentUndoCmd=nullptr) override
 Remove a keyframe from the channel at the specified time.
 
void setFilenameSuffix (const QString &suffix)
 
void setOnionSkinsEnabled (bool value)
 
QSet< int > timesForFrameID (int frameID) const
 
QDomElement toXML (QDomDocument doc, const QString &layerFilename) override
 
void writeToDevice (int time, KisPaintDeviceSP targetDevice)
 
 ~KisRasterKeyframeChannel () override
 
- Public Member Functions inherited from KisKeyframeChannel
KisKeyframeSP activeKeyframeAt (int time) const
 
template<class KeyframeType >
QSharedPointer< KeyframeType > activeKeyframeAt (int time) const
 
int activeKeyframeTime () 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.
 
void addKeyframe (int time, KUndo2Command *parentUndoCmd=nullptr)
 Add a new keyframe to the channel at the specified time.
 
virtual KisTimeSpan affectedFrames (int time) const
 Get the set of frames affected by any changes to the value or content of the active keyframe at the given time.
 
QSet< int > allKeyframeTimes () const
 Get a set of all integer times that map to a keyframe.
 
int channelHash () const
 Calculates a pseudo-unique hash based on the relevant internal state of the channel.
 
void copyKeyframe (int sourceTime, int targetTime, KUndo2Command *parentUndoCmd=nullptr)
 
int firstKeyframeTime () const
 
QString id () const
 
virtual KisTimeSpan identicalFrames (int time) const
 Get a span of times for which the channel gives identical results compared to frame at a given time. NOTE: This set may be different than the set of affected frames due to interpolation.
 
KisKeyframeSP keyframeAt (int time) const
 Get a keyframe at specified time. Used primarily when the value of a given keyframe is needed.
 
template<class KeyframeType >
QSharedPointer< KeyframeType > keyframeAt (int time) const
 
int keyframeCount () const
 
 KisKeyframeChannel (const KisKeyframeChannel &rhs)
 
 KisKeyframeChannel (const KoID &id, KisDefaultBoundsBaseSP bounds)
 
int lastKeyframeTime () const
 
int lookupKeyframeTime (KisKeyframeSP toLookup)
 Search for the time for a given keyframe. (Reverse map lookup, so use sparingly.)
 
void moveKeyframe (int sourceTime, int targetTime, KUndo2Command *parentUndoCmd=nullptr)
 
QString name () const
 
int nextKeyframeTime (const int time) const
 
KisNodeWSP node () const
 
int previousKeyframeTime (const int time) const
 
void setDefaultBounds (KisDefaultBoundsBaseSP bounds)
 
void setNode (KisNodeWSP node)
 
void swapKeyframes (int timeA, int timeB, KUndo2Command *parentUndoCmd=nullptr)
 
 ~KisKeyframeChannel () override
 

Static Public Member Functions

static QSet< int > clonesOf (const KisNode *node, int time)
 
- Static Public Member Functions inherited from KisKeyframeChannel
static KoID channelIdToKoId (const QString &id)
 
static void copyKeyframe (const KisKeyframeChannel *sourceChannel, int sourceTime, KisKeyframeChannel *targetChannel, int targetTime, KUndo2Command *parentUndoCmd=nullptr)
 Copy a keyframe across channel(s) at the specified times.
 
static void moveKeyframe (KisKeyframeChannel *sourceChannel, int sourceTime, KisKeyframeChannel *targetChannel, int targetTime, KUndo2Command *parentUndoCmd=nullptr)
 Move a keyframe across channel(s) at the specified times.
 
static void swapKeyframes (KisKeyframeChannel *channelA, int timeA, KisKeyframeChannel *channelB, int timeB, KUndo2Command *parentUndoCmd=nullptr)
 Swap two keyframes across channel(s) at the specified times.
 

Private Member Functions

QRect affectedRect (int time) const override
 
QString chooseFrameFilename (int frameId, const QString &layerFilename)
 
KisKeyframeSP createKeyframe () override
 Virtual keyframe creation function. Derived classes implement this function based on the needs of their specific KisKeyframe subclasses.
 
QPair< int, KisKeyframeSPloadKeyframe (const QDomElement &keyframeNode) override
 
void saveKeyframe (KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename) override
 
void setFrameFilename (int frameId, const QString &filename)
 

Private Attributes

QScopedPointer< Privatem_d
 

Additional Inherited Members

- Signals inherited from KisKeyframeChannel
void sigAddedKeyframe (const KisKeyframeChannel *channel, int time)
 This signal is emitted just AFTER a keyframe was added to the channel.
 
void sigAnyKeyframeChange ()
 
void sigKeyframeAboutToBeRemoved (const KisKeyframeChannel *channel, int time)
 This signal is emitted just BEFORE a keyframe is removed from the channel.
 
void sigKeyframeChanged (const KisKeyframeChannel *channel, int time)
 This signal is emitted just AFTER a non-raster keyframe was changed its value.
 
void sigKeyframeHasBeenRemoved (const KisKeyframeChannel *channel, int time)
 This signal is emitted just AFTER a keyframe is removed from the channel.
 
- Static Public Attributes inherited from KisKeyframeChannel
static const KoID Opacity = KoID("opacity", ki18n("Opacity"))
 
static const KoID PositionX = KoID("transform_pos_x", ki18n("Position (X)"))
 
static const KoID PositionY = KoID("transform_pos_y", ki18n("Position (Y)"))
 
static const KoID Raster = KoID("content", ki18n("Content"))
 
static const KoID RotationX = KoID("transform_rotation_x", ki18n("Rotation (X)"))
 
static const KoID RotationY = KoID("transform_rotation_y", ki18n("Rotation (Y)"))
 
static const KoID RotationZ = KoID("transform_rotation_z", ki18n("Rotation (Z)"))
 
static const KoID ScaleX = KoID("transform_scale_x", ki18n("Scale (X)"))
 
static const KoID ScaleY = KoID("transform_scale_y", ki18n("Scale (Y)"))
 
static const KoID ShearX = KoID("transform_shear_x", ki18n("Shear (X)"))
 
static const KoID ShearY = KoID("transform_shear_y", ki18n("Shear (Y)"))
 
static const KoID TransformArguments
 
- Protected Types inherited from KisKeyframeChannel
typedef QMap< int, KisKeyframeSPTimeKeyframeMap
 
- Protected Member Functions inherited from KisKeyframeChannel
const TimeKeyframeMapconstKeys () const
 
int currentTime () const
 
TimeKeyframeMapkeys ()
 
virtual void removeKeyframeImpl (int time, KUndo2Command *parentUndoCmd)
 
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. The bug has been fixed, but there might be some files still in the wild.
 

Detailed Description

The KisRasterKeyframeChannel is a concrete KisKeyframeChannel subclass that stores and manages KisRasterKeyframes.

Like a traditional animation dopesheet, this class maps individual units of times (in frames) to "virtual" KisRasterKeyframes, which wrap and manage the "physical" raster images on this channel's associated KisPaintDevice.

Often, a raster channel will be represented by an individual track with Krita's KisAnimationTimelineDocker.

Definition at line 66 of file kis_raster_keyframe_channel.h.

Constructor & Destructor Documentation

◆ KisRasterKeyframeChannel() [1/2]

KisRasterKeyframeChannel::KisRasterKeyframeChannel ( const KoID & id,
const KisPaintDeviceWSP paintDevice,
const KisDefaultBoundsBaseSP bounds )

Definition at line 123 of file kis_raster_keyframe_channel.cpp.

125 m_d(new Private(paintDevice, QString()))
126{
127}
KisKeyframeChannel(const KoID &id, KisDefaultBoundsBaseSP bounds)
#define bounds(x, a, b)

◆ KisRasterKeyframeChannel() [2/2]

KisRasterKeyframeChannel::KisRasterKeyframeChannel ( const KisRasterKeyframeChannel & rhs,
const KisPaintDeviceWSP newPaintDevice )

Definition at line 129 of file kis_raster_keyframe_channel.cpp.

130 : KisKeyframeChannel(rhs),
131 m_d(new Private(newPaintDevice, rhs.m_d->filenameSuffix))
132{
133 KIS_ASSERT_RECOVER_NOOP(&rhs != this);
134
135 m_d->frameFilenames = rhs.m_d->frameFilenames;
136 m_d->onionSkinsEnabled = rhs.m_d->onionSkinsEnabled;
137
138 // Copy keyframes with attention to clones..
139 foreach (const int& frame, rhs.constKeys().keys()) {
140 KisRasterKeyframeSP copySource = rhs.keyframeAt<KisRasterKeyframe>(frame);
141 if (m_d->frameIDTimesMap.contains(copySource->frameID())){
142 continue;
143 }
144
145 KisRasterKeyframeSP transferredKey = toQShared(new KisRasterKeyframe(newPaintDevice, copySource->frameID(), copySource->colorLabel()));
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);
149 }
150 }
151}
TimeKeyframeMap & keys()
KisKeyframeSP keyframeAt(int time) const
Get a keyframe at specified time. Used primarily when the value of a given keyframe is needed.
const TimeKeyframeMap & constKeys() const
The KisRasterKeyframe class is a concrete subclass of KisKeyframe that wraps a physical raster image ...
#define KIS_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:97
QSharedPointer< T > toQShared(T *ptr)

References KisKeyframeChannel::constKeys(), KisKeyframeChannel::keyframeAt(), KisKeyframeChannel::keys(), KIS_ASSERT_RECOVER_NOOP, m_d, and toQShared().

◆ ~KisRasterKeyframeChannel()

KisRasterKeyframeChannel::~KisRasterKeyframeChannel ( )
override

Definition at line 153 of file kis_raster_keyframe_channel.cpp.

154{
155}

Member Function Documentation

◆ affectedRect()

QRect KisRasterKeyframeChannel::affectedRect ( int time) const
overrideprivatevirtual

The rect that is affected by a frame at the given time

Implements KisKeyframeChannel.

Definition at line 335 of file kis_raster_keyframe_channel.cpp.

336{
337 QRect affectedRect;
338
339 QList<KisRasterKeyframeSP> relevantFrames;
340 relevantFrames.append(keyframeAt<KisRasterKeyframe>(time));
341 relevantFrames.append(keyframeAt<KisRasterKeyframe>(previousKeyframeTime(time)));
342
343 Q_FOREACH (KisRasterKeyframeSP frame, relevantFrames) {
344 if (frame) {
345 affectedRect |= frame->contentBounds();
346 }
347 }
348
349 return affectedRect;
350}
int previousKeyframeTime(const int time) const
QRect affectedRect(int time) const override

References affectedRect(), and KisKeyframeChannel::previousKeyframeTime().

◆ areClones()

bool KisRasterKeyframeChannel::areClones ( int timeA,
int timeB )

Definition at line 273 of file kis_raster_keyframe_channel.cpp.

274{
275 /* Edgecase
276 * If both times are empty, we shouldn't really consider the two "clones".. */
277 if (keyframeAt(timeA) == nullptr && keyframeAt(timeB) == nullptr) {
278 return false;
279 }
280
281 return (keyframeAt(timeA) == keyframeAt(timeB));
282}

References KisKeyframeChannel::keyframeAt().

◆ chooseFrameFilename()

QString KisRasterKeyframeChannel::chooseFrameFilename ( int frameId,
const QString & layerFilename )
private

Definition at line 195 of file kis_raster_keyframe_channel.cpp.

196{
197 QString filename;
198
199 if (m_d->frameFilenames.isEmpty()) {
200 // Use legacy naming convention for first keyframe
201 filename = layerFilename + m_d->filenameSuffix;
202 } else {
203 filename = layerFilename + m_d->filenameSuffix + ".f" + QString::number(frameId);
204 }
205
206 setFrameFilename(frameId, filename);
207
208 return filename;
209}
void setFrameFilename(int frameId, const QString &filename)

References m_d, and setFrameFilename().

◆ cloneKeyframe()

void KisRasterKeyframeChannel::cloneKeyframe ( int source,
int destination,
KUndo2Command * parentUndoCmd = nullptr )

Definition at line 266 of file kis_raster_keyframe_channel.cpp.

267{
268 if (!keyframeAt(source)) return;
269
270 insertKeyframe(destination, keyframeAt<KisRasterKeyframe>(source), parentUndoCmd);
271}
KisMagneticGraph::vertex_descriptor source(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)
virtual void insertKeyframe(int time, KisKeyframeSP keyframe, KUndo2Command *parentUndoCmd=nullptr) override
Insert an existing keyframe into the channel at the specified time.

References insertKeyframe(), KisKeyframeChannel::keyframeAt(), and source().

◆ clonesOf() [1/2]

QSet< int > KisRasterKeyframeChannel::clonesOf ( const KisNode * node,
int time )
static

Definition at line 308 of file kis_raster_keyframe_channel.cpp.

309{
310 QSet<int> clones;
311
312 QMap<QString, KisKeyframeChannel*> chans = node->keyframeChannels();
313 foreach (KisKeyframeChannel* channel, chans.values()){
314 KisRasterKeyframeChannel* rasterChan = dynamic_cast<KisRasterKeyframeChannel*>(channel);
315 if (!rasterChan) {
316 continue;
317 }
318
319 QSet<int> chanClones = rasterChan->clonesOf(rasterChan->activeKeyframeTime(time));
320 clones += chanClones;
321 }
322
323 return clones;
324}
KisKeyframeChannel stores and manages KisKeyframes. Maps units of time to virtual keyframe values....
int activeKeyframeTime(int time) const
Get the time of the active keyframe. Useful for snapping any time to that of the most recent keyframe...
The KisRasterKeyframeChannel is a concrete KisKeyframeChannel subclass that stores and manages KisRas...
QMap< QString, KisKeyframeChannel * > keyframeChannels

References KisKeyframeChannel::activeKeyframeTime(), clonesOf(), KisBaseNode::keyframeChannels, and KisKeyframeChannel::node().

◆ clonesOf() [2/2]

QSet< int > KisRasterKeyframeChannel::clonesOf ( int time)

Definition at line 284 of file kis_raster_keyframe_channel.cpp.

285{
286 KisRasterKeyframeSP rasterKey = keyframeAt<KisRasterKeyframe>(time);
287
288 if (!rasterKey) {
289 return QSet<int>();
290 }
291
292 QList<int> values = m_d->frameIDTimesMap.values(rasterKey->frameID());
293 QSet<int> clones = QSet<int>(values.cbegin(), values.cend());
294 clones.remove(time); // Clones only! Remove input time from the list.
295 return clones;
296}

References m_d.

◆ createKeyframe()

KisKeyframeSP KisRasterKeyframeChannel::createKeyframe ( )
overrideprivatevirtual

Virtual keyframe creation function. Derived classes implement this function based on the needs of their specific KisKeyframe subclasses.

Implements KisKeyframeChannel.

Definition at line 411 of file kis_raster_keyframe_channel.cpp.

412{
413 return toQShared(new KisRasterKeyframe(m_d->paintDevice));
414}

References m_d, and toQShared().

◆ frameExtents()

QRect KisRasterKeyframeChannel::frameExtents ( KisKeyframeSP keyframe)

Get the rectangular area that the content of this frame occupies.

Definition at line 174 of file kis_raster_keyframe_channel.cpp.

175{
176 return m_d->paintDevice->framesInterface()->frameBounds(keyframe.dynamicCast<KisRasterKeyframe>()->frameID());
177}
int frameID() const
Get the frameID of the "physical" raster frame on the associated KisPaintDevice.

References KisRasterKeyframe::frameID(), and m_d.

◆ frameFilename()

QString KisRasterKeyframeChannel::frameFilename ( int frameId) const

Definition at line 179 of file kis_raster_keyframe_channel.cpp.

180{
181 return m_d->frameFilenames.value(frameId, QString());
182}

References m_d.

◆ importFrame()

void KisRasterKeyframeChannel::importFrame ( int time,
KisPaintDeviceSP sourceDevice,
KUndo2Command * parentCommand )

Copy the content of the sourceDevice into a new keyframe at given time.

Parameters
timePosition of new keyframe.
sourceDeviceSource for content.
parentCommandParent undo command used for stacking.

Definition at line 167 of file kis_raster_keyframe_channel.cpp.

168{
169 addKeyframe(time, parentCommand);
170 KisRasterKeyframeSP keyframe = keyframeAt<KisRasterKeyframe>(time);
171 m_d->paintDevice->framesInterface()->uploadFrame(keyframe->frameID(), sourceDevice);
172}
void addKeyframe(int time, KUndo2Command *parentUndoCmd=nullptr)
Add a new keyframe to the channel at the specified time.

References KisKeyframeChannel::addKeyframe(), and m_d.

◆ insertKeyframe()

void KisRasterKeyframeChannel::insertKeyframe ( int time,
KisKeyframeSP keyframe,
KUndo2Command * parentUndoCmd = nullptr )
overridevirtual

Insert an existing keyframe into the channel at the specified time.

Reimplemented from KisKeyframeChannel.

Definition at line 240 of file kis_raster_keyframe_channel.cpp.

241{
242 KisRasterKeyframeSP rasterKey = keyframe.dynamicCast<KisRasterKeyframe>();
243 if (rasterKey) {
244 m_d->frameIDTimesMap.insert(rasterKey->frameID(), time);
245 }
246
247 KisKeyframeChannel::insertKeyframe(time, keyframe, parentUndoCmd);
248}
virtual void insertKeyframe(int time, KisKeyframeSP keyframe, KUndo2Command *parentUndoCmd=nullptr)
Insert an existing keyframe into the channel at the specified time.

References KisKeyframeChannel::insertKeyframe(), and m_d.

◆ loadKeyframe()

QPair< int, KisKeyframeSP > KisRasterKeyframeChannel::loadKeyframe ( const QDomElement & keyframeNode)
overrideprivatevirtual

Implements KisKeyframeChannel.

Definition at line 369 of file kis_raster_keyframe_channel.cpp.

370{
371 int time = keyframeNode.attribute("time").toInt();
373
374 KisRasterKeyframeSP keyframe;
375
376 QPoint offset;
377 KisDomUtils::loadValue(keyframeNode, "offset", &offset);
378 QString frameFilename = keyframeNode.attribute("frame");
379
380 if (m_d->frameFilenames.isEmpty()) {
381
382 // First keyframe loaded: use the existing frame
384 int firstKeyframeTime = constKeys().begin().key();
385 keyframe = keyframeAt<KisRasterKeyframe>(firstKeyframeTime);
386
387 // Remove from keys. It will get reinserted with new time once we return
389 m_d->paintDevice->framesInterface()->setFrameOffset(keyframe->frameID(), offset);
390 } else {
391
392 // If the filename already exists, it's **probably** a clone we can reinstance.
393 if (m_d->frameFilenames.values().contains(frameFilename)) {
394
395 const int frameId = m_d->frameFilenames.key(frameFilename);
396 const int cloneOf = m_d->frameIDTimesMap.values(frameId).first();
397 const KisRasterKeyframeSP instance = keyframeAt<KisRasterKeyframe>(cloneOf);
398 return QPair<int, KisKeyframeSP>(time, instance);
399 } else {
400
401 keyframe = toQShared(new KisRasterKeyframe(m_d->paintDevice));
402 m_d->paintDevice->framesInterface()->setFrameOffset(keyframe->frameID(), offset);
403 }
404 }
405
406 setFrameFilename(keyframe->frameID(), frameFilename);
407
408 return QPair<int, KisKeyframeSP>(time, keyframe);
409}
PythonPluginManager * instance
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....
virtual void removeKeyframe(int time, KUndo2Command *parentUndoCmd=nullptr) override
Remove a keyframe from the channel at the specified time.
QString frameFilename(int frameId) const
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130
bool loadValue(const QDomElement &e, float *v)

References KisKeyframeChannel::constKeys(), KisKeyframeChannel::firstKeyframeTime(), frameFilename(), instance, KisKeyframeChannel::keyframeCount(), KIS_SAFE_ASSERT_RECOVER_NOOP, KisDomUtils::loadValue(), m_d, removeKeyframe(), setFrameFilename(), toQShared(), and KisKeyframeChannel::workaroundBrokenFrameTimeBug().

◆ loadXML()

void KisRasterKeyframeChannel::loadXML ( const QDomElement & channelNode)
overridevirtual

Reimplemented from KisKeyframeChannel.

Definition at line 218 of file kis_raster_keyframe_channel.cpp.

219{
220 m_d->frameFilenames.clear();
221
222 KisKeyframeChannel::loadXML(channelNode);
223}
virtual void loadXML(const QDomElement &channelNode)

References KisKeyframeChannel::loadXML(), and m_d.

◆ makeUnique()

void KisRasterKeyframeChannel::makeUnique ( int time,
KUndo2Command * parentUndoCmd = nullptr )

Definition at line 326 of file kis_raster_keyframe_channel.cpp.

327{
328 KisRasterKeyframeSP rasterKey = keyframeAt<KisRasterKeyframe>(time);
329
330 if (rasterKey && clonesOf(time).count() > 0) {
331 insertKeyframe(time, rasterKey->duplicate(), parentUndoCmd);
332 }
333}

References clonesOf(), and insertKeyframe().

◆ onionSkinsEnabled()

bool KisRasterKeyframeChannel::onionSkinsEnabled ( ) const

Definition at line 230 of file kis_raster_keyframe_channel.cpp.

231{
232 return m_d->onionSkinsEnabled;
233}

References m_d.

◆ paintDevice()

KisPaintDeviceWSP KisRasterKeyframeChannel::paintDevice ( )

Definition at line 235 of file kis_raster_keyframe_channel.cpp.

236{
237 return m_d->paintDevice;
238}

References m_d.

◆ removeKeyframe()

void KisRasterKeyframeChannel::removeKeyframe ( int time,
KUndo2Command * parentUndoCmd = nullptr )
overridevirtual

Remove a keyframe from the channel at the specified time.

Reimplemented from KisKeyframeChannel.

Definition at line 250 of file kis_raster_keyframe_channel.cpp.

251{
252 Q_EMIT sigKeyframeAboutToBeRemoved(this, time);
253
254 KisRasterKeyframeSP rasterKey = keyframeAt<KisRasterKeyframe>(time);
255 if (rasterKey) {
256 m_d->frameIDTimesMap.remove(rasterKey->frameID(), time);
257 }
258
259 KisKeyframeChannel::removeKeyframeImpl(time, parentUndoCmd);
260
261 if (time == 0) { // There should always be a raster frame on frame 0.
262 addKeyframe(time, parentUndoCmd);
263 }
264}
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.

References KisKeyframeChannel::addKeyframe(), m_d, KisKeyframeChannel::removeKeyframeImpl(), and KisKeyframeChannel::sigKeyframeAboutToBeRemoved().

◆ saveKeyframe()

void KisRasterKeyframeChannel::saveKeyframe ( KisKeyframeSP keyframe,
QDomElement keyframeElement,
const QString & layerFilename )
overrideprivatevirtual

Implements KisKeyframeChannel.

Definition at line 352 of file kis_raster_keyframe_channel.cpp.

353{
354 KisRasterKeyframeSP rasterKeyframe = keyframe.dynamicCast<KisRasterKeyframe>();
355 KIS_SAFE_ASSERT_RECOVER_RETURN(rasterKeyframe);
356
357 int frame = rasterKeyframe->frameID();
358
359 QString filename = frameFilename(frame);
360 if (filename.isEmpty()) {
361 filename = chooseFrameFilename(frame, layerFilename);
362 }
363 keyframeElement.setAttribute("frame", filename);
364
365 QPoint offset = m_d->paintDevice->framesInterface()->frameOffset(frame);
366 KisDomUtils::saveValue(&keyframeElement, "offset", offset);
367}
QString chooseFrameFilename(int frameId, const QString &layerFilename)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
void saveValue(QDomElement *parent, const QString &tag, const QSize &size)

References chooseFrameFilename(), frameFilename(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_d, and KisDomUtils::saveValue().

◆ setFilenameSuffix()

void KisRasterKeyframeChannel::setFilenameSuffix ( const QString & suffix)

When choosing filenames for frames, this will be appended to the node filename.

Definition at line 184 of file kis_raster_keyframe_channel.cpp.

185{
186 m_d->filenameSuffix = suffix;
187}

References m_d.

◆ setFrameFilename()

void KisRasterKeyframeChannel::setFrameFilename ( int frameId,
const QString & filename )
private

Definition at line 189 of file kis_raster_keyframe_channel.cpp.

190{
191 Q_ASSERT(!m_d->frameFilenames.contains(frameId));
192 m_d->frameFilenames.insert(frameId, filename);
193}

References m_d.

◆ setOnionSkinsEnabled()

void KisRasterKeyframeChannel::setOnionSkinsEnabled ( bool value)

Definition at line 225 of file kis_raster_keyframe_channel.cpp.

226{
227 m_d->onionSkinsEnabled = value;
228}
float value(const T *src, size_t ch)

References m_d, and value().

◆ timesForFrameID()

QSet< int > KisRasterKeyframeChannel::timesForFrameID ( int frameID) const

Definition at line 298 of file kis_raster_keyframe_channel.cpp.

299{
300 QSet<int> clones;
301 if (m_d->frameIDTimesMap.contains(frameID)) {
302 QList<int> values = m_d->frameIDTimesMap.values(frameID);
303 clones = QSet<int>(values.cbegin(), values.cend());
304 }
305 return clones;
306}

References m_d.

◆ toXML()

QDomElement KisRasterKeyframeChannel::toXML ( QDomDocument doc,
const QString & layerFilename )
overridevirtual

Reimplemented from KisKeyframeChannel.

Definition at line 211 of file kis_raster_keyframe_channel.cpp.

212{
213 m_d->frameFilenames.clear();
214
215 return KisKeyframeChannel::toXML(doc, layerFilename);
216}
virtual QDomElement toXML(QDomDocument doc, const QString &layerFilename)

References m_d, and KisKeyframeChannel::toXML().

◆ writeToDevice()

void KisRasterKeyframeChannel::writeToDevice ( int time,
KisPaintDeviceSP targetDevice )

Copy the active frame at given time to target device.

Parameters
keyframeKeyframe to copy from.
targetDeviceDevice to copy the frame to.

Definition at line 157 of file kis_raster_keyframe_channel.cpp.

158{
159 KisRasterKeyframeSP key = keyframeAt<KisRasterKeyframe>(time);
160 if (!key) {
161 key = activeKeyframeAt<KisRasterKeyframe>(time);
162 }
163
164 key->writeFrameToDevice(targetDevice);
165}

Member Data Documentation

◆ m_d

QScopedPointer<Private> KisRasterKeyframeChannel::m_d
private

Definition at line 126 of file kis_raster_keyframe_channel.h.


The documentation for this class was generated from the following files: