Skip to content

Commit

Permalink
Updated plugin to ue 5.4 (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiebeazer authored Aug 24, 2024
1 parent 22f4ed0 commit 7fdc728
Show file tree
Hide file tree
Showing 27 changed files with 50 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ Plugins/*/Intermediate/*

# Cache files for the editor to use
DerivedDataCache/*
/.idea/
2 changes: 1 addition & 1 deletion Linter.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"DocsURL": "http://discord.gamemak.in",
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/content/ca0639af6339476da86fa3bcf15de8ec",
"SupportURL": "http://discord.gamemak.in",
"EngineVersion": "5.3.0",
"EngineVersion": "5.4.0",
"CanContainContent": true,
"Installed": true,
"Modules": [
Expand Down
4 changes: 2 additions & 2 deletions Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ FDlgBatchRenameTool::FDlgBatchRenameTool(const TArray<FAssetData> Assets)
.SupportsMinimize(false).SupportsMaximize(false)
.SaneWindowPlacement(true)
.AutoCenter(EAutoCenter::PreferredWorkArea)
.ClientSize(FVector2D(350, 165));
.ClientSize(FVector2D(350, 185));

TSharedPtr<SBorder> DialogWrapper =
SNew(SBorder)
Expand Down Expand Up @@ -74,7 +74,7 @@ FDlgBatchRenameTool::EResult FDlgBatchRenameTool::ShowModal()
const FAssetData& Asset = *AssetIt;

// Early out on assets that can not be renamed
if (!(!Asset.IsRedirector() && Asset.AssetClass != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)))
if (!(!Asset.IsRedirector() && Asset.AssetClassPath.GetAssetName() != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)))
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Linter/Private/LintRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ bool FLintRuleViolation::PopulateAssetData()

if (Violator.IsValid())
{
ViolatorAssetData = AssetRegistry.GetAssetByObjectPath(FName(*Violator->GetPathName()));
ViolatorAssetData = AssetRegistry.GetAssetByObjectPath(FSoftObjectPath(*Violator->GetPathName()));
return ViolatorAssetData.IsValid();
}

Expand Down
13 changes: 11 additions & 2 deletions Source/Linter/Private/LintRuleSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,16 @@ TArray<FLintRuleViolation> ULintRuleSet::LintPath(TArray<FString> AssetPaths, FS
for (FAssetData const& Asset : AssetList)
{
check(Asset.IsValid());
UE_LOG(LogLinter, Verbose, TEXT("Creating Lint Thread for asset \"%s\"."), *Asset.AssetName.ToString());
// TODO - ADD LIST OF ASSETS TO SKIP THAT CAN BE CONFIGURED IN EDITOR
if (Asset.AssetName.ToString().Contains(TEXT("ABP_Humanoid")))
{
UE_LOG(LogLinter, Verbose, TEXT("Skipping asset \"%s\"."), *Asset.AssetName.ToString());
continue;
}
else
{
UE_LOG(LogLinter, Verbose, TEXT("Creating Lint Thread for asset \"%s\"."), *Asset.AssetName.ToString());
}
UObject* Object = Asset.GetAsset();
check(Object != nullptr);

Expand All @@ -82,7 +91,7 @@ TArray<FLintRuleViolation> ULintRuleSet::LintPath(TArray<FString> AssetPaths, FS
}
else
{
Threads.Push(FRunnableThread::Create(Runner, *FString::Printf(TEXT("FLintRunner - %s"), *Asset.ObjectPath.ToString()), 0, TPri_Normal));
Threads.Push(FRunnableThread::Create(Runner, *FString::Printf(TEXT("FLintRunner - %s"), *Asset.GetObjectPathString()), 0, TPri_Normal));
if (ParentScopedSlowTask != nullptr)
{
ParentScopedSlowTask->EnterProgressFrame(1.0f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "LintRuleSet.h"
#include "LinterNamingConvention.h"
#include "HAL/FileManager.h"

// @TODO reimplement this class. Look at Marketplace ruleset for implementation
ULintRule_Texture_Size_NotTooBig::ULintRule_Texture_Size_NotTooBig(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "LintRuleSet.h"
#include "LinterNamingConvention.h"
#include "HAL/FileManager.h"

// @TODO reimplement this class. Look at Marketplace ruleset for implementation
ULintRule_Texture_Size_PowerOfTwo::ULintRule_Texture_Size_PowerOfTwo(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
Expand Down Expand Up @@ -32,6 +32,7 @@ bool ULintRule_Texture_Size_PowerOfTwo::PassesRule_Internal_Implementation(UObje
{
const UTexture2D* Texture = CastChecked<UTexture2D>(ObjectToLint);


int32 TexSizeX = Texture->GetSizeX();
int32 TexSizeY = Texture->GetSizeY();

Expand Down
4 changes: 3 additions & 1 deletion Source/Linter/Private/Linter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ void FLinterModule::TryToLoadAllLintRuleSets()
IAssetRegistry& AssetRegistry = AssetRegistryModule.Get();

TArray<FAssetData> FoundRuleSets;
AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetFName(), FoundRuleSets, true);
const UClass* LintRuleSetClass = ULintRuleSet::StaticClass();
FTopLevelAssetPath LintRuleTopLevelAssetPath(FName(LintRuleSetClass->GetPackage()->GetPathName()), LintRuleSetClass->GetFName());
AssetRegistry.GetAssetsByClass(LintRuleTopLevelAssetPath, FoundRuleSets, true);

// Attempt to get all RuleSets in memory so that linting tools are better aware of them
for (const FAssetData& RuleSetData : FoundRuleSets)
Expand Down
6 changes: 4 additions & 2 deletions Source/Linter/Private/LinterCommandlet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ int32 ULinterCommandlet::Main(const FString& InParams)
FLinterModule::TryToLoadAllLintRuleSets();

TArray<FAssetData> FoundRuleSets;
AssetRegistryModule.Get().GetAssetsByClass(ULintRuleSet::StaticClass()->GetFName(), FoundRuleSets, true);
const UClass* LintRuleSetClass = ULintRuleSet::StaticClass();
FTopLevelAssetPath LintRuleTopLevelAssetPath(FName(LintRuleSetClass->GetPackage()->GetPathName()), LintRuleSetClass->GetFName());
AssetRegistryModule.Get().GetAssetsByClass(LintRuleTopLevelAssetPath, FoundRuleSets, true);

for (const FAssetData& RuleSetData : FoundRuleSets)
{
Expand Down Expand Up @@ -129,7 +131,7 @@ int32 ULinterCommandlet::Main(const FString& InParams)
UniqueViolatorViolations[0].PopulateAssetData();
AssetData = UniqueViolatorViolations[0].ViolatorAssetData;
AssetJsonObject->SetStringField(TEXT("ViolatorAssetName"), AssetData.AssetName.ToString());
AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.ObjectPath.ToString());
AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.GetObjectPathString());
AssetJsonObject->SetStringField(TEXT("ViolatorFullName"), AssetData.GetFullName());
//@TODO: Thumbnail export?

Expand Down
4 changes: 2 additions & 2 deletions Source/Linter/Private/LinterContentBrowserExtensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void FLinterContentBrowserExtensions::InstallHooks(FLinterModule* LinterModule,
{
const FAssetData& Asset = *AssetIt;
// Cannot rename redirectors or classes or cooked packages
if (!Asset.IsRedirector() && Asset.AssetClass != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly))
if (!Asset.IsRedirector() && Asset.AssetClassPath.GetAssetName() != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly))
{
if (Asset.GetClass()->IsChildOf(UBlueprint::StaticClass()))
{
Expand Down Expand Up @@ -123,7 +123,7 @@ void FLinterContentBrowserExtensions::InstallHooks(FLinterModule* LinterModule,
{
const FAssetData& Asset = *AssetIt;
// Cannot rename redirectors or classes or cooked packages
if (!Asset.IsRedirector() && Asset.AssetClass != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly))
if (!Asset.IsRedirector() && Asset.AssetClassPath.GetAssetName() != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly))
{
bAnyAssetCanBeRenamed = true;
break;
Expand Down
2 changes: 1 addition & 1 deletion Source/Linter/Private/UI/LintReport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void SLintReport::Rebuild(const ULintRuleSet* SelectedLintRuleSet)
{
AssetData = UniqueViolatorViolations[0]->ViolatorAssetData;
AssetJsonObject->SetStringField(TEXT("ViolatorAssetName"), AssetData.AssetName.ToString());
AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.ObjectPath.ToString());
AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.GetObjectPathString());
AssetJsonObject->SetStringField(TEXT("ViolatorFullName"), AssetData.GetFullName());
//@TODO: Thumbnail export?

Expand Down
1 change: 1 addition & 0 deletions Source/Linter/Private/UI/LintReportAssetError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,4 @@ void SLintReportAssetError::Construct(const FArguments& Args)
];
}

#undef LOCTEXT_NAMESPACE
2 changes: 1 addition & 1 deletion Source/Linter/Private/UI/LintReportRuleDetails.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void SLintReportRuleDetails::Construct(const FArguments& Args)
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
IAssetRegistry& AssetRegistry = AssetRegistryModule.Get();

RuleAssetData = AssetRegistry.GetAssetByObjectPath(FName(*BrokenRule->GetPathName()), true);
RuleAssetData = AssetRegistry.GetAssetByObjectPath(FSoftObjectPath(*BrokenRule->GetPathName()), true);
FText RuleAssetPath;
if (RuleAssetData.IsValid())
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Linter/Private/UI/LintReportRuleError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void SLintReportRuleError::Construct(const FArguments& Args)
FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked<FContentBrowserModule>("ContentBrowser");
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
TArray<FAssetData> AssetDatas;
AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(RuleViolation.Get()->ViolatorAssetData.ObjectPath));
AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(RuleViolation.Get()->ViolatorAssetData.ToSoftObjectPath()));
ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas);
})
]
Expand Down
10 changes: 7 additions & 3 deletions Source/Linter/Private/UI/LintWizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ void SLintWizard::Construct(const FArguments& InArgs)
IAssetRegistry& AssetRegistry = AssetRegistryModule.Get();

TArray<FAssetData> FoundRuleSets;
AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetFName(), FoundRuleSets, true);
const UClass* LintRuleSetClass = ULintRuleSet::StaticClass();
FTopLevelAssetPath LintRuleTopLevelAssetPath(FName(LintRuleSetClass->GetPackage()->GetPathName()), LintRuleSetClass->GetFName());
AssetRegistry.GetAssetsByClass(LintRuleTopLevelAssetPath, FoundRuleSets, true);

// Attempt to get all RuleSets in memory so that linting tools are better aware of them
for (const FAssetData& RuleSetData : FoundRuleSets)
Expand Down Expand Up @@ -268,7 +270,9 @@ void SLintWizard::Construct(const FArguments& InArgs)
FARFilter Filter;
Filter.bRecursivePaths = true;
Filter.PackagePaths.Add("/Game");
Filter.ClassNames.Add("ObjectRedirector");
const UClass* ObjectRedirectorClass = UObjectRedirector::StaticClass();
FTopLevelAssetPath ObjectRedirectorTopLevelAssetPath(FName(ObjectRedirectorClass->GetPackage()->GetPathName()), ObjectRedirectorClass->GetFName());
Filter.ClassPaths.Add(ObjectRedirectorTopLevelAssetPath);

// Query for a list of assets in the selected paths
TArray<FAssetData> AssetList;
Expand All @@ -279,7 +283,7 @@ void SLintWizard::Construct(const FArguments& InArgs)
TArray<FString> ObjectPaths;
for (const auto& Asset : AssetList)
{
ObjectPaths.Add(Asset.ObjectPath.ToString());
ObjectPaths.Add(Asset.GetObjectPathString());
}

ScopedSlowTask.EnterProgressFrame(0.25f, LOCTEXT("Linter.FixUpRedirects.LoadingRedirectors", "Loading redirectors..."));
Expand Down
2 changes: 1 addition & 1 deletion Source/Linter/Private/UI/SAssetLinkWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void SAssetLinkWidget::Construct(const FArguments& Args)
FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked<FContentBrowserModule>("ContentBrowser");
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
TArray<FAssetData> AssetDatas;
AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(AssetData.Get().ObjectPath));
AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(AssetData.Get().ToSoftObjectPath()));
ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas);
})
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "CoreMinimal.h"
#include "LintRule.h"
#include "LintRules/LintRule_Blueprint_Base.h"

#include "LintRule_Blueprint_Compiles.generated.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "CoreMinimal.h"
#include "LintRule.h"
#include "LintRules/LintRule_Blueprint_Base.h"

#include "LintRule_Blueprint_Funcs_MaxNodes.generated.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "CoreMinimal.h"
#include "LintRule.h"
#include "LintRules/LintRule_Blueprint_Base.h"

#include "LintRule_Blueprint_Funcs_MustHaveReturn.generated.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "CoreMinimal.h"
#include "LintRule.h"
#include "LintRules/LintRule_Blueprint_Base.h"

#include "LintRule_Blueprint_Funcs_PublicDescriptions.generated.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "CoreMinimal.h"
#include "LintRule.h"

#include "LintRules/LintRule_Blueprint_Base.h"
#include "LintRule_Blueprint_LooseNodes.generated.h"

UCLASS(BlueprintType, Blueprintable, Abstract)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "CoreMinimal.h"
#include "LintRule.h"

#include "LintRules/LintRule_Blueprint_Base.h"
#include "LintRule_Blueprint_Vars_EditableMustHaveTooltip.generated.h"

UCLASS(BlueprintType, Blueprintable, Abstract)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "CoreMinimal.h"
#include "LintRule.h"

#include "LintRules/LintRule_Blueprint_Base.h"
#include "LintRule_Blueprint_Vars_NoConfigFlag.generated.h"

UCLASS(BlueprintType, Blueprintable, Abstract)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "CoreMinimal.h"
#include "LintRule.h"

#include "LintRules/LintRule_Blueprint_Base.h"
#include "LintRule_Blueprint_Vars_NonAtomic.generated.h"

UCLASS(BlueprintType, Blueprintable, Abstract)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "CoreMinimal.h"
#include "LintRule.h"

#include "LintRules/LintRule_Blueprint_Base.h"
#include "LintRule_Blueprint_Vars_PluralArrays.generated.h"

UCLASS(BlueprintType, Blueprintable, Abstract)
Expand Down
1 change: 0 additions & 1 deletion Source/Linter/Public/LinterCommandlet.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class ULinterCommandlet : public UCommandlet
GENERATED_UCLASS_BODY()
//~ Begin UCommandlet Interface
virtual int32 Main(const FString& Params) override;

//~ End UCommandlet Interface
};

Expand Down
1 change: 1 addition & 0 deletions Source/Linter/Public/UI/LintWizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#pragma once

#include "CoreMinimal.h"
#include "UObject/ObjectRedirector.h"
#include "Widgets/SCompoundWidget.h"
#include "Widgets/Workflow/SWizard.h"
#include "UI/SStepWidget.h"
Expand Down

0 comments on commit 7fdc728

Please sign in to comment.