Merge remote-tracking branch 'origin/master' into 1.10

This commit is contained in:
Wojtek Figat
2025-02-24 23:27:56 +01:00
89 changed files with 6155 additions and 1832 deletions

View File

@@ -27,6 +27,7 @@ class AnimationsSystem : public TaskGraphSystem
{
public:
float DeltaTime, UnscaledDeltaTime, Time, UnscaledTime;
bool Active;
void Job(int32 index);
void Execute(TaskGraph* graph) override;
@@ -51,6 +52,7 @@ namespace
AnimationsService AnimationManagerInstance;
TaskGraphSystem* Animations::System = nullptr;
ConcurrentSystemLocker Animations::SystemLocker;
#if USE_EDITOR
Delegate<Animations::DebugFlowInfo> Animations::DebugFlow;
#endif
@@ -116,6 +118,10 @@ void AnimationsSystem::Execute(TaskGraph* graph)
{
if (AnimationManagerInstance.UpdateList.Count() == 0)
return;
Active = true;
// Ensure no animation assets can be reloaded/modified during async update
Animations::SystemLocker.Begin(false);
// Setup data for async update
const auto& tickData = Time::Update;
@@ -138,6 +144,8 @@ void AnimationsSystem::Execute(TaskGraph* graph)
void AnimationsSystem::PostExecute(TaskGraph* graph)
{
if (!Active)
return;
PROFILE_CPU_NAMED("Animations.PostExecute");
// Update gameplay
@@ -153,6 +161,8 @@ void AnimationsSystem::PostExecute(TaskGraph* graph)
// Cleanup
AnimationManagerInstance.UpdateList.Clear();
Animations::SystemLocker.End(false);
Active = false;
}
void Animations::AddToUpdate(AnimatedModel* obj)

View File

@@ -4,6 +4,7 @@
#include "Engine/Scripting/ScriptingType.h"
#include "Engine/Core/Delegate.h"
#include "Engine/Threading/ConcurrentSystemLocker.h"
class TaskGraphSystem;
class AnimatedModel;
@@ -21,6 +22,9 @@ API_CLASS(Static) class FLAXENGINE_API Animations
/// </summary>
API_FIELD(ReadOnly) static TaskGraphSystem* System;
// Data access locker for animations data.
static ConcurrentSystemLocker SystemLocker;
#if USE_EDITOR
// Data wrapper for the debug flow information.
API_STRUCT(NoDefault) struct DebugFlowInfo