Upgrade to 5.8
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
// Released under the MIT license https://opensource.org/license/MIT/
|
||||
#include "SUDSValue.h"
|
||||
|
||||
#include "UObject/Class.h"
|
||||
#include "Internationalization/Text.h"
|
||||
|
||||
FArchive& operator<<(FArchive& Ar, FSUDSValue& Value)
|
||||
{
|
||||
// Custom serialisation since we can't auto-serialise union, TOptional
|
||||
@@ -62,7 +65,11 @@ FString FSUDSValue::ToString() const
|
||||
case ESUDSValueType::Boolean:
|
||||
return GetBooleanValue() ? "True" : "False";
|
||||
case ESUDSValueType::Gender:
|
||||
return StaticEnum<ETextGender>()->GetNameStringByValue((int64)GetGenderValue());
|
||||
#if ENGINE_MAJOR_VERSION ==5 && ENGINE_MINOR_VERSION >= 8
|
||||
return LexToString(GetGenderValue());
|
||||
#else
|
||||
return *StaticEnum<ETextGender>()->GetNameStringByValue((int64)GetGenderValue());
|
||||
#endif
|
||||
case ESUDSValueType::Name:
|
||||
return GetNameValue().ToString();
|
||||
case ESUDSValueType::Variable:
|
||||
|
||||
@@ -706,7 +706,11 @@ void FSUDSEditorToolkit::OnDialogueChoice(USUDSDialogue* D, int ChoiceIndex, int
|
||||
|
||||
void FSUDSEditorToolkit::OnDialogueEvent(USUDSDialogue* D, FName EventName, const TArray<FSUDSValue>& Args, int LineNo)
|
||||
{
|
||||
#if ENGINE_MAJOR_VERSION ==5 && ENGINE_MINOR_VERSION >= 8
|
||||
TStringBuilder<256> B;
|
||||
#else
|
||||
FStringBuilderBase B;
|
||||
#endif
|
||||
if (Args.Num() > 0)
|
||||
{
|
||||
for (auto& Arg : Args)
|
||||
@@ -1372,6 +1376,24 @@ TSharedRef<SWidget> SSUDSEditorVariableItem::GetGenderMenu()
|
||||
{
|
||||
FMenuBuilder MenuBuilder(true, NULL);
|
||||
|
||||
#if ENGINE_MAJOR_VERSION ==5 && ENGINE_MINOR_VERSION >= 8
|
||||
// StaticEnum<ETextGender>() doesn't exist anymore so we have to do this manually
|
||||
const FUIAction Action0(FExecuteAction::CreateSP(this, &SSUDSEditorVariableItem::OnGenderSelected, ETextGender::Feminine));
|
||||
MenuBuilder.AddMenuEntry(FText::FromString(LexToString(ETextGender::Feminine)),
|
||||
FText(),
|
||||
FSlateIcon(),
|
||||
Action0);
|
||||
const FUIAction Action1(FExecuteAction::CreateSP(this, &SSUDSEditorVariableItem::OnGenderSelected, ETextGender::Masculine));
|
||||
MenuBuilder.AddMenuEntry(FText::FromString(LexToString(ETextGender::Masculine)),
|
||||
FText(),
|
||||
FSlateIcon(),
|
||||
Action1);
|
||||
const FUIAction Action2(FExecuteAction::CreateSP(this, &SSUDSEditorVariableItem::OnGenderSelected, ETextGender::Neuter));
|
||||
MenuBuilder.AddMenuEntry(FText::FromString(LexToString(ETextGender::Neuter)),
|
||||
FText(),
|
||||
FSlateIcon(),
|
||||
Action2);
|
||||
#else
|
||||
// NumEnums() - 1 because the last value is the autogen _MAX value
|
||||
for (int i = 0; i < StaticEnum<ETextGender>()->NumEnums() - 1; ++i)
|
||||
{
|
||||
@@ -1383,6 +1405,7 @@ TSharedRef<SWidget> SSUDSEditorVariableItem::GetGenderMenu()
|
||||
Action);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
return MenuBuilder.MakeWidget();
|
||||
|
||||
|
||||
@@ -1772,7 +1772,11 @@ FString FSUDSScriptImporter::GetCurrentTreePath(const FSUDSScriptImporter::Parse
|
||||
// Do NOT fallthrough to here
|
||||
// Fallthrough to here instead (/)
|
||||
|
||||
#if ENGINE_MAJOR_VERSION ==5 && ENGINE_MINOR_VERSION >= 8
|
||||
TStringBuilder<256> B;
|
||||
#else
|
||||
FStringBuilderBase B;
|
||||
#endif
|
||||
for (auto Indent : Tree.IndentLevelStack)
|
||||
{
|
||||
B.Appendf(TEXT("%s%s"), *Indent.PathEntry, *TreePathSeparator);
|
||||
@@ -1784,7 +1788,11 @@ FString FSUDSScriptImporter::GetCurrentTreeConditionalPath(const FSUDSScriptImpo
|
||||
{
|
||||
// Like GetCurrentTreePath, but for conditional blocks
|
||||
// Cannot fall through to blocks that aren't on the same conditional path
|
||||
#if ENGINE_MAJOR_VERSION ==5 && ENGINE_MINOR_VERSION >= 8
|
||||
TStringBuilder<256> B;
|
||||
#else
|
||||
FStringBuilderBase B;
|
||||
#endif
|
||||
int BlockIdx = Tree.CurrentConditionalBlockIdx;
|
||||
B.Append(TreePathSeparator);
|
||||
// work backwards, hence prepend
|
||||
@@ -1803,7 +1811,11 @@ FString FSUDSScriptImporter::GetCurrentTreeConditionalPath(const FSUDSScriptImpo
|
||||
FString FSUDSScriptImporter::GetTreeConditionalPath(const FSUDSScriptImporter::ParsedTree& Tree, int NodeIndex)
|
||||
{
|
||||
// Like GetCurrentTreeConditionalPath, but we're not in the block context. Follow the nodes back up
|
||||
#if ENGINE_MAJOR_VERSION ==5 && ENGINE_MINOR_VERSION >= 8
|
||||
TStringBuilder<256> B;
|
||||
#else
|
||||
FStringBuilderBase B;
|
||||
#endif
|
||||
B.Append(TreePathSeparator);
|
||||
|
||||
while (Tree.Nodes.IsValidIndex(NodeIndex))
|
||||
@@ -2543,7 +2555,11 @@ void FSUDSScriptImporter::PopulateAssetFromTree(USUDSScript* Asset,
|
||||
{
|
||||
case ESUDSParsedNodeType::Text:
|
||||
{
|
||||
#if ENGINE_MAJOR_VERSION ==5 && ENGINE_MINOR_VERSION >= 8
|
||||
StringTable->GetMutableStringTable()->SetSourceString(InNode.TextID, InNode.Text, "");
|
||||
#else
|
||||
StringTable->GetMutableStringTable()->SetSourceString(InNode.TextID, InNode.Text);
|
||||
#endif
|
||||
// Always include speaker metadata
|
||||
StringTable->GetMutableStringTable()->SetMetaData(InNode.TextID, FName("Speaker"), InNode.Identifier);
|
||||
// Other metadata
|
||||
@@ -2579,7 +2595,11 @@ void FSUDSScriptImporter::PopulateAssetFromTree(USUDSScript* Asset,
|
||||
FSUDSExpression Expr = InNode.Expression;
|
||||
if (Expr.IsTextLiteral())
|
||||
{
|
||||
#if ENGINE_MAJOR_VERSION ==5 && ENGINE_MINOR_VERSION >= 8
|
||||
StringTable->GetMutableStringTable()->SetSourceString(InNode.TextID, Expr.GetTextLiteralValue().ToString(), "");
|
||||
#else
|
||||
StringTable->GetMutableStringTable()->SetSourceString(InNode.TextID, Expr.GetTextLiteralValue().ToString());
|
||||
#endif
|
||||
Expr.SetTextLiteralValue(FText::FromStringTable (StringTable->GetStringTableId(), InNode.TextID));
|
||||
}
|
||||
SetNode->Init(InNode.Identifier, Expr, InNode.SourceLineNo);
|
||||
@@ -2707,7 +2727,11 @@ void FSUDSScriptImporter::PopulateAssetFromTree(USUDSScript* Asset,
|
||||
|
||||
if (!InEdge.TextID.IsEmpty() && !InEdge.Text.IsEmpty())
|
||||
{
|
||||
#if ENGINE_MAJOR_VERSION ==5 && ENGINE_MINOR_VERSION >= 8
|
||||
StringTable->GetMutableStringTable()->SetSourceString(InEdge.TextID, InEdge.Text, "");
|
||||
#else
|
||||
StringTable->GetMutableStringTable()->SetSourceString(InEdge.TextID, InEdge.Text);
|
||||
#endif
|
||||
NewEdge.SetText(FText::FromStringTable(StringTable->GetStringTableId(), InEdge.TextID));
|
||||
// Always include speaker metadata, always the player in a choice
|
||||
// Identify that it's a choice so translators know that there may be more limited space
|
||||
|
||||
Reference in New Issue
Block a user