blob: e6ee064937490a676012e0ce26ee347533f44844 [file]
#include "rive/nested_animation.hpp"
#include "rive/container_component.hpp"
#include "rive/nested_artboard.hpp"
#include "rive/core_context.hpp"
using namespace rive;
bool NestedAnimation::validate(CoreContext* context)
{
if (!Super::validate(context))
{
return false;
}
auto parentObject = context->resolve(parentId());
// We know parentObject is not null from Super::validate().
return parentObject->is<NestedArtboard>();
}
StatusCode NestedAnimation::onAddedDirty(CoreContext* context)
{
StatusCode code = Super::onAddedDirty(context);
#ifndef WITH_RIVE_EDITOR
// Runtime-only: importer guarantees parent is a NestedArtboard.
// Editor build registers via editorParentChanged (Pass 4.5).
if (code == StatusCode::Ok)
{
auto nestedArtboard = parent()->as<NestedArtboard>();
nestedArtboard->addNestedAnimation(this);
}
#endif
return code;
}