|
Krita Source Code Documentation
|
KisKeyframeChannel stores and manages KisKeyframes. Maps units of time to virtual keyframe values. This class is a key piece of Krita's animation backend. Abstract base class of KisRasterKeyframeChannel, KisScalarKeyframeChannel, etc. More...
#include <kis_keyframe_channel.h>
Inheritance diagram for KisKeyframeChannel:Classes | |
| struct | Private |
Signals | |
| 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. | |
Public Member Functions | |
| 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. | |
| virtual QRect | affectedRect (int time) const =0 |
| 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. | |
| virtual void | insertKeyframe (int time, KisKeyframeSP keyframe, KUndo2Command *parentUndoCmd=nullptr) |
| Insert an existing keyframe into the channel at the specified time. | |
| 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 |
| virtual void | loadXML (const QDomElement &channelNode) |
| 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 |
| virtual void | removeKeyframe (int time, KUndo2Command *parentUndoCmd=nullptr) |
| Remove a keyframe from the channel at the specified time. | |
| void | setDefaultBounds (KisDefaultBoundsBaseSP bounds) |
| void | setNode (KisNodeWSP node) |
| void | swapKeyframes (int timeA, int timeB, KUndo2Command *parentUndoCmd=nullptr) |
| virtual QDomElement | toXML (QDomDocument doc, const QString &layerFilename) |
| ~KisKeyframeChannel () override | |
Static Public Member Functions | |
| 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. | |
Static Public Attributes | |
| 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 | |
| typedef QMap< int, KisKeyframeSP > | TimeKeyframeMap |
Protected Member Functions | |
| const TimeKeyframeMap & | constKeys () const |
| int | currentTime () const |
| TimeKeyframeMap & | keys () |
| 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. | |
Private Member Functions | |
| virtual KisKeyframeSP | createKeyframe ()=0 |
| Virtual keyframe creation function. Derived classes implement this function based on the needs of their specific KisKeyframe subclasses. | |
| virtual QPair< int, KisKeyframeSP > | loadKeyframe (const QDomElement &keyframeNode)=0 |
| virtual void | saveKeyframe (KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename)=0 |
Private Attributes | |
| QScopedPointer< Private > | m_d |
KisKeyframeChannel stores and manages KisKeyframes. Maps units of time to virtual keyframe values. This class is a key piece of Krita's animation backend. Abstract base class of KisRasterKeyframeChannel, KisScalarKeyframeChannel, etc.
Definition at line 32 of file kis_keyframe_channel.h.
|
protected |
Definition at line 173 of file kis_keyframe_channel.h.
| KisKeyframeChannel::KisKeyframeChannel | ( | const KoID & | id, |
| KisDefaultBoundsBaseSP | bounds ) |
Definition at line 94 of file kis_keyframe_channel.cpp.
References connect(), sigAddedKeyframe(), sigAnyKeyframeChange(), sigKeyframeChanged(), and sigKeyframeHasBeenRemoved().
| KisKeyframeChannel::KisKeyframeChannel | ( | const KisKeyframeChannel & | rhs | ) |
Definition at line 111 of file kis_keyframe_channel.cpp.
References m_d.
|
override |
Definition at line 117 of file kis_keyframe_channel.cpp.
|
inline |
Definition at line 82 of file kis_keyframe_channel.h.
|
inline |
Definition at line 91 of file kis_keyframe_channel.h.
|
inline |
| int KisKeyframeChannel::activeKeyframeTime | ( | int | time | ) | const |
Get the time of the active keyframe. Useful for snapping any time to that of the most recent keyframe.
| time | Input time. When not specified, currentTime() will be used. |
Definition at line 233 of file kis_keyframe_channel.cpp.
References m_d.
| void KisKeyframeChannel::addKeyframe | ( | int | time, |
| KUndo2Command * | parentUndoCmd = nullptr ) |
Add a new keyframe to the channel at the specified time.
Definition at line 121 of file kis_keyframe_channel.cpp.
References createKeyframe(), and insertKeyframe().
|
virtual |
Get the set of frames affected by any changes to the value or content of the active keyframe at the given time.
Reimplemented in KisScalarKeyframeChannel.
Definition at line 372 of file kis_keyframe_channel.cpp.
References activeKeyframeTime(), KisTimeSpan::fromTimeToTime(), KisTimeSpan::infinite(), keyframeAt(), m_d, and nextKeyframeTime().
|
pure virtual |
The rect that is affected by a frame at the given time
Implemented in KisRasterKeyframeChannel, and KisScalarKeyframeChannel.
| QSet< int > KisKeyframeChannel::allKeyframeTimes | ( | ) | const |
Get a set of all integer times that map to a keyframe.
Definition at line 303 of file kis_keyframe_channel.cpp.
References m_d.
| int KisKeyframeChannel::channelHash | ( | ) | const |
Calculates a pseudo-unique hash based on the relevant internal state of the channel.
Definition at line 357 of file kis_keyframe_channel.cpp.
References m_d.
|
static |
Definition at line 38 of file kis_keyframe_channel.cpp.
References Opacity, PositionX, PositionY, Raster, RotationX, RotationY, RotationZ, ScaleX, ScaleY, ShearX, and ShearY.
|
protected |
Definition at line 439 of file kis_keyframe_channel.cpp.
References m_d.
|
static |
Copy a keyframe across channel(s) at the specified times.
Definition at line 186 of file kis_keyframe_channel.cpp.
References insertKeyframe(), keyframeAt(), KIS_ASSERT, and KIS_SAFE_ASSERT_RECOVER_RETURN.
|
inline |
Definition at line 75 of file kis_keyframe_channel.h.
References copyKeyframe().
|
privatepure virtual |
Virtual keyframe creation function. Derived classes implement this function based on the needs of their specific KisKeyframe subclasses.
Implemented in KisRasterKeyframeChannel, and KisScalarKeyframeChannel.
|
protected |
Definition at line 444 of file kis_keyframe_channel.cpp.
References m_d.
| int KisKeyframeChannel::firstKeyframeTime | ( | ) | const |
Definition at line 258 of file kis_keyframe_channel.cpp.
References m_d.
| QString KisKeyframeChannel::id | ( | ) | const |
Definition at line 318 of file kis_keyframe_channel.cpp.
References m_d.
|
virtual |
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.
Reimplemented in KisScalarKeyframeChannel.
Definition at line 392 of file kis_keyframe_channel.cpp.
References affectedFrames().
|
virtual |
Insert an existing keyframe into the channel at the specified time.
Reimplemented in KisRasterKeyframeChannel, and KisScalarKeyframeChannel.
Definition at line 127 of file kis_keyframe_channel.cpp.
References KIS_ASSERT, m_d, removeKeyframe(), and sigAddedKeyframe().
| KisKeyframeSP KisKeyframeChannel::keyframeAt | ( | int | time | ) | const |
Get a keyframe at specified time. Used primarily when the value of a given keyframe is needed.
Definition at line 218 of file kis_keyframe_channel.cpp.
References m_d.
|
inline |
Definition at line 86 of file kis_keyframe_channel.h.
| int KisKeyframeChannel::keyframeCount | ( | ) | const |
Definition at line 228 of file kis_keyframe_channel.cpp.
References m_d.
|
protected |
Definition at line 434 of file kis_keyframe_channel.cpp.
References m_d.
| int KisKeyframeChannel::lastKeyframeTime | ( | ) | const |
Definition at line 294 of file kis_keyframe_channel.cpp.
References m_d.
|
privatepure virtual |
Implemented in KisRasterKeyframeChannel, and KisScalarKeyframeChannel.
|
virtual |
Reimplemented in KisRasterKeyframeChannel.
Definition at line 418 of file kis_keyframe_channel.cpp.
References insertKeyframe(), KIS_SAFE_ASSERT_RECOVER, and loadKeyframe().
| int KisKeyframeChannel::lookupKeyframeTime | ( | KisKeyframeSP | toLookup | ) |
Search for the time for a given keyframe. (Reverse map lookup, so use sparingly.)
| toLookup | - the keyframe to look up the time for. |
Definition at line 251 of file kis_keyframe_channel.cpp.
References KIS_ASSERT, and m_d.
|
inline |
Definition at line 74 of file kis_keyframe_channel.h.
References moveKeyframe().
|
static |
Move a keyframe across channel(s) at the specified times.
Definition at line 167 of file kis_keyframe_channel.cpp.
References insertKeyframe(), keyframeAt(), KIS_ASSERT, KIS_SAFE_ASSERT_RECOVER_RETURN, and removeKeyframe().
| QString KisKeyframeChannel::name | ( | ) | const |
Definition at line 323 of file kis_keyframe_channel.cpp.
References m_d.
| int KisKeyframeChannel::nextKeyframeTime | ( | const int | time | ) | const |
Definition at line 283 of file kis_keyframe_channel.cpp.
References m_d.
| KisNodeWSP KisKeyframeChannel::node | ( | ) | const |
Definition at line 348 of file kis_keyframe_channel.cpp.
References m_d.
| int KisKeyframeChannel::previousKeyframeTime | ( | const int | time | ) | const |
Definition at line 267 of file kis_keyframe_channel.cpp.
References activeKeyframeTime(), keyframeAt(), and m_d.
|
virtual |
Remove a keyframe from the channel at the specified time.
Reimplemented in KisRasterKeyframeChannel, and KisScalarKeyframeChannel.
Definition at line 161 of file kis_keyframe_channel.cpp.
References removeKeyframeImpl(), and sigKeyframeAboutToBeRemoved().
|
protectedvirtual |
Actual implementation of the frame removal that does everything except of the signal emission (that should be emitted before the removal)
Definition at line 148 of file kis_keyframe_channel.cpp.
References m_d, and sigKeyframeHasBeenRemoved().
|
privatepure virtual |
Implemented in KisRasterKeyframeChannel, and KisScalarKeyframeChannel.
| void KisKeyframeChannel::setDefaultBounds | ( | KisDefaultBoundsBaseSP | bounds | ) |
| void KisKeyframeChannel::setNode | ( | KisNodeWSP | node | ) |
Definition at line 328 of file kis_keyframe_channel.cpp.
References connect(), KisNode::handleKeyframeChannelFrameAboutToBeRemoved(), KisNode::handleKeyframeChannelFrameAdded(), KisNode::handleKeyframeChannelFrameChange(), KisNode::handleKeyframeChannelFrameHasBeenRemoved(), m_d, node(), sigAddedKeyframe(), sigKeyframeAboutToBeRemoved(), sigKeyframeChanged(), and sigKeyframeHasBeenRemoved().
|
signal |
This signal is emitted just AFTER a keyframe was added to the channel.
|
signal |
This signal is an aggregate of the following signals:
|
signal |
This signal is emitted just BEFORE a keyframe is removed from the channel.
|
signal |
This signal is emitted just AFTER a non-raster keyframe was changed its value.
|
signal |
This signal is emitted just AFTER a keyframe is removed from the channel.
|
inline |
Definition at line 76 of file kis_keyframe_channel.h.
References swapKeyframes().
|
static |
Swap two keyframes across channel(s) at the specified times.
Definition at line 199 of file kis_keyframe_channel.cpp.
References insertKeyframe(), keyframeAt(), KIS_ASSERT, KIS_SAFE_ASSERT_RECOVER_RETURN, and moveKeyframe().
|
virtual |
Reimplemented in KisRasterKeyframeChannel.
Definition at line 397 of file kis_keyframe_channel.cpp.
References keyframeAt(), m_d, and saveKeyframe().
|
protected |
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.
TODO: remove this workaround in Krita 5.0, when no such file are left :)
Definition at line 449 of file kis_keyframe_channel.cpp.
References keyframeAt(), m_d, and ppVar.
|
private |
Definition at line 195 of file kis_keyframe_channel.h.
Definition at line 38 of file kis_keyframe_channel.h.
Definition at line 40 of file kis_keyframe_channel.h.
Definition at line 41 of file kis_keyframe_channel.h.
Definition at line 37 of file kis_keyframe_channel.h.
|
static |
Definition at line 46 of file kis_keyframe_channel.h.
|
static |
Definition at line 47 of file kis_keyframe_channel.h.
|
static |
Definition at line 48 of file kis_keyframe_channel.h.
Definition at line 42 of file kis_keyframe_channel.h.
Definition at line 43 of file kis_keyframe_channel.h.
Definition at line 44 of file kis_keyframe_channel.h.
Definition at line 45 of file kis_keyframe_channel.h.
|
static |
Definition at line 39 of file kis_keyframe_channel.h.