blob: 31d3715c8b0de2b505d39b9ff391407d0a911afd [file]
#include "rive/animation/keyframe.hpp"
#include "rive/animation/cubic_interpolator.hpp"
#include "rive/animation/keyed_property.hpp"
#include "rive/core_context.hpp"
#include "rive/importers/import_stack.hpp"
#include "rive/importers/keyed_property_importer.hpp"
using namespace rive;
void KeyFrame::computeSeconds(int fps) { m_seconds = frame() / (float)fps; }
// `KeyFrame::frameChanged` lives in
// `editor_native/native/src/editor/animation/keyframe_editor.cpp`
// — see the matching comment in `keyed_property.cpp`.
StatusCode KeyFrame::import(ImportStack& importStack)
{
auto importer = importStack.latest<KeyedPropertyImporter>(
KeyedProperty::typeKey);
if (importer == nullptr || !importer->hasKeyedProperty())
{
return StatusCode::MissingObject;
}
importer->addKeyFrame(std::unique_ptr<KeyFrame>(this));
return Super::import(importStack);
}