Checking everything in
This commit is contained in:
@@ -91,15 +91,13 @@ void UlxAnimationStepLibrary::UnpackAnimationStep(UObject* into, const FlxAnimat
|
||||
step.Unpack(prefix, into, true);
|
||||
}
|
||||
|
||||
static FlxAnimationField FindAnimationField(const FlxAnimationStep& step, const FString& name) {
|
||||
static FlxAnimationField FindAnimationFieldLL(const FlxAnimationStep& step, std::string_view 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) {
|
||||
if (result.Name == name) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -107,6 +105,34 @@ static FlxAnimationField FindAnimationField(const FlxAnimationStep& step, const
|
||||
return result;
|
||||
}
|
||||
|
||||
static FlxAnimationField FindAnimationField(const FlxAnimationStep& step, const FString& name) {
|
||||
FTCHARToUTF8 utf8name(name);
|
||||
std::string_view uname(utf8name.Get(), utf8name.Length());
|
||||
return FindAnimationFieldLL(step, uname);
|
||||
}
|
||||
|
||||
void FlxAnimationStep::AutoUpdateXYZ(AActor *actor) const {
|
||||
FlxAnimationField xyz = FindAnimationFieldLL(*this, "xyz");
|
||||
if (xyz.Type == ElxAnimValueType::XYZ) {
|
||||
actor->SetActorLocation(FVector(xyz.X, xyz.Y, xyz.Z));
|
||||
}
|
||||
}
|
||||
|
||||
void FlxAnimationStep::AutoUpdateFacing(AActor *actor) const {
|
||||
FlxAnimationField facing = FindAnimationFieldLL(*this, "facing");
|
||||
if (facing.Type == ElxAnimValueType::NUMBER) {
|
||||
actor->SetActorRotation(FRotator(0, facing.X, 0));
|
||||
}
|
||||
}
|
||||
|
||||
void FlxAnimationStep::AutoUpdatePlane(FName *planep) const {
|
||||
FlxAnimationField plane = FindAnimationFieldLL(*this, "plane");
|
||||
if (plane.Type == ElxAnimValueType::STRING) {
|
||||
FString pname(plane.S.size(), (const UTF8CHAR*)(plane.S.data()));
|
||||
*planep = FName(pname);
|
||||
}
|
||||
}
|
||||
|
||||
bool UlxAnimationStepLibrary::AnimationStepIsIdle(const FlxAnimationStep &step) {
|
||||
return step.Finished;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user