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

#include <kis_keyframe_commands.h>

+ Inheritance diagram for KisScalarKeyframeUpdateCommand:

Public Types

template<typename T >
using UndoStore = QPair<T, T>
 

Public Member Functions

 KisScalarKeyframeUpdateCommand (KisScalarKeyframe *keyframe, KisScalarKeyframe::InterpolationMode interpMode, KUndo2Command *parentCmd)
 
 KisScalarKeyframeUpdateCommand (KisScalarKeyframe *keyframe, KisScalarKeyframe::TangentsMode tangentMode, KUndo2Command *parentCmd)
 
 KisScalarKeyframeUpdateCommand (KisScalarKeyframe *keyframe, QPointF tangentLeft, QPointF tangentRight, KUndo2Command *parentCmd)
 
 KisScalarKeyframeUpdateCommand (KisScalarKeyframe *keyframe, qreal value, KisScalarKeyframe::InterpolationMode interpolationMode, KisScalarKeyframe::TangentsMode tangentMode, QPointF tangentLeft, QPointF tangentRight, KUndo2Command *parentCmd)
 
 KisScalarKeyframeUpdateCommand (KisScalarKeyframe *keyframe, qreal value, KUndo2Command *parentCmd)
 
void redo () override
 
void undo () override
 
- Public Member Functions inherited from KUndo2Command
QString actionText () const
 
virtual bool canAnnihilateWith (const KUndo2Command *other) const
 
const KUndo2Commandchild (int index) const
 
int childCount () const
 
virtual QTime endTime () const
 
KUndo2CommandExtraDataextraData () const
 
bool hasParent () const
 
virtual int id () const
 
virtual bool isMerged () const
 
 KUndo2Command (const KUndo2MagicString &text, KUndo2Command *parent=0)
 
 KUndo2Command (KUndo2Command *parent=0)
 
virtual QVector< KUndo2Command * > mergeCommandsVector () const
 
virtual bool mergeWith (const KUndo2Command *other)
 
virtual void redoMergedCommands ()
 
void setEndTime ()
 
virtual void setEndTime (const QTime &time)
 
void setExtraData (KUndo2CommandExtraData *data)
 
void setText (const KUndo2MagicString &text)
 
void setTime ()
 
virtual void setTime (const QTime &time)
 
virtual void setTimedID (int timedID)
 
KUndo2MagicString text () const
 
virtual QTime time () const
 
virtual int timedId () const
 
virtual bool timedMergeWith (KUndo2Command *other)
 
virtual void undoMergedCommands ()
 
virtual ~KUndo2Command ()
 

Private Attributes

UndoStore< KisScalarKeyframe::InterpolationModecachedInterpolationMode
 
UndoStore< QPointF > cachedTangentLeft
 
UndoStore< QPointF > cachedTangentRight
 
UndoStore< KisScalarKeyframe::TangentsModecachedTangentsMode
 
UndoStore< qreal > cachedValue
 
KisScalarKeyframekeyframe
 

Detailed Description

Definition at line 50 of file kis_keyframe_commands.h.

Member Typedef Documentation

◆ UndoStore

template<typename T >
using KisScalarKeyframeUpdateCommand::UndoStore = QPair<T, T>

Definition at line 94 of file kis_keyframe_commands.h.

Constructor & Destructor Documentation

◆ KisScalarKeyframeUpdateCommand() [1/5]

KisScalarKeyframeUpdateCommand::KisScalarKeyframeUpdateCommand ( KisScalarKeyframe * keyframe,
qreal value,
KisScalarKeyframe::InterpolationMode interpolationMode,
KisScalarKeyframe::TangentsMode tangentMode,
QPointF tangentLeft,
QPointF tangentRight,
KUndo2Command * parentCmd )

Definition at line 54 of file kis_keyframe_commands.cpp.

55 : KUndo2Command(parentCmd),
60 cachedTangentLeft(keyframe->leftTangent(), tangentLeft),
62{}
float value(const T *src, size_t ch)
KUndo2Command(KUndo2Command *parent=0)
UndoStore< KisScalarKeyframe::TangentsMode > cachedTangentsMode
UndoStore< KisScalarKeyframe::InterpolationMode > cachedInterpolationMode
InterpolationMode interpolationMode() const
TangentsMode tangentsMode() const

◆ KisScalarKeyframeUpdateCommand() [2/5]

KisScalarKeyframeUpdateCommand::KisScalarKeyframeUpdateCommand ( KisScalarKeyframe * keyframe,
qreal value,
KUndo2Command * parentCmd )
inline

Definition at line 61 of file kis_keyframe_commands.h.

66 keyframe->m_rightTangent, parentCmd) {};
KisScalarKeyframeUpdateCommand(KisScalarKeyframe *keyframe, qreal value, KisScalarKeyframe::InterpolationMode interpolationMode, KisScalarKeyframe::TangentsMode tangentMode, QPointF tangentLeft, QPointF tangentRight, KUndo2Command *parentCmd)
InterpolationMode m_interpolationMode

