Refactor Scripted Animations to provide an option for which clock to use
This commit is contained in:
@@ -123,7 +123,8 @@ void UlxTangible::MaybeExecuteAnimStateChanged() {
|
||||
|
||||
bool AnyChange = AnimTracker.IsChanged();
|
||||
|
||||
while (AnimTracker.IsChanged()) {
|
||||
while (AnimTracker.IsChanged())
|
||||
{
|
||||
if (limit == 0) break;
|
||||
limit -= 1;
|
||||
AnimTracker.ClearChanged();
|
||||
@@ -164,11 +165,22 @@ void UlxTangible::MaybeExecuteAnimStateChanged() {
|
||||
FString DS = UlxAnimationStepLibrary::AnimationStepDebugString(*Step);
|
||||
UE_LOG(LogLuprex, Warning, TEXT("Timeout - blueprint didn't finish animation: %s"), *DS);
|
||||
AnimTracker.FinishedAnimation(PendingAnimationHash);
|
||||
AnyChange = true;
|
||||
}
|
||||
AutoUpdatePosition();
|
||||
PendingAnimationHash = 0;
|
||||
PendingAnimationTimeout = 0.0;
|
||||
}
|
||||
|
||||
// The following code garbage collects any scripted animations that
|
||||
// were created by animation steps that are no longer in the animation
|
||||
// queue. This is intended to handle the case that predictive reexecution
|
||||
// incorrectly predicts an animation step, and then the animation step
|
||||
// goes away during of difference transmission.
|
||||
if (AnyChange && (ScriptedAnimations != nullptr))
|
||||
{
|
||||
ScriptedAnimations->FadeGarbage(this, AnimTracker.GetHashes());
|
||||
}
|
||||
}
|
||||
|
||||
FVector UlxTangible::GetLocation() const
|
||||
@@ -233,7 +245,8 @@ void UlxTangible::AutoUpdatePosition()
|
||||
}
|
||||
}
|
||||
|
||||
void UlxTangible::FinishedAnimation(AActor *target, const FlxAnimationStep &step, bool AutoUpdate) {
|
||||
void UlxTangible::FinishedAnimation(AActor *target, const FlxAnimationStep &step, bool AutoUpdate)
|
||||
{
|
||||
UlxTangible *tan = GetActorTangibleOrLog(target);
|
||||
if (tan == nullptr) return;
|
||||
tan->AnimTracker.FinishedAnimation(step.Hash);
|
||||
@@ -242,7 +255,8 @@ void UlxTangible::FinishedAnimation(AActor *target, const FlxAnimationStep &step
|
||||
UE_LOG(LogLuprex, Display, TEXT("Animation Finished: %s"), *DebugString);
|
||||
}
|
||||
|
||||
bool UlxTangible::AnimationStepIsFinished(AActor *target, const FlxAnimationStep &step) {
|
||||
bool UlxTangible::AnimationStepIsFinished(AActor *target, const FlxAnimationStep &step)
|
||||
{
|
||||
UlxTangible *tan = GetActorTangibleOrLog(target);
|
||||
if (tan == nullptr) return true;
|
||||
return tan->AnimTracker.IsFinished(step.Hash);
|
||||
|
||||
Reference in New Issue
Block a user