Fix build

This commit is contained in:
Wojtek Figat
2023-09-10 10:25:03 +02:00
parent 6a5e660c2e
commit 8a31a63713
2 changed files with 19 additions and 15 deletions

View File

@@ -12,6 +12,8 @@
class AnimationsService : public EngineService
{
public:
Array<AnimatedModel*> UpdateList;
AnimationsService()
: EngineService(TEXT("Animations"), -10)
{
@@ -25,6 +27,7 @@ class AnimationsSystem : public TaskGraphSystem
{
public:
float DeltaTime, UnscaledDeltaTime, Time, UnscaledTime;
void Job(int32 index);
void Execute(TaskGraph* graph) override;
void PostExecute(TaskGraph* graph) override;
@@ -47,7 +50,6 @@ namespace
}
AnimationsService AnimationManagerInstance;
Array<AnimatedModel*> UpdateList;
TaskGraphSystem* Animations::System = nullptr;
#if USE_EDITOR
Delegate<Asset*, ScriptingObject*, uint32, uint32> Animations::DebugFlow;
@@ -79,7 +81,7 @@ void AnimationsService::Dispose()
void AnimationsSystem::Job(int32 index)
{
PROFILE_CPU_NAMED("Animations.Job");
auto animatedModel = UpdateList[index];
auto animatedModel = AnimationManagerInstance.UpdateList[index];
if (CanUpdateModel(animatedModel))
{
auto graph = animatedModel->AnimationGraph.Get();
@@ -112,7 +114,7 @@ void AnimationsSystem::Job(int32 index)
void AnimationsSystem::Execute(TaskGraph* graph)
{
if (UpdateList.Count() == 0)
if (AnimationManagerInstance.UpdateList.Count() == 0)
return;
// Setup data for async update
@@ -131,7 +133,7 @@ void AnimationsSystem::Execute(TaskGraph* graph)
// Schedule work to update all animated models in async
Function<void(int32)> job;
job.Bind<AnimationsSystem, &AnimationsSystem::Job>(this);
graph->DispatchJob(job, UpdateList.Count());
graph->DispatchJob(job, AnimationManagerInstance.UpdateList.Count());
}
void AnimationsSystem::PostExecute(TaskGraph* graph)
@@ -139,9 +141,9 @@ void AnimationsSystem::PostExecute(TaskGraph* graph)
PROFILE_CPU_NAMED("Animations.PostExecute");
// Update gameplay
for (int32 index = 0; index < UpdateList.Count(); index++)
for (int32 index = 0; index < AnimationManagerInstance.UpdateList.Count(); index++)
{
auto animatedModel = UpdateList[index];
auto animatedModel = AnimationManagerInstance.UpdateList[index];
if (CanUpdateModel(animatedModel))
{
animatedModel->OnAnimationUpdated_Sync();
@@ -149,15 +151,15 @@ void AnimationsSystem::PostExecute(TaskGraph* graph)
}
// Cleanup
UpdateList.Clear();
AnimationManagerInstance.UpdateList.Clear();
}
void Animations::AddToUpdate(AnimatedModel* obj)
{
UpdateList.Add(obj);
AnimationManagerInstance.UpdateList.Add(obj);
}
void Animations::RemoveFromUpdate(AnimatedModel* obj)
{
UpdateList.Remove(obj);
AnimationManagerInstance.UpdateList.Remove(obj);
}