#include "DataModel/AnimationController.hpp" #include "DataModel/Workspace.hpp" #include "DataModel/PartInstance.hpp" #include "DataModel/Animator.hpp" #include "World/World.hpp" #include "Tree/Service.hpp" #include "Kernel/Constants.hpp" #include "Players.hpp" namespace Aya { const char* const sAnimationController = "AnimationController"; static Reflection::BoundFuncDesc()> desc_GetPlayingAnimationTracks( &AnimationController::getPlayingAnimationTracks, "GetPlayingAnimationTracks", Security::None); static Reflection::BoundFuncDesc(shared_ptr)> desc_LoadAnimation( &AnimationController::loadAnimation, "LoadAnimation", "animation", Security::None); static Reflection::EventDesc)> event_AnimationPlayed( &AnimationController::animationPlayedSignal, "AnimationPlayed", "animationTrack"); REFLECTION_END(); AnimationController::AnimationController() { setName("AnimationController"); FASTLOG1(FLog::ISteppedLifetime, "AnimationController created - %p", this); } AnimationController::~AnimationController() { FASTLOG1(FLog::ISteppedLifetime, "AnimationController destroyed - %p", this); } bool AnimationController::askSetParent(const Instance* instance) const { return true; } void AnimationController::onStepped(const Stepped& event) { if (animator) { animator->onStepped(event); } } Animator* AnimationController::getAnimator() { if (!animator) { animator = shared_ptr(Creatable::create(this)); if (getParent() && getParent()->getClassNameStr() == "Model") animator->setParent(this); } return animator.get(); } shared_ptr AnimationController::getPlayingAnimationTracks() { return getAnimator()->getPlayingAnimationTracks(); } shared_ptr AnimationController::loadAnimation(shared_ptr instance) { return getAnimator()->loadAnimation(instance); } void AnimationController::onServiceProvider(ServiceProvider* oldProvider, ServiceProvider* newProvider) { Super::onServiceProvider(oldProvider, newProvider); onServiceProviderIStepped(oldProvider, newProvider); } } // namespace Aya