Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support UE 4.26 - 5.0 #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Plugins/Linter/Source/Linter/Private/LintRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "IAssetRegistry.h"
#include "IAssetTools.h"
#include "AssetRegistryModule.h"
#include "Misc/EngineVersionComparison.h"


ULintRule::ULintRule(const FObjectInitializer& ObjectInitializer)
Expand Down Expand Up @@ -61,7 +62,7 @@ FName ULintRule::GetRuleBasedObjectVariantName_Implementation(UObject* ObjectToL
UMaterialInterface* MI = Cast<UMaterialInterface>(ObjectToLint);
if (MI != nullptr)
{
#if ENGINE_MINOR_VERSION >= 25
#if UE_VERSION_NEWER_THAN(4, 25, 0)
TMicRecursionGuard RecursionGuard;
#else
UMaterialInterface::TMicRecursionGuard RecursionGuard;
Expand Down
2 changes: 1 addition & 1 deletion Plugins/Linter/Source/Linter/Private/Linter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ TSharedRef<SDockTab> FLinterModule::SpawnTab(const FSpawnTabArgs& TabSpawnArgs,

const TSharedRef<SDockTab> MajorTab =
SNew(SDockTab)
.Icon(IconBrush)
.TabRole(ETabRole::MajorTab);

MajorTab->SetContent(SNew(SLintWizard));
MajorTab->SetTabIcon(IconBrush);

return MajorTab;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions Plugins/Linter/Source/Linter/Private/UI/LintWizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -83,12 +84,18 @@ 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([&]()
{
#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; })
Expand Down Expand Up @@ -521,7 +528,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();
})
Expand Down
2 changes: 1 addition & 1 deletion Plugins/Linter/Source/Linter/Public/LinterSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ class ULinterSettings : public UObject
public:

UPROPERTY(EditAnywhere, config, Category = Settings)
TAssetPtr<ULintRuleSet> DefaultLintRuleSet;
TSoftObjectPtr<ULintRuleSet> DefaultLintRuleSet;

};