Convert anim step hashes from uint64 to int64, because blueprint has no uint64
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include "GameFramework/Actor.h"
|
||||
#include <iostream>
|
||||
|
||||
FlxAnimationStep::FlxAnimationStep(uint64 hash, std::string_view body) {
|
||||
FlxAnimationStep::FlxAnimationStep(int64 hash, std::string_view body) {
|
||||
Finished = false;
|
||||
Hash = hash;
|
||||
Body.SetNum(body.size());
|
||||
@@ -107,7 +107,7 @@ void UlxAnimationStepLibrary::UnpackAnimationStep(bool &bChanged, FString &Actio
|
||||
}
|
||||
|
||||
FlxAnimationStep* stepstorage = stepproperty->ContainerPtrToValuePtr<FlxAnimationStep>(target);
|
||||
uint64 oldhash = stepstorage->Hash;
|
||||
int64 oldhash = stepstorage->Hash;
|
||||
|
||||
FlxAnimationField actionfield;
|
||||
actionfield.Name = "action";
|
||||
@@ -265,7 +265,7 @@ FlxAnimationField FlxAnimationStepDecoder::ReadField() {
|
||||
return result;
|
||||
}
|
||||
|
||||
FString FlxAnimationStepDecoder::DebugString(bool finished, uint64 hash, std::string_view body) {
|
||||
FString FlxAnimationStepDecoder::DebugString(bool finished, int64 hash, std::string_view body) {
|
||||
FString result;
|
||||
FlxAnimationStepDecoder decoder(body);
|
||||
result.Appendf(TEXT("Hash=%016llx"), hash);
|
||||
@@ -300,14 +300,14 @@ FString FlxAnimationStepDecoder::DebugString(bool finished, uint64 hash, std::st
|
||||
|
||||
FlxAnimationStepView FlxAnimQueueDecoder::ReadStep() {
|
||||
FlxAnimationStepView result;
|
||||
result.Hash = Decoder.read_uint64();
|
||||
result.Hash = Decoder.read_int64();
|
||||
result.Body = Decoder.read_string_view();
|
||||
return result;
|
||||
}
|
||||
|
||||
uint64 FlxAnimQueueDecoder::PeekHash() {
|
||||
int64 FlxAnimQueueDecoder::PeekHash() {
|
||||
int64_t read_count = Decoder.total_reads();
|
||||
uint64 result = Decoder.read_uint64();
|
||||
int64 result = Decoder.read_int64();
|
||||
Decoder.unread_to(read_count);
|
||||
return result;
|
||||
}
|
||||
@@ -337,7 +337,7 @@ void FlxAnimTracker::Clear() {
|
||||
Changed = true;
|
||||
}
|
||||
|
||||
void FlxAnimTracker::FinishedAnimation(uint64 hash) {
|
||||
void FlxAnimTracker::FinishedAnimation(int64 hash) {
|
||||
for (int i = 0; i < AQ.Num(); i++) {
|
||||
if (AQ[i].Hash == hash) {
|
||||
AQ[i].Finished = true;
|
||||
@@ -346,7 +346,7 @@ void FlxAnimTracker::FinishedAnimation(uint64 hash) {
|
||||
}
|
||||
}
|
||||
|
||||
bool FlxAnimTracker::IsFinished(uint64 hash) {
|
||||
bool FlxAnimTracker::IsFinished(int64 hash) {
|
||||
for (int i = 0; i < AQ.Num(); i++) {
|
||||
if (AQ[i].Hash == hash) {
|
||||
return AQ[i].Finished;
|
||||
@@ -364,6 +364,17 @@ void FlxAnimTracker::SkipToEnd() {
|
||||
}
|
||||
}
|
||||
|
||||
TArray<int64> FlxAnimTracker::GetHashes()
|
||||
{
|
||||
TArray<int64> Result;
|
||||
Result.SetNum(AQ.Num());
|
||||
for (int i = 0; i < AQ.Num(); i++)
|
||||
{
|
||||
Result[i] = AQ[i].Hash;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
const FlxAnimationStep *FlxAnimTracker::FirstUnfinished() const
|
||||
{
|
||||
for (int i = 0; i < AQ.Num(); i++) {
|
||||
@@ -380,7 +391,7 @@ const FlxAnimationStep *FlxAnimTracker::LastFinished() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const FlxAnimationStep *FlxAnimTracker::FindAnimation(uint64 hash) const
|
||||
const FlxAnimationStep *FlxAnimTracker::FindAnimation(int64 hash) const
|
||||
{
|
||||
for (int i = 0; i < AQ.Num(); i++) {
|
||||
if (AQ[i].Hash == hash) return &AQ[i];
|
||||
@@ -408,7 +419,7 @@ void FlxAnimTracker::Update(std::string_view encqueue) {
|
||||
|
||||
// Build a map indexing the steps in AQ.
|
||||
//
|
||||
TMap<uint64, int32> HashToIndex;
|
||||
TMap<int64, int32> HashToIndex;
|
||||
for (int i = 0; i < AQ.Num(); i++) {
|
||||
HashToIndex.Emplace(AQ[i].Hash, i);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
bool Finished;
|
||||
|
||||
UPROPERTY()
|
||||
uint64 Hash;
|
||||
int64 Hash;
|
||||
|
||||
UPROPERTY()
|
||||
TArray<uint8> Body;
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
FString Blueprint;
|
||||
|
||||
FlxAnimationStep() : Finished(false), Hash(0), Body(), Blueprint() {}
|
||||
FlxAnimationStep(uint64 h, std::string_view b);
|
||||
FlxAnimationStep(int64 h, std::string_view b);
|
||||
|
||||
// Auto-Execute
|
||||
//
|
||||
@@ -122,11 +122,11 @@ public:
|
||||
////////////////////////////////////////////////
|
||||
|
||||
struct FlxAnimationStepView {
|
||||
uint64 Hash;
|
||||
int64 Hash;
|
||||
std::string_view Body;
|
||||
|
||||
FlxAnimationStepView() : Hash(0), Body("") {}
|
||||
FlxAnimationStepView(uint64 h, std::string_view b) : Hash(h), Body(b) {}
|
||||
FlxAnimationStepView(int64 h, std::string_view b) : Hash(h), Body(b) {}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////
|
||||
@@ -194,7 +194,7 @@ public:
|
||||
|
||||
// Peek at the hash of the next animation step.
|
||||
//
|
||||
uint64 PeekHash();
|
||||
int64 PeekHash();
|
||||
|
||||
// Convert an AnimQueue to an FString.
|
||||
//
|
||||
@@ -231,7 +231,7 @@ public:
|
||||
|
||||
// Convert an AnimStep to an FString.
|
||||
//
|
||||
static FString DebugString(bool finished, uint64 hash, std::string_view body);
|
||||
static FString DebugString(bool finished, int64 hash, std::string_view body);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////
|
||||
@@ -294,13 +294,13 @@ public:
|
||||
// animation to be marked as finished, which in turn causes
|
||||
// 'GetCurrentStep' to advance to the next animation.
|
||||
//
|
||||
void FinishedAnimation(uint64 Hash);
|
||||
void FinishedAnimation(int64 Hash);
|
||||
|
||||
// Return true if an animation step is marked finished.
|
||||
//
|
||||
// Also return true if the animation step is not found.
|
||||
//
|
||||
bool IsFinished(uint64 Hash);
|
||||
bool IsFinished(int64 Hash);
|
||||
|
||||
// Skip to the end of the animation queue.
|
||||
//
|
||||
@@ -309,6 +309,10 @@ public:
|
||||
//
|
||||
void SkipToEnd();
|
||||
|
||||
// Get all the hashes of all the animation steps.
|
||||
//
|
||||
TArray<int64> GetHashes();
|
||||
|
||||
// Return the first unfinished animation.
|
||||
//
|
||||
const FlxAnimationStep *FirstUnfinished() const;
|
||||
@@ -319,7 +323,7 @@ public:
|
||||
|
||||
// Return the first animation with the specified hash.
|
||||
//
|
||||
const FlxAnimationStep *FindAnimation(uint64 hash) const;
|
||||
const FlxAnimationStep *FindAnimation(int64 hash) const;
|
||||
|
||||
// Clear the 'Changed' flag.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user