You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
A specially designated set of attribute curves can be authored on a bone
to encode timecode metadata for an animation sequence. Each attribute
encodes a different component of a complete timecode and subframe value
("TCHour", "TCMinute", "TCSecond", "TCFrame", and "TCSubframe"). The
convention is to author these attribute curves on the root bone of the animation.
This adds a function for evaluating those attributes at a particular time, and the result
is returned as a qualified frame time. If the anim sequence has an import file frame rate
specified, then that rate is used for the returned qualified frame time to more closely
match the original source of the animation. Otherwise, the sampling frame rate of the
anim sequence is used. If the root bone does not have any timecode attributes or they
otherwise cannot be evaluated (for example, because they have no keys), the function
returns false, and the qualified frame time passed by reference is unmodified.
Finally, this new function is used for the frame time hint of skeletal animation tracks in
Sequencer. Anim sequences that have these attributes authored will show the authored
timecode/frame values in the frame time hint when they are selected. This enables more
easily correlating a point in time in the anim sequence with where it came from in an
external DCC.
#rb benoit.deschenes, max.chen
#preflight 619d6f48aa4521f9e7a4e183
#ROBOMERGE-AUTHOR: matt.johnson
#ROBOMERGE-SOURCE: CL 18316998 in //UE5/Release-5.0/... via CL 18317391
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18317981 by matt johnson in ue5-release-engine-test branch]
497 lines
34 KiB
C++
497 lines
34 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "Kismet/BlueprintFunctionLibrary.h"
|
|
#include "Animation/AnimEnums.h"
|
|
#include "Animation/AnimCurveTypes.h"
|
|
#include "Animation/AnimMetaData.h"
|
|
#include "AnimationGraph.h"
|
|
|
|
#include "AnimationBlueprintLibrary.generated.h"
|
|
|
|
struct FQualifiedFrameTime;
|
|
struct FRawAnimSequenceTrack;
|
|
class UAnimCompress;
|
|
class USkeleton;
|
|
class UAnimBoneCompressionSettings;
|
|
class UAnimCurveCompressionSettings;
|
|
|
|
UENUM()
|
|
enum class ESmartNameContainerType : uint8
|
|
{
|
|
SNCT_CurveMapping UMETA(DisplayName = "Curve Names"),
|
|
SNCT_TrackCurveMapping UMETA(DisplayName = "Track Curve Names"),
|
|
SNCT_MAX
|
|
};
|
|
|
|
/** Delegate called when a notify was replaced */
|
|
DECLARE_DYNAMIC_DELEGATE_TwoParams(FOnNotifyReplaced, UAnimNotify*, OldNotify, UAnimNotify*, NewNotify);
|
|
|
|
/** Delegate called when a notify state was replaced */
|
|
DECLARE_DYNAMIC_DELEGATE_TwoParams(FOnNotifyStateReplaced, UAnimNotifyState*, OldNotifyState, UAnimNotifyState*, NewNotifyState);
|
|
|
|
/** Blueprint library for altering and analyzing animation / skeletal data */
|
|
UCLASS(meta=(ScriptName="AnimationLibrary"))
|
|
class ANIMATIONBLUEPRINTLIBRARY_API UAnimationBlueprintLibrary : public UBlueprintFunctionLibrary
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
/** Retrieves the number of animation frames for the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, meta=(AutoCreateRefTerm = "AnimationSequence"), Category = "AnimationBlueprintLibrary|Animation")
|
|
static void GetNumFrames(const UAnimSequenceBase* AnimationSequenceBase, int32& NumFrames);
|
|
|
|
/** Retrieves the number of animation keys for the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, meta = (AutoCreateRefTerm = "AnimationSequence"), Category = "AnimationBlueprintLibrary|Animation")
|
|
static void GetNumKeys(const UAnimSequenceBase* AnimationSequenceBase, int32& NumKeys);
|
|
|
|
/** Retrieves the Names of the individual ATracks for the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Animation")
|
|
static void GetAnimationTrackNames(const UAnimSequenceBase* AnimationSequenceBase, TArray<FName>& TrackNames);
|
|
|
|
/** Retrieves the Names of the individual float curves for the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Animation")
|
|
static void GetAnimationCurveNames(const UAnimSequence* AnimationSequence, ERawCurveTrackTypes CurveType, TArray<FName>& CurveNames);
|
|
|
|
/** Retrieves the Raw Translation Animation Data for the given Animation Track Name and Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|RawTrackData")
|
|
static void GetRawTrackPositionData(const UAnimSequenceBase* AnimationSequenceBase, const FName TrackName, TArray<FVector>& PositionData);
|
|
|
|
/** Retrieves the Raw Rotation Animation Data for the given Animation Track Name and Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|RawTrackData")
|
|
static void GetRawTrackRotationData(const UAnimSequenceBase* AnimationSequenceBase, const FName TrackName, TArray<FQuat>& RotationData );
|
|
|
|
/** Retrieves the Raw Scale Animation Data for the given Animation Track Name and Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|RawTrackData")
|
|
static void GetRawTrackScaleData(const UAnimSequenceBase* AnimationSequenceBase, const FName TrackName, TArray<FVector>& ScaleData);
|
|
|
|
/** Retrieves the Raw Animation Data for the given Animation Track Name and Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|RawTrackData")
|
|
static void GetRawTrackData(const UAnimSequenceBase* AnimationSequenceBase, const FName TrackName, TArray<FVector>& PositionKeys,TArray<FQuat>& RotationKeys, TArray<FVector>& ScalingKeys);
|
|
|
|
/** Checks whether or not the given Animation Track Name is contained within the Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Helpers")
|
|
static bool IsValidRawAnimationTrackName(const UAnimSequenceBase* AnimationSequenceBase, const FName TrackName);
|
|
|
|
static const FRawAnimSequenceTrack& GetRawAnimationTrackByName(const UAnimSequenceBase* AnimationSequenceBase, const FName TrackName);
|
|
|
|
// Compression
|
|
|
|
/** Retrieves the Bone Compression Settings for the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Compression")
|
|
static void GetBoneCompressionSettings(const UAnimSequence* AnimationSequence, UAnimBoneCompressionSettings*& CompressionSettings);
|
|
|
|
/** Sets the Bone Compression Settings for the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Compression")
|
|
static void SetBoneCompressionSettings(UAnimSequence* AnimationSequence, UAnimBoneCompressionSettings* CompressionSettings);
|
|
|
|
/** Retrieves the Curve Compression Settings for the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Compression")
|
|
static void GetCurveCompressionSettings(const UAnimSequence* AnimationSequence, UAnimCurveCompressionSettings*& CompressionSettings);
|
|
|
|
/** Sets the Curve Compression Settings for the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Compression")
|
|
static void SetCurveCompressionSettings(UAnimSequence* AnimationSequence, UAnimCurveCompressionSettings* CompressionSettings);
|
|
|
|
// Additive
|
|
/** Retrieves the Additive Animation type for the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Additive")
|
|
static void GetAdditiveAnimationType(const UAnimSequence* AnimationSequence, TEnumAsByte<enum EAdditiveAnimationType>& AdditiveAnimationType);
|
|
|
|
/** Sets the Additive Animation type for the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Additive")
|
|
static void SetAdditiveAnimationType(UAnimSequence* AnimationSequence, const TEnumAsByte<enum EAdditiveAnimationType> AdditiveAnimationType);
|
|
|
|
/** Retrieves the Additive Base Pose type for the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Additive")
|
|
static void GetAdditiveBasePoseType(const UAnimSequence* AnimationSequence, TEnumAsByte<enum EAdditiveBasePoseType>& AdditiveBasePoseType);
|
|
|
|
/** Sets the Additive Base Pose type for the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Additive")
|
|
static void SetAdditiveBasePoseType(UAnimSequence* AnimationSequence, const TEnumAsByte<enum EAdditiveBasePoseType> AdditiveBasePoseType);
|
|
|
|
// Interpolation
|
|
|
|
/** Retrieves the Animation Interpolation type for the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Interpolation")
|
|
static void GetAnimationInterpolationType(const UAnimSequence* AnimationSequence, EAnimInterpolationType& InterpolationType);
|
|
|
|
/** Sets the Animation Interpolation type for the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Interpolation")
|
|
static void SetAnimationInterpolationType(UAnimSequence* AnimationSequence, EAnimInterpolationType InterpolationType);
|
|
|
|
// Root motion
|
|
|
|
/** Checks whether or not Root Motion is Enabled for the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|RootMotion")
|
|
static bool IsRootMotionEnabled(const UAnimSequence* AnimationSequence);
|
|
|
|
/** Sets whether or not Root Motion is Enabled for the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|RootMotion")
|
|
static void SetRootMotionEnabled(UAnimSequence* AnimationSequence, bool bEnabled);
|
|
|
|
/** Retrieves the Root Motion Lock Type for the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|RootMotion")
|
|
static void GetRootMotionLockType(const UAnimSequence* AnimationSequence, TEnumAsByte<ERootMotionRootLock::Type>& LockType);
|
|
|
|
/** Sets the Root Motion Lock Type for the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|RootMotion")
|
|
static void SetRootMotionLockType(UAnimSequence* AnimationSequence, TEnumAsByte<ERootMotionRootLock::Type> RootMotionLockType);
|
|
|
|
/** Checks whether or not Root Motion locking is Forced for the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|RootMotion")
|
|
static bool IsRootMotionLockForced(const UAnimSequence* AnimationSequence);
|
|
|
|
/** Sets whether or not Root Motion locking is Forced for the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|RootMotion")
|
|
static void SetIsRootMotionLockForced(UAnimSequence* AnimationSequence, bool bForced);
|
|
|
|
// Markers
|
|
|
|
/** Retrieves all the Animation Sync Markers for the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|MarkerSyncing")
|
|
static void GetAnimationSyncMarkers(const UAnimSequence* AnimationSequence, TArray<FAnimSyncMarker>& Markers);
|
|
|
|
/** Retrieves all the Unique Names for the Animation Sync Markers contained by the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|MarkerSyncing")
|
|
static void GetUniqueMarkerNames(const UAnimSequence* AnimationSequence, TArray<FName>& MarkerNames);
|
|
|
|
/** Adds an Animation Sync Marker to Notify track in the given Animation with the corresponding Marker Name and Time */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|MarkerSyncing")
|
|
static void AddAnimationSyncMarker(UAnimSequence* AnimationSequence, FName MarkerName, float Time, FName NotifyTrackName);
|
|
|
|
/** Checks whether or not the given Marker Name is a valid Animation Sync Marker Name */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Helpers")
|
|
static bool IsValidAnimationSyncMarkerName(const UAnimSequence* AnimationSequence, FName MarkerName);
|
|
|
|
/** Removes All Animation Sync Marker found within the Animation Sequence whose name matches MarkerName, and returns the number of removed instances */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|MarkerSyncing")
|
|
static int32 RemoveAnimationSyncMarkersByName(UAnimSequence* AnimationSequence, FName MarkerName);
|
|
|
|
/** Removes All Animation Sync Marker found within the Animation Sequence that belong to the specific Notify Track, and returns the number of removed instances */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|MarkerSyncing")
|
|
static int32 RemoveAnimationSyncMarkersByTrack(UAnimSequence* AnimationSequence, FName NotifyTrackName);
|
|
|
|
/** Removes All Animation Sync Markers found within the Animation Sequence, and returns the number of removed instances */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|MarkerSyncing")
|
|
static void RemoveAllAnimationSyncMarkers(UAnimSequence* AnimationSequence);
|
|
|
|
// Notifies
|
|
|
|
/** Retrieves all Animation Notify Events found within the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|NotifyEvents")
|
|
static void GetAnimationNotifyEvents(const UAnimSequenceBase* AnimationSequenceBase, TArray<FAnimNotifyEvent>& NotifyEvents);
|
|
|
|
/** Retrieves all Unique Animation Notify Events found within the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|NotifyEvents")
|
|
static void GetAnimationNotifyEventNames(const UAnimSequenceBase* AnimationSequenceBase, TArray<FName>& EventNames);
|
|
|
|
/** Adds an Animation Notify Event to Notify track in the given Animation with the given Notify creation data */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|NotifyEvents")
|
|
static UAnimNotify* AddAnimationNotifyEvent(UAnimSequenceBase* AnimationSequenceBase, FName NotifyTrackName, float StartTime, TSubclassOf<UAnimNotify> NotifyClass);
|
|
|
|
/** Adds an Animation Notify State Event to Notify track in the given Animation with the given Notify State creation data */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|NotifyEvents")
|
|
static UAnimNotifyState* AddAnimationNotifyStateEvent(UAnimSequenceBase* AnimationSequenceBase, FName NotifyTrackName, float StartTime, float Duration, TSubclassOf<UAnimNotifyState> NotifyStateClass);
|
|
|
|
/** Adds an the specific Animation Notify to the Animation Sequence (requires Notify's outer to be the Animation Sequence) */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|NotifyEvents")
|
|
static void AddAnimationNotifyEventObject(UAnimSequenceBase* AnimationSequenceBase, float StartTime, UAnimNotify* Notify, FName NotifyTrackName);
|
|
|
|
/** Adds an the specific Animation Notify State to the Animation Sequence (requires Notify State's outer to be the Animation Sequence) */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|NotifyEvents")
|
|
static void AddAnimationNotifyStateEventObject(UAnimSequenceBase* AnimationSequenceBase, float StartTime, float Duration, UAnimNotifyState* NotifyState, FName NotifyTrackName);
|
|
|
|
/** Removes Animation Notify Events found by Name within the Animation Sequence, and returns the number of removed name instances */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|NotifyEvents")
|
|
static int32 RemoveAnimationNotifyEventsByName(UAnimSequenceBase* AnimationSequenceBase, FName NotifyName);
|
|
|
|
/** Removes Animation Notify Events found by Track within the Animation Sequence, and returns the number of removed name instances */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|NotifyEvents")
|
|
static int32 RemoveAnimationNotifyEventsByTrack(UAnimSequenceBase* AnimationSequenceBase, FName NotifyTrackName);
|
|
|
|
/** Replaces animation notifies in the specified Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|NotifyEvents")
|
|
static void ReplaceAnimNotifyStates(UAnimSequenceBase* AnimationSequenceBase, TSubclassOf<UAnimNotifyState> OldNotifyClass, TSubclassOf<UAnimNotifyState> NewNotifyClass, FOnNotifyStateReplaced OnNotifyStateReplaced);
|
|
|
|
/** Replaces animation notifies in the specified Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|NotifyEvents")
|
|
static void ReplaceAnimNotifies(UAnimSequenceBase* AnimationSequenceBase, TSubclassOf<UAnimNotify> OldNotifyClass, TSubclassOf<UAnimNotify> NewNotifyClass, FOnNotifyReplaced OnNotifyReplaced);
|
|
|
|
/** Copies animation notifies from Src Animation Sequence to Dest. Creates anim notify tracks as necessary. Returns true on success. */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|NotifyEvents")
|
|
static void CopyAnimNotifiesFromSequence(UAnimSequenceBase* SourceAnimationSequenceBase, UAnimSequenceBase* DestinationAnimationSequenceBase, bool bDeleteExistingNotifies = false);
|
|
|
|
// Notify Tracks
|
|
|
|
/** Retrieves all Unique Animation Notify Track Names found within the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|AnimationNotifies")
|
|
static void GetAnimationNotifyTrackNames(const UAnimSequenceBase* AnimationSequenceBase, TArray<FName>& TrackNames);
|
|
|
|
/** Adds an Animation Notify Track to the Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|AnimationNotifies")
|
|
static void AddAnimationNotifyTrack(UAnimSequenceBase* AnimationSequenceBase, FName NotifyTrackName, FLinearColor TrackColor = FLinearColor::White);
|
|
|
|
/** Removes an Animation Notify Track from Animation Sequence by Name */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|AnimationNotifies")
|
|
static void RemoveAnimationNotifyTrack(UAnimSequenceBase* AnimationSequenceBase, FName NotifyTrackName);
|
|
|
|
/** Removes All Animation Notify Tracks from Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|AnimationNotifies")
|
|
static void RemoveAllAnimationNotifyTracks(UAnimSequenceBase* AnimationSequenceBase);
|
|
|
|
/** Checks whether or not the given Track Name is a valid Animation Notify Track in the Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Helpers")
|
|
static bool IsValidAnimNotifyTrackName(const UAnimSequenceBase* AnimationSequenceBase, FName NotifyTrackName);
|
|
|
|
static int32 GetTrackIndexForAnimationNotifyTrackName(const UAnimSequenceBase* AnimationSequenceBase, FName NotifyTrackName);
|
|
static const FAnimNotifyTrack& GetNotifyTrackByName(const UAnimSequenceBase* AnimationSequenceBase, FName NotifyTrackName);
|
|
|
|
/** Returns the actual trigger time for a NotifyEvent */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|AnimationNotifies")
|
|
static float GetAnimNotifyEventTriggerTime(const FAnimNotifyEvent& NotifyEvent);
|
|
|
|
/** Returns the duration for a NotifyEvent, only non-zero for Anim Notify States */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|AnimationNotifies")
|
|
static float GetAnimNotifyEventDuration(const FAnimNotifyEvent& NotifyEvent);
|
|
|
|
/** Retrieves all Animation Sync Markers for the given Notify Track Name from the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|MarkerSyncing")
|
|
static void GetAnimationSyncMarkersForTrack(const UAnimSequence* AnimationSequence, FName NotifyTrackName, TArray<FAnimSyncMarker>& Markers);
|
|
|
|
/** Retrieves all Animation Notify Events for the given Notify Track Name from the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|NotifyEvents")
|
|
static void GetAnimationNotifyEventsForTrack(const UAnimSequenceBase* AnimationSequenceBase, FName NotifyTrackName, TArray<FAnimNotifyEvent>& Events);
|
|
|
|
// Curves
|
|
|
|
/** Adds an Animation Curve by Type and Name to the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves")
|
|
static void AddCurve(UAnimSequence* AnimationSequence, FName CurveName, ERawCurveTrackTypes CurveType = ERawCurveTrackTypes::RCT_Float, bool bMetaDataCurve = false);
|
|
|
|
/** Removes an Animation Curve by Name from the given Animation Sequence (Raw Animation Curves [Names] may not be removed from the Skeleton) */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves")
|
|
static void RemoveCurve(UAnimSequence* AnimationSequence, FName CurveName, bool bRemoveNameFromSkeleton = false);
|
|
|
|
/** Removes all Animation Curve Data from the given Animation Sequence (Raw Animation Curves [Names] may not be removed from the Skeleton) */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves")
|
|
static void RemoveAllCurveData(UAnimSequence* AnimationSequence);
|
|
|
|
/** Adds a Transformation Key to the specified Animation Curve inside of the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves")
|
|
static void AddTransformationCurveKey(UAnimSequence* AnimationSequence, FName CurveName, const float Time, const FTransform& Transform);
|
|
|
|
/** Adds a multiple of Transformation Keys to the specified Animation Curve inside of the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves")
|
|
static void AddTransformationCurveKeys(UAnimSequence* AnimationSequence, FName CurveName, const TArray<float>& Times, const TArray<FTransform>& Transforms);
|
|
|
|
/** Adds a Float Key to the specified Animation Curve inside of the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves")
|
|
static void AddFloatCurveKey(UAnimSequence* AnimationSequence, FName CurveName, const float Time, const float Value);
|
|
|
|
/** Adds a multiple of Float Keys to the specified Animation Curve inside of the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves")
|
|
static void AddFloatCurveKeys(UAnimSequence* AnimationSequence, FName CurveName, const TArray<float>& Times, const TArray<float>& Values);
|
|
|
|
/** Adds a Vector Key to the specified Animation Curve inside of the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves")
|
|
static void AddVectorCurveKey(UAnimSequence* AnimationSequence, FName CurveName, const float Time, const FVector Vector);
|
|
|
|
/** Adds a multiple of Vector Keys to the specified Animation Curve inside of the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves")
|
|
static void AddVectorCurveKeys(UAnimSequence* AnimationSequence, FName CurveName, const TArray<float>& Times, const TArray<FVector>& Vectors);
|
|
|
|
// Curve helper functions
|
|
template <typename DataType, typename CurveClass, ERawCurveTrackTypes CurveType>
|
|
static void AddCurveKeysInternal(UAnimSequence* AnimationSequence, FName CurveName, const TArray<float>& Times, const TArray<DataType>& KeyData);
|
|
|
|
// Returns true if successfully added, false if it was already existing
|
|
static bool AddCurveInternal(UAnimSequence* AnimationSequence, FName CurveName, FName ContainerName, int32 CurveFlags, ERawCurveTrackTypes SupportedCurveType);
|
|
static bool RemoveCurveInternal(UAnimSequence* AnimationSequence, FName CurveName, FName ContainerName, bool bRemoveNameFromSkeleton);
|
|
|
|
/** Checks whether or not the given Bone Name exist on the Skeleton referenced by the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Skeleton")
|
|
static void DoesBoneNameExist(UAnimSequence* AnimationSequence, FName BoneName, bool& bExists);
|
|
|
|
static bool DoesBoneNameExistInternal(USkeleton* Skeleton, FName BoneName);
|
|
static bool DoesBoneCurveNameExistInternal(USkeleton* Skeleton, FName BoneName);
|
|
|
|
/** Retrieves, a multiple of, Float Key(s) from the specified Animation Curve inside of the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves")
|
|
static void GetFloatKeys(UAnimSequence* AnimationSequence, FName CurveName, TArray<float>& Times, TArray<float>& Values);
|
|
|
|
/** Retrieves, a multiple of, Vector Key(s) from the specified Animation Curve inside of the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves")
|
|
static void GetVectorKeys(UAnimSequence* AnimationSequence, FName CurveName, TArray<float>& Times, TArray<FVector>& Values);
|
|
|
|
/** Retrieves, a multiple of, Transformation Key(s) from the specified Animation Curve inside of the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves")
|
|
static void GetTransformationKeys(UAnimSequence* AnimationSequence, FName CurveName, TArray<float>& Times, TArray<FTransform>& Values);
|
|
|
|
template <typename DataType, typename CurveClass, ERawCurveTrackTypes CurveType>
|
|
static void GetCurveKeysInternal(UAnimSequence* AnimationSequence, FName CurveName, TArray<float>& Times, TArray<DataType>& KeyData);
|
|
|
|
/** Ensures that any curve names that do not exist on the NewSkeleton are added to it, in which case the SmartName on the actual curve itself will also be updated */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves")
|
|
static void CopyAnimationCurveNamesToSkeleton(USkeleton* OldSkeleton, USkeleton* NewSkeleton, UAnimSequenceBase* SequenceBase, ERawCurveTrackTypes CurveType);
|
|
|
|
// Bone Tracks
|
|
|
|
/** Removes an Animation Curve by Name from the given Animation Sequence (Raw Animation Curves [Names] may not be removed from the Skeleton)
|
|
*
|
|
* @param AnimationSequence : AnimSequence
|
|
* @param BoneName : Name of bone track user wants to remove
|
|
* @param bIncludeChildren : true if user wants to include all children of BoneName
|
|
* @param bFinalize : If you set this to true, it will trigger compression. If you set bFinalize to be false, you'll have to manually trigger Finalize.
|
|
*/
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Bones")
|
|
static void RemoveBoneAnimation(UAnimSequence* AnimationSequence, FName BoneName, bool bIncludeChildren = true, bool bFinalize = true);
|
|
|
|
/** Removes all Animation Bone Track Data from the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves")
|
|
static void RemoveAllBoneAnimation(UAnimSequence* AnimationSequence);
|
|
|
|
/** Apply all the changes made to Bone Tracks to Finalize. This triggers recompression. Note that this is expensive, but will require to get correct compressed data */
|
|
UE_DEPRECATED(5.0, "FinalizeBoneAnimation has been deprecated, use UAnimDataController instead")
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves", meta=(DeprecatedFunction, DeprecationMessage="FinalizeBoneAnimation has been deprecated, use UAnimDataController instead"))
|
|
static void FinalizeBoneAnimation(UAnimSequence* AnimationSequence);
|
|
|
|
// Smart name helper functions
|
|
|
|
/** Checks whether or not the given Curve Name exist on the Skeleton referenced by the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Curves")
|
|
static bool DoesCurveExist(UAnimSequence* AnimationSequence, FName CurveName, ERawCurveTrackTypes CurveType);
|
|
static bool DoesSmartNameExist(UAnimSequence* AnimationSequence, FName Name);
|
|
|
|
static FSmartName RetrieveSmartNameForCurve(const UAnimSequence* AnimationSequence, FName CurveName, FName ContainerName);
|
|
static bool RetrieveSmartNameForCurve(const UAnimSequence* AnimationSequence, FName CurveName, FName ContainerName, FSmartName& SmartName);
|
|
static FName RetrieveContainerNameForCurve(const UAnimSequence* AnimationSequence, FName CurveName);
|
|
|
|
// MetaData
|
|
|
|
/** Creates and Adds an instance of the specified MetaData Class to the given Animation Asset */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|MetaData")
|
|
static void AddMetaData(UAnimationAsset* AnimationAsset, TSubclassOf<UAnimMetaData> MetaDataClass, UAnimMetaData*& MetaDataInstance);
|
|
|
|
/** Adds an instance of the specified MetaData Class to the given Animation Asset (requires MetaDataObject's outer to be the Animation Asset) */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|MetaData")
|
|
static void AddMetaDataObject(UAnimationAsset* AnimationAsset, UAnimMetaData* MetaDataObject);
|
|
|
|
/** Removes all Meta Data from the given Animation Asset */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|MetaData")
|
|
static void RemoveAllMetaData(UAnimationAsset* AnimationAsset);
|
|
|
|
/** Removes the specified Meta Data Instance from the given Animation Asset */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|MetaData")
|
|
static void RemoveMetaData(UAnimationAsset* AnimationAsset, UAnimMetaData* MetaDataObject);
|
|
|
|
/** Removes all Meta Data Instance of the specified Class from the given Animation Asset */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|MetaData")
|
|
static void RemoveMetaDataOfClass(UAnimationAsset* AnimationAsset, TSubclassOf<UAnimMetaData> MetaDataClass);
|
|
|
|
/** Retrieves all Meta Data Instances from the given Animation Asset */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|MetaData")
|
|
static void GetMetaData(const UAnimationAsset* AnimationAsset, TArray<UAnimMetaData*>& MetaData);
|
|
|
|
/** Retrieves all Meta Data Instances from the given Animation Asset */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|MetaData")
|
|
static void GetMetaDataOfClass(const UAnimationAsset* AnimationAsset, TSubclassOf<UAnimMetaData> MetaDataClass, TArray<UAnimMetaData*>& MetaDataOfClass);
|
|
|
|
/** Checks whether or not the given Animation Asset contains Meta Data Instance of the specified Meta Data Class */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|MetaData")
|
|
static bool ContainsMetaDataOfClass(const UAnimationAsset* AnimationAsset, TSubclassOf<UAnimMetaData> MetaDataClass);
|
|
|
|
// Poses
|
|
|
|
/** Retrieves Bone Pose data for the given Bone Name at the specified Time from the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Pose")
|
|
static void GetBonePoseForTime(const UAnimSequenceBase* AnimationSequenceBase, FName BoneName, float Time, bool bExtractRootMotion, FTransform& Pose);
|
|
|
|
/** Retrieves Bone Pose data for the given Bone Name at the specified Frame from the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Pose")
|
|
static void GetBonePoseForFrame(const UAnimSequenceBase* AnimationSequenceBase, FName BoneName, int32 Frame, bool bExtractRootMotion, FTransform& Pose);
|
|
|
|
/** Retrieves Bone Pose data for the given Bone Names at the specified Time from the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Pose")
|
|
static void GetBonePosesForTime(const UAnimSequenceBase* AnimationSequenceBase, TArray<FName> BoneNames, float Time, bool bExtractRootMotion, TArray<FTransform>& Poses, const USkeletalMesh* PreviewMesh = nullptr);
|
|
|
|
/** Retrieves Bone Pose data for the given Bone Names at the specified Frame from the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Pose")
|
|
static void GetBonePosesForFrame(const UAnimSequenceBase* AnimationSequenceBase, TArray<FName> BoneNames, int32 Frame, bool bExtractRootMotion, TArray<FTransform>& Poses, const USkeletalMesh* PreviewMesh = nullptr);
|
|
|
|
// Virtual bones
|
|
|
|
/** Adds a Virtual Bone between the Source and Target Bones to the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|VirtualBones")
|
|
static void AddVirtualBone(const UAnimSequence* AnimationSequence, FName SourceBoneName, FName TargetBoneName, FName& VirtualBoneName);
|
|
|
|
/** Removes a Virtual Bone with the specified Bone Name from the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|VirtualBones")
|
|
static void RemoveVirtualBone(const UAnimSequence* AnimationSequence, FName VirtualBoneName);
|
|
|
|
/** Removes Virtual Bones with the specified Bone Names from the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|VirtualBones")
|
|
static void RemoveVirtualBones(const UAnimSequence* AnimationSequence, TArray<FName> VirtualBoneNames);
|
|
|
|
/** Removes all Virtual Bones from the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|VirtualBones")
|
|
static void RemoveAllVirtualBones(const UAnimSequence* AnimationSequence);
|
|
|
|
static bool DoesVirtualBoneNameExistInternal(USkeleton* Skeleton, FName BoneName);
|
|
|
|
// Misc
|
|
|
|
/** Retrieves the Length of the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Animation")
|
|
static void GetSequenceLength(const UAnimSequenceBase* AnimationSequenceBase, float& Length);
|
|
|
|
/** Retrieves the (Play) Rate Scale of the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Animation")
|
|
static void GetRateScale(const UAnimSequenceBase* AnimationSequenceBase, float& RateScale);
|
|
|
|
/** Sets the (Play) Rate Scale for the given Animation Sequence */
|
|
UFUNCTION(BlueprintCallable, Category = "AnimationBlueprintLibrary|Animation")
|
|
static void SetRateScale(UAnimSequenceBase* AnimationSequenceBase, float RateScale);
|
|
|
|
/** Retrieves the Frame Index at the specified Time Value for the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Helpers")
|
|
static void GetFrameAtTime(const UAnimSequenceBase* AnimationSequenceBase, const float Time, int32& Frame);
|
|
|
|
/** Retrieves the Time Value at the specified Frame Indexfor the given Animation Sequence */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Helpers")
|
|
static void GetTimeAtFrame(const UAnimSequenceBase* AnimationSequenceBase, const int32 Frame, float& Time);
|
|
|
|
static float GetTimeAtFrameInternal(const UAnimSequenceBase* AnimationSequenceBase, const int32 Frame);
|
|
|
|
/** Checks whether or not the given Time Value lies within the given Animation Sequence's Length */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Helpers")
|
|
static void IsValidTime(const UAnimSequenceBase* AnimationSequenceBase, const float Time, bool& IsValid);
|
|
|
|
static bool IsValidTimeInternal(const UAnimSequenceBase* AnimationSequenceBase, const float Time);
|
|
|
|
/** Evaluates timecode attributes (e.g. "TCFrame", "TCSecond", etc.) of the root bone and returns the resulting qualified frame time.
|
|
*
|
|
* @param AnimationSequenceBase: Anim sequence for which to evaluate the root bone attributes.
|
|
* @param EvalTime: Time (in seconds) at which to evaluate the timecode bone attributes.
|
|
* @param OutQualifiedFrameTime: Resulting qualified frame time from evaluation. If the anim sequence has an import file frame rate
|
|
* set, then that will be used as the frame rate of the qualified frame time. Otherwise, the sampling frame rate of the anim
|
|
* sequence is used. If no timecode attributes are present on the bone or if none can be evaluated, the passed object will not be modified.
|
|
* @return: true if the root bone had timecode attributes that could be evaluated and a qualified frame time was set, or false otherwise.
|
|
*/
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Helpers")
|
|
static bool EvaluateRootBoneTimecodeAttributesAtTime(const UAnimSequenceBase* AnimationSequenceBase, const float EvalTime, FQualifiedFrameTime& OutQualifiedFrameTime);
|
|
|
|
/** Finds the Bone Path from the given Bone to the Root Bone */
|
|
UFUNCTION(BlueprintPure, Category = "AnimationBlueprintLibrary|Helpers")
|
|
static void FindBonePathToRoot(const UAnimSequenceBase* AnimationSequenceBase, FName BoneName, TArray<FName>& BonePath);
|
|
|
|
/** Returns all Animation Graphs contained by the provided Animation Blueprint */
|
|
UFUNCTION(BlueprintCallable, Category=Animation, meta=(ScriptMethod))
|
|
static void GetAnimationGraphs(UAnimBlueprint* AnimationBlueprint, TArray<UAnimationGraph*>& AnimationGraphs);
|
|
|
|
/** Returns all Animation Graph Nodes of the provided Node Class contained by the Animation Blueprint */
|
|
UFUNCTION(BlueprintCallable, Category=Animation, meta=(ScriptMethod))
|
|
static void GetNodesOfClass(UAnimBlueprint* AnimationBlueprint, TSubclassOf<UAnimGraphNode_Base> NodeClass, TArray<UAnimGraphNode_Base*>& GraphNodes, bool bIncludeChildClasses = true);
|
|
};
|