Cleanup based on feedback in PR.
diff --git a/include/rive/nested_artboard.hpp b/include/rive/nested_artboard.hpp index 1fdc746..1025d7f 100644 --- a/include/rive/nested_artboard.hpp +++ b/include/rive/nested_artboard.hpp
@@ -3,6 +3,7 @@ #include "rive/generated/nested_artboard_base.hpp" #include "rive/hit_info.hpp" +#include "rive/span.hpp" #include <stdio.h> namespace rive { @@ -11,8 +12,8 @@ class NestedArtboard : public NestedArtboardBase { private: - Artboard* m_Artboard = nullptr; // might point to m_Instance, and might not - std::unique_ptr<ArtboardInstance> m_Instance; // may be null + Artboard* m_Artboard = nullptr; // might point to m_Instance, and might not + std::unique_ptr<ArtboardInstance> m_Instance; // may be null std::vector<NestedAnimation*> m_NestedAnimations; public: @@ -31,7 +32,7 @@ void update(ComponentDirt value) override; bool hasNestedStateMachines() const; - const std::vector<NestedAnimation*>& nestedAnimations() const; + Span<NestedAnimation*> nestedAnimations(); /// Convert a world space (relative to the artboard that this /// NestedArtboard is a child of) to the local space of the Artboard
diff --git a/src/animation/state_machine_instance.cpp b/src/animation/state_machine_instance.cpp index 7d22aae..662bef0 100644 --- a/src/animation/state_machine_instance.cpp +++ b/src/animation/state_machine_instance.cpp
@@ -291,11 +291,7 @@ // Mounted artboard isn't ready or has a 0 scale transform. continue; } - // var nestedPosition = nestedArtboard.worldToLocal(position); - // if (nestedPosition == null) { - // // Mounted artboard isn't ready or has a 0 scale transform. - // continue; - // } + for (auto nestedAnimation : nestedArtboard->nestedAnimations()) { if (nestedAnimation->is<NestedStateMachine>()) { auto nestedStateMachine = nestedAnimation->as<NestedStateMachine>();
diff --git a/src/nested_artboard.cpp b/src/nested_artboard.cpp index 0e26962..bbd543d 100644 --- a/src/nested_artboard.cpp +++ b/src/nested_artboard.cpp
@@ -123,9 +123,7 @@ return false; } -const std::vector<NestedAnimation*>& NestedArtboard::nestedAnimations() const { - return m_NestedAnimations; -} +Span<NestedAnimation*> NestedArtboard::nestedAnimations() { return toSpan(m_NestedAnimations); } bool NestedArtboard::worldToLocal(Vec2D world, Vec2D* local) { assert(local != nullptr);