Files
UnrealEngineUWP/Engine/Source/Runtime/AnimGraphRuntime/Public/SequencePlayerLibrary.h
koray hagen 7952f73fdc #preflight 6143ef4681695600011c49a8
#rb braeden.shosa, aaron.cox, cesar.castro
#jira none

Motion Trajectory Component for Motion Matching:

Motion Trajectory Component notes:
1) Abstract component/interface implemented with prediction and history API.
2) Implemented uniform, frame-rate independent history sampling algorithm for retaining trajectory sample coherence.
3) Implemented concrete Character Movement Trajectory Component for encapsulating ground locomotion prediction algorithm and API.
4) Motion Trajectory blueprint library containing:
5) FlattenTrajectory2D algorithm for isolating and removing Z axis direction contribution from tracjectory.
6) ClampTrajectoryDirection for projecting trajectory samples into a discrete, allowed set of directions (such as cardinal).

Engine changes:
1) Implemented shared TrajectorySample, Range, and Domain structures for common usage among Motion Trajectory, Pose Search, and Blueprint.
2) Expanded Sequence Player blueprint library functionality for Scripted Motion Matching content example.

Pose Search changes:
1) Match Pose renamed to Pose History with minor configuration parameters.
2) Complete removal of approximated past trajectory sampling. This has now been pushed to the Motion Trajectory Component.
3) Motion Matching interface changes: Goal has been replaced with Trajectory and Dynamic Play Rate Adjustment has been encapsulated to an experimental code module and blueprint library. New defaults, and encapsulating settings.
4) Motion Matching changes: New Pose Search blueprint library which encapsulates core Motion Matching algorithm.
5) Unified Trajectory to Pose Feature Vector transformation algorithms.
6) Removal of temporary Pose Search Prediction blueprint library (now Dynamic Play Rate).
7) End-to-end implementation support for Past/Future Time and Distance domain schemas.

AnimInput changes:
1) Removal of AnimInput_CapsulePrediction (replaced with Motion Trajectory Component).

Gameplay Anim Gym changes:
1) Pose search database is now fully distance-based (history and future).
2) Character blueprint includes Character Movement Trajectory Component with distance-based domain setup.
3) Scripted Motion Matching anim node function prototype with Engine content example.
#preflight 6143ef4681695600011c49a8

#ROBOMERGE-AUTHOR: koray.hagen
#ROBOMERGE-SOURCE: CL 17547347 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v870-17433530)

[CL 17547352 by koray hagen in ue5-release-engine-test branch]
2021-09-16 22:34:27 -04:00

82 lines
4.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Animation/AnimExecutionContext.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Animation/AnimNodeReference.h"
#include "SequencePlayerLibrary.generated.h"
struct FAnimNode_SequencePlayer;
USTRUCT(BlueprintType)
struct FSequencePlayerReference : public FAnimNodeReference
{
GENERATED_BODY()
typedef FAnimNode_SequencePlayer FInternalNodeType;
};
// Exposes operations to be performed on a sequence player anim node
// Note: Experimental and subject to change!
UCLASS(Experimental)
class ANIMGRAPHRUNTIME_API USequencePlayerLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
/** Get a sequence player context from an anim node context */
UFUNCTION(BlueprintCallable, Category = "Sequence Player", meta = (BlueprintThreadSafe, ExpandEnumAsExecs = "Result"))
static FSequencePlayerReference ConvertToSequencePlayer(const FAnimNodeReference& Node, EAnimNodeReferenceConversionResult& Result);
/** Get a sequence player context from an anim node context (pure) */
UFUNCTION(BlueprintPure, Category = "Sequence Player", meta = (BlueprintThreadSafe, DisplayName = "Convert to Sequence Player"))
static void ConvertToSequencePlayerPure(const FAnimNodeReference& Node, FSequencePlayerReference& SequencePlayer, bool& Result)
{
EAnimNodeReferenceConversionResult ConversionResult;
SequencePlayer = ConvertToSequencePlayer(Node, ConversionResult);
Result = (ConversionResult == EAnimNodeReferenceConversionResult::Succeeded);
}
/** Set the current accumulated time of the sequence player */
UFUNCTION(BlueprintCallable, Category = "Sequence Player", meta = (BlueprintThreadSafe))
static FSequencePlayerReference SetAccumulatedTime(const FSequencePlayerReference& SequencePlayer, float Time);
/** Set the start position of the sequence player */
UFUNCTION(BlueprintCallable, Category = "Sequence Player", meta = (BlueprintThreadSafe))
static FSequencePlayerReference SetStartPosition(const FSequencePlayerReference& SequencePlayer, float StartPosition);
/** Set the play rate of the sequence player */
UFUNCTION(BlueprintCallable, Category = "Sequence Player", meta = (BlueprintThreadSafe))
static FSequencePlayerReference SetPlayRate(const FSequencePlayerReference& SequencePlayer, float PlayRate);
/** Set the current sequence of the sequence player */
UFUNCTION(BlueprintCallable, Category = "Sequence Player", meta = (BlueprintThreadSafe))
static FSequencePlayerReference SetSequence(const FSequencePlayerReference& SequencePlayer, UAnimSequenceBase* Sequence);
/** Set the current sequence of the sequence player with an inertial blend time */
UFUNCTION(BlueprintCallable, Category = "Sequence Player", meta = (BlueprintThreadSafe))
static FSequencePlayerReference SetSequenceWithInertialBlending(const FAnimUpdateContext& UpdateContext, const FSequencePlayerReference& SequencePlayer, UAnimSequenceBase* Sequence, float BlendTime = 0.2f);
/** Gets the current accumulated time of the sequence player */
UFUNCTION(BlueprintCallable, Category = "Sequence Player", meta = (BlueprintThreadSafe))
static float GetAccumulatedTime(const FSequencePlayerReference& SequencePlayer);
/** Get the start position of the sequence player */
UFUNCTION(BlueprintCallable, Category = "Sequence Player", meta = (BlueprintThreadSafe))
static float GetStartPosition(const FSequencePlayerReference& SequencePlayer);
/** Get the play rate of the sequence player */
UFUNCTION(BlueprintCallable, Category = "Sequence Player", meta = (BlueprintThreadSafe))
static float GetPlayRate(const FSequencePlayerReference& SequencePlayer);
/** Get the looping state of the sequence player */
UFUNCTION(BlueprintCallable, Category = "Sequence Player", meta = (BlueprintThreadSafe))
static bool GetLoopAnimation(const FSequencePlayerReference& SequencePlayer);
/** Get the current sequence of the sequence player */
UFUNCTION(BlueprintCallable, Category = "Sequence Player", meta = (BlueprintThreadSafe))
static UAnimSequenceBase* GetSequence(const FSequencePlayerReference& SequencePlayer);
};