/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #include "JackGraphFixture.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace EMotionFX { void JackGraphFixture::SetUp() { SystemComponentFixture::SetUp(); m_actor = ActorFactory::CreateAndInit(); OnPostActorCreated(); m_actorInstance = ActorInstance::Create(m_actor.get()); m_motionSet = aznew MotionSet("motionSet"); ConstructGraph(); m_animGraph->InitAfterLoading(); m_animGraphInstance = AnimGraphInstance::Create(m_animGraph.get(), m_actorInstance, m_motionSet); m_actorInstance->SetAnimGraphInstance(m_animGraphInstance); m_animGraphInstance->IncreaseReferenceCount(); // Two owners now, the test and the actor instance m_animGraphInstance->RecursiveInvalidateUniqueDatas(); } void JackGraphFixture::ConstructGraph() { m_animGraph = AnimGraphFactory::Create(); } void JackGraphFixture::TearDown() { if (m_animGraphInstance) { m_animGraphInstance->Destroy(); m_animGraphInstance = nullptr; } if (m_actorInstance) { m_actorInstance->Destroy(); m_actorInstance = nullptr; } delete m_motionSet; m_motionSet = nullptr; m_animGraph.reset(); SystemComponentFixture::TearDown(); } void JackGraphFixture::Evaluate(float timeDelta) { GetEMotionFX().Update(timeDelta); } void JackGraphFixture::AddValueParameter(const AZ::TypeId& typeId, const AZStd::string& name) { Parameter* parameter = ParameterFactory::Create(typeId); parameter->SetName(name); m_animGraph->AddParameter(parameter); m_animGraphInstance->AddMissingParameterValues(); } } // namespace EMotionFX