Files

453 lines
16 KiB
C
Raw Permalink 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.
#pragma once
#include "CurveDataAbstraction.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 "Misc/Change.h"
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
#include "Misc/CoreMiscDefines.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 "Animation/AnimTypes.h"
#include "Misc/FrameRate.h"
class UObject;
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
class IAnimationDataModel;
class IAnimationDataController;
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
#if WITH_EDITOR
namespace UE {
namespace Anim {
/**
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
* UAnimDataController instanced FChange-based objects used for storing mutations to an IAnimationDataModel within the Transaction Buffer.
* Each Action class represents an (invertable) operation mutating an IAnimationDataModel object utilizing a UAnimDataController. Allowing
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 a more granular approach to undo/redo-ing changes while also allowing for script-based interoperability.
*/
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
class ANIMATIONDATACONTROLLER_API FAnimDataBaseAction : public FSwapChange
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
{
public:
virtual TUniquePtr<FChange> Execute(UObject* Object) final;
virtual ~FAnimDataBaseAction() {}
virtual FString ToString() const override;
protected:
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) = 0;
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
virtual FString ToStringInternal() const = 0;
};
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
class ANIMATIONDATACONTROLLER_API FOpenBracketAction : public FAnimDataBaseAction
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
{
public:
explicit FOpenBracketAction(const FString& InDescription) : Description(InDescription) {}
virtual ~FOpenBracketAction() {}
protected:
FOpenBracketAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FString 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
class ANIMATIONDATACONTROLLER_API FCloseBracketAction : public FAnimDataBaseAction
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
{
public:
explicit FCloseBracketAction(const FString& InDescription) : Description(InDescription) {}
virtual ~FCloseBracketAction() {}
protected:
FCloseBracketAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FString 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
class ANIMATIONDATACONTROLLER_API FAddTrackAction : public FAnimDataBaseAction
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
{
public:
explicit 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
virtual ~FAddTrackAction() {}
protected:
FAddTrackAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FName Name;
TArray<FTransform> TransformData;
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
class ANIMATIONDATACONTROLLER_API FRemoveTrackAction : public FAnimDataBaseAction
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
{
public:
explicit FRemoveTrackAction(const FName& 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
virtual ~FRemoveTrackAction() {}
protected:
FRemoveTrackAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FName Name;
};
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
class ANIMATIONDATACONTROLLER_API FSetTrackKeysAction : public FAnimDataBaseAction
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
{
public:
explicit 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
virtual ~FSetTrackKeysAction() {}
protected:
FSetTrackKeysAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FName Name;
TArray<FTransform> TransformData;
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
class ANIMATIONDATACONTROLLER_API FResizePlayLengthInFramesAction : public FAnimDataBaseAction
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
{
public:
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
explicit FResizePlayLengthInFramesAction(const IAnimationDataModel* InModel, FFrameNumber F0, FFrameNumber F1);
virtual ~FResizePlayLengthInFramesAction() override {}
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
protected:
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() {}
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
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
FFrameNumber Length;
FFrameNumber Frame0;
FFrameNumber Frame1;
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
class ANIMATIONDATACONTROLLER_API FSetFrameRateAction : public FAnimDataBaseAction
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
{
public:
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
explicit FSetFrameRateAction(const IAnimationDataModel* InModel);
virtual ~FSetFrameRateAction() override {}
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
protected:
FSetFrameRateAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FFrameRate FrameRate;
};
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
class ANIMATIONDATACONTROLLER_API FAddCurveAction : public FAnimDataBaseAction
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
{
public:
explicit FAddCurveAction(const FAnimationCurveIdentifier& InCurveId, int32 InFlags) : CurveId(InCurveId), Flags(InFlags) {}
virtual ~FAddCurveAction() {}
protected:
FAddCurveAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationCurveIdentifier CurveId;
int32 Flags;
};
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
class ANIMATIONDATACONTROLLER_API FAddFloatCurveAction : public FAnimDataBaseAction
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
{
public:
explicit FAddFloatCurveAction(const FAnimationCurveIdentifier& InCurveId, int32 InFlags, const TArray<FRichCurveKey>& InKeys, const FLinearColor& InColor) : CurveId(InCurveId), Flags(InFlags), Keys(InKeys), Color(InColor) {}
virtual ~FAddFloatCurveAction() {}
protected:
FAddFloatCurveAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationCurveIdentifier CurveId;
int32 Flags;
TArray<FRichCurveKey> Keys;
FLinearColor Color;
};
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
class ANIMATIONDATACONTROLLER_API FAddTransformCurveAction : public FAnimDataBaseAction
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
{
public:
explicit FAddTransformCurveAction(const FAnimationCurveIdentifier& InCurveId, int32 InFlags, const FTransformCurve& InTransformCurve);
virtual ~FAddTransformCurveAction() {}
protected:
FAddTransformCurveAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationCurveIdentifier CurveId;
int32 Flags;
TArray<FRichCurveKey> SubCurveKeys[9];
};
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
class ANIMATIONDATACONTROLLER_API FRemoveCurveAction : public FAnimDataBaseAction
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
{
public:
explicit FRemoveCurveAction(const FAnimationCurveIdentifier& InCurveId) : CurveId(InCurveId) {}
virtual ~FRemoveCurveAction() {}
protected:
FRemoveCurveAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationCurveIdentifier CurveId;
};
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
class ANIMATIONDATACONTROLLER_API FSetCurveFlagsAction : public FAnimDataBaseAction
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
{
public:
explicit FSetCurveFlagsAction(const FAnimationCurveIdentifier& InCurveId, int32 InFlags, ERawCurveTrackTypes InCurveType) : CurveId(InCurveId), Flags(InFlags), CurveType(InCurveType) {}
virtual ~FSetCurveFlagsAction() {}
protected:
FSetCurveFlagsAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationCurveIdentifier CurveId;
int32 Flags;
ERawCurveTrackTypes CurveType;
};
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
class ANIMATIONDATACONTROLLER_API FRenameCurveAction : public FAnimDataBaseAction
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
{
public:
explicit FRenameCurveAction(const FAnimationCurveIdentifier& InCurveId, const FAnimationCurveIdentifier& InNewCurveId) : CurveId(InCurveId), NewCurveId(InNewCurveId) {}
virtual ~FRenameCurveAction() {}
protected:
FRenameCurveAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationCurveIdentifier CurveId;
FAnimationCurveIdentifier NewCurveId;
};
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
class ANIMATIONDATACONTROLLER_API FScaleCurveAction : public FAnimDataBaseAction
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
{
public:
explicit FScaleCurveAction(const FAnimationCurveIdentifier& InCurveId, float InOrigin, float InFactor, ERawCurveTrackTypes InCurveType);
virtual ~FScaleCurveAction() {}
protected:
FScaleCurveAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationCurveIdentifier CurveId;
ERawCurveTrackTypes CurveType;
float Origin;
float Factor;
};
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
class ANIMATIONDATACONTROLLER_API FAddRichCurveKeyAction : public FAnimDataBaseAction
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
{
public:
explicit FAddRichCurveKeyAction(const FAnimationCurveIdentifier& InCurveId, const FRichCurveKey& InKey) : CurveId(InCurveId), Key(InKey) {}
virtual ~FAddRichCurveKeyAction() {}
protected:
FAddRichCurveKeyAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationCurveIdentifier CurveId;
ERawCurveTrackTypes CurveType;
FRichCurveKey Key;
};
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
class ANIMATIONDATACONTROLLER_API FSetRichCurveKeyAction : public FAnimDataBaseAction
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
{
public:
explicit FSetRichCurveKeyAction(const FAnimationCurveIdentifier& InCurveId, const FRichCurveKey& InKey) : CurveId(InCurveId), Key(InKey) {}
virtual ~FSetRichCurveKeyAction() {}
protected:
FSetRichCurveKeyAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationCurveIdentifier CurveId;
FRichCurveKey Key;
};
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
class ANIMATIONDATACONTROLLER_API FRemoveRichCurveKeyAction : public FAnimDataBaseAction
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
{
public:
explicit FRemoveRichCurveKeyAction(const FAnimationCurveIdentifier& InCurveId, const float InTime) : CurveId(InCurveId), Time(InTime) {}
virtual ~FRemoveRichCurveKeyAction() {}
protected:
FRemoveRichCurveKeyAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationCurveIdentifier CurveId;
float Time;
};
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
class ANIMATIONDATACONTROLLER_API FSetRichCurveKeysAction : public FAnimDataBaseAction
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
{
public:
explicit FSetRichCurveKeysAction(const FAnimationCurveIdentifier& InCurveId, const TArray<FRichCurveKey>& InKeys) : CurveId(InCurveId), Keys(InKeys) {}
virtual ~FSetRichCurveKeysAction() {}
protected:
FSetRichCurveKeysAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationCurveIdentifier CurveId;
TArray<FRichCurveKey> Keys;
};
class ANIMATIONDATACONTROLLER_API FSetRichCurveAttributesAction : public FAnimDataBaseAction
{
public:
explicit FSetRichCurveAttributesAction(const FAnimationCurveIdentifier& InCurveId, const FCurveAttributes& InAttributes) : CurveId(InCurveId), Attributes(InAttributes) {}
virtual ~FSetRichCurveAttributesAction() {}
protected:
FSetRichCurveAttributesAction() {}
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
virtual FString ToStringInternal() const override;
protected:
FAnimationCurveIdentifier CurveId;
FCurveAttributes Attributes;
};
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
class ANIMATIONDATACONTROLLER_API FSetCurveColorAction : public FAnimDataBaseAction
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
{
public:
explicit FSetCurveColorAction(const FAnimationCurveIdentifier& InCurveId, const FLinearColor& InColor) : CurveId(InCurveId), Color(InColor) {}
virtual ~FSetCurveColorAction() {}
protected:
FSetCurveColorAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationCurveIdentifier CurveId;
FLinearColor Color;
};
class ANIMATIONDATACONTROLLER_API FSetCurveCommentAction : public FAnimDataBaseAction
{
public:
explicit FSetCurveCommentAction(const FAnimationCurveIdentifier& InCurveId, const FString& InComment) : CurveId(InCurveId), Comment(InComment) {}
virtual ~FSetCurveCommentAction() {}
protected:
FSetCurveCommentAction() {}
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
virtual FString ToStringInternal() const override;
protected:
FAnimationCurveIdentifier CurveId;
FString Comment;
};
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
class ANIMATIONDATACONTROLLER_API FAddAtributeAction : public FAnimDataBaseAction
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
{
public:
explicit FAddAtributeAction(const FAnimatedBoneAttribute& InAttribute);
virtual ~FAddAtributeAction() {}
protected:
FAddAtributeAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationAttributeIdentifier AttributeId;
TArray<FAttributeKey> Keys;
};
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
class ANIMATIONDATACONTROLLER_API FRemoveAtributeAction : public FAnimDataBaseAction
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
{
public:
explicit FRemoveAtributeAction(const FAnimationAttributeIdentifier& InAttributeId) : AttributeId(InAttributeId) {}
virtual ~FRemoveAtributeAction() {}
protected:
FRemoveAtributeAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationAttributeIdentifier AttributeId;
};
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
class ANIMATIONDATACONTROLLER_API FAddAtributeKeyAction : public FAnimDataBaseAction
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
{
public:
explicit FAddAtributeKeyAction(const FAnimationAttributeIdentifier& InAttributeId, const FAttributeKey& InKey) : AttributeId(InAttributeId), Key(InKey) {}
virtual ~FAddAtributeKeyAction() {}
protected:
FAddAtributeKeyAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationAttributeIdentifier AttributeId;
FAttributeKey Key;
};
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
class ANIMATIONDATACONTROLLER_API FSetAtributeKeyAction : public FAnimDataBaseAction
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
{
public:
explicit FSetAtributeKeyAction(const FAnimationAttributeIdentifier& InAttributeId, const FAttributeKey& InKey) : AttributeId(InAttributeId), Key(InKey) {}
virtual ~FSetAtributeKeyAction() {}
protected:
FSetAtributeKeyAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationAttributeIdentifier AttributeId;
FAttributeKey Key;
};
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
class ANIMATIONDATACONTROLLER_API FRemoveAtributeKeyAction : public FAnimDataBaseAction
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
{
public:
explicit FRemoveAtributeKeyAction(const FAnimationAttributeIdentifier& InAttributeId, float InTime) : AttributeId(InAttributeId), Time(InTime) {}
virtual ~FRemoveAtributeKeyAction() {}
protected:
FRemoveAtributeKeyAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationAttributeIdentifier AttributeId;
float Time;
};
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
class ANIMATIONDATACONTROLLER_API FSetAtributeKeysAction : public FAnimDataBaseAction
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
{
public:
explicit FSetAtributeKeysAction(const FAnimatedBoneAttribute& InAttribute);
virtual ~FSetAtributeKeysAction() {}
protected:
FSetAtributeKeysAction() {}
Reintroducing AnimationDataModel refactor with additional memory and cooktime optimizations. **Animation Data Model load/cook time and memory optimizations** - Added SetKeysOnly to FMovieSceneFloatChannel, allowing to only set value/frames values and skip allocating key handles - Added EvaluateWithCache to TMovieSceneCurveChannelImpl, allowing to evaluate multiple curves using a caching data structure holding the frame-indices resulting from the FrameTime -> indexes calculationg - UFKControlRig::GetControlName/GetControlTargetName, added thread_local mapping cache and optimized FName generation - Made the sequencer bone curve keys 'sparse' again, if constant it just sets the default value for the curve otherwise it is still uniform - Only resample keys when compressing, and clear them on any significant model changes and when save-during-cook has been completed - Routed ::Presave for AnimSequencerDataModel directly through to UMovieSceneSignedObject to skip compiling cooked sequencer that that will/should never cooked and packaged - Added some significant pass-by-reference changes to AnimSequencerModel APIs (passing large arrays by value previously) :doh: - Optimized GenerateLegacyBoneData Original CL description: **New** - Engine - IAnimationDataModel interface - AnimationData plugin - AnimSequencerDataModel, sequencer based implementation of IAnimationDataModel - AnimSequencerDataController, controller for above (implementation of IAnimationDataController) - Added FCompressedRichCurve::PopulateCurve, allowing users to convert back to a FRichCurve for validation/debugging - Added DefaultFrameRate to AnimationSettings, this replaces the hardcoded 30FPS in code - Added ::GetKeyIndicesFromTime which takes FFrameRate - Added AnimSequenceBase::OnAnimModelLoaded, this is required for correct postloading behaviour of data model (specifically AnimSequencerDataModel, as it depends on data from its outer ? anim sequence) - Added IAnimationDataModel ::Evaluate which now takes responsibility for evaluating raw animation bone, curve and attribute data. And moved all trackbased evaluation code into AnimDataModel.cpp - Added a.ForceEvalRawData allowing to force evaluation of source data - Added a.SkipDDC to force compressing animation data locally **Changed** - Reparent UAnimDataModel to IAnimationDataModel interface, and rejig behaviour - AnimSequenceBase now reference AnimDataModel as IAnimationDataModel - Upgrade path for legacy to IAnimationDataModel and existing UAnimDataModel to IAnimationDataModel through IAnimationDataController::PopulateWithExisting - IAnimationDataModel data is now frame(number/rate/time) based rather than seconds/keyindices. This enforces frameborder aligned data from now on. - Moved RichCurve evaluation code from RichCurve.cpp to separate file and consolidated all instances of copy-pasta behaviour - Updated/removed deprecated EngineTests around AnimSequences - Changed many instances to use a FFrameTime together with a known FFrameRate versus seconds and sequencelength in float involving frame \/ time calculations (including instances of FAnimKeyHelper) - Switched anim sequence evaluation to use double in Extraction context for time value and patched up places with static\_cast\<double\> - FRichCurve::Eval - Make sure we always evaluate keys when T >= Key0.Time and T <= KeyN.Time to deal with crazy userweighted tangents - Fixed WeightedKeyDataAdapter::GetKeyInterpMode/GetKeyTangentWeightMode retrieving invalid values, as it was indexing according to KeyIndex rather than KeyIndex\*2. This made it so that values were misinterpreted. - Fixed WeightedEvalForTwoKeys for compressed data retrieving GetKeyInterpMode and GetKeyTangentWeightMode using the wrong index value. As they are not indexed using KeyDataHandle type. - Fixed issue where compression could crash when containing zero-key scale additivebase track (tries to retrieve) - Replaced instances of NULL with nullptr - Moved required decompression information into FAnimSequenceDecompressionContext and reimplemented decompression within UE::Anim::Decompression namespace and new file - Deprecated ::GetRawDataGuid and replaced with GetDataModel()->GenerateGuid() - Fixed UAnimStreamable evaluation/compression (previously broken with MVC refactor) - Updated Animation exporting pipeline to be frame-based rather than seconds - Deprecated RetargetPose, replaced with FRetargetingScope (used within AnimModel::Evaluate) - Fixed BaseAdditiveAnimation array become invalid/incorrect when removing zero-additve tracks during compression - Updated EngineTest animation sequence related tests to new APIs (while maintaining deprecated path testing as well for now) - AnimDataController / Animation Sequence tests now generate a USkeleton for the transient animation sequence (used to perform the test on) **Removed** - Unused file/class AnimData/AnimDataNotifyCollector.h #rb Thomas.Sarkanen, Mike.Zyracki #jira UE-131296 #preflight 631f6897a9331c69c3a34d1e [CL 21980597 by Jurre deBaare in ue5-main branch]
2022-09-13 06:41:15 -04:00
virtual TUniquePtr<FChange> ExecuteInternal(IAnimationDataModel* Model, IAnimationDataController* Controller) override;
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
virtual FString ToStringInternal() const override;
protected:
FAnimationAttributeIdentifier AttributeId;
TArray<FAttributeKey> Keys;
};
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