Removed 'autofinish' from the animation C++ system, replaced it with more elegant implementation in blueprint.

This commit is contained in:
2025-09-22 16:17:21 -04:00
parent e8bc3389a6
commit 4b0f85ef19
11 changed files with 47 additions and 75 deletions

View File

@@ -335,9 +335,6 @@ FlxAnimTracker::FlxAnimTracker() {
void FlxAnimTracker::Clear() {
AQ.Empty();
Changed = true;
AutoFinish = false;
AutoFinishAction.Empty();
AutoFinishXYZ.Set(0,0,0);
}
void FlxAnimTracker::FinishedAnimation(uint64 hash) {
@@ -349,6 +346,15 @@ void FlxAnimTracker::FinishedAnimation(uint64 hash) {
}
}
bool FlxAnimTracker::IsFinished(uint64 hash) {
for (int i = 0; i < AQ.Num(); i++) {
if (AQ[i].Hash == hash) {
return AQ[i].Finished;
}
}
return true;
}
void FlxAnimTracker::SkipToEnd() {
for (int i = 0; i < AQ.Num(); i++) {
if (!AQ[i].Finished) {
@@ -459,22 +465,6 @@ void FlxAnimTracker::Update(std::string_view encqueue) {
}
AQ.SetNum(limit);
}
// Autofinish up to one animation.
//
if (AutoFinish) {
for (int i = 0; i < AQ.Num(); i++) {
if (!AQ[i].Finished) {
if (MatchesAutoFinish(AQ[i])) {
AQ[i].Finished = true;
}
break;
}
}
AutoFinish = false;
AutoFinishAction.Empty();
AutoFinishXYZ.Set(0,0,0);
}
}
FString FlxAnimTracker::DebugString() const
@@ -488,14 +478,6 @@ FString FlxAnimTracker::DebugString() const
{
Result += TEXT("changed=false ");
}
if (AutoFinish)
{
Result += TEXT("autofinish=true");
}
else
{
Result += TEXT("autofinish=false");
}
Result += TEXT("\n");
for (int i = 0; i < AQ.Num(); i++)
{
@@ -505,20 +487,6 @@ FString FlxAnimTracker::DebugString() const
return Result;
}
void FlxAnimTracker::SetAutoFinish(const FString &action, const FVector &xyz) {
AutoFinish = true;
AutoFinishAction = action;
AutoFinishXYZ = xyz;
}
bool FlxAnimTracker::MatchesAutoFinish(const FlxAnimationStep &step) {
FVector xyz = UlxAnimationStepLibrary::AnimationStepGetVector(step, TEXT("xyz"));
if (xyz != AutoFinishXYZ) return false;
FString action = UlxAnimationStepLibrary::AnimationStepGetString(step, TEXT("action"));
if (action != AutoFinishAction) return false;
return true;
}
FString FlxAnimTracker::GetCurrentBlueprintName() {
for (int i = 0; i < AQ.Num(); i++) {
if (!AQ[i].Finished) {