Some minor touchups to FlxAnimationStep
This commit is contained in:
BIN
Content/TangibleActor.uasset
LFS
BIN
Content/TangibleActor.uasset
LFS
Binary file not shown.
@@ -86,10 +86,51 @@ FString UlxAnimationStepLibrary::AnimationStepDebugString(const FlxAnimationStep
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UlxAnimationStepLibrary::UnpackAnimationStep(const FlxAnimationStep& step,
|
void UlxAnimationStepLibrary::UnpackAnimationStep(const FlxAnimationStep& step,
|
||||||
const FString& prefix, UObject* into, bool preclear) {
|
const FString& prefix, UObject* into) {
|
||||||
step.Unpack(prefix, into, preclear);
|
step.Unpack(prefix, into, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static FlxAnimationField FindAnimationField(const FlxAnimationStep& step, const FString& name) {
|
||||||
|
std::string_view body((const char*)(step.Body.GetData()), step.Body.Num());
|
||||||
|
FTCHARToUTF8 utf8name(name);
|
||||||
|
std::string_view uname(utf8name.Get(), utf8name.Length());
|
||||||
|
FlxAnimationStepDecoder decoder(body);
|
||||||
|
FlxAnimationField result;
|
||||||
|
while (!decoder.AtEOF()) {
|
||||||
|
result = decoder.ReadField();
|
||||||
|
if (result.Name == uname) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.Type = ElxAnimValueType::INVALID;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
FVector UlxAnimationStepLibrary::AnimationStepGetVector(const FlxAnimationStep& step, const FString& name) {
|
||||||
|
FlxAnimationField field = FindAnimationField(step, name);
|
||||||
|
if (field.Type != ElxAnimValueType::XYZ) return FVector(0, 0, 0);
|
||||||
|
return FVector(field.X, field.Y, field.Z);
|
||||||
|
}
|
||||||
|
|
||||||
|
double UlxAnimationStepLibrary::AnimationStepGetFloat(const FlxAnimationStep& step, const FString& name) {
|
||||||
|
FlxAnimationField field = FindAnimationField(step, name);
|
||||||
|
if (field.Type != ElxAnimValueType::NUMBER) return 0.0;
|
||||||
|
return field.X;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma optimize("", off)
|
||||||
|
FString UlxAnimationStepLibrary::AnimationStepGetString(const FlxAnimationStep& step, const FString& name) {
|
||||||
|
FlxAnimationField field = FindAnimationField(step, name);
|
||||||
|
if (field.Type != ElxAnimValueType::STRING) return TEXT("");
|
||||||
|
return FString(field.S.size(), (const UTF8CHAR*)(field.S.data()));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UlxAnimationStepLibrary::AnimationStepGetBool(const FlxAnimationStep& step, const FString& name) {
|
||||||
|
FlxAnimationField field = FindAnimationField(step, name);
|
||||||
|
if (field.Type != ElxAnimValueType::BOOLEAN) return false;
|
||||||
|
return field.X == 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
FlxAnimationStepView FlxAnimQueueDecoder::ReadStep() {
|
FlxAnimationStepView FlxAnimQueueDecoder::ReadStep() {
|
||||||
FlxAnimationStepView result;
|
FlxAnimationStepView result;
|
||||||
result.Hash = Decoder.read_uint64();
|
result.Hash = Decoder.read_uint64();
|
||||||
|
|||||||
@@ -111,12 +111,25 @@ class INTEGRATION_API UlxAnimationStepLibrary : public UObject
|
|||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = Tangibles)
|
UFUNCTION(BlueprintCallable, BlueprintPure, Category = Luprex)
|
||||||
static FString AnimationStepDebugString(const FlxAnimationStep& step);
|
static FString AnimationStepDebugString(const FlxAnimationStep& step);
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = Tangibles)
|
UFUNCTION(BlueprintCallable, Category = Luprex)
|
||||||
static void UnpackAnimationStep(const FlxAnimationStep& step,
|
static void UnpackAnimationStep(const FlxAnimationStep& step,
|
||||||
const FString& prefix, UObject* into, bool preclear = true);
|
const FString& VariableNamePrefix, UObject* into);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, BlueprintPure, Category = Luprex)
|
||||||
|
static FVector AnimationStepGetVector(const FlxAnimationStep& step, const FString& name);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, BlueprintPure, Category = Luprex)
|
||||||
|
static double AnimationStepGetFloat(const FlxAnimationStep& step, const FString& name);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, BlueprintPure, Category = Luprex)
|
||||||
|
static FString AnimationStepGetString(const FlxAnimationStep& step, const FString& name);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, BlueprintPure, Category = Luprex)
|
||||||
|
static bool AnimationStepGetBool(const FlxAnimationStep& step, const FString& name);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user