From d8724f16891636f9bfe96fd478cbca8af4431765 Mon Sep 17 00:00:00 2001 From: empty2fill Date: Mon, 18 Apr 2022 16:01:36 +0900 Subject: [PATCH 1/2] Fix UE version check - FTabManager::InvokeTab is deprecated - TMicRecursionGuard (cherry picked from commit 9b69d3ecf2c053ac6c14a0ec962695e27e212a40) --- Plugins/Linter/Source/Linter/Private/LintRule.cpp | 3 ++- .../Linter/Private/LinterContentBrowserExtensions.cpp | 5 +++++ Plugins/Linter/Source/Linter/Private/UI/LintWizard.cpp | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Plugins/Linter/Source/Linter/Private/LintRule.cpp b/Plugins/Linter/Source/Linter/Private/LintRule.cpp index 596aa31..507dd19 100644 --- a/Plugins/Linter/Source/Linter/Private/LintRule.cpp +++ b/Plugins/Linter/Source/Linter/Private/LintRule.cpp @@ -10,6 +10,7 @@ #include "IAssetRegistry.h" #include "IAssetTools.h" #include "AssetRegistryModule.h" +#include "Misc/EngineVersionComparison.h" ULintRule::ULintRule(const FObjectInitializer& ObjectInitializer) @@ -61,7 +62,7 @@ FName ULintRule::GetRuleBasedObjectVariantName_Implementation(UObject* ObjectToL UMaterialInterface* MI = Cast(ObjectToLint); if (MI != nullptr) { -#if ENGINE_MINOR_VERSION >= 25 +#if UE_VERSION_NEWER_THAN(4, 25, 0) TMicRecursionGuard RecursionGuard; #else UMaterialInterface::TMicRecursionGuard RecursionGuard; diff --git a/Plugins/Linter/Source/Linter/Private/LinterContentBrowserExtensions.cpp b/Plugins/Linter/Source/Linter/Private/LinterContentBrowserExtensions.cpp index 099c20d..c07bc85 100644 --- a/Plugins/Linter/Source/Linter/Private/LinterContentBrowserExtensions.cpp +++ b/Plugins/Linter/Source/Linter/Private/LinterContentBrowserExtensions.cpp @@ -12,6 +12,7 @@ #include "Framework/Commands/UIAction.h" #include "Delegates/IDelegateInstance.h" #include "TooltipEditor/TooltipTool.h" +#include "Misc/EngineVersionComparison.h" #define LOCTEXT_NAMESPACE "Linter" DEFINE_LOG_CATEGORY_STATIC(LinterContentBrowserExtensions, Log, All); @@ -50,7 +51,11 @@ void FLinterContentBrowserExtensions::InstallHooks(FLinterModule* LinterModule, { lm->SetDesiredLintPaths(SelectedPaths); } +#if UE_VERSION_NEWER_THAN(4, 26, 0) + FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab")); +#else FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab")); +#endif } })), NAME_None, diff --git a/Plugins/Linter/Source/Linter/Private/UI/LintWizard.cpp b/Plugins/Linter/Source/Linter/Private/UI/LintWizard.cpp index 65e9cbd..f8162b0 100644 --- a/Plugins/Linter/Source/Linter/Private/UI/LintWizard.cpp +++ b/Plugins/Linter/Source/Linter/Private/UI/LintWizard.cpp @@ -19,6 +19,7 @@ #include "FileHelpers.h" #include "Logging/MessageLog.h" #include "Logging/TokenizedMessage.h" +#include "Misc/EngineVersionComparison.h" #include "LinterStyle.h" #include "LintRuleSet.h" @@ -88,7 +89,11 @@ void SLintWizard::Construct(const FArguments& InArgs) .FinishButtonText(LOCTEXT("FinishButtonText", "Close")) .OnFinished_Lambda([&]() { +#if UE_VERSION_NEWER_THAN(4, 26, 0) + FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab"))->RequestCloseTab(); +#else FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab"))->RequestCloseTab(); +#endif }) + SWizard::Page() .CanShow_Lambda([&]() { return RuleSets.Num() > 0; }) @@ -521,7 +526,11 @@ void SLintWizard::Construct(const FArguments& InArgs) LOCTEXT("ZipTaskShortName", "Zip Project Task"), FEditorStyle::GetBrush(TEXT("MainFrame.CookContent"))); } +#if UE_VERSION_NEWER_THAN(4, 26, 0) + FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab"))->RequestCloseTab(); +#else FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab"))->RequestCloseTab(); +#endif } return FReply::Handled(); }) From e1f78b85bf50d33945825e02d9950abd9cb1a559 Mon Sep 17 00:00:00 2001 From: empty2fill Date: Tue, 19 Apr 2022 00:58:40 +0900 Subject: [PATCH 2/2] Support UE 4.26 - 5.0 --- Plugins/Linter/Source/Linter/Private/Linter.cpp | 2 +- Plugins/Linter/Source/Linter/Private/UI/LintWizard.cpp | 2 ++ Plugins/Linter/Source/Linter/Public/LinterSettings.h | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Plugins/Linter/Source/Linter/Private/Linter.cpp b/Plugins/Linter/Source/Linter/Private/Linter.cpp index deab22e..210a46f 100644 --- a/Plugins/Linter/Source/Linter/Private/Linter.cpp +++ b/Plugins/Linter/Source/Linter/Private/Linter.cpp @@ -103,10 +103,10 @@ TSharedRef FLinterModule::SpawnTab(const FSpawnTabArgs& TabSpawnArgs, const TSharedRef MajorTab = SNew(SDockTab) - .Icon(IconBrush) .TabRole(ETabRole::MajorTab); MajorTab->SetContent(SNew(SLintWizard)); + MajorTab->SetTabIcon(IconBrush); return MajorTab; } diff --git a/Plugins/Linter/Source/Linter/Private/UI/LintWizard.cpp b/Plugins/Linter/Source/Linter/Private/UI/LintWizard.cpp index f8162b0..3566f61 100644 --- a/Plugins/Linter/Source/Linter/Private/UI/LintWizard.cpp +++ b/Plugins/Linter/Source/Linter/Private/UI/LintWizard.cpp @@ -84,7 +84,9 @@ void SLintWizard::Construct(const FArguments& InArgs) .CancelButtonStyle(FEditorStyle::Get(), "FlatButton.Default") .FinishButtonStyle(FEditorStyle::Get(), "FlatButton.Success") .ButtonTextStyle(FEditorStyle::Get(), "LargeText") +#if UE_VERSION_OLDER_THAN(5, 0, 0) .ForegroundColor(FEditorStyle::Get().GetSlateColor("WhiteBrush")) +#endif .CanFinish(true) .FinishButtonText(LOCTEXT("FinishButtonText", "Close")) .OnFinished_Lambda([&]() diff --git a/Plugins/Linter/Source/Linter/Public/LinterSettings.h b/Plugins/Linter/Source/Linter/Public/LinterSettings.h index 5b13fac..bb7e9f5 100644 --- a/Plugins/Linter/Source/Linter/Public/LinterSettings.h +++ b/Plugins/Linter/Source/Linter/Public/LinterSettings.h @@ -18,6 +18,6 @@ class ULinterSettings : public UObject public: UPROPERTY(EditAnywhere, config, Category = Settings) - TAssetPtr DefaultLintRuleSet; + TSoftObjectPtr DefaultLintRuleSet; };