You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
This prevents extra updates from occuring when there are multiple runners, because after one updates another one might incorrectly think instantiation changes have occured and need more updates. Generally speaking, any "true" state (i.e. state that carries outside of a single update) needs to be avoided in the ECS runner. #rb ludovic.chabant, andrew.rodham #rb andrew.firth #lockdown andrew.firth #preflight 615c69b58ebc2600019efbe9 #ROBOMERGE-OWNER: marc.audy #ROBOMERGE-AUTHOR: max.chen #ROBOMERGE-SOURCE: CL 17721867 via CL 17979511 via CL 18366808 via CL 18366873 #ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469) [CL 18366947 by marc audy in ue5-release-engine-test branch]
135 lines
3.6 KiB
C++
135 lines
3.6 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "MovieSceneEntityIDs.h"
|
|
#include "MovieSceneSequenceID.h"
|
|
#include "Evaluation/MovieScenePlayback.h"
|
|
//#include "Misc/FrameTime.h"
|
|
//#include "UObject/ObjectKey.h"
|
|
#include "Async/TaskGraphInterfaces.h"
|
|
#include "EntitySystem/MovieSceneEntitySystemTypes.h"
|
|
#include "EntitySystem/MovieSceneSequenceInstance.h"
|
|
|
|
class UMovieSceneEntitySystemLinker;
|
|
|
|
namespace UE {
|
|
namespace MovieScene {
|
|
class FEntityManager;
|
|
struct FInstanceRegistry;
|
|
}
|
|
}
|
|
|
|
DECLARE_MULTICAST_DELEGATE(FMovieSceneEntitySystemEventTriggers);
|
|
|
|
class MOVIESCENE_API FMovieSceneEntitySystemRunner
|
|
{
|
|
public:
|
|
|
|
using FEntityManager = UE::MovieScene::FEntityManager;
|
|
using FInstanceHandle = UE::MovieScene::FInstanceHandle;
|
|
using FInstanceRegistry = UE::MovieScene::FInstanceRegistry;
|
|
|
|
public:
|
|
/** Creates an unbound runner */
|
|
FMovieSceneEntitySystemRunner();
|
|
/** Destructor */
|
|
~FMovieSceneEntitySystemRunner();
|
|
|
|
/** Attach this runner to a linker */
|
|
void AttachToLinker(UMovieSceneEntitySystemLinker* InLinker);
|
|
/** Returns whether this runner is attached to a linker */
|
|
bool IsAttachedToLinker() const;
|
|
/** Detaches this runner from a linker */
|
|
void DetachFromLinker();
|
|
|
|
/** Returns whether this runner has any outstanding updates. */
|
|
bool HasQueuedUpdates() const;
|
|
/** Returns whether the given instance is queued for any updates. */
|
|
bool HasQueuedUpdates(FInstanceHandle Instance) const;
|
|
/** Queue the given instance for an update with the given context. */
|
|
void QueueUpdate(const FMovieSceneContext& Context, FInstanceHandle Instance);
|
|
|
|
/** Updates the given instance with the given context immediately. This doesn't affect the current update queue. */
|
|
void Update(const FMovieSceneContext& Context, FInstanceHandle Instance);
|
|
|
|
/** Flushes the update queue, blocking the current thread until all queued updates have run. */
|
|
void Flush();
|
|
|
|
/** Finish updating an instance. */
|
|
void FinishInstance(FInstanceHandle InInstanceHandle);
|
|
|
|
/** Access this runner's currently executing phase */
|
|
UE::MovieScene::ESystemPhase GetCurrentPhase() const
|
|
{
|
|
return CurrentPhase;
|
|
}
|
|
|
|
public:
|
|
|
|
UMovieSceneEntitySystemLinker* GetLinker() const;
|
|
FEntityManager* GetEntityManager() const;
|
|
FInstanceRegistry* GetInstanceRegistry() const;
|
|
|
|
public:
|
|
|
|
// Internal API
|
|
|
|
void MarkForUpdate(FInstanceHandle InInstanceHandle);
|
|
FMovieSceneEntitySystemEventTriggers& GetQueuedEventTriggers();
|
|
|
|
private:
|
|
|
|
void OnLinkerAbandon(UMovieSceneEntitySystemLinker* Linker);
|
|
|
|
private:
|
|
|
|
// Update loop
|
|
|
|
void DoFlushUpdateQueueOnce();
|
|
|
|
void GameThread_ProcessQueue();
|
|
void GameThread_SpawnPhase();
|
|
void GameThread_InstantiationPhase();
|
|
void GameThread_PostInstantiation();
|
|
void GameThread_EvaluationPhase();
|
|
void GameThread_EvaluationFinalizationPhase();
|
|
void GameThread_PostEvaluationPhase();
|
|
|
|
private:
|
|
|
|
struct FMovieSceneUpdateRequest
|
|
{
|
|
FMovieSceneContext Context;
|
|
FInstanceHandle InstanceHandle;
|
|
};
|
|
|
|
struct FDissectedUpdate
|
|
{
|
|
FMovieSceneContext Context;
|
|
|
|
FInstanceHandle InstanceHandle;
|
|
int32 Order;
|
|
};
|
|
|
|
/** Owner linker */
|
|
TWeakObjectPtr<UMovieSceneEntitySystemLinker> WeakLinker;
|
|
|
|
/** Queue of sequence instances to be updated */
|
|
TArray<FMovieSceneUpdateRequest> UpdateQueue;
|
|
|
|
/** When an update is running, the list of actual instances being updated */
|
|
TArray<FInstanceHandle> CurrentInstances;
|
|
/** When an update is running, the list of sub-contexts for the requested update */
|
|
TArray<FDissectedUpdate> DissectedUpdates;
|
|
|
|
TGraphTask<FNullGraphTask>* CompletionTask;
|
|
|
|
bool bCanQueueEventTriggers;
|
|
FMovieSceneEntitySystemEventTriggers EventTriggers;
|
|
|
|
ENamedThreads::Type GameThread;
|
|
|
|
UE::MovieScene::ESystemPhase CurrentPhase;
|
|
};
|