Completed the play-seq animation command for characters

This commit is contained in:
2025-11-18 00:40:43 -05:00
parent 29612d226d
commit 383ed25453
8 changed files with 55 additions and 10 deletions

View File

@@ -76,7 +76,6 @@ static bool SetProperty(const FString& prefix, UObject* obj, const FlxAnimationF
return false;
}
#pragma optimize("", off)
static FStructProperty *FindAnimationStepProperty(UClass *uclass, const FString &prefix) {
FName nname(prefix + TEXT("Animation Step"));
FStructProperty* fprop = FindFProperty<FStructProperty>(uclass, nname);
@@ -85,7 +84,12 @@ static FStructProperty *FindAnimationStepProperty(UClass *uclass, const FString
return fprop;
}
#pragma optimize("", off)
static FInt64Property *FindAnimationIDProperty(UClass *uclass, const FString &prefix) {
FName nname(prefix + TEXT("Animation ID"));
FInt64Property* fprop = FindFProperty<FInt64Property>(uclass, nname);
return fprop;
}
void UlxAnimationStepLibrary::UnpackAnimationStep(bool &bChanged, FString &Action, const FlxAnimationStep& step, UObject* target, const FString& prefix) {
bChanged = false;
Action = TEXT("");
@@ -106,6 +110,12 @@ void UlxAnimationStepLibrary::UnpackAnimationStep(bool &bChanged, FString &Actio
return;
}
FInt64Property* idproperty = FindAnimationIDProperty(uclass, prefix);
if (idproperty == nullptr) {
UE_LOG(LogBlueprint, Error, TEXT("UnpackAnimationStep: Target object does not have a variable named: '%s Animation ID'"), *prefix);
return;
}
FlxAnimationStep* stepstorage = stepproperty->ContainerPtrToValuePtr<FlxAnimationStep>(target);
int64 oldhash = stepstorage->Hash;
@@ -134,6 +144,10 @@ void UlxAnimationStepLibrary::UnpackAnimationStep(bool &bChanged, FString &Actio
// Store the whole step.
*stepstorage = step;
// Store the ID
int64 *idstorage = idproperty->ContainerPtrToValuePtr<int64>(target);
*idstorage = step.Hash;
// Return the correct values.
Action = FString(actionfield.S.size(), (const UTF8CHAR*)actionfield.S.data());
bChanged = (step.Hash != oldhash);