2023-09-08 05:38:09 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "StringDecoder.h"
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// This is copied over from Luprex source. Not ideal.
|
|
|
|
|
//
|
|
|
|
|
////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
enum EAnimValueType {
|
|
|
|
|
T_STRING,
|
|
|
|
|
T_NUMBER,
|
|
|
|
|
T_BOOLEAN,
|
|
|
|
|
T_XYZ,
|
|
|
|
|
T_UNINITIALIZED
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// An single animation step.
|
|
|
|
|
//
|
|
|
|
|
// The body consists of a sequence of FAnimField
|
|
|
|
|
// records. The body is encoded, to read the
|
|
|
|
|
// FAnimField records you need an FAnimStepDecoder.
|
|
|
|
|
//
|
|
|
|
|
////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
struct FAnimStep {
|
|
|
|
|
uint32 Hash;
|
|
|
|
|
std::string_view Body;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// A single animation field.
|
|
|
|
|
//
|
|
|
|
|
// A field consists of a variable name,
|
|
|
|
|
// a persistent flag, a type, and some fields
|
|
|
|
|
// to hold the values.
|
|
|
|
|
//
|
|
|
|
|
// If the value is boolean, it is stored in
|
|
|
|
|
// X, as either 1 or 0. If the value is double,
|
|
|
|
|
// it is stored in X.
|
|
|
|
|
//
|
|
|
|
|
////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
struct FAnimField {
|
|
|
|
|
std::string_view Name;
|
|
|
|
|
bool Persistent;
|
|
|
|
|
EAnimValueType Type;
|
|
|
|
|
double X, Y, Z;
|
|
|
|
|
std::string_view S;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// An Animation Queue Decoder.
|
|
|
|
|
//
|
|
|
|
|
// This acts a lot like a stream reader,
|
|
|
|
|
// it reads one AnimEntry at a time from
|
|
|
|
|
// the animation queue until you reach
|
|
|
|
|
// 'end-of-file'.
|
|
|
|
|
//
|
|
|
|
|
////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class FAnimQueueDecoder {
|
|
|
|
|
private:
|
|
|
|
|
FStringDecoder Decoder;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
// Initialize the FAnimQueueDecoder with the encoded animation queue.
|
|
|
|
|
//
|
|
|
|
|
FAnimQueueDecoder(std::string_view s) : Decoder(s) {}
|
|
|
|
|
|
|
|
|
|
// Return true if the parser has reached the end of the string.
|
|
|
|
|
//
|
|
|
|
|
bool AtEOF() { return Decoder.at_eof(); }
|
|
|
|
|
|
|
|
|
|
// Read one animation step.
|
|
|
|
|
//
|
|
|
|
|
FAnimStep ReadStep();
|
|
|
|
|
|
|
|
|
|
// Convert an AnimQueue to an FString.
|
|
|
|
|
//
|
|
|
|
|
static FString DebugString(std::string_view s);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// An Animation Step Decoder.
|
|
|
|
|
//
|
|
|
|
|
// This acts a lot like a stream reader,
|
|
|
|
|
// it reads one FAnimField at a time from
|
|
|
|
|
// the animation queue until you reach
|
|
|
|
|
// 'end-of-file'.
|
|
|
|
|
//
|
|
|
|
|
////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class FAnimStepDecoder {
|
|
|
|
|
private:
|
|
|
|
|
FStringDecoder Decoder;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
// Initialize the FAnimStepDecoder from the FAnimStep.
|
|
|
|
|
//
|
|
|
|
|
FAnimStepDecoder(const FAnimStep &step) : Decoder(step.Body) {}
|
|
|
|
|
|
|
|
|
|
// Return true if the parser has reached the end of the string.
|
|
|
|
|
//
|
|
|
|
|
bool AtEOF() { return Decoder.at_eof(); }
|
|
|
|
|
|
|
|
|
|
// Read one field.
|
|
|
|
|
//
|
|
|
|
|
FAnimField ReadField();
|
|
|
|
|
|
|
|
|
|
// Convert an AnimStep to an FString.
|
|
|
|
|
//
|
|
|
|
|
static FString DebugString(const FAnimStep &step);
|
|
|
|
|
};
|