Skip to content

Instantly share code, notes, and snippets.

@torus
Created July 17, 2022 02:00
Show Gist options
  • Save torus/44139605ffb744c607e4bb1c31fc6abe to your computer and use it in GitHub Desktop.
Save torus/44139605ffb744c607e4bb1c31fc6abe to your computer and use it in GitHub Desktop.
UE5 local fix
From 0873075aea3fe169805b6518f3546023c1497938 Mon Sep 17 00:00:00 2001
From: Toru Hisai <[email protected]>
Date: Tue, 7 Sep 2021 13:46:36 +0900
Subject: [PATCH 1/2] fix for Blueprint generated C++ Class handling
---
.../Source/Runtime/Engine/Private/BlueprintGeneratedClass.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Engine/Source/Runtime/Engine/Private/BlueprintGeneratedClass.cpp b/Engine/Source/Runtime/Engine/Private/BlueprintGeneratedClass.cpp
index 456ac90aa..ec19196a9 100644
--- a/Engine/Source/Runtime/Engine/Private/BlueprintGeneratedClass.cpp
+++ b/Engine/Source/Runtime/Engine/Private/BlueprintGeneratedClass.cpp
@@ -1547,7 +1547,7 @@ bool UBlueprintGeneratedClass::NeedsLoadForServer() const
// to remove UBlueprint::NeedsLoadForEditorGame, after that it would be nice if we could just implement
// UBlueprint::NeedsLoadForEditorGame here, but we can't because then our CDO doesn't get loaded. We *could*
// fix that behavior, but instead I'm just abusing IsRunningCommandlet() so that this logic only runs during cook:
- if (IsRunningCommandlet() && !HasAnyFlags(RF_ClassDefaultObject))
+ if (IsRunningCommandlet() && !HasAnyFlags(RF_ClassDefaultObject | RF_Transient))
{
if (ensure(GetSuperClass()) && !GetSuperClass()->NeedsLoadForServer())
{
@@ -1568,7 +1568,7 @@ bool UBlueprintGeneratedClass::NeedsLoadForClient() const
// to remove UBlueprint::NeedsLoadForEditorGame, after that it would be nice if we could just implement
// UBlueprint::NeedsLoadForEditorGame here, but we can't because then our CDO doesn't get loaded. We *could*
// fix that behavior, but instead I'm just abusing IsRunningCommandlet() so that this logic only runs during cook:
- if (IsRunningCommandlet() && !HasAnyFlags(RF_ClassDefaultObject))
+ if (IsRunningCommandlet() && !HasAnyFlags(RF_ClassDefaultObject | RF_Transient))
{
if (ensure(GetSuperClass()) && !GetSuperClass()->NeedsLoadForClient())
{
--
2.27.0.windows.1
From 84e3c8e89c336f85b5a6d528d40cebee7c209dd9 Mon Sep 17 00:00:00 2001
From: Toru Hisai <[email protected]>
Date: Sun, 17 Jul 2022 10:50:04 +0900
Subject: [PATCH 2/2] add default value to the dialog for the unattended mode.
---
Engine/Source/Developer/AssetTools/Private/AssetTools.cpp | 1 +
Engine/Source/Editor/UnrealEd/Private/Factories/Factory.cpp | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/Engine/Source/Developer/AssetTools/Private/AssetTools.cpp b/Engine/Source/Developer/AssetTools/Private/AssetTools.cpp
index 293236139..2ea2c554b 100644
--- a/Engine/Source/Developer/AssetTools/Private/AssetTools.cpp
+++ b/Engine/Source/Developer/AssetTools/Private/AssetTools.cpp
@@ -2149,6 +2149,7 @@ TArray<UObject*> UAssetToolsImpl::ImportAssetsInternal(const TArray<FString>& Fi
{
UserResponse = FMessageDialog::Open(
EAppMsgType::YesNoYesAllNoAll,
+ EAppReturnType::Yes,
FText::Format(LOCTEXT("ImportObjectAlreadyExists_SameClass", "Do you want to overwrite the existing asset?\n\nAn asset already exists at the import location: {0}"), FText::FromString(PackageName)));
bOverwriteAll = UserResponse == EAppReturnType::YesAll;
diff --git a/Engine/Source/Editor/UnrealEd/Private/Factories/Factory.cpp b/Engine/Source/Editor/UnrealEd/Private/Factories/Factory.cpp
index 90c0af63a..cfe5f8fed 100644
--- a/Engine/Source/Editor/UnrealEd/Private/Factories/Factory.cpp
+++ b/Engine/Source/Editor/UnrealEd/Private/Factories/Factory.cpp
@@ -354,7 +354,7 @@ void UFactory::DisplayOverwriteOptionsDialog(const FText& Message)
}
else if (OverwriteYesOrNoToAllState != EAppReturnType::YesAll && OverwriteYesOrNoToAllState != EAppReturnType::NoAll)
{
- OverwriteYesOrNoToAllState = FMessageDialog::Open(EAppMsgType::YesNoYesAllNoAllCancel, FText::Format(
+ OverwriteYesOrNoToAllState = FMessageDialog::Open(EAppMsgType::YesNoYesAllNoAllCancel, EAppReturnType::Yes, FText::Format(
NSLOCTEXT("UnrealEd", "ImportedAssetAlreadyExists", "{0} Would you like to overwrite the existing settings?\n\nYes or Yes to All: Overwrite the existing settings.\nNo or No to All: Preserve the existing settings.\nCancel: Abort the operation."),
Message));
}
--
2.27.0.windows.1
@torus
Copy link
Author

torus commented Jul 17, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment