Krita Source Code Documentation
Loading...
Searching...
No Matches
KisAnimUtils.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef __KIS_ANIMATION_UTILS_H
8#define __KIS_ANIMATION_UTILS_H
9
10#include "kis_types.h"
11
12#include <boost/operators.hpp>
13#include <QModelIndexList>
14
15#include <kritaanimationdocker_export.h>
16
17
18namespace KisAnimUtils
19{
20 KUndo2Command* createKeyframeCommand(KisImageSP image, KisNodeSP node, const QString &channelId, int time, bool copy, KUndo2Command *parentCommand = 0);
21 void createKeyframeLazy(KisImageSP image, KisNodeSP node, const QString &channel, int time, bool copy);
22
23 struct KRITAANIMATIONDOCKER_EXPORT FrameItem : public boost::equality_comparable<FrameItem>
24 {
25 FrameItem() : time(-1) {}
26 FrameItem(KisNodeSP _node, const QString &_channel, int _time) : node(_node), channel(_channel), time(_time) {}
27
28 bool operator==(const FrameItem &rhs) const {
29 return rhs.node == node && rhs.channel == channel && rhs.time == time;
30 }
31
33 QString channel;
34 int time;
35 };
36
37 KRITAANIMATIONDOCKER_EXPORT QDebug operator<<(QDebug dbg, const FrameItem &item);
38
39 inline uint qHash(const FrameItem &item)
40 {
41 return ::qHash(item.node.data()) + ::qHash(item.channel) + ::qHash(item.time);
42 }
43
44
46 typedef std::pair<FrameItem, FrameItem> FrameMovePair;
48
49
50 void removeKeyframes(KisImageSP image, const FrameItemList &frames);
51 void removeKeyframe(KisImageSP image, KisNodeSP node, const QString &channel, int time);
52 void resetChannels(KisImageSP image, KisNodeSP node, const QList<QString> &channelIDs);
53 void resetChannel(KisImageSP image, KisNodeSP node, const QString &channelID);
54
55 void sortPointsForSafeMove(QModelIndexList *points, const QPoint &offset);
56
57 KUndo2Command* createMoveKeyframesCommand(const FrameItemList &srcFrames, const FrameItemList &dstFrames,
58 bool copy, bool moveEmpty, KUndo2Command *parentCommand = 0);
59
60
69 KRITAANIMATIONDOCKER_EXPORT
71 bool copy, bool moveEmptyFrames, KUndo2Command *parentCommand = 0);
72
74 KUndo2Command *parentCommand);
75
76 void makeClonesUnique(KisImageSP image, const FrameItemList &frames);
77
79
80 extern const QString lazyFrameCreationActionName;
81 extern const QString dropFramesActionName;
82
83 extern const QString newLayerActionName;
84 extern const QString pinExistingLayerActionName;
85 extern const QString removeLayerActionName;
86
87 extern const QString addOpacityKeyframeActionName;
88 extern const QString addTransformKeyframeActionName;
89 extern const QString removeOpacityKeyframeActionName;
90 extern const QString removeTransformKeyframeActionName;
91};
92
93
94#endif /* __KIS_ANIMATION_UTILS_H */
unsigned int uint
void makeClonesUnique(KisImageSP image, const FrameItemList &frames)
QVector< FrameItem > FrameItemList
const QString removeOpacityKeyframeActionName
void resetChannels(KisImageSP image, KisNodeSP node, const QList< QString > &channelIDs)
void removeKeyframes(KisImageSP image, const FrameItemList &frames)
void createKeyframeLazy(KisImageSP image, KisNodeSP node, const QString &channelId, int time, bool copy)
const QString newLayerActionName
void removeKeyframe(KisImageSP image, KisNodeSP node, const QString &channel, int time)
const QString addTransformKeyframeActionName
uint qHash(const FrameItem &item)
void resetChannel(KisImageSP image, KisNodeSP node, const QString &channelID)
const QString lazyFrameCreationActionName
void sortPointsForSafeMove(QModelIndexList *points, const QPoint &offset)
const QString addOpacityKeyframeActionName
KUndo2Command * createKeyframeCommand(KisImageSP image, KisNodeSP node, const QString &channelId, int time, bool copy, KUndo2Command *parentCommand)
QDebug operator<<(QDebug dbg, const FrameItem &item)
const QString removeLayerActionName
const QString removeTransformKeyframeActionName
QVector< FrameMovePair > FrameMovePairList
bool supportsContentFrames(KisNodeSP node)
const QString dropFramesActionName
KUndo2Command * createMoveKeyframesCommand(const FrameItemList &srcFrames, const FrameItemList &dstFrames, bool copy, bool moveEmpty, KUndo2Command *parentCommand)
std::pair< FrameItem, FrameItem > FrameMovePair
const QString pinExistingLayerActionName
KUndo2Command * createCloneKeyframesCommand(const FrameMovePairList &srcDstPairs, KUndo2Command *parentCommand)
bool operator==(const FrameItem &rhs) const
FrameItem(KisNodeSP _node, const QString &_channel, int _time)