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
Details
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))
Diff Detail
- Repository
- R37 Krita
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Just a comment
libs/libkis/Node.cpp | ||
---|---|---|
438 | 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; |
libs/libkis/Node.cpp | ||
---|---|---|
438 | To clarify, keyframeAt works as Dmitry described. There is a separate method activeKeyframeAt which also includes holds. |
Updated the diff removing the extra logic and replacing it with a safe assert. Using the python, it seems ok and I don't get any errors or issues