2022-04-01 06:09:36 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "AnimationAttributeBlueprintLibrary.h"
|
2022-08-30 23:03:03 -04:00
|
|
|
|
2022-04-04 12:18:34 -04:00
|
|
|
#include "Animation/AnimData/AnimDataModel.h"
|
2022-08-30 23:03:03 -04:00
|
|
|
#include "Animation/AnimData/AttributeIdentifier.h"
|
|
|
|
|
#include "Animation/AnimData/IAnimationDataController.h"
|
|
|
|
|
#include "Animation/AttributeCurve.h"
|
|
|
|
|
#include "Containers/ArrayView.h"
|
|
|
|
|
#include "Curves/KeyHandle.h"
|
|
|
|
|
#include "Internationalization/Internationalization.h"
|
|
|
|
|
#include "Misc/AssertionMacros.h"
|
|
|
|
|
#include "Templates/UnrealTemplate.h"
|
|
|
|
|
#include "UObject/Class.h"
|
|
|
|
|
#include "UObject/Field.h"
|
|
|
|
|
#include "UObject/Script.h"
|
|
|
|
|
#include "UObject/ScriptMacros.h"
|
|
|
|
|
#include "UObject/Stack.h"
|
|
|
|
|
#include "UObject/UnrealType.h"
|
|
|
|
|
|
|
|
|
|
class UObject;
|
2022-04-01 06:09:36 -04:00
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "AnimationAttributeBlueprintLibrary"
|
|
|
|
|
|
|
|
|
|
bool UAnimationAttributeBlueprintLibrary::SetAttributeKey(TScriptInterface<IAnimationDataController> AnimationDataController, const FAnimationAttributeIdentifier& AttributeIdentifier, float Time, const int32& Value)
|
|
|
|
|
{
|
|
|
|
|
// We should never hit this! Stubbed to avoid NoExport on the class.
|
|
|
|
|
check(0);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UAnimationAttributeBlueprintLibrary::Generic_SetAttributeKey(TScriptInterface<IAnimationDataController> AnimationDataController, const FAnimationAttributeIdentifier& AttributeIdentifier, float Time, UScriptStruct* ScriptStruct, const void* ValuePtr)
|
|
|
|
|
{
|
|
|
|
|
return AnimationDataController->SetAttributeKey(AttributeIdentifier, Time, ValuePtr, ScriptStruct);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFINE_FUNCTION(UAnimationAttributeBlueprintLibrary::execSetAttributeKey)
|
|
|
|
|
{
|
|
|
|
|
P_GET_TINTERFACE(IAnimationDataController, AnimationDataController);
|
|
|
|
|
P_GET_STRUCT_REF(FAnimationAttributeIdentifier, AttributeIdentifier);
|
|
|
|
|
P_GET_PROPERTY(FFloatProperty, TimeInterval);
|
|
|
|
|
|
|
|
|
|
Stack.MostRecentProperty = nullptr;
|
|
|
|
|
Stack.MostRecentPropertyAddress = nullptr;
|
|
|
|
|
|
|
|
|
|
Stack.StepCompiledIn<FStructProperty>(nullptr);
|
|
|
|
|
|
|
|
|
|
const FStructProperty* ItemProperty = CastField<FStructProperty>(Stack.MostRecentProperty);
|
|
|
|
|
void* ItemDataPtr = Stack.MostRecentPropertyAddress;
|
|
|
|
|
P_FINISH;
|
|
|
|
|
|
|
|
|
|
if (!ItemProperty || !ItemDataPtr)
|
|
|
|
|
{
|
|
|
|
|
FBlueprintExceptionInfo ExceptionInfo(
|
|
|
|
|
EBlueprintExceptionType::AccessViolation,
|
|
|
|
|
LOCTEXT("SetAttributeKey_InvalidValue", "Failed to resolve the attribute value parameter for SetAttributeKey.")
|
|
|
|
|
);
|
|
|
|
|
FBlueprintCoreDelegates::ThrowScriptException(P_THIS, Stack, ExceptionInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!AnimationDataController.GetObject())
|
|
|
|
|
{
|
|
|
|
|
FBlueprintExceptionInfo ExceptionInfo(
|
|
|
|
|
EBlueprintExceptionType::AccessViolation,
|
|
|
|
|
LOCTEXT("SetAttributeKey_InvalidController", "Accessed None attempting to call SetAttributeKey.")
|
|
|
|
|
);
|
|
|
|
|
FBlueprintCoreDelegates::ThrowScriptException(P_THIS, Stack, ExceptionInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool bResult = false;
|
|
|
|
|
|
|
|
|
|
if (AnimationDataController && ItemProperty)
|
|
|
|
|
{
|
|
|
|
|
P_NATIVE_BEGIN;
|
|
|
|
|
bResult = Generic_SetAttributeKey(AnimationDataController, AttributeIdentifier, TimeInterval, ItemProperty->Struct, ItemDataPtr);
|
|
|
|
|
P_NATIVE_END;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*(bool*)RESULT_PARAM = bResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UAnimationAttributeBlueprintLibrary::SetAttributeKeys(TScriptInterface<IAnimationDataController> AnimationDataController, const FAnimationAttributeIdentifier& AttributeIdentifier, const TArray<float>& Times, const TArray<int32>& Values)
|
|
|
|
|
{
|
|
|
|
|
// We should never hit this! Stubbed to avoid NoExport on the class.
|
|
|
|
|
check(0);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UAnimationAttributeBlueprintLibrary::Generic_SetAttributeKeys(TScriptInterface<IAnimationDataController> AnimationDataController, const FAnimationAttributeIdentifier& AttributeIdentifier, const TArray<float>& Times, const void* ValuesArray, const FArrayProperty* ValuesArrayProperty)
|
|
|
|
|
{
|
|
|
|
|
FScriptArrayHelper ArrayHelper(ValuesArrayProperty, ValuesArray);
|
|
|
|
|
|
|
|
|
|
TArray<const void*> ItemPtrs;
|
|
|
|
|
const int32 NumberOfItems = ArrayHelper.Num();
|
|
|
|
|
ItemPtrs.SetNumZeroed(NumberOfItems);
|
|
|
|
|
for (int32 Index = 0; Index < NumberOfItems; ++Index)
|
|
|
|
|
{
|
|
|
|
|
ItemPtrs[Index] = ArrayHelper.GetRawPtr(Index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FStructProperty* InnerStructProperty = CastField<const FStructProperty>(ValuesArrayProperty->Inner);
|
|
|
|
|
return AnimationDataController->SetAttributeKeys(AttributeIdentifier, MakeArrayView(Times), MakeArrayView(ItemPtrs), InnerStructProperty->Struct);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFINE_FUNCTION(UAnimationAttributeBlueprintLibrary::execSetAttributeKeys)
|
|
|
|
|
{
|
|
|
|
|
P_GET_TINTERFACE(IAnimationDataController, AnimationDataController);
|
|
|
|
|
P_GET_STRUCT_REF(FAnimationAttributeIdentifier, AttributeIdentifier);
|
|
|
|
|
P_GET_TARRAY_REF(float, TimeIntervals);
|
|
|
|
|
|
|
|
|
|
Stack.MostRecentProperty = nullptr;
|
|
|
|
|
Stack.MostRecentPropertyAddress = nullptr;
|
|
|
|
|
|
|
|
|
|
Stack.StepCompiledIn<FArrayProperty>(nullptr);
|
|
|
|
|
|
|
|
|
|
void* ArrayAddr = Stack.MostRecentPropertyAddress;
|
|
|
|
|
FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
|
|
|
|
|
P_FINISH;
|
|
|
|
|
|
|
|
|
|
if (!ArrayAddr || !ArrayProperty)
|
|
|
|
|
{
|
|
|
|
|
FBlueprintExceptionInfo ExceptionInfo(
|
|
|
|
|
EBlueprintExceptionType::AccessViolation,
|
|
|
|
|
LOCTEXT("SetAttributeKeys_InvalidValue", "Failed to resolve the attribute values parameter for SetAttributeKeys.")
|
|
|
|
|
);
|
|
|
|
|
FBlueprintCoreDelegates::ThrowScriptException(P_THIS, Stack, ExceptionInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!AnimationDataController.GetObject())
|
|
|
|
|
{
|
|
|
|
|
FBlueprintExceptionInfo ExceptionInfo(
|
|
|
|
|
EBlueprintExceptionType::AccessViolation,
|
2022-05-18 07:36:32 -04:00
|
|
|
LOCTEXT("SetAttributeKeys_InvalidController", "Accessed None attempting to call SetAttributeKeys.")
|
2022-04-01 06:09:36 -04:00
|
|
|
);
|
|
|
|
|
FBlueprintCoreDelegates::ThrowScriptException(P_THIS, Stack, ExceptionInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool bResult = false;
|
|
|
|
|
|
|
|
|
|
if (AnimationDataController)
|
|
|
|
|
{
|
|
|
|
|
P_NATIVE_BEGIN;
|
|
|
|
|
bResult = Generic_SetAttributeKeys(AnimationDataController, AttributeIdentifier, TimeIntervals, ArrayAddr, ArrayProperty);
|
|
|
|
|
P_NATIVE_END;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*(bool*)RESULT_PARAM = bResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
bool UAnimationAttributeBlueprintLibrary::GetAttributeKey(TScriptInterface<IAnimationDataModel> AnimationDataModel, const FAnimationAttributeIdentifier& AttributeIdentifier, float Time, int32& Value)
|
2022-04-01 06:09:36 -04:00
|
|
|
{
|
|
|
|
|
// We should never hit this! Stubbed to avoid NoExport on the class.
|
|
|
|
|
check(0);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
bool UAnimationAttributeBlueprintLibrary::Generic_GetAttributeKey(TScriptInterface<IAnimationDataModel> AnimationDataModel, const FAnimationAttributeIdentifier& AttributeIdentifier, float Time, UScriptStruct* ScriptStruct, void* ValuePtr)
|
2022-04-01 06:09:36 -04:00
|
|
|
{
|
|
|
|
|
const FAnimatedBoneAttribute* AttributePtr = AnimationDataModel->FindAttribute(AttributeIdentifier);
|
|
|
|
|
|
|
|
|
|
// Find attribute
|
|
|
|
|
if (AttributePtr && ScriptStruct)
|
|
|
|
|
{
|
|
|
|
|
// And the key on its attribute curve
|
|
|
|
|
const FAttributeCurve& Curve = AttributePtr->Curve;
|
|
|
|
|
check(ScriptStruct == Curve.GetScriptStruct());
|
|
|
|
|
const FKeyHandle KeyHandle = Curve.FindKey(Time);
|
|
|
|
|
if (KeyHandle != FKeyHandle::Invalid())
|
|
|
|
|
{
|
|
|
|
|
// Copy out the value to ptr
|
|
|
|
|
const FAttributeKey& Key = Curve.GetKey(KeyHandle);
|
|
|
|
|
ScriptStruct->CopyScriptStruct(ValuePtr, Key.GetValuePtr<void>(), 1);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFINE_FUNCTION(UAnimationAttributeBlueprintLibrary::execGetAttributeKey)
|
|
|
|
|
{
|
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
|
|
|
P_GET_TINTERFACE(IAnimationDataModel, AnimationDataModel);
|
2022-04-01 06:09:36 -04:00
|
|
|
P_GET_STRUCT_REF(FAnimationAttributeIdentifier, AttributeIdentifier);
|
|
|
|
|
P_GET_PROPERTY(FFloatProperty, TimeInterval);
|
|
|
|
|
|
|
|
|
|
Stack.MostRecentProperty = nullptr;
|
|
|
|
|
Stack.MostRecentPropertyAddress = nullptr;
|
|
|
|
|
|
|
|
|
|
Stack.StepCompiledIn<FStructProperty>(nullptr);
|
|
|
|
|
|
|
|
|
|
const FStructProperty* ItemProperty = CastField<FStructProperty>(Stack.MostRecentProperty);
|
|
|
|
|
void* ItemDataPtr = Stack.MostRecentPropertyAddress;
|
|
|
|
|
P_FINISH;
|
|
|
|
|
|
|
|
|
|
if (!ItemProperty || !ItemDataPtr)
|
|
|
|
|
{
|
|
|
|
|
FBlueprintExceptionInfo ExceptionInfo(
|
|
|
|
|
EBlueprintExceptionType::AccessViolation,
|
2022-05-18 07:36:32 -04:00
|
|
|
LOCTEXT("GetAttributeKey_InvalidValue", "Failed to resolve the attribute value parameter for GetAttributeKey.")
|
2022-04-01 06:09:36 -04:00
|
|
|
);
|
|
|
|
|
FBlueprintCoreDelegates::ThrowScriptException(P_THIS, Stack, ExceptionInfo);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
if (!AnimationDataModel.GetObject())
|
2022-04-01 06:09:36 -04:00
|
|
|
{
|
|
|
|
|
FBlueprintExceptionInfo ExceptionInfo(
|
|
|
|
|
EBlueprintExceptionType::AccessViolation,
|
2022-05-18 07:36:32 -04:00
|
|
|
LOCTEXT("GetAttributeKey_InvalidController", "Accessed None attempting to call GetAttributeKey.")
|
2022-04-01 06:09:36 -04:00
|
|
|
);
|
|
|
|
|
FBlueprintCoreDelegates::ThrowScriptException(P_THIS, Stack, ExceptionInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool bResult = false;
|
|
|
|
|
|
|
|
|
|
if (AnimationDataModel && ItemProperty)
|
|
|
|
|
{
|
|
|
|
|
P_NATIVE_BEGIN;
|
|
|
|
|
bResult = Generic_GetAttributeKey(AnimationDataModel, AttributeIdentifier, TimeInterval, ItemProperty->Struct, ItemDataPtr);
|
|
|
|
|
P_NATIVE_END;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*(bool*)RESULT_PARAM = bResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
bool UAnimationAttributeBlueprintLibrary::GetAttributeKeys(TScriptInterface<IAnimationDataModel> AnimationDataModel, const FAnimationAttributeIdentifier& AttributeIdentifier, TArray<float>& OutTimes, TArray<int32>& OutValues)
|
2022-04-01 06:09:36 -04:00
|
|
|
{
|
|
|
|
|
// We should never hit this! Stubbed to avoid NoExport on the class.
|
|
|
|
|
check(0);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
bool UAnimationAttributeBlueprintLibrary::Generic_GetAttributeKeys(TScriptInterface<IAnimationDataModel> AnimationDataModel, const FAnimationAttributeIdentifier& AttributeIdentifier, TArray<float>& Times, void* ValuesArray, const FArrayProperty* ValuesArrayProperty)
|
2022-04-01 06:09:36 -04:00
|
|
|
{
|
|
|
|
|
const FAnimatedBoneAttribute* AttributePtr = AnimationDataModel->FindAttribute(AttributeIdentifier);
|
|
|
|
|
|
|
|
|
|
// Find attribute
|
|
|
|
|
if (AttributePtr && ValuesArrayProperty)
|
|
|
|
|
{
|
|
|
|
|
const FStructProperty* InnerStructProperty = CastField<const FStructProperty>(ValuesArrayProperty->Inner);
|
|
|
|
|
// And the key on its attribute curve
|
|
|
|
|
const FAttributeCurve& Curve = AttributePtr->Curve;
|
|
|
|
|
check(InnerStructProperty->Struct == Curve.GetScriptStruct());
|
|
|
|
|
|
|
|
|
|
const TArray<FAttributeKey>& Keys = Curve.GetConstRefOfKeys();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FScriptArrayHelper ArrayHelper(ValuesArrayProperty, ValuesArray);
|
|
|
|
|
ArrayHelper.Resize(Keys.Num());
|
|
|
|
|
Times.SetNum(Keys.Num());
|
|
|
|
|
|
|
|
|
|
for (int32 KeyIndex = 0; KeyIndex < Keys.Num(); ++KeyIndex)
|
|
|
|
|
{
|
|
|
|
|
const FAttributeKey& Key = Keys[KeyIndex];
|
|
|
|
|
Times[KeyIndex] = Key.Time;
|
|
|
|
|
|
|
|
|
|
uint8* ValuePtr = ArrayHelper.GetRawPtr(KeyIndex);
|
|
|
|
|
InnerStructProperty->Struct->CopyScriptStruct(ValuePtr, Key.GetValuePtr<void>(), 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFINE_FUNCTION(UAnimationAttributeBlueprintLibrary::execGetAttributeKeys)
|
|
|
|
|
{
|
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
|
|
|
P_GET_TINTERFACE(IAnimationDataModel, AnimationDataModel);
|
2022-04-01 06:09:36 -04:00
|
|
|
P_GET_STRUCT_REF(FAnimationAttributeIdentifier, AttributeIdentifier);
|
|
|
|
|
P_GET_TARRAY_REF(float, TimeIntervals);
|
|
|
|
|
|
|
|
|
|
Stack.MostRecentProperty = nullptr;
|
|
|
|
|
Stack.MostRecentPropertyAddress = nullptr;
|
|
|
|
|
|
|
|
|
|
Stack.StepCompiledIn<FArrayProperty>(nullptr);
|
|
|
|
|
|
|
|
|
|
void* ArrayAddr = Stack.MostRecentPropertyAddress;
|
|
|
|
|
FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
|
|
|
|
|
P_FINISH;
|
|
|
|
|
|
|
|
|
|
if (!ArrayAddr || !ArrayProperty)
|
|
|
|
|
{
|
|
|
|
|
FBlueprintExceptionInfo ExceptionInfo(
|
|
|
|
|
EBlueprintExceptionType::AccessViolation,
|
2022-05-18 07:36:32 -04:00
|
|
|
LOCTEXT("GetAttributeKeys_InvalidValue", "Failed to resolve the attribute values parameter for GetAttributeKeys.")
|
2022-04-01 06:09:36 -04:00
|
|
|
);
|
|
|
|
|
FBlueprintCoreDelegates::ThrowScriptException(P_THIS, Stack, ExceptionInfo);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
if (!AnimationDataModel.GetObject())
|
2022-04-01 06:09:36 -04:00
|
|
|
{
|
|
|
|
|
FBlueprintExceptionInfo ExceptionInfo(
|
|
|
|
|
EBlueprintExceptionType::AccessViolation,
|
2022-05-18 07:36:32 -04:00
|
|
|
LOCTEXT("GetAttributeKeys_InvalidController", "Accessed None attempting to call GetAttributeKeys.")
|
2022-04-01 06:09:36 -04:00
|
|
|
);
|
|
|
|
|
FBlueprintCoreDelegates::ThrowScriptException(P_THIS, Stack, ExceptionInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool bResult = false;
|
|
|
|
|
|
|
|
|
|
if (AnimationDataModel)
|
|
|
|
|
{
|
|
|
|
|
P_NATIVE_BEGIN;
|
|
|
|
|
bResult = Generic_GetAttributeKeys(AnimationDataModel, AttributeIdentifier, TimeIntervals, ArrayAddr, ArrayProperty);
|
|
|
|
|
P_NATIVE_END;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*(bool*)RESULT_PARAM = bResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|