Cleanup based on feedback.
diff --git a/include/rive/animation/animation_state.hpp b/include/rive/animation/animation_state.hpp index 2a2c580..a5ce875 100644 --- a/include/rive/animation/animation_state.hpp +++ b/include/rive/animation/animation_state.hpp
@@ -15,7 +15,7 @@ public: const LinearAnimation* animation() const { return m_Animation; } - const LinearAnimation* animationOrEmpty() const; + std::unique_ptr<StateInstance> makeInstance(ArtboardInstance*) const override; }; } // namespace rive
diff --git a/src/animation/animation_state.cpp b/src/animation/animation_state.cpp index cc1d37c..b8f92d1 100644 --- a/src/animation/animation_state.cpp +++ b/src/animation/animation_state.cpp
@@ -9,9 +9,3 @@ std::unique_ptr<StateInstance> AnimationState::makeInstance(ArtboardInstance* instance) const { return std::make_unique<AnimationStateInstance>(this, instance); } - -static LinearAnimation emptyAnimation; - -const LinearAnimation* AnimationState::animationOrEmpty() const { - return m_Animation == nullptr ? &emptyAnimation : m_Animation; -} \ No newline at end of file
diff --git a/src/animation/animation_state_instance.cpp b/src/animation/animation_state_instance.cpp index 7efd51d..6365708 100644 --- a/src/animation/animation_state_instance.cpp +++ b/src/animation/animation_state_instance.cpp
@@ -3,6 +3,8 @@ using namespace rive; +static LinearAnimation emptyAnimation; + AnimationStateInstance::AnimationStateInstance(const AnimationState* state, ArtboardInstance* instance) : StateInstance(state), @@ -13,7 +15,7 @@ // SystemStateInstance (basically a no-op StateMachine state) which would // cause bad casts in parts of the code where we assumed AnimationStates // would have create AnimationStateInstances. - m_AnimationInstance(state->animationOrEmpty(), instance), + m_AnimationInstance(state->animation() ? state->animation() : &emptyAnimation, instance), m_KeepGoing(true) {} void AnimationStateInstance::advance(float seconds, Span<SMIInput*>) {