Files

122 lines
8.6 KiB
C
Raw Permalink Normal View History

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreTypes.h"
#include "UObject/ObjectMacros.h"
#include "Animation/AnimData/AnimDataModel.h"
#include "Animation/AnimCurveTypes.h"
#include "Algo/Transform.h"
#include "Animation/AnimData/IAnimationDataController.h"
#if WITH_EDITOR
#include "ChangeTransactor.h"
#endif // WITH_EDITOR
#include "AnimDataController.generated.h"
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
UCLASS(BlueprintType)
class ANIMATIONDATACONTROLLER_API UAnimDataController : public UObject, public IAnimationDataController
{
GENERATED_BODY()
public:
UAnimDataController()
#if WITH_EDITOR
: BracketDepth(0)
#endif // WITH_EDITOR
{}
#if WITH_EDITOR
/** Begin IAnimationDataController overrides */
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual void SetModel(TScriptInterface<IAnimationDataModel> InModel) override;
virtual TScriptInterface<IAnimationDataModel> GetModelInterface() const override { return ModelInterface; }
virtual const IAnimationDataModel* const GetModel() const override { return Model.Get(); }
virtual void OpenBracket(const FText& InTitle, bool bShouldTransact = true) override;
virtual void CloseBracket(bool bShouldTransact = true) override;
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual void SetNumberOfFrames(FFrameNumber Length, bool bShouldTransact = true) override;
virtual void ResizeNumberOfFrames(FFrameNumber NewLength, FFrameNumber T0, FFrameNumber T1, bool bShouldTransact = true) override;
virtual void ResizeInFrames(FFrameNumber Length, FFrameNumber T0, FFrameNumber T1, bool bShouldTransact = true) override;
virtual void SetFrameRate(FFrameRate FrameRate, bool bShouldTransact = true) override;
virtual void SetPlayLength(float Length, bool bShouldTransact = true) override;
virtual void ResizePlayLength(float NewLength, float T0, float T1, bool bShouldTransact = true) override;
virtual void Resize(float Length, float T0, float T1, bool bShouldTransact = true) override;
virtual bool AddBoneCurve(FName BoneName, bool bShouldTransact = true) override;
virtual int32 InsertBoneTrack(FName BoneName, int32 DesiredIndex, bool bShouldTransact = true) override;
virtual bool RemoveBoneTrack(FName BoneName, bool bShouldTransact = true) override;
virtual void RemoveAllBoneTracks(bool bShouldTransact = true) override;
virtual bool SetBoneTrackKeys(FName BoneName, const TArray<FVector3f>& PositionalKeys, const TArray<FQuat4f>& RotationalKeys, const TArray<FVector3f>& ScalingKeys, bool bShouldTransact = true) override;
virtual bool SetBoneTrackKeys(FName BoneName, const TArray<FVector>& PositionalKeys, const TArray<FQuat>& RotationalKeys, const TArray<FVector>& ScalingKeys, bool bShouldTransact = true) override;
virtual bool UpdateBoneTrackKeys(FName BoneName, const FInt32Range& KeyRangeToSet, const TArray<FVector3f>& PositionalKeys, const TArray<FQuat4f>& RotationalKeys, const TArray<FVector3f>& ScalingKeys, bool bShouldTransact = true) override;
virtual bool UpdateBoneTrackKeys(FName BoneName, const FInt32Range& KeyRangeToSet, const TArray<FVector>& PositionalKeys, const TArray<FQuat>& RotationalKeys, const TArray<FVector>& ScalingKeys, bool bShouldTransact = true) override;
virtual bool AddCurve(const FAnimationCurveIdentifier& CurveId, int32 CurveFlags = 0x00000004, bool bShouldTransact = true) override;
virtual bool DuplicateCurve(const FAnimationCurveIdentifier& CopyCurveId, const FAnimationCurveIdentifier& NewCurveId, bool bShouldTransact = true) override;
virtual bool RemoveCurve(const FAnimationCurveIdentifier& CurveId, bool bShouldTransact = true) override;
virtual void RemoveAllCurvesOfType(ERawCurveTrackTypes SupportedCurveType, bool bShouldTransact = true) override;
virtual bool SetCurveFlag(const FAnimationCurveIdentifier& CurveId, EAnimAssetCurveFlags Flag, bool bState = true, bool bShouldTransact = true) override;
virtual bool SetCurveFlags(const FAnimationCurveIdentifier& CurveId, int32 Flags, bool bShouldTransact = true) override;
virtual bool SetTransformCurveKeys(const FAnimationCurveIdentifier& CurveId, const TArray<FTransform>& TransformValues, const TArray<float>& TimeKeys, bool bShouldTransact = true) override;
virtual bool SetTransformCurveKey(const FAnimationCurveIdentifier& CurveId, float Time, const FTransform& Value, bool bShouldTransact = true) override;
virtual bool RemoveTransformCurveKey(const FAnimationCurveIdentifier& CurveId, float Time, bool bShouldTransact = true) override;
virtual bool RenameCurve(const FAnimationCurveIdentifier& CurveToRenameId, const FAnimationCurveIdentifier& NewCurveId, bool bShouldTransact = true) override;
virtual bool SetCurveColor(const FAnimationCurveIdentifier& CurveId, FLinearColor Color, bool bShouldTransact = true) override;
virtual bool SetCurveComment(const FAnimationCurveIdentifier& CurveId, const FString& Comment, bool bShouldTransact = true) override;
virtual bool ScaleCurve(const FAnimationCurveIdentifier& CurveId, float Origin, float Factor, bool bShouldTransact = true) override;
virtual bool SetCurveKey(const FAnimationCurveIdentifier& CurveId, const FRichCurveKey& Key, bool bShouldTransact = true) override;
virtual bool RemoveCurveKey(const FAnimationCurveIdentifier& CurveId, float Time, bool bShouldTransact = true) override;
virtual bool SetCurveKeys(const FAnimationCurveIdentifier& CurveId, const TArray<FRichCurveKey>& CurveKeys, bool bShouldTransact = true) override;
virtual bool SetCurveAttributes(const FAnimationCurveIdentifier& CurveId, const FCurveAttributes& Attributes, bool bShouldTransact = true) override;
virtual bool RemoveBoneTracksMissingFromSkeleton(const USkeleton* Skeleton, bool bShouldTransact = true) override;
virtual void UpdateAttributesFromSkeleton(const USkeleton* Skeleton, bool bShouldTransact = true) override;
virtual void NotifyPopulated() override;
virtual void ResetModel(bool bShouldTransact = true) override;
virtual bool AddAttribute(const FAnimationAttributeIdentifier& AttributeIdentifier, bool bShouldTransact = true) override;
virtual bool RemoveAttribute(const FAnimationAttributeIdentifier& AttributeIdentifier, bool bShouldTransact = true) override;
virtual int32 RemoveAllAttributesForBone(const FName& BoneName, bool bShouldTransact = true) override;
virtual int32 RemoveAllAttributes(bool bShouldTransact = true) override;
virtual bool SetAttributeKey(const FAnimationAttributeIdentifier& AttributeIdentifier, float Time, const void* KeyValue, const UScriptStruct* TypeStruct, bool bShouldTransact = true) override
{
return SetAttributeKey_Internal(AttributeIdentifier, Time, KeyValue, TypeStruct, bShouldTransact);
}
virtual bool SetAttributeKeys(const FAnimationAttributeIdentifier& AttributeIdentifier, TArrayView<const float> Times, TArrayView<const void*> KeyValues, const UScriptStruct* TypeStruct, bool bShouldTransact = true) override
{
return SetAttributeKeys_Internal(AttributeIdentifier, Times, KeyValues, TypeStruct, bShouldTransact);
}
virtual bool RemoveAttributeKey(const FAnimationAttributeIdentifier& AttributeIdentifier, float Time, bool bShouldTransact = true) override;
virtual bool DuplicateAttribute(const FAnimationAttributeIdentifier& AttributeIdentifier, const FAnimationAttributeIdentifier& NewAttributeIdentifier, bool bShouldTransact = true) override;
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual void UpdateWithSkeleton(USkeleton* TargetSkeleton, bool bShouldTransact = true) override;
virtual void PopulateWithExistingModel(TScriptInterface<IAnimationDataModel> InModel) override;
virtual void InitializeModel() override {}
protected:
virtual void NotifyBracketOpen() override;
virtual void NotifyBracketClosed() override;
/** End IAnimationDataController overrides */
private:
/** Internal functionality for setting Attribute curve key(s) */
bool SetAttributeKey_Internal(const FAnimationAttributeIdentifier& AttributeIdentifier, float Time, const void* KeyValue, const UScriptStruct* TypeStruct, bool bShouldTransact = true);
bool SetAttributeKeys_Internal(const FAnimationAttributeIdentifier& AttributeIdentifier, TArrayView<const float> Times, TArrayView<const void*> KeyValues, const UScriptStruct* TypeStruct, bool bShouldTransact = true);
/** Resizes the curve/attribute data stored on the model according to the provided new length and time at which to insert or remove time */
void ResizeCurves(float NewLength, bool bInserted, float T0, float T1, bool bShouldTransact = true);
void ResizeAttributes(float NewLength, bool bInserted, float T0, float T1, bool bShouldTransact = true);
#endif // WITH_EDITOR
private:
#if WITH_EDITOR
int32 BracketDepth;
#endif // WITH_EDITOR
#if WITH_EDITORONLY_DATA
UPROPERTY(transient)
TWeakObjectPtr<UAnimDataModel> Model;
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
UPROPERTY(transient)
TScriptInterface<IAnimationDataModel> ModelInterface;
#endif // WITH_EDITORONLY_DATA
friend class FAnimDataControllerTestBase;
friend UE::Anim::FOpenBracketAction;
friend UE::Anim::FCloseBracketAction;
};