80 const boost::optional<int> origin = animationState->
playbackOrigin();
82 if (origin.has_value()) {
105 if (!
m_d->activeCanvas)
return;
109 KisNodeSP node =
m_d->activeCanvas->viewManager()->activeNode();
114 if (!keyframes)
return;
118 int destinationTime = -1;
136 if (!
m_d->activeCanvas)
return;
140 KisNodeSP node =
m_d->activeCanvas->viewManager()->activeNode();
145 if (!keyframes)
return;
149 int destinationTime = -1;
166 if (previousKeyTime != -1) {
171 const int timing = activeKeyTime - previousKeyTime;
179 if (!
m_d->activeCanvas)
return;
195 if (!
m_d->activeCanvas)
return;
211 if (!
m_d->activeCanvas)
return;
215 KisNodeSP node =
m_d->activeCanvas->viewManager()->activeNode();
220 if (!keyframes)
return;
226 const int desiredColor = currentKeyframe ? currentKeyframe->colorLabel() : keyframes->
keyframeAt(destinationTime)->colorLabel();
232 if (!
m_d->activeCanvas)
return;
236 KisNodeSP node =
m_d->activeCanvas->viewManager()->activeNode();
241 if (!keyframes)
return;
273 return m_d->dropFramesMode;
280 const int inclusiveEndFrame = endFrame + 1;
281 frame = ((frame - startFrame) % (inclusiveEndFrame - startFrame)) + startFrame;
283 if (frame - startFrame < 0) {
284 frame += (inclusiveEndFrame - startFrame);
292 return m_d->activeCanvas;
297 if (
m_d->activeCanvas) {
301 animState->disconnect(
this);
305 m_d->activeCanvas = canvas;
307 if (
m_d->activeCanvas) {
330 m_d->activeCanvas =
nullptr;
335 if (!
m_d->activeCanvas)
return;
345 frame =
frameWrap(frame, startFrame, endFrame);
358 QSet<int> validColors;
359 validColors.insert(color);
365 if (!
m_d->activeCanvas)
return;
369 KisNodeSP node =
m_d->activeCanvas->viewManager()->activeNode();
374 if (!keyframes)
return;
383 while ( keyframes->
keyframeAt(destinationTime) &&
384 ((destinationTime == time) ||
385 !validColors.contains(keyframes->
keyframeAt(destinationTime)->colorLabel()))) {
401 QSet<int> validColors;
402 validColors.insert(color);
408 if (!
m_d->activeCanvas)
return;
412 KisNodeSP node =
m_d->activeCanvas->viewManager()->activeNode();
417 if (!keyframes)
return;
422 while (keyframes->
keyframeAt(destinationTime) &&
423 ((destinationTime == time) ||
424 !validColors.contains(keyframes->
keyframeAt(destinationTime)->colorLabel()))) {
float value(const T *src, size_t ch)
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KisCanvasAnimationState * animationState() const
KisImageWSP image() const
The KisCanvasAnimationState class stores all of the canvas-specific animation state.
PlaybackState playbackState()
class KisFrameDisplayProxy * displayProxy()
void setPlaybackState(PlaybackState state)
setPlaybackState changes the animation playback state for this canvas. KisPlaybackEngine should respo...
boost::optional< int > playbackOrigin()
Get the animation frame to return to (for this canvas) when playback is stopped, if available.
bool animationDropFrames(bool defaultValue=false) const
int activeFrame() const
Gets the active frame, the frame that is intended to be shown. This should always reflect the actual ...
KisImageWSP image() const
const KisTimeSpan & activePlaybackRange() const
activePlaybackRange
const KisTimeSpan & documentPlaybackRange() const
documentPlaybackRange
KisImageAnimationInterface * animationInterface() const
KisKeyframeChannel stores and manages KisKeyframes. Maps units of time to virtual keyframe values....
int previousKeyframeTime(const int time) const
KisKeyframeSP keyframeAt(int time) const
Get a keyframe at specified time. Used primarily when the value of a given keyframe is needed.
KisKeyframeSP activeKeyframeAt(int time) 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...
int nextKeyframeTime(const int time) const
static KisOnionSkinCompositor * instance()
virtual void previousUnfilteredKeyframe()
previousUnfilteredKeyframe && nextUnfilteredKeyframe Navigate to keyframes based on the current onion...
virtual void nextMatchingKeyframe()
virtual void setDropFramesMode(bool value)
virtual void nextUnfilteredKeyframe()
void sigDropFramesModeChanged(bool value)
virtual void unsetCanvas() override
void moveActiveFrameBy(int frames)
Move the active frame of the animation player forwards or backwards by some number of frames.
virtual void previousMatchingKeyframe()
previousMatchingKeyframe && nextMatchingKeyframe Navigate to the next keyframe that has the same colo...
virtual void previousKeyframe()
QScopedPointer< Private > m_d
int frameWrap(int frame, int startFrame, int endFrame)
KisPlaybackEngine(QObject *parent=nullptr)
virtual void seek(int frameIndex, SeekOptionFlags options=SEEK_FINALIZE|SEEK_PUSH_AUDIO)=0
virtual void firstFrame()
virtual void nextKeyframe()
class KisCanvas2 * activeCanvas() const
virtual void previousFrame()
void nextKeyframeWithColor(int color)
virtual void setCanvas(KoCanvasBase *p_canvas) override
void previousKeyframeWithColor(int color)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
KisKeyframeChannel * getKeyframeChannel(const QString &id, bool create)
KisCanvas2 * activeCanvas