For querying the timeline, it is nice to be able to see if a certain frame is a keyframe. This just adds one API call to the Node class to get see if a frame is is a keyframe
I created a test animation KRA file and added a few blank and filled keyframes. I used the new API call to see if the correct frames were keyframes. They appeared to be ok.
I am getting a weird free error on my build, but that happens even without running the script, so I might just need to do a clean build.
tested using this file:
I pasted this Python into the Scripter plugin:
doc = Krita.instance().activeDocument() currentLayer = doc.activeNode() layerHasAnimationEnabled = currentLayer.animated() if layerHasAnimationEnabled: # in sample file, keyframes are at frames 0, 4, and 8 print(currentLayer.hasKeyframeAtTime(0)) print(currentLayer.hasKeyframeAtTime(1)) print(currentLayer.hasKeyframeAtTime(8)) print(currentLayer.hasKeyframeAtTime(120))
Just a comment
As far as I know, this check is not needed, because keyframeAt() returns either a frame exactly in position or null. To be sure I would just ass a safe assert (instead of the check):
KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(timeOfCurrentKeyframe->time() == frameNumber, false); return true;