Use AnimationInstance as a type where needed
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..d75cca9 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*, ArtboardInstance*);
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..866b524 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*, ArtboardInstance*);
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..d85dc5c 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*, ArtboardInstance*);
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..f011ab5 100644
--- a/include/rive/animation/blend_state_instance.hpp
+++ b/include/rive/animation/blend_state_instance.hpp
@@ -23,9 +23,9 @@
const T* blendAnimation() const { return m_BlendAnimation; }
const LinearAnimationInstance* animationInstance() const { return &m_AnimationInstance; }
- BlendStateAnimationInstance(const T* blendAnimation, Artboard* instance) :
+ BlendStateAnimationInstance(const T* blendAnimation, ArtboardInstance* artboard) :
m_BlendAnimation(blendAnimation),
- m_AnimationInstance(blendAnimation->animation(), instance)
+ m_AnimationInstance(blendAnimation->animation(), artboard)
{}
void mix(float value) { m_Mix = value; }
@@ -37,10 +37,10 @@
bool m_KeepGoing = true;
public:
- BlendStateInstance(const K* blendState, Artboard* instance) : StateInstance(blendState) {
+ BlendStateInstance(const K* blendState, ArtboardInstance* artboard) : StateInstance(blendState) {
for (auto blendAnimation : blendState->animations()) {
m_AnimationInstances.emplace_back(
- BlendStateAnimationInstance<T>(static_cast<T*>(blendAnimation), instance));
+ BlendStateAnimationInstance<T>(static_cast<T*>(blendAnimation), artboard));
}
}
diff --git a/include/rive/animation/layer_state.hpp b/include/rive/animation/layer_state.hpp
index 793947a..f2086f0 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*) const;
};
} // namespace rive
diff --git a/include/rive/animation/linear_animation_instance.hpp b/include/rive/animation/linear_animation_instance.hpp
index a1ec2ab..8eefb87 100644
--- a/include/rive/animation/linear_animation_instance.hpp
+++ b/include/rive/animation/linear_animation_instance.hpp
@@ -8,7 +8,7 @@
class LinearAnimationInstance {
private:
const LinearAnimation* m_Animation = nullptr;
- Artboard* m_ArtboardInstance;
+ ArtboardInstance* m_ArtboardInstance;
float m_Time;
float m_TotalTime;
float m_LastTotalTime;
@@ -18,7 +18,7 @@
int m_LoopValue = -1;
public:
- LinearAnimationInstance(const LinearAnimation*, Artboard* instance);
+ LinearAnimationInstance(const LinearAnimation*, ArtboardInstance*);
// Advance the animation by the specified time. Returns true if the
// animation will continue to animate after this advance.
diff --git a/include/rive/animation/nested_linear_animation.hpp b/include/rive/animation/nested_linear_animation.hpp
index 7940c51..9481350 100644
--- a/include/rive/animation/nested_linear_animation.hpp
+++ b/include/rive/animation/nested_linear_animation.hpp
@@ -3,6 +3,7 @@
#include "rive/generated/animation/nested_linear_animation_base.hpp"
#include <stdio.h>
namespace rive {
+ class ArtboardInstance;
class LinearAnimationInstance;
class NestedLinearAnimation : public NestedLinearAnimationBase {
protected:
@@ -11,7 +12,7 @@
public:
~NestedLinearAnimation();
- void initializeAnimation(Artboard* artboard) override;
+ void initializeAnimation(ArtboardInstance*) override;
};
} // namespace rive
diff --git a/include/rive/animation/nested_remap_animation.hpp b/include/rive/animation/nested_remap_animation.hpp
index 9303572..f71c229 100644
--- a/include/rive/animation/nested_remap_animation.hpp
+++ b/include/rive/animation/nested_remap_animation.hpp
@@ -7,7 +7,7 @@
public:
void timeChanged() override;
void advance(float elapsedSeconds) override;
- void initializeAnimation(Artboard* artboard) override;
+ void initializeAnimation(ArtboardInstance*) override;
};
} // namespace rive
diff --git a/include/rive/animation/nested_state_machine.hpp b/include/rive/animation/nested_state_machine.hpp
index d96c07b..5e7caf6 100644
--- a/include/rive/animation/nested_state_machine.hpp
+++ b/include/rive/animation/nested_state_machine.hpp
@@ -6,7 +6,7 @@
class NestedStateMachine : public NestedStateMachineBase {
public:
void advance(float elapsedSeconds) override;
- void initializeAnimation(Artboard* artboard) override;
+ void initializeAnimation(ArtboardInstance*) override;
};
} // namespace rive
diff --git a/include/rive/animation/state_machine_instance.hpp b/include/rive/animation/state_machine_instance.hpp
index 7e48cbb..5c7f1bc 100644
--- a/include/rive/animation/state_machine_instance.hpp
+++ b/include/rive/animation/state_machine_instance.hpp
@@ -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*);
~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..d72f844 100644
--- a/include/rive/animation/system_state_instance.hpp
+++ b/include/rive/animation/system_state_instance.hpp
@@ -5,12 +5,14 @@
#include "rive/animation/state_instance.hpp"
namespace rive {
+ class ArtboardInstance;
+
/// Represents an instance of a system state machine. Basically a
/// placeholder that may have meaning to the state machine itself, or is
/// 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*, ArtboardInstance*);
void advance(float seconds, SMIInput** inputs) override;
void apply(float mix) override;
diff --git a/include/rive/nested_animation.hpp b/include/rive/nested_animation.hpp
index bbc0a87..1f4491b 100644
--- a/include/rive/nested_animation.hpp
+++ b/include/rive/nested_animation.hpp
@@ -3,6 +3,8 @@
#include "rive/generated/nested_animation_base.hpp"
#include <stdio.h>
namespace rive {
+ class ArtboardInstance;
+
class NestedAnimation : public NestedAnimationBase {
public:
StatusCode onAddedDirty(CoreContext* context) override;
@@ -12,7 +14,7 @@
// Initialize the animation (make instances as necessary) from the
// source artboard.
- virtual void initializeAnimation(Artboard* artboard) = 0;
+ virtual void initializeAnimation(ArtboardInstance*) = 0;
};
} // namespace rive
diff --git a/src/animation/animation_state.cpp b/src/animation/animation_state.cpp
index ceb701d..ee60a9c 100644
--- a/src/animation/animation_state.cpp
+++ b/src/animation/animation_state.cpp
@@ -7,10 +7,10 @@
using namespace rive;
-StateInstance* AnimationState::makeInstance(Artboard* instance) const {
+StateInstance* AnimationState::makeInstance(ArtboardInstance* artboard) const {
if (animation() == nullptr) {
// Failed to load at runtime/some new type we don't understand.
- return new SystemStateInstance(this, instance);
+ return new SystemStateInstance(this, artboard);
}
- return new AnimationStateInstance(this, instance);
+ return new AnimationStateInstance(this, artboard);
}
\ No newline at end of file
diff --git a/src/animation/animation_state_instance.cpp b/src/animation/animation_state_instance.cpp
index 3303d4f..32fa598 100644
--- a/src/animation/animation_state_instance.cpp
+++ b/src/animation/animation_state_instance.cpp
@@ -4,9 +4,9 @@
using namespace rive;
AnimationStateInstance::AnimationStateInstance(const AnimationState* state,
- Artboard* instance) :
+ ArtboardInstance* artboard) :
StateInstance(state),
- m_AnimationInstance(state->animation(), instance),
+ m_AnimationInstance(state->animation(), artboard),
m_KeepGoing(true)
{}
diff --git a/src/animation/blend_state_1d.cpp b/src/animation/blend_state_1d.cpp
index 778fe9b..0f0043f 100644
--- a/src/animation/blend_state_1d.cpp
+++ b/src/animation/blend_state_1d.cpp
@@ -6,8 +6,8 @@
using namespace rive;
-StateInstance* BlendState1D::makeInstance(Artboard* instance) const {
- return new BlendState1DInstance(this, instance);
+StateInstance* BlendState1D::makeInstance(ArtboardInstance* artboard) const {
+ return new BlendState1DInstance(this, artboard);
}
StatusCode BlendState1D::import(ImportStack& importStack) {
diff --git a/src/animation/blend_state_1d_instance.cpp b/src/animation/blend_state_1d_instance.cpp
index 4bb4408..d0ac304 100644
--- a/src/animation/blend_state_1d_instance.cpp
+++ b/src/animation/blend_state_1d_instance.cpp
@@ -3,8 +3,8 @@
using namespace rive;
-BlendState1DInstance::BlendState1DInstance(const BlendState1D* blendState, Artboard* instance) :
- BlendStateInstance<BlendState1D, BlendAnimation1D>(blendState, instance) {}
+BlendState1DInstance::BlendState1DInstance(const BlendState1D* blendState, ArtboardInstance* artboard) :
+ BlendStateInstance<BlendState1D, BlendAnimation1D>(blendState, artboard) {}
int BlendState1DInstance::animationIndex(float value) {
int idx = 0;
diff --git a/src/animation/blend_state_direct.cpp b/src/animation/blend_state_direct.cpp
index 2879b4c..9830c83 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 {
- return new BlendStateDirectInstance(this, instance);
+StateInstance* BlendStateDirect::makeInstance(ArtboardInstance* artboard) const {
+ return new BlendStateDirectInstance(this, artboard);
}
\ 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..062698e 100644
--- a/src/animation/blend_state_direct_instance.cpp
+++ b/src/animation/blend_state_direct_instance.cpp
@@ -3,8 +3,8 @@
using namespace rive;
-BlendStateDirectInstance::BlendStateDirectInstance(const BlendStateDirect* blendState, Artboard* instance) :
- BlendStateInstance<BlendStateDirect, BlendAnimationDirect>(blendState, instance) {}
+BlendStateDirectInstance::BlendStateDirectInstance(const BlendStateDirect* blendState, ArtboardInstance* artboard) :
+ BlendStateInstance<BlendStateDirect, BlendAnimationDirect>(blendState, artboard) {}
void BlendStateDirectInstance::advance(float seconds, SMIInput** inputs) {
BlendStateInstance<BlendStateDirect, BlendAnimationDirect>::advance(seconds, inputs);
diff --git a/src/animation/layer_state.cpp b/src/animation/layer_state.cpp
index 7fce2d8..e6e9d9a 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 {
- return new SystemStateInstance(this, instance);
+StateInstance* LayerState::makeInstance(ArtboardInstance* artboard) const {
+ return new SystemStateInstance(this, artboard);
}
\ No newline at end of file
diff --git a/src/animation/linear_animation_instance.cpp b/src/animation/linear_animation_instance.cpp
index f781cc2..a754993 100644
--- a/src/animation/linear_animation_instance.cpp
+++ b/src/animation/linear_animation_instance.cpp
@@ -6,9 +6,9 @@
using namespace rive;
LinearAnimationInstance::LinearAnimationInstance(const LinearAnimation* animation,
- Artboard* instance) :
+ ArtboardInstance* artboard) :
m_Animation(animation),
- m_ArtboardInstance(instance),
+ m_ArtboardInstance(artboard),
m_Time(animation->enableWorkArea() ? (float)animation->workStart() / animation->fps() : 0),
m_TotalTime(0.0f),
m_LastTotalTime(0.0f),
diff --git a/src/animation/nested_linear_animation.cpp b/src/animation/nested_linear_animation.cpp
index 2d418d1..7bfefd4 100644
--- a/src/animation/nested_linear_animation.cpp
+++ b/src/animation/nested_linear_animation.cpp
@@ -5,7 +5,7 @@
NestedLinearAnimation::~NestedLinearAnimation() { delete m_AnimationInstance; }
-void NestedLinearAnimation::initializeAnimation(Artboard* artboard) {
+void NestedLinearAnimation::initializeAnimation(ArtboardInstance* artboard) {
assert(m_AnimationInstance == nullptr);
m_AnimationInstance = new LinearAnimationInstance(artboard->animation(animationId()), artboard);
}
\ No newline at end of file
diff --git a/src/animation/nested_remap_animation.cpp b/src/animation/nested_remap_animation.cpp
index fd146eb..2af1522 100644
--- a/src/animation/nested_remap_animation.cpp
+++ b/src/animation/nested_remap_animation.cpp
@@ -10,7 +10,7 @@
}
}
-void NestedRemapAnimation::initializeAnimation(Artboard* artboard) {
+void NestedRemapAnimation::initializeAnimation(ArtboardInstance* artboard) {
Super::initializeAnimation(artboard);
timeChanged();
}
diff --git a/src/animation/nested_state_machine.cpp b/src/animation/nested_state_machine.cpp
index 2b3ad7c..139572a 100644
--- a/src/animation/nested_state_machine.cpp
+++ b/src/animation/nested_state_machine.cpp
@@ -4,4 +4,4 @@
void NestedStateMachine::advance(float elapsedSeconds) {}
-void NestedStateMachine::initializeAnimation(Artboard* artboard) {}
\ No newline at end of file
+void NestedStateMachine::initializeAnimation(ArtboardInstance*) {}
\ No newline at end of file
diff --git a/src/animation/state_machine_instance.cpp b/src/animation/state_machine_instance.cpp
index 6ece00f..1239044 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,10 +49,10 @@
delete m_StateFrom;
}
- void init(const StateMachineLayer* layer, Artboard* instance) {
- m_ArtboardInstance = instance;
+ void init(const StateMachineLayer* layer, ArtboardInstance* artboard) {
+ m_ArtboardInstance = artboard;
assert(m_Layer == nullptr);
- m_AnyStateInstance = layer->anyState()->makeInstance(instance);
+ m_AnyStateInstance = layer->anyState()->makeInstance(artboard);
m_Layer = layer;
changeState(m_Layer->entryState());
}
@@ -215,11 +215,11 @@
};
} // namespace rive
-StateMachineInstance::StateMachineInstance(const StateMachine* machine, Artboard* instance)
+StateMachineInstance::StateMachineInstance(const StateMachine* machine, ArtboardInstance* artboard)
: m_Machine(machine)
- , m_ArtboardInstance(instance)
+ , m_ArtboardInstance(artboard)
{
- assert(instance->isInstance());
+ assert(artboard->isInstance());
m_InputCount = machine->inputCount();
m_InputInstances = new SMIInput*[m_InputCount];
for (size_t i = 0; i < m_InputCount; i++) {
diff --git a/src/animation/system_state_instance.cpp b/src/animation/system_state_instance.cpp
index 957ac18..0d97784 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*) :
StateInstance(layerState) {}
void SystemStateInstance::advance(float seconds, SMIInput** inputs) {}