Add UpdateSpeed to Animated Model for playback speed scaling

This commit is contained in:
Wojtek Figat
2021-07-15 13:50:50 +02:00
parent 1062c0b3a0
commit 50ffdcd9ca
3 changed files with 9 additions and 0 deletions

View File

@@ -73,6 +73,7 @@ void AnimationsSystem::Job(int32 index)
{
dt = t - lastUpdateTime;
}
dt *= animatedModel->UpdateSpeed;
animatedModel->GraphInstance.LastUpdateTime = t;
// Evaluate animated nodes pose

View File

@@ -665,6 +665,7 @@ void AnimatedModel::Serialize(SerializeStream& stream, const void* otherObj)
SERIALIZE(PerBoneMotionBlur);
SERIALIZE(UseTimeScale);
SERIALIZE(UpdateWhenOffscreen);
SERIALIZE(UpdateSpeed);
SERIALIZE(UpdateMode);
SERIALIZE(BoundsScale);
SERIALIZE(CustomBounds);
@@ -688,6 +689,7 @@ void AnimatedModel::Deserialize(DeserializeStream& stream, ISerializeModifier* m
DESERIALIZE(PerBoneMotionBlur);
DESERIALIZE(UseTimeScale);
DESERIALIZE(UpdateWhenOffscreen);
DESERIALIZE(UpdateSpeed);
DESERIALIZE(UpdateMode);
DESERIALIZE(BoundsScale);
DESERIALIZE(CustomBounds);

View File

@@ -99,6 +99,12 @@ public:
API_FIELD(Attributes="EditorOrder(40), DefaultValue(false), EditorDisplay(\"Skinned Model\")")
bool UpdateWhenOffscreen = false;
/// <summary>
/// The animation update delta time scale. Can be used to speed up animation playback or create slow motion effect.
/// </summary>
API_FIELD(Attributes="EditorOrder(45), EditorDisplay(\"Skinned Model\")")
float UpdateSpeed = 1.0f;
/// <summary>
/// The animation update mode. Can be used to optimize the performance.
/// </summary>