|
Krita Source Code Documentation
|
The KisScalarKeyframeChannel is a concrete KisKeyframeChannel subclass that stores and manages KisScalarKeyframes. More...
#include <kis_scalar_keyframe_channel.h>
Inheritance diagram for KisScalarKeyframeChannel:Classes | |
| struct | Private |
Public Member Functions | |
| void | addScalarKeyframe (int time, qreal value, KUndo2Command *parentUndoCmd=nullptr) |
| virtual KisTimeSpan | affectedFrames (int time) const override |
| Get the set of frames affected by any changes to the value or content of the active keyframe at the given time. | |
| qreal | currentValue () |
| virtual KisTimeSpan | identicalFrames (int time) const override |
| 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) override |
| Insert an existing keyframe into the channel at the specified time. | |
| bool | isCurrentTimeAffectedBy (int keyTime) |
| KisScalarKeyframeChannel (const KisScalarKeyframeChannel &rhs) | |
| KisScalarKeyframeChannel (const KoID &id, KisDefaultBoundsBaseSP bounds) | |
| QSharedPointer< ScalarKeyframeLimits > | limits () const |
| virtual void | removeKeyframe (int time, KUndo2Command *parentUndoCmd=nullptr) override |
| Remove a keyframe from the channel at the specified time. | |
| void | removeLimits () |
| void | setDefaultInterpolationMode (KisScalarKeyframe::InterpolationMode mode) |
| void | setDefaultValue (qreal value) |
| void | setLimits (qreal low, qreal high) |
| qreal | valueAt (int time) const |
| Quickly get the interpolated value at the given time. | |
| ~KisScalarKeyframeChannel () 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. | |
| 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 |
| 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 |
| 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 QPointF | interpolate (QPointF point1, QPointF rightTangent, QPointF leftTangent, QPointF point2, qreal t) |
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 | |
| virtual QRect | affectedRect (int time) const override |
| virtual KisKeyframeSP | createKeyframe () override |
| 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) override |
| virtual void | saveKeyframe (KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename) override |
Static Private Member Functions | |
| static qreal | cubicBezier (qreal p0, qreal delta1, qreal delta2, qreal p3, qreal t) |
| static qreal | findCubicCurveParameter (int time0, qreal delta0, qreal delta1, int time1, int time) |
| static void | normalizeTangents (const QPointF point1, QPointF &rightTangent, QPointF &leftTangent, const QPointF point2) |
Private Attributes | |
| QScopedPointer< Private > | m_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, KisKeyframeSP > | TimeKeyframeMap |
Protected Member Functions inherited from KisKeyframeChannel | |
| 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. | |
The KisScalarKeyframeChannel is a concrete KisKeyframeChannel subclass that stores and manages KisScalarKeyframes.
This class maps units of time (in frames) to points along a curve for the animation of various interpolated scalar parameters within Krita. Each scalar channel can be provided with default values and interpolation modes, as well as an optional ScalarKeyframeLimits object that can be used to limit the range of possible values.
Generally, each scalar channel will be represented as an individual curve within Krita's KisAnimationCurvesDocker.
Definition at line 119 of file kis_scalar_keyframe_channel.h.
| KisScalarKeyframeChannel::KisScalarKeyframeChannel | ( | const KoID & | id, |
| KisDefaultBoundsBaseSP | bounds ) |
Definition at line 167 of file kis_scalar_keyframe_channel.cpp.
| KisScalarKeyframeChannel::KisScalarKeyframeChannel | ( | const KisScalarKeyframeChannel & | rhs | ) |
Definition at line 173 of file kis_scalar_keyframe_channel.cpp.
References KisKeyframeChannel::constKeys(), KisKeyframeChannel::copyKeyframe(), and m_d.
|
override |
Definition at line 183 of file kis_scalar_keyframe_channel.cpp.
| void KisScalarKeyframeChannel::addScalarKeyframe | ( | int | time, |
| qreal | value, | ||
| KUndo2Command * | parentUndoCmd = nullptr ) |
Utility for adding keyframe with non-default value.
Definition at line 187 of file kis_scalar_keyframe_channel.cpp.
References KisKeyframeChannel::addKeyframe(), and value().
|
overridevirtual |
Get the set of frames affected by any changes to the value or content of the active keyframe at the given time.
Reimplemented from KisKeyframeChannel.
Definition at line 336 of file kis_scalar_keyframe_channel.cpp.
References KisKeyframeChannel::activeKeyframeTime(), KisKeyframeChannel::affectedFrames(), KisScalarKeyframe::Constant, KisKeyframeChannel::firstKeyframeTime(), KisTimeSpan::fromTimeToTime(), KisTimeSpan::infinite(), and KisKeyframeChannel::previousKeyframeTime().
|
overrideprivatevirtual |
The rect that is affected by a frame at the given time
Implements KisKeyframeChannel.
Definition at line 449 of file kis_scalar_keyframe_channel.cpp.
References KisBaseNode::exactBounds(), and KisKeyframeChannel::node().
|
overrideprivatevirtual |
Virtual keyframe creation function. Derived classes implement this function based on the needs of their specific KisKeyframe subclasses.
Implements KisKeyframeChannel.
Definition at line 442 of file kis_scalar_keyframe_channel.cpp.
References m_d, KisScalarKeyframe::setInterpolationMode(), and toQShared().
|
staticprivate |
Definition at line 416 of file kis_scalar_keyframe_channel.cpp.
|
inline |
Definition at line 138 of file kis_scalar_keyframe_channel.h.
|
staticprivate |
Definition at line 393 of file kis_scalar_keyframe_channel.cpp.
References cubicBezier().
|
overridevirtual |
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 from KisKeyframeChannel.
Definition at line 361 of file kis_scalar_keyframe_channel.cpp.
References KisKeyframeChannel::activeKeyframeTime(), KisKeyframeChannel::allKeyframeTimes(), KisScalarKeyframe::Constant, KisTimeSpan::fromTimeToTime(), KisTimeSpan::infinite(), KisKeyframeChannel::keyframeAt(), KisKeyframeChannel::lastKeyframeTime(), and KisKeyframeChannel::nextKeyframeTime().
|
overridevirtual |
Insert an existing keyframe into the channel at the specified time.
Reimplemented from KisKeyframeChannel.
Definition at line 310 of file kis_scalar_keyframe_channel.cpp.
References KisKeyframeChannel::insertKeyframe(), and KisScalarKeyframe::sigChanged().
|
static |
Definition at line 300 of file kis_scalar_keyframe_channel.cpp.
References cubicBezier(), and normalizeTangents().
| bool KisScalarKeyframeChannel::isCurrentTimeAffectedBy | ( | int | keyTime | ) |
Definition at line 286 of file kis_scalar_keyframe_channel.cpp.
References KisKeyframeChannel::activeKeyframeTime(), affectedFrames(), KisTimeSpan::contains(), and KisKeyframeChannel::currentTime().
| QSharedPointer< ScalarKeyframeLimits > KisScalarKeyframeChannel::limits | ( | ) | const |
Definition at line 199 of file kis_scalar_keyframe_channel.cpp.
References m_d.
|
overrideprivatevirtual |
Implements KisKeyframeChannel.
Definition at line 483 of file kis_scalar_keyframe_channel.cpp.
References KisScalarKeyframe::Bezier, KisScalarKeyframe::Constant, createKeyframe(), KisScalarKeyframe::Linear, KisDomUtils::loadValue(), KisScalarKeyframe::Sharp, KisScalarKeyframe::Smooth, KisDomUtils::toDouble(), value(), and KisKeyframeChannel::workaroundBrokenFrameTimeBug().
|
staticprivate |
Definition at line 424 of file kis_scalar_keyframe_channel.cpp.
|
overridevirtual |
Remove a keyframe from the channel at the specified time.
Reimplemented from KisKeyframeChannel.
Definition at line 326 of file kis_scalar_keyframe_channel.cpp.
References KisKeyframeChannel::removeKeyframe().
| void KisScalarKeyframeChannel::removeLimits | ( | ) |
Remove limits, allowing channel to operate within any range of values.
Definition at line 215 of file kis_scalar_keyframe_channel.cpp.
References m_d.
|
overrideprivatevirtual |
Implements KisKeyframeChannel.
Definition at line 460 of file kis_scalar_keyframe_channel.cpp.
References KisScalarKeyframe::Bezier, KisScalarKeyframe::Constant, KIS_SAFE_ASSERT_RECOVER_RETURN, KisScalarKeyframe::Linear, KisDomUtils::saveValue(), KisScalarKeyframe::Sharp, KisScalarKeyframe::Smooth, KisDomUtils::toString(), and value().
| void KisScalarKeyframeChannel::setDefaultInterpolationMode | ( | KisScalarKeyframe::InterpolationMode | mode | ) |
Definition at line 295 of file kis_scalar_keyframe_channel.cpp.
References m_d.
| void KisScalarKeyframeChannel::setDefaultValue | ( | qreal | value | ) |
| void KisScalarKeyframeChannel::setLimits | ( | qreal | low, |
| qreal | high ) |
Limit channel within scalar value range.
Definition at line 204 of file kis_scalar_keyframe_channel.cpp.
References KisKeyframeChannel::allKeyframeTimes(), m_d, and toQShared().
| qreal KisScalarKeyframeChannel::valueAt | ( | int | time | ) | const |
Quickly get the interpolated value at the given time.
Definition at line 222 of file kis_scalar_keyframe_channel.cpp.
References KisKeyframeChannel::activeKeyframeTime(), KisScalarKeyframe::Bezier, KisScalarKeyframe::Constant, findCubicCurveParameter(), interpolate(), KIS_ASSERT_RECOVER_BREAK, KisScalarKeyframe::Linear, m_d, KisKeyframeChannel::nextKeyframeTime(), and normalizeTangents().
|
private |
Definition at line 163 of file kis_scalar_keyframe_channel.h.