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

#include <KisLazyCreateTransformMaskKeyframesCommand.h>

+ Inheritance diagram for KisLazyCreateTransformMaskKeyframesCommand:

Public Member Functions

 KisLazyCreateTransformMaskKeyframesCommand (KisTransformMaskSP mask, KUndo2Command *parent=nullptr)
 
- Public Member Functions inherited from KisCommandUtils::AggregateCommand
 AggregateCommand (const KUndo2MagicString &text, KUndo2Command *parent=0)
 
 AggregateCommand (KUndo2Command *parent=0)
 
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 ()
 

Static Public Member Functions

static bool maskHasAnimation (KisTransformMaskSP mask)
 

Private Member Functions

void populateChildCommands () override
 

Private Attributes

KisTransformMaskSP m_mask
 

Additional Inherited Members

- Protected Member Functions inherited from KisCommandUtils::AggregateCommand
void addCommand (KUndo2Command *cmd)
 

Detailed Description

Definition at line 13 of file KisLazyCreateTransformMaskKeyframesCommand.h.

Constructor & Destructor Documentation

◆ KisLazyCreateTransformMaskKeyframesCommand()

KisLazyCreateTransformMaskKeyframesCommand::KisLazyCreateTransformMaskKeyframesCommand ( KisTransformMaskSP mask,
KUndo2Command * parent = nullptr )

Definition at line 12 of file KisLazyCreateTransformMaskKeyframesCommand.cpp.

14 , m_mask(mask)
15{
16}
The AggregateCommand struct is a command with delayed initialization. On first redo() populateChildCo...

Member Function Documentation

◆ maskHasAnimation()

bool KisLazyCreateTransformMaskKeyframesCommand::maskHasAnimation ( KisTransformMaskSP mask)
static

Definition at line 18 of file KisLazyCreateTransformMaskKeyframesCommand.cpp.

19{
29
30 Q_FOREACH (const QString &id, ids) {
31 if (mask->getKeyframeChannel(id)) return true;
32 }
33
34 return false;
35}
static const KoID RotationY
static const KoID ScaleY
static const KoID RotationZ
static const KoID ScaleX
static const KoID RotationX
static const KoID PositionX
static const KoID PositionY
static const KoID ShearX
static const KoID ShearY
QString id() const
Definition KoID.cpp:63
KisKeyframeChannel * getKeyframeChannel(const QString &id, bool create)

References KisBaseNode::getKeyframeChannel(), KoID::id(), KisKeyframeChannel::PositionX, KisKeyframeChannel::PositionY, KisKeyframeChannel::RotationX, KisKeyframeChannel::RotationY, KisKeyframeChannel::RotationZ, KisKeyframeChannel::ScaleX, KisKeyframeChannel::ScaleY, KisKeyframeChannel::ShearX, and KisKeyframeChannel::ShearY.

◆ populateChildCommands()

void KisLazyCreateTransformMaskKeyframesCommand::populateChildCommands ( )
overrideprivatevirtual

Implements KisCommandUtils::AggregateCommand.

Definition at line 37 of file KisLazyCreateTransformMaskKeyframesCommand.cpp.

38{
39 QScopedPointer<KUndo2Command> parentCommand(new KUndo2Command);
40
42
43 const int time = m_mask->parent()->original()->defaultBounds()->currentTime();
44
45 auto addKeyframe = [this, time] (const KoID &channelId, KUndo2Command *parentCommand)
46 {
47 KisScalarKeyframeChannel *channel = dynamic_cast<KisScalarKeyframeChannel*>(m_mask->getKeyframeChannel(channelId.id()));
49
50 if (!channel->keyframeAt(time)) {
51 channel->addScalarKeyframe(time, channel->valueAt(time), parentCommand);
52 }
53 };
54
55 addKeyframe(KisKeyframeChannel::PositionX, parentCommand.data());
56 addKeyframe(KisKeyframeChannel::PositionY, parentCommand.data());
57
58 addKeyframe(KisKeyframeChannel::ScaleX, parentCommand.data());
59 addKeyframe(KisKeyframeChannel::ScaleY, parentCommand.data());
60
61 addKeyframe(KisKeyframeChannel::ShearX, parentCommand.data());
62 addKeyframe(KisKeyframeChannel::ShearY, parentCommand.data());
63
64 addKeyframe(KisKeyframeChannel::RotationX, parentCommand.data());
65 addKeyframe(KisKeyframeChannel::RotationY, parentCommand.data());
66 addKeyframe(KisKeyframeChannel::RotationZ, parentCommand.data());
67
68 addCommand(parentCommand.take());
69}
virtual QTime time() const
virtual int currentTime() const =0
KisKeyframeSP keyframeAt(int time) const
Get a keyframe at specified time. Used primarily when the value of a given keyframe is needed.
KisDefaultBoundsBaseSP defaultBounds() const
The KisScalarKeyframeChannel is a concrete KisKeyframeChannel subclass that stores and manages KisSca...
qreal valueAt(int time) const
Quickly get the interpolated value at the given time.
void addScalarKeyframe(int time, qreal value, KUndo2Command *parentUndoCmd=nullptr)
Definition KoID.h:30
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
virtual KisPaintDeviceSP original() const =0
void addCommand(KUndo2Command *cmd)
KisNodeWSP parent
Definition kis_node.cpp:86

References KisCommandUtils::AggregateCommand::addCommand(), KisScalarKeyframeChannel::addScalarKeyframe(), KisDefaultBoundsBase::currentTime(), KisPaintDevice::defaultBounds(), KisBaseNode::getKeyframeChannel(), KoID::id(), KisKeyframeChannel::keyframeAt(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_mask, KisBaseNode::original(), KisNode::parent, KisKeyframeChannel::PositionX, KisKeyframeChannel::PositionY, KisKeyframeChannel::RotationX, KisKeyframeChannel::RotationY, KisKeyframeChannel::RotationZ, KisKeyframeChannel::ScaleX, KisKeyframeChannel::ScaleY, KisKeyframeChannel::ShearX, KisKeyframeChannel::ShearY, KUndo2Command::time(), and KisScalarKeyframeChannel::valueAt().

Member Data Documentation

◆ m_mask

KisTransformMaskSP KisLazyCreateTransformMaskKeyframesCommand::m_mask
private

Definition at line 23 of file KisLazyCreateTransformMaskKeyframesCommand.h.


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