diff --git a/.rive_head b/.rive_head index fb10e0bc..6dd81aad 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -b03d365c93d0d52f0f05ae598deacbf7dd330a53 +90da85fbb4151a7a4a1c30cf2f6738929debe925 diff --git a/include/rive/container_component.hpp b/include/rive/container_component.hpp index 04cf246a..7fd590eb 100644 --- a/include/rive/container_component.hpp +++ b/include/rive/container_component.hpp @@ -13,10 +13,12 @@ class ContainerComponent : public ContainerComponentBase virtual void addChild(Component* component); bool collapse(bool value) override; - // Returns true if it searched through all of its children. predicate can - // return false to stop searching. + // Returns whether predicate returns true for the current Component. bool forAll(std::function predicate); - bool forEachChild(std::function predicate); + + // Recursively descend onto all the children in the hierarchy tree. + // If predicate returns false, it won't recurse down a particular branch. + void forEachChild(std::function predicate); private: std::vector m_children; diff --git a/src/animation/state_machine_instance.cpp b/src/animation/state_machine_instance.cpp index 6149b928..8d02ee34 100644 --- a/src/animation/state_machine_instance.cpp +++ b/src/animation/state_machine_instance.cpp @@ -1220,7 +1220,7 @@ void StateMachineInstance::addToHitLookup( hitLookup, listenerGroup, isOpaque); - return true; + return false; }); return; } diff --git a/src/container_component.cpp b/src/container_component.cpp index a018b2e2..4808c362 100644 --- a/src/container_component.cpp +++ b/src/container_component.cpp @@ -29,19 +29,17 @@ bool ContainerComponent::forAll(std::function predicate) return true; } -bool ContainerComponent::forEachChild(std::function predicate) +void ContainerComponent::forEachChild(std::function predicate) { for (Component* child : m_children) { if (!predicate(child)) { - return false; + continue; } - if (child->is() && - !child->as()->forEachChild(predicate)) + if (child->is()) { - return false; + child->as()->forEachChild(predicate); } } - return true; } \ No newline at end of file