Files
UnrealEngineUWP/Engine/Source/Runtime/MovieScene/Public/EntitySystem/MovieScenePreAnimatedStateSystem.h
max chen a20dc348ee Sequencer: Pre-Animated state changes to support track instance inputs
- Track Instance Inputs can now be used as capture sources to capture pre-animated state
  - PreAnimatedState extension now simply exists as a member of UMovieSceneEntitySystem. Previously the existence of the extension was used to determine whether any pre-animated state logic was required, but in practice this created more problems than it solved and led to some convoluted lifetime management code.
  - Added a templated group manager type from which the object group manager can inherit. This simplifies the introduction of new group managers
  - Removed the requirement that all pre-animated state must exist as part of a valid group. This forced state from 'master' tracks to be arbitrarily grouped together which put an unnecessary burden on the storage classes.

#jira UE-132512
#rb max.chen, matt.hoffman
[FYI] andrew.rodham
#preflight 61f2ca893765218cf01f290e

#ROBOMERGE-AUTHOR: max.chen
#ROBOMERGE-SOURCE: CL 18754810 in //UE5/Release-5.0/... via CL 18754825 via CL 18757520
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18758489 by max chen in ue5-main branch]
2022-01-27 14:35:51 -05:00

103 lines
3.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "EntitySystem/MovieSceneEntityInstantiatorSystem.h"
#include "Evaluation/PreAnimatedState/MovieScenePreAnimatedStateStorage.h"
#include "MovieScenePreAnimatedStateSystem.generated.h"
UINTERFACE()
class UMovieScenePreAnimatedStateSystemInterface : public UInterface
{
GENERATED_BODY()
};
/**
* Interface that can be added to any entity system in the 'instantiation' phase to implement save / restore state
* with its system dependencies strictly saved in order, and restored in reverse order
*/
class IMovieScenePreAnimatedStateSystemInterface
{
public:
GENERATED_BODY()
struct FPreAnimationParameters
{
UE::MovieScene::FSystemTaskPrerequisites* Prerequisites;
UE::MovieScene::FSystemSubsequentTasks* Subsequents;
UE::MovieScene::FPreAnimatedStateExtension* CacheExtension;
};
virtual void SavePreAnimatedState(const FPreAnimationParameters& InParameters) {}
virtual void RestorePreAnimatedState(const FPreAnimationParameters& InParameters) {}
private:
UE_DEPRECATED(4.26, "Please override the method that takes a FPreAnimationParameters")
virtual void SavePreAnimatedState(UE::MovieScene::FSystemTaskPrerequisites& InPrerequisites, UE::MovieScene::FSystemSubsequentTasks& Subsequents) final {}
UE_DEPRECATED(4.26, "Please override the method that takes a FPreAnimationParameters")
virtual void SaveGlobalPreAnimatedState(UE::MovieScene::FSystemTaskPrerequisites& InPrerequisites, UE::MovieScene::FSystemSubsequentTasks& Subsequents) final {}
UE_DEPRECATED(4.26, "Please override the method that takes a FPreAnimationParameters")
virtual void RestorePreAnimatedState(UE::MovieScene::FSystemTaskPrerequisites& InPrerequisites, UE::MovieScene::FSystemSubsequentTasks& Subsequents) final {}
};
/**
* System that becomes relevant if there are any entites tagged RestoreState,
* or UMovieSceneEntitySystemLinker::ShouldCaptureGlobalState is true.
* When run this system will iterate the instantiation phase in order, and call
* IMovieScenePreAnimatedStateSystemInterface::Save(Global)PreAnimatedState on any
* systems that implement the necessary interface
*/
UCLASS(MinimalAPI)
class UMovieSceneCachePreAnimatedStateSystem
: public UMovieSceneEntityInstantiatorSystem
{
public:
GENERATED_BODY()
UMovieSceneCachePreAnimatedStateSystem(const FObjectInitializer& ObjInit);
private:
virtual bool IsRelevantImpl(UMovieSceneEntitySystemLinker* InLinker) const override;
virtual void OnLink() override;
virtual void OnUnlink() override;
virtual void OnRun(FSystemTaskPrerequisites& InPrerequisites, FSystemSubsequentTasks& Subsequents) override final;
};
/**
* System that becomes relevant if there are any entites tagged RestoreState,
* or UMovieSceneEntitySystemLinker::ShouldCaptureGlobalState is true.
* When run this system will iterate the instantiation phase in reverse order, and call
* IMovieScenePreAnimatedStateSystemInterface::Restore(Global)PreAnimatedState on any
* systems that implement the necessary interface.
*/
UCLASS(MinimalAPI)
class UMovieSceneRestorePreAnimatedStateSystem
: public UMovieSceneEntityInstantiatorSystem
{
public:
GENERATED_BODY()
UMovieSceneRestorePreAnimatedStateSystem(const FObjectInitializer& ObjInit);
private:
virtual bool IsRelevantImpl(UMovieSceneEntitySystemLinker* InLinker) const override;
virtual void OnLink() override;
virtual void OnUnlink() override;
virtual void OnRun(FSystemTaskPrerequisites& InPrerequisites, FSystemSubsequentTasks& Subsequents) override final;
TSharedPtr<UE::MovieScene::FPreAnimatedStateExtension> PreAnimatedStateRef;
};