Files
UnrealEngineUWP/Engine/Source/Developer/AnimationDataController/Private/AnimDataControllerActions.cpp

604 lines
22 KiB
C++
Raw Normal View History

Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
// Copyright Epic Games, Inc. All Rights Reserved.
#include "AnimDataControllerActions.h"
#include "AnimDataController.h"
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
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
#include "Animation/AnimData/IAnimationDataModel.h"
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
#include "UObject/StrongObjectPtr.h"
#define LOCTEXT_NAMESPACE "AnimDataControllerActions"
#if WITH_EDITOR
namespace UE {
namespace Anim {
TUniquePtr<FChange> FAnimDataBaseAction::Execute(UObject* Object)
{
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
const TScriptInterface<IAnimationDataModel> DataModelInterface(Object);
checkf(DataModelInterface, TEXT("Invalid IAnimationDataModel Object"));
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
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
const TScriptInterface<IAnimationDataController> Controller = DataModelInterface->GetController();
Controller->SetModel(DataModelInterface);
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
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
return ExecuteInternal(DataModelInterface.GetInterface(), Controller.GetInterface());
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
FString FAnimDataBaseAction::ToString() const
{
return ToStringInternal();
}
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
TUniquePtr<FChange> FOpenBracketAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
Controller->NotifyBracketOpen();
return MakeUnique<FCloseBracketAction>(Description);
}
FString FOpenBracketAction::ToStringInternal() const
{
return FString::Printf(TEXT("Open Bracket: %s"), *Description);
}
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
TUniquePtr<FChange> FCloseBracketAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
Controller->NotifyBracketClosed();
return MakeUnique<FOpenBracketAction>(Description);
}
FString FCloseBracketAction::ToStringInternal() const
{
return TEXT("Closing Bracket");
}
FAddTrackAction::FAddTrackAction(const FName& InName, TArray<FTransform>&& InTransformData)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
Name = InName;
TransformData = MoveTemp(InTransformData);
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
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
TUniquePtr<FChange> FAddTrackAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
Controller->AddBoneCurve(Name, false);
if (TransformData.Num())
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
TArray<FVector3f> PosKeys;
TArray<FQuat4f> RotKeys;
TArray<FVector3f> ScaleKeys;
PosKeys.Reserve(TransformData.Num());
RotKeys.Reserve(TransformData.Num());
ScaleKeys.Reserve(TransformData.Num());
for (const FTransform& Transform : TransformData)
{
PosKeys.Add(FVector3f(Transform.GetLocation()));
RotKeys.Add(FQuat4f(Transform.GetRotation()));
ScaleKeys.Add(FVector3f(Transform.GetScale3D()));
}
Controller->SetBoneTrackKeys(Name, PosKeys, RotKeys, ScaleKeys, false);
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
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
return MakeUnique<FRemoveTrackAction>(Name);
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
FString FAddTrackAction::ToStringInternal() const
{
return FText::Format(LOCTEXT("AddTrackAction_Description", "Adding animation bone track '{0}'."), FText::FromName(Name)).ToString();
}
FRemoveTrackAction::FRemoveTrackAction(const FName& InName)
: Name(InName)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
}
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
TUniquePtr<FChange> FRemoveTrackAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
ensure(Model->IsValidBoneTrackName(Name));
TArray<FTransform> BoneTransforms;
Model->GetBoneTrackTransforms(Name, BoneTransforms);
TUniquePtr<FChange> InverseAction = MakeUnique<FAddTrackAction>(Name, MoveTemp(BoneTransforms));
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
Controller->RemoveBoneTrack(Name, false);
return InverseAction;
}
FString FRemoveTrackAction::ToStringInternal() const
{
return FText::Format(LOCTEXT("RemoveTrackAction_Description", "Removing animation bone Track '{0}'."), FText::FromName(Name)).ToString();
}
FSetTrackKeysAction::FSetTrackKeysAction(const FName& InName, TArray<FTransform>& InTransformData)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
Name = InName;
TransformData = MoveTemp(InTransformData);
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
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
TUniquePtr<FChange> FSetTrackKeysAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
TArray<FTransform> CurrentBoneTransforms;
Model->GetBoneTrackTransforms(Name, CurrentBoneTransforms);
TUniquePtr<FChange> InverseAction = MakeUnique<FSetTrackKeysAction>(Name, CurrentBoneTransforms);
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
TArray<FVector3f> PosKeys;
TArray<FQuat4f> RotKeys;
TArray<FVector3f> ScaleKeys;
PosKeys.Reserve(TransformData.Num());
RotKeys.Reserve(TransformData.Num());
ScaleKeys.Reserve(TransformData.Num());
for (const FTransform& Transform : TransformData)
{
PosKeys.Add(FVector3f(Transform.GetLocation()));
RotKeys.Add(FQuat4f(Transform.GetRotation()));
ScaleKeys.Add(FVector3f(Transform.GetScale3D()));
}
Controller->SetBoneTrackKeys(Name, PosKeys, RotKeys, ScaleKeys, false);
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
return InverseAction;
}
FString FSetTrackKeysAction::ToStringInternal() const
{
return FText::Format(LOCTEXT("SetTrackKeysAction_Description", "Setting keys for animation bone track '{0}'."), FText::FromName(Name)).ToString();
}
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
FResizePlayLengthInFramesAction::FResizePlayLengthInFramesAction(const IAnimationDataModel* InModel, FFrameNumber F0, FFrameNumber F1) : Frame0(F0), Frame1(F1)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
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
Length = InModel->GetNumberOfFrames();
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
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
TUniquePtr<FChange> FResizePlayLengthInFramesAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
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
TUniquePtr<FChange> InverseAction = MakeUnique<FResizePlayLengthInFramesAction>(Model, Frame0, Frame1);
Controller->ResizeNumberOfFrames(Length, Frame0, Frame1, false);
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
return InverseAction;
}
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
FString FResizePlayLengthInFramesAction::ToStringInternal() const
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
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
return FText::Format(LOCTEXT("ResizePlayLengthInFramesAction_Description", "Resizing play length to {0} frames."), FText::AsNumber(Length.Value)).ToString();
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
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
FSetFrameRateAction::FSetFrameRateAction(const IAnimationDataModel* InModel)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
FrameRate = InModel->GetFrameRate();
}
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
TUniquePtr<FChange> FSetFrameRateAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
TUniquePtr<FChange> InverseAction = MakeUnique<FSetFrameRateAction>(Model);
Controller->SetFrameRate(FrameRate, false);
return InverseAction;
}
FString FSetFrameRateAction::ToStringInternal() const
{
return FText::Format(LOCTEXT("SetFrameRateAction_Description", "Setting Frame Rate to {0}."), FrameRate.ToPrettyText()).ToString();
}
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
TUniquePtr<FChange> FAddCurveAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
TUniquePtr<FChange> InverseAction = MakeUnique<FRemoveCurveAction>(CurveId);
Controller->AddCurve(CurveId, Flags, false);
return InverseAction;
}
FString FAddCurveAction::ToStringInternal() const
{
const FString FloatLabel(TEXT("float"));
const FString TransformLabel(TEXT("transform"));
return FText::Format(LOCTEXT("AddCurveAction_Description", "Adding {0} curve '{1}'."), FText::FromString(CurveId.CurveType == ERawCurveTrackTypes::RCT_Float ? FloatLabel : TransformLabel), FText::FromName(CurveId.CurveName)).ToString();
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
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
TUniquePtr<FChange> FRemoveCurveAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
TUniquePtr<FChange> InverseAction;
if (CurveId.CurveType == ERawCurveTrackTypes::RCT_Float)
{
const FFloatCurve& Curve = Model->GetFloatCurve(CurveId);
InverseAction = MakeUnique<FAddFloatCurveAction>(CurveId, Curve.GetCurveTypeFlags(), Curve.FloatCurve.GetConstRefOfKeys(), Curve.Color);
}
else if (CurveId.CurveType == ERawCurveTrackTypes::RCT_Transform)
{
const FTransformCurve& Curve = Model->GetTransformCurve(CurveId);
InverseAction = MakeUnique<FAddTransformCurveAction>(CurveId, Curve.GetCurveTypeFlags(), Curve);
}
Controller->RemoveCurve(CurveId, false);
return InverseAction;
}
FString FRemoveCurveAction::ToStringInternal() const
{
const FString FloatLabel(TEXT("float"));
const FString TransformLabel(TEXT("transform"));
return FText::Format(LOCTEXT("RemoveCurveAction_Description", "Removing {0} curve '{1}'."), FText::FromString(CurveId.CurveType == ERawCurveTrackTypes::RCT_Float ? FloatLabel : TransformLabel), FText::FromName(CurveId.CurveName)).ToString();
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
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
TUniquePtr<FChange> FSetCurveFlagsAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
const FAnimCurveBase& Curve = Model->GetCurve(CurveId);
const int32 CurrentFlags = Curve.GetCurveTypeFlags();
TUniquePtr<FChange> InverseAction = MakeUnique<FSetCurveFlagsAction>(CurveId, CurrentFlags, CurveType);
Controller->SetCurveFlags(CurveId, Flags, false);
return InverseAction;
}
FString FSetCurveFlagsAction::ToStringInternal() const
{
const FString FloatLabel(TEXT("float"));
const FString TransformLabel(TEXT("transform"));
return FText::Format(LOCTEXT("SetCurveFlagsAction_Description", "Setting flags for {0} curve '{1}'."), FText::FromString(CurveType == ERawCurveTrackTypes::RCT_Float ? FloatLabel : TransformLabel), FText::FromName(CurveId.CurveName)).ToString();
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
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
TUniquePtr<FChange> FRenameCurveAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
Controller->RenameCurve(CurveId, NewCurveId, false);
return MakeUnique<FRenameCurveAction>(NewCurveId, CurveId);
}
FString FRenameCurveAction::ToStringInternal() const
{
const FString FloatLabel(TEXT("float"));
const FString TransformLabel(TEXT("transform"));
return FText::Format(LOCTEXT("RenameCurveAction_Description", "Renaming {0} curve '{1}' to '{2}'."), FText::FromString(CurveId.CurveType == ERawCurveTrackTypes::RCT_Float ? FloatLabel : TransformLabel), FText::FromName(CurveId.CurveName), FText::FromName(NewCurveId.CurveName)).ToString();
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
FScaleCurveAction::FScaleCurveAction(const FAnimationCurveIdentifier& InCurveId, float InOrigin, float InFactor, ERawCurveTrackTypes InCurveType) : CurveId(InCurveId), CurveType(InCurveType), Origin(InOrigin), Factor(InFactor)
{
ensure(CurveType == ERawCurveTrackTypes::RCT_Float);
}
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
TUniquePtr<FChange> FScaleCurveAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
const float InverseFactor = 1.0f / Factor;
TUniquePtr<FChange> InverseAction = MakeUnique<FScaleCurveAction>(CurveId, Origin, InverseFactor, CurveType);
Controller->ScaleCurve(CurveId, Origin, Factor, false);
return InverseAction;
}
FString FScaleCurveAction::ToStringInternal() const
{
const FString FloatLabel(TEXT("float"));
const FString TransformLabel(TEXT("transform"));
return FText::Format(LOCTEXT("ScaleCurveAction_Description", "Scaling {0} curve '{1}'."), FText::FromString(CurveType == ERawCurveTrackTypes::RCT_Float ? FloatLabel : TransformLabel), FText::FromName(CurveId.CurveName)).ToString();
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
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
TUniquePtr<FChange> FAddFloatCurveAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
TUniquePtr<FChange> InverseAction = MakeUnique<FRemoveCurveAction>(CurveId);
Controller->OpenBracket(LOCTEXT("AddFloatCurveAction_Description", "Adding float curve."), false);
Controller->AddCurve(CurveId, Flags, false);
Controller->SetCurveKeys(CurveId, Keys, false);
Controller->SetCurveColor(CurveId, Color, false);
Controller->CloseBracket();
return InverseAction;
}
FString FAddFloatCurveAction::ToStringInternal() const
{
return FText::Format(LOCTEXT("AddFloatCurveAction_Format", "Adding float curve '{0}'."), FText::FromName(CurveId.CurveName)).ToString();
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
FAddTransformCurveAction::FAddTransformCurveAction(const FAnimationCurveIdentifier& InCurveId, int32 InFlags, const FTransformCurve& InTransformCurve) : CurveId(InCurveId), Flags(InFlags)
{
SubCurveKeys[0] = InTransformCurve.TranslationCurve.FloatCurves[0].GetConstRefOfKeys();
SubCurveKeys[1] = InTransformCurve.TranslationCurve.FloatCurves[1].GetConstRefOfKeys();
SubCurveKeys[2] = InTransformCurve.TranslationCurve.FloatCurves[2].GetConstRefOfKeys();
SubCurveKeys[3] = InTransformCurve.RotationCurve.FloatCurves[0].GetConstRefOfKeys();
SubCurveKeys[4] = InTransformCurve.RotationCurve.FloatCurves[1].GetConstRefOfKeys();
SubCurveKeys[5] = InTransformCurve.RotationCurve.FloatCurves[2].GetConstRefOfKeys();
SubCurveKeys[6] = InTransformCurve.ScaleCurve.FloatCurves[0].GetConstRefOfKeys();
SubCurveKeys[7] = InTransformCurve.ScaleCurve.FloatCurves[1].GetConstRefOfKeys();
SubCurveKeys[8] = InTransformCurve.ScaleCurve.FloatCurves[2].GetConstRefOfKeys();
}
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
TUniquePtr<FChange> FAddTransformCurveAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
TUniquePtr<FChange> InverseAction = MakeUnique<FRemoveCurveAction>(CurveId);
Controller->AddCurve(CurveId, Flags, false);
for (int32 SubCurveIndex = 0; SubCurveIndex < 3; ++SubCurveIndex)
{
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
const ETransformCurveChannel Channel = static_cast<ETransformCurveChannel>(SubCurveIndex);
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
for (int32 ChannelIndex = 0; ChannelIndex < 3; ++ChannelIndex)
{
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
const EVectorCurveChannel Axis = static_cast<EVectorCurveChannel>(ChannelIndex);
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
FAnimationCurveIdentifier TargetCurveIdentifier = CurveId;
UAnimationCurveIdentifierExtensions::GetTransformChildCurveIdentifier(TargetCurveIdentifier, Channel, Axis);
Controller->SetCurveKeys(TargetCurveIdentifier, SubCurveKeys[(SubCurveIndex * 3) + ChannelIndex], false);
}
}
return InverseAction;
}
FString FAddTransformCurveAction::ToStringInternal() const
{
return FText::Format(LOCTEXT("AddTransformCurveAction_Description", "Adding transform curve '{0}'."), FText::FromName(CurveId.CurveName)).ToString();
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
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
TUniquePtr<FChange> FAddRichCurveKeyAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
TUniquePtr<FChange> InverseAction = MakeUnique<FRemoveRichCurveKeyAction>(CurveId, Key.Time);
Controller->SetCurveKey(CurveId, Key, false);
return InverseAction;
}
FString FAddRichCurveKeyAction::ToStringInternal() const
{
const FString FloatLabel(TEXT("float"));
const FString TransformLabel(TEXT("transform"));
return FText::Format(LOCTEXT("AddNamedRichCurveKeyAction_Description", "Adding key to {0} curve '{1}'."), FText::FromString(CurveId.CurveType == ERawCurveTrackTypes::RCT_Float ? FloatLabel : TransformLabel), FText::FromName(CurveId.CurveName)).ToString();
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
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
TUniquePtr<FChange> FSetRichCurveKeyAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
const FRichCurve& RichCurve = Model->GetRichCurve(CurveId);
const FKeyHandle Handle = RichCurve.FindKey(Key.Time, 0.f);
ensure(Handle != FKeyHandle::Invalid());
FRichCurveKey CurrentKey = RichCurve.GetKey(Handle);
Controller->SetCurveKey(CurveId, Key, false);
return MakeUnique<FSetRichCurveKeyAction>(CurveId, CurrentKey);
}
FString FSetRichCurveKeyAction::ToStringInternal() const
{
const FString FloatLabel(TEXT("float"));
const FString TransformLabel(TEXT("transform"));
return FText::Format(LOCTEXT("SetNamedRichCurveKeyAction_Description", "Setting key for {0} curve '{1}'."), FText::FromString(CurveId.CurveType == ERawCurveTrackTypes::RCT_Float ? FloatLabel : TransformLabel), FText::FromName(CurveId.CurveName)).ToString();
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
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
TUniquePtr<FChange> FRemoveRichCurveKeyAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
const FRichCurve& RichCurve = Model->GetRichCurve(CurveId);
const FKeyHandle Handle = RichCurve.FindKey(Time, 0.f);
ensure(Handle != FKeyHandle::Invalid());
FRichCurveKey CurrentKey = RichCurve.GetKey(Handle);
Controller->RemoveCurveKey(CurveId, Time, false);
return MakeUnique<FAddRichCurveKeyAction>(CurveId, CurrentKey);
}
FString FRemoveRichCurveKeyAction::ToStringInternal() const
{
const FString FloatLabel(TEXT("float"));
const FString TransformLabel(TEXT("transform"));
return FText::Format(LOCTEXT("RemoveNamedRichCurveKeyAction_Description", "Removing key from {0} curve '{1}'."), FText::FromString(CurveId.CurveType == ERawCurveTrackTypes::RCT_Float ? FloatLabel : TransformLabel), FText::FromName(CurveId.CurveName)).ToString();
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
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
TUniquePtr<FChange> FSetRichCurveKeysAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
const FRichCurve& RichCurve = Model->GetRichCurve(CurveId);
TUniquePtr<FChange> InverseAction = MakeUnique<FSetRichCurveKeysAction>(CurveId, RichCurve.GetConstRefOfKeys());
Controller->SetCurveKeys(CurveId, Keys, false);
return InverseAction;
}
FString FSetRichCurveKeysAction::ToStringInternal() const
{
const FString FloatLabel(TEXT("float"));
const FString TransformLabel(TEXT("transform"));
return FText::Format(LOCTEXT("SetNamedRichCurveKeysAction_Description", "Replacing keys for {0} curve '{1}'."), FText::FromString(CurveId.CurveType == ERawCurveTrackTypes::RCT_Float ? FloatLabel : TransformLabel), FText::FromName(CurveId.CurveName)).ToString();
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
TUniquePtr<FChange> FSetRichCurveAttributesAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
{
const FRichCurve& RichCurve = Model->GetRichCurve(CurveId);
FCurveAttributes CurrentAttributes;
CurrentAttributes.SetPreExtrapolation(RichCurve.PreInfinityExtrap);
CurrentAttributes.SetPostExtrapolation(RichCurve.PostInfinityExtrap);
TUniquePtr<FChange> InverseAction = MakeUnique<FSetRichCurveAttributesAction>(CurveId, CurrentAttributes);
Controller->SetCurveAttributes(CurveId, Attributes, false);
return InverseAction;
}
FString FSetRichCurveAttributesAction::ToStringInternal() const
{
return FText::Format(LOCTEXT("SetCurveAttributesAction_Description", "Setting curve attributes '{0}'."), FText::FromName(CurveId.CurveName)).ToString();
}
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
TUniquePtr<FChange> FSetCurveColorAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
{
const FAnimCurveBase& AnimationCurve = Model->GetCurve(CurveId);
const FLinearColor CurrentColor = AnimationCurve.Color;
Controller->SetCurveColor(CurveId, Color, false);
return MakeUnique<FSetCurveColorAction>(CurveId, CurrentColor);
}
FString FSetCurveColorAction::ToStringInternal() const
{
return FText::Format(LOCTEXT("SetCurveColorAction_Description", "Setting curve color '{0}'."), FText::FromName(CurveId.CurveName)).ToString();
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
}
TUniquePtr<FChange> FSetCurveCommentAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
{
const FAnimCurveBase& AnimationCurve = Model->GetCurve(CurveId);
const FString& CurrentComment = AnimationCurve.Comment;
Controller->SetCurveComment(CurveId, Comment, false);
return MakeUnique<FSetCurveCommentAction>(CurveId, CurrentComment);
}
FString FSetCurveCommentAction::ToStringInternal() const
{
return FText::Format(LOCTEXT("SetCurveCommentAction_Description", "Setting curve comment '{0}'."), FText::FromName(CurveId.CurveName)).ToString();
}
New Animation Attributes system, replacing Custom Attributes: + Attribute structures to UAnimDataModel * These are sampled/copied into AnimSequence whenever they change + Attribute related Notifies and Payloads + Controller API and Actions for Attribute related behaviour + Type traits (TAttributeTypeTraitsBase) to determine support functionality for user-defined attribute types + TAttributeContainer equivalent to TCustomAttributes, used for keeping track of attributes at runtime in a TMap similar fashion * Has two exported specializations FStack/Heap-AttributeContainer + IAttributeBlendOperator interface used for Attribute related operations in Anim graph * Allows for user-defined blending behaviour for their associated types + TAttributeBlendOperator providing out-of-the-box blending behaviour for user-defined types + FAttributeBlendData helper structure, this encapsulates and abstracts the blend / attribute operations * Exposes two iterators, allowing BlendOperator to loop through (type) overlapping Attributes and unique attributes + Float/Integer/String Animation Attribute structures used to support legacy TVariant CustomAttribute data types + Transform animation attribute structure to add support for single-FTransform based attributes + FAnimationAttributeIdentifier identifier used to reference an attribute in a script-friendly manor + AttributeTypes static API for registering Attribute types + FAttributeCurve providing a curve-type with an Attribute type as its underlying key-value + TWrappedAttribute helper structure to wrap end template operate on raw memory (TArray buffer) + Added tests for * Attribute related controller functionality and actions * Attribute curve key reduction * Evaluating attributes from AnimSequence * Attribute operations (blend, accumulate etc) * Functional testing for blendspace attribute evaluation and blending * Changed default attribute blend type to Blend vs Override * Updated FBX import/export paths to handle and use new Attribute data structures * Attribute data is now incorporated into animation source data DDC key * Deprecated Custom Attributes stored on AnimSequence get converted into their equivalent Attribute structures * Deprecated all previous CustomAttribute structures, APIs and files * Corrected some comments in UAnimDataController.h * Updated existing custom attribute tests to adhere to new blend expectations/behaviour * Updated AnimSequence resize tests to also incorporate an attribute curve * Changed layered bone blend to use .5 blend weight vs 1.0 to cover more behaviour * Added transform attribute used to compare against bone transform during pre-existing functional testing (blended only) - Deleted CustomAttributes details customization #rb Thomas.Sarkanen #fyi kiaran.ritchie, koray.hagen, timothy.daoust [CL 15568420 by Jurre deBaare in ue5-main branch]
2021-03-02 09:04:09 -04:00
FAddAtributeAction::FAddAtributeAction(const FAnimatedBoneAttribute& InAttribute) : AttributeId(InAttribute.Identifier)
{
Keys = InAttribute.Curve.GetConstRefOfKeys();
}
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
TUniquePtr<FChange> FAddAtributeAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
New Animation Attributes system, replacing Custom Attributes: + Attribute structures to UAnimDataModel * These are sampled/copied into AnimSequence whenever they change + Attribute related Notifies and Payloads + Controller API and Actions for Attribute related behaviour + Type traits (TAttributeTypeTraitsBase) to determine support functionality for user-defined attribute types + TAttributeContainer equivalent to TCustomAttributes, used for keeping track of attributes at runtime in a TMap similar fashion * Has two exported specializations FStack/Heap-AttributeContainer + IAttributeBlendOperator interface used for Attribute related operations in Anim graph * Allows for user-defined blending behaviour for their associated types + TAttributeBlendOperator providing out-of-the-box blending behaviour for user-defined types + FAttributeBlendData helper structure, this encapsulates and abstracts the blend / attribute operations * Exposes two iterators, allowing BlendOperator to loop through (type) overlapping Attributes and unique attributes + Float/Integer/String Animation Attribute structures used to support legacy TVariant CustomAttribute data types + Transform animation attribute structure to add support for single-FTransform based attributes + FAnimationAttributeIdentifier identifier used to reference an attribute in a script-friendly manor + AttributeTypes static API for registering Attribute types + FAttributeCurve providing a curve-type with an Attribute type as its underlying key-value + TWrappedAttribute helper structure to wrap end template operate on raw memory (TArray buffer) + Added tests for * Attribute related controller functionality and actions * Attribute curve key reduction * Evaluating attributes from AnimSequence * Attribute operations (blend, accumulate etc) * Functional testing for blendspace attribute evaluation and blending * Changed default attribute blend type to Blend vs Override * Updated FBX import/export paths to handle and use new Attribute data structures * Attribute data is now incorporated into animation source data DDC key * Deprecated Custom Attributes stored on AnimSequence get converted into their equivalent Attribute structures * Deprecated all previous CustomAttribute structures, APIs and files * Corrected some comments in UAnimDataController.h * Updated existing custom attribute tests to adhere to new blend expectations/behaviour * Updated AnimSequence resize tests to also incorporate an attribute curve * Changed layered bone blend to use .5 blend weight vs 1.0 to cover more behaviour * Added transform attribute used to compare against bone transform during pre-existing functional testing (blended only) - Deleted CustomAttributes details customization #rb Thomas.Sarkanen #fyi kiaran.ritchie, koray.hagen, timothy.daoust [CL 15568420 by Jurre deBaare in ue5-main branch]
2021-03-02 09:04:09 -04:00
{
TArray<const void*> VoidValues;
Algo::Transform(Keys, VoidValues, [](const FAttributeKey& Key)
{
return Key.GetValuePtr<void>();
});
TArray<float> Times;
Algo::Transform(Keys, Times, [](const FAttributeKey& Key)
{
return Key.Time;
});
Controller->AddAttribute(AttributeId, false);
Controller->SetAttributeKeys(AttributeId, MakeArrayView(Times), MakeArrayView(VoidValues), AttributeId.GetType(), false);
New Animation Attributes system, replacing Custom Attributes: + Attribute structures to UAnimDataModel * These are sampled/copied into AnimSequence whenever they change + Attribute related Notifies and Payloads + Controller API and Actions for Attribute related behaviour + Type traits (TAttributeTypeTraitsBase) to determine support functionality for user-defined attribute types + TAttributeContainer equivalent to TCustomAttributes, used for keeping track of attributes at runtime in a TMap similar fashion * Has two exported specializations FStack/Heap-AttributeContainer + IAttributeBlendOperator interface used for Attribute related operations in Anim graph * Allows for user-defined blending behaviour for their associated types + TAttributeBlendOperator providing out-of-the-box blending behaviour for user-defined types + FAttributeBlendData helper structure, this encapsulates and abstracts the blend / attribute operations * Exposes two iterators, allowing BlendOperator to loop through (type) overlapping Attributes and unique attributes + Float/Integer/String Animation Attribute structures used to support legacy TVariant CustomAttribute data types + Transform animation attribute structure to add support for single-FTransform based attributes + FAnimationAttributeIdentifier identifier used to reference an attribute in a script-friendly manor + AttributeTypes static API for registering Attribute types + FAttributeCurve providing a curve-type with an Attribute type as its underlying key-value + TWrappedAttribute helper structure to wrap end template operate on raw memory (TArray buffer) + Added tests for * Attribute related controller functionality and actions * Attribute curve key reduction * Evaluating attributes from AnimSequence * Attribute operations (blend, accumulate etc) * Functional testing for blendspace attribute evaluation and blending * Changed default attribute blend type to Blend vs Override * Updated FBX import/export paths to handle and use new Attribute data structures * Attribute data is now incorporated into animation source data DDC key * Deprecated Custom Attributes stored on AnimSequence get converted into their equivalent Attribute structures * Deprecated all previous CustomAttribute structures, APIs and files * Corrected some comments in UAnimDataController.h * Updated existing custom attribute tests to adhere to new blend expectations/behaviour * Updated AnimSequence resize tests to also incorporate an attribute curve * Changed layered bone blend to use .5 blend weight vs 1.0 to cover more behaviour * Added transform attribute used to compare against bone transform during pre-existing functional testing (blended only) - Deleted CustomAttributes details customization #rb Thomas.Sarkanen #fyi kiaran.ritchie, koray.hagen, timothy.daoust [CL 15568420 by Jurre deBaare in ue5-main branch]
2021-03-02 09:04:09 -04:00
return MakeUnique<FRemoveAtributeAction>(AttributeId);
}
FString FAddAtributeAction::ToStringInternal() const
{
return FText::Format(LOCTEXT("AddAttributeAction_Description", "Adding attribute '{0}'."), FText::FromName(AttributeId.GetName())).ToString();
}
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
TUniquePtr<FChange> FRemoveAtributeAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
New Animation Attributes system, replacing Custom Attributes: + Attribute structures to UAnimDataModel * These are sampled/copied into AnimSequence whenever they change + Attribute related Notifies and Payloads + Controller API and Actions for Attribute related behaviour + Type traits (TAttributeTypeTraitsBase) to determine support functionality for user-defined attribute types + TAttributeContainer equivalent to TCustomAttributes, used for keeping track of attributes at runtime in a TMap similar fashion * Has two exported specializations FStack/Heap-AttributeContainer + IAttributeBlendOperator interface used for Attribute related operations in Anim graph * Allows for user-defined blending behaviour for their associated types + TAttributeBlendOperator providing out-of-the-box blending behaviour for user-defined types + FAttributeBlendData helper structure, this encapsulates and abstracts the blend / attribute operations * Exposes two iterators, allowing BlendOperator to loop through (type) overlapping Attributes and unique attributes + Float/Integer/String Animation Attribute structures used to support legacy TVariant CustomAttribute data types + Transform animation attribute structure to add support for single-FTransform based attributes + FAnimationAttributeIdentifier identifier used to reference an attribute in a script-friendly manor + AttributeTypes static API for registering Attribute types + FAttributeCurve providing a curve-type with an Attribute type as its underlying key-value + TWrappedAttribute helper structure to wrap end template operate on raw memory (TArray buffer) + Added tests for * Attribute related controller functionality and actions * Attribute curve key reduction * Evaluating attributes from AnimSequence * Attribute operations (blend, accumulate etc) * Functional testing for blendspace attribute evaluation and blending * Changed default attribute blend type to Blend vs Override * Updated FBX import/export paths to handle and use new Attribute data structures * Attribute data is now incorporated into animation source data DDC key * Deprecated Custom Attributes stored on AnimSequence get converted into their equivalent Attribute structures * Deprecated all previous CustomAttribute structures, APIs and files * Corrected some comments in UAnimDataController.h * Updated existing custom attribute tests to adhere to new blend expectations/behaviour * Updated AnimSequence resize tests to also incorporate an attribute curve * Changed layered bone blend to use .5 blend weight vs 1.0 to cover more behaviour * Added transform attribute used to compare against bone transform during pre-existing functional testing (blended only) - Deleted CustomAttributes details customization #rb Thomas.Sarkanen #fyi kiaran.ritchie, koray.hagen, timothy.daoust [CL 15568420 by Jurre deBaare in ue5-main branch]
2021-03-02 09:04:09 -04:00
{
const FAnimatedBoneAttribute& Attribute = Model->GetAttribute(AttributeId);
TUniquePtr<FAddAtributeAction> InverseAction = MakeUnique<FAddAtributeAction>(Attribute);
Controller->RemoveAttribute(AttributeId, false);
return InverseAction;
}
FString FRemoveAtributeAction::ToStringInternal() const
{
return FText::Format(LOCTEXT("RemoveAttributeAction_Description", "Removing attribute '{0}'."), FText::FromName(AttributeId.GetName())).ToString();
}
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
TUniquePtr<FChange> FAddAtributeKeyAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
New Animation Attributes system, replacing Custom Attributes: + Attribute structures to UAnimDataModel * These are sampled/copied into AnimSequence whenever they change + Attribute related Notifies and Payloads + Controller API and Actions for Attribute related behaviour + Type traits (TAttributeTypeTraitsBase) to determine support functionality for user-defined attribute types + TAttributeContainer equivalent to TCustomAttributes, used for keeping track of attributes at runtime in a TMap similar fashion * Has two exported specializations FStack/Heap-AttributeContainer + IAttributeBlendOperator interface used for Attribute related operations in Anim graph * Allows for user-defined blending behaviour for their associated types + TAttributeBlendOperator providing out-of-the-box blending behaviour for user-defined types + FAttributeBlendData helper structure, this encapsulates and abstracts the blend / attribute operations * Exposes two iterators, allowing BlendOperator to loop through (type) overlapping Attributes and unique attributes + Float/Integer/String Animation Attribute structures used to support legacy TVariant CustomAttribute data types + Transform animation attribute structure to add support for single-FTransform based attributes + FAnimationAttributeIdentifier identifier used to reference an attribute in a script-friendly manor + AttributeTypes static API for registering Attribute types + FAttributeCurve providing a curve-type with an Attribute type as its underlying key-value + TWrappedAttribute helper structure to wrap end template operate on raw memory (TArray buffer) + Added tests for * Attribute related controller functionality and actions * Attribute curve key reduction * Evaluating attributes from AnimSequence * Attribute operations (blend, accumulate etc) * Functional testing for blendspace attribute evaluation and blending * Changed default attribute blend type to Blend vs Override * Updated FBX import/export paths to handle and use new Attribute data structures * Attribute data is now incorporated into animation source data DDC key * Deprecated Custom Attributes stored on AnimSequence get converted into their equivalent Attribute structures * Deprecated all previous CustomAttribute structures, APIs and files * Corrected some comments in UAnimDataController.h * Updated existing custom attribute tests to adhere to new blend expectations/behaviour * Updated AnimSequence resize tests to also incorporate an attribute curve * Changed layered bone blend to use .5 blend weight vs 1.0 to cover more behaviour * Added transform attribute used to compare against bone transform during pre-existing functional testing (blended only) - Deleted CustomAttributes details customization #rb Thomas.Sarkanen #fyi kiaran.ritchie, koray.hagen, timothy.daoust [CL 15568420 by Jurre deBaare in ue5-main branch]
2021-03-02 09:04:09 -04:00
{
Controller->SetAttributeKey(AttributeId, Key.Time, Key.GetValuePtr<void>(), AttributeId.GetType(), false);
New Animation Attributes system, replacing Custom Attributes: + Attribute structures to UAnimDataModel * These are sampled/copied into AnimSequence whenever they change + Attribute related Notifies and Payloads + Controller API and Actions for Attribute related behaviour + Type traits (TAttributeTypeTraitsBase) to determine support functionality for user-defined attribute types + TAttributeContainer equivalent to TCustomAttributes, used for keeping track of attributes at runtime in a TMap similar fashion * Has two exported specializations FStack/Heap-AttributeContainer + IAttributeBlendOperator interface used for Attribute related operations in Anim graph * Allows for user-defined blending behaviour for their associated types + TAttributeBlendOperator providing out-of-the-box blending behaviour for user-defined types + FAttributeBlendData helper structure, this encapsulates and abstracts the blend / attribute operations * Exposes two iterators, allowing BlendOperator to loop through (type) overlapping Attributes and unique attributes + Float/Integer/String Animation Attribute structures used to support legacy TVariant CustomAttribute data types + Transform animation attribute structure to add support for single-FTransform based attributes + FAnimationAttributeIdentifier identifier used to reference an attribute in a script-friendly manor + AttributeTypes static API for registering Attribute types + FAttributeCurve providing a curve-type with an Attribute type as its underlying key-value + TWrappedAttribute helper structure to wrap end template operate on raw memory (TArray buffer) + Added tests for * Attribute related controller functionality and actions * Attribute curve key reduction * Evaluating attributes from AnimSequence * Attribute operations (blend, accumulate etc) * Functional testing for blendspace attribute evaluation and blending * Changed default attribute blend type to Blend vs Override * Updated FBX import/export paths to handle and use new Attribute data structures * Attribute data is now incorporated into animation source data DDC key * Deprecated Custom Attributes stored on AnimSequence get converted into their equivalent Attribute structures * Deprecated all previous CustomAttribute structures, APIs and files * Corrected some comments in UAnimDataController.h * Updated existing custom attribute tests to adhere to new blend expectations/behaviour * Updated AnimSequence resize tests to also incorporate an attribute curve * Changed layered bone blend to use .5 blend weight vs 1.0 to cover more behaviour * Added transform attribute used to compare against bone transform during pre-existing functional testing (blended only) - Deleted CustomAttributes details customization #rb Thomas.Sarkanen #fyi kiaran.ritchie, koray.hagen, timothy.daoust [CL 15568420 by Jurre deBaare in ue5-main branch]
2021-03-02 09:04:09 -04:00
return MakeUnique<FRemoveAtributeKeyAction>(AttributeId, Key.Time);
}
FString FAddAtributeKeyAction::ToStringInternal() const
{
return FText::Format(LOCTEXT("AddAttributeKeyAction_Description", "Adding key to attribute '{0}'."), FText::FromName(AttributeId.GetName())).ToString();
}
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
TUniquePtr<FChange> FSetAtributeKeyAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
New Animation Attributes system, replacing Custom Attributes: + Attribute structures to UAnimDataModel * These are sampled/copied into AnimSequence whenever they change + Attribute related Notifies and Payloads + Controller API and Actions for Attribute related behaviour + Type traits (TAttributeTypeTraitsBase) to determine support functionality for user-defined attribute types + TAttributeContainer equivalent to TCustomAttributes, used for keeping track of attributes at runtime in a TMap similar fashion * Has two exported specializations FStack/Heap-AttributeContainer + IAttributeBlendOperator interface used for Attribute related operations in Anim graph * Allows for user-defined blending behaviour for their associated types + TAttributeBlendOperator providing out-of-the-box blending behaviour for user-defined types + FAttributeBlendData helper structure, this encapsulates and abstracts the blend / attribute operations * Exposes two iterators, allowing BlendOperator to loop through (type) overlapping Attributes and unique attributes + Float/Integer/String Animation Attribute structures used to support legacy TVariant CustomAttribute data types + Transform animation attribute structure to add support for single-FTransform based attributes + FAnimationAttributeIdentifier identifier used to reference an attribute in a script-friendly manor + AttributeTypes static API for registering Attribute types + FAttributeCurve providing a curve-type with an Attribute type as its underlying key-value + TWrappedAttribute helper structure to wrap end template operate on raw memory (TArray buffer) + Added tests for * Attribute related controller functionality and actions * Attribute curve key reduction * Evaluating attributes from AnimSequence * Attribute operations (blend, accumulate etc) * Functional testing for blendspace attribute evaluation and blending * Changed default attribute blend type to Blend vs Override * Updated FBX import/export paths to handle and use new Attribute data structures * Attribute data is now incorporated into animation source data DDC key * Deprecated Custom Attributes stored on AnimSequence get converted into their equivalent Attribute structures * Deprecated all previous CustomAttribute structures, APIs and files * Corrected some comments in UAnimDataController.h * Updated existing custom attribute tests to adhere to new blend expectations/behaviour * Updated AnimSequence resize tests to also incorporate an attribute curve * Changed layered bone blend to use .5 blend weight vs 1.0 to cover more behaviour * Added transform attribute used to compare against bone transform during pre-existing functional testing (blended only) - Deleted CustomAttributes details customization #rb Thomas.Sarkanen #fyi kiaran.ritchie, koray.hagen, timothy.daoust [CL 15568420 by Jurre deBaare in ue5-main branch]
2021-03-02 09:04:09 -04:00
{
const FAnimatedBoneAttribute& Attribute = Model->GetAttribute(AttributeId);
const FKeyHandle Handle = Attribute.Curve.FindKey(Key.Time, 0.f);
ensure(Handle != FKeyHandle::Invalid());
FAttributeKey CurrentKey = Attribute.Curve.GetKey(Handle);
Controller->SetAttributeKey(AttributeId, Key.Time, Key.GetValuePtr<void>(), AttributeId.GetType(), false);
New Animation Attributes system, replacing Custom Attributes: + Attribute structures to UAnimDataModel * These are sampled/copied into AnimSequence whenever they change + Attribute related Notifies and Payloads + Controller API and Actions for Attribute related behaviour + Type traits (TAttributeTypeTraitsBase) to determine support functionality for user-defined attribute types + TAttributeContainer equivalent to TCustomAttributes, used for keeping track of attributes at runtime in a TMap similar fashion * Has two exported specializations FStack/Heap-AttributeContainer + IAttributeBlendOperator interface used for Attribute related operations in Anim graph * Allows for user-defined blending behaviour for their associated types + TAttributeBlendOperator providing out-of-the-box blending behaviour for user-defined types + FAttributeBlendData helper structure, this encapsulates and abstracts the blend / attribute operations * Exposes two iterators, allowing BlendOperator to loop through (type) overlapping Attributes and unique attributes + Float/Integer/String Animation Attribute structures used to support legacy TVariant CustomAttribute data types + Transform animation attribute structure to add support for single-FTransform based attributes + FAnimationAttributeIdentifier identifier used to reference an attribute in a script-friendly manor + AttributeTypes static API for registering Attribute types + FAttributeCurve providing a curve-type with an Attribute type as its underlying key-value + TWrappedAttribute helper structure to wrap end template operate on raw memory (TArray buffer) + Added tests for * Attribute related controller functionality and actions * Attribute curve key reduction * Evaluating attributes from AnimSequence * Attribute operations (blend, accumulate etc) * Functional testing for blendspace attribute evaluation and blending * Changed default attribute blend type to Blend vs Override * Updated FBX import/export paths to handle and use new Attribute data structures * Attribute data is now incorporated into animation source data DDC key * Deprecated Custom Attributes stored on AnimSequence get converted into their equivalent Attribute structures * Deprecated all previous CustomAttribute structures, APIs and files * Corrected some comments in UAnimDataController.h * Updated existing custom attribute tests to adhere to new blend expectations/behaviour * Updated AnimSequence resize tests to also incorporate an attribute curve * Changed layered bone blend to use .5 blend weight vs 1.0 to cover more behaviour * Added transform attribute used to compare against bone transform during pre-existing functional testing (blended only) - Deleted CustomAttributes details customization #rb Thomas.Sarkanen #fyi kiaran.ritchie, koray.hagen, timothy.daoust [CL 15568420 by Jurre deBaare in ue5-main branch]
2021-03-02 09:04:09 -04:00
return MakeUnique<FSetAtributeKeyAction>(AttributeId, CurrentKey);
}
FString FSetAtributeKeyAction::ToStringInternal() const
{
return FText::Format(LOCTEXT("SetAttributeKeyAction_Description", "Setting key on attribute '{0}'."), FText::FromName(AttributeId.GetName())).ToString();
}
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
TUniquePtr<FChange> FRemoveAtributeKeyAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
New Animation Attributes system, replacing Custom Attributes: + Attribute structures to UAnimDataModel * These are sampled/copied into AnimSequence whenever they change + Attribute related Notifies and Payloads + Controller API and Actions for Attribute related behaviour + Type traits (TAttributeTypeTraitsBase) to determine support functionality for user-defined attribute types + TAttributeContainer equivalent to TCustomAttributes, used for keeping track of attributes at runtime in a TMap similar fashion * Has two exported specializations FStack/Heap-AttributeContainer + IAttributeBlendOperator interface used for Attribute related operations in Anim graph * Allows for user-defined blending behaviour for their associated types + TAttributeBlendOperator providing out-of-the-box blending behaviour for user-defined types + FAttributeBlendData helper structure, this encapsulates and abstracts the blend / attribute operations * Exposes two iterators, allowing BlendOperator to loop through (type) overlapping Attributes and unique attributes + Float/Integer/String Animation Attribute structures used to support legacy TVariant CustomAttribute data types + Transform animation attribute structure to add support for single-FTransform based attributes + FAnimationAttributeIdentifier identifier used to reference an attribute in a script-friendly manor + AttributeTypes static API for registering Attribute types + FAttributeCurve providing a curve-type with an Attribute type as its underlying key-value + TWrappedAttribute helper structure to wrap end template operate on raw memory (TArray buffer) + Added tests for * Attribute related controller functionality and actions * Attribute curve key reduction * Evaluating attributes from AnimSequence * Attribute operations (blend, accumulate etc) * Functional testing for blendspace attribute evaluation and blending * Changed default attribute blend type to Blend vs Override * Updated FBX import/export paths to handle and use new Attribute data structures * Attribute data is now incorporated into animation source data DDC key * Deprecated Custom Attributes stored on AnimSequence get converted into their equivalent Attribute structures * Deprecated all previous CustomAttribute structures, APIs and files * Corrected some comments in UAnimDataController.h * Updated existing custom attribute tests to adhere to new blend expectations/behaviour * Updated AnimSequence resize tests to also incorporate an attribute curve * Changed layered bone blend to use .5 blend weight vs 1.0 to cover more behaviour * Added transform attribute used to compare against bone transform during pre-existing functional testing (blended only) - Deleted CustomAttributes details customization #rb Thomas.Sarkanen #fyi kiaran.ritchie, koray.hagen, timothy.daoust [CL 15568420 by Jurre deBaare in ue5-main branch]
2021-03-02 09:04:09 -04:00
{
const FAnimatedBoneAttribute& Attribute = Model->GetAttribute(AttributeId);
const FKeyHandle Handle = Attribute.Curve.FindKey(Time, 0.f);
ensure(Handle != FKeyHandle::Invalid());
FAttributeKey CurrentKey = Attribute.Curve.GetKey(Handle);
Controller->RemoveAttributeKey(AttributeId, Time, false);
return MakeUnique<FAddAtributeKeyAction>(AttributeId, CurrentKey);
}
FString FRemoveAtributeKeyAction::ToStringInternal() const
{
return FText::Format(LOCTEXT("RemoveAttributeKeyAction_Description", "Removing key from attribute '{0}'."), FText::FromName(AttributeId.GetName())).ToString();
}
FSetAtributeKeysAction::FSetAtributeKeysAction(const FAnimatedBoneAttribute& InAttribute) : AttributeId(InAttribute.Identifier)
{
Keys = InAttribute.Curve.GetConstRefOfKeys();
}
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
TUniquePtr<FChange> FSetAtributeKeysAction::ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller)
New Animation Attributes system, replacing Custom Attributes: + Attribute structures to UAnimDataModel * These are sampled/copied into AnimSequence whenever they change + Attribute related Notifies and Payloads + Controller API and Actions for Attribute related behaviour + Type traits (TAttributeTypeTraitsBase) to determine support functionality for user-defined attribute types + TAttributeContainer equivalent to TCustomAttributes, used for keeping track of attributes at runtime in a TMap similar fashion * Has two exported specializations FStack/Heap-AttributeContainer + IAttributeBlendOperator interface used for Attribute related operations in Anim graph * Allows for user-defined blending behaviour for their associated types + TAttributeBlendOperator providing out-of-the-box blending behaviour for user-defined types + FAttributeBlendData helper structure, this encapsulates and abstracts the blend / attribute operations * Exposes two iterators, allowing BlendOperator to loop through (type) overlapping Attributes and unique attributes + Float/Integer/String Animation Attribute structures used to support legacy TVariant CustomAttribute data types + Transform animation attribute structure to add support for single-FTransform based attributes + FAnimationAttributeIdentifier identifier used to reference an attribute in a script-friendly manor + AttributeTypes static API for registering Attribute types + FAttributeCurve providing a curve-type with an Attribute type as its underlying key-value + TWrappedAttribute helper structure to wrap end template operate on raw memory (TArray buffer) + Added tests for * Attribute related controller functionality and actions * Attribute curve key reduction * Evaluating attributes from AnimSequence * Attribute operations (blend, accumulate etc) * Functional testing for blendspace attribute evaluation and blending * Changed default attribute blend type to Blend vs Override * Updated FBX import/export paths to handle and use new Attribute data structures * Attribute data is now incorporated into animation source data DDC key * Deprecated Custom Attributes stored on AnimSequence get converted into their equivalent Attribute structures * Deprecated all previous CustomAttribute structures, APIs and files * Corrected some comments in UAnimDataController.h * Updated existing custom attribute tests to adhere to new blend expectations/behaviour * Updated AnimSequence resize tests to also incorporate an attribute curve * Changed layered bone blend to use .5 blend weight vs 1.0 to cover more behaviour * Added transform attribute used to compare against bone transform during pre-existing functional testing (blended only) - Deleted CustomAttributes details customization #rb Thomas.Sarkanen #fyi kiaran.ritchie, koray.hagen, timothy.daoust [CL 15568420 by Jurre deBaare in ue5-main branch]
2021-03-02 09:04:09 -04:00
{
TUniquePtr<FSetAtributeKeysAction> InverseAction = MakeUnique<FSetAtributeKeysAction>(Model->GetAttribute(AttributeId));
TArray<const void*> VoidValues;
Algo::Transform(Keys, VoidValues, [](const FAttributeKey& Key)
{
return Key.GetValuePtr<void>();
});
TArray<float> Times;
Algo::Transform(Keys, Times, [](const FAttributeKey& Key)
{
return Key.Time;
});
Controller->SetAttributeKeys(AttributeId, MakeArrayView(Times), MakeArrayView(VoidValues), AttributeId.GetType(), false);
New Animation Attributes system, replacing Custom Attributes: + Attribute structures to UAnimDataModel * These are sampled/copied into AnimSequence whenever they change + Attribute related Notifies and Payloads + Controller API and Actions for Attribute related behaviour + Type traits (TAttributeTypeTraitsBase) to determine support functionality for user-defined attribute types + TAttributeContainer equivalent to TCustomAttributes, used for keeping track of attributes at runtime in a TMap similar fashion * Has two exported specializations FStack/Heap-AttributeContainer + IAttributeBlendOperator interface used for Attribute related operations in Anim graph * Allows for user-defined blending behaviour for their associated types + TAttributeBlendOperator providing out-of-the-box blending behaviour for user-defined types + FAttributeBlendData helper structure, this encapsulates and abstracts the blend / attribute operations * Exposes two iterators, allowing BlendOperator to loop through (type) overlapping Attributes and unique attributes + Float/Integer/String Animation Attribute structures used to support legacy TVariant CustomAttribute data types + Transform animation attribute structure to add support for single-FTransform based attributes + FAnimationAttributeIdentifier identifier used to reference an attribute in a script-friendly manor + AttributeTypes static API for registering Attribute types + FAttributeCurve providing a curve-type with an Attribute type as its underlying key-value + TWrappedAttribute helper structure to wrap end template operate on raw memory (TArray buffer) + Added tests for * Attribute related controller functionality and actions * Attribute curve key reduction * Evaluating attributes from AnimSequence * Attribute operations (blend, accumulate etc) * Functional testing for blendspace attribute evaluation and blending * Changed default attribute blend type to Blend vs Override * Updated FBX import/export paths to handle and use new Attribute data structures * Attribute data is now incorporated into animation source data DDC key * Deprecated Custom Attributes stored on AnimSequence get converted into their equivalent Attribute structures * Deprecated all previous CustomAttribute structures, APIs and files * Corrected some comments in UAnimDataController.h * Updated existing custom attribute tests to adhere to new blend expectations/behaviour * Updated AnimSequence resize tests to also incorporate an attribute curve * Changed layered bone blend to use .5 blend weight vs 1.0 to cover more behaviour * Added transform attribute used to compare against bone transform during pre-existing functional testing (blended only) - Deleted CustomAttributes details customization #rb Thomas.Sarkanen #fyi kiaran.ritchie, koray.hagen, timothy.daoust [CL 15568420 by Jurre deBaare in ue5-main branch]
2021-03-02 09:04:09 -04:00
return InverseAction;
}
FString FSetAtributeKeysAction::ToStringInternal() const
{
return FText::Format(LOCTEXT("SetAttributeKeysAction_Description", "Replacing keys for attribute '{0}'."), FText::FromName(AttributeId.GetName())).ToString();
}
Animation data MVC refactor #jira UE-104234 #rb Thomas.Sarkanen, Martin.Wilson, Alexis.Matte, Michael.Zyracki + Introduced UAnimDataModel, this currently represents the source data for bone and curve animation. It contains: + Bone animation tracks (FBoneAnimationTrack) + Key data (coarse) + Name + Bone tree index + Curve data (FAnimationCurveData) + Float Curves + Transform Curves + Play length + Sampling rate + Used for deriving the expected number of keys/frames when combined with the PlayLength + Transient data for supporting backwards compatibility APIs + (Dynamic) delegate which broadcasts the mutation Notifies + Introduced UAnimDataController, this has sole authority over mutating data contained by UAnimDataModel + API functionality allows to transform the contained data in all ways currently expected in the engine. + Any mutation will add an undo/redo-able FChange object into the transaction buffer + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo + Broadcasts change notifies alongside a payload object containing details about the change + Interested systems/objects can register to these changes through UAnimDataModel::OnModelModified event + Almost all functionality is exposed to both Blueprint and Python scripting + Allows for opening 'Brackets', these define the beginning and end of a chain of mutations. Allowing anything registered to OnModelModified to halt responding to the notifies until the (top-level) bracket is closed + Undo/redo actions + Each mutation to the UAnimDataModel is covered by a 'Action' which is based of FChange and is used to insert a undo/redo-able operation into the transactions buffer + Introduced EAnimDataModelNotifType and per-notify payload types. These are used to update views, and any model derived data + Introduced FAnimationCurveIdentifier, exposed to scripting, this is used for referencing a curve by name and type when passed to the controller + Allows for targetting a specific RichCurve as part of a TransformCurve + Introduced FAnimationDataNotifyCollectorused for keeping track of which notifies of type EAnimDataModelNotifType are broadcasted between top-level EAnimDataModelNotifType::BracketOpened and EAnimDataModelNotifType::BracketClosed notifies + Added CanTransact to UEngine, returns whether or not a transaction can be made + Added UAnimCompositeBase::SetCompositeLength, used for runtime changing of play length value + Animation Sequence helpers, containing 'helper' functionality for both AnimSequence and AnimDataModel * Animation Sequence Base + virtual PopulateModel, called during upgrade path for converting existing (legacy) data to the new UAnimDataModel data + virtual OnModelModified, registered to the Model's OnModified event to handle any Notifies and payloads + Added UAnimDataModel sub-object (editor only) + Added UAnimDataController instance (transient and editor only) + FAnimationDataNotifyCollector to keep track of model bracketed notifies * Deprecated * SetSequenceLength() * RefreshCurveData() * MarkRawDataAsModified() * RegisterOnAnimCurvesChanged() * UnregisterOnAnimCurvesChanged() * UnregisterOnAnimTrackCurvesChanged() * RegisterOnAnimTrackCurvesChanged() * Public access to RawCurveData * Animation Sequence + Implements PopulateModel/OnModelModified for AnimationSequence related data + Added TargetFrameRate, currently locked to the initial sampling rate, but allows for resampling the UAnimDataModel data according to the set rate + Added NumberOfSampledKeys (editor only), populated by resampling process + Added NumberOfSampledFrames (editor only), populated by resampling process + Added ResampledAnimationTrackData (editor only and transient), populated by resampling process + Added bBlockCompressionRequests (editor only), used for blocking compression during automation tests * Deprecated * SetNumberOfSampledKeys() * MarkRawDataAsModified() * GetRawAnimationData() * GetAnimationTrackNames() * AddNewRawTrack() * GetRawTrackToSkeletonMapTable() * GetRawAnimationTrack() * GetRawAnimationTrack() * UpdateFrameRate() * ExtractBoneTransform() * CompressRawAnimData() * GetSkeletonIndexFromRawDataTrackIndex() * RecycleAnimSequence() * CleanAnimSequenceForImport() * CopyNotifies() * PostProcessSequence() * AddLoopingInterpolation() * RemoveAllTracks() * DoesContainTransformCurves() * InsertFramesToRawAnimData() * CropRawAnimData() * RemoveTrack() * InsertTrack() * ResizeSequence() * Non-editor access to GetUncompressedRawSize() * Non-editor access to GetApproxRawSize() * Public access to UpdateCompressedCurveName() * NumberOfKeys * SamplingFrameRate * TrackToSkeletonMapTable * RawAnimationData * AnimationTrackNames * Animation Streamable * Model from source Sequence is duplicated rather than copying animation data * Deprecated ERawCurveTrackTypes::RCT_Vector (marked as hidden) + Added automated test for + All script exposed controller functionality + Undo/redo actions * Updated existing AnimSequence tests with deprecation and new expected data + Base data for compression is now populated from the 'resampled' version stored on the AnimSequence + Data cleanup and validation is now performed during compression + Track sanitization is now performed during compression (normalizing Quats and clamping near-zero values to zero) + Key reduction + Invalid track (missing bone from skeleton) removal + Curve name validation against skeleton * Replaced RawCurves with Float curves * Updated DDC key - Removed all Guid generation related functionality (now part of the model) * AnimSequenceBase model registers to AnimModel's notify event, used for refreshing the tracks * Replaces the in-place calling of RefreshTracks() * All curve tracks now hold a const CurveType* rather than a CurveType*/& for introspection of its data + Any mutations now go through the controller API + Uses AnimationCurveIdentifier to set Transform's per-channel tracks * RichCurveEditorModelNamed conformed to model/controller + Any modifications are applied to an temporary CurveType which always contains a copy of the const-ptr after any previous mutation + Registers to the outer AnimModel's notify event, used for updating the cached curve data + Registers to CurveModifiedDelegate, used for copying the temp curve data to the model using SetCurveKeys * Not-ideal but point that I got to for V1 * Would be replaced with either refactoring FRichCurve to be MVC like, or by calling UAnimDataController functionality from an implementation of FRichCurveEditorModel * Mark FChange overrides as final for swap/command change permutations * Changed FCompoundChange GetDescription to return concatenation of all sub-changes * Added GetDescription to FTransaction which returns the ToString() value of any contained FChange entries. * Entries in SUndoHistory tab now have a ToolTip showing the GetDescription() value + FChangeTransactor helper object allows for keeping track of (compounded) FChange's and inserting them into GUndo * Deprecation handling, conforming code to new APIs and exposing structure/objects/properties to scripting * Conforming AnimSequence importing from FBX to Model/Controller changes [CL 15106211 by Jurre deBaare in ue5-main branch]
2021-01-15 06:41:11 -04:00
} // namespace Anim
} // namespace UE
#endif // WITH_EDITOR
#undef LOCTEXT_NAMESPACE // "AnimDataControllerActions"