diff --git a/libs/libkis/Node.h b/libs/libkis/Node.h --- a/libs/libkis/Node.h +++ b/libs/libkis/Node.h @@ -312,6 +312,11 @@ */ bool visible() const; + /** + * Check to see if frame number on layer is a keyframe + */ + bool hasKeyframeAtTime(int frameNumber); + /** * Set the visibility of the current node to @param visible */ diff --git a/libs/libkis/Node.cpp b/libs/libkis/Node.cpp --- a/libs/libkis/Node.cpp +++ b/libs/libkis/Node.cpp @@ -421,6 +421,24 @@ return d->node->visible(); } +bool Node::hasKeyframeAtTime(int frameNumber) +{ + if (!d->node || !d->node->isAnimated()) return false; + + KisRasterKeyframeChannel *rkc = dynamic_cast(d->node->getKeyframeChannel(KisKeyframeChannel::Content.id())); + if (!rkc) return false; + + KisKeyframeSP timeOfCurrentKeyframe = rkc->keyframeAt(frameNumber); + + if (!timeOfCurrentKeyframe) { + return false; + } + + // do an assert just to be careful + KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(timeOfCurrentKeyframe->time() == frameNumber, false); + return true; +} + void Node::setVisible(bool visible) { if (!d->node) return; diff --git a/plugins/extensions/pykrita/sip/krita/Node.sip b/plugins/extensions/pykrita/sip/krita/Node.sip --- a/plugins/extensions/pykrita/sip/krita/Node.sip +++ b/plugins/extensions/pykrita/sip/krita/Node.sip @@ -45,6 +45,7 @@ QString type() const; QIcon icon() const; bool visible() const; + bool hasKeyframeAtTime(int frameNumber); void setVisible(bool value); QByteArray pixelData(int x, int y, int w, int h) const; QByteArray pixelDataAtTime(int x, int y, int w, int h, int time) const;