Use new ArtboardInstance type
diff --git a/include/rive/animation/animation_state.hpp b/include/rive/animation/animation_state.hpp index f1a71b8..aff5c3d 100644 --- a/include/rive/animation/animation_state.hpp +++ b/include/rive/animation/animation_state.hpp
@@ -4,7 +4,7 @@ #include <stdio.h> namespace rive { class LinearAnimation; - class Artboard; + class ArtboardInstance; class StateMachineLayerImporter; class AnimationState : public AnimationStateBase { @@ -15,7 +15,7 @@ public: const LinearAnimation* animation() const { return m_Animation; } - StateInstance* makeInstance(Artboard*) const override; + StateInstance* makeInstance(ArtboardInstance*) const override; }; } // namespace rive
diff --git a/include/rive/animation/animation_state_instance.hpp b/include/rive/animation/animation_state_instance.hpp index 64d25bf..1f03f3f 100644 --- a/include/rive/animation/animation_state_instance.hpp +++ b/include/rive/animation/animation_state_instance.hpp
@@ -15,7 +15,7 @@ bool m_KeepGoing; public: - AnimationStateInstance(const AnimationState* animationState, Artboard* instance); + AnimationStateInstance(const AnimationState* animationState, ArtboardInstance* instance); void advance(float seconds, SMIInput** inputs) override; void apply(float mix) override;
diff --git a/include/rive/animation/blend_state_1d.hpp b/include/rive/animation/blend_state_1d.hpp index 8ffa1e4..83d0695 100644 --- a/include/rive/animation/blend_state_1d.hpp +++ b/include/rive/animation/blend_state_1d.hpp
@@ -12,7 +12,7 @@ StatusCode import(ImportStack& importStack) override; - StateInstance* makeInstance(Artboard*) const override; + StateInstance* makeInstance(ArtboardInstance*) const override; }; } // namespace rive
diff --git a/include/rive/animation/blend_state_1d_instance.hpp b/include/rive/animation/blend_state_1d_instance.hpp index db7e7a6..a386074 100644 --- a/include/rive/animation/blend_state_1d_instance.hpp +++ b/include/rive/animation/blend_state_1d_instance.hpp
@@ -13,7 +13,7 @@ int animationIndex(float value); public: - BlendState1DInstance(const BlendState1D* blendState, Artboard* instance); + BlendState1DInstance(const BlendState1D* blendState, ArtboardInstance* instance); void advance(float seconds, SMIInput** inputs) override; }; } // namespace rive
diff --git a/include/rive/animation/blend_state_direct.hpp b/include/rive/animation/blend_state_direct.hpp index 5562221..fd8f120 100644 --- a/include/rive/animation/blend_state_direct.hpp +++ b/include/rive/animation/blend_state_direct.hpp
@@ -5,7 +5,7 @@ namespace rive { class BlendStateDirect : public BlendStateDirectBase { public: - StateInstance* makeInstance(Artboard*) const override; + StateInstance* makeInstance(ArtboardInstance*) const override; }; } // namespace rive
diff --git a/include/rive/animation/blend_state_direct_instance.hpp b/include/rive/animation/blend_state_direct_instance.hpp index fd90681..03b6a54 100644 --- a/include/rive/animation/blend_state_direct_instance.hpp +++ b/include/rive/animation/blend_state_direct_instance.hpp
@@ -9,7 +9,7 @@ class BlendStateDirectInstance : public BlendStateInstance<BlendStateDirect, BlendAnimationDirect> { public: - BlendStateDirectInstance(const BlendStateDirect* blendState, Artboard* instance); + BlendStateDirectInstance(const BlendStateDirect* blendState, ArtboardInstance* instance); void advance(float seconds, SMIInput** inputs) override; }; } // namespace rive
diff --git a/include/rive/animation/blend_state_instance.hpp b/include/rive/animation/blend_state_instance.hpp index fe43e18..6847d0a 100644 --- a/include/rive/animation/blend_state_instance.hpp +++ b/include/rive/animation/blend_state_instance.hpp
@@ -37,7 +37,7 @@ bool m_KeepGoing = true; public: - BlendStateInstance(const K* blendState, Artboard* instance) : StateInstance(blendState) { + BlendStateInstance(const K* blendState, ArtboardInstance* instance) : StateInstance(blendState) { for (auto blendAnimation : blendState->animations()) { m_AnimationInstances.emplace_back( BlendStateAnimationInstance<T>(static_cast<T*>(blendAnimation), instance));
diff --git a/include/rive/animation/layer_state.hpp b/include/rive/animation/layer_state.hpp index 793947a..e957f9e 100644 --- a/include/rive/animation/layer_state.hpp +++ b/include/rive/animation/layer_state.hpp
@@ -5,7 +5,7 @@ #include <vector> namespace rive { - class Artboard; + class ArtboardInstance; class StateTransition; class LayerStateImporter; class StateMachineLayerImporter; @@ -36,7 +36,7 @@ /// Make an instance of this state that can be advanced and applied by /// the state machine when it is active or being transitioned from. - virtual StateInstance* makeInstance(Artboard* instance) const; + virtual StateInstance* makeInstance(ArtboardInstance* instance) const; }; } // namespace rive
diff --git a/include/rive/animation/state_instance.hpp b/include/rive/animation/state_instance.hpp index df9f1e8..f2d1dca 100644 --- a/include/rive/animation/state_instance.hpp +++ b/include/rive/animation/state_instance.hpp
@@ -7,7 +7,7 @@ namespace rive { class LayerState; class SMIInput; - class Artboard; + class ArtboardInstance; /// Represents an instance of a state tracked by the State Machine. class StateInstance {
diff --git a/include/rive/animation/state_machine_instance.hpp b/include/rive/animation/state_machine_instance.hpp index 7e48cbb..e9c8c33 100644 --- a/include/rive/animation/state_machine_instance.hpp +++ b/include/rive/animation/state_machine_instance.hpp
@@ -9,7 +9,7 @@ class StateMachine; class LayerState; class SMIInput; - class Artboard; + class ArtboardInstance; class SMIBool; class SMINumber; class SMITrigger; @@ -21,7 +21,7 @@ private: const StateMachine* m_Machine; - Artboard* m_ArtboardInstance; + ArtboardInstance* m_ArtboardInstance; bool m_NeedsAdvance = false; size_t m_InputCount; @@ -32,7 +32,7 @@ void markNeedsAdvance(); public: - StateMachineInstance(const StateMachine* machine, Artboard* instance); + StateMachineInstance(const StateMachine* machine, ArtboardInstance* instance); ~StateMachineInstance(); // Advance the state machine by the specified time. Returns true if the
diff --git a/include/rive/animation/system_state_instance.hpp b/include/rive/animation/system_state_instance.hpp index 2cc70ef..c0f76a3 100644 --- a/include/rive/animation/system_state_instance.hpp +++ b/include/rive/animation/system_state_instance.hpp
@@ -10,7 +10,7 @@ /// just a no-op state (perhaps an unknown to this runtime state-type). class SystemStateInstance : public StateInstance { public: - SystemStateInstance(const LayerState* layerState, Artboard* instance); + SystemStateInstance(const LayerState* layerState, ArtboardInstance* instance); void advance(float seconds, SMIInput** inputs) override; void apply(float mix) override;
diff --git a/src/animation/animation_state.cpp b/src/animation/animation_state.cpp index ceb701d..c279289 100644 --- a/src/animation/animation_state.cpp +++ b/src/animation/animation_state.cpp
@@ -7,7 +7,7 @@ using namespace rive; -StateInstance* AnimationState::makeInstance(Artboard* instance) const { +StateInstance* AnimationState::makeInstance(ArtboardInstance* instance) const { if (animation() == nullptr) { // Failed to load at runtime/some new type we don't understand. return new SystemStateInstance(this, instance);
diff --git a/src/animation/animation_state_instance.cpp b/src/animation/animation_state_instance.cpp index 3303d4f..d3a7c25 100644 --- a/src/animation/animation_state_instance.cpp +++ b/src/animation/animation_state_instance.cpp
@@ -4,7 +4,7 @@ using namespace rive; AnimationStateInstance::AnimationStateInstance(const AnimationState* state, - Artboard* instance) : + ArtboardInstance* instance) : StateInstance(state), m_AnimationInstance(state->animation(), instance), m_KeepGoing(true)
diff --git a/src/animation/blend_state_1d.cpp b/src/animation/blend_state_1d.cpp index 778fe9b..3399c6e 100644 --- a/src/animation/blend_state_1d.cpp +++ b/src/animation/blend_state_1d.cpp
@@ -6,7 +6,7 @@ using namespace rive; -StateInstance* BlendState1D::makeInstance(Artboard* instance) const { +StateInstance* BlendState1D::makeInstance(ArtboardInstance* instance) const { return new BlendState1DInstance(this, instance); }
diff --git a/src/animation/blend_state_1d_instance.cpp b/src/animation/blend_state_1d_instance.cpp index 4bb4408..2f6227b 100644 --- a/src/animation/blend_state_1d_instance.cpp +++ b/src/animation/blend_state_1d_instance.cpp
@@ -3,7 +3,7 @@ using namespace rive; -BlendState1DInstance::BlendState1DInstance(const BlendState1D* blendState, Artboard* instance) : +BlendState1DInstance::BlendState1DInstance(const BlendState1D* blendState, ArtboardInstance* instance) : BlendStateInstance<BlendState1D, BlendAnimation1D>(blendState, instance) {} int BlendState1DInstance::animationIndex(float value) {
diff --git a/src/animation/blend_state_direct.cpp b/src/animation/blend_state_direct.cpp index 2879b4c..cc421ac 100644 --- a/src/animation/blend_state_direct.cpp +++ b/src/animation/blend_state_direct.cpp
@@ -6,6 +6,6 @@ using namespace rive; -StateInstance* BlendStateDirect::makeInstance(Artboard* instance) const { +StateInstance* BlendStateDirect::makeInstance(ArtboardInstance* instance) const { return new BlendStateDirectInstance(this, instance); } \ No newline at end of file
diff --git a/src/animation/blend_state_direct_instance.cpp b/src/animation/blend_state_direct_instance.cpp index 77c1c2f..04dd036 100644 --- a/src/animation/blend_state_direct_instance.cpp +++ b/src/animation/blend_state_direct_instance.cpp
@@ -3,7 +3,7 @@ using namespace rive; -BlendStateDirectInstance::BlendStateDirectInstance(const BlendStateDirect* blendState, Artboard* instance) : +BlendStateDirectInstance::BlendStateDirectInstance(const BlendStateDirect* blendState, ArtboardInstance* instance) : BlendStateInstance<BlendStateDirect, BlendAnimationDirect>(blendState, instance) {} void BlendStateDirectInstance::advance(float seconds, SMIInput** inputs) {
diff --git a/src/animation/layer_state.cpp b/src/animation/layer_state.cpp index 7fce2d8..42327ac 100644 --- a/src/animation/layer_state.cpp +++ b/src/animation/layer_state.cpp
@@ -46,6 +46,6 @@ void LayerState::addTransition(StateTransition* transition) { m_Transitions.push_back(transition); } -StateInstance* LayerState::makeInstance(Artboard* instance) const { +StateInstance* LayerState::makeInstance(ArtboardInstance* instance) const { return new SystemStateInstance(this, instance); } \ No newline at end of file
diff --git a/src/animation/state_machine_instance.cpp b/src/animation/state_machine_instance.cpp index 6ece00f..928ad49 100644 --- a/src/animation/state_machine_instance.cpp +++ b/src/animation/state_machine_instance.cpp
@@ -20,7 +20,7 @@ private: static const int maxIterations = 100; const StateMachineLayer* m_Layer = nullptr; - Artboard* m_ArtboardInstance = nullptr; + ArtboardInstance* m_ArtboardInstance = nullptr; StateInstance* m_AnyStateInstance = nullptr; StateInstance* m_CurrentState = nullptr; @@ -49,7 +49,7 @@ delete m_StateFrom; } - void init(const StateMachineLayer* layer, Artboard* instance) { + void init(const StateMachineLayer* layer, ArtboardInstance* instance) { m_ArtboardInstance = instance; assert(m_Layer == nullptr); m_AnyStateInstance = layer->anyState()->makeInstance(instance); @@ -215,7 +215,7 @@ }; } // namespace rive -StateMachineInstance::StateMachineInstance(const StateMachine* machine, Artboard* instance) +StateMachineInstance::StateMachineInstance(const StateMachine* machine, ArtboardInstance* instance) : m_Machine(machine) , m_ArtboardInstance(instance) {
diff --git a/src/animation/system_state_instance.cpp b/src/animation/system_state_instance.cpp index 957ac18..50906a5 100644 --- a/src/animation/system_state_instance.cpp +++ b/src/animation/system_state_instance.cpp
@@ -1,7 +1,7 @@ #include "rive/animation/system_state_instance.hpp" using namespace rive; -SystemStateInstance::SystemStateInstance(const LayerState* layerState, Artboard* instance) : +SystemStateInstance::SystemStateInstance(const LayerState* layerState, ArtboardInstance* instance) : StateInstance(layerState) {} void SystemStateInstance::advance(float seconds, SMIInput** inputs) {}
diff --git a/src/artboard.cpp b/src/artboard.cpp index 7402623..940b835 100644 --- a/src/artboard.cpp +++ b/src/artboard.cpp
@@ -537,6 +537,7 @@ artboardClone->m_IsInstance = true; } + assert(artboardClone->isInstance()); return artboardClone; }