Can now pass tokens as values in animation steps
This commit is contained in:
@@ -41,6 +41,13 @@ static bool SetProperty(const FString& prefix, UObject* obj, const FlxAnimationF
|
||||
*pptr = FString(field.S.size(), (const UTF8CHAR*)field.S.data());
|
||||
return true;
|
||||
}
|
||||
case SimpleDynamicTag::TOKEN: {
|
||||
FNameProperty* fprop = FindFProperty<FNameProperty>(uclass, nname);
|
||||
if (fprop == nullptr) return false;
|
||||
FName* pptr = fprop->ContainerPtrToValuePtr<FName>(obj);
|
||||
*pptr = FName(field.S.size(), (const UTF8CHAR*)field.S.data(), FNAME_Add);
|
||||
return true;
|
||||
}
|
||||
case SimpleDynamicTag::NUMBER: {
|
||||
FDoubleProperty* fprop = FindFProperty<FDoubleProperty>(uclass, nname);
|
||||
if (fprop == nullptr) return false;
|
||||
@@ -206,6 +213,12 @@ FString UlxAnimationStepLibrary::AnimationStepGetString(const FlxAnimationStep&
|
||||
return FString(field.S.size(), (const UTF8CHAR*)(field.S.data()));
|
||||
}
|
||||
|
||||
FName UlxAnimationStepLibrary::AnimationStepGetName(const FlxAnimationStep& step, const FString& name) {
|
||||
FlxAnimationField field = FindAnimationField(step, name);
|
||||
if (field.Type != SimpleDynamicTag::TOKEN) return FName();
|
||||
return FName(field.S.size(), (const UTF8CHAR*)(field.S.data()), FNAME_Add);
|
||||
}
|
||||
|
||||
bool UlxAnimationStepLibrary::AnimationStepGetBool(const FlxAnimationStep& step, const FString& name) {
|
||||
FlxAnimationField field = FindAnimationField(step, name);
|
||||
if (field.Type != SimpleDynamicTag::BOOLEAN) return false;
|
||||
@@ -223,6 +236,10 @@ FlxAnimationField FlxAnimationStepDecoder::ReadField() {
|
||||
result.S = Decoder.read_string_view();
|
||||
break;
|
||||
}
|
||||
case SimpleDynamicTag::TOKEN: {
|
||||
result.S = Decoder.read_string_view();
|
||||
break;
|
||||
}
|
||||
case SimpleDynamicTag::NUMBER: {
|
||||
result.X = Decoder.read_double();
|
||||
break;
|
||||
@@ -263,6 +280,9 @@ FString FlxAnimationStepDecoder::DebugString(bool injectidle, bool persistentonl
|
||||
case SimpleDynamicTag::STRING:
|
||||
result.Append(FString(field.S.size(), (const UTF8CHAR*)field.S.data()));
|
||||
break;
|
||||
case SimpleDynamicTag::TOKEN:
|
||||
result.Appendf(TEXT("[%s]"), *FString(field.S.size(), (const UTF8CHAR*)field.S.data()));
|
||||
break;
|
||||
case SimpleDynamicTag::NUMBER:
|
||||
result.Appendf(TEXT("%lf"), field.X);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user