◆ KisScalarKeyframeUpdateCommand() [3/5]

KisScalarKeyframeUpdateCommand::KisScalarKeyframeUpdateCommand ( KisScalarKeyframe * keyframe,
KisScalarKeyframe::InterpolationMode interpMode,
KUndo2Command * parentCmd )
inline

◆ KisScalarKeyframeUpdateCommand() [4/5]

KisScalarKeyframeUpdateCommand::KisScalarKeyframeUpdateCommand ( KisScalarKeyframe * keyframe,
KisScalarKeyframe::TangentsMode tangentMode,
KUndo2Command * parentCmd )
inline

◆ KisScalarKeyframeUpdateCommand() [5/5]

KisScalarKeyframeUpdateCommand::KisScalarKeyframeUpdateCommand ( KisScalarKeyframe * keyframe,
QPointF tangentLeft,
QPointF tangentRight,
KUndo2Command * parentCmd )
inline

Definition at line 82 of file kis_keyframe_commands.h.

87 keyframe->m_tangentsMode, tangentLeft,
88 tangentRight, parentCmd) {};

Member Function Documentation

◆ redo()

void KisScalarKeyframeUpdateCommand::redo ( )
overridevirtual

Applies a change to the document. This function must be implemented in the derived class. Calling KUndo2QStack::push(), KUndo2QStack::undo() or KUndo2QStack::redo() from this function leads to undefined behavior.

The default implementation calls redo() on all child commands.

See also
undo()

Reimplemented from KUndo2Command.

Definition at line 64 of file kis_keyframe_commands.cpp.

65{
67
69 if (limits) {
70 keyframe->m_value = limits->clamp(cachedValue.second);
71 } else {
73 }
74
79
81}
void sigChanged(const KisScalarKeyframe *scalarKey)
QWeakPointer< ScalarKeyframeLimits > m_channelLimits
#define KIS_ASSERT(cond)
Definition kis_assert.h:33

References cachedInterpolationMode, cachedTangentLeft, cachedTangentRight, cachedTangentsMode, cachedValue, keyframe, KIS_ASSERT, KisScalarKeyframe::m_channelLimits, KisScalarKeyframe::m_interpolationMode, KisScalarKeyframe::m_leftTangent, KisScalarKeyframe::m_rightTangent, KisScalarKeyframe::m_tangentsMode, KisScalarKeyframe::m_value, and KisScalarKeyframe::sigChanged().

◆ undo()

void KisScalarKeyframeUpdateCommand::undo ( )
overridevirtual

Reverts a change to the document. After undo() is called, the state of the document should be the same as before redo() was called. This function must be implemented in the derived class. Calling KUndo2QStack::push(), KUndo2QStack::undo() or KUndo2QStack::redo() from this function leads to undefined behavior.

The default implementation calls undo() on all child commands in reverse order.

See also
redo()

Reimplemented from KUndo2Command.

Definition at line 83 of file kis_keyframe_commands.cpp.

References cachedInterpolationMode, cachedTangentLeft, cachedTangentRight, cachedTangentsMode, cachedValue, keyframe, KIS_ASSERT, KisScalarKeyframe::m_channelLimits, KisScalarKeyframe::m_interpolationMode, KisScalarKeyframe::m_leftTangent, KisScalarKeyframe::m_rightTangent, KisScalarKeyframe::m_tangentsMode, KisScalarKeyframe::m_value, and KisScalarKeyframe::sigChanged().

Member Data Documentation

◆ cachedInterpolationMode

UndoStore<KisScalarKeyframe::InterpolationMode> KisScalarKeyframeUpdateCommand::cachedInterpolationMode
private

Definition at line 99 of file kis_keyframe_commands.h.

◆ cachedTangentLeft

UndoStore<QPointF> KisScalarKeyframeUpdateCommand::cachedTangentLeft
private

Definition at line 101 of file kis_keyframe_commands.h.

◆ cachedTangentRight

UndoStore<QPointF> KisScalarKeyframeUpdateCommand::cachedTangentRight
private

Definition at line 102 of file kis_keyframe_commands.h.

◆ cachedTangentsMode

UndoStore<KisScalarKeyframe::TangentsMode> KisScalarKeyframeUpdateCommand::cachedTangentsMode
private

Definition at line 100 of file kis_keyframe_commands.h.

◆ cachedValue

UndoStore<qreal> KisScalarKeyframeUpdateCommand::cachedValue
private

Definition at line 98 of file kis_keyframe_commands.h.

◆ keyframe

KisScalarKeyframe* KisScalarKeyframeUpdateCommand::keyframe
private

Definition at line 97 of file kis_keyframe_commands.h.


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