From 77196658633a21b16a7e40e7e90a8ef1fd790ec4 Mon Sep 17 00:00:00 2001 From: Guy Lundvall Date: Sat, 23 Apr 2022 19:31:39 -0700 Subject: [PATCH 01/28] Fix top level directories As it currently is, if this repo is added to a project as a git repo as a submodule or just downloaded manually, it sticks the Readme, Docs, and License files *outside* of the plugins folder. To fix this, the Content, Resources, and Source folders, as well as the UPlugin file, should be moved out of the folder they are in, and moved up to top. That way the entire contents of this repo will properly populate into a plugin folder when added as a submodule. --- .../GamemakinLinter/GamemakinLinterRuleSet.uasset | Bin .../GamemakinNamingConvention.uasset | Bin .../LintRules/GMLR_BP_Compiles.uasset | Bin .../LintRules/GMLR_BP_Funcs_MaxNodes.uasset | Bin .../LintRules/GMLR_BP_Funcs_MustReturn.uasset | Bin .../GMLR_BP_Funcs_PublicDescriptions.uasset | Bin .../LintRules/GMLR_BP_NoConfigFlag.uasset | Bin .../LintRules/GMLR_BP_Vars_ConfigCategories.uasset | Bin .../LintRules/GMLR_BP_Vars_EditableTooltips.uasset | Bin .../LintRules/GMLR_BP_Vars_NoIs.uasset | Bin .../LintRules/GMLR_BP_Vars_NoPluralArrays.uasset | Bin .../LintRules/GMLR_BP_Vars_NonAtomic.uasset | Bin .../LintRules/GMLR_BP_Vars_PascalCase.uasset | Bin .../LintRules/GMLR_IsNamedCorrectly.uasset | Bin .../LintRules/GMLR_Particles_EmitterNames.uasset | Bin .../LintRules/GMLR_PathChecks.uasset | Bin .../LintRules/GMLR_Path_DoNotNameAssets.uasset | Bin .../GamemakinLinter/LintRules/GMLR_Path_Maps.uasset | Bin .../LintRules/GMLR_Path_NoSpaces.uasset | Bin .../LintRules/GMLR_Path_NoTopLevelAssets.uasset | Bin .../LintRules/GMLR_Path_NoUnicode.uasset | Bin .../LintRules/GMLR_Path_PascalCase.uasset | Bin .../LintRules/GMLR_Path_RedundantNames.uasset | Bin .../LintRules/GMLR_StaticMesh_ValidUVs.uasset | Bin .../LintRules/GMLR_Texture2D_PowerOfTwo.uasset | Bin .../LintRules/GMLR_Texture2D_Size_NotTooBig.uasset | Bin .../Icons/CompileStatus_Fail_64px.png | Bin .../Icons/CompileStatus_Good_64px.png | Bin .../Icons/CompileStatus_Unknown_64px.png | Bin .../Icons/CompileStatus_Warning_64px.png | Bin .../Icons/CompileStatus_Working_64px.png | Bin .../Icons/icon_AddContent_64x.png | Bin .../Icons/icon_Help_Documentation_16x.png | Bin .../Icons/icon_Help_epic_16x.png | Bin .../Content => Content}/Icons/icon_MapCheck_64x.png | Bin .../Icons/icon_MessageLog_Error_14x.png | Bin .../Icons/icon_MessageLog_Info_14x.png | Bin .../Icons/icon_MessageLog_Warning_14x.png | Bin .../Icons/icon_Texture_Run_16x.png | Bin .../Icons/icon_file_saveall_64x.png | Bin .../Icons/icon_tab_Toolbars_64x.png | Bin .../LintRules/MPLR_Blueprint_Compiles.uasset | Bin .../LintRules/MPLR_Blueprint_LooseNodes.uasset | Bin .../LintRules/MPLR_IsNamedCorrectly.uasset | Bin .../LintRules/MPLR_Particles_EmitterNames.uasset | Bin .../LintRules/MPLR_PathRules.uasset | Bin .../LintRules/MPLR_Path_AlphaNumeric.uasset | Bin .../LintRules/MPLR_Path_DisallowedPathNames.uasset | Bin .../LintRules/MPLR_Path_IsNotTooLong.uasset | Bin .../LintRules/MPLR_Path_NoTopLevelAssets.uasset | Bin .../LintRules/MPLR_Path_PascalCase.uasset | Bin .../LintRules/MPLR_SoundWave_SampleRate.uasset | Bin .../LintRules/MPLR_StaticMesh_ValidUVs.uasset | Bin .../LintRules/MPLR_Texture2D_PowerOfTwo.uasset | Bin .../LintRules/MPLR_Texture2D_Size_NotTooBig.uasset | Bin .../MarketplaceLinter/MarketplaceLintRuleSet.uasset | Bin .../MarketplaceNamingConvention.uasset | Bin Plugins/Linter/Linter.uplugin => Linter.uplugin | 0 {Plugins/Linter/Resources => Resources}/Icon128.png | Bin .../Resources => Resources}/LintReportTemplate.html | 0 .../GamemakinLinter/GamemakinLinter.Build.cs | 0 .../GamemakinLinter/Private/GamemakinLinter.cpp | 0 .../Private/GamemakinNamingConvention.cpp | 0 .../GamemakinLinter/Public/GamemakinLinter.h | 0 .../Public/GamemakinNamingConvention.h | 0 .../Linter/Source => Source}/Linter/Linter.Build.cs | 0 .../Linter/Private/AnyObject_LinterDummyClass.cpp | 0 .../Private/BatchRenameTool/BatchRenameTool.cpp | 0 .../Source => Source}/Linter/Private/LintRule.cpp | 0 .../Linter/Private/LintRuleSet.cpp | 0 .../Private/LintRules/LintRule_Blueprint_Base.cpp | 0 .../LintRules/LintRule_Blueprint_Compiles.cpp | 0 .../LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp | 0 .../LintRule_Blueprint_Funcs_MustHaveReturn.cpp | 0 .../LintRule_Blueprint_Funcs_PublicDescriptions.cpp | 0 .../LintRules/LintRule_Blueprint_LooseNodes.cpp | 0 .../LintRule_Blueprint_Vars_ConfigCategories.cpp | 0 ...tRule_Blueprint_Vars_EditableMustHaveTooltip.cpp | 0 .../LintRule_Blueprint_Vars_NoConfigFlag.cpp | 0 .../LintRules/LintRule_Blueprint_Vars_NonAtomic.cpp | 0 .../LintRule_Blueprint_Vars_PluralArrays.cpp | 0 .../LintRules/LintRule_Blueprint_Vars_RegEx.cpp | 0 .../Private/LintRules/LintRule_Collection.cpp | 0 .../LintRules/LintRule_IsNamedCorrectly_Base.cpp | 0 .../LintRule_ParticleSystem_EmitterNameRegex.cpp | 0 .../LintRules/LintRule_Path_DisallowNames.cpp | 0 .../LintRules/LintRule_Path_IsNotTooLong.cpp | 0 .../Private/LintRules/LintRule_Path_NoTopLevel.cpp | 0 .../Private/LintRules/LintRule_Path_Regex.cpp | 0 .../LintRules/LintRule_SoundWave_SampleRate.cpp | 0 .../LintRules/LintRule_StaticMesh_ValidUVs.cpp | 0 .../LintRules/LintRule_Texture_Size_NotTooBig.cpp | 0 .../LintRules/LintRule_Texture_Size_PowerOfTwo.cpp | 0 .../Source => Source}/Linter/Private/LintRunner.cpp | 0 .../Source => Source}/Linter/Private/Linter.cpp | 0 .../Linter/Private/LinterCommandlet.cpp | 0 .../Private/LinterContentBrowserExtensions.cpp | 0 .../Linter/Private/LinterNamingConvention.cpp | 0 .../Linter/Private/LinterSettings.cpp | 0 .../Linter/Private/LinterStyle.cpp | 0 .../Private/TooltipTool/TooltipStringHelper.cpp | 0 .../Linter/Private/TooltipTool/TooltipTool.cpp | 0 .../Linter/Private/UI/LintReport.cpp | 0 .../Linter/Private/UI/LintReportAssetDetails.cpp | 0 .../Linter/Private/UI/LintReportAssetError.cpp | 0 .../Linter/Private/UI/LintReportAssetErrorList.cpp | 0 .../Linter/Private/UI/LintReportRuleDetails.cpp | 0 .../Linter/Private/UI/LintReportRuleError.cpp | 0 .../Linter/Private/UI/LintReportRuleErrorList.cpp | 0 .../Linter/Private/UI/LintWizard.cpp | 0 .../Linter/Private/UI/SAssetLinkWidget.cpp | 0 .../Linter/Private/UI/SStepWidget.cpp | 0 .../Linter/Public/AnyObject_LinterDummyClass.h | 0 .../Linter/Public/BatchRenameTool/BatchRenameTool.h | 0 .../Source => Source}/Linter/Public/LintRule.h | 0 .../Source => Source}/Linter/Public/LintRuleSet.h | 0 .../Public/LintRules/LintRule_Blueprint_Base.h | 0 .../Public/LintRules/LintRule_Blueprint_Compiles.h | 0 .../LintRules/LintRule_Blueprint_Funcs_MaxNodes.h | 0 .../LintRule_Blueprint_Funcs_MustHaveReturn.h | 0 .../LintRule_Blueprint_Funcs_PublicDescriptions.h | 0 .../LintRules/LintRule_Blueprint_LooseNodes.h | 0 .../LintRule_Blueprint_Vars_ConfigCategories.h | 0 ...intRule_Blueprint_Vars_EditableMustHaveTooltip.h | 0 .../LintRule_Blueprint_Vars_NoConfigFlag.h | 0 .../LintRules/LintRule_Blueprint_Vars_NonAtomic.h | 0 .../LintRule_Blueprint_Vars_PluralArrays.h | 0 .../LintRules/LintRule_Blueprint_Vars_Regex.h | 0 .../Linter/Public/LintRules/LintRule_Collection.h | 0 .../LintRules/LintRule_IsNamedCorrectly_Base.h | 0 .../LintRule_ParticleSystem_EmitterNameRegex.h | 0 .../Public/LintRules/LintRule_Path_DisallowNames.h | 0 .../Public/LintRules/LintRule_Path_IsNotTooLong.h | 0 .../Public/LintRules/LintRule_Path_NoTopLevel.h | 0 .../Linter/Public/LintRules/LintRule_Path_Regex.h | 0 .../LintRules/LintRule_SoundWave_SampleRate.h | 0 .../Public/LintRules/LintRule_StaticMesh_ValidUVs.h | 0 .../LintRules/LintRule_Texture_Size_NotTooBig.h | 0 .../LintRules/LintRule_Texture_Size_PowerOfTwo.h | 0 .../Source => Source}/Linter/Public/LintRunner.h | 0 .../Linter/Source => Source}/Linter/Public/Linter.h | 0 .../Source => Source}/Linter/Public/LinterBase.h | 0 .../Linter/Public/LinterCommandlet.h | 0 .../Linter/Public/LinterContentBrowserExtensions.h | 0 .../Linter/Public/LinterNamingConvention.h | 0 .../Linter/Public/LinterSettings.h | 0 .../Source => Source}/Linter/Public/LinterStyle.h | 0 .../Public/TooltipEditor/TooltipStringHelper.h | 0 .../Linter/Public/TooltipEditor/TooltipTool.h | 0 .../Source => Source}/Linter/Public/UI/LintReport.h | 0 .../Linter/Public/UI/LintReportAssetDetails.h | 0 .../Linter/Public/UI/LintReportAssetError.h | 0 .../Linter/Public/UI/LintReportAssetErrorList.h | 0 .../Linter/Public/UI/LintReportRuleDetails.h | 0 .../Linter/Public/UI/LintReportRuleError.h | 0 .../Linter/Public/UI/LintReportRuleErrorList.h | 0 .../Source => Source}/Linter/Public/UI/LintWizard.h | 0 .../Linter/Public/UI/SAssetLinkWidget.h | 0 .../Linter/Public/UI/SStepWidget.h | 0 .../MarketplaceLinter/MarketplaceLinter.Build.cs | 0 .../MarketplaceLinter/Private/MarketplaceLinter.cpp | 0 .../Private/MarketplaceNamingConvention.cpp | 0 .../MarketplaceLinter/Public/MarketplaceLinter.h | 0 .../Public/MarketplaceNamingConvention.h | 0 164 files changed, 0 insertions(+), 0 deletions(-) rename {Plugins/Linter/Content => Content}/GamemakinLinter/GamemakinLinterRuleSet.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/GamemakinNamingConvention.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_BP_Compiles.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_BP_Funcs_MaxNodes.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_BP_Funcs_MustReturn.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_BP_Funcs_PublicDescriptions.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_BP_NoConfigFlag.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_BP_Vars_ConfigCategories.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_BP_Vars_EditableTooltips.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_BP_Vars_NoIs.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_BP_Vars_NoPluralArrays.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_BP_Vars_NonAtomic.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_BP_Vars_PascalCase.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_IsNamedCorrectly.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_Particles_EmitterNames.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_PathChecks.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_Path_DoNotNameAssets.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_Path_Maps.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_Path_NoSpaces.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_Path_NoTopLevelAssets.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_Path_NoUnicode.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_Path_PascalCase.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_Path_RedundantNames.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_StaticMesh_ValidUVs.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_Texture2D_PowerOfTwo.uasset (100%) rename {Plugins/Linter/Content => Content}/GamemakinLinter/LintRules/GMLR_Texture2D_Size_NotTooBig.uasset (100%) rename {Plugins/Linter/Content => Content}/Icons/CompileStatus_Fail_64px.png (100%) rename {Plugins/Linter/Content => Content}/Icons/CompileStatus_Good_64px.png (100%) rename {Plugins/Linter/Content => Content}/Icons/CompileStatus_Unknown_64px.png (100%) rename {Plugins/Linter/Content => Content}/Icons/CompileStatus_Warning_64px.png (100%) rename {Plugins/Linter/Content => Content}/Icons/CompileStatus_Working_64px.png (100%) rename {Plugins/Linter/Content => Content}/Icons/icon_AddContent_64x.png (100%) rename {Plugins/Linter/Content => Content}/Icons/icon_Help_Documentation_16x.png (100%) rename {Plugins/Linter/Content => Content}/Icons/icon_Help_epic_16x.png (100%) rename {Plugins/Linter/Content => Content}/Icons/icon_MapCheck_64x.png (100%) rename {Plugins/Linter/Content => Content}/Icons/icon_MessageLog_Error_14x.png (100%) rename {Plugins/Linter/Content => Content}/Icons/icon_MessageLog_Info_14x.png (100%) rename {Plugins/Linter/Content => Content}/Icons/icon_MessageLog_Warning_14x.png (100%) rename {Plugins/Linter/Content => Content}/Icons/icon_Texture_Run_16x.png (100%) rename {Plugins/Linter/Content => Content}/Icons/icon_file_saveall_64x.png (100%) rename {Plugins/Linter/Content => Content}/Icons/icon_tab_Toolbars_64x.png (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/LintRules/MPLR_Blueprint_Compiles.uasset (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/LintRules/MPLR_Blueprint_LooseNodes.uasset (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/LintRules/MPLR_IsNamedCorrectly.uasset (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/LintRules/MPLR_Particles_EmitterNames.uasset (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/LintRules/MPLR_PathRules.uasset (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/LintRules/MPLR_Path_AlphaNumeric.uasset (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/LintRules/MPLR_Path_DisallowedPathNames.uasset (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/LintRules/MPLR_Path_IsNotTooLong.uasset (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/LintRules/MPLR_Path_NoTopLevelAssets.uasset (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/LintRules/MPLR_Path_PascalCase.uasset (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/LintRules/MPLR_SoundWave_SampleRate.uasset (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/LintRules/MPLR_StaticMesh_ValidUVs.uasset (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/LintRules/MPLR_Texture2D_PowerOfTwo.uasset (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/LintRules/MPLR_Texture2D_Size_NotTooBig.uasset (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/MarketplaceLintRuleSet.uasset (100%) rename {Plugins/Linter/Content => Content}/MarketplaceLinter/MarketplaceNamingConvention.uasset (100%) rename Plugins/Linter/Linter.uplugin => Linter.uplugin (100%) rename {Plugins/Linter/Resources => Resources}/Icon128.png (100%) rename {Plugins/Linter/Resources => Resources}/LintReportTemplate.html (100%) rename {Plugins/Linter/Source => Source}/GamemakinLinter/GamemakinLinter.Build.cs (100%) rename {Plugins/Linter/Source => Source}/GamemakinLinter/Private/GamemakinLinter.cpp (100%) rename {Plugins/Linter/Source => Source}/GamemakinLinter/Private/GamemakinNamingConvention.cpp (100%) rename {Plugins/Linter/Source => Source}/GamemakinLinter/Public/GamemakinLinter.h (100%) rename {Plugins/Linter/Source => Source}/GamemakinLinter/Public/GamemakinNamingConvention.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Linter.Build.cs (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/AnyObject_LinterDummyClass.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/BatchRenameTool/BatchRenameTool.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRule.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRuleSet.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Blueprint_Base.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Blueprint_Compiles.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Blueprint_Vars_ConfigCategories.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Blueprint_Vars_NonAtomic.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Blueprint_Vars_PluralArrays.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Blueprint_Vars_RegEx.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Collection.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_IsNamedCorrectly_Base.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_ParticleSystem_EmitterNameRegex.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Path_DisallowNames.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Path_IsNotTooLong.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Path_NoTopLevel.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Path_Regex.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_StaticMesh_ValidUVs.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LintRunner.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/Linter.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LinterCommandlet.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LinterContentBrowserExtensions.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LinterNamingConvention.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LinterSettings.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/LinterStyle.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/TooltipTool/TooltipStringHelper.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/TooltipTool/TooltipTool.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/UI/LintReport.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/UI/LintReportAssetDetails.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/UI/LintReportAssetError.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/UI/LintReportAssetErrorList.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/UI/LintReportRuleDetails.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/UI/LintReportRuleError.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/UI/LintReportRuleErrorList.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/UI/LintWizard.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/UI/SAssetLinkWidget.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Private/UI/SStepWidget.cpp (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/AnyObject_LinterDummyClass.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/BatchRenameTool/BatchRenameTool.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRule.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRuleSet.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Blueprint_Base.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Collection.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_IsNamedCorrectly_Base.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_ParticleSystem_EmitterNameRegex.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Path_DisallowNames.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Path_IsNotTooLong.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Path_NoTopLevel.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Path_Regex.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_SoundWave_SampleRate.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_StaticMesh_ValidUVs.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Texture_Size_NotTooBig.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRules/LintRule_Texture_Size_PowerOfTwo.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LintRunner.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/Linter.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LinterBase.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LinterCommandlet.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LinterContentBrowserExtensions.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LinterNamingConvention.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LinterSettings.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/LinterStyle.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/TooltipEditor/TooltipStringHelper.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/TooltipEditor/TooltipTool.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/UI/LintReport.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/UI/LintReportAssetDetails.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/UI/LintReportAssetError.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/UI/LintReportAssetErrorList.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/UI/LintReportRuleDetails.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/UI/LintReportRuleError.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/UI/LintReportRuleErrorList.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/UI/LintWizard.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/UI/SAssetLinkWidget.h (100%) rename {Plugins/Linter/Source => Source}/Linter/Public/UI/SStepWidget.h (100%) rename {Plugins/Linter/Source => Source}/MarketplaceLinter/MarketplaceLinter.Build.cs (100%) rename {Plugins/Linter/Source => Source}/MarketplaceLinter/Private/MarketplaceLinter.cpp (100%) rename {Plugins/Linter/Source => Source}/MarketplaceLinter/Private/MarketplaceNamingConvention.cpp (100%) rename {Plugins/Linter/Source => Source}/MarketplaceLinter/Public/MarketplaceLinter.h (100%) rename {Plugins/Linter/Source => Source}/MarketplaceLinter/Public/MarketplaceNamingConvention.h (100%) diff --git a/Plugins/Linter/Content/GamemakinLinter/GamemakinLinterRuleSet.uasset b/Content/GamemakinLinter/GamemakinLinterRuleSet.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/GamemakinLinterRuleSet.uasset rename to Content/GamemakinLinter/GamemakinLinterRuleSet.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/GamemakinNamingConvention.uasset b/Content/GamemakinLinter/GamemakinNamingConvention.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/GamemakinNamingConvention.uasset rename to Content/GamemakinLinter/GamemakinNamingConvention.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Compiles.uasset b/Content/GamemakinLinter/LintRules/GMLR_BP_Compiles.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Compiles.uasset rename to Content/GamemakinLinter/LintRules/GMLR_BP_Compiles.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Funcs_MaxNodes.uasset b/Content/GamemakinLinter/LintRules/GMLR_BP_Funcs_MaxNodes.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Funcs_MaxNodes.uasset rename to Content/GamemakinLinter/LintRules/GMLR_BP_Funcs_MaxNodes.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Funcs_MustReturn.uasset b/Content/GamemakinLinter/LintRules/GMLR_BP_Funcs_MustReturn.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Funcs_MustReturn.uasset rename to Content/GamemakinLinter/LintRules/GMLR_BP_Funcs_MustReturn.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Funcs_PublicDescriptions.uasset b/Content/GamemakinLinter/LintRules/GMLR_BP_Funcs_PublicDescriptions.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Funcs_PublicDescriptions.uasset rename to Content/GamemakinLinter/LintRules/GMLR_BP_Funcs_PublicDescriptions.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_NoConfigFlag.uasset b/Content/GamemakinLinter/LintRules/GMLR_BP_NoConfigFlag.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_NoConfigFlag.uasset rename to Content/GamemakinLinter/LintRules/GMLR_BP_NoConfigFlag.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_ConfigCategories.uasset b/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_ConfigCategories.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_ConfigCategories.uasset rename to Content/GamemakinLinter/LintRules/GMLR_BP_Vars_ConfigCategories.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_EditableTooltips.uasset b/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_EditableTooltips.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_EditableTooltips.uasset rename to Content/GamemakinLinter/LintRules/GMLR_BP_Vars_EditableTooltips.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_NoIs.uasset b/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_NoIs.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_NoIs.uasset rename to Content/GamemakinLinter/LintRules/GMLR_BP_Vars_NoIs.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_NoPluralArrays.uasset b/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_NoPluralArrays.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_NoPluralArrays.uasset rename to Content/GamemakinLinter/LintRules/GMLR_BP_Vars_NoPluralArrays.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_NonAtomic.uasset b/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_NonAtomic.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_NonAtomic.uasset rename to Content/GamemakinLinter/LintRules/GMLR_BP_Vars_NonAtomic.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_PascalCase.uasset b/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_PascalCase.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_BP_Vars_PascalCase.uasset rename to Content/GamemakinLinter/LintRules/GMLR_BP_Vars_PascalCase.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_IsNamedCorrectly.uasset b/Content/GamemakinLinter/LintRules/GMLR_IsNamedCorrectly.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_IsNamedCorrectly.uasset rename to Content/GamemakinLinter/LintRules/GMLR_IsNamedCorrectly.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Particles_EmitterNames.uasset b/Content/GamemakinLinter/LintRules/GMLR_Particles_EmitterNames.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Particles_EmitterNames.uasset rename to Content/GamemakinLinter/LintRules/GMLR_Particles_EmitterNames.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_PathChecks.uasset b/Content/GamemakinLinter/LintRules/GMLR_PathChecks.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_PathChecks.uasset rename to Content/GamemakinLinter/LintRules/GMLR_PathChecks.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Path_DoNotNameAssets.uasset b/Content/GamemakinLinter/LintRules/GMLR_Path_DoNotNameAssets.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Path_DoNotNameAssets.uasset rename to Content/GamemakinLinter/LintRules/GMLR_Path_DoNotNameAssets.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Path_Maps.uasset b/Content/GamemakinLinter/LintRules/GMLR_Path_Maps.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Path_Maps.uasset rename to Content/GamemakinLinter/LintRules/GMLR_Path_Maps.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Path_NoSpaces.uasset b/Content/GamemakinLinter/LintRules/GMLR_Path_NoSpaces.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Path_NoSpaces.uasset rename to Content/GamemakinLinter/LintRules/GMLR_Path_NoSpaces.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Path_NoTopLevelAssets.uasset b/Content/GamemakinLinter/LintRules/GMLR_Path_NoTopLevelAssets.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Path_NoTopLevelAssets.uasset rename to Content/GamemakinLinter/LintRules/GMLR_Path_NoTopLevelAssets.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Path_NoUnicode.uasset b/Content/GamemakinLinter/LintRules/GMLR_Path_NoUnicode.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Path_NoUnicode.uasset rename to Content/GamemakinLinter/LintRules/GMLR_Path_NoUnicode.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Path_PascalCase.uasset b/Content/GamemakinLinter/LintRules/GMLR_Path_PascalCase.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Path_PascalCase.uasset rename to Content/GamemakinLinter/LintRules/GMLR_Path_PascalCase.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Path_RedundantNames.uasset b/Content/GamemakinLinter/LintRules/GMLR_Path_RedundantNames.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Path_RedundantNames.uasset rename to Content/GamemakinLinter/LintRules/GMLR_Path_RedundantNames.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_StaticMesh_ValidUVs.uasset b/Content/GamemakinLinter/LintRules/GMLR_StaticMesh_ValidUVs.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_StaticMesh_ValidUVs.uasset rename to Content/GamemakinLinter/LintRules/GMLR_StaticMesh_ValidUVs.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Texture2D_PowerOfTwo.uasset b/Content/GamemakinLinter/LintRules/GMLR_Texture2D_PowerOfTwo.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Texture2D_PowerOfTwo.uasset rename to Content/GamemakinLinter/LintRules/GMLR_Texture2D_PowerOfTwo.uasset diff --git a/Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Texture2D_Size_NotTooBig.uasset b/Content/GamemakinLinter/LintRules/GMLR_Texture2D_Size_NotTooBig.uasset similarity index 100% rename from Plugins/Linter/Content/GamemakinLinter/LintRules/GMLR_Texture2D_Size_NotTooBig.uasset rename to Content/GamemakinLinter/LintRules/GMLR_Texture2D_Size_NotTooBig.uasset diff --git a/Plugins/Linter/Content/Icons/CompileStatus_Fail_64px.png b/Content/Icons/CompileStatus_Fail_64px.png similarity index 100% rename from Plugins/Linter/Content/Icons/CompileStatus_Fail_64px.png rename to Content/Icons/CompileStatus_Fail_64px.png diff --git a/Plugins/Linter/Content/Icons/CompileStatus_Good_64px.png b/Content/Icons/CompileStatus_Good_64px.png similarity index 100% rename from Plugins/Linter/Content/Icons/CompileStatus_Good_64px.png rename to Content/Icons/CompileStatus_Good_64px.png diff --git a/Plugins/Linter/Content/Icons/CompileStatus_Unknown_64px.png b/Content/Icons/CompileStatus_Unknown_64px.png similarity index 100% rename from Plugins/Linter/Content/Icons/CompileStatus_Unknown_64px.png rename to Content/Icons/CompileStatus_Unknown_64px.png diff --git a/Plugins/Linter/Content/Icons/CompileStatus_Warning_64px.png b/Content/Icons/CompileStatus_Warning_64px.png similarity index 100% rename from Plugins/Linter/Content/Icons/CompileStatus_Warning_64px.png rename to Content/Icons/CompileStatus_Warning_64px.png diff --git a/Plugins/Linter/Content/Icons/CompileStatus_Working_64px.png b/Content/Icons/CompileStatus_Working_64px.png similarity index 100% rename from Plugins/Linter/Content/Icons/CompileStatus_Working_64px.png rename to Content/Icons/CompileStatus_Working_64px.png diff --git a/Plugins/Linter/Content/Icons/icon_AddContent_64x.png b/Content/Icons/icon_AddContent_64x.png similarity index 100% rename from Plugins/Linter/Content/Icons/icon_AddContent_64x.png rename to Content/Icons/icon_AddContent_64x.png diff --git a/Plugins/Linter/Content/Icons/icon_Help_Documentation_16x.png b/Content/Icons/icon_Help_Documentation_16x.png similarity index 100% rename from Plugins/Linter/Content/Icons/icon_Help_Documentation_16x.png rename to Content/Icons/icon_Help_Documentation_16x.png diff --git a/Plugins/Linter/Content/Icons/icon_Help_epic_16x.png b/Content/Icons/icon_Help_epic_16x.png similarity index 100% rename from Plugins/Linter/Content/Icons/icon_Help_epic_16x.png rename to Content/Icons/icon_Help_epic_16x.png diff --git a/Plugins/Linter/Content/Icons/icon_MapCheck_64x.png b/Content/Icons/icon_MapCheck_64x.png similarity index 100% rename from Plugins/Linter/Content/Icons/icon_MapCheck_64x.png rename to Content/Icons/icon_MapCheck_64x.png diff --git a/Plugins/Linter/Content/Icons/icon_MessageLog_Error_14x.png b/Content/Icons/icon_MessageLog_Error_14x.png similarity index 100% rename from Plugins/Linter/Content/Icons/icon_MessageLog_Error_14x.png rename to Content/Icons/icon_MessageLog_Error_14x.png diff --git a/Plugins/Linter/Content/Icons/icon_MessageLog_Info_14x.png b/Content/Icons/icon_MessageLog_Info_14x.png similarity index 100% rename from Plugins/Linter/Content/Icons/icon_MessageLog_Info_14x.png rename to Content/Icons/icon_MessageLog_Info_14x.png diff --git a/Plugins/Linter/Content/Icons/icon_MessageLog_Warning_14x.png b/Content/Icons/icon_MessageLog_Warning_14x.png similarity index 100% rename from Plugins/Linter/Content/Icons/icon_MessageLog_Warning_14x.png rename to Content/Icons/icon_MessageLog_Warning_14x.png diff --git a/Plugins/Linter/Content/Icons/icon_Texture_Run_16x.png b/Content/Icons/icon_Texture_Run_16x.png similarity index 100% rename from Plugins/Linter/Content/Icons/icon_Texture_Run_16x.png rename to Content/Icons/icon_Texture_Run_16x.png diff --git a/Plugins/Linter/Content/Icons/icon_file_saveall_64x.png b/Content/Icons/icon_file_saveall_64x.png similarity index 100% rename from Plugins/Linter/Content/Icons/icon_file_saveall_64x.png rename to Content/Icons/icon_file_saveall_64x.png diff --git a/Plugins/Linter/Content/Icons/icon_tab_Toolbars_64x.png b/Content/Icons/icon_tab_Toolbars_64x.png similarity index 100% rename from Plugins/Linter/Content/Icons/icon_tab_Toolbars_64x.png rename to Content/Icons/icon_tab_Toolbars_64x.png diff --git a/Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Blueprint_Compiles.uasset b/Content/MarketplaceLinter/LintRules/MPLR_Blueprint_Compiles.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Blueprint_Compiles.uasset rename to Content/MarketplaceLinter/LintRules/MPLR_Blueprint_Compiles.uasset diff --git a/Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Blueprint_LooseNodes.uasset b/Content/MarketplaceLinter/LintRules/MPLR_Blueprint_LooseNodes.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Blueprint_LooseNodes.uasset rename to Content/MarketplaceLinter/LintRules/MPLR_Blueprint_LooseNodes.uasset diff --git a/Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_IsNamedCorrectly.uasset b/Content/MarketplaceLinter/LintRules/MPLR_IsNamedCorrectly.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_IsNamedCorrectly.uasset rename to Content/MarketplaceLinter/LintRules/MPLR_IsNamedCorrectly.uasset diff --git a/Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Particles_EmitterNames.uasset b/Content/MarketplaceLinter/LintRules/MPLR_Particles_EmitterNames.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Particles_EmitterNames.uasset rename to Content/MarketplaceLinter/LintRules/MPLR_Particles_EmitterNames.uasset diff --git a/Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_PathRules.uasset b/Content/MarketplaceLinter/LintRules/MPLR_PathRules.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_PathRules.uasset rename to Content/MarketplaceLinter/LintRules/MPLR_PathRules.uasset diff --git a/Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Path_AlphaNumeric.uasset b/Content/MarketplaceLinter/LintRules/MPLR_Path_AlphaNumeric.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Path_AlphaNumeric.uasset rename to Content/MarketplaceLinter/LintRules/MPLR_Path_AlphaNumeric.uasset diff --git a/Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Path_DisallowedPathNames.uasset b/Content/MarketplaceLinter/LintRules/MPLR_Path_DisallowedPathNames.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Path_DisallowedPathNames.uasset rename to Content/MarketplaceLinter/LintRules/MPLR_Path_DisallowedPathNames.uasset diff --git a/Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Path_IsNotTooLong.uasset b/Content/MarketplaceLinter/LintRules/MPLR_Path_IsNotTooLong.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Path_IsNotTooLong.uasset rename to Content/MarketplaceLinter/LintRules/MPLR_Path_IsNotTooLong.uasset diff --git a/Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Path_NoTopLevelAssets.uasset b/Content/MarketplaceLinter/LintRules/MPLR_Path_NoTopLevelAssets.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Path_NoTopLevelAssets.uasset rename to Content/MarketplaceLinter/LintRules/MPLR_Path_NoTopLevelAssets.uasset diff --git a/Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Path_PascalCase.uasset b/Content/MarketplaceLinter/LintRules/MPLR_Path_PascalCase.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Path_PascalCase.uasset rename to Content/MarketplaceLinter/LintRules/MPLR_Path_PascalCase.uasset diff --git a/Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_SoundWave_SampleRate.uasset b/Content/MarketplaceLinter/LintRules/MPLR_SoundWave_SampleRate.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_SoundWave_SampleRate.uasset rename to Content/MarketplaceLinter/LintRules/MPLR_SoundWave_SampleRate.uasset diff --git a/Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_StaticMesh_ValidUVs.uasset b/Content/MarketplaceLinter/LintRules/MPLR_StaticMesh_ValidUVs.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_StaticMesh_ValidUVs.uasset rename to Content/MarketplaceLinter/LintRules/MPLR_StaticMesh_ValidUVs.uasset diff --git a/Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Texture2D_PowerOfTwo.uasset b/Content/MarketplaceLinter/LintRules/MPLR_Texture2D_PowerOfTwo.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Texture2D_PowerOfTwo.uasset rename to Content/MarketplaceLinter/LintRules/MPLR_Texture2D_PowerOfTwo.uasset diff --git a/Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Texture2D_Size_NotTooBig.uasset b/Content/MarketplaceLinter/LintRules/MPLR_Texture2D_Size_NotTooBig.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/LintRules/MPLR_Texture2D_Size_NotTooBig.uasset rename to Content/MarketplaceLinter/LintRules/MPLR_Texture2D_Size_NotTooBig.uasset diff --git a/Plugins/Linter/Content/MarketplaceLinter/MarketplaceLintRuleSet.uasset b/Content/MarketplaceLinter/MarketplaceLintRuleSet.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/MarketplaceLintRuleSet.uasset rename to Content/MarketplaceLinter/MarketplaceLintRuleSet.uasset diff --git a/Plugins/Linter/Content/MarketplaceLinter/MarketplaceNamingConvention.uasset b/Content/MarketplaceLinter/MarketplaceNamingConvention.uasset similarity index 100% rename from Plugins/Linter/Content/MarketplaceLinter/MarketplaceNamingConvention.uasset rename to Content/MarketplaceLinter/MarketplaceNamingConvention.uasset diff --git a/Plugins/Linter/Linter.uplugin b/Linter.uplugin similarity index 100% rename from Plugins/Linter/Linter.uplugin rename to Linter.uplugin diff --git a/Plugins/Linter/Resources/Icon128.png b/Resources/Icon128.png similarity index 100% rename from Plugins/Linter/Resources/Icon128.png rename to Resources/Icon128.png diff --git a/Plugins/Linter/Resources/LintReportTemplate.html b/Resources/LintReportTemplate.html similarity index 100% rename from Plugins/Linter/Resources/LintReportTemplate.html rename to Resources/LintReportTemplate.html diff --git a/Plugins/Linter/Source/GamemakinLinter/GamemakinLinter.Build.cs b/Source/GamemakinLinter/GamemakinLinter.Build.cs similarity index 100% rename from Plugins/Linter/Source/GamemakinLinter/GamemakinLinter.Build.cs rename to Source/GamemakinLinter/GamemakinLinter.Build.cs diff --git a/Plugins/Linter/Source/GamemakinLinter/Private/GamemakinLinter.cpp b/Source/GamemakinLinter/Private/GamemakinLinter.cpp similarity index 100% rename from Plugins/Linter/Source/GamemakinLinter/Private/GamemakinLinter.cpp rename to Source/GamemakinLinter/Private/GamemakinLinter.cpp diff --git a/Plugins/Linter/Source/GamemakinLinter/Private/GamemakinNamingConvention.cpp b/Source/GamemakinLinter/Private/GamemakinNamingConvention.cpp similarity index 100% rename from Plugins/Linter/Source/GamemakinLinter/Private/GamemakinNamingConvention.cpp rename to Source/GamemakinLinter/Private/GamemakinNamingConvention.cpp diff --git a/Plugins/Linter/Source/GamemakinLinter/Public/GamemakinLinter.h b/Source/GamemakinLinter/Public/GamemakinLinter.h similarity index 100% rename from Plugins/Linter/Source/GamemakinLinter/Public/GamemakinLinter.h rename to Source/GamemakinLinter/Public/GamemakinLinter.h diff --git a/Plugins/Linter/Source/GamemakinLinter/Public/GamemakinNamingConvention.h b/Source/GamemakinLinter/Public/GamemakinNamingConvention.h similarity index 100% rename from Plugins/Linter/Source/GamemakinLinter/Public/GamemakinNamingConvention.h rename to Source/GamemakinLinter/Public/GamemakinNamingConvention.h diff --git a/Plugins/Linter/Source/Linter/Linter.Build.cs b/Source/Linter/Linter.Build.cs similarity index 100% rename from Plugins/Linter/Source/Linter/Linter.Build.cs rename to Source/Linter/Linter.Build.cs diff --git a/Plugins/Linter/Source/Linter/Private/AnyObject_LinterDummyClass.cpp b/Source/Linter/Private/AnyObject_LinterDummyClass.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/AnyObject_LinterDummyClass.cpp rename to Source/Linter/Private/AnyObject_LinterDummyClass.cpp diff --git a/Plugins/Linter/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp b/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp rename to Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRule.cpp b/Source/Linter/Private/LintRule.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRule.cpp rename to Source/Linter/Private/LintRule.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRuleSet.cpp b/Source/Linter/Private/LintRuleSet.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRuleSet.cpp rename to Source/Linter/Private/LintRuleSet.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Base.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Base.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Base.cpp rename to Source/Linter/Private/LintRules/LintRule_Blueprint_Base.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Compiles.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Compiles.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Compiles.cpp rename to Source/Linter/Private/LintRules/LintRule_Blueprint_Compiles.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp rename to Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp rename to Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.cpp rename to Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp rename to Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_ConfigCategories.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_ConfigCategories.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_ConfigCategories.cpp rename to Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_ConfigCategories.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.cpp rename to Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.cpp rename to Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NonAtomic.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NonAtomic.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NonAtomic.cpp rename to Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NonAtomic.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_PluralArrays.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_PluralArrays.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_PluralArrays.cpp rename to Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_PluralArrays.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_RegEx.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_RegEx.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_RegEx.cpp rename to Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_RegEx.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Collection.cpp b/Source/Linter/Private/LintRules/LintRule_Collection.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Collection.cpp rename to Source/Linter/Private/LintRules/LintRule_Collection.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_IsNamedCorrectly_Base.cpp b/Source/Linter/Private/LintRules/LintRule_IsNamedCorrectly_Base.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_IsNamedCorrectly_Base.cpp rename to Source/Linter/Private/LintRules/LintRule_IsNamedCorrectly_Base.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_ParticleSystem_EmitterNameRegex.cpp b/Source/Linter/Private/LintRules/LintRule_ParticleSystem_EmitterNameRegex.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_ParticleSystem_EmitterNameRegex.cpp rename to Source/Linter/Private/LintRules/LintRule_ParticleSystem_EmitterNameRegex.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Path_DisallowNames.cpp b/Source/Linter/Private/LintRules/LintRule_Path_DisallowNames.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Path_DisallowNames.cpp rename to Source/Linter/Private/LintRules/LintRule_Path_DisallowNames.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Path_IsNotTooLong.cpp b/Source/Linter/Private/LintRules/LintRule_Path_IsNotTooLong.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Path_IsNotTooLong.cpp rename to Source/Linter/Private/LintRules/LintRule_Path_IsNotTooLong.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Path_NoTopLevel.cpp b/Source/Linter/Private/LintRules/LintRule_Path_NoTopLevel.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Path_NoTopLevel.cpp rename to Source/Linter/Private/LintRules/LintRule_Path_NoTopLevel.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Path_Regex.cpp b/Source/Linter/Private/LintRules/LintRule_Path_Regex.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Path_Regex.cpp rename to Source/Linter/Private/LintRules/LintRule_Path_Regex.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp b/Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp rename to Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_StaticMesh_ValidUVs.cpp b/Source/Linter/Private/LintRules/LintRule_StaticMesh_ValidUVs.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_StaticMesh_ValidUVs.cpp rename to Source/Linter/Private/LintRules/LintRule_StaticMesh_ValidUVs.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp b/Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp rename to Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp b/Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp rename to Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LintRunner.cpp b/Source/Linter/Private/LintRunner.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LintRunner.cpp rename to Source/Linter/Private/LintRunner.cpp diff --git a/Plugins/Linter/Source/Linter/Private/Linter.cpp b/Source/Linter/Private/Linter.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/Linter.cpp rename to Source/Linter/Private/Linter.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LinterCommandlet.cpp b/Source/Linter/Private/LinterCommandlet.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LinterCommandlet.cpp rename to Source/Linter/Private/LinterCommandlet.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LinterContentBrowserExtensions.cpp b/Source/Linter/Private/LinterContentBrowserExtensions.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LinterContentBrowserExtensions.cpp rename to Source/Linter/Private/LinterContentBrowserExtensions.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LinterNamingConvention.cpp b/Source/Linter/Private/LinterNamingConvention.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LinterNamingConvention.cpp rename to Source/Linter/Private/LinterNamingConvention.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LinterSettings.cpp b/Source/Linter/Private/LinterSettings.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LinterSettings.cpp rename to Source/Linter/Private/LinterSettings.cpp diff --git a/Plugins/Linter/Source/Linter/Private/LinterStyle.cpp b/Source/Linter/Private/LinterStyle.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/LinterStyle.cpp rename to Source/Linter/Private/LinterStyle.cpp diff --git a/Plugins/Linter/Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp b/Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp rename to Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp diff --git a/Plugins/Linter/Source/Linter/Private/TooltipTool/TooltipTool.cpp b/Source/Linter/Private/TooltipTool/TooltipTool.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/TooltipTool/TooltipTool.cpp rename to Source/Linter/Private/TooltipTool/TooltipTool.cpp diff --git a/Plugins/Linter/Source/Linter/Private/UI/LintReport.cpp b/Source/Linter/Private/UI/LintReport.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/UI/LintReport.cpp rename to Source/Linter/Private/UI/LintReport.cpp diff --git a/Plugins/Linter/Source/Linter/Private/UI/LintReportAssetDetails.cpp b/Source/Linter/Private/UI/LintReportAssetDetails.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/UI/LintReportAssetDetails.cpp rename to Source/Linter/Private/UI/LintReportAssetDetails.cpp diff --git a/Plugins/Linter/Source/Linter/Private/UI/LintReportAssetError.cpp b/Source/Linter/Private/UI/LintReportAssetError.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/UI/LintReportAssetError.cpp rename to Source/Linter/Private/UI/LintReportAssetError.cpp diff --git a/Plugins/Linter/Source/Linter/Private/UI/LintReportAssetErrorList.cpp b/Source/Linter/Private/UI/LintReportAssetErrorList.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/UI/LintReportAssetErrorList.cpp rename to Source/Linter/Private/UI/LintReportAssetErrorList.cpp diff --git a/Plugins/Linter/Source/Linter/Private/UI/LintReportRuleDetails.cpp b/Source/Linter/Private/UI/LintReportRuleDetails.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/UI/LintReportRuleDetails.cpp rename to Source/Linter/Private/UI/LintReportRuleDetails.cpp diff --git a/Plugins/Linter/Source/Linter/Private/UI/LintReportRuleError.cpp b/Source/Linter/Private/UI/LintReportRuleError.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/UI/LintReportRuleError.cpp rename to Source/Linter/Private/UI/LintReportRuleError.cpp diff --git a/Plugins/Linter/Source/Linter/Private/UI/LintReportRuleErrorList.cpp b/Source/Linter/Private/UI/LintReportRuleErrorList.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/UI/LintReportRuleErrorList.cpp rename to Source/Linter/Private/UI/LintReportRuleErrorList.cpp diff --git a/Plugins/Linter/Source/Linter/Private/UI/LintWizard.cpp b/Source/Linter/Private/UI/LintWizard.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/UI/LintWizard.cpp rename to Source/Linter/Private/UI/LintWizard.cpp diff --git a/Plugins/Linter/Source/Linter/Private/UI/SAssetLinkWidget.cpp b/Source/Linter/Private/UI/SAssetLinkWidget.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/UI/SAssetLinkWidget.cpp rename to Source/Linter/Private/UI/SAssetLinkWidget.cpp diff --git a/Plugins/Linter/Source/Linter/Private/UI/SStepWidget.cpp b/Source/Linter/Private/UI/SStepWidget.cpp similarity index 100% rename from Plugins/Linter/Source/Linter/Private/UI/SStepWidget.cpp rename to Source/Linter/Private/UI/SStepWidget.cpp diff --git a/Plugins/Linter/Source/Linter/Public/AnyObject_LinterDummyClass.h b/Source/Linter/Public/AnyObject_LinterDummyClass.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/AnyObject_LinterDummyClass.h rename to Source/Linter/Public/AnyObject_LinterDummyClass.h diff --git a/Plugins/Linter/Source/Linter/Public/BatchRenameTool/BatchRenameTool.h b/Source/Linter/Public/BatchRenameTool/BatchRenameTool.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/BatchRenameTool/BatchRenameTool.h rename to Source/Linter/Public/BatchRenameTool/BatchRenameTool.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRule.h b/Source/Linter/Public/LintRule.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRule.h rename to Source/Linter/Public/LintRule.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRuleSet.h b/Source/Linter/Public/LintRuleSet.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRuleSet.h rename to Source/Linter/Public/LintRuleSet.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h rename to Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h rename to Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h rename to Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h rename to Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h rename to Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h rename to Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h rename to Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h rename to Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h rename to Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h rename to Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h rename to Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h rename to Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Collection.h b/Source/Linter/Public/LintRules/LintRule_Collection.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Collection.h rename to Source/Linter/Public/LintRules/LintRule_Collection.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_IsNamedCorrectly_Base.h b/Source/Linter/Public/LintRules/LintRule_IsNamedCorrectly_Base.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_IsNamedCorrectly_Base.h rename to Source/Linter/Public/LintRules/LintRule_IsNamedCorrectly_Base.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_ParticleSystem_EmitterNameRegex.h b/Source/Linter/Public/LintRules/LintRule_ParticleSystem_EmitterNameRegex.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_ParticleSystem_EmitterNameRegex.h rename to Source/Linter/Public/LintRules/LintRule_ParticleSystem_EmitterNameRegex.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Path_DisallowNames.h b/Source/Linter/Public/LintRules/LintRule_Path_DisallowNames.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Path_DisallowNames.h rename to Source/Linter/Public/LintRules/LintRule_Path_DisallowNames.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Path_IsNotTooLong.h b/Source/Linter/Public/LintRules/LintRule_Path_IsNotTooLong.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Path_IsNotTooLong.h rename to Source/Linter/Public/LintRules/LintRule_Path_IsNotTooLong.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Path_NoTopLevel.h b/Source/Linter/Public/LintRules/LintRule_Path_NoTopLevel.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Path_NoTopLevel.h rename to Source/Linter/Public/LintRules/LintRule_Path_NoTopLevel.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Path_Regex.h b/Source/Linter/Public/LintRules/LintRule_Path_Regex.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Path_Regex.h rename to Source/Linter/Public/LintRules/LintRule_Path_Regex.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_SoundWave_SampleRate.h b/Source/Linter/Public/LintRules/LintRule_SoundWave_SampleRate.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_SoundWave_SampleRate.h rename to Source/Linter/Public/LintRules/LintRule_SoundWave_SampleRate.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_StaticMesh_ValidUVs.h b/Source/Linter/Public/LintRules/LintRule_StaticMesh_ValidUVs.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_StaticMesh_ValidUVs.h rename to Source/Linter/Public/LintRules/LintRule_StaticMesh_ValidUVs.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Texture_Size_NotTooBig.h b/Source/Linter/Public/LintRules/LintRule_Texture_Size_NotTooBig.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Texture_Size_NotTooBig.h rename to Source/Linter/Public/LintRules/LintRule_Texture_Size_NotTooBig.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Texture_Size_PowerOfTwo.h b/Source/Linter/Public/LintRules/LintRule_Texture_Size_PowerOfTwo.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRules/LintRule_Texture_Size_PowerOfTwo.h rename to Source/Linter/Public/LintRules/LintRule_Texture_Size_PowerOfTwo.h diff --git a/Plugins/Linter/Source/Linter/Public/LintRunner.h b/Source/Linter/Public/LintRunner.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LintRunner.h rename to Source/Linter/Public/LintRunner.h diff --git a/Plugins/Linter/Source/Linter/Public/Linter.h b/Source/Linter/Public/Linter.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/Linter.h rename to Source/Linter/Public/Linter.h diff --git a/Plugins/Linter/Source/Linter/Public/LinterBase.h b/Source/Linter/Public/LinterBase.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LinterBase.h rename to Source/Linter/Public/LinterBase.h diff --git a/Plugins/Linter/Source/Linter/Public/LinterCommandlet.h b/Source/Linter/Public/LinterCommandlet.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LinterCommandlet.h rename to Source/Linter/Public/LinterCommandlet.h diff --git a/Plugins/Linter/Source/Linter/Public/LinterContentBrowserExtensions.h b/Source/Linter/Public/LinterContentBrowserExtensions.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LinterContentBrowserExtensions.h rename to Source/Linter/Public/LinterContentBrowserExtensions.h diff --git a/Plugins/Linter/Source/Linter/Public/LinterNamingConvention.h b/Source/Linter/Public/LinterNamingConvention.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LinterNamingConvention.h rename to Source/Linter/Public/LinterNamingConvention.h diff --git a/Plugins/Linter/Source/Linter/Public/LinterSettings.h b/Source/Linter/Public/LinterSettings.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LinterSettings.h rename to Source/Linter/Public/LinterSettings.h diff --git a/Plugins/Linter/Source/Linter/Public/LinterStyle.h b/Source/Linter/Public/LinterStyle.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/LinterStyle.h rename to Source/Linter/Public/LinterStyle.h diff --git a/Plugins/Linter/Source/Linter/Public/TooltipEditor/TooltipStringHelper.h b/Source/Linter/Public/TooltipEditor/TooltipStringHelper.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/TooltipEditor/TooltipStringHelper.h rename to Source/Linter/Public/TooltipEditor/TooltipStringHelper.h diff --git a/Plugins/Linter/Source/Linter/Public/TooltipEditor/TooltipTool.h b/Source/Linter/Public/TooltipEditor/TooltipTool.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/TooltipEditor/TooltipTool.h rename to Source/Linter/Public/TooltipEditor/TooltipTool.h diff --git a/Plugins/Linter/Source/Linter/Public/UI/LintReport.h b/Source/Linter/Public/UI/LintReport.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/UI/LintReport.h rename to Source/Linter/Public/UI/LintReport.h diff --git a/Plugins/Linter/Source/Linter/Public/UI/LintReportAssetDetails.h b/Source/Linter/Public/UI/LintReportAssetDetails.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/UI/LintReportAssetDetails.h rename to Source/Linter/Public/UI/LintReportAssetDetails.h diff --git a/Plugins/Linter/Source/Linter/Public/UI/LintReportAssetError.h b/Source/Linter/Public/UI/LintReportAssetError.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/UI/LintReportAssetError.h rename to Source/Linter/Public/UI/LintReportAssetError.h diff --git a/Plugins/Linter/Source/Linter/Public/UI/LintReportAssetErrorList.h b/Source/Linter/Public/UI/LintReportAssetErrorList.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/UI/LintReportAssetErrorList.h rename to Source/Linter/Public/UI/LintReportAssetErrorList.h diff --git a/Plugins/Linter/Source/Linter/Public/UI/LintReportRuleDetails.h b/Source/Linter/Public/UI/LintReportRuleDetails.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/UI/LintReportRuleDetails.h rename to Source/Linter/Public/UI/LintReportRuleDetails.h diff --git a/Plugins/Linter/Source/Linter/Public/UI/LintReportRuleError.h b/Source/Linter/Public/UI/LintReportRuleError.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/UI/LintReportRuleError.h rename to Source/Linter/Public/UI/LintReportRuleError.h diff --git a/Plugins/Linter/Source/Linter/Public/UI/LintReportRuleErrorList.h b/Source/Linter/Public/UI/LintReportRuleErrorList.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/UI/LintReportRuleErrorList.h rename to Source/Linter/Public/UI/LintReportRuleErrorList.h diff --git a/Plugins/Linter/Source/Linter/Public/UI/LintWizard.h b/Source/Linter/Public/UI/LintWizard.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/UI/LintWizard.h rename to Source/Linter/Public/UI/LintWizard.h diff --git a/Plugins/Linter/Source/Linter/Public/UI/SAssetLinkWidget.h b/Source/Linter/Public/UI/SAssetLinkWidget.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/UI/SAssetLinkWidget.h rename to Source/Linter/Public/UI/SAssetLinkWidget.h diff --git a/Plugins/Linter/Source/Linter/Public/UI/SStepWidget.h b/Source/Linter/Public/UI/SStepWidget.h similarity index 100% rename from Plugins/Linter/Source/Linter/Public/UI/SStepWidget.h rename to Source/Linter/Public/UI/SStepWidget.h diff --git a/Plugins/Linter/Source/MarketplaceLinter/MarketplaceLinter.Build.cs b/Source/MarketplaceLinter/MarketplaceLinter.Build.cs similarity index 100% rename from Plugins/Linter/Source/MarketplaceLinter/MarketplaceLinter.Build.cs rename to Source/MarketplaceLinter/MarketplaceLinter.Build.cs diff --git a/Plugins/Linter/Source/MarketplaceLinter/Private/MarketplaceLinter.cpp b/Source/MarketplaceLinter/Private/MarketplaceLinter.cpp similarity index 100% rename from Plugins/Linter/Source/MarketplaceLinter/Private/MarketplaceLinter.cpp rename to Source/MarketplaceLinter/Private/MarketplaceLinter.cpp diff --git a/Plugins/Linter/Source/MarketplaceLinter/Private/MarketplaceNamingConvention.cpp b/Source/MarketplaceLinter/Private/MarketplaceNamingConvention.cpp similarity index 100% rename from Plugins/Linter/Source/MarketplaceLinter/Private/MarketplaceNamingConvention.cpp rename to Source/MarketplaceLinter/Private/MarketplaceNamingConvention.cpp diff --git a/Plugins/Linter/Source/MarketplaceLinter/Public/MarketplaceLinter.h b/Source/MarketplaceLinter/Public/MarketplaceLinter.h similarity index 100% rename from Plugins/Linter/Source/MarketplaceLinter/Public/MarketplaceLinter.h rename to Source/MarketplaceLinter/Public/MarketplaceLinter.h diff --git a/Plugins/Linter/Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h b/Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h similarity index 100% rename from Plugins/Linter/Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h rename to Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h From 6acfea44dcc2f99a2ff4c2f238a9d2c915b0976b Mon Sep 17 00:00:00 2001 From: Guy Lundvall Date: Tue, 26 Apr 2022 20:26:30 -0700 Subject: [PATCH 02/28] Fix includes for unity build, and merge prs from origin --- .gitignore | 83 +++++++++++++++++++ Linter.uplugin | 7 +- .../GamemakinLinter/GamemakinLinter.Build.cs | 11 +-- .../GamemakinLinter/Public/GamemakinLinter.h | 2 - Source/Linter/Linter.Build.cs | 13 +-- .../BatchRenameTool/BatchRenameTool.cpp | 13 +-- Source/Linter/Private/LintRule.cpp | 18 ++-- Source/Linter/Private/LintRuleSet.cpp | 35 ++++---- .../LintRules/LintRule_Blueprint_Compiles.cpp | 14 ++-- .../LintRule_Blueprint_Funcs_MaxNodes.cpp | 6 +- ...intRule_Blueprint_Funcs_MustHaveReturn.cpp | 4 +- ...ule_Blueprint_Funcs_PublicDescriptions.cpp | 6 +- .../LintRule_Blueprint_LooseNodes.cpp | 6 +- ...ntRule_Blueprint_Vars_ConfigCategories.cpp | 10 ++- ...Blueprint_Vars_EditableMustHaveTooltip.cpp | 2 +- .../LintRule_Blueprint_Vars_NoConfigFlag.cpp | 2 +- .../LintRule_Blueprint_Vars_NonAtomic.cpp | 2 +- .../LintRule_Blueprint_Vars_PluralArrays.cpp | 2 +- .../LintRule_Blueprint_Vars_RegEx.cpp | 10 +-- .../Private/LintRules/LintRule_Collection.cpp | 1 - .../LintRule_IsNamedCorrectly_Base.cpp | 12 +-- ...ntRule_ParticleSystem_EmitterNameRegex.cpp | 8 +- .../LintRules/LintRule_Path_DisallowNames.cpp | 3 +- .../LintRules/LintRule_Path_IsNotTooLong.cpp | 5 +- .../LintRules/LintRule_Path_NoTopLevel.cpp | 2 +- .../Private/LintRules/LintRule_Path_Regex.cpp | 11 ++- .../LintRule_SoundWave_SampleRate.cpp | 2 +- .../LintRule_StaticMesh_ValidUVs.cpp | 5 +- .../LintRule_Texture_Size_NotTooBig.cpp | 7 +- .../LintRule_Texture_Size_PowerOfTwo.cpp | 9 +- Source/Linter/Private/LintRunner.cpp | 9 +- Source/Linter/Private/Linter.cpp | 15 ++-- Source/Linter/Private/LinterCommandlet.cpp | 12 +-- .../LinterContentBrowserExtensions.cpp | 17 ++-- .../Linter/Private/LinterNamingConvention.cpp | 68 ++++++++++----- .../TooltipTool/TooltipStringHelper.cpp | 18 ++-- .../Private/TooltipTool/TooltipTool.cpp | 54 ++++++------ Source/Linter/Private/UI/LintReport.cpp | 34 ++++---- .../Private/UI/LintReportAssetDetails.cpp | 18 ++-- .../Private/UI/LintReportAssetError.cpp | 16 ++-- .../Private/UI/LintReportAssetErrorList.cpp | 20 +---- .../Private/UI/LintReportRuleDetails.cpp | 17 ++-- .../Linter/Private/UI/LintReportRuleError.cpp | 18 ++-- .../Private/UI/LintReportRuleErrorList.cpp | 20 +---- Source/Linter/Private/UI/LintWizard.cpp | 52 ++++++------ Source/Linter/Private/UI/SAssetLinkWidget.cpp | 21 +++-- Source/Linter/Private/UI/SStepWidget.cpp | 39 ++++----- .../Public/BatchRenameTool/BatchRenameTool.h | 2 - Source/Linter/Public/LintRule.h | 10 ++- Source/Linter/Public/LintRuleSet.h | 7 +- .../LintRules/LintRule_Blueprint_Base.h | 4 +- .../LintRules/LintRule_Blueprint_Compiles.h | 5 +- .../LintRule_Blueprint_Funcs_MaxNodes.h | 5 +- .../LintRule_Blueprint_Funcs_MustHaveReturn.h | 5 +- ...tRule_Blueprint_Funcs_PublicDescriptions.h | 4 +- .../LintRules/LintRule_Blueprint_LooseNodes.h | 3 +- ...LintRule_Blueprint_Vars_ConfigCategories.h | 5 +- ...e_Blueprint_Vars_EditableMustHaveTooltip.h | 3 +- .../LintRule_Blueprint_Vars_NoConfigFlag.h | 3 +- .../LintRule_Blueprint_Vars_NonAtomic.h | 4 +- .../LintRule_Blueprint_Vars_PluralArrays.h | 5 +- .../LintRules/LintRule_Blueprint_Vars_Regex.h | 5 +- Source/Linter/Public/LintRunner.h | 11 +-- Source/Linter/Public/Linter.h | 2 - Source/Linter/Public/LinterBase.h | 1 - .../Public/LinterContentBrowserExtensions.h | 1 + Source/Linter/Public/LinterNamingConvention.h | 11 +-- Source/Linter/Public/LinterSettings.h | 13 +-- .../TooltipEditor/TooltipStringHelper.h | 2 - .../Linter/Public/TooltipEditor/TooltipTool.h | 4 - Source/Linter/Public/UI/LintReport.h | 1 - .../Public/UI/LintReportAssetErrorList.h | 6 +- .../Public/UI/LintReportRuleErrorList.h | 6 +- Source/Linter/Public/UI/LintWizard.h | 4 +- Source/Linter/Public/UI/SAssetLinkWidget.h | 3 - Source/Linter/Public/UI/SStepWidget.h | 9 +- .../MarketplaceLinter.Build.cs | 13 +-- .../Private/MarketplaceLinter.cpp | 5 -- .../Public/MarketplaceLinter.h | 2 - .../Public/MarketplaceNamingConvention.h | 2 - 80 files changed, 495 insertions(+), 430 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ebde5c9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,83 @@ +# Visual Studio 2015 user specific files +.vs/ + +# Rider C++ +.idea/ +Plugins/Developer/RiderLink/ + +# Visual Studio 2015 database file +*.VC.db + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app +*.ipa + +# These project files can be generated by the engine +*.xcodeproj +*.xcworkspace +*.sln +*.suo +*.opensdf +*.sdf +*.VC.db +*.VC.opendb + +# Precompiled Assets +SourceArt/**/*.png +SourceArt/**/*.tga + +# Binary Files +Binaries/* +Plugins/*/Binaries/* + +# Builds +Build/* + +# Whitelist PakBlacklist-.txt files +!Build/*/ +Build/*/** +!Build/*/PakBlacklist*.txt + +# Don't ignore icon files in Build +!Build/**/*.ico + +# Built data for maps +*_BuiltData.uasset + +# Configuration files generated by the Editor +Saved/* + +# Compiled source files for the engine to use +Intermediate/* +Plugins/*/Intermediate/* + +# Cache files for the editor to use +DerivedDataCache/* +*.DotSettings* +*DotSettings* diff --git a/Linter.uplugin b/Linter.uplugin index b8697f9..7fb6a19 100644 --- a/Linter.uplugin +++ b/Linter.uplugin @@ -10,9 +10,9 @@ "DocsURL": "http://discord.gamemak.in", "MarketplaceURL": "com.epicgames.launcher://ue/marketplace/content/ca0639af6339476da86fa3bcf15de8ec", "SupportURL": "http://discord.gamemak.in", - "EngineVersion": "4.26.0", "CanContainContent": true, - "Installed": true, + "Installed": false, + "EnabledByDefault": true, "Modules": [ { "Name": "Linter", @@ -20,7 +20,6 @@ "LoadingPhase": "PreDefault", "WhitelistPlatforms": [ "Win64", - "Win32", "Mac", "Linux" ], @@ -35,7 +34,6 @@ "LoadingPhase": "PreDefault", "WhitelistPlatforms": [ "Win64", - "Win32", "Mac", "Linux" ], @@ -50,7 +48,6 @@ "LoadingPhase": "PreDefault", "WhitelistPlatforms": [ "Win64", - "Win32", "Mac", "Linux" ], diff --git a/Source/GamemakinLinter/GamemakinLinter.Build.cs b/Source/GamemakinLinter/GamemakinLinter.Build.cs index 4fdbab7..d183647 100644 --- a/Source/GamemakinLinter/GamemakinLinter.Build.cs +++ b/Source/GamemakinLinter/GamemakinLinter.Build.cs @@ -6,8 +6,9 @@ public class GamemakinLinter : ModuleRules { public GamemakinLinter(ReadOnlyTargetRules Target) : base(Target) { - PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - + PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; + bUseUnity = false; + PublicDependencyModuleNames.AddRange( new string[] { @@ -17,8 +18,8 @@ public GamemakinLinter(ReadOnlyTargetRules Target) : base(Target) "Linter" } ); - - + + PrivateDependencyModuleNames.AddRange( new string[] { @@ -26,4 +27,4 @@ public GamemakinLinter(ReadOnlyTargetRules Target) : base(Target) } ); } -} +} \ No newline at end of file diff --git a/Source/GamemakinLinter/Public/GamemakinLinter.h b/Source/GamemakinLinter/Public/GamemakinLinter.h index ef402ae..cbcb27a 100644 --- a/Source/GamemakinLinter/Public/GamemakinLinter.h +++ b/Source/GamemakinLinter/Public/GamemakinLinter.h @@ -1,8 +1,6 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "Modules/ModuleManager.h" - DECLARE_LOG_CATEGORY_EXTERN(LogGamemakinLinter, Verbose, All); class GAMEMAKINLINTER_API FGamemakinLinterModule : public IModuleInterface diff --git a/Source/Linter/Linter.Build.cs b/Source/Linter/Linter.Build.cs index 95412a7..8b99ca5 100644 --- a/Source/Linter/Linter.Build.cs +++ b/Source/Linter/Linter.Build.cs @@ -6,16 +6,17 @@ public class Linter : ModuleRules { public Linter(ReadOnlyTargetRules Target) : base(Target) { - PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - + PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; + bUseUnity = false; + PublicDependencyModuleNames.AddRange( new string[] { "Core", } ); - - + + PrivateDependencyModuleNames.AddRange( new string[] { @@ -36,7 +37,7 @@ public Linter(ReadOnlyTargetRules Target) : base(Target) "DesktopPlatform", "Json", "UATHelper" - // ... add private dependencies that you statically link with here ... + // ... add private dependencies that you statically link with here ... } ); @@ -47,4 +48,4 @@ public Linter(ReadOnlyTargetRules Target) : base(Target) #endif } -} +} \ No newline at end of file diff --git a/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp b/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp index cc43644..d6e3904 100644 --- a/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp +++ b/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp @@ -15,6 +15,7 @@ #include "Framework/Notifications/NotificationManager.h" #include "Logging/MessageLog.h" #include "Logging/TokenizedMessage.h" +#include "Widgets/Layout/SSeparator.h" #define LOCTEXT_NAMESPACE "LinterBatchRenamer" @@ -32,7 +33,7 @@ FDlgBatchRenameTool::FDlgBatchRenameTool(const TArray Assets) .AutoCenter(EAutoCenter::PreferredWorkArea) .ClientSize(FVector2D(350, 165)); - TSharedPtr DialogWrapper = + const TSharedPtr DialogWrapper = SNew(SBorder) .BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(4.0f) @@ -48,9 +49,9 @@ FDlgBatchRenameTool::EResult FDlgBatchRenameTool::ShowModal() { //Show Dialog GEditor->EditorAddModalWindow(DialogWindow.ToSharedRef()); - EResult UserResponse = (EResult)DialogWidget->GetUserResponse(); + const EResult UserResponse = (EResult)DialogWidget->GetUserResponse(); - if (UserResponse == EResult::Confirm) + if (UserResponse == Confirm) { Prefix = DialogWidget->PrefixTextBox->GetText().ToString(); Suffix = DialogWidget->SuffixTextBox->GetText().ToString(); @@ -63,10 +64,10 @@ FDlgBatchRenameTool::EResult FDlgBatchRenameTool::ShowModal() // If no information is given, treat as canceled if (Prefix.IsEmpty() && Suffix.IsEmpty() && Find.IsEmpty()) { - return EResult::Cancel; + return Cancel; } - FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked("AssetTools"); + const FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked("AssetTools"); TArray AssetsAndNames; for (auto AssetIt = SelectedAssets.CreateConstIterator(); AssetIt; ++AssetIt) @@ -317,4 +318,4 @@ FDlgBatchRenameTool::EResult SDlgBatchRenameTool::GetUserResponse() const return UserResponse; } -#undef LOCTEXT_NAMESPACE +#undef LOCTEXT_NAMESPACE \ No newline at end of file diff --git a/Source/Linter/Private/LintRule.cpp b/Source/Linter/Private/LintRule.cpp index 596aa31..462c7a2 100644 --- a/Source/Linter/Private/LintRule.cpp +++ b/Source/Linter/Private/LintRule.cpp @@ -5,9 +5,7 @@ #include "Materials/Material.h" #include "Kismet2/BlueprintEditorUtils.h" #include "Engine/Blueprint.h" -#include "AssetData.h" #include "Modules/ModuleManager.h" -#include "IAssetRegistry.h" #include "IAssetTools.h" #include "AssetRegistryModule.h" @@ -58,10 +56,10 @@ FName ULintRule::GetRuleBasedObjectVariantName_Implementation(UObject* ObjectToL } { - UMaterialInterface* MI = Cast(ObjectToLint); + const UMaterialInterface* MI = Cast(ObjectToLint); if (MI != nullptr) { -#if ENGINE_MINOR_VERSION >= 25 +#if ENGINE_MINOR_VERSION >= 25 || ENGINE_MAJOR_VERSION >= 5 TMicRecursionGuard RecursionGuard; #else UMaterialInterface::TMicRecursionGuard RecursionGuard; @@ -69,7 +67,7 @@ FName ULintRule::GetRuleBasedObjectVariantName_Implementation(UObject* ObjectToL const UMaterial* Material = MI->GetMaterial_Concurrent(RecursionGuard); if (Material != nullptr) { - if (Material->MaterialDomain == EMaterialDomain::MD_PostProcess) + if (Material->MaterialDomain == MD_PostProcess) { return "PostProcess"; } @@ -78,10 +76,10 @@ FName ULintRule::GetRuleBasedObjectVariantName_Implementation(UObject* ObjectToL } { - UBlueprint* Blueprint = Cast(ObjectToLint); + const UBlueprint* Blueprint = Cast(ObjectToLint); if (Blueprint != nullptr) { - if (Blueprint->BlueprintType == EBlueprintType::BPTYPE_MacroLibrary) + if (Blueprint->BlueprintType == BPTYPE_MacroLibrary) { return "MacroLibrary"; } @@ -132,7 +130,7 @@ TArray> FLintRuleViolation::AllRuleViolationsWith // This should really be done when the structs are first created TArray> SharedViolations; TArray Violations = AllRuleViolationsWithViolator(RuleViolationCollection, SearchViolator); - for (FLintRuleViolation Violation : Violations) + for (const FLintRuleViolation Violation : Violations) { SharedViolations.Push(TSharedPtr(new FLintRuleViolation(Violation))); } @@ -237,7 +235,7 @@ TMultiMap> FLintRuleViolation:: bool FLintRuleViolation::PopulateAssetData() { - IAssetRegistry& AssetRegistry = FModuleManager::LoadModuleChecked("AssetRegistry").Get(); + const IAssetRegistry& AssetRegistry = FModuleManager::LoadModuleChecked("AssetRegistry").Get(); TArray AssetRenameData; if (Violator.IsValid()) @@ -247,4 +245,4 @@ bool FLintRuleViolation::PopulateAssetData() } return false; -} +} \ No newline at end of file diff --git a/Source/Linter/Private/LintRuleSet.cpp b/Source/Linter/Private/LintRuleSet.cpp index e52ae60..7ae4536 100644 --- a/Source/Linter/Private/LintRuleSet.cpp +++ b/Source/Linter/Private/LintRuleSet.cpp @@ -1,6 +1,8 @@ #include "LintRuleSet.h" -#include "LintRunner.h" +#include "AnyObject_LinterDummyClass.h" +#include "LintRunner.h" +#include "Linter.h" #include "AssetRegistryModule.h" #include "Modules/ModuleManager.h" #include "HAL/RunnableThread.h" @@ -18,6 +20,7 @@ ULinterNamingConvention* ULintRuleSet::GetNamingConvention() const TArray ULintRuleSet::LintPath(TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask /*= nullptr*/) const { + // ReSharper disable once CppExpressionWithoutSideEffects NamingConvention.LoadSynchronous(); TArray RuleViolations; @@ -28,7 +31,7 @@ TArray ULintRuleSet::LintPath(TArray AssetPaths, FS } // Begin loading assets - FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); UE_LOG(LogLinter, Display, TEXT("Loading the asset registry...")); AssetRegistryModule.Get().SearchAllAssets(/*bSynchronousSearch =*/true); @@ -100,14 +103,14 @@ TArray ULintRuleSet::LintPath(TArray AssetPaths, FS return RuleViolations; } -TArray> ULintRuleSet::LintPathShared(TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask /*= nullptr*/) const +TArray> ULintRuleSet::LintPathShared(const TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask /*= nullptr*/) const { TArray RuleViolations = LintPath(AssetPaths, ParentScopedSlowTask); TArray> SharedRuleViolations; - for (FLintRuleViolation Violation : RuleViolations) + for (const FLintRuleViolation Violation : RuleViolations) { - TSharedPtr SharedViolation = TSharedPtr(new FLintRuleViolation(Violation)); + TSharedPtr SharedViolation = MakeShared(Violation); SharedViolation->PopulateAssetData(); SharedRuleViolations.Push(SharedViolation); } @@ -115,26 +118,26 @@ TArray> ULintRuleSet::LintPathShared(TArray Class) const +const FLintRuleList* ULintRuleSet::GetLintRuleListForClass(const TSoftClassPtr Class) const { - UClass* searchClass = Class.LoadSynchronous(); - while (searchClass != nullptr) + UClass* SearchClass = Class.LoadSynchronous(); + while (SearchClass != nullptr) { - const FLintRuleList* pRuleList = ClassLintRulesMap.Find(searchClass); - if (pRuleList != nullptr) + const FLintRuleList* RuleList = ClassLintRulesMap.Find(SearchClass); + if (RuleList != nullptr) { - return pRuleList; + return RuleList; } // @HACK: If we reach UObject, find our hack rule for fallback - if (searchClass == UObject::StaticClass()) + if (SearchClass == UObject::StaticClass()) { - const FLintRuleList* anyObjectRuleList = ClassLintRulesMap.Find(UAnyObject_LinterDummyClass::StaticClass()); - return anyObjectRuleList; + const FLintRuleList* AnyObjectRuleList = ClassLintRulesMap.Find(UAnyObject_LinterDummyClass::StaticClass()); + return AnyObjectRuleList; } // Load our parent class in case we failed to get naming conventions - searchClass = searchClass->GetSuperClass(); + SearchClass = SearchClass->GetSuperClass(); } return nullptr; @@ -179,4 +182,4 @@ bool FLintRuleList::PassesRules(UObject* ObjectToLint, const ULintRuleSet* Paren } return !bFailedAnyRule; -} +} \ No newline at end of file diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Compiles.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Compiles.cpp index ca3f32a..187b3ab 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Compiles.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Compiles.cpp @@ -11,17 +11,17 @@ ULintRule_Blueprint_Compiles::ULintRule_Blueprint_Compiles(const FObjectInitiali bool ULintRule_Blueprint_Compiles::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { - UBlueprint* Blueprint = CastChecked(ObjectToLint); + const UBlueprint* Blueprint = CastChecked(ObjectToLint); switch (Blueprint->Status) { - case EBlueprintStatus::BS_BeingCreated: - case EBlueprintStatus::BS_Dirty: - case EBlueprintStatus::BS_Unknown: - case EBlueprintStatus::BS_UpToDate: + case BS_BeingCreated: + case BS_Dirty: + case BS_Unknown: + case BS_UpToDate: return true; - case EBlueprintStatus::BS_Error: - case EBlueprintStatus::BS_UpToDateWithWarnings: + case BS_Error: + case BS_UpToDateWithWarnings: OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass())); return false; default: diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp index 1e522ef..0c61626 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp @@ -45,7 +45,7 @@ bool ULintRule_Blueprint_Funcs_MaxNodes::IsNodeTrivial(const UEdGraphNode* Node) if (const UK2Node_CallFunction* CallFuncNode = Cast(Node)) { - FName FuncName = CallFuncNode->FunctionReference.GetMemberName(); + const FName FuncName = CallFuncNode->FunctionReference.GetMemberName(); if (FuncName == TEXT("Conv_InterfaceToObject") || FuncName.ToString().Contains(TEXT("MakeLiteral")) || FuncName.ToString().Contains(TEXT("ToString")) @@ -65,10 +65,10 @@ bool ULintRule_Blueprint_Funcs_MaxNodes::PassesRule_Internal_Implementation(UObj UBlueprint* Blueprint = CastChecked(ObjectToLint); bool bRuleViolated = false; - FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintFuncsMaxNodes", "{Previous}{WhiteSpace}Please simply function {FuncName} as it has {Nodes} nodes when we want a max of {MaxNodes}."); + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintFuncsMaxNodes", "{Previous}{WhiteSpace}Please simply function {FuncName} as it has {Nodes} nodes when we want a max of {MaxNodes}."); FText AllFixes; - for (auto FunctionGraph : Blueprint->FunctionGraphs) + for (const auto FunctionGraph : Blueprint->FunctionGraphs) { if (FunctionGraph->GetFName() != UEdGraphSchema_K2::FN_UserConstructionScript) { diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp index b3afc19..1f7b7b0 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp @@ -29,12 +29,12 @@ bool ULintRule_Blueprint_Funcs_MustHaveReturn::PassesRule_Internal_Implementatio } bool bRuleViolated = false; - FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintFuncsMustHaveReturn", "{Previous}{WhiteSpace}Please give function {FuncName} a return node."); + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintFuncsMustHaveReturn", "{Previous}{WhiteSpace}Please give function {FuncName} a return node."); FText AllFixes; static const FName DefaultAnimGraphName("AnimGraph"); - for (auto FunctionGraph : Blueprint->FunctionGraphs) + for (const auto FunctionGraph : Blueprint->FunctionGraphs) { if (FunctionGraph->GetFName() != UEdGraphSchema_K2::FN_UserConstructionScript && FunctionGraph->GetFName() != DefaultAnimGraphName) diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.cpp index e192779..f62e6ac 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.cpp @@ -30,14 +30,14 @@ bool ULintRule_Blueprint_Funcs_PublicDescriptions::PassesRule_Internal_Implement } bool bRuleViolated = false; - FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintFuncsPublicDescriptions", "{Previous}{WhiteSpace}Please give public function {FuncName} a description."); + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintFuncsPublicDescriptions", "{Previous}{WhiteSpace}Please give public function {FuncName} a description."); FText AllFixes; - for (UEdGraph* FunctionGraph : Blueprint->FunctionGraphs) + for (const UEdGraph* FunctionGraph : Blueprint->FunctionGraphs) { if (FunctionGraph->GetFName() != UEdGraphSchema_K2::FN_UserConstructionScript) { - UK2Node_FunctionEntry* FunctionEntryNode = nullptr; + const UK2Node_FunctionEntry* FunctionEntryNode = nullptr; TArray EntryNodes; FunctionGraph->GetNodesOfClass(EntryNodes); diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp index 6bc3cb1..1946804 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp @@ -19,7 +19,7 @@ ULintRule_Blueprint_LooseNodes::ULintRule_Blueprint_LooseNodes(const FObjectInit bool ULintRule_Blueprint_LooseNodes::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { - UBlueprint* Blueprint = CastChecked(ObjectToLint); + const UBlueprint* Blueprint = CastChecked(ObjectToLint); // Check for loose nodes TArray Graphs; @@ -27,7 +27,7 @@ bool ULintRule_Blueprint_LooseNodes::PassesRule_Internal_Implementation(UObject* for (UEdGraph* Graph : Graphs) { - for (UEdGraphNode* Node : Graph->Nodes) + for (const UEdGraphNode* Node : Graph->Nodes) { if ( Node->IsAutomaticallyPlacedGhostNode() || @@ -44,7 +44,7 @@ bool ULintRule_Blueprint_LooseNodes::PassesRule_Internal_Implementation(UObject* bool bNodeIsolated = true; TArray Pins = Node->GetAllPins(); - for (UEdGraphPin* Pin : Pins) + for (const UEdGraphPin* Pin : Pins) { if (Pin->LinkedTo.Num() != 0) { diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_ConfigCategories.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_ConfigCategories.cpp index 58b797d..5fd2262 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_ConfigCategories.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_ConfigCategories.cpp @@ -1,8 +1,10 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. + #include "LintRules/LintRule_Blueprint_Vars_ConfigCategories.h" #include "LintRuleSet.h" #include "Engine/Blueprint.h" #include "EdGraphSchema_K2.h" +#include "Kismet2/BlueprintEditorUtils.h" ULintRule_Blueprint_Vars_ConfigCategories::ULintRule_Blueprint_Vars_ConfigCategories(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) @@ -15,8 +17,8 @@ bool ULintRule_Blueprint_Vars_ConfigCategories::PassesRule_Internal_Implementati bool bRuleViolated = false; - FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsConfigCategories", "{Previous}{WhiteSpace}Please give variable {VarName} a category."); - FText FixTextTemplateEditable = NSLOCTEXT("Linter", "BlueprintVarsConfigCategoriesEditable", "{Previous}{WhiteSpace}Please give editable variable {VarName} a category starting with 'Config'."); + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsConfigCategories", "{Previous}{WhiteSpace}Please give variable {VarName} a category."); + const FText FixTextTemplateEditable = NSLOCTEXT("Linter", "BlueprintVarsConfigCategoriesEditable", "{Previous}{WhiteSpace}Please give editable variable {VarName} a category starting with 'Config'."); FText AllFixes; int32 VariableCount = Blueprint->NewVariables.Num(); @@ -31,8 +33,8 @@ bool ULintRule_Blueprint_Vars_ConfigCategories::PassesRule_Internal_Implementati if (VariableCount < NumVariablesToRequireCategorization) { return true; - } - + } + for (FBPVariableDescription Desc : Blueprint->NewVariables) { FString PropName = Desc.VarName.ToString(); diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.cpp index c614ec7..d1de215 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.cpp @@ -15,7 +15,7 @@ bool ULintRule_Blueprint_Vars_EditableMustHaveTooltip::PassesRule_Internal_Imple bool bRuleViolated = false; - FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsEditableMustHaveTooltip", "{Previous}{WhiteSpace}Please give variable {VarName} a tooltip as it is marked editable."); + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsEditableMustHaveTooltip", "{Previous}{WhiteSpace}Please give variable {VarName} a tooltip as it is marked editable."); FText AllFixes; for (FBPVariableDescription Desc : Blueprint->NewVariables) diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.cpp index 53fc50b..0de7862 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.cpp @@ -15,7 +15,7 @@ bool ULintRule_Blueprint_Vars_NoConfigFlag::PassesRule_Internal_Implementation(U bool bRuleViolated = false; - FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsNoConfigFlag", "{Previous}{WhiteSpace}Please disable the config flag on variable {VarName}."); + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsNoConfigFlag", "{Previous}{WhiteSpace}Please disable the config flag on variable {VarName}."); FText AllFixes; for (FBPVariableDescription Desc : Blueprint->NewVariables) diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NonAtomic.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NonAtomic.cpp index a2b1ef9..82bdb13 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NonAtomic.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NonAtomic.cpp @@ -28,7 +28,7 @@ bool ULintRule_Blueprint_Vars_NonAtomic::PassesRule_Internal_Implementation(UObj bool bRuleViolated = false; - FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsNonAtomic", "{Previous}{WhiteSpace}Please fix variable named {VarName}."); + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsNonAtomic", "{Previous}{WhiteSpace}Please fix variable named {VarName}."); FText AllFixes; for (FBPVariableDescription Desc : Blueprint->NewVariables) diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_PluralArrays.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_PluralArrays.cpp index 22ccc94..95b0754 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_PluralArrays.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_PluralArrays.cpp @@ -15,7 +15,7 @@ bool ULintRule_Blueprint_Vars_PluralArrays::PassesRule_Internal_Implementation(U bool bRuleViolated = false; - FText FixTextTemplate = NSLOCTEXT("Linter", "PluralArrayHasArray", "{Previous}{WhiteSpace}Please remove the word 'Array' from your variable {VarName}."); + const FText FixTextTemplate = NSLOCTEXT("Linter", "PluralArrayHasArray", "{Previous}{WhiteSpace}Please remove the word 'Array' from your variable {VarName}."); FText AllFixes; for (FBPVariableDescription Desc : Blueprint->NewVariables) diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_RegEx.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_RegEx.cpp index 01d0d91..7321c3c 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_RegEx.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_RegEx.cpp @@ -17,11 +17,11 @@ bool ULintRule_Blueprint_Vars_Regex::PassesRule_Internal_Implementation(UObject* bool bRuleViolated = false; - FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsRegex", "{Previous}{WhiteSpace}Please fix variable named {VarName}."); + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsRegex", "{Previous}{WhiteSpace}Please fix variable named {VarName}."); FText AllFixes; - FString TestRegexPatternString = RegexPatternString; - FString BoolTestRegexPatternString = TEXT("b") + RegexPatternString; + const FString TestRegexPatternString = RegexPatternString; + const FString BoolTestRegexPatternString = TEXT("b") + RegexPatternString; const FRegexPattern TestRegexPattern = FRegexPattern(TestRegexPatternString); const FRegexPattern BoolTestRegexPattern = FRegexPattern(BoolTestRegexPatternString); @@ -30,10 +30,10 @@ bool ULintRule_Blueprint_Vars_Regex::PassesRule_Internal_Implementation(UObject* { FString PropName = Desc.VarName.ToString(); FText TypeName = UEdGraphSchema_K2::TypeToText(Desc.VarType); - bool bIsBool = Desc.VarType.PinCategory == UEdGraphSchema_K2::PC_Boolean; + const bool bIsBool = Desc.VarType.PinCategory == UEdGraphSchema_K2::PC_Boolean; FRegexMatcher Matcher(bIsBool ? BoolTestRegexPattern : TestRegexPattern, PropName); - bool bFoundMatch = Matcher.FindNext(); + const bool bFoundMatch = Matcher.FindNext(); if ((bFoundMatch && bMustNotContainRegexPattern) || (!bFoundMatch && !bMustNotContainRegexPattern)) { diff --git a/Source/Linter/Private/LintRules/LintRule_Collection.cpp b/Source/Linter/Private/LintRules/LintRule_Collection.cpp index 50d06a4..570d792 100644 --- a/Source/Linter/Private/LintRules/LintRule_Collection.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Collection.cpp @@ -2,7 +2,6 @@ #include "LintRules/LintRule_Collection.h" #include "LintRuleSet.h" #include "LinterNamingConvention.h" -#include "HAL/FileManager.h" ULintRule_Collection::ULintRule_Collection(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) diff --git a/Source/Linter/Private/LintRules/LintRule_IsNamedCorrectly_Base.cpp b/Source/Linter/Private/LintRules/LintRule_IsNamedCorrectly_Base.cpp index 3b278f8..9b3572a 100644 --- a/Source/Linter/Private/LintRules/LintRule_IsNamedCorrectly_Base.cpp +++ b/Source/Linter/Private/LintRules/LintRule_IsNamedCorrectly_Base.cpp @@ -38,8 +38,8 @@ bool ULintRule_IsNamedCorrectly_Base::PassesRule_Internal_Implementation(UObject bool bFoundMatchingNameRule = false; for (FLinterNamingConventionInfo Info : NameSettingList) { - bool bPassesPrefixCheck = Info.Prefix.IsEmpty() ? true : ObjectToLint->GetName().StartsWith(Info.Prefix, ESearchCase::CaseSensitive); - bool bPassesSuffixCheck = Info.Suffix.IsEmpty() ? true : ObjectToLint->GetName().EndsWith(Info.Suffix, ESearchCase::CaseSensitive); + const bool bPassesPrefixCheck = Info.Prefix.IsEmpty() ? true : ObjectToLint->GetName().StartsWith(Info.Prefix, ESearchCase::CaseSensitive); + const bool bPassesSuffixCheck = Info.Suffix.IsEmpty() ? true : ObjectToLint->GetName().EndsWith(Info.Suffix, ESearchCase::CaseSensitive); // Run prefix and suffix checks using found name settings if they are non-null if (bPassesPrefixCheck && bPassesSuffixCheck) @@ -51,8 +51,8 @@ bool ULintRule_IsNamedCorrectly_Base::PassesRule_Internal_Implementation(UObject if (!bFoundMatchingNameRule) { - FString SuggestedName = BuildSuggestedName(ObjectToLint->GetName(), NameSettingList[0].Prefix, NameSettingList[0].Suffix); - FText RecommendedAction = FText::FormatOrdered(NSLOCTEXT("Linter", "IsNamedCorrectly_RecommendedAction", "Recommended name: [{0}]."), FText::FromString(SuggestedName)); + const FString SuggestedName = BuildSuggestedName(ObjectToLint->GetName(), NameSettingList[0].Prefix, NameSettingList[0].Suffix); + const FText RecommendedAction = FText::FormatOrdered(NSLOCTEXT("Linter", "IsNamedCorrectly_RecommendedAction", "Recommended name: [{0}]."), FText::FromString(SuggestedName)); OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), RecommendedAction)); return false; } @@ -65,8 +65,8 @@ FString ULintRule_IsNamedCorrectly_Base::BuildSuggestedName(FString CurrentName, { FString SuggestedName; - int32 FirstUnderscore = CurrentName.Find(TEXT("_")); - int32 LastUnderscore = CurrentName.Find(TEXT("_"), ESearchCase::IgnoreCase, ESearchDir::FromEnd); + const int32 FirstUnderscore = CurrentName.Find(TEXT("_")); + const int32 LastUnderscore = CurrentName.Find(TEXT("_"), ESearchCase::IgnoreCase, ESearchDir::FromEnd); bool bAddPrefix = false; bool bAddSuffix = false; diff --git a/Source/Linter/Private/LintRules/LintRule_ParticleSystem_EmitterNameRegex.cpp b/Source/Linter/Private/LintRules/LintRule_ParticleSystem_EmitterNameRegex.cpp index a28b576..765e3c1 100644 --- a/Source/Linter/Private/LintRules/LintRule_ParticleSystem_EmitterNameRegex.cpp +++ b/Source/Linter/Private/LintRules/LintRule_ParticleSystem_EmitterNameRegex.cpp @@ -31,17 +31,17 @@ bool ULintRule_ParticleSystem_EmitterNameRegex::PassesRule_Internal_Implementati bool bRuleViolated = false; - FText FixTextTemplate = NSLOCTEXT("Linter", "ParticleHasBadEmitterNames", "{Previous}{WhiteSpace}Please rename emitter {EmitterName}."); + const FText FixTextTemplate = NSLOCTEXT("Linter", "ParticleHasBadEmitterNames", "{Previous}{WhiteSpace}Please rename emitter {EmitterName}."); FText AllFixes; if (ParticleSystem->Emitters.Num() >= MinEmittersNeededToEnforce) { - FRegexPattern RegexPattern = FRegexPattern(RegexPatternString); + const FRegexPattern RegexPattern = FRegexPattern(RegexPatternString); - for (UParticleEmitter* Emitter : ParticleSystem->Emitters) + for (const UParticleEmitter* Emitter : ParticleSystem->Emitters) { FRegexMatcher RegexMatcher(RegexPattern, Emitter->EmitterName.ToString()); - bool bFoundMatch = RegexMatcher.FindNext(); + const bool bFoundMatch = RegexMatcher.FindNext(); if ((bFoundMatch && bMustNotContainRegexPattern) || (!bFoundMatch && !bMustNotContainRegexPattern)) { diff --git a/Source/Linter/Private/LintRules/LintRule_Path_DisallowNames.cpp b/Source/Linter/Private/LintRules/LintRule_Path_DisallowNames.cpp index acd081a..a45e5be 100644 --- a/Source/Linter/Private/LintRules/LintRule_Path_DisallowNames.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Path_DisallowNames.cpp @@ -2,7 +2,6 @@ #include "LintRules/LintRule_Path_DisallowNames.h" #include "LintRuleSet.h" #include "LinterNamingConvention.h" -#include "HAL/FileManager.h" ULintRule_Path_DisallowNames::ULintRule_Path_DisallowNames(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) @@ -12,7 +11,7 @@ ULintRule_Path_DisallowNames::ULintRule_Path_DisallowNames(const FObjectInitiali bool ULintRule_Path_DisallowNames::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { - FString PathName = ObjectToLint->GetPathName(); + const FString PathName = ObjectToLint->GetPathName(); TArray PathElements; PathName.ParseIntoArray(PathElements, TEXT("/"), true); diff --git a/Source/Linter/Private/LintRules/LintRule_Path_IsNotTooLong.cpp b/Source/Linter/Private/LintRules/LintRule_Path_IsNotTooLong.cpp index 7d16d02..9a012fc 100644 --- a/Source/Linter/Private/LintRules/LintRule_Path_IsNotTooLong.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Path_IsNotTooLong.cpp @@ -2,7 +2,6 @@ #include "LintRules/LintRule_Path_IsNotTooLong.h" #include "LintRuleSet.h" #include "LinterNamingConvention.h" -#include "HAL/FileManager.h" ULintRule_Path_IsNotTooLong::ULintRule_Path_IsNotTooLong(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) @@ -11,13 +10,13 @@ ULintRule_Path_IsNotTooLong::ULintRule_Path_IsNotTooLong(const FObjectInitialize bool ULintRule_Path_IsNotTooLong::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { - FString PathName = ObjectToLint->GetPathName(); + const FString PathName = ObjectToLint->GetPathName(); // See if file path is longer than 140 characters // 145 = 140 + /Game (5) int32 DotIndex = -1; PathName.FindLastChar('.', DotIndex); - FString FilePath = PathName.LeftChop(PathName.Len() - DotIndex); + const FString FilePath = PathName.LeftChop(PathName.Len() - DotIndex); if (FilePath.Len() >= MaxPathLimit + 5) { OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass())); diff --git a/Source/Linter/Private/LintRules/LintRule_Path_NoTopLevel.cpp b/Source/Linter/Private/LintRules/LintRule_Path_NoTopLevel.cpp index 0c78641..40b1dbb 100644 --- a/Source/Linter/Private/LintRules/LintRule_Path_NoTopLevel.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Path_NoTopLevel.cpp @@ -13,7 +13,7 @@ ULintRule_Path_NoTopLevel::ULintRule_Path_NoTopLevel(const FObjectInitializer& O bool ULintRule_Path_NoTopLevel::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { - FString PathName = ObjectToLint->GetPathName(); + const FString PathName = ObjectToLint->GetPathName(); TArray PathElements; PathName.ParseIntoArray(PathElements, TEXT("/"), true); diff --git a/Source/Linter/Private/LintRules/LintRule_Path_Regex.cpp b/Source/Linter/Private/LintRules/LintRule_Path_Regex.cpp index f4497ff..bf00bd1 100644 --- a/Source/Linter/Private/LintRules/LintRule_Path_Regex.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Path_Regex.cpp @@ -2,7 +2,6 @@ #include "LintRules/LintRule_Path_Regex.h" #include "LintRuleSet.h" #include "LinterNamingConvention.h" -#include "HAL/FileManager.h" #include "Internationalization/Regex.h" ULintRule_Path_Regex::ULintRule_Path_Regex(const FObjectInitializer& ObjectInitializer) @@ -18,9 +17,9 @@ ULintRule_Path_Regex::ULintRule_Path_Regex(const FObjectInitializer& ObjectIniti bool ULintRule_Path_Regex::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { - FString PathName = ObjectToLint->GetPathName(); - - FRegexPattern RegexPattern = FRegexPattern(RegexPatternString); + const FString PathName = ObjectToLint->GetPathName(); + + const FRegexPattern RegexPattern = FRegexPattern(RegexPatternString); bool bRuleViolated = false; if (bCheckPerPathElement) @@ -31,7 +30,7 @@ bool ULintRule_Path_Regex::PassesRule_Internal_Implementation(UObject* ObjectToL for (int32 i = 0; i < PathElements.Num() - 1; ++i) { FRegexMatcher RegexMatcher(RegexPattern, PathElements[i]); - bool bFoundMatch = RegexMatcher.FindNext(); + const bool bFoundMatch = RegexMatcher.FindNext(); if ((bFoundMatch && bMustNotContainRegexPattern) || (!bFoundMatch && !bMustNotContainRegexPattern)) { @@ -43,7 +42,7 @@ bool ULintRule_Path_Regex::PassesRule_Internal_Implementation(UObject* ObjectToL else { FRegexMatcher RegexMatcher(RegexPattern, PathName); - bool bFoundMatch = RegexMatcher.FindNext(); + const bool bFoundMatch = RegexMatcher.FindNext(); if ((bFoundMatch && bMustNotContainRegexPattern) || (!bFoundMatch && !bMustNotContainRegexPattern)) { diff --git a/Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp b/Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp index 63199b6..dd5ef06 100644 --- a/Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp +++ b/Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp @@ -24,7 +24,7 @@ bool ULintRule_SoundWave_SampleRate::PassesRule(UObject* ObjectToLint, const ULi bool ULintRule_SoundWave_SampleRate::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { - USoundWave* SoundWave = const_cast(CastChecked(ObjectToLint)); + const USoundWave* SoundWave = const_cast(CastChecked(ObjectToLint)); if (ValidSampleRates.Contains(SoundWave->GetSampleRateForCurrentPlatform())) { diff --git a/Source/Linter/Private/LintRules/LintRule_StaticMesh_ValidUVs.cpp b/Source/Linter/Private/LintRules/LintRule_StaticMesh_ValidUVs.cpp index d4160a5..34fb23f 100644 --- a/Source/Linter/Private/LintRules/LintRule_StaticMesh_ValidUVs.cpp +++ b/Source/Linter/Private/LintRules/LintRule_StaticMesh_ValidUVs.cpp @@ -2,7 +2,6 @@ #include "LintRules/LintRule_StaticMesh_ValidUVs.h" #include "LintRuleSet.h" #include "LinterNamingConvention.h" -#include "HAL/FileManager.h" ULintRule_StaticMesh_ValidUVs::ULintRule_StaticMesh_ValidUVs(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) @@ -37,14 +36,14 @@ bool ULintRule_StaticMesh_ValidUVs::PassesRule_Internal_Implementation(UObject* if ((!bIgnoreMissingUVs && MissingUVs.Num() > 0)) { - FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_StaticMesh_ValidUVs_Missing", "Static mesh has missing UVs. Please add at least one valid UV channel."); + const FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_StaticMesh_ValidUVs_Missing", "Static mesh has missing UVs. Please add at least one valid UV channel."); OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), RecommendedAction)); return false; } if (BadUVs.Num() > 0) { - FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_StaticMesh_ValidUVs_Bad", "Static mesh has invalid UVs. [{0}]"); + const FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_StaticMesh_ValidUVs_Bad", "Static mesh has invalid UVs. [{0}]"); FText::FormatOrdered(RecommendedAction, FText::FromString(FString::Join(BadUVs, TEXT(", ")))); OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), RecommendedAction)); return false; diff --git a/Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp b/Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp index ab8088a..f481bcb 100644 --- a/Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp @@ -2,7 +2,6 @@ #include "LintRules/LintRule_Texture_Size_NotTooBig.h" #include "LintRuleSet.h" #include "LinterNamingConvention.h" -#include "HAL/FileManager.h" ULintRule_Texture_Size_NotTooBig::ULintRule_Texture_Size_NotTooBig(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) @@ -25,13 +24,13 @@ bool ULintRule_Texture_Size_NotTooBig::PassesRule_Internal_Implementation(UObjec { const UTexture2D* Texture = CastChecked(ObjectToLint); - int32 TexSizeX = Texture->GetSizeX(); - int32 TexSizeY = Texture->GetSizeY(); + const int32 TexSizeX = Texture->GetSizeX(); + const int32 TexSizeY = Texture->GetSizeY(); // Check to see if textures are too big if (TexSizeX > MaxTextureSizeX || TexSizeY > MaxTextureSizeY) { - FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_Texture_Size_NotTooBig_TooBig", "Please shrink your textures dimensions so that they fit within {0}x{1} pixels."); + const FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_Texture_Size_NotTooBig_TooBig", "Please shrink your textures dimensions so that they fit within {0}x{1} pixels."); OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), FText::FormatOrdered(RecommendedAction, MaxTextureSizeX, MaxTextureSizeY))); return false; } diff --git a/Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp b/Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp index 9819c71..81dcaee 100644 --- a/Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp @@ -2,12 +2,11 @@ #include "LintRules/LintRule_Texture_Size_PowerOfTwo.h" #include "LintRuleSet.h" #include "LinterNamingConvention.h" -#include "HAL/FileManager.h" ULintRule_Texture_Size_PowerOfTwo::ULintRule_Texture_Size_PowerOfTwo(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { - IgnoreTexturesInTheseGroups.Add(TextureGroup::TEXTUREGROUP_UI); + IgnoreTexturesInTheseGroups.Add(TEXTUREGROUP_UI); } bool ULintRule_Texture_Size_PowerOfTwo::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const @@ -35,10 +34,10 @@ bool ULintRule_Texture_Size_PowerOfTwo::PassesRule_Internal_Implementation(UObje int32 TexSizeX = Texture->GetSizeX(); int32 TexSizeY = Texture->GetSizeY(); - bool bXFail = ((TexSizeX & (TexSizeX - 1)) != 0); - bool bYFail = ((TexSizeY & (TexSizeY - 1)) != 0); + const bool bXFail = ((TexSizeX & (TexSizeX - 1)) != 0); + const bool bYFail = ((TexSizeY & (TexSizeY - 1)) != 0); - UEnum* TextureGroupEnum = StaticEnum(); + const UEnum* TextureGroupEnum = StaticEnum(); FString IgnoredLODGroupNames; for (TEnumAsByte LODGroup : IgnoreTexturesInTheseGroups) diff --git a/Source/Linter/Private/LintRunner.cpp b/Source/Linter/Private/LintRunner.cpp index c151244..cfbbc56 100644 --- a/Source/Linter/Private/LintRunner.cpp +++ b/Source/Linter/Private/LintRunner.cpp @@ -1,5 +1,8 @@ // Copyright 1998-2018 Epic Games, Inc. All Rights Reserved. + #include "LintRunner.h" +#include "Linter.h" +#include "LintRuleSet.h" #define LOCTEXT_NAMESPACE "Linter" @@ -50,7 +53,7 @@ bool FLintRunner::Init() } uint32 FLintRunner::Run() -{ +{ if (LoadedObject == nullptr || pLoadedRuleList == nullptr || RuleSet == nullptr || pOutRuleViolations == nullptr) { return 2; @@ -64,7 +67,7 @@ uint32 FLintRunner::Run() if (RuleViolations.Num() > 0) { - FScopeLock lock(&LintDataUpdateLock); + FScopeLock Lock(&LintDataUpdateLock); pOutRuleViolations->Append(RuleViolations); } @@ -82,4 +85,4 @@ void FLintRunner::Exit() return; } -#undef LOCTEXT_NAMESPACE +#undef LOCTEXT_NAMESPACE \ No newline at end of file diff --git a/Source/Linter/Private/Linter.cpp b/Source/Linter/Private/Linter.cpp index deab22e..507fdbd 100644 --- a/Source/Linter/Private/Linter.cpp +++ b/Source/Linter/Private/Linter.cpp @@ -4,12 +4,9 @@ #include "ISettingsModule.h" #include "Framework/Docking/TabManager.h" #include "LevelEditor.h" -#include "Widgets/Input/SButton.h" #include "Styling/SlateStyle.h" #include "AssetRegistryModule.h" #include "IAssetRegistry.h" -#include "AssetData.h" -#include "ContentBrowserModule.h" #include "PropertyEditorModule.h" #include "LinterStyle.h" @@ -26,7 +23,7 @@ static const FName LinterTabName = "LinterTab"; void FLinterModule::StartupModule() { // Load the asset registry module - FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(FName("AssetRegistry")); + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(FName("AssetRegistry")); IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); if (AssetRegistry.IsLoadingAssets()) @@ -43,7 +40,7 @@ void FLinterModule::StartupModule() { // Register slate style overrides FLinterStyle::Initialize(); - TSharedPtr StyleSetPtr = FLinterStyle::StyleSet; + const TSharedPtr StyleSetPtr = FLinterStyle::StyleSet; if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr("Settings")) { @@ -103,10 +100,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; } @@ -118,8 +115,8 @@ void FLinterModule::OnInitialAssetRegistrySearchComplete() void FLinterModule::TryToLoadAllLintRuleSets() { - FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(FName("AssetRegistry")); - IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(FName("AssetRegistry")); + const IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); TArray FoundRuleSets; AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetFName(), FoundRuleSets, true); @@ -135,6 +132,6 @@ void FLinterModule::TryToLoadAllLintRuleSets() } #undef LOCTEXT_NAMESPACE - + IMPLEMENT_MODULE(FLinterModule, Linter) DEFINE_LOG_CATEGORY(LogLinter); \ No newline at end of file diff --git a/Source/Linter/Private/LinterCommandlet.cpp b/Source/Linter/Private/LinterCommandlet.cpp index a455379..9b6b065 100644 --- a/Source/Linter/Private/LinterCommandlet.cpp +++ b/Source/Linter/Private/LinterCommandlet.cpp @@ -1,9 +1,7 @@ // Copyright 2020 Gamemakin LLC. All Rights Reserved. #include "LinterCommandlet.h" -#include "Editor.h" #include "AssetRegistryModule.h" -#include "AssetData.h" #include "Engine/ObjectLibrary.h" #include "Dom/JsonObject.h" #include "Dom/JsonValue.h" @@ -13,7 +11,9 @@ #include "Serialization/JsonWriter.h" #include "Serialization/JsonSerializer.h" #include "Linter.h" +#include "LinterSettings.h" #include "LintRule.h" +#include "LintRuleSet.h" DEFINE_LOG_CATEGORY_STATIC(LinterCommandlet, All, All); @@ -38,7 +38,7 @@ int32 ULinterCommandlet::Main(const FString& InParams) TArray Paths; TArray Switches; TMap ParamsMap; - UCommandlet::ParseCommandLine(*Params, Paths, Switches, ParamsMap); + ParseCommandLine(*Params, Paths, Switches, ParamsMap); UE_LOG(LinterCommandlet, Display, TEXT("Linter is indeed running!")); FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); @@ -166,7 +166,7 @@ int32 ULinterCommandlet::Main(const FString& InParams) if (Switches.Contains(TEXT("json")) || ParamsMap.Contains(FString(TEXT("json")))) { FDateTime Now = FDateTime::Now(); - FString JsonOutputName = TEXT("lint-report-") + FDateTime::Now().ToString() + TEXT(".json"); + FString JsonOutputName = TEXT("lint-report-") + Now.ToString() + TEXT(".json"); const FString LintReportPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); FString FullOutputPath = LintReportPath / JsonOutputName; @@ -204,7 +204,7 @@ int32 ULinterCommandlet::Main(const FString& InParams) if (Switches.Contains(TEXT("html")) || ParamsMap.Contains(FString(TEXT("html")))) { FDateTime Now = FDateTime::Now(); - FString HtmlOutputName = TEXT("lint-report-") + FDateTime::Now().ToString() + TEXT(".html"); + FString HtmlOutputName = TEXT("lint-report-") + Now.ToString() + TEXT(".html"); const FString LintReportPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); FString FullOutputPath = LintReportPath / HtmlOutputName; @@ -257,7 +257,7 @@ int32 ULinterCommandlet::Main(const FString& InParams) } } - if (NumErrors > 0 || Switches.Contains(TEXT("TreatWarningsAsErrors")) && NumWarnings > 0) + if (NumErrors > 0 || (Switches.Contains(TEXT("TreatWarningsAsErrors")) && NumWarnings > 0)) { UE_LOG(LinterCommandlet, Display, TEXT("Lint completed with errors. Returning error code 2.")); return 2; diff --git a/Source/Linter/Private/LinterContentBrowserExtensions.cpp b/Source/Linter/Private/LinterContentBrowserExtensions.cpp index 099c20d..d7beeb1 100644 --- a/Source/Linter/Private/LinterContentBrowserExtensions.cpp +++ b/Source/Linter/Private/LinterContentBrowserExtensions.cpp @@ -1,19 +1,20 @@ // Copyright 1998-2018 Epic Games, Inc. All Rights Reserved. + #include "LinterContentBrowserExtensions.h" #include "Modules/ModuleManager.h" #include "LevelEditor.h" #include "Framework/MultiBox/MultiBoxBuilder.h" #include "LinterStyle.h" -#include "LauncherPlatformModule.h" -#include "UnrealEdMisc.h" #include "ContentBrowserModule.h" -#include "EditorStyleSet.h" +#include "Linter.h" +#include "BatchRenameTool/BatchRenameTool.h" #include "Framework/MultiBox/MultiBoxExtender.h" #include "Framework/Commands/UIAction.h" #include "Delegates/IDelegateInstance.h" #include "TooltipEditor/TooltipTool.h" #define LOCTEXT_NAMESPACE "Linter" + DEFINE_LOG_CATEGORY_STATIC(LinterContentBrowserExtensions, Log, All); void FLinterContentBrowserExtensions::InstallHooks(FLinterModule* LinterModule, FDelegateHandle* pContentBrowserExtenderDelegateHandle, class FDelegateHandle* pAssetExtenderDelegateHandle) @@ -44,13 +45,13 @@ void FLinterContentBrowserExtensions::InstallHooks(FLinterModule* LinterModule, FSlateIcon(FLinterStyle::GetStyleSetName(), "Linter.Toolbar.Icon"), FUIAction(FExecuteAction::CreateLambda([SelectedPaths]() { - if (FLinterModule* lm = FModuleManager::GetModulePtr("Linter")) + if (FLinterModule* Linter = FModuleManager::GetModulePtr("Linter")) { - if (lm != nullptr) + if (Linter != nullptr) { - lm->SetDesiredLintPaths(SelectedPaths); + Linter->SetDesiredLintPaths(SelectedPaths); } - FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab")); + FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab")); } })), NAME_None, @@ -77,7 +78,7 @@ void FLinterContentBrowserExtensions::InstallHooks(FLinterModule* LinterModule, { MenuBuilder.BeginSection("LinterAssetContext", LOCTEXT("CB_LinterHeader", "Linter")); { - + // Run through the assets to determine if any are blueprints bool bAnyBlueprintsSelected = false; for (auto AssetIt = SelectedAssets.CreateConstIterator(); AssetIt; ++AssetIt) diff --git a/Source/Linter/Private/LinterNamingConvention.cpp b/Source/Linter/Private/LinterNamingConvention.cpp index 8ed5a9c..4e96627 100644 --- a/Source/Linter/Private/LinterNamingConvention.cpp +++ b/Source/Linter/Private/LinterNamingConvention.cpp @@ -1,9 +1,12 @@ + #include "LinterNamingConvention.h" +#include "AnyObject_LinterDummyClass.h" #include "DetailLayoutBuilder.h" #include "PropertyCustomizationHelpers.h" #include "Templates/SharedPointer.h" #include "DetailCategoryBuilder.h" #include "IDetailChildrenBuilder.h" +#include "UObject/ObjectSaveContext.h" TSharedRef FLinterNamingConventionDetails::MakeInstance() { @@ -14,21 +17,35 @@ void FLinterNamingConventionDetails::CustomizeDetails(class IDetailLayoutBuilder { // Edit the Conventions category IDetailCategoryBuilder& DetailCategory = DetailBuilder.EditCategory("Conventions"); - TSharedRef NamingConventionsProperty = DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(ULinterNamingConvention, ClassNamingConventions), ULinterNamingConvention::StaticClass()); + const TSharedRef NamingConventionsProperty = DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(ULinterNamingConvention, ClassNamingConventions), ULinterNamingConvention::StaticClass()); - TSharedRef ConventionsPropertyBuilder = MakeShareable(new FDetailArrayBuilder(NamingConventionsProperty)); + const TSharedRef ConventionsPropertyBuilder = MakeShareable(new FDetailArrayBuilder(NamingConventionsProperty)); ConventionsPropertyBuilder->OnGenerateArrayElementWidget(FOnGenerateArrayElementWidget::CreateSP(this, &FLinterNamingConventionDetails::OnGenerateElementForDetails, &DetailBuilder)); DetailCategory.AddCustomBuilder(ConventionsPropertyBuilder); } -void FLinterNamingConventionDetails::OnGenerateElementForDetails(TSharedRef StructProperty, int32 ElementIndex, IDetailChildrenBuilder& ChildrenBuilder, IDetailLayoutBuilder* DetailLayout) +void FLinterNamingConventionDetails::OnGenerateElementForDetails(const TSharedRef StructProperty, int32 ElementIndex, IDetailChildrenBuilder& ChildrenBuilder, IDetailLayoutBuilder* DetailLayout) { + const TSharedRef RemoveButton = PropertyCustomizationHelpers::MakeRemoveButton(FSimpleDelegate::CreateLambda([this, DetailLayout, ElementIndex] + { + const TSharedRef NamingConventionsProperty + = DetailLayout->GetProperty(GET_MEMBER_NAME_CHECKED(ULinterNamingConvention, ClassNamingConventions), ULinterNamingConvention::StaticClass()); + const TSharedPtr NamingConventionsPropertyHandle = NamingConventionsProperty->AsArray(); + NamingConventionsPropertyHandle->DeleteItem(ElementIndex); + } + )); + ChildrenBuilder.AddCustomRow(FText::GetEmpty()) [ SNew(SHorizontalBox) + SHorizontalBox::Slot() + .AutoWidth() + [ + RemoveButton + ] + + SHorizontalBox::Slot() .FillWidth(1.0f) [ SNew(SProperty, StructProperty->GetChildHandle("SoftClassPtr")) @@ -58,36 +75,43 @@ ULinterNamingConvention::ULinterNamingConvention(const FObjectInitializer& Objec ClassNamingConventions = TArray(); } -TArray ULinterNamingConvention::GetNamingConventionsForClassVariant(TSoftClassPtr Class, FName Variant /*= NAME_None*/) const +void ULinterNamingConvention::PreSave(const FObjectPreSaveContext SaveContext) +{ + Super::PreSave(SaveContext); + + SortConventions(); +} + +TArray ULinterNamingConvention::GetNamingConventionsForClassVariant(const TSoftClassPtr Class, FName Variant /*= NAME_None*/) const { TArray NamingConventionList; - UClass* searchClass = Class.Get(); - while (NamingConventionList.Num() == 0 && searchClass != nullptr) + UClass* SearchClass = Class.Get(); + while (NamingConventionList.Num() == 0 && SearchClass != nullptr) { - NamingConventionList = ClassNamingConventions.FilterByPredicate([searchClass, Variant](const FLinterNamingConventionInfo& Info) + NamingConventionList = ClassNamingConventions.FilterByPredicate([SearchClass, Variant](const FLinterNamingConventionInfo& Info) { - return (Info.SoftClassPtr.Get() == searchClass && Info.Variant == Variant); + return (Info.SoftClassPtr.Get() == SearchClass && Info.Variant == Variant); }); // Abort if we try to go above UObject - if (searchClass == UObject::StaticClass()) + if (SearchClass == UObject::StaticClass()) { break; } // @HACK: Editor UI won't allow us to select the UObject class in some cases - if (searchClass == UAnyObject_LinterDummyClass::StaticClass()) + if (SearchClass == UAnyObject_LinterDummyClass::StaticClass()) { - searchClass = UObject::StaticClass(); + SearchClass = UObject::StaticClass(); continue; } // Load our parent class in case we failed to get naming conventions - searchClass = searchClass->GetSuperClass(); + SearchClass = SearchClass->GetSuperClass(); } - return NamingConventionList; + return NamingConventionList; } void ULinterNamingConvention::SortConventions() @@ -101,24 +125,24 @@ void ULinterNamingConvention::SortConventions() if (A.SoftClassPtr.GetAssetName() == B.SoftClassPtr.GetAssetName()) { - int32 sort = A.Variant.Compare(B.Variant); - if (sort < 0) + int32 Sort = A.Variant.Compare(B.Variant); + if (Sort < 0) { return true; } - if (sort == 0) + if (Sort == 0) { - sort = A.Prefix.Compare(B.Prefix); - if (sort < 0) + Sort = A.Prefix.Compare(B.Prefix); + if (Sort < 0) { return true; } - if (sort == 0) + if (Sort == 0) { - sort = A.Suffix.Compare(B.Suffix); - if (sort <= 0) + Sort = A.Suffix.Compare(B.Suffix); + if (Sort <= 0) { return true; } @@ -133,4 +157,4 @@ void ULinterNamingConvention::SortConventions() return false; }); -} +} \ No newline at end of file diff --git a/Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp b/Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp index 1f25f6b..189453d 100644 --- a/Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp +++ b/Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp @@ -66,11 +66,11 @@ bool FTooltipStringHelper::ParseFunctionRawTooltip(FString RawTooltip, FText& Ou { if (bCurrentArgumentIsInput) { - FTooltipStringHelper::FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Inputs); + FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Inputs); } else { - FTooltipStringHelper::FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Outputs); + FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Outputs); } CurrentArgumentName = FText::GetEmpty(); @@ -105,11 +105,11 @@ bool FTooltipStringHelper::ParseFunctionRawTooltip(FString RawTooltip, FText& Ou { if (bCurrentArgumentIsInput) { - FTooltipStringHelper::FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Inputs); + FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Inputs); } else { - FTooltipStringHelper::FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Outputs); + FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Outputs); } CurrentArgumentName = FText::GetEmpty(); @@ -145,11 +145,11 @@ bool FTooltipStringHelper::ParseFunctionRawTooltip(FString RawTooltip, FText& Ou { if (bCurrentArgumentIsInput) { - FTooltipStringHelper::FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Inputs); + FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Inputs); } else { - FTooltipStringHelper::FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Outputs); + FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Outputs); } CurrentArgumentName = FText::GetEmpty(); @@ -164,7 +164,7 @@ bool FTooltipStringHelper::ParseFunctionRawTooltip(FString RawTooltip, FText& Ou FString FTooltipStringHelper::ConvertTooltipDataToRawTooltip(FText FunctionDescription, TArray> Inputs, TArray> Outputs) { FString RawTooltip = FunctionDescription.ToString(); - for (TSharedPtr Arg : Inputs) + for (const TSharedPtr Arg : Inputs) { RawTooltip.Append(FString::Printf(TEXT("\n@param %s %s\t\t\t%s"), TEXT(" "), *Arg->ArgumentName.ToString(), *Arg->Tooltip.ToString())); } @@ -175,7 +175,7 @@ FString FTooltipStringHelper::ConvertTooltipDataToRawTooltip(FText FunctionDescr } else { - for (TSharedPtr Arg : Outputs) + for (const TSharedPtr Arg : Outputs) { RawTooltip.Append(FString::Printf(TEXT("\n@param %s %s\t\t\t%s"), TEXT("[out]"), *Arg->ArgumentName.ToString(), *Arg->Tooltip.ToString())); } @@ -186,7 +186,7 @@ FString FTooltipStringHelper::ConvertTooltipDataToRawTooltip(FText FunctionDescr bool FTooltipStringHelper::FindAndUpdateArgumentTooltip(FText ArgumentName, FText Tooltip, TArray>& Arguments) { - TSharedPtr* FuncArg = Arguments.FindByPredicate([&](TSharedPtr Arg){ return Arg->ArgumentName.EqualTo(ArgumentName, ETextComparisonLevel::Quinary);}); + const TSharedPtr* FuncArg = Arguments.FindByPredicate([&](TSharedPtr Arg){ return Arg->ArgumentName.EqualTo(ArgumentName, ETextComparisonLevel::Quinary);}); if (FuncArg != nullptr) { (*FuncArg)->Tooltip = Tooltip; diff --git a/Source/Linter/Private/TooltipTool/TooltipTool.cpp b/Source/Linter/Private/TooltipTool/TooltipTool.cpp index 1dffd40..6878192 100644 --- a/Source/Linter/Private/TooltipTool/TooltipTool.cpp +++ b/Source/Linter/Private/TooltipTool/TooltipTool.cpp @@ -16,6 +16,7 @@ #include "EdGraphSchema_K2.h" #include "Kismet2/BlueprintEditorUtils.h" #include "FileHelpers.h" +#include "Widgets/Layout/SSeparator.h" #define LOCTEXT_NAMESPACE "LinterTooltipTool" @@ -45,7 +46,7 @@ FTooltipTool::FTooltipTool(const TArray Assets) .MaxWidth(400.0f) .SizingRule(ESizingRule::Autosized); - TSharedPtr DialogWrapper = + const TSharedPtr DialogWrapper = SNew(SBorder) .BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(4.0f) @@ -63,9 +64,9 @@ FTooltipTool::EResult FTooltipTool::ShowModal() { //Show Dialog GEditor->EditorAddModalWindow(DialogWindow.ToSharedRef()); - EResult UserResponse = (EResult)DialogWidget->GetUserResponse(); + const EResult UserResponse = (EResult)DialogWidget->GetUserResponse(); - if (UserResponse == EResult::Confirm) + if (UserResponse == Confirm) { @@ -100,7 +101,7 @@ void STooltipTool::Construct(const FArguments& InArgs) .OptionsSource(&Blueprints.Get()) .InitiallySelectedItem(Blueprints.Get()[0]) .OnGenerateWidget_Lambda( - [](TSharedPtr Item) + [](const TSharedPtr Item) { return SNew(STextBlock) .Text(FText::FromName(Item->AssetName)) @@ -165,7 +166,7 @@ void STooltipTool::Construct(const FArguments& InArgs) [&]{ // Save package here if SCC is enabled because the user can use SCC to revert a change TArray OutermostPackagesToSave; - for (auto Asset : Blueprints.Get()) + for (const auto Asset : Blueprints.Get()) { OutermostPackagesToSave.Add(Asset->GetPackage()); } @@ -234,7 +235,7 @@ void STooltipTool::Construct(const FArguments& InArgs) ]; }) .OnSelectionChanged_Lambda( - [&](TSharedPtr Item, ESelectInfo::Type SelectInfo) + [&](const TSharedPtr Item, ESelectInfo::Type SelectInfo) { if (!Item.IsValid()) { @@ -351,7 +352,7 @@ void STooltipTool::Construct(const FArguments& InArgs) ]; }) .OnSelectionChanged_Lambda( - [&](TSharedPtr Item, ESelectInfo::Type SelectInfo) + [&](const TSharedPtr Item, ESelectInfo::Type SelectInfo) { FunctionArgumentDescriptions.Empty(); FunctionOutputDescriptions.Empty(); @@ -371,23 +372,23 @@ void STooltipTool::Construct(const FArguments& InArgs) check(Item->FunctionEntryNode); TArray InputPins = Item->FunctionEntryNode->GetAllPins(); - for (UEdGraphPin* Pin : InputPins) + for (const UEdGraphPin* Pin : InputPins) { - if (Pin->Direction == EEdGraphPinDirection::EGPD_Output) - { + if (Pin->Direction == EGPD_Output) + { if (Pin->PinType.PinCategory != UEdGraphSchema_K2::PC_Exec) { FunctionArgumentDescriptions.Add(MakeShared(FText::FromString(Pin->GetName()), FText::GetEmpty(), UEdGraphSchema_K2::TypeToText(Pin->PinType))); - } - } + } + } } if (Item->FunctionResultNode != nullptr) { TArray OutputPins = Item->FunctionResultNode->GetAllPins(); - for (UEdGraphPin* Pin : OutputPins) + for (const UEdGraphPin* Pin : OutputPins) { - if (Pin->Direction == EEdGraphPinDirection::EGPD_Input) + if (Pin->Direction == EGPD_Input) { if (Pin->PinType.PinCategory != UEdGraphSchema_K2::PC_Exec) { @@ -418,7 +419,7 @@ void STooltipTool::Construct(const FArguments& InArgs) FunctionOutputListView->RebuildList(); FunctionDescriptionTooltipBox->SetText(CurrentFunctionDescription); - + }) ] ] @@ -456,7 +457,6 @@ void STooltipTool::Construct(const FArguments& InArgs) { UpdateCurrentFunctionTooltipText(); } - } }) ] @@ -650,7 +650,7 @@ FTooltipTool::EResult STooltipTool::GetUserResponse() const return UserResponse; } -FReply STooltipTool::OnButtonClick(FTooltipTool::EResult ButtonID) +FReply STooltipTool::OnButtonClick(const FTooltipTool::EResult ButtonID) { ParentWindow->RequestDestroyWindow(); UserResponse = ButtonID; @@ -680,7 +680,7 @@ void STooltipTool::UpdateVariableTooltipText(const FText& NewText) MemberListView->GetSelectedItems(SelectedMembers); if (SelectedMembers.Num() == 1) { - TSharedPtr BlueprintAsset = BlueprintComboBox->GetSelectedItem(); + const TSharedPtr BlueprintAsset = BlueprintComboBox->GetSelectedItem(); UBlueprint* Blueprint = CastChecked(BlueprintAsset->GetAsset()); SelectedMembers[0]->SetMetaData(FBlueprintMetadata::MD_Tooltip, NewText.ToString()); FBlueprintEditorUtils::SetBlueprintVariableMetaData(Blueprint, SelectedMembers[0]->VarName, nullptr, FBlueprintMetadata::MD_Tooltip, NewText.ToString()); @@ -703,7 +703,7 @@ void STooltipTool::UpdateCurrentFunctionTooltipText() check(SelectedFunctions.Num() == 1); //If anything is selected, only one thing should be selected. for (int32 i = 0; i < FunctionArgumentDescriptions.Num(); i++) - { + { // @TODO: Don't do this TSharedRef Child = FunctionArgumentListView->WidgetFromItem(FunctionArgumentDescriptions[i])->GetContent()->GetChildren()->GetChildAt(1); const SEditableTextBox& TooltipBox = static_cast(Child.Get()); @@ -717,9 +717,9 @@ void STooltipTool::UpdateCurrentFunctionTooltipText() FunctionOutputDescriptions[i]->Tooltip = TooltipBox.GetText(); } - FString RawTooltip = FTooltipStringHelper::ConvertTooltipDataToRawTooltip(FunctionDescriptionTooltipBox->GetText(), FunctionArgumentDescriptions, FunctionOutputDescriptions); - - TSharedPtr FunctionPointer = SelectedFunctions[0]; + const FString RawTooltip = FTooltipStringHelper::ConvertTooltipDataToRawTooltip(FunctionDescriptionTooltipBox->GetText(), FunctionArgumentDescriptions, FunctionOutputDescriptions); + + const TSharedPtr FunctionPointer = SelectedFunctions[0]; FunctionPointer->FunctionEntryNode->MetaData.ToolTip = FText::FromString(RawTooltip); } @@ -736,18 +736,18 @@ void STooltipTool::RebuildMemberList() } UBlueprint* Blueprint = Cast(BlueprintComboBox->GetSelectedItem().Get()->GetAsset()); - + // Get variables - for (FBPVariableDescription Member : Blueprint->NewVariables) + for (const FBPVariableDescription Member : Blueprint->NewVariables) { if ((Member.PropertyFlags & CPF_DisableEditOnInstance) != CPF_DisableEditOnInstance) { - Members.Push(TSharedPtr(new FBPVariableDescription(Member))); + Members.Push(MakeShared(Member)); } } // Get functions - for (UEdGraph* FunctionGraph : Blueprint->FunctionGraphs) + for (const UEdGraph* FunctionGraph : Blueprint->FunctionGraphs) { if (FunctionGraph->GetFName() != UEdGraphSchema_K2::FN_UserConstructionScript) { @@ -779,4 +779,4 @@ void STooltipTool::RebuildMemberList() } } -#undef LOCTEXT_NAMESPACE +#undef LOCTEXT_NAMESPACE \ No newline at end of file diff --git a/Source/Linter/Private/UI/LintReport.cpp b/Source/Linter/Private/UI/LintReport.cpp index 592300b..3c01776 100644 --- a/Source/Linter/Private/UI/LintReport.cpp +++ b/Source/Linter/Private/UI/LintReport.cpp @@ -1,10 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. -#include "UI/LintReport.h" -#include "UI/LintReportAssetError.h" +#include "UI/LintReport.h" #include "LintRule.h" -#include "Widgets/Views/STableRow.h" -#include "Widgets/Views/SListView.h" #include "Widgets/SBoxPanel.h" #include "LintRuleSet.h" #include "UI/LintReportAssetErrorList.h" @@ -21,6 +18,9 @@ #include "Dom/JsonValue.h" #include "DesktopPlatformModule.h" #include "IDesktopPlatform.h" +#include "Linter.h" +#include "LinterStyle.h" +#include "Interfaces/IPluginManager.h" #include "Misc/FileHelper.h" #include "Widgets/Input/SComboButton.h" #include "UI/LintReportRuleDetails.h" @@ -72,7 +72,7 @@ void SLintReport::Construct(const FArguments& Args) SNew(SButton) .Text(LOCTEXT("ExportToJSON", "Export To JSON")) .OnClicked_Lambda([this]() -> FReply - { + { IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); const void* ParentWindowWindowHandle = FSlateApplication::Get().FindBestParentWindowHandleForDialogs(nullptr); @@ -80,9 +80,9 @@ void SLintReport::Construct(const FArguments& Args) const FText Title = LOCTEXT("ExportToJsonTitle", "Export Lint Report as JSON"); const FString FileTypes = TEXT("Json (*.json)|*.json"); - FDateTime Now = FDateTime::Now(); - FString Output = TEXT("lint-report-") + FDateTime::Now().ToString() + TEXT(".json"); - + const FDateTime Now = FDateTime::Now(); + const FString Output = TEXT("lint-report-") + Now.ToString() + TEXT(".json"); + FString DefaultPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); DefaultPath = FPaths::ConvertRelativePathToFull(DefaultPath); IFileManager::Get().MakeDirectory(*DefaultPath, true); @@ -100,7 +100,7 @@ void SLintReport::Construct(const FArguments& Args) if (OutFilenames.Num() > 0) { - FString WritePath = FPaths::ConvertRelativePathToFull(OutFilenames[0]); + const FString WritePath = FPaths::ConvertRelativePathToFull(OutFilenames[0]); FFileHelper::SaveStringToFile(JsonReport, *WritePath); FPlatformProcess::LaunchURL(*WritePath, TEXT(""), nullptr); } @@ -116,7 +116,7 @@ void SLintReport::Construct(const FArguments& Args) SNew(SButton) .Text(LOCTEXT("ExportToHTML", "Export To HTML")) .OnClicked_Lambda([this]() -> FReply - { + { IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); const void* ParentWindowWindowHandle = FSlateApplication::Get().FindBestParentWindowHandleForDialogs(nullptr); @@ -124,9 +124,9 @@ void SLintReport::Construct(const FArguments& Args) const FText Title = LOCTEXT("ExportToHTMLTitle", "Export Lint Report as HTML"); const FString FileTypes = TEXT("HTML (*.html)|*.html"); - FDateTime Now = FDateTime::Now(); - FString Output = TEXT("lint-report-") + FDateTime::Now().ToString() + TEXT(".html"); - + const FDateTime Now = FDateTime::Now(); + const FString Output = TEXT("lint-report-") + Now.ToString() + TEXT(".html"); + FString DefaultPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); DefaultPath = FPaths::ConvertRelativePathToFull(DefaultPath); IFileManager::Get().MakeDirectory(*DefaultPath, true); @@ -144,7 +144,7 @@ void SLintReport::Construct(const FArguments& Args) if (OutFilenames.Num() > 0) { - FString WritePath = FPaths::ConvertRelativePathToFull(OutFilenames[0]); + const FString WritePath = FPaths::ConvertRelativePathToFull(OutFilenames[0]); FFileHelper::SaveStringToFile(HTMLReport, *WritePath); FPlatformProcess::LaunchURL(*WritePath, TEXT(""), nullptr); } @@ -206,7 +206,7 @@ void SLintReport::Construct(const FArguments& Args) [ SNew(SImage).Image( FEditorStyle::GetBrush("GenericViewButton") ) ] - + +SHorizontalBox::Slot() .AutoWidth() .Padding(2, 0, 0, 0) @@ -378,7 +378,7 @@ TSharedRef SLintReport::GetViewButtonContent() FSlateIcon(), FUIAction( FExecuteAction::CreateLambda([&]() - { + { if (AssetDetailsScrollBoxPtr.IsValid()) { AssetDetailsScrollBoxPtr->SetVisibility(EVisibility::SelfHitTestInvisible); @@ -401,7 +401,7 @@ TSharedRef SLintReport::GetViewButtonContent() FSlateIcon(), FUIAction( FExecuteAction::CreateLambda([&]() - { + { if (AssetDetailsScrollBoxPtr.IsValid()) { AssetDetailsScrollBoxPtr->SetVisibility(EVisibility::Collapsed); diff --git a/Source/Linter/Private/UI/LintReportAssetDetails.cpp b/Source/Linter/Private/UI/LintReportAssetDetails.cpp index c2e9b28..2f82c39 100644 --- a/Source/Linter/Private/UI/LintReportAssetDetails.cpp +++ b/Source/Linter/Private/UI/LintReportAssetDetails.cpp @@ -1,4 +1,5 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. + #include "UI/LintReportAssetDetails.h" #include "LinterStyle.h" #include "Widgets/Layout/SBorder.h" @@ -9,16 +10,13 @@ #include "IContentBrowserSingleton.h" #include "AssetRegistryModule.h" #include "Widgets/Input/SHyperlink.h" -#include "Widgets/Layout/SSpacer.h" #include "IAssetTools.h" #include "AssetToolsModule.h" -#include "Misc/MessageDialog.h" #include "Internationalization/Internationalization.h" #include "Widgets/Text/STextBlock.h" -#include "Framework/Views/ITypedTableView.h" -#include "UI/LintReportAssetError.h" #include "LintRule.h" #include "AssetThumbnail.h" +#include "UI/LintReportAssetErrorList.h" #define LOCTEXT_NAMESPACE "LintReport" @@ -31,15 +29,15 @@ void SLintReportAssetDetails::Construct(const FArguments& Args) const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - FText AssetName = FText::FromString(AssetData.Get().AssetName.ToString()); - FText AssetPath = FText::FromString(AssetData.Get().GetFullName()); + const FText AssetName = FText::FromString(AssetData.Get().AssetName.ToString()); + const FText AssetPath = FText::FromString(AssetData.Get().GetFullName()); const TSharedPtr AssetThumbnail = MakeShareable(new FAssetThumbnail(AssetData.Get().GetAsset(), 96, 96, ThumbnailPool.Get())); int32 NumErrors = 0; int32 NumWarnings = 0; - for (TSharedPtr RuleViolation : RuleViolations.Get()) + for (const TSharedPtr RuleViolation : RuleViolations.Get()) { switch (RuleViolation->ViolatedRule.Get()->GetDefaultObject()->RuleSeverity) { @@ -53,7 +51,7 @@ void SLintReportAssetDetails::Construct(const FArguments& Args) break; //case ELintRuleSeverity::Ignore: default: - break; + break; } } @@ -113,7 +111,7 @@ void SLintReportAssetDetails::Construct(const FArguments& Args) .Text(AssetPath) .OnNavigate_Lambda([&]() { - FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); TArray AssetDatas; AssetDatas.Push(AssetData.Get()); @@ -141,4 +139,4 @@ void SLintReportAssetDetails::Construct(const FArguments& Args) ] ] ]; -} +} \ No newline at end of file diff --git a/Source/Linter/Private/UI/LintReportAssetError.cpp b/Source/Linter/Private/UI/LintReportAssetError.cpp index 1df22b6..041d66d 100644 --- a/Source/Linter/Private/UI/LintReportAssetError.cpp +++ b/Source/Linter/Private/UI/LintReportAssetError.cpp @@ -1,27 +1,26 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. + #include "UI/LintReportAssetError.h" -#include "Widgets/Layout/SBorder.h" + +#include "LinterStyle.h" #include "Widgets/SBoxPanel.h" #include "Widgets/Layout/SExpandableArea.h" #include "Widgets/Input/SHyperlink.h" #include "LintRule.h" -#include "Widgets/Views/SListView.h" -#include "Widgets/Views/STableRow.h" #include "Widgets/Layout/SBox.h" #define LOCTEXT_NAMESPACE "LintReport" - void SLintReportAssetError::Construct(const FArguments& Args) { RuleViolation = Args._RuleViolation; const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - ULintRule* LintRule = RuleViolation.Get()->ViolatedRule.Get()->GetDefaultObject(); + const ULintRule* LintRule = RuleViolation.Get()->ViolatedRule.Get()->GetDefaultObject(); check(LintRule != nullptr); const FSlateBrush* RuleIcon = nullptr; - bool bHasURL = !LintRule->RuleURL.IsEmpty(); + const bool bHasURL = !LintRule->RuleURL.IsEmpty(); switch (LintRule->RuleSeverity) { @@ -84,7 +83,7 @@ void SLintReportAssetError::Construct(const FArguments& Args) SNew(SImage) .Cursor(EMouseCursor::Hand) .Visibility(bHasURL ? EVisibility::Visible : EVisibility::Collapsed) - .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { FPlatformProcess::LaunchURL(*RuleViolation.Get()->ViolatedRule.Get()->GetDefaultObject()->RuleURL, NULL, NULL); return FReply::Handled(); }) + .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { FPlatformProcess::LaunchURL(*RuleViolation.Get()->ViolatedRule.Get()->GetDefaultObject()->RuleURL, nullptr, nullptr); return FReply::Handled(); }) .Image(FLinterStyle::Get()->GetBrush("Linter.Report.Link")) ] ] @@ -108,5 +107,4 @@ void SLintReportAssetError::Construct(const FArguments& Args) .Text(RuleViolation.Get()->RecommendedAction) ] ]; -} - +} \ No newline at end of file diff --git a/Source/Linter/Private/UI/LintReportAssetErrorList.cpp b/Source/Linter/Private/UI/LintReportAssetErrorList.cpp index 1d1bf8c..14ba12c 100644 --- a/Source/Linter/Private/UI/LintReportAssetErrorList.cpp +++ b/Source/Linter/Private/UI/LintReportAssetErrorList.cpp @@ -1,20 +1,8 @@ +// Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. + #include "UI/LintReportAssetErrorList.h" #include "LinterStyle.h" -#include "Widgets/Layout/SBorder.h" -#include "EditorStyleSet.h" -#include "Widgets/SBoxPanel.h" -#include "Widgets/Layout/SExpandableArea.h" -#include "ContentBrowserModule.h" #include "IContentBrowserSingleton.h" -#include "AssetRegistryModule.h" -#include "Widgets/Input/SHyperlink.h" -#include "Widgets/Layout/SSpacer.h" -#include "IAssetTools.h" -// Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. -#include "AssetToolsModule.h" -#include "Misc/MessageDialog.h" -#include "Internationalization/Internationalization.h" -#include "Widgets/Text/STextBlock.h" #include "Framework/Views/ITypedTableView.h" #include "UI/LintReportAssetError.h" #include "LintRule.h" @@ -31,7 +19,7 @@ void SLintReportAssetErrorList::Construct(const FArguments& Args) SNew(SListView>) .SelectionMode(ESelectionMode::None) .ListItemsSource(&RuleViolations.Get()) - .OnGenerateRow_Lambda([&](TSharedPtr InItem, const TSharedRef& OwnerTable) + .OnGenerateRow_Lambda([&](const TSharedPtr InItem, const TSharedRef& OwnerTable) { return SNew(STableRow>, OwnerTable) [ @@ -40,4 +28,4 @@ void SLintReportAssetErrorList::Construct(const FArguments& Args) ]; }) ]; -} +} \ No newline at end of file diff --git a/Source/Linter/Private/UI/LintReportRuleDetails.cpp b/Source/Linter/Private/UI/LintReportRuleDetails.cpp index f1d1e4a..c01e319 100644 --- a/Source/Linter/Private/UI/LintReportRuleDetails.cpp +++ b/Source/Linter/Private/UI/LintReportRuleDetails.cpp @@ -9,13 +9,10 @@ #include "IContentBrowserSingleton.h" #include "AssetRegistryModule.h" #include "Widgets/Input/SHyperlink.h" -#include "Widgets/Layout/SSpacer.h" #include "IAssetTools.h" #include "AssetToolsModule.h" -#include "Misc/MessageDialog.h" #include "Internationalization/Internationalization.h" #include "Widgets/Text/STextBlock.h" -#include "Framework/Views/ITypedTableView.h" #include "UI/LintReportRuleErrorList.h" #include "LintRule.h" #include "AssetThumbnail.h" @@ -35,8 +32,8 @@ void SLintReportRuleDetails::Construct(const FArguments& Args) ULintRule* BrokenRule = (RuleViolations.Get())[0]->ViolatedRule.GetDefaultObject(); check(BrokenRule != nullptr); - FText RuleName = BrokenRule->RuleTitle; - FText RuleDesc = BrokenRule->RuleDescription; + const FText RuleName = BrokenRule->RuleTitle; + const FText RuleDesc = BrokenRule->RuleDescription; RuleURL = BrokenRule->RuleURL; @@ -57,8 +54,8 @@ void SLintReportRuleDetails::Construct(const FArguments& Args) break; } - FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); - IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); + const IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); RuleAssetData = AssetRegistry.GetAssetByObjectPath(FName(*BrokenRule->GetPathName()), true); FText RuleAssetPath; @@ -132,7 +129,7 @@ void SLintReportRuleDetails::Construct(const FArguments& Args) .Image(FLinterStyle::Get()->GetBrush("Linter.Report.Link")) .Cursor(EMouseCursor::Hand) .Visibility(RuleURL.IsEmpty() ? EVisibility::Collapsed : EVisibility::Visible) - .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { FPlatformProcess::LaunchURL(*RuleURL, NULL, NULL); return FReply::Handled(); }) + .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { FPlatformProcess::LaunchURL(*RuleURL, nullptr, nullptr); return FReply::Handled(); }) ] // Link to Rule Definition Asset + SHorizontalBox::Slot() @@ -145,7 +142,7 @@ void SLintReportRuleDetails::Construct(const FArguments& Args) .Visibility(EVisibility::Collapsed) .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { - FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); ContentBrowserModule.Get().SyncBrowserToAssets(TArray({ RuleAssetData })); return FReply::Handled(); }) @@ -160,7 +157,7 @@ void SLintReportRuleDetails::Construct(const FArguments& Args) .Text(FText::FormatNamed(LOCTEXT("AssetCountDisplay", "{NumAssets} {NumAssets}|plural(one=Asset,other=Assets)"), TEXT("NumAssets"), RuleViolations.Get().Num())) .OnNavigate_Lambda([&]() { - FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); TArray AssetDatas; for (const TSharedPtr& RuleViolation : RuleViolations.Get()) diff --git a/Source/Linter/Private/UI/LintReportRuleError.cpp b/Source/Linter/Private/UI/LintReportRuleError.cpp index b8d22a6..3b7057d 100644 --- a/Source/Linter/Private/UI/LintReportRuleError.cpp +++ b/Source/Linter/Private/UI/LintReportRuleError.cpp @@ -1,17 +1,18 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. + #include "UI/LintReportRuleError.h" -#include "Widgets/Layout/SBorder.h" + +#include "ContentBrowserModule.h" +#include "IContentBrowserSingleton.h" +#include "LinterStyle.h" #include "Widgets/SBoxPanel.h" #include "Widgets/Layout/SExpandableArea.h" #include "Widgets/Input/SHyperlink.h" #include "LintRule.h" -#include "Widgets/Views/SListView.h" -#include "Widgets/Views/STableRow.h" -#include "Widgets/Layout/SBox.h" +#include "AssetRegistry/AssetRegistryModule.h" #define LOCTEXT_NAMESPACE "LintReport" - void SLintReportRuleError::Construct(const FArguments& Args) { RuleViolation = Args._RuleViolation; @@ -36,8 +37,8 @@ void SLintReportRuleError::Construct(const FArguments& Args) .Text(FText::FromName(RuleViolation.Get()->ViolatorAssetData.PackageName)) .OnNavigate_Lambda([&]() { - FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); - FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); + const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); TArray AssetDatas; AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(RuleViolation.Get()->ViolatorAssetData.ObjectPath)); ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); @@ -55,5 +56,4 @@ void SLintReportRuleError::Construct(const FArguments& Args) .Visibility(RuleViolation.Get()->RecommendedAction.IsEmpty() ? EVisibility::Collapsed : EVisibility::SelfHitTestInvisible) ] ]; -} - +} \ No newline at end of file diff --git a/Source/Linter/Private/UI/LintReportRuleErrorList.cpp b/Source/Linter/Private/UI/LintReportRuleErrorList.cpp index 4f411a5..eb4c984 100644 --- a/Source/Linter/Private/UI/LintReportRuleErrorList.cpp +++ b/Source/Linter/Private/UI/LintReportRuleErrorList.cpp @@ -2,23 +2,10 @@ #include "UI/LintReportruleErrorList.h" #include "LinterStyle.h" -#include "Widgets/Layout/SBorder.h" -#include "EditorStyleSet.h" -#include "Widgets/SBoxPanel.h" -#include "Widgets/Layout/SExpandableArea.h" -#include "ContentBrowserModule.h" #include "IContentBrowserSingleton.h" -#include "AssetRegistryModule.h" -#include "Widgets/Input/SHyperlink.h" -#include "Widgets/Layout/SSpacer.h" -#include "IAssetTools.h" -#include "AssetToolsModule.h" -#include "Misc/MessageDialog.h" -#include "Internationalization/Internationalization.h" -#include "Widgets/Text/STextBlock.h" #include "Framework/Views/ITypedTableView.h" -#include "UI/LintReportAssetError.h" #include "LintRule.h" +#include "UI/LintReportRuleError.h" #define LOCTEXT_NAMESPACE "LintReport" @@ -26,13 +13,12 @@ void SLintReportRuleErrorList::Construct(const FArguments& Args) { RuleViolations = Args._RuleViolations; const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - ChildSlot [ SNew(SListView>) .SelectionMode(ESelectionMode::None) .ListItemsSource(&RuleViolations.Get()) - .OnGenerateRow_Lambda([&](TSharedPtr InItem, const TSharedRef& OwnerTable) + .OnGenerateRow_Lambda([&](const TSharedPtr InItem, const TSharedRef& OwnerTable) { return SNew(STableRow>, OwnerTable) [ @@ -41,4 +27,4 @@ void SLintReportRuleErrorList::Construct(const FArguments& Args) ]; }) ]; -} +} \ No newline at end of file diff --git a/Source/Linter/Private/UI/LintWizard.cpp b/Source/Linter/Private/UI/LintWizard.cpp index 65e9cbd..d0364cb 100644 --- a/Source/Linter/Private/UI/LintWizard.cpp +++ b/Source/Linter/Private/UI/LintWizard.cpp @@ -4,18 +4,18 @@ #include "CoreGlobals.h" #include "Delegates/Delegate.h" #include "AssetRegistryModule.h" +#include "AssetToolsModule.h" +#include "ContentBrowserModule.h" +#include "DesktopPlatformModule.h" #include "IAssetRegistry.h" -#include "AssetData.h" #include "SlateOptMacros.h" #include "Widgets/Layout/SSeparator.h" -#include "Widgets/Views/SListView.h" #include "Widgets/Text/SRichTextBlock.h" #include "Widgets/Notifications/SNotificationList.h" #include "Widgets/Layout/SScrollBox.h" #include "IUATHelperModule.h" #include "Misc/FeedbackContext.h" #include "Framework/Notifications/NotificationManager.h" -#include "AssetThumbnail.h" #include "FileHelpers.h" #include "Logging/MessageLog.h" #include "Logging/TokenizedMessage.h" @@ -25,7 +25,7 @@ #include "LinterSettings.h" #include "UI/SAssetLinkWidget.h" - +#define LOCTEXT_NAMESPACE "LintWizard" BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION void SLintWizard::Construct(const FArguments& InArgs) @@ -36,12 +36,12 @@ void SLintWizard::Construct(const FArguments& InArgs) RuleSets = TArray>(); // Try to load the default rule set - ULintRuleSet* DefaultRuleSet = GetDefault()->DefaultLintRuleSet.LoadSynchronous(); + const ULintRuleSet* DefaultRuleSet = GetDefault()->DefaultLintRuleSet.LoadSynchronous(); // Even though this happens on module startup, we try force loading all rule sets again in case any new unloaded rule sets have been added // or for some reason our existing rule sets were unloaded from memory - FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(FName("AssetRegistry")); - IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(FName("AssetRegistry")); + const IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); TArray FoundRuleSets; AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetFName(), FoundRuleSets, true); @@ -49,7 +49,7 @@ void SLintWizard::Construct(const FArguments& InArgs) // Attempt to get all RuleSets in memory so that linting tools are better aware of them for (const FAssetData& RuleSetData : FoundRuleSets) { - ULintRuleSet* LoadedRuleSet = Cast(RuleSetData.GetAsset()); + const ULintRuleSet* LoadedRuleSet = Cast(RuleSetData.GetAsset()); if (LoadedRuleSet != nullptr) { FAssetData* newData = new FAssetData; @@ -83,12 +83,12 @@ void SLintWizard::Construct(const FArguments& InArgs) .CancelButtonStyle(FEditorStyle::Get(), "FlatButton.Default") .FinishButtonStyle(FEditorStyle::Get(), "FlatButton.Success") .ButtonTextStyle(FEditorStyle::Get(), "LargeText") - .ForegroundColor(FEditorStyle::Get().GetSlateColor("WhiteBrush")) + //.ForegroundColor(FEditorStyle::Get().GetSlateColor("WhiteBrush")) .CanFinish(true) .FinishButtonText(LOCTEXT("FinishButtonText", "Close")) .OnFinished_Lambda([&]() { - FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab"))->RequestCloseTab(); + FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab"))->RequestCloseTab(); }) + SWizard::Page() .CanShow_Lambda([&]() { return RuleSets.Num() > 0; }) @@ -119,13 +119,13 @@ void SLintWizard::Construct(const FArguments& InArgs) .OptionsSource(&RuleSets) .InitiallySelectedItem(SelectedRuleSet) .OnGenerateWidget_Lambda([&](TSharedPtr LintRuleSet) - { + { ULintRuleSet* RuleSet = Cast(LintRuleSet->GetAsset()); if (RuleSet != nullptr) { return SNew(STextBlock).Text(RuleSet->RuleSetDescription.IsEmpty() ? FText::FromString(RuleSet->GetPathName()) : RuleSet->RuleSetDescription); } - return SNew(STextBlock).Text(FText::FromString(TEXT("This Lint Rule Set Failed To Load? Uhhhh...."))); + return SNew(STextBlock).Text(FText::FromString(TEXT("This Lint Rule Set Failed To Load? Uhhhh...."))); }) .OnSelectionChanged_Lambda([&](TSharedPtr Item, ESelectInfo::Type SelectInfo) { SelectedRuleSet = Item; RuleSetSelectionComboBox->RefreshOptions(); }) .ContentPadding(4.0f) @@ -256,10 +256,10 @@ void SLintWizard::Construct(const FArguments& InArgs) .StepActionText(LOCTEXT("FixUpRedirectsStepAction", "Fix Up Redirectors")) .OnPerformAction_Lambda([this](FScopedSlowTask& ScopedSlowTask) { - FixUpRedirectorStatus = EStepStatus::InProgress; + FixUpRedirectorStatus = InProgress; bool bSuccess = true; - FAssetRegistryModule& AssetRegistryModule = FModuleManager::Get().LoadModuleChecked(TEXT("AssetRegistry")); + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::Get().LoadModuleChecked(TEXT("AssetRegistry")); ScopedSlowTask.EnterProgressFrame(0, LOCTEXT("Linter.FixUpRedirects.FindingRedirectors", "Looking For redirectors...")); // Form a filter from the paths @@ -287,7 +287,7 @@ void SLintWizard::Construct(const FArguments& InArgs) { // Transform Objects array to ObjectRedirectors array TArray Redirectors; - for (auto Object : Objects) + for (const auto Object : Objects) { auto Redirector = CastChecked(Object); Redirectors.Add(Redirector); @@ -310,7 +310,7 @@ void SLintWizard::Construct(const FArguments& InArgs) } } - FixUpRedirectorStatus = bSuccess ? EStepStatus::Success : EStepStatus::Error; + FixUpRedirectorStatus = bSuccess ? Success : Error; }) ] // Build Lighting Widget @@ -394,7 +394,7 @@ void SLintWizard::Construct(const FArguments& InArgs) .StepActionText(LOCTEXT("SaveAllStepNameAction", "Save All")) .OnPerformAction_Lambda([this](FScopedSlowTask& ScopedSlowTask) { - SaveAllStatus = EStepStatus::InProgress; + SaveAllStatus = InProgress; // Taken from MainFrameActions.cpp SaveAll const bool bPromptUserToSave = false; @@ -405,7 +405,7 @@ void SLintWizard::Construct(const FArguments& InArgs) const bool bCanBeDeclined = false; if (FEditorFileUtils::SaveDirtyPackages(bPromptUserToSave, bSaveMapPackages, bSaveContentPackages, bFastSave, bNotifyNoPackagesSaved, bCanBeDeclined)) { - SaveAllStatus = EStepStatus::Success; + SaveAllStatus = Success; } else { @@ -414,8 +414,8 @@ void SLintWizard::Construct(const FArguments& InArgs) NotificationInfo.Hyperlink = FSimpleDelegate::CreateStatic([]() { FMessageLog("LoadErrors").Open(EMessageSeverity::Info, true); }); NotificationInfo.HyperlinkText = LOCTEXT("LoadObjectHyperlink", "Show Message Log"); FSlateNotificationManager::Get().AddNotification(NotificationInfo); - SaveAllStatus = EStepStatus::Error; - } + SaveAllStatus = Error; + } }) ] // Package Project step @@ -489,7 +489,7 @@ void SLintWizard::Construct(const FArguments& InArgs) bool bOpened = false; TArray SaveFilenames; IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); - if (DesktopPlatform != NULL) + if (DesktopPlatform != nullptr) { bOpened = DesktopPlatform->SaveFileDialog( NULL, @@ -521,7 +521,7 @@ void SLintWizard::Construct(const FArguments& InArgs) LOCTEXT("ZipTaskShortName", "Zip Project Task"), FEditorStyle::GetBrush(TEXT("MainFrame.CookContent"))); } - FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab"))->RequestCloseTab(); + FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab"))->RequestCloseTab(); } return FReply::Handled(); }) @@ -590,7 +590,7 @@ bool SLintWizard::LoadAssetsIfNeeded(const TArray& ObjectPaths, TArray< { const FString& ObjectPath = ObjectPaths[PathIdx]; - UObject* FoundObject = FindObject(NULL, *ObjectPath); + UObject* FoundObject = FindObject(nullptr, *ObjectPath); if (FoundObject) { LoadedObjects.Add(FoundObject); @@ -622,7 +622,7 @@ bool SLintWizard::LoadAssetsIfNeeded(const TArray& ObjectPaths, TArray< SlowTask.EnterProgressFrame(1, FText::Format(LOCTEXT("LoadingObjectf", "Loading {0}..."), FText::FromString(ObjectPath))); // Load up the object - UObject* LoadedObject = LoadObject(NULL, *ObjectPath, NULL, LoadFlags, NULL); + UObject* LoadedObject = LoadObject(nullptr, *ObjectPath, nullptr, LoadFlags, nullptr); if (LoadedObject) { LoadedObjects.Add(LoadedObject); @@ -635,7 +635,7 @@ bool SLintWizard::LoadAssetsIfNeeded(const TArray& ObjectPaths, TArray< if (GWarn->ReceivedUserCancel()) { // If the user has canceled stop loading the remaining objects. We don't add the remaining objects to the failed string, - // this would only result in launching another dialog when by their actions the user clearly knows not all of the + // this would only result in launching another dialog when by their actions the user clearly knows not all of the // assets will have been loaded. break; } @@ -650,3 +650,5 @@ bool SLintWizard::LoadAssetsIfNeeded(const TArray& ObjectPaths, TArray< return true; } + +#undef LOCTEXT_NAMESPACE \ No newline at end of file diff --git a/Source/Linter/Private/UI/SAssetLinkWidget.cpp b/Source/Linter/Private/UI/SAssetLinkWidget.cpp index a3ae2e5..94bdbc7 100644 --- a/Source/Linter/Private/UI/SAssetLinkWidget.cpp +++ b/Source/Linter/Private/UI/SAssetLinkWidget.cpp @@ -1,15 +1,16 @@ // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. + #include "UI/SAssetLinkWidget.h" +#include "ContentBrowserModule.h" +#include "IContentBrowserSingleton.h" +#include "SlateOptMacros.h" +#include "AssetRegistry/AssetRegistryModule.h" #include "Widgets/SBoxPanel.h" -#include "Widgets/Layout/SBorder.h" -#include "Widgets/Layout/SBox.h" -#include "Widgets/Images/SImage.h" -#include "Widgets/Input/SButton.h" -#include "Widgets/Text/STextBlock.h" -#include "Widgets/Images/SThrobber.h" +#include "Widgets/Input/SHyperlink.h" #include "Widgets/Text/SRichTextBlock.h" BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION + void SAssetLinkWidget::Construct(const FArguments& Args) { const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); @@ -23,10 +24,11 @@ void SAssetLinkWidget::Construct(const FArguments& Args) [ SNew(SHyperlink) .Text(FText::FromName(AssetData.Get().AssetName)) + .Padding(PaddingAmount) .OnNavigate_Lambda([&]() { - FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); - FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); + const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); TArray AssetDatas; AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(AssetData.Get().ObjectPath)); ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); @@ -34,4 +36,5 @@ void SAssetLinkWidget::Construct(const FArguments& Args) ] ]; } -END_SLATE_FUNCTION_BUILD_OPTIMIZATION + +END_SLATE_FUNCTION_BUILD_OPTIMIZATION \ No newline at end of file diff --git a/Source/Linter/Private/UI/SStepWidget.cpp b/Source/Linter/Private/UI/SStepWidget.cpp index 28536e8..11667da 100644 --- a/Source/Linter/Private/UI/SStepWidget.cpp +++ b/Source/Linter/Private/UI/SStepWidget.cpp @@ -1,23 +1,24 @@ // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #include "UI/SStepWidget.h" + +#include "LinterStyle.h" #include "Widgets/SBoxPanel.h" #include "Widgets/Layout/SBorder.h" -#include "Widgets/Layout/SBox.h" #include "Widgets/Images/SImage.h" #include "Widgets/Input/SButton.h" #include "Widgets/Text/STextBlock.h" #include "Widgets/Images/SThrobber.h" #include "Widgets/Text/SRichTextBlock.h" -bool SStepWidget::IsStepCompleted(bool bAllowWarning /*= true*/) +bool SStepWidget::IsStepCompleted(const bool bAllowWarning) const { - EStepStatus Status = StepStatus.Get(); - if (bAllowWarning && Status == EStepStatus::Warning) + const EStepStatus Status = StepStatus.Get(); + if (bAllowWarning && Status == Warning) { return true; } - return Status == EStepStatus::Success; + return Status == Success; } void SStepWidget::Construct(const FArguments& Args) @@ -32,22 +33,22 @@ void SStepWidget::Construct(const FArguments& Args) // Visibility lambda based on whether step is in progress auto VisibleIfInProgress = [this]() { - return StepStatus.Get(EStepStatus::NoStatus) == EStepStatus::InProgress ? EVisibility::Visible : EVisibility::Collapsed; + return StepStatus.Get(NoStatus) == InProgress ? EVisibility::Visible : EVisibility::Collapsed; }; // Enabled lambda based on whether this widget has a step status that requires action auto EnabledBasedOnStepStatus = [this]() -> bool { - switch (StepStatus.Get(EStepStatus::NoStatus)) + switch (StepStatus.Get(NoStatus)) { - case EStepStatus::NoStatus: - case EStepStatus::InProgress: - case EStepStatus::Success: + case NoStatus: + case InProgress: + case Success: return false; - case EStepStatus::Unknown: - case EStepStatus::Warning: - case EStepStatus::Error: - case EStepStatus::NeedsUpdate: + case Unknown: + case Warning: + case Error: + case NeedsUpdate: return true; } return false; @@ -70,10 +71,10 @@ void SStepWidget::Construct(const FArguments& Args) .AutoWidth() [ SNew(SImage) - .Visibility_Lambda([&]() { return StepStatus.Get(EStepStatus::NoStatus) == EStepStatus::NoStatus || !ShowStepStatusIcon.Get(true) ? EVisibility::Collapsed : EVisibility::Visible; }) + .Visibility_Lambda([&]() { return StepStatus.Get(NoStatus) == NoStatus || !ShowStepStatusIcon.Get(true) ? EVisibility::Collapsed : EVisibility::Visible; }) .Image_Lambda([&]() { - switch (StepStatus.Get(EStepStatus::NoStatus)) + switch (StepStatus.Get(NoStatus)) { case NoStatus: case Unknown: @@ -88,7 +89,7 @@ void SStepWidget::Construct(const FArguments& Args) case Success: return FLinterStyle::Get()->GetBrush("Linter.Step.Good"); } - + return FLinterStyle::Get()->GetBrush("Linter.Step.Unknown"); }) ] @@ -135,7 +136,7 @@ void SStepWidget::Construct(const FArguments& Args) [ SNew(SButton) .IsEnabled_Lambda(EnabledBasedOnStepStatus) - .Visibility_Lambda([&]() { return StepStatus.Get(EStepStatus::NoStatus) == EStepStatus::NoStatus ? EVisibility::Collapsed : EVisibility::Visible; }) + .Visibility_Lambda([&]() { return StepStatus.Get(NoStatus) == NoStatus ? EVisibility::Collapsed : EVisibility::Visible; }) .OnClicked_Lambda([&]() { FScopedSlowTask SlowTask(1.0f, StepActionText.Get(FText())); @@ -160,4 +161,4 @@ void SStepWidget::Construct(const FArguments& Args) ] ] ]; -} +} \ No newline at end of file diff --git a/Source/Linter/Public/BatchRenameTool/BatchRenameTool.h b/Source/Linter/Public/BatchRenameTool/BatchRenameTool.h index 1b7d516..8ff0cf5 100644 --- a/Source/Linter/Public/BatchRenameTool/BatchRenameTool.h +++ b/Source/Linter/Public/BatchRenameTool/BatchRenameTool.h @@ -2,14 +2,12 @@ #pragma once -#include "EditorStyleSet.h" #include "Widgets/Input/SEditableTextBox.h" #include "Widgets/Input/SCheckBox.h" #include "Widgets/SWindow.h" #include "Widgets/SUserWidget.h" #include "Widgets/SCompoundWidget.h" #include "Widgets/Layout/SUniformGridPanel.h" -#include "Widgets/Layout/SSeparator.h" #define LOCTEXT_NAMESPACE "LinterBatchRenamer" diff --git a/Source/Linter/Public/LintRule.h b/Source/Linter/Public/LintRule.h index 842f9e5..a41975d 100644 --- a/Source/Linter/Public/LintRule.h +++ b/Source/Linter/Public/LintRule.h @@ -1,9 +1,13 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. + #pragma once #include "CoreMinimal.h" #include "LintRule.generated.h" +class ULintRule; +class ULintRuleSet; + UENUM(BlueprintType) enum class ELintRuleSeverity : uint8 { @@ -25,7 +29,7 @@ struct LINTER_API FLintRuleViolation { } - FLintRuleViolation(UObject* InViolator, TSubclassOf InViolatedRule, const FText InRecommendedAction = FText::GetEmpty()) + FLintRuleViolation(UObject* InViolator, const TSubclassOf InViolatedRule, const FText InRecommendedAction = FText::GetEmpty()) : Violator(InViolator) , ViolatedRule(InViolatedRule) , RecommendedAction(InRecommendedAction) @@ -92,7 +96,7 @@ class LINTER_API ULintRule : public UObject UFUNCTION(BlueprintCallable, Category = "Lint") virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const; - + UFUNCTION(BlueprintCallable, Category = "Display") virtual bool IsRuleSuppressed() const; @@ -110,4 +114,4 @@ class LINTER_API ULintRule : public UObject private: -}; +}; \ No newline at end of file diff --git a/Source/Linter/Public/LintRuleSet.h b/Source/Linter/Public/LintRuleSet.h index d5e16f9..676fc20 100644 --- a/Source/Linter/Public/LintRuleSet.h +++ b/Source/Linter/Public/LintRuleSet.h @@ -2,13 +2,11 @@ #pragma once #include "CoreMinimal.h" +#include "LinterNamingConvention.h" #include "Misc/ScopedSlowTask.h" #include "LintRule.h" - #include "LintRuleSet.generated.h" -class ULinterNamingConvention; - USTRUCT(BlueprintType) struct LINTER_API FLintRuleList { @@ -65,5 +63,4 @@ class LINTER_API ULintRuleSet : public UDataAsset UPROPERTY(EditDefaultsOnly, Category = "Rules") TMap, FLintRuleList> ClassLintRulesMap; -}; - +}; \ No newline at end of file diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h index f42a2b1..cd9f0c9 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h @@ -1,11 +1,13 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. + #pragma once #include "CoreMinimal.h" #include "LintRule.h" - #include "LintRule_Blueprint_Base.generated.h" +class ULintRuleSet; + /** *Comment */ diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h index b6629ef..d63a9e0 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h @@ -1,9 +1,10 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. + #pragma once #include "CoreMinimal.h" #include "LintRule.h" - +#include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Compiles.generated.h" /** @@ -20,4 +21,4 @@ class LINTER_API ULintRule_Blueprint_Compiles : public ULintRule_Blueprint_Base protected: virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; -}; +}; \ No newline at end of file diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h index 6b86d84..d80c3bf 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h @@ -1,9 +1,10 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. + #pragma once #include "CoreMinimal.h" #include "LintRule.h" - +#include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Funcs_MaxNodes.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) @@ -22,4 +23,4 @@ class LINTER_API ULintRule_Blueprint_Funcs_MaxNodes : public ULintRule_Blueprint protected: virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; -}; +}; \ No newline at end of file diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h index 0bc90e6..42a9d65 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h @@ -3,7 +3,7 @@ #include "CoreMinimal.h" #include "LintRule.h" - +#include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Funcs_MustHaveReturn.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) @@ -16,5 +16,4 @@ class LINTER_API ULintRule_Blueprint_Funcs_MustHaveReturn : public ULintRule_Blu protected: virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - -}; +}; \ No newline at end of file diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h index 6978c6e..2a0e28d 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h @@ -3,7 +3,7 @@ #include "CoreMinimal.h" #include "LintRule.h" - +#include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Funcs_PublicDescriptions.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) @@ -17,4 +17,4 @@ class LINTER_API ULintRule_Blueprint_Funcs_PublicDescriptions : public ULintRule protected: virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; -}; +}; \ No newline at end of file diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h index a001355..b66ad76 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h @@ -3,6 +3,7 @@ #include "CoreMinimal.h" #include "LintRule.h" +#include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_LooseNodes.generated.h" @@ -17,4 +18,4 @@ class LINTER_API ULintRule_Blueprint_LooseNodes : public ULintRule_Blueprint_Bas protected: virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; -}; +}; \ No newline at end of file diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h index ffa268d..b206b46 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h @@ -1,9 +1,10 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. + #pragma once #include "CoreMinimal.h" #include "LintRule.h" - +#include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Vars_ConfigCategories.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) @@ -20,4 +21,4 @@ class LINTER_API ULintRule_Blueprint_Vars_ConfigCategories : public ULintRule_Bl protected: virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; -}; +}; \ No newline at end of file diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h index 97dc55c..7024511 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h @@ -3,6 +3,7 @@ #include "CoreMinimal.h" #include "LintRule.h" +#include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Vars_EditableMustHaveTooltip.generated.h" @@ -17,4 +18,4 @@ class LINTER_API ULintRule_Blueprint_Vars_EditableMustHaveTooltip : public ULint protected: virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; -}; +}; \ No newline at end of file diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h index d56d84b..d15d801 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h @@ -3,6 +3,7 @@ #include "CoreMinimal.h" #include "LintRule.h" +#include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Vars_NoConfigFlag.generated.h" @@ -17,4 +18,4 @@ class LINTER_API ULintRule_Blueprint_Vars_NoConfigFlag : public ULintRule_Bluepr protected: virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; -}; +}; \ No newline at end of file diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h index 8342e0a..e8816fa 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h @@ -1,8 +1,10 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. + #pragma once #include "CoreMinimal.h" #include "LintRule.h" +#include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Vars_NonAtomic.generated.h" @@ -19,4 +21,4 @@ class LINTER_API ULintRule_Blueprint_Vars_NonAtomic : public ULintRule_Blueprint protected: virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; -}; +}; \ No newline at end of file diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h index 8219752..c1e6fff 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h @@ -1,9 +1,10 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. + #pragma once #include "CoreMinimal.h" #include "LintRule.h" - +#include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Vars_PluralArrays.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) @@ -17,4 +18,4 @@ class LINTER_API ULintRule_Blueprint_Vars_PluralArrays : public ULintRule_Bluepr protected: virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; -}; +}; \ No newline at end of file diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h index 65b52cc..496f519 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h @@ -1,9 +1,10 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. + #pragma once #include "CoreMinimal.h" #include "LintRule.h" - +#include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Vars_Regex.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) @@ -26,4 +27,4 @@ class LINTER_API ULintRule_Blueprint_Vars_Regex : public ULintRule_Blueprint_Bas protected: virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; -}; +}; \ No newline at end of file diff --git a/Source/Linter/Public/LintRunner.h b/Source/Linter/Public/LintRunner.h index 0150aa3..9fa065e 100644 --- a/Source/Linter/Public/LintRunner.h +++ b/Source/Linter/Public/LintRunner.h @@ -1,11 +1,13 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. + #pragma once #include "CoreMinimal.h" -#include "HAL/ThreadSafeCounter.h" #include "HAL/Runnable.h" -#include "AssetData.h" -#include "Linter.h" + +struct FLintRuleList; +struct FLintRuleViolation; +class ULintRuleSet; class FLintRunner : public FRunnable { @@ -30,5 +32,4 @@ class FLintRunner : public FRunnable static FCriticalSection LintDataUpdateLock; FScopedSlowTask* ParentScopedSlowTask; -}; - +}; \ No newline at end of file diff --git a/Source/Linter/Public/Linter.h b/Source/Linter/Public/Linter.h index a9dfb17..00ec685 100644 --- a/Source/Linter/Public/Linter.h +++ b/Source/Linter/Public/Linter.h @@ -2,8 +2,6 @@ #pragma once -#include "Modules/ModuleManager.h" - #include "Widgets/Docking/SDockTab.h" #include "Styling/SlateStyle.h" diff --git a/Source/Linter/Public/LinterBase.h b/Source/Linter/Public/LinterBase.h index 2a0d36e..66d2bcb 100644 --- a/Source/Linter/Public/LinterBase.h +++ b/Source/Linter/Public/LinterBase.h @@ -3,7 +3,6 @@ #pragma once #include "Internationalization/Regex.h" #include "CoreMinimal.h" -#include "UObject/Class.h" #include "UObject/Object.h" /** Future Notes: diff --git a/Source/Linter/Public/LinterContentBrowserExtensions.h b/Source/Linter/Public/LinterContentBrowserExtensions.h index 463c779..65184f5 100644 --- a/Source/Linter/Public/LinterContentBrowserExtensions.h +++ b/Source/Linter/Public/LinterContentBrowserExtensions.h @@ -2,6 +2,7 @@ #pragma once +class FLinterModule; // Integrate Linter actions into the Content Browser class FLinterContentBrowserExtensions diff --git a/Source/Linter/Public/LinterNamingConvention.h b/Source/Linter/Public/LinterNamingConvention.h index d05f017..c135fb4 100644 --- a/Source/Linter/Public/LinterNamingConvention.h +++ b/Source/Linter/Public/LinterNamingConvention.h @@ -36,7 +36,7 @@ struct LINTER_API FLinterNamingConventionInfo UPROPERTY(EditAnywhere, Category = Default) FString Suffix; - + UPROPERTY(EditAnywhere, Category = Default) FName Variant; }; @@ -65,6 +65,8 @@ class LINTER_API ULinterNamingConvention : public UDataAsset ULinterNamingConvention(const FObjectInitializer& ObjectInitializer); + virtual void PreSave(FObjectPreSaveContext SaveContext) override; + UPROPERTY(EditAnywhere, Category="Conventions", meta = (AllowAbstract = "")) TArray ClassNamingConventions; @@ -73,9 +75,4 @@ class LINTER_API ULinterNamingConvention : public UDataAsset UFUNCTION(Blueprintcallable, Category = "Conventions") void SortConventions(); - -protected: - - - -}; +}; \ No newline at end of file diff --git a/Source/Linter/Public/LinterSettings.h b/Source/Linter/Public/LinterSettings.h index 5b13fac..de0480c 100644 --- a/Source/Linter/Public/LinterSettings.h +++ b/Source/Linter/Public/LinterSettings.h @@ -1,23 +1,24 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once + #include "CoreMinimal.h" #include "UObject/Object.h" #include "LintRuleSet.h" #include "LinterSettings.generated.h" - /** * Implements the settings for the Linter plugin. */ UCLASS(config = Linter, defaultconfig) class ULinterSettings : public UObject { - GENERATED_UCLASS_BODY() - + GENERATED_BODY() + + ULinterSettings(const FObjectInitializer& ObjectInitializer); + public: UPROPERTY(EditAnywhere, config, Category = Settings) - TAssetPtr DefaultLintRuleSet; - -}; + TSoftObjectPtr DefaultLintRuleSet; +}; \ No newline at end of file diff --git a/Source/Linter/Public/TooltipEditor/TooltipStringHelper.h b/Source/Linter/Public/TooltipEditor/TooltipStringHelper.h index 0fc717d..65d7022 100644 --- a/Source/Linter/Public/TooltipEditor/TooltipStringHelper.h +++ b/Source/Linter/Public/TooltipEditor/TooltipStringHelper.h @@ -2,8 +2,6 @@ #include "Internationalization/Regex.h" #include "CoreMinimal.h" -#include "UObject/Class.h" -#include "UObject/Object.h" /** * Helper struct for showing function tooltip widgets diff --git a/Source/Linter/Public/TooltipEditor/TooltipTool.h b/Source/Linter/Public/TooltipEditor/TooltipTool.h index 5711675..4a117c3 100644 --- a/Source/Linter/Public/TooltipEditor/TooltipTool.h +++ b/Source/Linter/Public/TooltipEditor/TooltipTool.h @@ -2,14 +2,10 @@ #pragma once -#include "EditorStyleSet.h" - #include "Widgets/SCompoundWidget.h" #include "Widgets/SUserWidget.h" #include "Widgets/SWindow.h" -#include "Widgets/Layout/SSeparator.h" #include "Widgets/Layout/SUniformGridPanel.h" -#include "Widgets/Input/SEditableTextBox.h" #include "Widgets/Input/SCheckBox.h" #include "Widgets/Input/SComboBox.h" #include "Widgets/Input/SMultiLineEditableTextBox.h" diff --git a/Source/Linter/Public/UI/LintReport.h b/Source/Linter/Public/UI/LintReport.h index f157bd2..5ca7c49 100644 --- a/Source/Linter/Public/UI/LintReport.h +++ b/Source/Linter/Public/UI/LintReport.h @@ -4,7 +4,6 @@ #include "Widgets/SCompoundWidget.h" #include "Widgets/Layout/SScrollBox.h" -#include "LintReportAssetError.h" #include "LintRule.h" diff --git a/Source/Linter/Public/UI/LintReportAssetErrorList.h b/Source/Linter/Public/UI/LintReportAssetErrorList.h index ec8ac0f..3d121b1 100644 --- a/Source/Linter/Public/UI/LintReportAssetErrorList.h +++ b/Source/Linter/Public/UI/LintReportAssetErrorList.h @@ -1,8 +1,11 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once + #include "Widgets/SCompoundWidget.h" #include "Widgets/DeclarativeSyntaxSupport.h" +struct FLintRuleViolation; + class SLintReportAssetErrorList : public SCompoundWidget { public: @@ -17,7 +20,6 @@ class SLintReportAssetErrorList : public SCompoundWidget TAttribute>> RuleViolations; public: - - void Construct(const FArguments& Args); + void Construct(const FArguments& Args); }; \ No newline at end of file diff --git a/Source/Linter/Public/UI/LintReportRuleErrorList.h b/Source/Linter/Public/UI/LintReportRuleErrorList.h index 233d217..988109d 100644 --- a/Source/Linter/Public/UI/LintReportRuleErrorList.h +++ b/Source/Linter/Public/UI/LintReportRuleErrorList.h @@ -1,8 +1,11 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once + #include "Widgets/SCompoundWidget.h" #include "Widgets/DeclarativeSyntaxSupport.h" +struct FLintRuleViolation; + class SLintReportRuleErrorList : public SCompoundWidget { public: @@ -17,7 +20,6 @@ class SLintReportRuleErrorList : public SCompoundWidget TAttribute>> RuleViolations; public: - - void Construct(const FArguments& Args); + void Construct(const FArguments& Args); }; \ No newline at end of file diff --git a/Source/Linter/Public/UI/LintWizard.h b/Source/Linter/Public/UI/LintWizard.h index fee641d..72b1371 100644 --- a/Source/Linter/Public/UI/LintWizard.h +++ b/Source/Linter/Public/UI/LintWizard.h @@ -44,8 +44,8 @@ class LINTER_API SLintWizard : public SCompoundWidget TSharedPtr SelectedRuleSet; bool bOfferPackage = false; - EStepStatus FixUpRedirectorStatus = EStepStatus::Unknown; - EStepStatus SaveAllStatus = EStepStatus::Unknown; + EStepStatus FixUpRedirectorStatus = Unknown; + EStepStatus SaveAllStatus = Unknown; void OnLintReportEntered(); void OnMarketplaceRecommendationsEntered(); diff --git a/Source/Linter/Public/UI/SAssetLinkWidget.h b/Source/Linter/Public/UI/SAssetLinkWidget.h index 6d5d821..71d5e82 100644 --- a/Source/Linter/Public/UI/SAssetLinkWidget.h +++ b/Source/Linter/Public/UI/SAssetLinkWidget.h @@ -1,12 +1,9 @@ // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #pragma once -#include "EditorStyleSet.h" #include "LinterStyle.h" #include "Widgets/DeclarativeSyntaxSupport.h" #include "Widgets/SCompoundWidget.h" -#include "Types/SlateStructs.h" -#include "Misc/ScopedSlowTask.h" class SAssetLinkWidget : public SCompoundWidget { diff --git a/Source/Linter/Public/UI/SStepWidget.h b/Source/Linter/Public/UI/SStepWidget.h index a58560a..6b2f3f8 100644 --- a/Source/Linter/Public/UI/SStepWidget.h +++ b/Source/Linter/Public/UI/SStepWidget.h @@ -1,11 +1,8 @@ // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #pragma once -#include "EditorStyleSet.h" -#include "LinterStyle.h" #include "Widgets/DeclarativeSyntaxSupport.h" #include "Widgets/SCompoundWidget.h" -#include "Types/SlateStructs.h" #include "Misc/ScopedSlowTask.h" @@ -28,7 +25,7 @@ class SStepWidget : public SCompoundWidget public: SLATE_BEGIN_ARGS(SStepWidget) - : _StepStatus(EStepStatus::NoStatus) + : _StepStatus(NoStatus) , _ShowStepStatusIcon(true) { } @@ -62,7 +59,7 @@ class SStepWidget : public SCompoundWidget FOnStepPerformAction OnPerformAction; TAttribute ShowStepStatusIcon; - bool IsStepCompleted(bool bAllowWarning = true); - + bool IsStepCompleted(bool bAllowWarning = true) const; + void Construct(const FArguments& Args); }; \ No newline at end of file diff --git a/Source/MarketplaceLinter/MarketplaceLinter.Build.cs b/Source/MarketplaceLinter/MarketplaceLinter.Build.cs index 55bc9f2..2e58905 100644 --- a/Source/MarketplaceLinter/MarketplaceLinter.Build.cs +++ b/Source/MarketplaceLinter/MarketplaceLinter.Build.cs @@ -6,8 +6,9 @@ public class MarketplaceLinter : ModuleRules { public MarketplaceLinter(ReadOnlyTargetRules Target) : base(Target) { - PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - + PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; + bUseUnity = false; + PublicDependencyModuleNames.AddRange( new string[] { @@ -15,8 +16,8 @@ public MarketplaceLinter(ReadOnlyTargetRules Target) : base(Target) "Linter" } ); - - + + PrivateDependencyModuleNames.AddRange( new string[] { @@ -39,8 +40,8 @@ public MarketplaceLinter(ReadOnlyTargetRules Target) : base(Target) "AppFramework", "DesktopPlatform", "UATHelper" - // ... add private dependencies that you statically link with here ... + // ... add private dependencies that you statically link with here ... } ); } -} +} \ No newline at end of file diff --git a/Source/MarketplaceLinter/Private/MarketplaceLinter.cpp b/Source/MarketplaceLinter/Private/MarketplaceLinter.cpp index ba462fb..7f0bcf3 100644 --- a/Source/MarketplaceLinter/Private/MarketplaceLinter.cpp +++ b/Source/MarketplaceLinter/Private/MarketplaceLinter.cpp @@ -2,11 +2,6 @@ #include "MarketplaceLinter.h" #include "ISettingsModule.h" -#include "Framework/Docking/TabManager.h" -#include "LevelEditor.h" - -#include "Widgets/Input/SButton.h" -#include "Styling/SlateStyle.h" #define LOCTEXT_NAMESPACE "FMarketplaceLinterModule" diff --git a/Source/MarketplaceLinter/Public/MarketplaceLinter.h b/Source/MarketplaceLinter/Public/MarketplaceLinter.h index a47dd34..30e1bcf 100644 --- a/Source/MarketplaceLinter/Public/MarketplaceLinter.h +++ b/Source/MarketplaceLinter/Public/MarketplaceLinter.h @@ -2,8 +2,6 @@ #pragma once -#include "Modules/ModuleManager.h" - DECLARE_LOG_CATEGORY_EXTERN(LogMarketplaceLinter, Verbose, All); class MARKETPLACELINTER_API FMarketplaceLinterModule : public IModuleInterface diff --git a/Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h b/Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h index 55827fe..cc7c3ea 100644 --- a/Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h +++ b/Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h @@ -2,8 +2,6 @@ #pragma once #include "CoreMinimal.h" -#include "UObject/Object.h" -#include "Templates/SharedPointer.h" #include "LinterNamingConvention.h" #include "MarketplaceNamingConvention.generated.h" From d4e4be0bbf9db221021aa9d7421f97177d358063 Mon Sep 17 00:00:00 2001 From: Guy Lundvall <47373221+Drakynfly@users.noreply.github.com> Date: Fri, 9 Sep 2022 19:39:33 -0700 Subject: [PATCH 03/28] small style edits --- .../Private/LintRules/LintRule_Blueprint_LooseNodes.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp index 1946804..117bb69 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp @@ -29,14 +29,12 @@ bool ULintRule_Blueprint_LooseNodes::PassesRule_Internal_Implementation(UObject* { for (const UEdGraphNode* Node : Graph->Nodes) { - if ( - Node->IsAutomaticallyPlacedGhostNode() || + if (Node->IsAutomaticallyPlacedGhostNode() || Node->IsA(UK2Node_Event::StaticClass()) || Node->IsA(UK2Node_FunctionEntry::StaticClass()) || Node->IsA(UK2Node_Knot::StaticClass()) || Node->IsA(UEdGraphNode_Comment::StaticClass()) || - Node->IsA(UK2Node_Tunnel::StaticClass()) - ) + Node->IsA(UK2Node_Tunnel::StaticClass())) { continue; } From a69693551401e46cc8c99813abcfb95b02f8d277 Mon Sep 17 00:00:00 2001 From: Guy Lundvall <47373221+Drakynfly@users.noreply.github.com> Date: Sun, 25 Dec 2022 21:24:21 -0800 Subject: [PATCH 04/28] 5.1 update --- .../BatchRenameTool/BatchRenameTool.cpp | 12 +++--- .../LintRule_Blueprint_Funcs_MaxNodes.cpp | 2 +- ...intRule_Blueprint_Funcs_MustHaveReturn.cpp | 2 +- Source/Linter/Private/LinterStyle.cpp | 2 +- .../Private/TooltipTool/TooltipTool.cpp | 12 +++--- Source/Linter/Private/UI/LintReport.cpp | 10 ++--- .../Private/UI/LintReportAssetDetails.cpp | 4 +- .../Private/UI/LintReportRuleDetails.cpp | 6 +-- Source/Linter/Private/UI/LintWizard.cpp | 38 +++++++++---------- Source/Linter/Private/UI/SStepWidget.cpp | 4 +- .../Linter/Public/TooltipEditor/TooltipTool.h | 8 ++-- 11 files changed, 50 insertions(+), 50 deletions(-) diff --git a/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp b/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp index d6e3904..48754d6 100644 --- a/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp +++ b/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp @@ -35,7 +35,7 @@ FDlgBatchRenameTool::FDlgBatchRenameTool(const TArray Assets) const TSharedPtr DialogWrapper = SNew(SBorder) - .BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder")) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(4.0f) [ SAssignNew(DialogWidget, SDlgBatchRenameTool) @@ -290,14 +290,14 @@ void SDlgBatchRenameTool::Construct(const FArguments& InArgs) .Padding(8.0f, 4.0f, 8.0f, 4.0f) [ SNew(SUniformGridPanel) - .SlotPadding(FEditorStyle::GetMargin("StandardDialog.SlotPadding")) - .MinDesiredSlotWidth(FEditorStyle::GetFloat("StandardDialog.MinDesiredSlotWidth")) - .MinDesiredSlotHeight(FEditorStyle::GetFloat("StandardDialog.MinDesiredSlotHeight")) + .SlotPadding(FAppStyle::GetMargin("StandardDialog.SlotPadding")) + .MinDesiredSlotWidth(FAppStyle::GetFloat("StandardDialog.MinDesiredSlotWidth")) + .MinDesiredSlotHeight(FAppStyle::GetFloat("StandardDialog.MinDesiredSlotHeight")) + SUniformGridPanel::Slot(0, 0) [ SNew(SButton) .HAlign(HAlign_Center) - .ContentPadding(FEditorStyle::GetMargin("StandardDialog.ContentPadding")) + .ContentPadding(FAppStyle::GetMargin("StandardDialog.ContentPadding")) .OnClicked(this, &SDlgBatchRenameTool::OnButtonClick, FDlgBatchRenameTool::Confirm) .Text(LOCTEXT("SkeletonMergeOk", "OK")) ] @@ -305,7 +305,7 @@ void SDlgBatchRenameTool::Construct(const FArguments& InArgs) [ SNew(SButton) .HAlign(HAlign_Center) - .ContentPadding(FEditorStyle::GetMargin("StandardDialog.ContentPadding")) + .ContentPadding(FAppStyle::GetMargin("StandardDialog.ContentPadding")) .OnClicked(this, &SDlgBatchRenameTool::OnButtonClick, FDlgBatchRenameTool::Cancel) .Text(LOCTEXT("SkeletonMergeCancel", "Cancel")) ] diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp index 0c61626..338f856 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp @@ -68,7 +68,7 @@ bool ULintRule_Blueprint_Funcs_MaxNodes::PassesRule_Internal_Implementation(UObj const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintFuncsMaxNodes", "{Previous}{WhiteSpace}Please simply function {FuncName} as it has {Nodes} nodes when we want a max of {MaxNodes}."); FText AllFixes; - for (const auto FunctionGraph : Blueprint->FunctionGraphs) + for (auto&& FunctionGraph : Blueprint->FunctionGraphs) { if (FunctionGraph->GetFName() != UEdGraphSchema_K2::FN_UserConstructionScript) { diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp index 1f7b7b0..e06dbdd 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp @@ -34,7 +34,7 @@ bool ULintRule_Blueprint_Funcs_MustHaveReturn::PassesRule_Internal_Implementatio static const FName DefaultAnimGraphName("AnimGraph"); - for (const auto FunctionGraph : Blueprint->FunctionGraphs) + for (auto&& FunctionGraph : Blueprint->FunctionGraphs) { if (FunctionGraph->GetFName() != UEdGraphSchema_K2::FN_UserConstructionScript && FunctionGraph->GetFName() != DefaultAnimGraphName) diff --git a/Source/Linter/Private/LinterStyle.cpp b/Source/Linter/Private/LinterStyle.cpp index 6e1480e..80ee20e 100644 --- a/Source/Linter/Private/LinterStyle.cpp +++ b/Source/Linter/Private/LinterStyle.cpp @@ -81,7 +81,7 @@ void FLinterStyle::Initialize() StyleSet->Set("Linter.Padding", 2.0f); // PaCK Fonts - const FTextBlockStyle NormalText = FEditorStyle::GetWidgetStyle("NormalText"); + const FTextBlockStyle NormalText = FAppStyle::GetWidgetStyle("NormalText"); FTextBlockStyle NameText = FTextBlockStyle(NormalText) .SetColorAndOpacity(FLinearColor(0.9f, 0.9f, 0.9f)); diff --git a/Source/Linter/Private/TooltipTool/TooltipTool.cpp b/Source/Linter/Private/TooltipTool/TooltipTool.cpp index 6878192..6336d86 100644 --- a/Source/Linter/Private/TooltipTool/TooltipTool.cpp +++ b/Source/Linter/Private/TooltipTool/TooltipTool.cpp @@ -48,7 +48,7 @@ FTooltipTool::FTooltipTool(const TArray Assets) const TSharedPtr DialogWrapper = SNew(SBorder) - .BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder")) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(4.0f) [ SAssignNew(DialogWidget, STooltipTool) @@ -166,7 +166,7 @@ void STooltipTool::Construct(const FArguments& InArgs) [&]{ // Save package here if SCC is enabled because the user can use SCC to revert a change TArray OutermostPackagesToSave; - for (const auto Asset : Blueprints.Get()) + for (auto&& Asset : Blueprints.Get()) { OutermostPackagesToSave.Add(Asset->GetPackage()); } @@ -216,7 +216,7 @@ void STooltipTool::Construct(const FArguments& InArgs) .AutoWidth() [ SNew(SImage) - .Image(FEditorStyle::GetBrush(TEXT("Icons.Error"))) + .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) .Visibility_Lambda([Item] {return Item.IsValid() ? (Item->HasMetaData(FBlueprintMetadata::MD_Tooltip) && Item->GetMetaData(FBlueprintMetadata::MD_Tooltip).Len() > 0 ? EVisibility::Collapsed : EVisibility::HitTestInvisible) : EVisibility::Collapsed; }) ] + SHorizontalBox::Slot() @@ -340,7 +340,7 @@ void STooltipTool::Construct(const FArguments& InArgs) .AutoWidth() [ SNew(SImage) - .Image(FEditorStyle::GetBrush(TEXT("Icons.Error"))) + .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) .Visibility_Lambda([Item] {return (Item.IsValid() && Item->FunctionEntryNode != nullptr&& !Item->FunctionEntryNode->MetaData.ToolTip.IsEmptyOrWhitespace()) ? EVisibility::Collapsed : EVisibility::Visible; }) ] + SHorizontalBox::Slot() @@ -501,7 +501,7 @@ void STooltipTool::Construct(const FArguments& InArgs) .AutoWidth() [ SNew(SImage) - .Image(FEditorStyle::GetBrush(TEXT("Icons.Error"))) + .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) .Visibility_Lambda([Item] {return (Item.IsValid() && !Item->Tooltip.IsEmptyOrWhitespace()) ? EVisibility::Collapsed : EVisibility::Visible; }) ] + SHorizontalBox::Slot() @@ -572,7 +572,7 @@ void STooltipTool::Construct(const FArguments& InArgs) .AutoWidth() [ SNew(SImage) - .Image(FEditorStyle::GetBrush(TEXT("Icons.Error"))) + .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) .Visibility_Lambda([Item] {return (Item.IsValid() && !Item->Tooltip.IsEmptyOrWhitespace()) ? EVisibility::Collapsed : EVisibility::Visible; }) ] + SHorizontalBox::Slot() diff --git a/Source/Linter/Private/UI/LintReport.cpp b/Source/Linter/Private/UI/LintReport.cpp index 3c01776..d185cb6 100644 --- a/Source/Linter/Private/UI/LintReport.cpp +++ b/Source/Linter/Private/UI/LintReport.cpp @@ -176,12 +176,12 @@ void SLintReport::Construct(const FArguments& Args) .VAlign(VAlign_Top) [ SNew(SBorder) - .BorderImage(FEditorStyle::GetBrush("NoBorder")) + .BorderImage(FAppStyle::GetBrush("NoBorder")) .Padding(FMargin(4.0f, 0.0f, 4.0f, 2.0f)) //.Visibility_Lambda([&]() { return AssetErrorLists.Num() > 0 ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed; }) [ SNew(SBorder) - .BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder")) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(FMargin(2.0f, 0.0f, 2.0f, 2.0f)) [ @@ -194,8 +194,8 @@ void SLintReport::Construct(const FArguments& Args) [ SAssignNew( ViewOptionsComboButton, SComboButton ) .ContentPadding(0) - .ForegroundColor_Lambda([&]() { return ViewOptionsComboButton->IsHovered() ? FEditorStyle::GetSlateColor("InvertedForeground") : FEditorStyle::GetSlateColor("DefaultForeground"); }) - .ButtonStyle( FEditorStyle::Get(), "ToggleButton" ) // Use the tool bar item style for this button + .ForegroundColor_Lambda([&]() { return ViewOptionsComboButton->IsHovered() ? FAppStyle::GetSlateColor("InvertedForeground") : FAppStyle::GetSlateColor("DefaultForeground"); }) + .ButtonStyle( FAppStyle::Get(), "ToggleButton" ) // Use the tool bar item style for this button .OnGetMenuContent( this, &SLintReport::GetViewButtonContent ) .ButtonContent() [ @@ -204,7 +204,7 @@ void SLintReport::Construct(const FArguments& Args) .AutoWidth() .VAlign(VAlign_Center) [ - SNew(SImage).Image( FEditorStyle::GetBrush("GenericViewButton") ) + SNew(SImage).Image( FAppStyle::GetBrush("GenericViewButton") ) ] +SHorizontalBox::Slot() diff --git a/Source/Linter/Private/UI/LintReportAssetDetails.cpp b/Source/Linter/Private/UI/LintReportAssetDetails.cpp index 2f82c39..ffac9e6 100644 --- a/Source/Linter/Private/UI/LintReportAssetDetails.cpp +++ b/Source/Linter/Private/UI/LintReportAssetDetails.cpp @@ -58,11 +58,11 @@ void SLintReportAssetDetails::Construct(const FArguments& Args) ChildSlot [ SNew(SBorder) - .BorderImage(FEditorStyle::GetBrush("NoBorder")) + .BorderImage(FAppStyle::GetBrush("NoBorder")) .Padding(PaddingAmount) [ SNew(SBorder) - .BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder")) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(PaddingAmount) [ SNew(SVerticalBox) diff --git a/Source/Linter/Private/UI/LintReportRuleDetails.cpp b/Source/Linter/Private/UI/LintReportRuleDetails.cpp index c01e319..f67e9f6 100644 --- a/Source/Linter/Private/UI/LintReportRuleDetails.cpp +++ b/Source/Linter/Private/UI/LintReportRuleDetails.cpp @@ -69,11 +69,11 @@ void SLintReportRuleDetails::Construct(const FArguments& Args) ChildSlot [ SNew(SBorder) - .BorderImage(FEditorStyle::GetBrush("NoBorder")) + .BorderImage(FAppStyle::GetBrush("NoBorder")) .Padding(PaddingAmount) [ SNew(SBorder) - .BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder")) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(PaddingAmount) [ SNew(SVerticalBox) @@ -164,7 +164,7 @@ void SLintReportRuleDetails::Construct(const FArguments& Args) { AssetDatas.Push(RuleViolation->ViolatorAssetData); } - + ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); }) ] diff --git a/Source/Linter/Private/UI/LintWizard.cpp b/Source/Linter/Private/UI/LintWizard.cpp index d0364cb..de2b941 100644 --- a/Source/Linter/Private/UI/LintWizard.cpp +++ b/Source/Linter/Private/UI/LintWizard.cpp @@ -71,7 +71,7 @@ void SLintWizard::Construct(const FArguments& InArgs) [ SNew(SBorder) .Padding(18) - .BorderImage(FEditorStyle::GetBrush("Docking.Tab.ContentAreaBrush")) + .BorderImage(FAppStyle::GetBrush("Docking.Tab.ContentAreaBrush")) [ SNew(SVerticalBox) + SVerticalBox::Slot() @@ -79,11 +79,11 @@ void SLintWizard::Construct(const FArguments& InArgs) SAssignNew(MainWizard, SWizard) .ShowPageList(false) .ShowCancelButton(false) - .ButtonStyle(FEditorStyle::Get(), "FlatButton.Default") - .CancelButtonStyle(FEditorStyle::Get(), "FlatButton.Default") - .FinishButtonStyle(FEditorStyle::Get(), "FlatButton.Success") - .ButtonTextStyle(FEditorStyle::Get(), "LargeText") - //.ForegroundColor(FEditorStyle::Get().GetSlateColor("WhiteBrush")) + .ButtonStyle(FAppStyle::Get(), "FlatButton.Default") + .CancelButtonStyle(FAppStyle::Get(), "FlatButton.Default") + .FinishButtonStyle(FAppStyle::Get(), "FlatButton.Success") + .ButtonTextStyle(FAppStyle::Get(), "LargeText") + //.ForegroundColor(FAppStyle::Get().GetSlateColor("WhiteBrush")) .CanFinish(true) .FinishButtonText(LOCTEXT("FinishButtonText", "Close")) .OnFinished_Lambda([&]() @@ -100,7 +100,7 @@ void SLintWizard::Construct(const FArguments& InArgs) .Padding(0) [ SNew(STextBlock) - .TextStyle( FEditorStyle::Get(), "NewClassDialog.PageTitle" ) + .TextStyle( FAppStyle::Get(), "NewClassDialog.PageTitle" ) .Text(LOCTEXT("LinterSelectionTitle", "Linter Rule Set Selection")) ] // Title spacer @@ -147,7 +147,7 @@ void SLintWizard::Construct(const FArguments& InArgs) .Padding(0) [ SNew(STextBlock) - .TextStyle( FEditorStyle::Get(), "NewClassDialog.PageTitle" ) + .TextStyle( FAppStyle::Get(), "NewClassDialog.PageTitle" ) .Text(LOCTEXT("LinterReportTitle", "Lint Report")) ] // Marketplace No Errors Required Text @@ -188,7 +188,7 @@ void SLintWizard::Construct(const FArguments& InArgs) .Padding(0) [ SNew(STextBlock) - .TextStyle( FEditorStyle::Get(), "NewClassDialog.PageTitle" ) + .TextStyle( FAppStyle::Get(), "NewClassDialog.PageTitle" ) .Text(LOCTEXT("MarketplaceInfoTitle", "Marketplace Recommendations")) ] // Title spacer @@ -211,11 +211,11 @@ void SLintWizard::Construct(const FArguments& InArgs) .AutoHeight() [ SNew(SBorder) - .BorderImage(FEditorStyle::GetBrush("NoBorder")) + .BorderImage(FAppStyle::GetBrush("NoBorder")) .Padding(PaddingAmount) [ SNew(SBorder) - .BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder")) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(PaddingAmount) [ SNew(SHorizontalBox) @@ -277,7 +277,7 @@ void SLintWizard::Construct(const FArguments& InArgs) TArray 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...")); @@ -287,7 +287,7 @@ void SLintWizard::Construct(const FArguments& InArgs) { // Transform Objects array to ObjectRedirectors array TArray Redirectors; - for (const auto Object : Objects) + for (auto&& Object : Objects) { auto Redirector = CastChecked(Object); Redirectors.Add(Redirector); @@ -318,12 +318,12 @@ void SLintWizard::Construct(const FArguments& InArgs) .Padding(PaddingAmount) [ SNew(SBorder) - .BorderImage(FEditorStyle::GetBrush("NoBorder")) + .BorderImage(FAppStyle::GetBrush("NoBorder")) .Padding(PaddingAmount) .Visibility_Lambda([&](){ return (MapAssetDataList.Num() > 0) ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed; }) [ SNew(SBorder) - .BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder")) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(PaddingAmount) [ SNew(SVerticalBox) @@ -425,11 +425,11 @@ void SLintWizard::Construct(const FArguments& InArgs) [ SNew(SBorder) .Visibility(EVisibility::Collapsed) - .BorderImage(FEditorStyle::GetBrush("NoBorder")) + .BorderImage(FAppStyle::GetBrush("NoBorder")) .Padding(PaddingAmount) [ SNew(SBorder) - .BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder")) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(PaddingAmount) [ SNew(SVerticalBox) @@ -518,7 +518,7 @@ void SLintWizard::Construct(const FArguments& InArgs) FString CommandLine = FString::Printf(TEXT("ZipProjectUp %s -project=\"%s\" -install=\"%s\""), UATFlags, *ProjectPath, *FinalFileName); IUATHelperModule::Get().CreateUatTask(CommandLine, PlatformName, LOCTEXT("ZipTaskName", "Zipping Up Project"), - LOCTEXT("ZipTaskShortName", "Zip Project Task"), FEditorStyle::GetBrush(TEXT("MainFrame.CookContent"))); + LOCTEXT("ZipTaskShortName", "Zip Project Task"), FAppStyle::GetBrush(TEXT("MainFrame.CookContent"))); } FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab"))->RequestCloseTab(); @@ -547,7 +547,7 @@ void SLintWizard::Construct(const FArguments& InArgs) FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); TArray AssetDatas; FARFilter Filter; - Filter.ClassNames.Add(UWorld::StaticClass()->GetFName()); + Filter.ClassPaths.Add(FTopLevelAssetPath(UWorld::StaticClass())); Filter.bRecursivePaths = true; Filter.PackagePaths.Add(TEXT("/Game")); AssetRegistryModule.Get().GetAssets(Filter, AssetDatas); diff --git a/Source/Linter/Private/UI/SStepWidget.cpp b/Source/Linter/Private/UI/SStepWidget.cpp index 11667da..9893c51 100644 --- a/Source/Linter/Private/UI/SStepWidget.cpp +++ b/Source/Linter/Private/UI/SStepWidget.cpp @@ -57,11 +57,11 @@ void SStepWidget::Construct(const FArguments& Args) ChildSlot [ SNew(SBorder) - .BorderImage(FEditorStyle::GetBrush("NoBorder")) + .BorderImage(FAppStyle::GetBrush("NoBorder")) .Padding(PaddingAmount) [ SNew(SBorder) - .BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder")) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(PaddingAmount) [ SNew(SHorizontalBox) diff --git a/Source/Linter/Public/TooltipEditor/TooltipTool.h b/Source/Linter/Public/TooltipEditor/TooltipTool.h index 4a117c3..70ba714 100644 --- a/Source/Linter/Public/TooltipEditor/TooltipTool.h +++ b/Source/Linter/Public/TooltipEditor/TooltipTool.h @@ -10,7 +10,7 @@ #include "Widgets/Input/SComboBox.h" #include "Widgets/Input/SMultiLineEditableTextBox.h" #include "Widgets/Views/SListView.h" -#include "AssetData.h" +#include "AssetRegistry/AssetData.h" #include "Engine/Blueprint.h" #include "K2Node_FunctionEntry.h" #include "K2Node_FunctionResult.h" @@ -124,8 +124,8 @@ class STooltipTool : public SCompoundWidget public: - - + + TAttribute>> Blueprints; TSharedPtr>> BlueprintComboBox; @@ -139,7 +139,7 @@ class STooltipTool : public SCompoundWidget TArray> FunctionOutputDescriptions; TSharedPtr>> FunctionOutputListView; - + TArray> Members; TSharedPtr>> MemberListView; TSharedPtr VariableTooltipEditableTextBox; From 3657324522f581b01d107810801f7b80afad9b12 Mon Sep 17 00:00:00 2001 From: Guy Lundvall <47373221+Drakynfly@users.noreply.github.com> Date: Fri, 3 Feb 2023 23:05:23 -0800 Subject: [PATCH 05/28] remove unity disabling --- Source/GamemakinLinter/GamemakinLinter.Build.cs | 1 - Source/Linter/Linter.Build.cs | 1 - Source/MarketplaceLinter/MarketplaceLinter.Build.cs | 1 - 3 files changed, 3 deletions(-) diff --git a/Source/GamemakinLinter/GamemakinLinter.Build.cs b/Source/GamemakinLinter/GamemakinLinter.Build.cs index d183647..a291e29 100644 --- a/Source/GamemakinLinter/GamemakinLinter.Build.cs +++ b/Source/GamemakinLinter/GamemakinLinter.Build.cs @@ -7,7 +7,6 @@ public class GamemakinLinter : ModuleRules public GamemakinLinter(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - bUseUnity = false; PublicDependencyModuleNames.AddRange( new string[] diff --git a/Source/Linter/Linter.Build.cs b/Source/Linter/Linter.Build.cs index 8b99ca5..161d0e9 100644 --- a/Source/Linter/Linter.Build.cs +++ b/Source/Linter/Linter.Build.cs @@ -7,7 +7,6 @@ public class Linter : ModuleRules public Linter(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - bUseUnity = false; PublicDependencyModuleNames.AddRange( new string[] diff --git a/Source/MarketplaceLinter/MarketplaceLinter.Build.cs b/Source/MarketplaceLinter/MarketplaceLinter.Build.cs index 2e58905..289619c 100644 --- a/Source/MarketplaceLinter/MarketplaceLinter.Build.cs +++ b/Source/MarketplaceLinter/MarketplaceLinter.Build.cs @@ -7,7 +7,6 @@ public class MarketplaceLinter : ModuleRules public MarketplaceLinter(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - bUseUnity = false; PublicDependencyModuleNames.AddRange( new string[] From ab050f412705d4ebf43b4c2674e0fed3cff8d6ac Mon Sep 17 00:00:00 2001 From: Guy Lundvall <47373221+Drakynfly@users.noreply.github.com> Date: Wed, 8 Feb 2023 02:04:28 -0800 Subject: [PATCH 06/28] fix localization issues --- Source/Linter/Private/UI/LintWizard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Linter/Private/UI/LintWizard.cpp b/Source/Linter/Private/UI/LintWizard.cpp index de2b941..9e47501 100644 --- a/Source/Linter/Private/UI/LintWizard.cpp +++ b/Source/Linter/Private/UI/LintWizard.cpp @@ -293,7 +293,7 @@ void SLintWizard::Construct(const FArguments& InArgs) Redirectors.Add(Redirector); } - ScopedSlowTask.EnterProgressFrame(0.25f, LOCTEXT("Linter.FixUpRedirects.LoadingRedirectors", "Fixing up redirectors...")); + ScopedSlowTask.EnterProgressFrame(0.25f, LOCTEXT("Linter.FixUpRedirects.FixingRedirectors", "Fixing up redirectors...")); // Load the asset tools module FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked(TEXT("AssetTools")); From 0588656f0c176b7094f3a1a20c088286c0888bb6 Mon Sep 17 00:00:00 2001 From: Guy Lundvall <47373221+Drakynfly@users.noreply.github.com> Date: Mon, 20 Feb 2023 17:37:01 -0800 Subject: [PATCH 07/28] remove usage of core minimal --- Source/GamemakinLinter/Public/GamemakinNamingConvention.h | 2 +- Source/Linter/Public/AnyObject_LinterDummyClass.h | 2 +- Source/Linter/Public/LintRule.h | 2 +- Source/Linter/Public/LintRuleSet.h | 2 +- Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h | 2 +- .../Linter/Public/LintRules/LintRule_Blueprint_Compiles.h | 2 +- .../Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h | 2 +- .../LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h | 2 +- .../LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h | 2 +- .../Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h | 2 +- .../LintRules/LintRule_Blueprint_Vars_ConfigCategories.h | 2 +- .../LintRule_Blueprint_Vars_EditableMustHaveTooltip.h | 2 +- .../Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h | 2 +- .../Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h | 2 +- .../Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h | 2 +- .../Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h | 2 +- Source/Linter/Public/LintRules/LintRule_Collection.h | 2 +- .../Public/LintRules/LintRule_IsNamedCorrectly_Base.h | 2 +- .../LintRules/LintRule_ParticleSystem_EmitterNameRegex.h | 2 +- .../Linter/Public/LintRules/LintRule_Path_DisallowNames.h | 2 +- Source/Linter/Public/LintRules/LintRule_Path_IsNotTooLong.h | 2 +- Source/Linter/Public/LintRules/LintRule_Path_NoTopLevel.h | 2 +- Source/Linter/Public/LintRules/LintRule_Path_Regex.h | 2 +- .../Linter/Public/LintRules/LintRule_SoundWave_SampleRate.h | 2 +- .../Linter/Public/LintRules/LintRule_StaticMesh_ValidUVs.h | 2 +- .../Public/LintRules/LintRule_Texture_Size_NotTooBig.h | 2 +- .../Public/LintRules/LintRule_Texture_Size_PowerOfTwo.h | 2 +- Source/Linter/Public/LintRunner.h | 2 +- Source/Linter/Public/LinterBase.h | 6 +++--- Source/Linter/Public/LinterNamingConvention.h | 2 +- Source/Linter/Public/LinterSettings.h | 2 +- Source/Linter/Public/TooltipEditor/TooltipStringHelper.h | 2 +- Source/Linter/Public/UI/LintWizard.h | 4 ++-- .../MarketplaceLinter/Public/MarketplaceNamingConvention.h | 2 +- 34 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Source/GamemakinLinter/Public/GamemakinNamingConvention.h b/Source/GamemakinLinter/Public/GamemakinNamingConvention.h index 38f9aa9..46237d8 100644 --- a/Source/GamemakinLinter/Public/GamemakinNamingConvention.h +++ b/Source/GamemakinLinter/Public/GamemakinNamingConvention.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LinterNamingConvention.h" #include "GamemakinNamingConvention.generated.h" diff --git a/Source/Linter/Public/AnyObject_LinterDummyClass.h b/Source/Linter/Public/AnyObject_LinterDummyClass.h index 5d697bf..b7e188a 100644 --- a/Source/Linter/Public/AnyObject_LinterDummyClass.h +++ b/Source/Linter/Public/AnyObject_LinterDummyClass.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "AnyObject_LinterDummyClass.generated.h" UCLASS(BlueprintType, Blueprintable) diff --git a/Source/Linter/Public/LintRule.h b/Source/Linter/Public/LintRule.h index a41975d..ab8730a 100644 --- a/Source/Linter/Public/LintRule.h +++ b/Source/Linter/Public/LintRule.h @@ -2,7 +2,7 @@ #pragma once -#include "CoreMinimal.h" + #include "LintRule.generated.h" class ULintRule; diff --git a/Source/Linter/Public/LintRuleSet.h b/Source/Linter/Public/LintRuleSet.h index 676fc20..49cbde6 100644 --- a/Source/Linter/Public/LintRuleSet.h +++ b/Source/Linter/Public/LintRuleSet.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LinterNamingConvention.h" #include "Misc/ScopedSlowTask.h" #include "LintRule.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h index cd9f0c9..b4d1b41 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h @@ -2,7 +2,7 @@ #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Blueprint_Base.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h index d63a9e0..32d59ad 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h @@ -2,7 +2,7 @@ #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Compiles.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h index d80c3bf..d01aa07 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h @@ -2,7 +2,7 @@ #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Funcs_MaxNodes.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h index 42a9d65..2022592 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Funcs_MustHaveReturn.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h index 2a0e28d..d19b5bd 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Funcs_PublicDescriptions.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h index b66ad76..706e648 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Blueprint_Base.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h index b206b46..69246cb 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h @@ -2,7 +2,7 @@ #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Vars_ConfigCategories.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h index 7024511..d74fce4 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Blueprint_Base.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h index d15d801..f97849e 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Blueprint_Base.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h index e8816fa..d63a6fc 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h @@ -2,7 +2,7 @@ #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Blueprint_Base.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h index c1e6fff..262b5cd 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h @@ -2,7 +2,7 @@ #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Vars_PluralArrays.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h index 496f519..d31dae4 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h @@ -2,7 +2,7 @@ #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Blueprint_Base.h" #include "LintRule_Blueprint_Vars_Regex.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Collection.h b/Source/Linter/Public/LintRules/LintRule_Collection.h index cbd39a0..408ca2f 100644 --- a/Source/Linter/Public/LintRules/LintRule_Collection.h +++ b/Source/Linter/Public/LintRules/LintRule_Collection.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Collection.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_IsNamedCorrectly_Base.h b/Source/Linter/Public/LintRules/LintRule_IsNamedCorrectly_Base.h index abb820a..95b611c 100644 --- a/Source/Linter/Public/LintRules/LintRule_IsNamedCorrectly_Base.h +++ b/Source/Linter/Public/LintRules/LintRule_IsNamedCorrectly_Base.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_IsNamedCorrectly_Base.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_ParticleSystem_EmitterNameRegex.h b/Source/Linter/Public/LintRules/LintRule_ParticleSystem_EmitterNameRegex.h index 73069a6..4173b05 100644 --- a/Source/Linter/Public/LintRules/LintRule_ParticleSystem_EmitterNameRegex.h +++ b/Source/Linter/Public/LintRules/LintRule_ParticleSystem_EmitterNameRegex.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_ParticleSystem_EmitterNameRegex.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Path_DisallowNames.h b/Source/Linter/Public/LintRules/LintRule_Path_DisallowNames.h index ec5d2ad..8492417 100644 --- a/Source/Linter/Public/LintRules/LintRule_Path_DisallowNames.h +++ b/Source/Linter/Public/LintRules/LintRule_Path_DisallowNames.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Path_DisallowNames.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Path_IsNotTooLong.h b/Source/Linter/Public/LintRules/LintRule_Path_IsNotTooLong.h index 36be61e..79375e8 100644 --- a/Source/Linter/Public/LintRules/LintRule_Path_IsNotTooLong.h +++ b/Source/Linter/Public/LintRules/LintRule_Path_IsNotTooLong.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Path_IsNotTooLong.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Path_NoTopLevel.h b/Source/Linter/Public/LintRules/LintRule_Path_NoTopLevel.h index 8c423e9..ca3d0b3 100644 --- a/Source/Linter/Public/LintRules/LintRule_Path_NoTopLevel.h +++ b/Source/Linter/Public/LintRules/LintRule_Path_NoTopLevel.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Path_NoTopLevel.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Path_Regex.h b/Source/Linter/Public/LintRules/LintRule_Path_Regex.h index e12c751..ef70cd1 100644 --- a/Source/Linter/Public/LintRules/LintRule_Path_Regex.h +++ b/Source/Linter/Public/LintRules/LintRule_Path_Regex.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Path_Regex.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_SoundWave_SampleRate.h b/Source/Linter/Public/LintRules/LintRule_SoundWave_SampleRate.h index a801903..a816c2b 100644 --- a/Source/Linter/Public/LintRules/LintRule_SoundWave_SampleRate.h +++ b/Source/Linter/Public/LintRules/LintRule_SoundWave_SampleRate.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_SoundWave_SampleRate.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_StaticMesh_ValidUVs.h b/Source/Linter/Public/LintRules/LintRule_StaticMesh_ValidUVs.h index d794446..fd755fb 100644 --- a/Source/Linter/Public/LintRules/LintRule_StaticMesh_ValidUVs.h +++ b/Source/Linter/Public/LintRules/LintRule_StaticMesh_ValidUVs.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_StaticMesh_ValidUVs.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Texture_Size_NotTooBig.h b/Source/Linter/Public/LintRules/LintRule_Texture_Size_NotTooBig.h index 4b8ae66..273e57f 100644 --- a/Source/Linter/Public/LintRules/LintRule_Texture_Size_NotTooBig.h +++ b/Source/Linter/Public/LintRules/LintRule_Texture_Size_NotTooBig.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "LintRule_Texture_Size_NotTooBig.generated.h" diff --git a/Source/Linter/Public/LintRules/LintRule_Texture_Size_PowerOfTwo.h b/Source/Linter/Public/LintRules/LintRule_Texture_Size_PowerOfTwo.h index d5b4e67..feb482c 100644 --- a/Source/Linter/Public/LintRules/LintRule_Texture_Size_PowerOfTwo.h +++ b/Source/Linter/Public/LintRules/LintRule_Texture_Size_PowerOfTwo.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LintRule.h" #include "Engine/TextureDefines.h" diff --git a/Source/Linter/Public/LintRunner.h b/Source/Linter/Public/LintRunner.h index 9fa065e..4bc506d 100644 --- a/Source/Linter/Public/LintRunner.h +++ b/Source/Linter/Public/LintRunner.h @@ -2,7 +2,7 @@ #pragma once -#include "CoreMinimal.h" + #include "HAL/Runnable.h" struct FLintRuleList; diff --git a/Source/Linter/Public/LinterBase.h b/Source/Linter/Public/LinterBase.h index 66d2bcb..3a8c32d 100644 --- a/Source/Linter/Public/LinterBase.h +++ b/Source/Linter/Public/LinterBase.h @@ -2,7 +2,7 @@ #pragma once #include "Internationalization/Regex.h" -#include "CoreMinimal.h" + #include "UObject/Object.h" /** Future Notes: @@ -54,7 +54,7 @@ struct LINTER_API FLinterAssetErrorList , SuggestedAssetName(InSuggestedAssetName) , Errors(InErrors) , Warnings(InWarnings) - + { } @@ -78,7 +78,7 @@ struct LINTER_API FLinterAssetErrorList } }; -/* Linter was originally built to store its data on a per-asset basis. +/* Linter was originally built to store its data on a per-asset basis. * After Epic's purchase, UI needed a way to store data on a per-rule basis. * The following structs help out the LinterManager populate a per-rule list after Linting is complete. */ diff --git a/Source/Linter/Public/LinterNamingConvention.h b/Source/Linter/Public/LinterNamingConvention.h index c135fb4..c6ee547 100644 --- a/Source/Linter/Public/LinterNamingConvention.h +++ b/Source/Linter/Public/LinterNamingConvention.h @@ -1,7 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "UObject/Object.h" #include "Templates/SharedPointer.h" #include "IDetailCustomization.h" diff --git a/Source/Linter/Public/LinterSettings.h b/Source/Linter/Public/LinterSettings.h index de0480c..f44ad81 100644 --- a/Source/Linter/Public/LinterSettings.h +++ b/Source/Linter/Public/LinterSettings.h @@ -2,7 +2,7 @@ #pragma once -#include "CoreMinimal.h" + #include "UObject/Object.h" #include "LintRuleSet.h" #include "LinterSettings.generated.h" diff --git a/Source/Linter/Public/TooltipEditor/TooltipStringHelper.h b/Source/Linter/Public/TooltipEditor/TooltipStringHelper.h index 65d7022..5d41e74 100644 --- a/Source/Linter/Public/TooltipEditor/TooltipStringHelper.h +++ b/Source/Linter/Public/TooltipEditor/TooltipStringHelper.h @@ -1,7 +1,7 @@ #pragma once #include "Internationalization/Regex.h" -#include "CoreMinimal.h" + /** * Helper struct for showing function tooltip widgets diff --git a/Source/Linter/Public/UI/LintWizard.h b/Source/Linter/Public/UI/LintWizard.h index 72b1371..a4506ae 100644 --- a/Source/Linter/Public/UI/LintWizard.h +++ b/Source/Linter/Public/UI/LintWizard.h @@ -2,7 +2,7 @@ #pragma once -#include "CoreMinimal.h" + #include "Widgets/SCompoundWidget.h" #include "Widgets/Workflow/SWizard.h" #include "UI/SStepWidget.h" @@ -10,7 +10,7 @@ #include "LintReport.h" /** - * + * */ class LINTER_API SLintWizard : public SCompoundWidget { diff --git a/Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h b/Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h index cc7c3ea..8eb7caa 100644 --- a/Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h +++ b/Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h @@ -1,7 +1,7 @@ // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #pragma once -#include "CoreMinimal.h" + #include "LinterNamingConvention.h" #include "MarketplaceNamingConvention.generated.h" From bee2986631ef753960b5313f86e4b1fbd1f3323f Mon Sep 17 00:00:00 2001 From: Guy Lundvall <47373221+Drakynfly@users.noreply.github.com> Date: Mon, 6 Mar 2023 23:24:05 -0800 Subject: [PATCH 08/28] fix build.cs's --- Source/GamemakinLinter/GamemakinLinter.Build.cs | 11 +++-------- Source/Linter/Linter.Build.cs | 7 +++---- Source/MarketplaceLinter/MarketplaceLinter.Build.cs | 5 ++--- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Source/GamemakinLinter/GamemakinLinter.Build.cs b/Source/GamemakinLinter/GamemakinLinter.Build.cs index d183647..82cf534 100644 --- a/Source/GamemakinLinter/GamemakinLinter.Build.cs +++ b/Source/GamemakinLinter/GamemakinLinter.Build.cs @@ -7,24 +7,19 @@ public class GamemakinLinter : ModuleRules public GamemakinLinter(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - bUseUnity = false; PublicDependencyModuleNames.AddRange( - new string[] + new [] { "Core", "CoreUObject", "Engine", "Linter" - } - ); - + }); PrivateDependencyModuleNames.AddRange( new string[] { - - } - ); + }); } } \ No newline at end of file diff --git a/Source/Linter/Linter.Build.cs b/Source/Linter/Linter.Build.cs index 8b99ca5..b40c331 100644 --- a/Source/Linter/Linter.Build.cs +++ b/Source/Linter/Linter.Build.cs @@ -7,18 +7,17 @@ public class Linter : ModuleRules public Linter(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - bUseUnity = false; PublicDependencyModuleNames.AddRange( - new string[] + new [] { - "Core", + "Core" } ); PrivateDependencyModuleNames.AddRange( - new string[] + new [] { "CoreUObject", "Engine", diff --git a/Source/MarketplaceLinter/MarketplaceLinter.Build.cs b/Source/MarketplaceLinter/MarketplaceLinter.Build.cs index 2e58905..d153125 100644 --- a/Source/MarketplaceLinter/MarketplaceLinter.Build.cs +++ b/Source/MarketplaceLinter/MarketplaceLinter.Build.cs @@ -7,10 +7,9 @@ public class MarketplaceLinter : ModuleRules public MarketplaceLinter(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - bUseUnity = false; PublicDependencyModuleNames.AddRange( - new string[] + new [] { "Core", "Linter" @@ -19,7 +18,7 @@ public MarketplaceLinter(ReadOnlyTargetRules Target) : base(Target) PrivateDependencyModuleNames.AddRange( - new string[] + new [] { "CoreUObject", "Engine", From 32cae767bdc0a1a00c5264d3826124ce9ca66551 Mon Sep 17 00:00:00 2001 From: jwindgassen Date: Wed, 16 Mar 2022 13:55:51 +0000 Subject: [PATCH 09/28] Fixed Typo / Compile-Error on Linux --- Source/Linter/Private/LinterCommandlet.cpp | 2 +- Source/Linter/Private/UI/LintReportRuleErrorList.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Linter/Private/LinterCommandlet.cpp b/Source/Linter/Private/LinterCommandlet.cpp index 9b6b065..8778628 100644 --- a/Source/Linter/Private/LinterCommandlet.cpp +++ b/Source/Linter/Private/LinterCommandlet.cpp @@ -264,4 +264,4 @@ int32 ULinterCommandlet::Main(const FString& InParams) } return 0; -} \ No newline at end of file +} diff --git a/Source/Linter/Private/UI/LintReportRuleErrorList.cpp b/Source/Linter/Private/UI/LintReportRuleErrorList.cpp index eb4c984..48ce37d 100644 --- a/Source/Linter/Private/UI/LintReportRuleErrorList.cpp +++ b/Source/Linter/Private/UI/LintReportRuleErrorList.cpp @@ -1,6 +1,6 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. -#include "UI/LintReportruleErrorList.h" +#include "UI/LintReportRuleErrorList.h" #include "LinterStyle.h" #include "IContentBrowserSingleton.h" #include "Framework/Views/ITypedTableView.h" From 52abc091f84178f5f0991ca4ae7dc8d30fb8eff6 Mon Sep 17 00:00:00 2001 From: empty2fill Date: Mon, 18 Apr 2022 16:01:36 +0900 Subject: [PATCH 10/28] Fix UE version check - FTabManager::InvokeTab is deprecated - TMicRecursionGuard --- Source/Linter/Private/LintRule.cpp | 3 ++- .../LinterContentBrowserExtensions.cpp | 7 +++++++ Source/Linter/Private/UI/LintWizard.cpp | 21 +++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Source/Linter/Private/LintRule.cpp b/Source/Linter/Private/LintRule.cpp index 462c7a2..249d25f 100644 --- a/Source/Linter/Private/LintRule.cpp +++ b/Source/Linter/Private/LintRule.cpp @@ -8,6 +8,7 @@ #include "Modules/ModuleManager.h" #include "IAssetTools.h" #include "AssetRegistryModule.h" +#include "Misc/EngineVersionComparison.h" ULintRule::ULintRule(const FObjectInitializer& ObjectInitializer) @@ -59,7 +60,7 @@ FName ULintRule::GetRuleBasedObjectVariantName_Implementation(UObject* ObjectToL const UMaterialInterface* MI = Cast(ObjectToLint); if (MI != nullptr) { -#if ENGINE_MINOR_VERSION >= 25 || ENGINE_MAJOR_VERSION >= 5 +#if UE_VERSION_NEWER_THAN(4, 25, 0) TMicRecursionGuard RecursionGuard; #else UMaterialInterface::TMicRecursionGuard RecursionGuard; diff --git a/Source/Linter/Private/LinterContentBrowserExtensions.cpp b/Source/Linter/Private/LinterContentBrowserExtensions.cpp index d7beeb1..99dfe7b 100644 --- a/Source/Linter/Private/LinterContentBrowserExtensions.cpp +++ b/Source/Linter/Private/LinterContentBrowserExtensions.cpp @@ -12,6 +12,9 @@ #include "Framework/Commands/UIAction.h" #include "Delegates/IDelegateInstance.h" #include "TooltipEditor/TooltipTool.h" +#include "Linter.h" +#include "BatchRenameTool/BatchRenameTool.h" +#include "Misc/EngineVersionComparison.h" #define LOCTEXT_NAMESPACE "Linter" @@ -51,7 +54,11 @@ void FLinterContentBrowserExtensions::InstallHooks(FLinterModule* LinterModule, { Linter->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/Source/Linter/Private/UI/LintWizard.cpp b/Source/Linter/Private/UI/LintWizard.cpp index 9e47501..3f41c1c 100644 --- a/Source/Linter/Private/UI/LintWizard.cpp +++ b/Source/Linter/Private/UI/LintWizard.cpp @@ -19,6 +19,15 @@ #include "FileHelpers.h" #include "Logging/MessageLog.h" #include "Logging/TokenizedMessage.h" +#include "ContentBrowserModule.h" +#include "DesktopPlatformModule.h" +#include "AssetToolsModule.h" +#include "Framework/Docking/TabManager.h" +#include "Widgets/Input/SComboBox.h" +#include "Widgets/Docking/SDockTab.h" +#include "Misc/App.h" +#include "Engine/World.h" +#include "Misc/EngineVersionComparison.h" #include "LinterStyle.h" #include "LintRuleSet.h" @@ -88,7 +97,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 +534,15 @@ void SLintWizard::Construct(const FArguments& InArgs) LOCTEXT("ZipTaskShortName", "Zip Project Task"), FAppStyle::GetBrush(TEXT("MainFrame.CookContent"))); } +<<<<<<< HEAD:Source/Linter/Private/UI/LintWizard.cpp + FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab"))->RequestCloseTab(); +======= +#if UE_VERSION_NEWER_THAN(4, 26, 0) FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab"))->RequestCloseTab(); +#else + FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab"))->RequestCloseTab(); +#endif +>>>>>>> 7384b2d (Fix UE version check):Plugins/Linter/Source/Linter/Private/UI/LintWizard.cpp } return FReply::Handled(); }) From ddf63df33382b3ea0d83c17333fe8ef24048f497 Mon Sep 17 00:00:00 2001 From: empty2fill Date: Mon, 18 Apr 2022 16:25:34 +0900 Subject: [PATCH 11/28] Sort Class Naming Conventions on PreSave --- Source/Linter/Private/LinterNamingConvention.cpp | 10 +++++++++- Source/Linter/Public/LinterNamingConvention.h | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Source/Linter/Private/LinterNamingConvention.cpp b/Source/Linter/Private/LinterNamingConvention.cpp index 4e96627..c905239 100644 --- a/Source/Linter/Private/LinterNamingConvention.cpp +++ b/Source/Linter/Private/LinterNamingConvention.cpp @@ -157,4 +157,12 @@ void ULinterNamingConvention::SortConventions() return false; }); -} \ No newline at end of file +} + +void ULinterNamingConvention::PreSave(const class ITargetPlatform* TargetPlatform) +{ + Super::PreSave(TargetPlatform); + + SortConventions(); +} +>>>>>>> 99c97f0 (Sort Class Naming Conventions on PreSave):Plugins/Linter/Source/Linter/Private/LinterNamingConvention.cpp diff --git a/Source/Linter/Public/LinterNamingConvention.h b/Source/Linter/Public/LinterNamingConvention.h index c6ee547..6a8529c 100644 --- a/Source/Linter/Public/LinterNamingConvention.h +++ b/Source/Linter/Public/LinterNamingConvention.h @@ -75,4 +75,11 @@ class LINTER_API ULinterNamingConvention : public UDataAsset UFUNCTION(Blueprintcallable, Category = "Conventions") void SortConventions(); -}; \ No newline at end of file + + virtual void PreSave(const class ITargetPlatform* TargetPlatform) override; + +protected: + + + +}; From 6de32cf1c14074f273cba986e5b029180ed2659e Mon Sep 17 00:00:00 2001 From: empty2fill Date: Tue, 19 Apr 2022 00:50:13 +0900 Subject: [PATCH 12/28] Support UE 4.26 - 5.0 --- Source/Linter/Private/LinterNamingConvention.cpp | 10 +++++++++- Source/Linter/Private/UI/LintWizard.cpp | 12 +++++++----- Source/Linter/Public/LinterNamingConvention.h | 9 +++++++++ Source/Linter/Public/LinterSettings.h | 3 ++- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/Source/Linter/Private/LinterNamingConvention.cpp b/Source/Linter/Private/LinterNamingConvention.cpp index c905239..016f0f2 100644 --- a/Source/Linter/Private/LinterNamingConvention.cpp +++ b/Source/Linter/Private/LinterNamingConvention.cpp @@ -159,10 +159,18 @@ void ULinterNamingConvention::SortConventions() }); } +#if UE_VERSION_NEWER_THAN(5, 0, 0) +void ULinterNamingConvention::PreSave(FObjectPreSaveContext ObjectSaveContext) +{ + Super::PreSave(ObjectSaveContext); + + SortConventions(); +} +#else void ULinterNamingConvention::PreSave(const class ITargetPlatform* TargetPlatform) { Super::PreSave(TargetPlatform); SortConventions(); } ->>>>>>> 99c97f0 (Sort Class Naming Conventions on PreSave):Plugins/Linter/Source/Linter/Private/LinterNamingConvention.cpp +#endif diff --git a/Source/Linter/Private/UI/LintWizard.cpp b/Source/Linter/Private/UI/LintWizard.cpp index 3f41c1c..49dd72f 100644 --- a/Source/Linter/Private/UI/LintWizard.cpp +++ b/Source/Linter/Private/UI/LintWizard.cpp @@ -88,11 +88,13 @@ void SLintWizard::Construct(const FArguments& InArgs) SAssignNew(MainWizard, SWizard) .ShowPageList(false) .ShowCancelButton(false) - .ButtonStyle(FAppStyle::Get(), "FlatButton.Default") - .CancelButtonStyle(FAppStyle::Get(), "FlatButton.Default") - .FinishButtonStyle(FAppStyle::Get(), "FlatButton.Success") - .ButtonTextStyle(FAppStyle::Get(), "LargeText") - //.ForegroundColor(FAppStyle::Get().GetSlateColor("WhiteBrush")) + .ButtonStyle(FEditorStyle::Get(), "FlatButton.Default") + .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/Source/Linter/Public/LinterNamingConvention.h b/Source/Linter/Public/LinterNamingConvention.h index 6a8529c..3ccc8ee 100644 --- a/Source/Linter/Public/LinterNamingConvention.h +++ b/Source/Linter/Public/LinterNamingConvention.h @@ -6,6 +6,11 @@ #include "Templates/SharedPointer.h" #include "IDetailCustomization.h" #include "PropertyHandle.h" +#include "Engine/DataAsset.h" +#include "Misc/EngineVersionComparison.h" +#if UE_VERSION_NEWER_THAN(5, 0, 0) +#include "UObject/ObjectSaveContext.h" +#endif #include "LinterNamingConvention.generated.h" @@ -76,7 +81,11 @@ class LINTER_API ULinterNamingConvention : public UDataAsset UFUNCTION(Blueprintcallable, Category = "Conventions") void SortConventions(); +#if UE_VERSION_NEWER_THAN(5, 0, 0) + virtual void PreSave(FObjectPreSaveContext ObjectSaveContext) override; +#else virtual void PreSave(const class ITargetPlatform* TargetPlatform) override; +#endif protected: diff --git a/Source/Linter/Public/LinterSettings.h b/Source/Linter/Public/LinterSettings.h index f44ad81..a56c7ca 100644 --- a/Source/Linter/Public/LinterSettings.h +++ b/Source/Linter/Public/LinterSettings.h @@ -21,4 +21,5 @@ class ULinterSettings : public UObject UPROPERTY(EditAnywhere, config, Category = Settings) TSoftObjectPtr DefaultLintRuleSet; -}; \ No newline at end of file + +}; From a5a042494fc2e8eabf6f51a4f6288f6c4379cd77 Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Sat, 14 Oct 2023 01:27:03 +0200 Subject: [PATCH 13/28] Update to 5.3 and Merge-Errors Fixes --- .../BatchRenameTool/BatchRenameTool.cpp | 9 ++++ Source/Linter/Private/LintRule.cpp | 6 ++- Source/Linter/Private/LintRuleSet.cpp | 6 ++- .../LintRule_SoundWave_SampleRate.cpp | 2 +- Source/Linter/Private/Linter.cpp | 8 ++-- Source/Linter/Private/LinterCommandlet.cpp | 11 ++++- .../LinterContentBrowserExtensions.cpp | 8 ++++ .../Linter/Private/LinterNamingConvention.cpp | 10 +---- Source/Linter/Private/UI/LintReport.cpp | 5 ++- .../Private/UI/LintReportAssetDetails.cpp | 9 ++-- .../Private/UI/LintReportAssetError.cpp | 4 +- .../Private/UI/LintReportAssetErrorList.cpp | 4 +- .../Private/UI/LintReportRuleDetails.cpp | 17 ++++---- .../Linter/Private/UI/LintReportRuleError.cpp | 9 +++- .../Private/UI/LintReportRuleErrorList.cpp | 4 +- Source/Linter/Private/UI/LintWizard.cpp | 41 ++++++++++++------- Source/Linter/Private/UI/SAssetLinkWidget.cpp | 6 ++- Source/Linter/Public/LinterNamingConvention.h | 6 --- 18 files changed, 109 insertions(+), 56 deletions(-) diff --git a/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp b/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp index 48754d6..e39d21b 100644 --- a/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp +++ b/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp @@ -16,9 +16,14 @@ #include "Logging/MessageLog.h" #include "Logging/TokenizedMessage.h" #include "Widgets/Layout/SSeparator.h" +#include "Misc/EngineVersionComparison.h" #define LOCTEXT_NAMESPACE "LinterBatchRenamer" +#if UE_VERSION_OLDER_THAN(5, 1, 0) +using FAppStyle = FEditorStyle; +#endif + FDlgBatchRenameTool::FDlgBatchRenameTool(const TArray Assets) : bRemovePrefix(false) , bRemoveSuffix(false) @@ -75,7 +80,11 @@ FDlgBatchRenameTool::EResult FDlgBatchRenameTool::ShowModal() const FAssetData& Asset = *AssetIt; // Early out on assets that can not be renamed +#if UE_VERSION_NEWER_THAN(5, 1, 0) + if (!(!Asset.IsRedirector() && Asset.AssetClassPath.GetAssetName() != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly))) +#else if (!(!Asset.IsRedirector() && Asset.AssetClass != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly))) +#endif { continue; } diff --git a/Source/Linter/Private/LintRule.cpp b/Source/Linter/Private/LintRule.cpp index 249d25f..b522cc9 100644 --- a/Source/Linter/Private/LintRule.cpp +++ b/Source/Linter/Private/LintRule.cpp @@ -7,7 +7,7 @@ #include "Engine/Blueprint.h" #include "Modules/ModuleManager.h" #include "IAssetTools.h" -#include "AssetRegistryModule.h" +#include "AssetRegistry/AssetRegistryModule.h" #include "Misc/EngineVersionComparison.h" @@ -241,7 +241,11 @@ bool FLintRuleViolation::PopulateAssetData() if (Violator.IsValid()) { +#if UE_VERSION_NEWER_THAN(5, 1, 0) + ViolatorAssetData = AssetRegistry.GetAssetByObjectPath(Violator->GetPathName()); +#else ViolatorAssetData = AssetRegistry.GetAssetByObjectPath(FName(*Violator->GetPathName())); +#endif return ViolatorAssetData.IsValid(); } diff --git a/Source/Linter/Private/LintRuleSet.cpp b/Source/Linter/Private/LintRuleSet.cpp index 7ae4536..ed9721b 100644 --- a/Source/Linter/Private/LintRuleSet.cpp +++ b/Source/Linter/Private/LintRuleSet.cpp @@ -3,7 +3,7 @@ #include "AnyObject_LinterDummyClass.h" #include "LintRunner.h" #include "Linter.h" -#include "AssetRegistryModule.h" +#include "AssetRegistry/AssetRegistryModule.h" #include "Modules/ModuleManager.h" #include "HAL/RunnableThread.h" @@ -82,7 +82,11 @@ TArray ULintRuleSet::LintPath(TArray AssetPaths, FS } else { +#if UE_VERSION_NEWER_THAN(5, 1, 0) + Threads.Push(FRunnableThread::Create(Runner, *FString::Printf(TEXT("FLintRunner - %s"), *Asset.GetObjectPathString()), 0, TPri_Normal)); +#else Threads.Push(FRunnableThread::Create(Runner, *FString::Printf(TEXT("FLintRunner - %s"), *Asset.ObjectPath.ToString()), 0, TPri_Normal)); +#endif if (ParentScopedSlowTask != nullptr) { ParentScopedSlowTask->EnterProgressFrame(1.0f); diff --git a/Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp b/Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp index dd5ef06..5922f78 100644 --- a/Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp +++ b/Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp @@ -24,7 +24,7 @@ bool ULintRule_SoundWave_SampleRate::PassesRule(UObject* ObjectToLint, const ULi bool ULintRule_SoundWave_SampleRate::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { - const USoundWave* SoundWave = const_cast(CastChecked(ObjectToLint)); + USoundWave* SoundWave = CastChecked(ObjectToLint); if (ValidSampleRates.Contains(SoundWave->GetSampleRateForCurrentPlatform())) { diff --git a/Source/Linter/Private/Linter.cpp b/Source/Linter/Private/Linter.cpp index 507fdbd..6c68285 100644 --- a/Source/Linter/Private/Linter.cpp +++ b/Source/Linter/Private/Linter.cpp @@ -5,16 +5,14 @@ #include "Framework/Docking/TabManager.h" #include "LevelEditor.h" #include "Styling/SlateStyle.h" -#include "AssetRegistryModule.h" -#include "IAssetRegistry.h" #include "PropertyEditorModule.h" - #include "LinterStyle.h" #include "LinterContentBrowserExtensions.h" #include "LinterNamingConvention.h" #include "LinterSettings.h" #include "UI/LintWizard.h" #include "LintRuleSet.h" +#include "AssetRegistry/AssetRegistryModule.h" #define LOCTEXT_NAMESPACE "FLinterModule" @@ -119,7 +117,11 @@ void FLinterModule::TryToLoadAllLintRuleSets() const IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); TArray FoundRuleSets; +#if UE_VERSION_NEWER_THAN(5, 1, 0) + AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetClassPathName(), FoundRuleSets, true); +#else AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetFName(), FoundRuleSets, true); +#endif // Attempt to get all RuleSets in memory so that linting tools are better aware of them for (const FAssetData& RuleSetData : FoundRuleSets) diff --git a/Source/Linter/Private/LinterCommandlet.cpp b/Source/Linter/Private/LinterCommandlet.cpp index 8778628..4c78a4b 100644 --- a/Source/Linter/Private/LinterCommandlet.cpp +++ b/Source/Linter/Private/LinterCommandlet.cpp @@ -1,8 +1,7 @@ // Copyright 2020 Gamemakin LLC. All Rights Reserved. #include "LinterCommandlet.h" -#include "AssetRegistryModule.h" -#include "Engine/ObjectLibrary.h" +#include "AssetRegistry/AssetRegistryModule.h" #include "Dom/JsonObject.h" #include "Dom/JsonValue.h" #include "Interfaces/IPluginManager.h" @@ -56,7 +55,11 @@ int32 ULinterCommandlet::Main(const FString& InParams) FLinterModule::TryToLoadAllLintRuleSets(); TArray FoundRuleSets; +#if UE_VERSION_NEWER_THAN(5, 1, 0) + AssetRegistryModule.Get().GetAssetsByClass(ULintRuleSet::StaticClass()->GetClassPathName(), FoundRuleSets, true); +#else AssetRegistryModule.Get().GetAssetsByClass(ULintRuleSet::StaticClass()->GetFName(), FoundRuleSets, true); +#endif for (const FAssetData& RuleSetData : FoundRuleSets) { @@ -128,7 +131,11 @@ int32 ULinterCommandlet::Main(const FString& InParams) UniqueViolatorViolations[0].PopulateAssetData(); AssetData = UniqueViolatorViolations[0].ViolatorAssetData; AssetJsonObject->SetStringField(TEXT("ViolatorAssetName"), AssetData.AssetName.ToString()); +#if UE_VERSION_NEWER_THAN(5, 1, 0) + AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.GetObjectPathString()); +#else AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.ObjectPath.ToString()); +#endif AssetJsonObject->SetStringField(TEXT("ViolatorFullName"), AssetData.GetFullName()); //@TODO: Thumbnail export? diff --git a/Source/Linter/Private/LinterContentBrowserExtensions.cpp b/Source/Linter/Private/LinterContentBrowserExtensions.cpp index 99dfe7b..96c4d45 100644 --- a/Source/Linter/Private/LinterContentBrowserExtensions.cpp +++ b/Source/Linter/Private/LinterContentBrowserExtensions.cpp @@ -92,7 +92,11 @@ void FLinterContentBrowserExtensions::InstallHooks(FLinterModule* LinterModule, { const FAssetData& Asset = *AssetIt; // Cannot rename redirectors or classes or cooked packages +#if UE_VERSION_NEWER_THAN(5, 1, 0) + if (!Asset.IsRedirector() && Asset.AssetClassPath.GetAssetName() != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) +#else if (!Asset.IsRedirector() && Asset.AssetClass != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) +#endif { if (Asset.GetClass()->IsChildOf(UBlueprint::StaticClass())) { @@ -129,7 +133,11 @@ void FLinterContentBrowserExtensions::InstallHooks(FLinterModule* LinterModule, { const FAssetData& Asset = *AssetIt; // Cannot rename redirectors or classes or cooked packages +#if UE_VERSION_NEWER_THAN(5, 1, 0) + if (!Asset.IsRedirector() && Asset.AssetClassPath.GetAssetName() != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) +#else if (!Asset.IsRedirector() && Asset.AssetClass != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) +#endif { bAnyAssetCanBeRenamed = true; break; diff --git a/Source/Linter/Private/LinterNamingConvention.cpp b/Source/Linter/Private/LinterNamingConvention.cpp index 016f0f2..dd3f1ba 100644 --- a/Source/Linter/Private/LinterNamingConvention.cpp +++ b/Source/Linter/Private/LinterNamingConvention.cpp @@ -1,12 +1,11 @@ - #include "LinterNamingConvention.h" + #include "AnyObject_LinterDummyClass.h" #include "DetailLayoutBuilder.h" #include "PropertyCustomizationHelpers.h" #include "Templates/SharedPointer.h" #include "DetailCategoryBuilder.h" #include "IDetailChildrenBuilder.h" -#include "UObject/ObjectSaveContext.h" TSharedRef FLinterNamingConventionDetails::MakeInstance() { @@ -75,13 +74,6 @@ ULinterNamingConvention::ULinterNamingConvention(const FObjectInitializer& Objec ClassNamingConventions = TArray(); } -void ULinterNamingConvention::PreSave(const FObjectPreSaveContext SaveContext) -{ - Super::PreSave(SaveContext); - - SortConventions(); -} - TArray ULinterNamingConvention::GetNamingConventionsForClassVariant(const TSoftClassPtr Class, FName Variant /*= NAME_None*/) const { TArray NamingConventionList; diff --git a/Source/Linter/Private/UI/LintReport.cpp b/Source/Linter/Private/UI/LintReport.cpp index d185cb6..7132dcf 100644 --- a/Source/Linter/Private/UI/LintReport.cpp +++ b/Source/Linter/Private/UI/LintReport.cpp @@ -4,7 +4,6 @@ #include "LintRule.h" #include "Widgets/SBoxPanel.h" #include "LintRuleSet.h" -#include "UI/LintReportAssetErrorList.h" #include "UI/LintReportAssetDetails.h" #include "AssetThumbnail.h" #include "Containers/Map.h" @@ -279,7 +278,11 @@ void SLintReport::Rebuild(const ULintRuleSet* SelectedLintRuleSet) { AssetData = UniqueViolatorViolations[0]->ViolatorAssetData; AssetJsonObject->SetStringField(TEXT("ViolatorAssetName"), AssetData.AssetName.ToString()); +#if UE_VERSION_NEWER_THAN(5, 1, 0) + AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.GetObjectPathString()); +#else AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.ObjectPath.ToString()); +#endif AssetJsonObject->SetStringField(TEXT("ViolatorFullName"), AssetData.GetFullName()); //@TODO: Thumbnail export? diff --git a/Source/Linter/Private/UI/LintReportAssetDetails.cpp b/Source/Linter/Private/UI/LintReportAssetDetails.cpp index ffac9e6..0a440dc 100644 --- a/Source/Linter/Private/UI/LintReportAssetDetails.cpp +++ b/Source/Linter/Private/UI/LintReportAssetDetails.cpp @@ -3,15 +3,12 @@ #include "UI/LintReportAssetDetails.h" #include "LinterStyle.h" #include "Widgets/Layout/SBorder.h" -#include "EditorStyleSet.h" #include "Widgets/SBoxPanel.h" #include "Widgets/Layout/SExpandableArea.h" #include "ContentBrowserModule.h" #include "IContentBrowserSingleton.h" -#include "AssetRegistryModule.h" +#include "AssetRegistry/AssetRegistryModule.h" #include "Widgets/Input/SHyperlink.h" -#include "IAssetTools.h" -#include "AssetToolsModule.h" #include "Internationalization/Internationalization.h" #include "Widgets/Text/STextBlock.h" #include "LintRule.h" @@ -139,4 +136,6 @@ void SLintReportAssetDetails::Construct(const FArguments& Args) ] ] ]; -} \ No newline at end of file +} + +#undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintReportAssetError.cpp b/Source/Linter/Private/UI/LintReportAssetError.cpp index 041d66d..dd35b38 100644 --- a/Source/Linter/Private/UI/LintReportAssetError.cpp +++ b/Source/Linter/Private/UI/LintReportAssetError.cpp @@ -107,4 +107,6 @@ void SLintReportAssetError::Construct(const FArguments& Args) .Text(RuleViolation.Get()->RecommendedAction) ] ]; -} \ No newline at end of file +} + +#undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintReportAssetErrorList.cpp b/Source/Linter/Private/UI/LintReportAssetErrorList.cpp index 14ba12c..ba62b51 100644 --- a/Source/Linter/Private/UI/LintReportAssetErrorList.cpp +++ b/Source/Linter/Private/UI/LintReportAssetErrorList.cpp @@ -28,4 +28,6 @@ void SLintReportAssetErrorList::Construct(const FArguments& Args) ]; }) ]; -} \ No newline at end of file +} + +#undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintReportRuleDetails.cpp b/Source/Linter/Private/UI/LintReportRuleDetails.cpp index f67e9f6..9586413 100644 --- a/Source/Linter/Private/UI/LintReportRuleDetails.cpp +++ b/Source/Linter/Private/UI/LintReportRuleDetails.cpp @@ -2,20 +2,15 @@ #include "UI/LintReportRuleDetails.h" #include "LinterStyle.h" #include "Widgets/Layout/SBorder.h" -#include "EditorStyleSet.h" #include "Widgets/SBoxPanel.h" #include "Widgets/Layout/SExpandableArea.h" -#include "ContentBrowserModule.h" -#include "IContentBrowserSingleton.h" -#include "AssetRegistryModule.h" -#include "Widgets/Input/SHyperlink.h" -#include "IAssetTools.h" -#include "AssetToolsModule.h" +#include "AssetRegistry/AssetRegistryModule.h" #include "Internationalization/Internationalization.h" #include "Widgets/Text/STextBlock.h" -#include "UI/LintReportRuleErrorList.h" #include "LintRule.h" #include "AssetThumbnail.h" +#include "LintReportRuleErrorList.h" +#include "Misc/EngineVersionComparison.h" @@ -57,7 +52,11 @@ void SLintReportRuleDetails::Construct(const FArguments& Args) const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); const IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); +#if UE_VERSION_NEWER_THAN(5, 1, 0) + RuleAssetData = AssetRegistry.GetAssetByObjectPath(BrokenRule->GetPathName(), true); +#else RuleAssetData = AssetRegistry.GetAssetByObjectPath(FName(*BrokenRule->GetPathName()), true); +#endif FText RuleAssetPath; if (RuleAssetData.IsValid()) { @@ -202,3 +201,5 @@ void SLintReportRuleDetails::Construct(const FArguments& Args) ThumbnailBox->SetContent(RuleThumbnail->MakeThumbnailWidget()); } } + +#undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintReportRuleError.cpp b/Source/Linter/Private/UI/LintReportRuleError.cpp index 3b7057d..2996aec 100644 --- a/Source/Linter/Private/UI/LintReportRuleError.cpp +++ b/Source/Linter/Private/UI/LintReportRuleError.cpp @@ -10,6 +10,7 @@ #include "Widgets/Input/SHyperlink.h" #include "LintRule.h" #include "AssetRegistry/AssetRegistryModule.h" +#include "Misc/EngineVersionComparison.h" #define LOCTEXT_NAMESPACE "LintReport" @@ -40,7 +41,11 @@ void SLintReportRuleError::Construct(const FArguments& Args) const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); TArray AssetDatas; +#if UE_VERSION_NEWER_THAN(5, 1, 0) + AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(RuleViolation.Get()->ViolatorAssetData.GetSoftObjectPath())); +#else AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(RuleViolation.Get()->ViolatorAssetData.ObjectPath)); +#endif ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); }) ] @@ -56,4 +61,6 @@ void SLintReportRuleError::Construct(const FArguments& Args) .Visibility(RuleViolation.Get()->RecommendedAction.IsEmpty() ? EVisibility::Collapsed : EVisibility::SelfHitTestInvisible) ] ]; -} \ No newline at end of file +} + +#undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintReportRuleErrorList.cpp b/Source/Linter/Private/UI/LintReportRuleErrorList.cpp index 48ce37d..8929431 100644 --- a/Source/Linter/Private/UI/LintReportRuleErrorList.cpp +++ b/Source/Linter/Private/UI/LintReportRuleErrorList.cpp @@ -27,4 +27,6 @@ void SLintReportRuleErrorList::Construct(const FArguments& Args) ]; }) ]; -} \ No newline at end of file +} + +#undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintWizard.cpp b/Source/Linter/Private/UI/LintWizard.cpp index 49dd72f..c816ee2 100644 --- a/Source/Linter/Private/UI/LintWizard.cpp +++ b/Source/Linter/Private/UI/LintWizard.cpp @@ -3,11 +3,11 @@ #include "CoreGlobals.h" #include "Delegates/Delegate.h" -#include "AssetRegistryModule.h" +#include "AssetRegistry/AssetRegistryModule.h" #include "AssetToolsModule.h" #include "ContentBrowserModule.h" #include "DesktopPlatformModule.h" -#include "IAssetRegistry.h" +#include "AssetRegistry/IAssetRegistry.h" #include "SlateOptMacros.h" #include "Widgets/Layout/SSeparator.h" #include "Widgets/Text/SRichTextBlock.h" @@ -19,16 +19,12 @@ #include "FileHelpers.h" #include "Logging/MessageLog.h" #include "Logging/TokenizedMessage.h" -#include "ContentBrowserModule.h" -#include "DesktopPlatformModule.h" -#include "AssetToolsModule.h" #include "Framework/Docking/TabManager.h" #include "Widgets/Input/SComboBox.h" #include "Widgets/Docking/SDockTab.h" #include "Misc/App.h" #include "Engine/World.h" #include "Misc/EngineVersionComparison.h" - #include "LinterStyle.h" #include "LintRuleSet.h" #include "LinterSettings.h" @@ -36,6 +32,10 @@ #define LOCTEXT_NAMESPACE "LintWizard" +#if UE_VERSION_OLDER_THAN(5, 1, 0) +using FAppStyle = FEditorStyle; +#endif + BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION void SLintWizard::Construct(const FArguments& InArgs) { @@ -53,7 +53,12 @@ void SLintWizard::Construct(const FArguments& InArgs) const IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); TArray FoundRuleSets; +#if UE_VERSION_NEWER_THAN(5, 1, 0) + AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetClassPathName(), FoundRuleSets, true); +#else AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetFName(), FoundRuleSets, true); +#endif + // Attempt to get all RuleSets in memory so that linting tools are better aware of them for (const FAssetData& RuleSetData : FoundRuleSets) @@ -88,10 +93,10 @@ void SLintWizard::Construct(const FArguments& InArgs) SAssignNew(MainWizard, SWizard) .ShowPageList(false) .ShowCancelButton(false) - .ButtonStyle(FEditorStyle::Get(), "FlatButton.Default") - .CancelButtonStyle(FEditorStyle::Get(), "FlatButton.Default") - .FinishButtonStyle(FEditorStyle::Get(), "FlatButton.Success") - .ButtonTextStyle(FEditorStyle::Get(), "LargeText") + .ButtonStyle(FAppStyle::Get(), "FlatButton.Default") + .CancelButtonStyle(FAppStyle::Get(), "FlatButton.Default") + .FinishButtonStyle(FAppStyle::Get(), "FlatButton.Success") + .ButtonTextStyle(FAppStyle::Get(), "LargeText") #if UE_VERSION_OLDER_THAN(5, 0, 0) .ForegroundColor(FEditorStyle::Get().GetSlateColor("WhiteBrush")) #endif @@ -281,7 +286,11 @@ void SLintWizard::Construct(const FArguments& InArgs) FARFilter Filter; Filter.bRecursivePaths = true; Filter.PackagePaths.Add("/Game"); +#if UE_VERSION_NEWER_THAN(5, 1, 0) + Filter.ClassPaths.Add(FTopLevelAssetPath{"ObjectRedirector"}); +#else Filter.ClassNames.Add("ObjectRedirector"); +#endif // Query for a list of assets in the selected paths TArray AssetList; @@ -292,7 +301,11 @@ void SLintWizard::Construct(const FArguments& InArgs) TArray ObjectPaths; for (const auto& Asset : AssetList) { +#if UE_VERSION_NEWER_THAN(5, 1, 0) ObjectPaths.Add(Asset.GetObjectPathString()); +#else + ObjectPaths.Add(Asset.ObjectPath.ToString()); +#endif } ScopedSlowTask.EnterProgressFrame(0.25f, LOCTEXT("Linter.FixUpRedirects.LoadingRedirectors", "Loading redirectors...")); @@ -536,15 +549,11 @@ void SLintWizard::Construct(const FArguments& InArgs) LOCTEXT("ZipTaskShortName", "Zip Project Task"), FAppStyle::GetBrush(TEXT("MainFrame.CookContent"))); } -<<<<<<< HEAD:Source/Linter/Private/UI/LintWizard.cpp - FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab"))->RequestCloseTab(); -======= #if UE_VERSION_NEWER_THAN(4, 26, 0) FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab"))->RequestCloseTab(); #else FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab"))->RequestCloseTab(); #endif ->>>>>>> 7384b2d (Fix UE version check):Plugins/Linter/Source/Linter/Private/UI/LintWizard.cpp } return FReply::Handled(); }) @@ -570,7 +579,11 @@ void SLintWizard::Construct(const FArguments& InArgs) FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); TArray AssetDatas; FARFilter Filter; +#if UE_VERSION_NEWER_THAN(5, 1, 0) Filter.ClassPaths.Add(FTopLevelAssetPath(UWorld::StaticClass())); +#else + Filter.ClassNames.Add(UWorld::StaticClass()->GetFName()); +#endif Filter.bRecursivePaths = true; Filter.PackagePaths.Add(TEXT("/Game")); AssetRegistryModule.Get().GetAssets(Filter, AssetDatas); diff --git a/Source/Linter/Private/UI/SAssetLinkWidget.cpp b/Source/Linter/Private/UI/SAssetLinkWidget.cpp index 94bdbc7..3860c2a 100644 --- a/Source/Linter/Private/UI/SAssetLinkWidget.cpp +++ b/Source/Linter/Private/UI/SAssetLinkWidget.cpp @@ -7,7 +7,7 @@ #include "AssetRegistry/AssetRegistryModule.h" #include "Widgets/SBoxPanel.h" #include "Widgets/Input/SHyperlink.h" -#include "Widgets/Text/SRichTextBlock.h" +#include "Misc/EngineVersionComparison.h" BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION @@ -30,7 +30,11 @@ void SAssetLinkWidget::Construct(const FArguments& Args) const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); TArray AssetDatas; +#if UE_VERSION_NEWER_THAN(5, 1, 0) + AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(AssetData.Get().GetObjectPathString())); +#else AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(AssetData.Get().ObjectPath)); +#endif ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); }) ] diff --git a/Source/Linter/Public/LinterNamingConvention.h b/Source/Linter/Public/LinterNamingConvention.h index 3ccc8ee..c24e997 100644 --- a/Source/Linter/Public/LinterNamingConvention.h +++ b/Source/Linter/Public/LinterNamingConvention.h @@ -70,8 +70,6 @@ class LINTER_API ULinterNamingConvention : public UDataAsset ULinterNamingConvention(const FObjectInitializer& ObjectInitializer); - virtual void PreSave(FObjectPreSaveContext SaveContext) override; - UPROPERTY(EditAnywhere, Category="Conventions", meta = (AllowAbstract = "")) TArray ClassNamingConventions; @@ -87,8 +85,4 @@ class LINTER_API ULinterNamingConvention : public UDataAsset virtual void PreSave(const class ITargetPlatform* TargetPlatform) override; #endif -protected: - - - }; From adb216d76dad08aec2416a5aaa2ad8e16e32948b Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Sat, 14 Oct 2023 02:12:45 +0200 Subject: [PATCH 14/28] Cleanup --- .clang-format | 141 ++ .../GamemakinLinter/GamemakinLinter.Build.cs | 24 +- .../Private/GamemakinLinter.cpp | 15 +- .../Private/GamemakinNamingConvention.cpp | 194 ++- .../GamemakinLinter/Public/GamemakinLinter.h | 20 +- .../Public/GamemakinNamingConvention.h | 9 +- Source/Linter/Linter.Build.cs | 50 +- .../Private/AnyObject_LinterDummyClass.cpp | 7 +- .../BatchRenameTool/BatchRenameTool.cpp | 489 +++---- Source/Linter/Private/LintRule.cpp | 357 ++--- Source/Linter/Private/LintRuleSet.cpp | 296 ++-- .../LintRules/LintRule_Blueprint_Base.cpp | 24 +- .../LintRules/LintRule_Blueprint_Compiles.cpp | 37 +- .../LintRule_Blueprint_Funcs_MaxNodes.cpp | 126 +- ...intRule_Blueprint_Funcs_MustHaveReturn.cpp | 92 +- ...ule_Blueprint_Funcs_PublicDescriptions.cpp | 111 +- .../LintRule_Blueprint_LooseNodes.cpp | 88 +- ...ntRule_Blueprint_Vars_ConfigCategories.cpp | 108 +- ...Blueprint_Vars_EditableMustHaveTooltip.cpp | 65 +- .../LintRule_Blueprint_Vars_NoConfigFlag.cpp | 48 +- .../LintRule_Blueprint_Vars_NonAtomic.cpp | 77 +- .../LintRule_Blueprint_Vars_PluralArrays.cpp | 60 +- .../LintRule_Blueprint_Vars_RegEx.cpp | 64 +- .../Private/LintRules/LintRule_Collection.cpp | 44 +- .../LintRule_IsNamedCorrectly_Base.cpp | 178 +-- ...ntRule_ParticleSystem_EmitterNameRegex.cpp | 90 +- .../LintRules/LintRule_Path_DisallowNames.cpp | 39 +- .../LintRules/LintRule_Path_IsNotTooLong.cpp | 37 +- .../LintRules/LintRule_Path_NoTopLevel.cpp | 101 +- .../Private/LintRules/LintRule_Path_Regex.cpp | 85 +- .../LintRule_SoundWave_SampleRate.cpp | 49 +- .../LintRule_StaticMesh_ValidUVs.cpp | 69 +- .../LintRule_Texture_Size_NotTooBig.cpp | 49 +- .../LintRule_Texture_Size_PowerOfTwo.cpp | 97 +- Source/Linter/Private/LintRunner.cpp | 110 +- Source/Linter/Private/Linter.cpp | 169 +-- Source/Linter/Private/LinterCommandlet.cpp | 439 +++--- .../LinterContentBrowserExtensions.cpp | 309 ++-- .../Linter/Private/LinterNamingConvention.cpp | 257 ++-- Source/Linter/Private/LinterSettings.cpp | 16 +- Source/Linter/Private/LinterStyle.cpp | 195 +-- .../TooltipTool/TooltipStringHelper.cpp | 336 ++--- .../Private/TooltipTool/TooltipTool.cpp | 1283 ++++++++--------- Source/Linter/Private/UI/LintReport.cpp | 743 +++++----- .../Private/UI/LintReportAssetDetails.cpp | 195 ++- .../Private/UI/LintReportAssetError.cpp | 156 +- .../Private/UI/LintReportAssetErrorList.cpp | 31 +- .../Private/UI/LintReportRuleDetails.cpp | 308 ++-- .../Linter/Private/UI/LintReportRuleError.cpp | 76 +- .../Private/UI/LintReportRuleErrorList.cpp | 31 +- Source/Linter/Private/UI/LintWizard.cpp | 1098 +++++++------- Source/Linter/Private/UI/SAssetLinkWidget.cpp | 45 +- Source/Linter/Private/UI/SStepWidget.cpp | 251 ++-- .../Public/AnyObject_LinterDummyClass.h | 10 +- .../Public/BatchRenameTool/BatchRenameTool.h | 129 +- Source/Linter/Public/LintRule.h | 154 +- Source/Linter/Public/LintRuleSet.h | 65 +- .../LintRules/LintRule_Blueprint_Base.h | 11 +- .../LintRules/LintRule_Blueprint_Compiles.h | 12 +- .../LintRule_Blueprint_Funcs_MaxNodes.h | 18 +- .../LintRule_Blueprint_Funcs_MustHaveReturn.h | 11 +- ...tRule_Blueprint_Funcs_PublicDescriptions.h | 12 +- .../LintRules/LintRule_Blueprint_LooseNodes.h | 12 +- ...LintRule_Blueprint_Vars_ConfigCategories.h | 16 +- ...e_Blueprint_Vars_EditableMustHaveTooltip.h | 12 +- .../LintRule_Blueprint_Vars_NoConfigFlag.h | 12 +- .../LintRule_Blueprint_Vars_NonAtomic.h | 14 +- .../LintRule_Blueprint_Vars_PluralArrays.h | 12 +- .../LintRules/LintRule_Blueprint_Vars_Regex.h | 24 +- .../Public/LintRules/LintRule_Collection.h | 14 +- .../LintRule_IsNamedCorrectly_Base.h | 14 +- ...LintRule_ParticleSystem_EmitterNameRegex.h | 32 +- .../LintRules/LintRule_Path_DisallowNames.h | 18 +- .../LintRules/LintRule_Path_IsNotTooLong.h | 14 +- .../LintRules/LintRule_Path_NoTopLevel.h | 18 +- .../Public/LintRules/LintRule_Path_Regex.h | 38 +- .../LintRules/LintRule_SoundWave_SampleRate.h | 16 +- .../LintRules/LintRule_StaticMesh_ValidUVs.h | 16 +- .../LintRule_Texture_Size_NotTooBig.h | 20 +- .../LintRule_Texture_Size_PowerOfTwo.h | 16 +- Source/Linter/Public/LintRunner.h | 31 +- Source/Linter/Public/Linter.h | 70 +- Source/Linter/Public/LinterBase.h | 168 +-- Source/Linter/Public/LinterCommandlet.h | 12 +- .../Public/LinterContentBrowserExtensions.h | 9 +- Source/Linter/Public/LinterNamingConvention.h | 78 +- Source/Linter/Public/LinterSettings.h | 13 +- Source/Linter/Public/LinterStyle.h | 18 +- .../TooltipEditor/TooltipStringHelper.h | 43 +- .../Linter/Public/TooltipEditor/TooltipTool.h | 169 +-- Source/Linter/Public/UI/LintReport.h | 49 +- .../Linter/Public/UI/LintReportAssetDetails.h | 28 +- .../Linter/Public/UI/LintReportAssetError.h | 20 +- .../Public/UI/LintReportAssetErrorList.h | 19 +- .../Linter/Public/UI/LintReportRuleDetails.h | 30 +- Source/Linter/Public/UI/LintReportRuleError.h | 21 +- .../Public/UI/LintReportRuleErrorList.h | 19 +- Source/Linter/Public/UI/LintWizard.h | 57 +- Source/Linter/Public/UI/SAssetLinkWidget.h | 20 +- Source/Linter/Public/UI/SStepWidget.h | 70 +- .../MarketplaceLinter.Build.cs | 50 +- .../Private/MarketplaceLinter.cpp | 19 +- .../Private/MarketplaceNamingConvention.cpp | 194 ++- .../Public/MarketplaceLinter.h | 10 - .../Public/MarketplaceNamingConvention.h | 9 +- 105 files changed, 5320 insertions(+), 6034 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..a478f6d --- /dev/null +++ b/.clang-format @@ -0,0 +1,141 @@ +--- +Language: Cpp +BasedOnStyle: Google +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: None +AlignConsecutiveAssignments: None +AlignConsecutiveDeclarations: None +AlignEscapedNewlines: Left +AlignOperands: DontAlign +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Empty +AllowShortCaseLabelsOnASingleLine: true +AllowShortEnumsOnASingleLine: true +AllowShortFunctionsOnASingleLine: Empty +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: Never + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeInheritanceComma: false +BreakInheritanceList: AfterColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: AfterColon +BreakStringLiterals: true +ColumnLimit: 0 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: true +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^' + Priority: 2 + SortPriority: 0 + - Regex: '^<.*\.h>' + Priority: 1 + SortPriority: 0 + - Regex: '^<.*' + Priority: 2 + SortPriority: 0 + - Regex: '.*' + Priority: 3 + SortPriority: 0 +IncludeIsMainRegex: '([-_](test|unittest))?$' +IncludeIsMainSourceRegex: '' +IndentAccessModifiers: false +IndentCaseLabels: true +IndentGotoLabels: true +IndentPPDirectives: None +IndentWidth: 4 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MaxEmptyLinesToKeep: 3 +NamespaceIndentation: None +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +RawStringFormats: + - Language: Cpp + Delimiters: + - cc + - CC + - cpp + - Cpp + - CPP + - 'c++' + - 'C++' + CanonicalDelimiter: '' + BasedOnStyle: google +ReferenceAlignment: Left +ReflowComments: true +SortIncludes: Never +SortUsingDeclarations: false +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: Never +SpacesInConditionalStatement: false +SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +Standard: Auto +StatementMacros: + - UPROEPRTY + - UFUNCTION + - UCLASS + - USTRUCT + - UENUM + - UMETA +TabWidth: 8 +UseCRLF: false +UseTab: Never diff --git a/Source/GamemakinLinter/GamemakinLinter.Build.cs b/Source/GamemakinLinter/GamemakinLinter.Build.cs index 82cf534..54d1ec7 100644 --- a/Source/GamemakinLinter/GamemakinLinter.Build.cs +++ b/Source/GamemakinLinter/GamemakinLinter.Build.cs @@ -2,24 +2,10 @@ using UnrealBuildTool; -public class GamemakinLinter : ModuleRules -{ - public GamemakinLinter(ReadOnlyTargetRules Target) : base(Target) - { - PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; +public class GamemakinLinter : ModuleRules { + public GamemakinLinter(ReadOnlyTargetRules Target) : base(Target) { + PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - PublicDependencyModuleNames.AddRange( - new [] - { - "Core", - "CoreUObject", - "Engine", - "Linter" - }); - - PrivateDependencyModuleNames.AddRange( - new string[] - { - }); - } + PublicDependencyModuleNames.AddRange(new[] { "Core", "CoreUObject", "Engine", "Linter" }); + } } \ No newline at end of file diff --git a/Source/GamemakinLinter/Private/GamemakinLinter.cpp b/Source/GamemakinLinter/Private/GamemakinLinter.cpp index 23584cb..70d645b 100644 --- a/Source/GamemakinLinter/Private/GamemakinLinter.cpp +++ b/Source/GamemakinLinter/Private/GamemakinLinter.cpp @@ -2,19 +2,6 @@ #include "GamemakinLinter.h" -#define LOCTEXT_NAMESPACE "FGamemakinLinterModule" -void FGamemakinLinterModule::StartupModule() -{ -// Super::StartupModule(); -} - -void FGamemakinLinterModule::ShutdownModule() -{ -// Super::ShutdownModule(); -} - -#undef LOCTEXT_NAMESPACE - IMPLEMENT_MODULE(FGamemakinLinterModule, GamemakinLinter) -DEFINE_LOG_CATEGORY(LogGamemakinLinter); \ No newline at end of file +DEFINE_LOG_CATEGORY(LogGamemakinLinter); diff --git a/Source/GamemakinLinter/Private/GamemakinNamingConvention.cpp b/Source/GamemakinLinter/Private/GamemakinNamingConvention.cpp index 965bf37..7ffad8a 100644 --- a/Source/GamemakinLinter/Private/GamemakinNamingConvention.cpp +++ b/Source/GamemakinLinter/Private/GamemakinNamingConvention.cpp @@ -2,109 +2,107 @@ #include "GamemakinNamingConvention.h" -UGamemakinNamingConvention::UGamemakinNamingConvention(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ +UGamemakinNamingConvention::UGamemakinNamingConvention(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) { #define SCRIPT_PATH(ScriptPath) TSoftClassPtr(FSoftObjectPath(TEXT("/Script/" #ScriptPath))) #define ADD_PREFIX(ClassName, Prefix) ClassNamingConventions.Push(FLinterNamingConventionInfo(TSoftClassPtr(FSoftObjectPath(TEXT("/Script/Engine." #ClassName))), Prefix)); #define ADD_PREFIX_SUFFIX(ClassName, Prefix, Suffix) ClassNamingConventions.Push(FLinterNamingConventionInfo(TSoftClassPtr(FSoftObjectPath(TEXT("/Script/Engine." #ClassName))), Prefix, Suffix)); - // Animation - ADD_PREFIX(AimOffsetBlendSpace, "AO_"); - ADD_PREFIX(AimOffsetBlendSpace1D, "AO_"); - ADD_PREFIX(AnimBlueprint, "ABP_"); - ADD_PREFIX(AnimComposite, "AC_"); - ADD_PREFIX(AnimMontage, "AM_"); - ADD_PREFIX(AnimSequence, "A_"); - ADD_PREFIX(BlendSpace, "BS_"); - ADD_PREFIX(BlendSpace1D, "BS_"); - ADD_PREFIX(MorphTarget, "MT_"); - ADD_PREFIX(Rig, "Rig_"); - ADD_PREFIX(SkeletalMesh, "SK_"); - ADD_PREFIX(Skeleton, "SKEL_"); - - - // Artificial Intelligence - ADD_PREFIX(AIController, "AIC_"); - ADD_PREFIX(BehaviorTree, "BT_"); - ADD_PREFIX(BlackboardData, "BB_"); - ADD_PREFIX(BTDecorator, "BTDecorator_"); - ADD_PREFIX(BTService, "BTService_"); - ADD_PREFIX(BTTaskNode, "BTTask_"); - - // Blueprints - ADD_PREFIX(Blueprint, "BP_"); - ADD_PREFIX(BlueprintFunctionLibrary, "BPFL_"); - ADD_PREFIX(Interface, "BPI_"); - ClassNamingConventions.Push(FLinterNamingConventionInfo(SCRIPT_PATH("IntroTutorials.EditorTutorial"), "TBP_")); - ADD_PREFIX(UserDefinedEnum, "E"); - ADD_PREFIX(UserDefinedStruct, "F"); - - // Materials - ADD_PREFIX(Material, "M_"); - ClassNamingConventions.Push(FLinterNamingConventionInfo(TSoftClassPtr(FSoftObjectPath(TEXT("/Script/Engine.Material"))), "PP_", TEXT(""), "PostProcess")); - ADD_PREFIX(MaterialFunction, "MF_"); - ADD_PREFIX(MaterialInstance, "MI_"); - ADD_PREFIX(MaterialInstanceConstant, "MI_"); - ClassNamingConventions.Push(FLinterNamingConventionInfo(TSoftClassPtr(FSoftObjectPath(TEXT("/Script/Engine.MaterialInstance"))), "PPI_", TEXT(""), "PostProcess")); - ClassNamingConventions.Push(FLinterNamingConventionInfo(TSoftClassPtr(FSoftObjectPath(TEXT("/Script/Engine.MaterialInstanceConstant"))), "PPI_", TEXT(""), "PostProcess")); - ADD_PREFIX(MaterialParameterCollection, "MPC_"); - ADD_PREFIX(SubsurfaceProfile, "SP_"); - - // Textures - ADD_PREFIX(Texture2D, "T_"); - ADD_PREFIX(TextureCube, "TC_"); - ADD_PREFIX(TextureRenderTarget2D, "RT_"); - ADD_PREFIX(TextureRenderTargetCube, "RTC_"); - ADD_PREFIX(TextureLightProfile, "TLP_"); - - // Media - ClassNamingConventions.Push(FLinterNamingConventionInfo(SCRIPT_PATH("MediaAssets.MediaTexture"), "MT_")); - ClassNamingConventions.Push(FLinterNamingConventionInfo(SCRIPT_PATH("MediaAssets.MediaPlayer"), "MP_")); - - // Miscellaneous - ADD_PREFIX(VectorFieldAnimated, "VFA_"); - ADD_PREFIX(CameraAnim, "CA_"); - ADD_PREFIX(CurveLinearColor, "Curve_"); - ADD_PREFIX(CurveTable, "Curve_"); - ADD_PREFIX(DataTable, "DT_"); - ADD_PREFIX(CurveFloat, "Curve_"); - ADD_PREFIX(ForceFeedbackEffect, "FFE_"); - ADD_PREFIX(MatineeAnimInterface, "Matinee_"); - ADD_PREFIX(ObjectLibrary, "OL_"); - ADD_PREFIX(VectorFieldStatic, "VF_"); - ADD_PREFIX(TouchInterface, "TI_"); - ADD_PREFIX(CurveVector, "Curve_"); - ADD_PREFIX(StaticMesh, "S_"); - - // Paper 2D - - // Physics - ADD_PREFIX(PhysicalMaterial, "PM_"); - ADD_PREFIX(PhysicsAsset, "PHYS_"); - - // Sounds - ADD_PREFIX(DialogueVoice, "DV_"); - ADD_PREFIX(DialogueWave, "DW_"); - ADD_PREFIX(ReverbEffect, "Reverb_"); - ADD_PREFIX(SoundAttenuation, "ATT_"); - ADD_PREFIX(SoundClass, ""); - ADD_PREFIX(SoundConcurrency, "_SC"); - ADD_PREFIX_SUFFIX(SoundCue, "A_", "_Cue"); - ADD_PREFIX(SoundMix, "Mix_"); - ADD_PREFIX(SoundWave, "A_"); - - // User Interface - ADD_PREFIX(Font, "Font_"); - ADD_PREFIX(SlateBrushAsset, "Brush_"); - ADD_PREFIX(SlateWidgetStyleAsset, "Style_"); - ADD_PREFIX(WidgetBlueprint, "WBP_"); - - // Effects - ADD_PREFIX(ParticleSystem, "PS_"); + // Animation + ADD_PREFIX(AimOffsetBlendSpace, "AO_"); + ADD_PREFIX(AimOffsetBlendSpace1D, "AO_"); + ADD_PREFIX(AnimBlueprint, "ABP_"); + ADD_PREFIX(AnimComposite, "AC_"); + ADD_PREFIX(AnimMontage, "AM_"); + ADD_PREFIX(AnimSequence, "A_"); + ADD_PREFIX(BlendSpace, "BS_"); + ADD_PREFIX(BlendSpace1D, "BS_"); + ADD_PREFIX(MorphTarget, "MT_"); + ADD_PREFIX(Rig, "Rig_"); + ADD_PREFIX(SkeletalMesh, "SK_"); + ADD_PREFIX(Skeleton, "SKEL_"); + + + // Artificial Intelligence + ADD_PREFIX(AIController, "AIC_"); + ADD_PREFIX(BehaviorTree, "BT_"); + ADD_PREFIX(BlackboardData, "BB_"); + ADD_PREFIX(BTDecorator, "BTDecorator_"); + ADD_PREFIX(BTService, "BTService_"); + ADD_PREFIX(BTTaskNode, "BTTask_"); + + // Blueprints + ADD_PREFIX(Blueprint, "BP_"); + ADD_PREFIX(BlueprintFunctionLibrary, "BPFL_"); + ADD_PREFIX(Interface, "BPI_"); + ClassNamingConventions.Push(FLinterNamingConventionInfo(SCRIPT_PATH("IntroTutorials.EditorTutorial"), "TBP_")); + ADD_PREFIX(UserDefinedEnum, "E"); + ADD_PREFIX(UserDefinedStruct, "F"); + + // Materials + ADD_PREFIX(Material, "M_"); + ClassNamingConventions.Push(FLinterNamingConventionInfo(TSoftClassPtr(FSoftObjectPath(TEXT("/Script/Engine.Material"))), "PP_", TEXT(""), "PostProcess")); + ADD_PREFIX(MaterialFunction, "MF_"); + ADD_PREFIX(MaterialInstance, "MI_"); + ADD_PREFIX(MaterialInstanceConstant, "MI_"); + ClassNamingConventions.Push(FLinterNamingConventionInfo(TSoftClassPtr(FSoftObjectPath(TEXT("/Script/Engine.MaterialInstance"))), "PPI_", TEXT(""), "PostProcess")); + ClassNamingConventions.Push(FLinterNamingConventionInfo(TSoftClassPtr(FSoftObjectPath(TEXT("/Script/Engine.MaterialInstanceConstant"))), "PPI_", TEXT(""), "PostProcess")); + ADD_PREFIX(MaterialParameterCollection, "MPC_"); + ADD_PREFIX(SubsurfaceProfile, "SP_"); + + // Textures + ADD_PREFIX(Texture2D, "T_"); + ADD_PREFIX(TextureCube, "TC_"); + ADD_PREFIX(TextureRenderTarget2D, "RT_"); + ADD_PREFIX(TextureRenderTargetCube, "RTC_"); + ADD_PREFIX(TextureLightProfile, "TLP_"); + + // Media + ClassNamingConventions.Push(FLinterNamingConventionInfo(SCRIPT_PATH("MediaAssets.MediaTexture"), "MT_")); + ClassNamingConventions.Push(FLinterNamingConventionInfo(SCRIPT_PATH("MediaAssets.MediaPlayer"), "MP_")); + + // Miscellaneous + ADD_PREFIX(VectorFieldAnimated, "VFA_"); + ADD_PREFIX(CameraAnim, "CA_"); + ADD_PREFIX(CurveLinearColor, "Curve_"); + ADD_PREFIX(CurveTable, "Curve_"); + ADD_PREFIX(DataTable, "DT_"); + ADD_PREFIX(CurveFloat, "Curve_"); + ADD_PREFIX(ForceFeedbackEffect, "FFE_"); + ADD_PREFIX(MatineeAnimInterface, "Matinee_"); + ADD_PREFIX(ObjectLibrary, "OL_"); + ADD_PREFIX(VectorFieldStatic, "VF_"); + ADD_PREFIX(TouchInterface, "TI_"); + ADD_PREFIX(CurveVector, "Curve_"); + ADD_PREFIX(StaticMesh, "S_"); + + // Paper 2D + + // Physics + ADD_PREFIX(PhysicalMaterial, "PM_"); + ADD_PREFIX(PhysicsAsset, "PHYS_"); + + // Sounds + ADD_PREFIX(DialogueVoice, "DV_"); + ADD_PREFIX(DialogueWave, "DW_"); + ADD_PREFIX(ReverbEffect, "Reverb_"); + ADD_PREFIX(SoundAttenuation, "ATT_"); + ADD_PREFIX(SoundClass, ""); + ADD_PREFIX(SoundConcurrency, "_SC"); + ADD_PREFIX_SUFFIX(SoundCue, "A_", "_Cue"); + ADD_PREFIX(SoundMix, "Mix_"); + ADD_PREFIX(SoundWave, "A_"); + + // User Interface + ADD_PREFIX(Font, "Font_"); + ADD_PREFIX(SlateBrushAsset, "Brush_"); + ADD_PREFIX(SlateWidgetStyleAsset, "Style_"); + ADD_PREFIX(WidgetBlueprint, "WBP_"); + + // Effects + ADD_PREFIX(ParticleSystem, "PS_"); #undef ADD_PREFIX - SortConventions(); + SortConventions(); } - diff --git a/Source/GamemakinLinter/Public/GamemakinLinter.h b/Source/GamemakinLinter/Public/GamemakinLinter.h index cbcb27a..7717a81 100644 --- a/Source/GamemakinLinter/Public/GamemakinLinter.h +++ b/Source/GamemakinLinter/Public/GamemakinLinter.h @@ -3,19 +3,9 @@ DECLARE_LOG_CATEGORY_EXTERN(LogGamemakinLinter, Verbose, All); -class GAMEMAKINLINTER_API FGamemakinLinterModule : public IModuleInterface -{ +class GAMEMAKINLINTER_API FGamemakinLinterModule : public IModuleInterface { public: - - /** IModuleInterface implementation */ - virtual void StartupModule() override; - virtual void ShutdownModule() override; - - virtual bool SupportsDynamicReloading() override - { - return false; - } - -private: - -}; \ No newline at end of file + virtual bool SupportsDynamicReloading() override { + return false; + } +}; diff --git a/Source/GamemakinLinter/Public/GamemakinNamingConvention.h b/Source/GamemakinLinter/Public/GamemakinNamingConvention.h index 46237d8..19a3893 100644 --- a/Source/GamemakinLinter/Public/GamemakinNamingConvention.h +++ b/Source/GamemakinLinter/Public/GamemakinNamingConvention.h @@ -6,12 +6,9 @@ #include "GamemakinNamingConvention.generated.h" UCLASS() -class UGamemakinNamingConvention : public ULinterNamingConvention -{ - GENERATED_BODY() +class UGamemakinNamingConvention : public ULinterNamingConvention { + GENERATED_BODY() public: - - UGamemakinNamingConvention(const FObjectInitializer& ObjectInitializer); - + UGamemakinNamingConvention(const FObjectInitializer& ObjectInitializer); }; diff --git a/Source/Linter/Linter.Build.cs b/Source/Linter/Linter.Build.cs index b40c331..eb064ff 100644 --- a/Source/Linter/Linter.Build.cs +++ b/Source/Linter/Linter.Build.cs @@ -2,49 +2,21 @@ using UnrealBuildTool; -public class Linter : ModuleRules -{ - public Linter(ReadOnlyTargetRules Target) : base(Target) - { - PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; +public class Linter : ModuleRules { + public Linter(ReadOnlyTargetRules Target) : base(Target) { + PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - PublicDependencyModuleNames.AddRange( - new [] - { - "Core" - } - ); + PublicDependencyModuleNames.AddRange(new[] { "Core" }); + PrivateDependencyModuleNames.AddRange(new[] { + "CoreUObject", "Engine", "Slate", "SlateCore", "AppFramework", + "InputCore", "UnrealEd", "GraphEditor", "AssetTools", "EditorStyle", "BlueprintGraph", "PropertyEditor", + "LauncherPlatform", "Projects", "DesktopPlatform", "Json", "UATHelper" + }); - - PrivateDependencyModuleNames.AddRange( - new [] - { - "CoreUObject", - "Engine", - "Slate", - "SlateCore", - "AppFramework", - "InputCore", - "UnrealEd", - "GraphEditor", - "AssetTools", - "EditorStyle", - "BlueprintGraph", - "PropertyEditor", - "LauncherPlatform", - "Projects", - "DesktopPlatform", - "Json", - "UATHelper" - // ... add private dependencies that you statically link with here ... - } - ); - - PublicIncludePathModuleNames.Add("Launch"); + PublicIncludePathModuleNames.Add("Launch"); #if UE_4_20_OR_LATER PublicDefinitions.Add("UE_4_20_OR_LATER=1"); #endif - - } + } } \ No newline at end of file diff --git a/Source/Linter/Private/AnyObject_LinterDummyClass.cpp b/Source/Linter/Private/AnyObject_LinterDummyClass.cpp index e1b68d3..248cc0b 100644 --- a/Source/Linter/Private/AnyObject_LinterDummyClass.cpp +++ b/Source/Linter/Private/AnyObject_LinterDummyClass.cpp @@ -1,7 +1,4 @@ #include "AnyObject_LinterDummyClass.h" -UAnyObject_LinterDummyClass::UAnyObject_LinterDummyClass(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ - -} +UAnyObject_LinterDummyClass::UAnyObject_LinterDummyClass(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} diff --git a/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp b/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp index e39d21b..78f09aa 100644 --- a/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp +++ b/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp @@ -11,6 +11,7 @@ #include "AssetToolsModule.h" #include "Modules/ModuleManager.h" #include "IAssetTools.h" +#include "SUniformGridPanel.h" #include "Widgets/Notifications/SNotificationList.h" #include "Framework/Notifications/NotificationManager.h" #include "Logging/MessageLog.h" @@ -24,307 +25,289 @@ using FAppStyle = FEditorStyle; #endif -FDlgBatchRenameTool::FDlgBatchRenameTool(const TArray Assets) - : bRemovePrefix(false) - , bRemoveSuffix(false) - , SelectedAssets(Assets) -{ - if (FSlateApplication::IsInitialized()) - { - DialogWindow = SNew(SWindow) +FDlgBatchRenameTool::FDlgBatchRenameTool(const TArray Assets) : + bRemovePrefix(false), + bRemoveSuffix(false), + SelectedAssets(Assets) { + if (FSlateApplication::IsInitialized()) { + DialogWindow = SNew(SWindow) .Title(LOCTEXT("BatchRenameToolDlgTitle", "Batch Rename Tool")) .SupportsMinimize(false).SupportsMaximize(false) .SaneWindowPlacement(true) .AutoCenter(EAutoCenter::PreferredWorkArea) .ClientSize(FVector2D(350, 165)); - const TSharedPtr DialogWrapper = - SNew(SBorder) + const TSharedPtr DialogWrapper = + SNew(SBorder) .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(4.0f) - [ - SAssignNew(DialogWidget, SDlgBatchRenameTool) - .ParentWindow(DialogWindow) - ]; + [ + SAssignNew(DialogWidget, SDlgBatchRenameTool) + .ParentWindow(DialogWindow) + ]; - DialogWindow->SetContent(DialogWrapper.ToSharedRef()); - } + DialogWindow->SetContent(DialogWrapper.ToSharedRef()); + } } -FDlgBatchRenameTool::EResult FDlgBatchRenameTool::ShowModal() -{ - //Show Dialog - GEditor->EditorAddModalWindow(DialogWindow.ToSharedRef()); - const EResult UserResponse = (EResult)DialogWidget->GetUserResponse(); - if (UserResponse == Confirm) - { - Prefix = DialogWidget->PrefixTextBox->GetText().ToString(); - Suffix = DialogWidget->SuffixTextBox->GetText().ToString(); - bRemovePrefix = DialogWidget->PrefixRemoveBox->IsChecked(); - bRemoveSuffix = DialogWidget->SuffixRemoveBox->IsChecked(); +FDlgBatchRenameTool::EResult FDlgBatchRenameTool::ShowModal() { + //Show Dialog + GEditor->EditorAddModalWindow(DialogWindow.ToSharedRef()); + const EResult UserResponse = DialogWidget->GetUserResponse(); - Find = DialogWidget->FindTextBox->GetText().ToString(); - Replace = DialogWidget->ReplaceTextBox->GetText().ToString(); + if (UserResponse == Confirm) { + Prefix = DialogWidget->PrefixTextBox->GetText().ToString(); + Suffix = DialogWidget->SuffixTextBox->GetText().ToString(); + bRemovePrefix = DialogWidget->PrefixRemoveBox->IsChecked(); + bRemoveSuffix = DialogWidget->SuffixRemoveBox->IsChecked(); - // If no information is given, treat as canceled - if (Prefix.IsEmpty() && Suffix.IsEmpty() && Find.IsEmpty()) - { - return Cancel; - } + Find = DialogWidget->FindTextBox->GetText().ToString(); + Replace = DialogWidget->ReplaceTextBox->GetText().ToString(); - const FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked("AssetTools"); - TArray AssetsAndNames; + // If no information is given, treat as canceled + if (Prefix.IsEmpty() && Suffix.IsEmpty() && Find.IsEmpty()) { + return Cancel; + } - for (auto AssetIt = SelectedAssets.CreateConstIterator(); AssetIt; ++AssetIt) - { - const FAssetData& Asset = *AssetIt; + const FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked("AssetTools"); + TArray AssetsAndNames; - // Early out on assets that can not be renamed + for (auto AssetIt = SelectedAssets.CreateConstIterator(); AssetIt; ++AssetIt) { + const FAssetData& Asset = *AssetIt; + + // Early out on assets that can not be renamed #if UE_VERSION_NEWER_THAN(5, 1, 0) - if (!(!Asset.IsRedirector() && Asset.AssetClassPath.GetAssetName() != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly))) + if (!(!Asset.IsRedirector() && Asset.AssetClassPath.GetAssetName() != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly))) #else - if (!(!Asset.IsRedirector() && Asset.AssetClass != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly))) + if (!(!Asset.IsRedirector() && Asset.AssetClass != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly))) #endif - { - continue; - } + { + continue; + } - // Work on a copy of the asset name and see if after name operations - // if the copy is different than the original before creating rename data - FString AssetNewName = Asset.AssetName.ToString(); + // Work on a copy of the asset name and see if after name operations + // if the copy is different than the original before creating rename data + FString AssetNewName = Asset.AssetName.ToString(); - if (!Find.IsEmpty()) - { - AssetNewName.ReplaceInline(*Find, *Replace); - } + if (!Find.IsEmpty()) { + AssetNewName.ReplaceInline(*Find, *Replace); + } - if (!Prefix.IsEmpty()) - { - if (bRemovePrefix) - { - AssetNewName.RemoveFromStart(Prefix, ESearchCase::CaseSensitive); - } - else - { - if (!AssetNewName.StartsWith(Prefix, ESearchCase::CaseSensitive)) - { - AssetNewName.InsertAt(0, Prefix); - } - } - } + if (!Prefix.IsEmpty()) { + if (bRemovePrefix) { + AssetNewName.RemoveFromStart(Prefix, ESearchCase::CaseSensitive); + } else { + if (!AssetNewName.StartsWith(Prefix, ESearchCase::CaseSensitive)) { + AssetNewName.InsertAt(0, Prefix); + } + } + } - if (!Suffix.IsEmpty()) - { - if (bRemoveSuffix) - { - AssetNewName.RemoveFromEnd(Suffix, ESearchCase::CaseSensitive); - } - else - { - if (!AssetNewName.EndsWith(Suffix, ESearchCase::CaseSensitive)) - { - AssetNewName = AssetNewName.Append(Suffix); - } - } - } + if (!Suffix.IsEmpty()) { + if (bRemoveSuffix) { + AssetNewName.RemoveFromEnd(Suffix, ESearchCase::CaseSensitive); + } else { + if (!AssetNewName.EndsWith(Suffix, ESearchCase::CaseSensitive)) { + AssetNewName = AssetNewName.Append(Suffix); + } + } + } - if (AssetNewName != Asset.AssetName.ToString()) - { - AssetsAndNames.Push(FAssetRenameData(Asset.GetAsset(), Asset.PackagePath.ToString(), AssetNewName)); - } - } + if (AssetNewName != Asset.AssetName.ToString()) { + AssetsAndNames.Push(FAssetRenameData(Asset.GetAsset(), Asset.PackagePath.ToString(), AssetNewName)); + } + } - if (!AssetToolsModule.Get().RenameAssets(AssetsAndNames)) - { - FNotificationInfo NotificationInfo(LOCTEXT("BatchRenameFailed", "Batch Rename operation did not fully complete successfully. Maybe fix up redirectors? Check Output Log for details!")); - NotificationInfo.ExpireDuration = 6.0f; - NotificationInfo.Hyperlink = FSimpleDelegate::CreateStatic([]() { FMessageLog("LoadErrors").Open(EMessageSeverity::Info, true); }); - NotificationInfo.HyperlinkText = LOCTEXT("LoadObjectHyperlink", "Show Message Log"); - FSlateNotificationManager::Get().AddNotification(NotificationInfo); - } - } - return UserResponse; + if (!AssetToolsModule.Get().RenameAssets(AssetsAndNames)) { + FNotificationInfo NotificationInfo(LOCTEXT("BatchRenameFailed", "Batch Rename operation did not fully complete successfully. Maybe fix up redirectors? Check Output Log for details!")); + NotificationInfo.ExpireDuration = 6.0f; + NotificationInfo.Hyperlink = FSimpleDelegate::CreateStatic([]() { + FMessageLog("LoadErrors").Open(EMessageSeverity::Info, true); + }); + NotificationInfo.HyperlinkText = LOCTEXT("LoadObjectHyperlink", "Show Message Log"); + FSlateNotificationManager::Get().AddNotification(NotificationInfo); + } + } + return UserResponse; } -void SDlgBatchRenameTool::Construct(const FArguments& InArgs) -{ - UserResponse = FDlgBatchRenameTool::Cancel; - ParentWindow = InArgs._ParentWindow.Get(); +void SDlgBatchRenameTool::Construct(const FArguments& InArgs) { + UserResponse = FDlgBatchRenameTool::Cancel; + ParentWindow = InArgs._ParentWindow.Get(); - this->ChildSlot[ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - .VAlign(VAlign_Center) - .HAlign(HAlign_Right) - .Padding(0.0f, 0.0f, 8.0f, 0.0f) - [ - SNew(SBox) - .WidthOverride(48.0f) - [ - SNew(STextBlock) + this->ChildSlot[ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + .VAlign(VAlign_Center) + .HAlign(HAlign_Right) + .Padding(0.0f, 0.0f, 8.0f, 0.0f) + [ + SNew(SBox) + .WidthOverride(48.0f) + [ + SNew(STextBlock) .Text(LOCTEXT("BatchRenameToolDlgPrefix", "Prefix")) .Justification(ETextJustify::Right) - ] - ] - + SHorizontalBox::Slot() - .FillWidth(1.0f) - .Padding(0.0f, 0.0f, 8.0f, 0.0f) - [ - SAssignNew(PrefixTextBox, SEditableTextBox) - ] - + SHorizontalBox::Slot() - .AutoWidth() - .Padding(0.0f, 0.0f, 0.0f, 0.0f) - [ - SAssignNew(PrefixRemoveBox, SCheckBox) - ] - + SHorizontalBox::Slot() - .AutoWidth() - .VAlign(VAlign_Center) - .Padding(0.0f, 0.0f, 8.0f, 0.0f) - [ - SNew(STextBlock) - .Text(LOCTEXT("BatchRenameToolDlgRemove", "Remove")) - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - .VAlign(VAlign_Center) - .HAlign(HAlign_Right) - .Padding(0.0f, 0.0f, 8.0f, 0.0f) - [ - SNew(SBox) - .WidthOverride(48.0f) - [ - SNew(STextBlock) + ] + ] + + SHorizontalBox::Slot() + .FillWidth(1.0f) + .Padding(0.0f, 0.0f, 8.0f, 0.0f) + [ + SAssignNew(PrefixTextBox, SEditableTextBox) + ] + + SHorizontalBox::Slot() + .AutoWidth() + .Padding(0.0f, 0.0f, 0.0f, 0.0f) + [ + SAssignNew(PrefixRemoveBox, SCheckBox) + ] + + SHorizontalBox::Slot() + .AutoWidth() + .VAlign(VAlign_Center) + .Padding(0.0f, 0.0f, 8.0f, 0.0f) + [ + SNew(STextBlock) + .Text(LOCTEXT("BatchRenameToolDlgRemove", "Remove")) + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + .VAlign(VAlign_Center) + .HAlign(HAlign_Right) + .Padding(0.0f, 0.0f, 8.0f, 0.0f) + [ + SNew(SBox) + .WidthOverride(48.0f) + [ + SNew(STextBlock) .Text(LOCTEXT("BatchRenameToolDlgSuffix", "Suffix")) .Justification(ETextJustify::Right) - ] - ] - + SHorizontalBox::Slot() - .FillWidth(1.0f) - .Padding(0.0f, 0.0f, 8.0f, 0.0f) - [ - SAssignNew(SuffixTextBox, SEditableTextBox) - ] - + SHorizontalBox::Slot() - .AutoWidth() - .Padding(0.0f, 0.0f, 0.0f, 0.0f) - [ - SAssignNew(SuffixRemoveBox, SCheckBox) - ] - + SHorizontalBox::Slot() - .AutoWidth() - .VAlign(VAlign_Center) - .Padding(0.0f, 0.0f, 8.0f, 0.0f) - [ - SNew(STextBlock) - .Text(LOCTEXT("BatchRenameToolDlgRemove", "Remove")) - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SSeparator) - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - .Padding(0.0f, 0.0f, 8.0f, 0.0f) - [ - SNew(SBox) - .WidthOverride(48.0f) - [ - SNew(STextBlock) + ] + ] + + SHorizontalBox::Slot() + .FillWidth(1.0f) + .Padding(0.0f, 0.0f, 8.0f, 0.0f) + [ + SAssignNew(SuffixTextBox, SEditableTextBox) + ] + + SHorizontalBox::Slot() + .AutoWidth() + .Padding(0.0f, 0.0f, 0.0f, 0.0f) + [ + SAssignNew(SuffixRemoveBox, SCheckBox) + ] + + SHorizontalBox::Slot() + .AutoWidth() + .VAlign(VAlign_Center) + .Padding(0.0f, 0.0f, 8.0f, 0.0f) + [ + SNew(STextBlock) + .Text(LOCTEXT("BatchRenameToolDlgRemove", "Remove")) + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SSeparator) + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + .Padding(0.0f, 0.0f, 8.0f, 0.0f) + [ + SNew(SBox) + .WidthOverride(48.0f) + [ + SNew(STextBlock) .Text(LOCTEXT("BatchRenameToolDlgFind", "Find")) .Justification(ETextJustify::Right) - ] - ] - + SHorizontalBox::Slot() - .FillWidth(1.0f) - .Padding(0.0f, 0.0f, 8.0f, 0.0f) - [ - SAssignNew(FindTextBox, SEditableTextBox) - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - .Padding(0.0f, 0.0f, 8.0f, 0.0f) - [ - SNew(SBox) - .WidthOverride(48.0f) - [ - SNew(STextBlock) + ] + ] + + SHorizontalBox::Slot() + .FillWidth(1.0f) + .Padding(0.0f, 0.0f, 8.0f, 0.0f) + [ + SAssignNew(FindTextBox, SEditableTextBox) + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + .Padding(0.0f, 0.0f, 8.0f, 0.0f) + [ + SNew(SBox) + .WidthOverride(48.0f) + [ + SNew(STextBlock) .Text(LOCTEXT("BatchRenameToolDlgReplace", "Replace")) .Justification(ETextJustify::Right) - ] - ] - + SHorizontalBox::Slot() - .FillWidth(1.0f) - .Padding(0.0f, 0.0f, 8.0f, 0.0f) - [ - SAssignNew(ReplaceTextBox, SEditableTextBox) - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SSeparator) - ] - + SVerticalBox::Slot() - .AutoHeight() - .HAlign(HAlign_Right) - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SUniformGridPanel) + ] + ] + + SHorizontalBox::Slot() + .FillWidth(1.0f) + .Padding(0.0f, 0.0f, 8.0f, 0.0f) + [ + SAssignNew(ReplaceTextBox, SEditableTextBox) + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SSeparator) + ] + + SVerticalBox::Slot() + .AutoHeight() + .HAlign(HAlign_Right) + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SUniformGridPanel) .SlotPadding(FAppStyle::GetMargin("StandardDialog.SlotPadding")) .MinDesiredSlotWidth(FAppStyle::GetFloat("StandardDialog.MinDesiredSlotWidth")) .MinDesiredSlotHeight(FAppStyle::GetFloat("StandardDialog.MinDesiredSlotHeight")) - + SUniformGridPanel::Slot(0, 0) - [ - SNew(SButton) + + SUniformGridPanel::Slot(0, 0) + [ + SNew(SButton) .HAlign(HAlign_Center) .ContentPadding(FAppStyle::GetMargin("StandardDialog.ContentPadding")) .OnClicked(this, &SDlgBatchRenameTool::OnButtonClick, FDlgBatchRenameTool::Confirm) .Text(LOCTEXT("SkeletonMergeOk", "OK")) - ] - + SUniformGridPanel::Slot(1, 0) - [ - SNew(SButton) + ] + + SUniformGridPanel::Slot(1, 0) + [ + SNew(SButton) .HAlign(HAlign_Center) .ContentPadding(FAppStyle::GetMargin("StandardDialog.ContentPadding")) .OnClicked(this, &SDlgBatchRenameTool::OnButtonClick, FDlgBatchRenameTool::Cancel) .Text(LOCTEXT("SkeletonMergeCancel", "Cancel")) - ] - ] - ]; + ] + ] + ]; } -FDlgBatchRenameTool::EResult SDlgBatchRenameTool::GetUserResponse() const -{ - return UserResponse; +FDlgBatchRenameTool::EResult SDlgBatchRenameTool::GetUserResponse() const { + return UserResponse; } -#undef LOCTEXT_NAMESPACE \ No newline at end of file +#undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/LintRule.cpp b/Source/Linter/Private/LintRule.cpp index b522cc9..96d3082 100644 --- a/Source/Linter/Private/LintRule.cpp +++ b/Source/Linter/Private/LintRule.cpp @@ -9,245 +9,202 @@ #include "IAssetTools.h" #include "AssetRegistry/AssetRegistryModule.h" #include "Misc/EngineVersionComparison.h" +#if UE_VERSION_NEWER_THAN(5, 2, 0) +#include "MaterialDomain.h" +#endif -ULintRule::ULintRule(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ - -} +ULintRule::ULintRule(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} -bool ULintRule::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, OUT TArray& OutRuleViolations) const -{ - return true; +bool ULintRule::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, OUT TArray& OutRuleViolations) const { + return true; } -bool ULintRule::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - OutRuleViolations.Empty(); +bool ULintRule::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + OutRuleViolations.Empty(); - if (ObjectToLint == nullptr) - { - return true; - } + if (ObjectToLint == nullptr) { + return true; + } - if (ParentRuleSet == nullptr) - { - return true; - } + if (ParentRuleSet == nullptr) { + return true; + } - if (IsRuleSuppressed()) - { - return true; - } + if (IsRuleSuppressed()) { + return true; + } - return PassesRule_Internal(ObjectToLint, ParentRuleSet, OutRuleViolations); + return PassesRule_Internal(ObjectToLint, ParentRuleSet, OutRuleViolations); } -bool ULintRule::IsRuleSuppressed() const -{ - return false; +bool ULintRule::IsRuleSuppressed() const { + return false; } -FName ULintRule::GetRuleBasedObjectVariantName_Implementation(UObject* ObjectToLint) const -{ - if (ObjectToLint == nullptr) - { - return NAME_None; - } +FName ULintRule::GetRuleBasedObjectVariantName_Implementation(UObject* ObjectToLint) const { + if (ObjectToLint == nullptr) { + return NAME_None; + } - { - const UMaterialInterface* MI = Cast(ObjectToLint); - if (MI != nullptr) - { + { + const UMaterialInterface* MI = Cast(ObjectToLint); + if (MI != nullptr) { #if UE_VERSION_NEWER_THAN(4, 25, 0) - TMicRecursionGuard RecursionGuard; + TMicRecursionGuard RecursionGuard; #else - UMaterialInterface::TMicRecursionGuard RecursionGuard; + UMaterialInterface::TMicRecursionGuard RecursionGuard; #endif - const UMaterial* Material = MI->GetMaterial_Concurrent(RecursionGuard); - if (Material != nullptr) - { - if (Material->MaterialDomain == MD_PostProcess) - { - return "PostProcess"; - } - } - } - } - - { - const UBlueprint* Blueprint = Cast(ObjectToLint); - if (Blueprint != nullptr) - { - if (Blueprint->BlueprintType == BPTYPE_MacroLibrary) - { - return "MacroLibrary"; - } - - if (FBlueprintEditorUtils::IsInterfaceBlueprint(Blueprint)) - { - return "Interface"; - } - - if (Blueprint->BlueprintType == BPTYPE_FunctionLibrary) - { - return "FunctionLibrary"; - } - } - } - - return NAME_None; -} - -TArray FLintRuleViolation::AllRuleViolationsWithViolator(const TArray& RuleViolationCollection, const UObject* SearchViolator) -{ - return RuleViolationCollection.FilterByPredicate([SearchViolator](const FLintRuleViolation& RuleViolation) - { - if (SearchViolator != nullptr && RuleViolation.Violator.Get() == SearchViolator) - { - return true; - } - - return false; - }); -} - -TArray> FLintRuleViolation::AllRuleViolationsWithViolatorShared(const TArray>& RuleViolationCollection, const UObject* SearchViolator) -{ - return RuleViolationCollection.FilterByPredicate([SearchViolator](const TSharedPtr& RuleViolation) - { - if (SearchViolator != nullptr && RuleViolation->Violator.Get() == SearchViolator) - { - return true; - } - - return false; - }); -} - -TArray> FLintRuleViolation::AllRuleViolationsWithViolatorShared(const TArray& RuleViolationCollection, const UObject* SearchViolator) -{ - // This should really be done when the structs are first created - TArray> SharedViolations; - TArray Violations = AllRuleViolationsWithViolator(RuleViolationCollection, SearchViolator); - for (const FLintRuleViolation Violation : Violations) - { - SharedViolations.Push(TSharedPtr(new FLintRuleViolation(Violation))); - } - - return SharedViolations; -} - -TArray FLintRuleViolation::AllRuleViolationsOfSpecificRule(const TArray& RuleViolationCollection, TSubclassOf SearchRule) -{ - return RuleViolationCollection.FilterByPredicate([SearchRule](const FLintRuleViolation& RuleViolation) - { - if (SearchRule.Get() != nullptr && RuleViolation.ViolatedRule == SearchRule) - { - return true; - } - - return false; - }); -} - -TArray FLintRuleViolation::AllRuleViolationsOfRuleGroup(const TArray& RuleViolationCollection, FName SearchRuleGroup) -{ - return RuleViolationCollection.FilterByPredicate([SearchRuleGroup](const FLintRuleViolation& RuleViolation) - { - if (RuleViolation.ViolatedRule.Get() != nullptr && RuleViolation.ViolatedRule.GetDefaultObject()->RuleGroup == SearchRuleGroup) - { - return true; - } - - return false; - }); -} - -TArray FLintRuleViolation::AllRuleViolationViolators(const TArray& RuleViolationCollection) -{ - TArray Violators; - for (const FLintRuleViolation& RuleViolation : RuleViolationCollection) - { - Violators.Add(RuleViolation.Violator.Get()); - } - return Violators; + const UMaterial* Material = MI->GetMaterial_Concurrent(RecursionGuard); + if (Material != nullptr) { + if (Material->MaterialDomain == MD_PostProcess) { + return "PostProcess"; + } + } + } + } + + { + const UBlueprint* Blueprint = Cast(ObjectToLint); + if (Blueprint != nullptr) { + if (Blueprint->BlueprintType == BPTYPE_MacroLibrary) { + return "MacroLibrary"; + } + + if (FBlueprintEditorUtils::IsInterfaceBlueprint(Blueprint)) { + return "Interface"; + } + + if (Blueprint->BlueprintType == BPTYPE_FunctionLibrary) { + return "FunctionLibrary"; + } + } + } + + return NAME_None; } -TArray FLintRuleViolation::AllRuleViolationViolators(const TArray>& RuleViolationCollection) -{ - TArray Violators; - for (const TSharedPtr& RuleViolation : RuleViolationCollection) - { - Violators.AddUnique(RuleViolation->Violator.Get()); - } - return Violators; +TArray FLintRuleViolation::AllRuleViolationsWithViolator(const TArray& RuleViolationCollection, const UObject* SearchViolator) { + return RuleViolationCollection.FilterByPredicate([SearchViolator](const FLintRuleViolation& RuleViolation) { + if (SearchViolator != nullptr && RuleViolation.Violator.Get() == SearchViolator) { + return true; + } + + return false; + }); } -TMultiMap FLintRuleViolation::AllRuleViolationsMappedByViolator(const TArray& RuleViolationCollection) -{ - TMultiMap ViolatorViolationsMultiMap; +TArray> FLintRuleViolation::AllRuleViolationsWithViolatorShared(const TArray>& RuleViolationCollection, const UObject* SearchViolator) { + return RuleViolationCollection.FilterByPredicate([SearchViolator](const TSharedPtr& RuleViolation) { + if (SearchViolator != nullptr && RuleViolation->Violator.Get() == SearchViolator) { + return true; + } + + return false; + }); +} - for (const FLintRuleViolation& RuleViolation : RuleViolationCollection) - { - ViolatorViolationsMultiMap.Add(RuleViolation.Violator.Get(), RuleViolation); - } +TArray> FLintRuleViolation::AllRuleViolationsWithViolatorShared(const TArray& RuleViolationCollection, const UObject* SearchViolator) { + // This should really be done when the structs are first created + TArray> SharedViolations; + TArray Violations = AllRuleViolationsWithViolator(RuleViolationCollection, SearchViolator); + for (const FLintRuleViolation Violation : Violations) { + SharedViolations.Push(MakeShared(Violation)); + } - return ViolatorViolationsMultiMap; + return SharedViolations; } -TMultiMap FLintRuleViolation::AllRuleViolationsMappedByViolatedLintRule(const TArray& RuleViolationCollection) -{ - TMultiMap LintRuleViolationsMultiMap; +TArray FLintRuleViolation::AllRuleViolationsOfSpecificRule(const TArray& RuleViolationCollection, TSubclassOf SearchRule) { + return RuleViolationCollection.FilterByPredicate([SearchRule](const FLintRuleViolation& RuleViolation) { + if (SearchRule.Get() != nullptr && RuleViolation.ViolatedRule == SearchRule) { + return true; + } - for (const FLintRuleViolation& RuleViolation : RuleViolationCollection) - { - LintRuleViolationsMultiMap.Add(RuleViolation.ViolatedRule.GetDefaultObject(), RuleViolation); - } + return false; + }); +} + +TArray FLintRuleViolation::AllRuleViolationsOfRuleGroup(const TArray& RuleViolationCollection, FName SearchRuleGroup) { + return RuleViolationCollection.FilterByPredicate([SearchRuleGroup](const FLintRuleViolation& RuleViolation) { + if (RuleViolation.ViolatedRule.Get() != nullptr && RuleViolation.ViolatedRule.GetDefaultObject()->RuleGroup == SearchRuleGroup) { + return true; + } - return LintRuleViolationsMultiMap; + return false; + }); } -TMultiMap> FLintRuleViolation::AllRuleViolationsMappedByViolatedLintRuleShared(const TArray& RuleViolationCollection) -{ - // We should really just create shared ptrs to begin with instead of doing this - TMultiMap> LintRuleViolationsMultiMap; +TArray FLintRuleViolation::AllRuleViolationViolators(const TArray& RuleViolationCollection) { + TArray Violators; + for (const FLintRuleViolation& RuleViolation : RuleViolationCollection) { + Violators.Add(RuleViolation.Violator.Get()); + } + return Violators; +} - for (const FLintRuleViolation& RuleViolation : RuleViolationCollection) - { - LintRuleViolationsMultiMap.Add(RuleViolation.ViolatedRule.GetDefaultObject(), TSharedPtr(new FLintRuleViolation(RuleViolation))); - } +TArray FLintRuleViolation::AllRuleViolationViolators(const TArray>& RuleViolationCollection) { + TArray Violators; + for (const TSharedPtr& RuleViolation : RuleViolationCollection) { + Violators.AddUnique(RuleViolation->Violator.Get()); + } + return Violators; +} + +TMultiMap FLintRuleViolation::AllRuleViolationsMappedByViolator(const TArray& RuleViolationCollection) { + TMultiMap ViolatorViolationsMultiMap; + + for (const FLintRuleViolation& RuleViolation : RuleViolationCollection) { + ViolatorViolationsMultiMap.Add(RuleViolation.Violator.Get(), RuleViolation); + } + + return ViolatorViolationsMultiMap; +} + +TMultiMap FLintRuleViolation::AllRuleViolationsMappedByViolatedLintRule(const TArray& RuleViolationCollection) { + TMultiMap LintRuleViolationsMultiMap; - return LintRuleViolationsMultiMap; + for (const FLintRuleViolation& RuleViolation : RuleViolationCollection) { + LintRuleViolationsMultiMap.Add(RuleViolation.ViolatedRule.GetDefaultObject(), RuleViolation); + } + + return LintRuleViolationsMultiMap; +} + +TMultiMap> FLintRuleViolation::AllRuleViolationsMappedByViolatedLintRuleShared(const TArray& RuleViolationCollection) { + // We should really just create shared ptrs to begin with instead of doing this + TMultiMap> LintRuleViolationsMultiMap; + + for (const FLintRuleViolation& RuleViolation : RuleViolationCollection) { + LintRuleViolationsMultiMap.Add(RuleViolation.ViolatedRule.GetDefaultObject(), MakeShared(RuleViolation)); + } + + return LintRuleViolationsMultiMap; } -TMultiMap> FLintRuleViolation::AllRuleViolationsMappedByViolatedLintRuleShared(const TArray>& RuleViolationCollection) -{ - TMultiMap> LintRuleViolationsMultiMap; +TMultiMap> FLintRuleViolation::AllRuleViolationsMappedByViolatedLintRuleShared(const TArray>& RuleViolationCollection) { + TMultiMap> LintRuleViolationsMultiMap; - for (const TSharedPtr& RuleViolation : RuleViolationCollection) - { - LintRuleViolationsMultiMap.Add(RuleViolation->ViolatedRule.GetDefaultObject(), RuleViolation); - } + for (const TSharedPtr& RuleViolation : RuleViolationCollection) { + LintRuleViolationsMultiMap.Add(RuleViolation->ViolatedRule.GetDefaultObject(), RuleViolation); + } - return LintRuleViolationsMultiMap; + return LintRuleViolationsMultiMap; } -bool FLintRuleViolation::PopulateAssetData() -{ - const IAssetRegistry& AssetRegistry = FModuleManager::LoadModuleChecked("AssetRegistry").Get(); - TArray AssetRenameData; +bool FLintRuleViolation::PopulateAssetData() { + const IAssetRegistry& AssetRegistry = FModuleManager::LoadModuleChecked("AssetRegistry").Get(); + TArray AssetRenameData; - if (Violator.IsValid()) - { + if (Violator.IsValid()) { #if UE_VERSION_NEWER_THAN(5, 1, 0) - ViolatorAssetData = AssetRegistry.GetAssetByObjectPath(Violator->GetPathName()); + ViolatorAssetData = AssetRegistry.GetAssetByObjectPath(Violator->GetPathName()); #else - ViolatorAssetData = AssetRegistry.GetAssetByObjectPath(FName(*Violator->GetPathName())); + ViolatorAssetData = AssetRegistry.GetAssetByObjectPath(FName(*Violator->GetPathName())); #endif - return ViolatorAssetData.IsValid(); - } + return ViolatorAssetData.IsValid(); + } - return false; -} \ No newline at end of file + return false; +} diff --git a/Source/Linter/Private/LintRuleSet.cpp b/Source/Linter/Private/LintRuleSet.cpp index ed9721b..d69e4d4 100644 --- a/Source/Linter/Private/LintRuleSet.cpp +++ b/Source/Linter/Private/LintRuleSet.cpp @@ -7,183 +7,153 @@ #include "Modules/ModuleManager.h" #include "HAL/RunnableThread.h" -ULintRuleSet::ULintRuleSet(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ +ULintRuleSet::ULintRuleSet(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} +ULinterNamingConvention* ULintRuleSet::GetNamingConvention() const { + return NamingConvention.Get(); } -ULinterNamingConvention* ULintRuleSet::GetNamingConvention() const -{ - return NamingConvention.Get(); -} +TArray ULintRuleSet::LintPath(TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask /*= nullptr*/) const { + // ReSharper disable once CppExpressionWithoutSideEffects + NamingConvention.LoadSynchronous(); + + TArray RuleViolations; + + if (AssetPaths.Num() == 0) { + AssetPaths.Push(TEXT("/Game")); + } + + // Begin loading assets + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); + + UE_LOG(LogLinter, Display, TEXT("Loading the asset registry...")); + AssetRegistryModule.Get().SearchAllAssets(/*bSynchronousSearch =*/true); + UE_LOG(LogLinter, Display, TEXT("Finished loading the asset registry. Loading assets...")); + + TArray AssetList; + + FARFilter ARFilter; + ARFilter.bRecursivePaths = true; + + for (const FString& AssetPath : AssetPaths) { + UE_LOG(LogLinter, Display, TEXT("Adding path \"%s\" to be linted."), *AssetPath); + ARFilter.PackagePaths.Push(FName(*AssetPath)); + } + + AssetRegistryModule.Get().GetAssets(ARFilter, AssetList); -TArray ULintRuleSet::LintPath(TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask /*= nullptr*/) const -{ - // ReSharper disable once CppExpressionWithoutSideEffects - NamingConvention.LoadSynchronous(); - - TArray RuleViolations; - - if (AssetPaths.Num() == 0) - { - AssetPaths.Push(TEXT("/Game")); - } - - // Begin loading assets - const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); - - UE_LOG(LogLinter, Display, TEXT("Loading the asset registry...")); - AssetRegistryModule.Get().SearchAllAssets(/*bSynchronousSearch =*/true); - UE_LOG(LogLinter, Display, TEXT("Finished loading the asset registry. Loading assets...")); - - TArray AssetList; - - FARFilter ARFilter; - ARFilter.bRecursivePaths = true; - - for (const FString& AssetPath : AssetPaths) - { - UE_LOG(LogLinter, Display, TEXT("Adding path \"%s\" to be linted."), *AssetPath); - ARFilter.PackagePaths.Push(FName(*AssetPath)); - } - - AssetRegistryModule.Get().GetAssets(ARFilter, AssetList); - - TArray LintRunners; - TArray Threads; - - if (ParentScopedSlowTask != nullptr) - { - ParentScopedSlowTask->TotalAmountOfWork = AssetList.Num() + 2; - ParentScopedSlowTask->CompletedWork = 0.0f; - } - - for (FAssetData const& Asset : AssetList) - { - check(Asset.IsValid()); - UE_LOG(LogLinter, Verbose, TEXT("Creating Lint Thread for asset \"%s\"."), *Asset.AssetName.ToString()); - UObject* Object = Asset.GetAsset(); - check(Object != nullptr); - - FLintRunner* Runner = new FLintRunner(Object, this, &RuleViolations, ParentScopedSlowTask); - check(Runner != nullptr); - - LintRunners.Add(Runner); - - if (Runner->RequiresGamethread()) - { - Runner->Run(); - // If we're given a scoped slow task, update its progress now... - if (ParentScopedSlowTask != nullptr) - { - ParentScopedSlowTask->EnterProgressFrame(1.0f); - } - } - else - { + TArray LintRunners; + TArray Threads; + + if (ParentScopedSlowTask != nullptr) { + ParentScopedSlowTask->TotalAmountOfWork = AssetList.Num() + 2; + ParentScopedSlowTask->CompletedWork = 0.0f; + } + + for (const FAssetData& Asset : AssetList) { + check(Asset.IsValid()); + UE_LOG(LogLinter, Verbose, TEXT("Creating Lint Thread for asset \"%s\"."), *Asset.AssetName.ToString()); + UObject* Object = Asset.GetAsset(); + check(Object != nullptr); + + FLintRunner* Runner = new FLintRunner(Object, this, &RuleViolations, ParentScopedSlowTask); + check(Runner != nullptr); + + LintRunners.Add(Runner); + + if (Runner->RequiresGamethread()) { + Runner->Run(); + // If we're given a scoped slow task, update its progress now... + if (ParentScopedSlowTask != nullptr) { + ParentScopedSlowTask->EnterProgressFrame(1.0f); + } + } else { #if UE_VERSION_NEWER_THAN(5, 1, 0) - Threads.Push(FRunnableThread::Create(Runner, *FString::Printf(TEXT("FLintRunner - %s"), *Asset.GetObjectPathString()), 0, TPri_Normal)); + Threads.Push(FRunnableThread::Create(Runner, *FString::Printf(TEXT("FLintRunner - %s"), *Asset.GetObjectPathString()), 0, TPri_Normal)); #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.ObjectPath.ToString()), 0, TPri_Normal)); #endif - if (ParentScopedSlowTask != nullptr) - { - ParentScopedSlowTask->EnterProgressFrame(1.0f); - } - } - } - - for (FRunnableThread* Thread : Threads) - { - Thread->WaitForCompletion(); - } - - if (ParentScopedSlowTask != nullptr) - { - ParentScopedSlowTask->EnterProgressFrame(1.0f, NSLOCTEXT("Linter", "ScanTaskFinished", "Tabulating Data...")); - } - - return RuleViolations; + if (ParentScopedSlowTask != nullptr) { + ParentScopedSlowTask->EnterProgressFrame(1.0f); + } + } + } + + for (FRunnableThread* Thread : Threads) { + Thread->WaitForCompletion(); + } + + if (ParentScopedSlowTask != nullptr) { + ParentScopedSlowTask->EnterProgressFrame(1.0f, NSLOCTEXT("Linter", "ScanTaskFinished", "Tabulating Data...")); + } + + return RuleViolations; } -TArray> ULintRuleSet::LintPathShared(const TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask /*= nullptr*/) const -{ - TArray RuleViolations = LintPath(AssetPaths, ParentScopedSlowTask); +TArray> ULintRuleSet::LintPathShared(const TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask /*= nullptr*/) const { + TArray RuleViolations = LintPath(AssetPaths, ParentScopedSlowTask); - TArray> SharedRuleViolations; - for (const FLintRuleViolation Violation : RuleViolations) - { - TSharedPtr SharedViolation = MakeShared(Violation); - SharedViolation->PopulateAssetData(); - SharedRuleViolations.Push(SharedViolation); - } + TArray> SharedRuleViolations; + for (const FLintRuleViolation Violation : RuleViolations) { + TSharedPtr SharedViolation = MakeShared(Violation); + SharedViolation->PopulateAssetData(); + SharedRuleViolations.Push(SharedViolation); + } - return SharedRuleViolations; + return SharedRuleViolations; } -const FLintRuleList* ULintRuleSet::GetLintRuleListForClass(const TSoftClassPtr Class) const -{ - UClass* SearchClass = Class.LoadSynchronous(); - while (SearchClass != nullptr) - { - const FLintRuleList* RuleList = ClassLintRulesMap.Find(SearchClass); - if (RuleList != nullptr) - { - return RuleList; - } - - // @HACK: If we reach UObject, find our hack rule for fallback - if (SearchClass == UObject::StaticClass()) - { - const FLintRuleList* AnyObjectRuleList = ClassLintRulesMap.Find(UAnyObject_LinterDummyClass::StaticClass()); - return AnyObjectRuleList; - } - - // Load our parent class in case we failed to get naming conventions - SearchClass = SearchClass->GetSuperClass(); - } - - return nullptr; +const FLintRuleList* ULintRuleSet::GetLintRuleListForClass(const TSoftClassPtr Class) const { + UClass* SearchClass = Class.LoadSynchronous(); + while (SearchClass != nullptr) { + const FLintRuleList* RuleList = ClassLintRulesMap.Find(SearchClass); + if (RuleList != nullptr) { + return RuleList; + } + + // @HACK: If we reach UObject, find our hack rule for fallback + if (SearchClass == UObject::StaticClass()) { + const FLintRuleList* AnyObjectRuleList = ClassLintRulesMap.Find(UAnyObject_LinterDummyClass::StaticClass()); + return AnyObjectRuleList; + } + + // Load our parent class in case we failed to get naming conventions + SearchClass = SearchClass->GetSuperClass(); + } + + return nullptr; } -bool FLintRuleList::RequiresGameThread() const -{ - for (TSubclassOf LintRuleSubClass : LintRules) - { - UClass* LintClass = LintRuleSubClass.Get(); - if (LintClass != nullptr) - { - const ULintRule* LintRule = GetDefault(LintClass); - if (LintRule != nullptr && LintRule->bRequiresGameThread) - { - return true; - } - } - } - - return false; +bool FLintRuleList::RequiresGameThread() const { + for (TSubclassOf LintRuleSubClass : LintRules) { + UClass* LintClass = LintRuleSubClass.Get(); + if (LintClass != nullptr) { + const ULintRule* LintRule = GetDefault(LintClass); + if (LintRule != nullptr && LintRule->bRequiresGameThread) { + return true; + } + } + } + + return false; } -bool FLintRuleList::PassesRules(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - OutRuleViolations.Empty(); - - bool bFailedAnyRule = false; - for (TSubclassOf LintRuleSubClass : LintRules) - { - UClass* LintClass = LintRuleSubClass.Get(); - if (LintClass != nullptr) - { - const ULintRule* LintRule = GetDefault(LintClass); - if (LintRule != nullptr) - { - TArray ViolatedRules; - bFailedAnyRule = !LintRule->PassesRule(ObjectToLint, ParentRuleSet, ViolatedRules) || bFailedAnyRule; - OutRuleViolations.Append(ViolatedRules); - } - } - } - - return !bFailedAnyRule; -} \ No newline at end of file +bool FLintRuleList::PassesRules(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + OutRuleViolations.Empty(); + + bool bFailedAnyRule = false; + for (TSubclassOf LintRuleSubClass : LintRules) { + UClass* LintClass = LintRuleSubClass.Get(); + if (LintClass != nullptr) { + const ULintRule* LintRule = GetDefault(LintClass); + if (LintRule != nullptr) { + TArray ViolatedRules; + bFailedAnyRule = !LintRule->PassesRule(ObjectToLint, ParentRuleSet, ViolatedRules) || bFailedAnyRule; + OutRuleViolations.Append(ViolatedRules); + } + } + } + + return !bFailedAnyRule; +} diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Base.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Base.cpp index f92a617..b1a1090 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Base.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Base.cpp @@ -3,19 +3,15 @@ #include "LintRuleSet.h" #include "Engine/Blueprint.h" -ULintRule_Blueprint_Base::ULintRule_Blueprint_Base(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ -} +ULintRule_Blueprint_Base::ULintRule_Blueprint_Base(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} -bool ULintRule_Blueprint_Base::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - // If we aren't a blueprint, abort - if (Cast(ObjectToLint) == nullptr) - { - // @TODO: Bubble up some sort of configuration error? - return true; - } +bool ULintRule_Blueprint_Base::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + // If we aren't a blueprint, abort + if (Cast(ObjectToLint) == nullptr) { + // @TODO: Bubble up some sort of configuration error? + return true; + } - return Super::PassesRule(ObjectToLint, ParentRuleSet, OutRuleViolations); -} \ No newline at end of file + return Super::PassesRule(ObjectToLint, ParentRuleSet, OutRuleViolations); +} diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Compiles.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Compiles.cpp index 187b3ab..fd0cc45 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Compiles.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Compiles.cpp @@ -4,27 +4,20 @@ #include "Sound/SoundWave.h" #include "Engine/Blueprint.h" -ULintRule_Blueprint_Compiles::ULintRule_Blueprint_Compiles(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ -} +ULintRule_Blueprint_Compiles::ULintRule_Blueprint_Compiles(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} -bool ULintRule_Blueprint_Compiles::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - const UBlueprint* Blueprint = CastChecked(ObjectToLint); +bool ULintRule_Blueprint_Compiles::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + const UBlueprint* Blueprint = CastChecked(ObjectToLint); - switch (Blueprint->Status) - { - case BS_BeingCreated: - case BS_Dirty: - case BS_Unknown: - case BS_UpToDate: - return true; - case BS_Error: - case BS_UpToDateWithWarnings: - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass())); - return false; - default: - return true; - } -} \ No newline at end of file + switch (Blueprint->Status) { + case BS_BeingCreated: + case BS_Dirty: + case BS_Unknown: + case BS_UpToDate: return true; + case BS_Error: + case BS_UpToDateWithWarnings: OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass())); + return false; + default: return true; + } +} diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp index 338f856..f5098db 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MaxNodes.cpp @@ -18,81 +18,71 @@ #include "K2Node_CastByteToEnum.h" #include "K2Node_CallFunction.h" -ULintRule_Blueprint_Funcs_MaxNodes::ULintRule_Blueprint_Funcs_MaxNodes(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ -} +ULintRule_Blueprint_Funcs_MaxNodes::ULintRule_Blueprint_Funcs_MaxNodes(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} -bool ULintRule_Blueprint_Funcs_MaxNodes::IsNodeTrivial(const UEdGraphNode* Node) -{ - if (Node->IsA(UK2Node_Knot::StaticClass()) - || Node->IsA(UK2Node_FunctionEntry::StaticClass()) - || Node->IsA(UK2Node_Self::StaticClass()) - || Node->IsA(UK2Node_DynamicCast::StaticClass()) - || Node->IsA(UK2Node_BreakStruct::StaticClass()) - || Node->IsA(UEdGraphNode_Comment::StaticClass()) - || Node->IsA(UK2Node_VariableGet::StaticClass()) - || Node->IsA(UK2Node_StructMemberGet::StaticClass()) - || Node->IsA(UK2Node_Tunnel::StaticClass()) - || Node->IsA(UK2Node_TemporaryVariable::StaticClass()) - || Node->IsA(UK2Node_FunctionResult::StaticClass()) - || Node->IsA(UK2Node_FunctionTerminator::StaticClass()) - || Node->IsA(UK2Node_CastByteToEnum::StaticClass()) - ) - { - return true; - } +bool ULintRule_Blueprint_Funcs_MaxNodes::IsNodeTrivial(const UEdGraphNode* Node) { + if (Node->IsA(UK2Node_Knot::StaticClass()) + || Node->IsA(UK2Node_FunctionEntry::StaticClass()) + || Node->IsA(UK2Node_Self::StaticClass()) + || Node->IsA(UK2Node_DynamicCast::StaticClass()) + || Node->IsA(UK2Node_BreakStruct::StaticClass()) + || Node->IsA(UEdGraphNode_Comment::StaticClass()) + || Node->IsA(UK2Node_VariableGet::StaticClass()) + || Node->IsA(UK2Node_StructMemberGet::StaticClass()) + || Node->IsA(UK2Node_Tunnel::StaticClass()) + || Node->IsA(UK2Node_TemporaryVariable::StaticClass()) + || Node->IsA(UK2Node_FunctionResult::StaticClass()) + || Node->IsA(UK2Node_FunctionTerminator::StaticClass()) + || Node->IsA(UK2Node_CastByteToEnum::StaticClass()) + ) { + return true; + } - if (const UK2Node_CallFunction* CallFuncNode = Cast(Node)) - { - const FName FuncName = CallFuncNode->FunctionReference.GetMemberName(); - if (FuncName == TEXT("Conv_InterfaceToObject") - || FuncName.ToString().Contains(TEXT("MakeLiteral")) - || FuncName.ToString().Contains(TEXT("ToString")) - || FuncName.ToString().StartsWith(TEXT("Make")) - || FuncName.ToString().StartsWith(TEXT("Break")) - ) - { - return true; - } - } + if (const UK2Node_CallFunction* CallFuncNode = Cast(Node)) { + const FName FuncName = CallFuncNode->FunctionReference.GetMemberName(); + if (FuncName == TEXT("Conv_InterfaceToObject") + || FuncName.ToString().Contains(TEXT("MakeLiteral")) + || FuncName.ToString().Contains(TEXT("ToString")) + || FuncName.ToString().StartsWith(TEXT("Make")) + || FuncName.ToString().StartsWith(TEXT("Break")) + ) { + return true; + } + } - return false; + return false; } -bool ULintRule_Blueprint_Funcs_MaxNodes::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - UBlueprint* Blueprint = CastChecked(ObjectToLint); +bool ULintRule_Blueprint_Funcs_MaxNodes::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + UBlueprint* Blueprint = CastChecked(ObjectToLint); - bool bRuleViolated = false; - const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintFuncsMaxNodes", "{Previous}{WhiteSpace}Please simply function {FuncName} as it has {Nodes} nodes when we want a max of {MaxNodes}."); - FText AllFixes; + bool bRuleViolated = false; + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintFuncsMaxNodes", "{Previous}{WhiteSpace}Please simply function {FuncName} as it has {Nodes} nodes when we want a max of {MaxNodes}."); + FText AllFixes; - for (auto&& FunctionGraph : Blueprint->FunctionGraphs) - { - if (FunctionGraph->GetFName() != UEdGraphSchema_K2::FN_UserConstructionScript) - { - // If initial graph check exceeds node limit, filter out nodes that do not contribute to complexity - if (FunctionGraph->Nodes.Num() > MaxExpectedNonTrivialNodes) - { - auto NodesCopy = FunctionGraph->Nodes; - NodesCopy.RemoveAll([this](UEdGraphNode* Val) { return IsNodeTrivial(Val); }); + for (auto&& FunctionGraph : Blueprint->FunctionGraphs) { + if (FunctionGraph->GetFName() != UEdGraphSchema_K2::FN_UserConstructionScript) { + // If initial graph check exceeds node limit, filter out nodes that do not contribute to complexity + if (FunctionGraph->Nodes.Num() > MaxExpectedNonTrivialNodes) { + auto NodesCopy = FunctionGraph->Nodes; + NodesCopy.RemoveAll([this](UEdGraphNode* Val) { + return IsNodeTrivial(Val); + }); - // If removing knots and comments still exceeds node limit, report error - if (NodesCopy.Num() > MaxExpectedNonTrivialNodes) - { - AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("FuncName"), FText::FromString(FunctionGraph->GetName()), TEXT("Nodes"), FText::FromString(FString::FromInt(NodesCopy.Num())), TEXT("MaxNodes"), FText::FromString(FString::FromInt(MaxExpectedNonTrivialNodes)), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); - bRuleViolated = true; - } - } - } - } + // If removing knots and comments still exceeds node limit, report error + if (NodesCopy.Num() > MaxExpectedNonTrivialNodes) { + AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("FuncName"), FText::FromString(FunctionGraph->GetName()), TEXT("Nodes"), FText::FromString(FString::FromInt(NodesCopy.Num())), TEXT("MaxNodes"), FText::FromString(FString::FromInt(MaxExpectedNonTrivialNodes)), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); + bRuleViolated = true; + } + } + } + } - if (bRuleViolated) - { - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); - return false; - } + if (bRuleViolated) { + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); + return false; + } - return true; -} \ No newline at end of file + return true; +} diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp index e06dbdd..89595d0 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.cpp @@ -5,55 +5,45 @@ #include "EdGraphSchema_K2.h" #include "K2Node_FunctionResult.h" -ULintRule_Blueprint_Funcs_MustHaveReturn::ULintRule_Blueprint_Funcs_MustHaveReturn(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ +ULintRule_Blueprint_Funcs_MustHaveReturn::ULintRule_Blueprint_Funcs_MustHaveReturn(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} + +bool ULintRule_Blueprint_Funcs_MustHaveReturn::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + UBlueprint* Blueprint = CastChecked(ObjectToLint); + + // Early return out if blueprint type shouldn't be checked for return nodes + switch (Blueprint->BlueprintType) { + case BPTYPE_Normal: + case BPTYPE_Const: + case BPTYPE_LevelScript: + case BPTYPE_FunctionLibrary: break; + case BPTYPE_MacroLibrary: + case BPTYPE_Interface: + default: return true; + } + + bool bRuleViolated = false; + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintFuncsMustHaveReturn", "{Previous}{WhiteSpace}Please give function {FuncName} a return node."); + FText AllFixes; + + static const FName DefaultAnimGraphName("AnimGraph"); + + for (auto&& FunctionGraph : Blueprint->FunctionGraphs) { + if (FunctionGraph->GetFName() != UEdGraphSchema_K2::FN_UserConstructionScript + && FunctionGraph->GetFName() != DefaultAnimGraphName) { + TArray AllResultNodes; + FunctionGraph->GetNodesOfClass(AllResultNodes); + if (AllResultNodes.Num() <= 0) { + AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("FuncName"), FText::FromString(FunctionGraph->GetName()), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); + bRuleViolated = true; + } + } + } + + if (bRuleViolated) { + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); + return false; + } + + return true; } - -bool ULintRule_Blueprint_Funcs_MustHaveReturn::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - UBlueprint* Blueprint = CastChecked(ObjectToLint); - - // Early return out if blueprint type shouldn't be checked for return nodes - switch (Blueprint->BlueprintType) - { - case BPTYPE_Normal: - case BPTYPE_Const: - case BPTYPE_LevelScript: - case BPTYPE_FunctionLibrary: - break; - case BPTYPE_MacroLibrary: - case BPTYPE_Interface: - default: - return true; - } - - bool bRuleViolated = false; - const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintFuncsMustHaveReturn", "{Previous}{WhiteSpace}Please give function {FuncName} a return node."); - FText AllFixes; - - static const FName DefaultAnimGraphName("AnimGraph"); - - for (auto&& FunctionGraph : Blueprint->FunctionGraphs) - { - if (FunctionGraph->GetFName() != UEdGraphSchema_K2::FN_UserConstructionScript - && FunctionGraph->GetFName() != DefaultAnimGraphName) - { - TArray AllResultNodes; - FunctionGraph->GetNodesOfClass(AllResultNodes); - if (AllResultNodes.Num() <= 0) - { - AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("FuncName"), FText::FromString(FunctionGraph->GetName()), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); - bRuleViolated = true; - } - } - } - - if (bRuleViolated) - { - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); - return false; - } - - return true; -} \ No newline at end of file diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.cpp index f62e6ac..df2df95 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.cpp @@ -6,66 +6,53 @@ #include "K2Node_FunctionEntry.h" -ULintRule_Blueprint_Funcs_PublicDescriptions::ULintRule_Blueprint_Funcs_PublicDescriptions(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ +ULintRule_Blueprint_Funcs_PublicDescriptions::ULintRule_Blueprint_Funcs_PublicDescriptions(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} + +bool ULintRule_Blueprint_Funcs_PublicDescriptions::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + UBlueprint* Blueprint = CastChecked(ObjectToLint); + + // Early return out if blueprint type shouldn't be checked for function descriptions + switch (Blueprint->BlueprintType) { + case BPTYPE_Normal: + case BPTYPE_Const: + case BPTYPE_LevelScript: + case BPTYPE_FunctionLibrary: break; + case BPTYPE_MacroLibrary: + case BPTYPE_Interface: + default: return true; + } + + bool bRuleViolated = false; + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintFuncsPublicDescriptions", "{Previous}{WhiteSpace}Please give public function {FuncName} a description."); + FText AllFixes; + + for (const UEdGraph* FunctionGraph : Blueprint->FunctionGraphs) { + if (FunctionGraph->GetFName() != UEdGraphSchema_K2::FN_UserConstructionScript) { + const UK2Node_FunctionEntry* FunctionEntryNode = nullptr; + TArray EntryNodes; + + FunctionGraph->GetNodesOfClass(EntryNodes); + + if ((EntryNodes.Num() > 0) && EntryNodes[0]->IsEditable()) { + FunctionEntryNode = Cast(EntryNodes[0]); + } + + if (FunctionEntryNode != nullptr) { + if (FUNC_AccessSpecifiers & FunctionEntryNode->GetFunctionFlags() & FUNC_Public) { + if (FunctionEntryNode->MetaData.ToolTip.IsEmpty()) { + AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("FuncName"), FText::FromString(FunctionGraph->GetName()), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); + bRuleViolated = true; + } + } + } + } + } + + if (bRuleViolated) { + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); + return false; + } + + return true; } - -bool ULintRule_Blueprint_Funcs_PublicDescriptions::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - UBlueprint* Blueprint = CastChecked(ObjectToLint); - - // Early return out if blueprint type shouldn't be checked for function descriptions - switch (Blueprint->BlueprintType) - { - case BPTYPE_Normal: - case BPTYPE_Const: - case BPTYPE_LevelScript: - case BPTYPE_FunctionLibrary: - break; - case BPTYPE_MacroLibrary: - case BPTYPE_Interface: - default: - return true; - } - - bool bRuleViolated = false; - const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintFuncsPublicDescriptions", "{Previous}{WhiteSpace}Please give public function {FuncName} a description."); - FText AllFixes; - - for (const UEdGraph* FunctionGraph : Blueprint->FunctionGraphs) - { - if (FunctionGraph->GetFName() != UEdGraphSchema_K2::FN_UserConstructionScript) - { - const UK2Node_FunctionEntry* FunctionEntryNode = nullptr; - TArray EntryNodes; - - FunctionGraph->GetNodesOfClass(EntryNodes); - - if ((EntryNodes.Num() > 0) && EntryNodes[0]->IsEditable()) - { - FunctionEntryNode = Cast(EntryNodes[0]); - } - - if (FunctionEntryNode != nullptr) - { - if (FUNC_AccessSpecifiers & FunctionEntryNode->GetFunctionFlags() & FUNC_Public) - { - if (FunctionEntryNode->MetaData.ToolTip.IsEmpty()) - { - AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("FuncName"), FText::FromString(FunctionGraph->GetName()), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); - bRuleViolated = true; - } - } - } - } - } - - if (bRuleViolated) - { - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); - return false; - } - - return true; -} \ No newline at end of file diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp index 117bb69..fd1ba76 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_LooseNodes.cpp @@ -12,53 +12,43 @@ #include "K2Node_Knot.h" #include "K2Node_Tunnel.h" -ULintRule_Blueprint_LooseNodes::ULintRule_Blueprint_LooseNodes(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ +ULintRule_Blueprint_LooseNodes::ULintRule_Blueprint_LooseNodes(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} + +bool ULintRule_Blueprint_LooseNodes::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + const UBlueprint* Blueprint = CastChecked(ObjectToLint); + + // Check for loose nodes + TArray Graphs; + Blueprint->GetAllGraphs(Graphs); + + for (UEdGraph* Graph : Graphs) { + for (const UEdGraphNode* Node : Graph->Nodes) { + if (Node->IsAutomaticallyPlacedGhostNode() || + Node->IsA(UK2Node_Event::StaticClass()) || + Node->IsA(UK2Node_FunctionEntry::StaticClass()) || + Node->IsA(UK2Node_Knot::StaticClass()) || + Node->IsA(UEdGraphNode_Comment::StaticClass()) || + Node->IsA(UK2Node_Tunnel::StaticClass())) { + continue; + } + + bool bNodeIsolated = true; + + TArray Pins = Node->GetAllPins(); + for (const UEdGraphPin* Pin : Pins) { + if (Pin->LinkedTo.Num() != 0) { + bNodeIsolated = false; + break; + } + } + + if (bNodeIsolated) { + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass())); + return false; + } + } + } + + return true; } - -bool ULintRule_Blueprint_LooseNodes::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - const UBlueprint* Blueprint = CastChecked(ObjectToLint); - - // Check for loose nodes - TArray Graphs; - Blueprint->GetAllGraphs(Graphs); - - for (UEdGraph* Graph : Graphs) - { - for (const UEdGraphNode* Node : Graph->Nodes) - { - if (Node->IsAutomaticallyPlacedGhostNode() || - Node->IsA(UK2Node_Event::StaticClass()) || - Node->IsA(UK2Node_FunctionEntry::StaticClass()) || - Node->IsA(UK2Node_Knot::StaticClass()) || - Node->IsA(UEdGraphNode_Comment::StaticClass()) || - Node->IsA(UK2Node_Tunnel::StaticClass())) - { - continue; - } - - bool bNodeIsolated = true; - - TArray Pins = Node->GetAllPins(); - for (const UEdGraphPin* Pin : Pins) - { - if (Pin->LinkedTo.Num() != 0) - { - bNodeIsolated = false; - break; - } - } - - if (bNodeIsolated) - { - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass())); - return false; - } - } - } - - return true; - -} \ No newline at end of file diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_ConfigCategories.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_ConfigCategories.cpp index 5fd2262..fe88abc 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_ConfigCategories.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_ConfigCategories.cpp @@ -6,65 +6,51 @@ #include "EdGraphSchema_K2.h" #include "Kismet2/BlueprintEditorUtils.h" -ULintRule_Blueprint_Vars_ConfigCategories::ULintRule_Blueprint_Vars_ConfigCategories(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ +ULintRule_Blueprint_Vars_ConfigCategories::ULintRule_Blueprint_Vars_ConfigCategories(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} + +bool ULintRule_Blueprint_Vars_ConfigCategories::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + UBlueprint* Blueprint = CastChecked(ObjectToLint); + + bool bRuleViolated = false; + + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsConfigCategories", "{Previous}{WhiteSpace}Please give variable {VarName} a category."); + const FText FixTextTemplateEditable = NSLOCTEXT("Linter", "BlueprintVarsConfigCategoriesEditable", "{Previous}{WhiteSpace}Please give editable variable {VarName} a category starting with 'Config'."); + FText AllFixes; + + int32 VariableCount = Blueprint->NewVariables.Num(); + for (FBPVariableDescription Desc : Blueprint->NewVariables) { + if (FBlueprintEditorUtils::IsVariableComponent(Desc)) { + VariableCount--; + } + } + + if (VariableCount < NumVariablesToRequireCategorization) { + return true; + } + + for (FBPVariableDescription Desc : Blueprint->NewVariables) { + FString PropName = Desc.VarName.ToString(); + FText TypeName = UEdGraphSchema_K2::TypeToText(Desc.VarType); + + // Is Editable variable? + if ((Desc.PropertyFlags & CPF_DisableEditOnInstance) != CPF_DisableEditOnInstance) { + if (!Desc.Category.ToString().StartsWith(TEXT("Config"))) { + AllFixes = FText::FormatNamed(FixTextTemplateEditable, TEXT("Previous"), AllFixes, TEXT("VarName"), FText::FromString(PropName), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); + bRuleViolated = true; + } + } else { + if (Desc.Category.IsEmptyOrWhitespace()) { + AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("VarName"), FText::FromString(PropName), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); + bRuleViolated = true; + } + } + } + + if (bRuleViolated) { + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); + return false; + } + + return true; } - -bool ULintRule_Blueprint_Vars_ConfigCategories::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - UBlueprint* Blueprint = CastChecked(ObjectToLint); - - bool bRuleViolated = false; - - const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsConfigCategories", "{Previous}{WhiteSpace}Please give variable {VarName} a category."); - const FText FixTextTemplateEditable = NSLOCTEXT("Linter", "BlueprintVarsConfigCategoriesEditable", "{Previous}{WhiteSpace}Please give editable variable {VarName} a category starting with 'Config'."); - FText AllFixes; - - int32 VariableCount = Blueprint->NewVariables.Num(); - for (FBPVariableDescription Desc : Blueprint->NewVariables) - { - if (FBlueprintEditorUtils::IsVariableComponent(Desc)) - { - VariableCount--; - } - } - - if (VariableCount < NumVariablesToRequireCategorization) - { - return true; - } - - for (FBPVariableDescription Desc : Blueprint->NewVariables) - { - FString PropName = Desc.VarName.ToString(); - FText TypeName = UEdGraphSchema_K2::TypeToText(Desc.VarType); - - // Is Editable variable? - if ((Desc.PropertyFlags & CPF_DisableEditOnInstance) != CPF_DisableEditOnInstance) - { - if (!Desc.Category.ToString().StartsWith(TEXT("Config"))) - { - AllFixes = FText::FormatNamed(FixTextTemplateEditable, TEXT("Previous"), AllFixes, TEXT("VarName"), FText::FromString(PropName), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); - bRuleViolated = true; - continue; - } - } - else - { - if (Desc.Category.IsEmptyOrWhitespace()) - { - AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("VarName"), FText::FromString(PropName), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); - bRuleViolated = true; - } - } - } - - if (bRuleViolated) - { - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); - return false; - } - - return true; -} \ No newline at end of file diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.cpp index d1de215..77be1d3 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.cpp @@ -4,40 +4,33 @@ #include "Engine/Blueprint.h" #include "EdGraphSchema_K2.h" -ULintRule_Blueprint_Vars_EditableMustHaveTooltip::ULintRule_Blueprint_Vars_EditableMustHaveTooltip(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ -} +ULintRule_Blueprint_Vars_EditableMustHaveTooltip::ULintRule_Blueprint_Vars_EditableMustHaveTooltip(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} + +bool ULintRule_Blueprint_Vars_EditableMustHaveTooltip::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + UBlueprint* Blueprint = CastChecked(ObjectToLint); + + bool bRuleViolated = false; + + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsEditableMustHaveTooltip", "{Previous}{WhiteSpace}Please give variable {VarName} a tooltip as it is marked editable."); + FText AllFixes; -bool ULintRule_Blueprint_Vars_EditableMustHaveTooltip::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - UBlueprint* Blueprint = CastChecked(ObjectToLint); - - bool bRuleViolated = false; - - const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsEditableMustHaveTooltip", "{Previous}{WhiteSpace}Please give variable {VarName} a tooltip as it is marked editable."); - FText AllFixes; - - for (FBPVariableDescription Desc : Blueprint->NewVariables) - { - FString PropName = Desc.VarName.ToString(); - FText TypeName = UEdGraphSchema_K2::TypeToText(Desc.VarType); - - if ((Desc.PropertyFlags & CPF_DisableEditOnInstance) != CPF_DisableEditOnInstance) - { - if (!Desc.HasMetaData(FBlueprintMetadata::MD_Tooltip) || Desc.GetMetaData(FBlueprintMetadata::MD_Tooltip).Len() <= 0) - { - AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("VarName"), FText::FromString(PropName), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); - bRuleViolated = true; - } - } - } - - if (bRuleViolated) - { - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); - return false; - } - - return true; -} \ No newline at end of file + for (FBPVariableDescription Desc : Blueprint->NewVariables) { + FString PropName = Desc.VarName.ToString(); + FText TypeName = UEdGraphSchema_K2::TypeToText(Desc.VarType); + + if ((Desc.PropertyFlags & CPF_DisableEditOnInstance) != CPF_DisableEditOnInstance) { + if (!Desc.HasMetaData(FBlueprintMetadata::MD_Tooltip) || Desc.GetMetaData(FBlueprintMetadata::MD_Tooltip).Len() <= 0) { + AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("VarName"), FText::FromString(PropName), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); + bRuleViolated = true; + } + } + } + + if (bRuleViolated) { + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); + return false; + } + + return true; +} diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.cpp index 0de7862..48107ba 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.cpp @@ -4,37 +4,31 @@ #include "Engine/Blueprint.h" #include "EdGraphSchema_K2.h" -ULintRule_Blueprint_Vars_NoConfigFlag::ULintRule_Blueprint_Vars_NoConfigFlag(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ -} +ULintRule_Blueprint_Vars_NoConfigFlag::ULintRule_Blueprint_Vars_NoConfigFlag(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} -bool ULintRule_Blueprint_Vars_NoConfigFlag::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - UBlueprint* Blueprint = CastChecked(ObjectToLint); +bool ULintRule_Blueprint_Vars_NoConfigFlag::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + UBlueprint* Blueprint = CastChecked(ObjectToLint); - bool bRuleViolated = false; + bool bRuleViolated = false; - const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsNoConfigFlag", "{Previous}{WhiteSpace}Please disable the config flag on variable {VarName}."); - FText AllFixes; + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsNoConfigFlag", "{Previous}{WhiteSpace}Please disable the config flag on variable {VarName}."); + FText AllFixes; - for (FBPVariableDescription Desc : Blueprint->NewVariables) - { - FString PropName = Desc.VarName.ToString(); - FText TypeName = UEdGraphSchema_K2::TypeToText(Desc.VarType); + for (FBPVariableDescription Desc : Blueprint->NewVariables) { + FString PropName = Desc.VarName.ToString(); + FText TypeName = UEdGraphSchema_K2::TypeToText(Desc.VarType); - if ((Desc.PropertyFlags & CPF_Config) == CPF_Config) - { - AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("VarName"), FText::FromString(PropName), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); - bRuleViolated = true; - } - } + if ((Desc.PropertyFlags & CPF_Config) == CPF_Config) { + AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("VarName"), FText::FromString(PropName), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); + bRuleViolated = true; + } + } - if (bRuleViolated) - { - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); - return false; - } + if (bRuleViolated) { + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); + return false; + } - return true; -} \ No newline at end of file + return true; +} diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NonAtomic.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NonAtomic.cpp index 82bdb13..bcf52ac 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NonAtomic.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_NonAtomic.cpp @@ -5,49 +5,42 @@ #include "EdGraphSchema_K2.h" #include "Internationalization/Regex.h" -ULintRule_Blueprint_Vars_NonAtomic::ULintRule_Blueprint_Vars_NonAtomic(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ +ULintRule_Blueprint_Vars_NonAtomic::ULintRule_Blueprint_Vars_NonAtomic(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} + + +bool ULintRule_Blueprint_Vars_NonAtomic::IsVariableAtomic(FBPVariableDescription& VarDesc) { + return (VarDesc.VarType.PinCategory == UEdGraphSchema_K2::PC_Boolean + || VarDesc.VarType.PinCategory == UEdGraphSchema_K2::PC_Byte + || VarDesc.VarType.PinCategory == UEdGraphSchema_K2::PC_Int + || VarDesc.VarType.PinCategory == UEdGraphSchema_K2::PC_Float + || VarDesc.VarType.PinCategory == UEdGraphSchema_K2::PC_String + || VarDesc.VarType.PinCategory == UEdGraphSchema_K2::PC_Enum + ); } +bool ULintRule_Blueprint_Vars_NonAtomic::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + UBlueprint* Blueprint = CastChecked(ObjectToLint); -bool ULintRule_Blueprint_Vars_NonAtomic::IsVariableAtomic(FBPVariableDescription& VarDesc) -{ - return (VarDesc.VarType.PinCategory == UEdGraphSchema_K2::PC_Boolean - || VarDesc.VarType.PinCategory == UEdGraphSchema_K2::PC_Byte - || VarDesc.VarType.PinCategory == UEdGraphSchema_K2::PC_Int - || VarDesc.VarType.PinCategory == UEdGraphSchema_K2::PC_Float - || VarDesc.VarType.PinCategory == UEdGraphSchema_K2::PC_String - || VarDesc.VarType.PinCategory == UEdGraphSchema_K2::PC_Enum - ); -} + bool bRuleViolated = false; + + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsNonAtomic", "{Previous}{WhiteSpace}Please fix variable named {VarName}."); + FText AllFixes; + + for (FBPVariableDescription Desc : Blueprint->NewVariables) { + FString PropName = Desc.VarName.ToString(); + FText TypeName = UEdGraphSchema_K2::TypeToText(Desc.VarType); -bool ULintRule_Blueprint_Vars_NonAtomic::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - UBlueprint* Blueprint = CastChecked(ObjectToLint); - - bool bRuleViolated = false; - - const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsNonAtomic", "{Previous}{WhiteSpace}Please fix variable named {VarName}."); - FText AllFixes; - - for (FBPVariableDescription Desc : Blueprint->NewVariables) - { - FString PropName = Desc.VarName.ToString(); - FText TypeName = UEdGraphSchema_K2::TypeToText(Desc.VarType); - - if (IsVariableAtomic(Desc) && PropName.Contains(TypeName.ToString())) - { - AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("VarName"), FText::FromString(PropName), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); - bRuleViolated = true; - } - } - - if (bRuleViolated) - { - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass())); - return false; - } - - return true; -} \ No newline at end of file + if (IsVariableAtomic(Desc) && PropName.Contains(TypeName.ToString())) { + AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("VarName"), FText::FromString(PropName), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); + bRuleViolated = true; + } + } + + if (bRuleViolated) { + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass())); + return false; + } + + return true; +} diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_PluralArrays.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_PluralArrays.cpp index 95b0754..f852dcb 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_PluralArrays.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_PluralArrays.cpp @@ -4,37 +4,31 @@ #include "Engine/Blueprint.h" #include "EdGraphSchema_K2.h" -ULintRule_Blueprint_Vars_PluralArrays::ULintRule_Blueprint_Vars_PluralArrays(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ -} +ULintRule_Blueprint_Vars_PluralArrays::ULintRule_Blueprint_Vars_PluralArrays(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} + +bool ULintRule_Blueprint_Vars_PluralArrays::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + UBlueprint* Blueprint = CastChecked(ObjectToLint); + + bool bRuleViolated = false; + + const FText FixTextTemplate = NSLOCTEXT("Linter", "PluralArrayHasArray", "{Previous}{WhiteSpace}Please remove the word 'Array' from your variable {VarName}."); + FText AllFixes; -bool ULintRule_Blueprint_Vars_PluralArrays::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - UBlueprint* Blueprint = CastChecked(ObjectToLint); - - bool bRuleViolated = false; - - const FText FixTextTemplate = NSLOCTEXT("Linter", "PluralArrayHasArray", "{Previous}{WhiteSpace}Please remove the word 'Array' from your variable {VarName}."); - FText AllFixes; - - for (FBPVariableDescription Desc : Blueprint->NewVariables) - { - FString PropName = Desc.VarName.ToString(); - FText TypeName = UEdGraphSchema_K2::TypeToText(Desc.VarType); - - if (PropName.Contains(TEXT("Array"), ESearchCase::CaseSensitive)) - { - AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("VarName"), FText::FromString(PropName), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); - bRuleViolated = true; - } - } - - if (bRuleViolated) - { - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); - return false; - } - - return true; -} \ No newline at end of file + for (FBPVariableDescription Desc : Blueprint->NewVariables) { + FString PropName = Desc.VarName.ToString(); + FText TypeName = UEdGraphSchema_K2::TypeToText(Desc.VarType); + + if (PropName.Contains(TEXT("Array"), ESearchCase::CaseSensitive)) { + AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("VarName"), FText::FromString(PropName), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); + bRuleViolated = true; + } + } + + if (bRuleViolated) { + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); + return false; + } + + return true; +} diff --git a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_RegEx.cpp b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_RegEx.cpp index 7321c3c..92536e0 100644 --- a/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_RegEx.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Blueprint_Vars_RegEx.cpp @@ -5,48 +5,42 @@ #include "EdGraphSchema_K2.h" #include "Internationalization/Regex.h" -ULintRule_Blueprint_Vars_Regex::ULintRule_Blueprint_Vars_Regex(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ -} +ULintRule_Blueprint_Vars_Regex::ULintRule_Blueprint_Vars_Regex(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} + +bool ULintRule_Blueprint_Vars_Regex::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + UBlueprint* Blueprint = CastChecked(ObjectToLint); -bool ULintRule_Blueprint_Vars_Regex::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - UBlueprint* Blueprint = CastChecked(ObjectToLint); + bool bRuleViolated = false; - bool bRuleViolated = false; + const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsRegex", "{Previous}{WhiteSpace}Please fix variable named {VarName}."); + FText AllFixes; - const FText FixTextTemplate = NSLOCTEXT("Linter", "BlueprintVarsRegex", "{Previous}{WhiteSpace}Please fix variable named {VarName}."); - FText AllFixes; + const FString TestRegexPatternString = RegexPatternString; + const FString BoolTestRegexPatternString = TEXT("b") + RegexPatternString; - const FString TestRegexPatternString = RegexPatternString; - const FString BoolTestRegexPatternString = TEXT("b") + RegexPatternString; + const FRegexPattern TestRegexPattern = FRegexPattern(TestRegexPatternString); + const FRegexPattern BoolTestRegexPattern = FRegexPattern(BoolTestRegexPatternString); - const FRegexPattern TestRegexPattern = FRegexPattern(TestRegexPatternString); - const FRegexPattern BoolTestRegexPattern = FRegexPattern(BoolTestRegexPatternString); + for (FBPVariableDescription Desc : Blueprint->NewVariables) { + FString PropName = Desc.VarName.ToString(); + FText TypeName = UEdGraphSchema_K2::TypeToText(Desc.VarType); + const bool bIsBool = Desc.VarType.PinCategory == UEdGraphSchema_K2::PC_Boolean; - for (FBPVariableDescription Desc : Blueprint->NewVariables) - { - FString PropName = Desc.VarName.ToString(); - FText TypeName = UEdGraphSchema_K2::TypeToText(Desc.VarType); - const bool bIsBool = Desc.VarType.PinCategory == UEdGraphSchema_K2::PC_Boolean; - - FRegexMatcher Matcher(bIsBool ? BoolTestRegexPattern : TestRegexPattern, PropName); - const bool bFoundMatch = Matcher.FindNext(); + FRegexMatcher Matcher(bIsBool ? BoolTestRegexPattern : TestRegexPattern, PropName); + const bool bFoundMatch = Matcher.FindNext(); - if ((bFoundMatch && bMustNotContainRegexPattern) || (!bFoundMatch && !bMustNotContainRegexPattern)) - { - AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("VarName"), FText::FromString(PropName), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); - bRuleViolated = true; - } - } + if ((bFoundMatch && bMustNotContainRegexPattern) || (!bFoundMatch && !bMustNotContainRegexPattern)) { + AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("VarName"), FText::FromString(PropName), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); + bRuleViolated = true; + } + } - if (bRuleViolated) - { - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); - return false; - } + if (bRuleViolated) { + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); + return false; + } - return true; -} \ No newline at end of file + return true; +} diff --git a/Source/Linter/Private/LintRules/LintRule_Collection.cpp b/Source/Linter/Private/LintRules/LintRule_Collection.cpp index 570d792..fe2ae97 100644 --- a/Source/Linter/Private/LintRules/LintRule_Collection.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Collection.cpp @@ -1,33 +1,25 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #include "LintRules/LintRule_Collection.h" #include "LintRuleSet.h" -#include "LinterNamingConvention.h" -ULintRule_Collection::ULintRule_Collection(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ -} +ULintRule_Collection::ULintRule_Collection(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} -bool ULintRule_Collection::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - bool bRuleViolated = false; +bool ULintRule_Collection::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + bool bRuleViolated = false; - for (TSubclassOf LintRuleClass : SubRules) - { - if (LintRuleClass.Get() != nullptr) - { - const ULintRule* LintRule = GetDefault(LintRuleClass); - if (LintRule != nullptr) - { - TArray SubViolations; - if (!LintRule->PassesRule(ObjectToLint, ParentRuleSet, SubViolations)) - { - OutRuleViolations.Append(SubViolations); - bRuleViolated = true; - } - } - } - } + for (TSubclassOf LintRuleClass : SubRules) { + if (LintRuleClass.Get() != nullptr) { + const ULintRule* LintRule = GetDefault(LintRuleClass); + if (LintRule != nullptr) { + TArray SubViolations; + if (!LintRule->PassesRule(ObjectToLint, ParentRuleSet, SubViolations)) { + OutRuleViolations.Append(SubViolations); + bRuleViolated = true; + } + } + } + } - return !bRuleViolated; -} \ No newline at end of file + return !bRuleViolated; +} diff --git a/Source/Linter/Private/LintRules/LintRule_IsNamedCorrectly_Base.cpp b/Source/Linter/Private/LintRules/LintRule_IsNamedCorrectly_Base.cpp index 9b3572a..274b9e6 100644 --- a/Source/Linter/Private/LintRules/LintRule_IsNamedCorrectly_Base.cpp +++ b/Source/Linter/Private/LintRules/LintRule_IsNamedCorrectly_Base.cpp @@ -3,105 +3,87 @@ #include "LintRuleSet.h" #include "LinterNamingConvention.h" -ULintRule_IsNamedCorrectly_Base::ULintRule_IsNamedCorrectly_Base(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ - +ULintRule_IsNamedCorrectly_Base::ULintRule_IsNamedCorrectly_Base(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} + +bool ULintRule_IsNamedCorrectly_Base::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + // NameSettingList Contributed by RocknRolla#3102 on http://discord.gamemak.in + TArray NameSettingList; + // If ObjectToLint is a Blueprint, it's class hierarchy does not contain actual classes that Blueprints extend (like Actor, Character, PlayerController, etc.). + // So we try to use Blueprint's ParentClass to access it's class hierarchy. + if (ObjectToLint->IsA()) { + const TSubclassOf BlueprintClass = Cast(ObjectToLint)->ParentClass; + if (BlueprintClass != nullptr) { + NameSettingList = ParentRuleSet->GetNamingConvention()->GetNamingConventionsForClassVariant(TSoftClassPtr(BlueprintClass), GetRuleBasedObjectVariantName(ObjectToLint)); + } + } + // If ObjectToLint is not a Blueprint or we failed to find any conventions, just fall back to our default algorithm. + if (NameSettingList.Num() == 0) { + NameSettingList = ParentRuleSet->GetNamingConvention()->GetNamingConventionsForClassVariant(ObjectToLint->GetClass(), GetRuleBasedObjectVariantName(ObjectToLint)); + } + + // If we don't have a name rule for this type of asset, simply return true + if (NameSettingList.Num() == 0) { + return true; + } + + bool bFoundMatchingNameRule = false; + for (FLinterNamingConventionInfo Info : NameSettingList) { + const bool bPassesPrefixCheck = Info.Prefix.IsEmpty() ? true : ObjectToLint->GetName().StartsWith(Info.Prefix, ESearchCase::CaseSensitive); + const bool bPassesSuffixCheck = Info.Suffix.IsEmpty() ? true : ObjectToLint->GetName().EndsWith(Info.Suffix, ESearchCase::CaseSensitive); + // Run prefix and suffix checks using found name settings if they are non-null + + if (bPassesPrefixCheck && bPassesSuffixCheck) { + bFoundMatchingNameRule = true; + break; + } + } + + if (!bFoundMatchingNameRule) { + const FString SuggestedName = BuildSuggestedName(ObjectToLint->GetName(), NameSettingList[0].Prefix, NameSettingList[0].Suffix); + const FText RecommendedAction = FText::FormatOrdered(NSLOCTEXT("Linter", "IsNamedCorrectly_RecommendedAction", "Recommended name: [{0}]."), FText::FromString(SuggestedName)); + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), RecommendedAction)); + return false; + } + + // If we don't have name settings or passed all name checks, simply return true + return true; } -bool ULintRule_IsNamedCorrectly_Base::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - // NameSettingList Contributed by RocknRolla#3102 on http://discord.gamemak.in - TArray NameSettingList; - // If ObjectToLint is a Blueprint, it's class hierarchy does not contain actual classes that Blueprints extend (like Actor, Character, PlayerController, etc.). - // So we try to use Blueprint's ParentClass to access it's class hierarchy. - if (ObjectToLint->IsA()) - { - const TSubclassOf BlueprintClass = Cast(ObjectToLint)->ParentClass; - if (BlueprintClass != nullptr) - { - NameSettingList = ParentRuleSet->GetNamingConvention()->GetNamingConventionsForClassVariant(TSoftClassPtr(BlueprintClass), GetRuleBasedObjectVariantName(ObjectToLint)); - } - } - // If ObjectToLint is not a Blueprint or we failed to find any conventions, just fall back to our default algorithm. - if (NameSettingList.Num() == 0) - { - NameSettingList = ParentRuleSet->GetNamingConvention()->GetNamingConventionsForClassVariant(ObjectToLint->GetClass(), GetRuleBasedObjectVariantName(ObjectToLint)); - } - - // If we don't have a name rule for this type of asset, simply return true - if (NameSettingList.Num() == 0) - { - return true; - } - - bool bFoundMatchingNameRule = false; - for (FLinterNamingConventionInfo Info : NameSettingList) - { - const bool bPassesPrefixCheck = Info.Prefix.IsEmpty() ? true : ObjectToLint->GetName().StartsWith(Info.Prefix, ESearchCase::CaseSensitive); - const bool bPassesSuffixCheck = Info.Suffix.IsEmpty() ? true : ObjectToLint->GetName().EndsWith(Info.Suffix, ESearchCase::CaseSensitive); - // Run prefix and suffix checks using found name settings if they are non-null - - if (bPassesPrefixCheck && bPassesSuffixCheck) - { - bFoundMatchingNameRule = true; - break; - } - } - - if (!bFoundMatchingNameRule) - { - const FString SuggestedName = BuildSuggestedName(ObjectToLint->GetName(), NameSettingList[0].Prefix, NameSettingList[0].Suffix); - const FText RecommendedAction = FText::FormatOrdered(NSLOCTEXT("Linter", "IsNamedCorrectly_RecommendedAction", "Recommended name: [{0}]."), FText::FromString(SuggestedName)); - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), RecommendedAction)); - return false; - } - - // If we don't have name settings or passed all name checks, simply return true - return true; -} +FString ULintRule_IsNamedCorrectly_Base::BuildSuggestedName(FString CurrentName, FString DesiredPrefix, FString DesiredSuffix /*= TEXT("")*/) { + FString SuggestedName; + + const int32 FirstUnderscore = CurrentName.Find(TEXT("_")); + const int32 LastUnderscore = CurrentName.Find(TEXT("_"), ESearchCase::IgnoreCase, ESearchDir::FromEnd); + + bool bAddPrefix = false; + bool bAddSuffix = false; + + // Attempt to remove a bad prefix + if (!DesiredPrefix.IsEmpty() && !CurrentName.StartsWith(DesiredPrefix, ESearchCase::CaseSensitive)) { + bAddPrefix = true; + if (FirstUnderscore <= 3) { + CurrentName = CurrentName.RightChop(FirstUnderscore + 1); + } + } + + // Attempt to remove a bad suffix + if (!DesiredSuffix.IsEmpty() && !CurrentName.EndsWith(DesiredSuffix, ESearchCase::CaseSensitive)) { + bAddSuffix = true; + if (CurrentName.Len() - LastUnderscore <= 3) { + CurrentName = CurrentName.LeftChop(CurrentName.Len() - LastUnderscore); + } + } + + SuggestedName = CurrentName; + + if (bAddPrefix) { + SuggestedName = DesiredPrefix + SuggestedName; + } + + if (bAddSuffix) { + SuggestedName = SuggestedName + DesiredSuffix; + } -FString ULintRule_IsNamedCorrectly_Base::BuildSuggestedName(FString CurrentName, FString DesiredPrefix, FString DesiredSuffix /*= TEXT("")*/) -{ - FString SuggestedName; - - const int32 FirstUnderscore = CurrentName.Find(TEXT("_")); - const int32 LastUnderscore = CurrentName.Find(TEXT("_"), ESearchCase::IgnoreCase, ESearchDir::FromEnd); - - bool bAddPrefix = false; - bool bAddSuffix = false; - - // Attempt to remove a bad prefix - if (!DesiredPrefix.IsEmpty() && !CurrentName.StartsWith(DesiredPrefix, ESearchCase::CaseSensitive)) - { - bAddPrefix = true; - if (FirstUnderscore <= 3) - { - CurrentName = CurrentName.RightChop(FirstUnderscore + 1); - } - } - - // Attempt to remove a bad suffix - if (!DesiredSuffix.IsEmpty() && !CurrentName.EndsWith(DesiredSuffix, ESearchCase::CaseSensitive)) - { - bAddSuffix = true; - if (CurrentName.Len() - LastUnderscore <= 3) - { - CurrentName = CurrentName.LeftChop(CurrentName.Len() - LastUnderscore); - } - } - - SuggestedName = CurrentName; - - if (bAddPrefix) - { - SuggestedName = DesiredPrefix + SuggestedName; - } - - if (bAddSuffix) - { - SuggestedName = SuggestedName + DesiredSuffix; - } - - return SuggestedName; + return SuggestedName; } diff --git a/Source/Linter/Private/LintRules/LintRule_ParticleSystem_EmitterNameRegex.cpp b/Source/Linter/Private/LintRules/LintRule_ParticleSystem_EmitterNameRegex.cpp index 765e3c1..4aecd5c 100644 --- a/Source/Linter/Private/LintRules/LintRule_ParticleSystem_EmitterNameRegex.cpp +++ b/Source/Linter/Private/LintRules/LintRule_ParticleSystem_EmitterNameRegex.cpp @@ -5,57 +5,49 @@ #include "Particles/ParticleSystem.h" #include "Internationalization/Regex.h" -ULintRule_ParticleSystem_EmitterNameRegex::ULintRule_ParticleSystem_EmitterNameRegex(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , RegexPatternString(TEXT("Particle Emitter")) -{ - DisallowedRecommendedAction = NSLOCTEXT("Linter", "ULintRule_ParticleSystem_EmitterRegexName_Disallowed", "Please rename the emitter \"{0}\" as you have multiple emitters."); - NonConformingRecommendedAction = NSLOCTEXT("Linter", "ULintRule_ParticleSystem_EmitterRegexName_NonConforming", "Please rename \"{0}\" as this emitter has invalid characters."); +ULintRule_ParticleSystem_EmitterNameRegex::ULintRule_ParticleSystem_EmitterNameRegex(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer), + RegexPatternString(TEXT("Particle Emitter")) { + DisallowedRecommendedAction = NSLOCTEXT("Linter", "ULintRule_ParticleSystem_EmitterRegexName_Disallowed", "Please rename the emitter \"{0}\" as you have multiple emitters."); + NonConformingRecommendedAction = NSLOCTEXT("Linter", "ULintRule_ParticleSystem_EmitterRegexName_NonConforming", "Please rename \"{0}\" as this emitter has invalid characters."); } -bool ULintRule_ParticleSystem_EmitterNameRegex::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - // If we aren't a particle system, abort - if (Cast(ObjectToLint) == nullptr) - { - // @TODO: Bubble up some sort of configuration error? - return true; - } +bool ULintRule_ParticleSystem_EmitterNameRegex::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + // If we aren't a particle system, abort + if (Cast(ObjectToLint) == nullptr) { + // @TODO: Bubble up some sort of configuration error? + return true; + } - return Super::PassesRule(ObjectToLint, ParentRuleSet, OutRuleViolations); + return Super::PassesRule(ObjectToLint, ParentRuleSet, OutRuleViolations); } -bool ULintRule_ParticleSystem_EmitterNameRegex::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - const UParticleSystem* ParticleSystem = CastChecked(ObjectToLint); - - bool bRuleViolated = false; - - const FText FixTextTemplate = NSLOCTEXT("Linter", "ParticleHasBadEmitterNames", "{Previous}{WhiteSpace}Please rename emitter {EmitterName}."); - FText AllFixes; - - if (ParticleSystem->Emitters.Num() >= MinEmittersNeededToEnforce) - { - const FRegexPattern RegexPattern = FRegexPattern(RegexPatternString); - - for (const UParticleEmitter* Emitter : ParticleSystem->Emitters) - { - FRegexMatcher RegexMatcher(RegexPattern, Emitter->EmitterName.ToString()); - const bool bFoundMatch = RegexMatcher.FindNext(); - - if ((bFoundMatch && bMustNotContainRegexPattern) || (!bFoundMatch && !bMustNotContainRegexPattern)) - { - AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("EmitterName"), FText::FromString(Emitter->EmitterName.ToString()), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); - bRuleViolated = true; - } - } - } - - if (bRuleViolated) - { - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); - return false; - } - - return true; -} \ No newline at end of file +bool ULintRule_ParticleSystem_EmitterNameRegex::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + const UParticleSystem* ParticleSystem = CastChecked(ObjectToLint); + + bool bRuleViolated = false; + + const FText FixTextTemplate = NSLOCTEXT("Linter", "ParticleHasBadEmitterNames", "{Previous}{WhiteSpace}Please rename emitter {EmitterName}."); + FText AllFixes; + + if (ParticleSystem->Emitters.Num() >= MinEmittersNeededToEnforce) { + const FRegexPattern RegexPattern = FRegexPattern(RegexPatternString); + + for (const UParticleEmitter* Emitter : ParticleSystem->Emitters) { + FRegexMatcher RegexMatcher(RegexPattern, Emitter->EmitterName.ToString()); + const bool bFoundMatch = RegexMatcher.FindNext(); + + if ((bFoundMatch && bMustNotContainRegexPattern) || (!bFoundMatch && !bMustNotContainRegexPattern)) { + AllFixes = FText::FormatNamed(FixTextTemplate, TEXT("Previous"), AllFixes, TEXT("EmitterName"), FText::FromString(Emitter->EmitterName.ToString()), TEXT("WhiteSpace"), bRuleViolated ? FText::FromString(TEXT("\r\n")) : FText::GetEmpty()); + bRuleViolated = true; + } + } + } + + if (bRuleViolated) { + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), AllFixes)); + return false; + } + + return true; +} diff --git a/Source/Linter/Private/LintRules/LintRule_Path_DisallowNames.cpp b/Source/Linter/Private/LintRules/LintRule_Path_DisallowNames.cpp index a45e5be..32dfabc 100644 --- a/Source/Linter/Private/LintRules/LintRule_Path_DisallowNames.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Path_DisallowNames.cpp @@ -1,30 +1,25 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #include "LintRules/LintRule_Path_DisallowNames.h" #include "LintRuleSet.h" -#include "LinterNamingConvention.h" -ULintRule_Path_DisallowNames::ULintRule_Path_DisallowNames(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ - RecommendedAction = NSLOCTEXT("Linter", "LintRule_Path_DisallowNames_ChangeName", "Please rename \"{0}\" to an allowed name."); +ULintRule_Path_DisallowNames::ULintRule_Path_DisallowNames(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) { + RecommendedAction = NSLOCTEXT("Linter", "LintRule_Path_DisallowNames_ChangeName", "Please rename \"{0}\" to an allowed name."); } -bool ULintRule_Path_DisallowNames::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - const FString PathName = ObjectToLint->GetPathName(); - TArray PathElements; - PathName.ParseIntoArray(PathElements, TEXT("/"), true); +bool ULintRule_Path_DisallowNames::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + const FString PathName = ObjectToLint->GetPathName(); + TArray PathElements; + PathName.ParseIntoArray(PathElements, TEXT("/"), true); - bool bRuleViolated = false; + bool bRuleViolated = false; - for (int32 i = 0; i < PathElements.Num() - 1; ++i) - { - if (DisallowedFolderNames.Contains(PathElements[i])) - { - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), FText::FormatOrdered(RecommendedAction, FText::FromString(PathElements[i])))); - bRuleViolated = true; - } - } - - return !bRuleViolated; -} \ No newline at end of file + for (int32 i = 0; i < PathElements.Num() - 1; ++i) { + if (DisallowedFolderNames.Contains(PathElements[i])) { + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), FText::FormatOrdered(RecommendedAction, FText::FromString(PathElements[i])))); + bRuleViolated = true; + } + } + + return !bRuleViolated; +} diff --git a/Source/Linter/Private/LintRules/LintRule_Path_IsNotTooLong.cpp b/Source/Linter/Private/LintRules/LintRule_Path_IsNotTooLong.cpp index 9a012fc..668066f 100644 --- a/Source/Linter/Private/LintRules/LintRule_Path_IsNotTooLong.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Path_IsNotTooLong.cpp @@ -1,27 +1,22 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #include "LintRules/LintRule_Path_IsNotTooLong.h" #include "LintRuleSet.h" -#include "LinterNamingConvention.h" -ULintRule_Path_IsNotTooLong::ULintRule_Path_IsNotTooLong(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ -} +ULintRule_Path_IsNotTooLong::ULintRule_Path_IsNotTooLong(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} + +bool ULintRule_Path_IsNotTooLong::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + const FString PathName = ObjectToLint->GetPathName(); -bool ULintRule_Path_IsNotTooLong::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - const FString PathName = ObjectToLint->GetPathName(); + // See if file path is longer than 140 characters + // 145 = 140 + /Game (5) + int32 DotIndex = -1; + PathName.FindLastChar('.', DotIndex); + const FString FilePath = PathName.LeftChop(PathName.Len() - DotIndex); + if (FilePath.Len() >= MaxPathLimit + 5) { + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass())); + return false; + } - // See if file path is longer than 140 characters - // 145 = 140 + /Game (5) - int32 DotIndex = -1; - PathName.FindLastChar('.', DotIndex); - const FString FilePath = PathName.LeftChop(PathName.Len() - DotIndex); - if (FilePath.Len() >= MaxPathLimit + 5) - { - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass())); - return false; - } - - return true; -} \ No newline at end of file + return true; +} diff --git a/Source/Linter/Private/LintRules/LintRule_Path_NoTopLevel.cpp b/Source/Linter/Private/LintRules/LintRule_Path_NoTopLevel.cpp index 40b1dbb..0caef7d 100644 --- a/Source/Linter/Private/LintRules/LintRule_Path_NoTopLevel.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Path_NoTopLevel.cpp @@ -1,62 +1,53 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #include "LintRules/LintRule_Path_NoTopLevel.h" #include "LintRuleSet.h" -#include "LinterNamingConvention.h" #include "HAL/FileManager.h" -ULintRule_Path_NoTopLevel::ULintRule_Path_NoTopLevel(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ - ZeroTopLevelFoldersRecommendedAction = NSLOCTEXT("Linter", "LintRule_Path_NoTopLevel_ZeroTopLevelFolders", "There appears to be no top level folders. Please put your assets in a top level folder."); - PleaseUseThisFolderRecommendedAction = NSLOCTEXT("Linter", "LintRule_Path_NoTopLevel_PleaseUseThisFolder", "Please move this asset into a top level folder. Maybe \"{0}\"?"); +ULintRule_Path_NoTopLevel::ULintRule_Path_NoTopLevel(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) { + ZeroTopLevelFoldersRecommendedAction = NSLOCTEXT("Linter", "LintRule_Path_NoTopLevel_ZeroTopLevelFolders", "There appears to be no top level folders. Please put your assets in a top level folder."); + PleaseUseThisFolderRecommendedAction = NSLOCTEXT("Linter", "LintRule_Path_NoTopLevel_PleaseUseThisFolder", "Please move this asset into a top level folder. Maybe \"{0}\"?"); } -bool ULintRule_Path_NoTopLevel::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - const FString PathName = ObjectToLint->GetPathName(); - TArray PathElements; - PathName.ParseIntoArray(PathElements, TEXT("/"), true); - - // Report issue with top assets not in a top level folder - if (PathElements.Num() == 1) - { - FText RecommendedAction; - - // This is really slow to do for every single asset that fails to be in a top level folder - // But doing it here makes the code base a lot cleaner and easier to follow for now. - { - // Determine content sub directory structure for project organization based rules - TArray Subdirectories; - IFileManager::Get().FindFiles(Subdirectories, *(FPaths::ProjectContentDir() / TEXT("*")), false, true); - Subdirectories.Remove(TEXT("Collections")); - Subdirectories.Remove(TEXT("Developers")); - - if (Subdirectories.Num() == 0) - { - RecommendedAction = ZeroTopLevelFoldersRecommendedAction; - } - else - { - FString MostPopulatedContentDir; - int32 FileCount = 0; - for (FString Subdirectory : Subdirectories) - { - TArray FileNames; - IFileManager::Get().FindFilesRecursive(FileNames, *(FPaths::ProjectContentDir() / Subdirectory), TEXT("*"), true, false, false); - if (FileNames.Num() > FileCount) - { - FileCount = FileNames.Num(); - MostPopulatedContentDir = Subdirectory; - } - } - - RecommendedAction = FText::FormatOrdered(PleaseUseThisFolderRecommendedAction, FText::FromString(MostPopulatedContentDir)); - } - } - - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), RecommendedAction)); - return false; - } - - return true; -} \ No newline at end of file +bool ULintRule_Path_NoTopLevel::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + const FString PathName = ObjectToLint->GetPathName(); + TArray PathElements; + PathName.ParseIntoArray(PathElements, TEXT("/"), true); + + // Report issue with top assets not in a top level folder + if (PathElements.Num() == 1) { + FText RecommendedAction; + + // This is really slow to do for every single asset that fails to be in a top level folder + // But doing it here makes the code base a lot cleaner and easier to follow for now. + { + // Determine content sub directory structure for project organization based rules + TArray Subdirectories; + IFileManager::Get().FindFiles(Subdirectories, *(FPaths::ProjectContentDir() / TEXT("*")), false, true); + Subdirectories.Remove(TEXT("Collections")); + Subdirectories.Remove(TEXT("Developers")); + + if (Subdirectories.Num() == 0) { + RecommendedAction = ZeroTopLevelFoldersRecommendedAction; + } else { + FString MostPopulatedContentDir; + int32 FileCount = 0; + for (FString Subdirectory : Subdirectories) { + TArray FileNames; + IFileManager::Get().FindFilesRecursive(FileNames, *(FPaths::ProjectContentDir() / Subdirectory), TEXT("*"), true, false, false); + if (FileNames.Num() > FileCount) { + FileCount = FileNames.Num(); + MostPopulatedContentDir = Subdirectory; + } + } + + RecommendedAction = FText::FormatOrdered(PleaseUseThisFolderRecommendedAction, FText::FromString(MostPopulatedContentDir)); + } + } + + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), RecommendedAction)); + return false; + } + + return true; +} diff --git a/Source/Linter/Private/LintRules/LintRule_Path_Regex.cpp b/Source/Linter/Private/LintRules/LintRule_Path_Regex.cpp index bf00bd1..e111c98 100644 --- a/Source/Linter/Private/LintRules/LintRule_Path_Regex.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Path_Regex.cpp @@ -1,55 +1,46 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #include "LintRules/LintRule_Path_Regex.h" #include "LintRuleSet.h" -#include "LinterNamingConvention.h" #include "Internationalization/Regex.h" -ULintRule_Path_Regex::ULintRule_Path_Regex(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) - , RegexPatternString(TEXT("[^a-zA-Z0-9_]")) -{ - DisallowedPathElementRecommendedAction = NSLOCTEXT("Linter", "ULintRule_Path_Regex_DisallowedPathElement", "Please rename \"{0}\" and remove disallowed characters."); - NonConformingPathElementRecommendedAction = NSLOCTEXT("Linter", "ULintRule_Path_Regex_NonConformingPathElement", "Please rename \"{0}\" and to conform to allowed characters."); +ULintRule_Path_Regex::ULintRule_Path_Regex(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer), + RegexPatternString(TEXT("[^a-zA-Z0-9_]")) { + DisallowedPathElementRecommendedAction = NSLOCTEXT("Linter", "ULintRule_Path_Regex_DisallowedPathElement", "Please rename \"{0}\" and remove disallowed characters."); + NonConformingPathElementRecommendedAction = NSLOCTEXT("Linter", "ULintRule_Path_Regex_NonConformingPathElement", "Please rename \"{0}\" and to conform to allowed characters."); - DisallowedWholePathRecommendedAction = NSLOCTEXT("Linter", "ULintRule_Path_Regex_DisallowedWholePath", "Please rename and remove disallowed characters."); - NonConformingWholePathRecommendedAction = NSLOCTEXT("Linter", "ULintRule_Path_Regex_NonConformingWholePath", "Please rename and conform to allowed characters."); + DisallowedWholePathRecommendedAction = NSLOCTEXT("Linter", "ULintRule_Path_Regex_DisallowedWholePath", "Please rename and remove disallowed characters."); + NonConformingWholePathRecommendedAction = NSLOCTEXT("Linter", "ULintRule_Path_Regex_NonConformingWholePath", "Please rename and conform to allowed characters."); } -bool ULintRule_Path_Regex::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - const FString PathName = ObjectToLint->GetPathName(); - - const FRegexPattern RegexPattern = FRegexPattern(RegexPatternString); - bool bRuleViolated = false; - - if (bCheckPerPathElement) - { - TArray PathElements; - PathName.ParseIntoArray(PathElements, TEXT("/"), true); - - for (int32 i = 0; i < PathElements.Num() - 1; ++i) - { - FRegexMatcher RegexMatcher(RegexPattern, PathElements[i]); - const bool bFoundMatch = RegexMatcher.FindNext(); - - if ((bFoundMatch && bMustNotContainRegexPattern) || (!bFoundMatch && !bMustNotContainRegexPattern)) - { - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), FText::FormatOrdered(bMustNotContainRegexPattern ? DisallowedPathElementRecommendedAction : NonConformingPathElementRecommendedAction, FText::FromString(PathElements[i])))); - bRuleViolated = true; - } - } - } - else - { - FRegexMatcher RegexMatcher(RegexPattern, PathName); - const bool bFoundMatch = RegexMatcher.FindNext(); - - if ((bFoundMatch && bMustNotContainRegexPattern) || (!bFoundMatch && !bMustNotContainRegexPattern)) - { - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), FText::FormatOrdered(bMustNotContainRegexPattern ? DisallowedWholePathRecommendedAction : NonConformingWholePathRecommendedAction, FText::FromString(PathName)))); - bRuleViolated = true; - } - } - - return !bRuleViolated; -} \ No newline at end of file +bool ULintRule_Path_Regex::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + const FString PathName = ObjectToLint->GetPathName(); + + const FRegexPattern RegexPattern = FRegexPattern(RegexPatternString); + bool bRuleViolated = false; + + if (bCheckPerPathElement) { + TArray PathElements; + PathName.ParseIntoArray(PathElements, TEXT("/"), true); + + for (int32 i = 0; i < PathElements.Num() - 1; ++i) { + FRegexMatcher RegexMatcher(RegexPattern, PathElements[i]); + const bool bFoundMatch = RegexMatcher.FindNext(); + + if ((bFoundMatch && bMustNotContainRegexPattern) || (!bFoundMatch && !bMustNotContainRegexPattern)) { + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), FText::FormatOrdered(bMustNotContainRegexPattern ? DisallowedPathElementRecommendedAction : NonConformingPathElementRecommendedAction, FText::FromString(PathElements[i])))); + bRuleViolated = true; + } + } + } else { + FRegexMatcher RegexMatcher(RegexPattern, PathName); + const bool bFoundMatch = RegexMatcher.FindNext(); + + if ((bFoundMatch && bMustNotContainRegexPattern) || (!bFoundMatch && !bMustNotContainRegexPattern)) { + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), FText::FormatOrdered(bMustNotContainRegexPattern ? DisallowedWholePathRecommendedAction : NonConformingWholePathRecommendedAction, FText::FromString(PathName)))); + bRuleViolated = true; + } + } + + return !bRuleViolated; +} diff --git a/Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp b/Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp index 5922f78..9bf3060 100644 --- a/Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp +++ b/Source/Linter/Private/LintRules/LintRule_SoundWave_SampleRate.cpp @@ -3,38 +3,33 @@ #include "LintRuleSet.h" #include "Sound/SoundWave.h" -ULintRule_SoundWave_SampleRate::ULintRule_SoundWave_SampleRate(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ - ValidSampleRates.Push(22050.0f); - ValidSampleRates.Push(44100.0f); +ULintRule_SoundWave_SampleRate::ULintRule_SoundWave_SampleRate(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) { + ValidSampleRates.Push(22050.0f); + ValidSampleRates.Push(44100.0f); } -bool ULintRule_SoundWave_SampleRate::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - // If we aren't a sound wave, abort - if (Cast(ObjectToLint) == nullptr) - { - // @TODO: Bubble up some sort of configuration error? - return true; - } +bool ULintRule_SoundWave_SampleRate::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + // If we aren't a sound wave, abort + if (Cast(ObjectToLint) == nullptr) { + // @TODO: Bubble up some sort of configuration error? + return true; + } - return Super::PassesRule(ObjectToLint, ParentRuleSet, OutRuleViolations); + return Super::PassesRule(ObjectToLint, ParentRuleSet, OutRuleViolations); } -bool ULintRule_SoundWave_SampleRate::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - USoundWave* SoundWave = CastChecked(ObjectToLint); +bool ULintRule_SoundWave_SampleRate::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + USoundWave* SoundWave = CastChecked(ObjectToLint); - if (ValidSampleRates.Contains(SoundWave->GetSampleRateForCurrentPlatform())) - { - return true; - } + if (ValidSampleRates.Contains(SoundWave->GetSampleRateForCurrentPlatform())) { + return true; + } - FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_SoundWave_SampleRate_Fix", "Please fix your sample rate of {0}."); - RecommendedAction = FText::FormatOrdered(RecommendedAction, SoundWave->GetSampleRateForCurrentPlatform()); + FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_SoundWave_SampleRate_Fix", "Please fix your sample rate of {0}."); + RecommendedAction = FText::FormatOrdered(RecommendedAction, SoundWave->GetSampleRateForCurrentPlatform()); - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), RecommendedAction)); - - return true; -} \ No newline at end of file + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), RecommendedAction)); + + return true; +} diff --git a/Source/Linter/Private/LintRules/LintRule_StaticMesh_ValidUVs.cpp b/Source/Linter/Private/LintRules/LintRule_StaticMesh_ValidUVs.cpp index 34fb23f..95a2d79 100644 --- a/Source/Linter/Private/LintRules/LintRule_StaticMesh_ValidUVs.cpp +++ b/Source/Linter/Private/LintRules/LintRule_StaticMesh_ValidUVs.cpp @@ -1,53 +1,44 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #include "LintRules/LintRule_StaticMesh_ValidUVs.h" #include "LintRuleSet.h" -#include "LinterNamingConvention.h" -ULintRule_StaticMesh_ValidUVs::ULintRule_StaticMesh_ValidUVs(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ - //UStaticMesh::CheckLightMapUVs requires being ran on the game thread - bRequiresGameThread = true; +ULintRule_StaticMesh_ValidUVs::ULintRule_StaticMesh_ValidUVs(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) { + //UStaticMesh::CheckLightMapUVs requires being ran on the game thread + bRequiresGameThread = true; } -bool ULintRule_StaticMesh_ValidUVs::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - // If we aren't a static mesh, abort - if (Cast(ObjectToLint) == nullptr) - { - // @TODO: Bubble up some sort of configuration error? - return true; - } +bool ULintRule_StaticMesh_ValidUVs::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + // If we aren't a static mesh, abort + if (Cast(ObjectToLint) == nullptr) { + // @TODO: Bubble up some sort of configuration error? + return true; + } - return Super::PassesRule(ObjectToLint, ParentRuleSet, OutRuleViolations); + return Super::PassesRule(ObjectToLint, ParentRuleSet, OutRuleViolations); } -bool ULintRule_StaticMesh_ValidUVs::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - const UStaticMesh* StaticMesh = CastChecked(ObjectToLint); +bool ULintRule_StaticMesh_ValidUVs::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + const UStaticMesh* StaticMesh = CastChecked(ObjectToLint); - bool bHadErrors = false; + TArray MissingUVs; + TArray BadUVs; + TArray ValidUVs; - TArray MissingUVs; - TArray BadUVs; - TArray ValidUVs; + UStaticMesh::CheckLightMapUVs(const_cast(StaticMesh), MissingUVs, BadUVs, ValidUVs, true); - UStaticMesh::CheckLightMapUVs(const_cast(StaticMesh), MissingUVs, BadUVs, ValidUVs, true); + if ((!bIgnoreMissingUVs && MissingUVs.Num() > 0)) { + const FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_StaticMesh_ValidUVs_Missing", "Static mesh has missing UVs. Please add at least one valid UV channel."); + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), RecommendedAction)); + return false; + } - if ((!bIgnoreMissingUVs && MissingUVs.Num() > 0)) - { - const FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_StaticMesh_ValidUVs_Missing", "Static mesh has missing UVs. Please add at least one valid UV channel."); - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), RecommendedAction)); - return false; - } + if (BadUVs.Num() > 0) { + const FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_StaticMesh_ValidUVs_Bad", "Static mesh has invalid UVs. [{0}]"); + FText::FormatOrdered(RecommendedAction, FText::FromString(FString::Join(BadUVs, TEXT(", ")))); + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), RecommendedAction)); + return false; + } - if (BadUVs.Num() > 0) - { - const FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_StaticMesh_ValidUVs_Bad", "Static mesh has invalid UVs. [{0}]"); - FText::FormatOrdered(RecommendedAction, FText::FromString(FString::Join(BadUVs, TEXT(", ")))); - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), RecommendedAction)); - return false; - } - - return true; -} \ No newline at end of file + return true; +} diff --git a/Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp b/Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp index f481bcb..2dbeda7 100644 --- a/Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp @@ -1,39 +1,32 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #include "LintRules/LintRule_Texture_Size_NotTooBig.h" #include "LintRuleSet.h" -#include "LinterNamingConvention.h" -ULintRule_Texture_Size_NotTooBig::ULintRule_Texture_Size_NotTooBig(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ -} +ULintRule_Texture_Size_NotTooBig::ULintRule_Texture_Size_NotTooBig(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) {} -bool ULintRule_Texture_Size_NotTooBig::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - // If we aren't a texture, abort - if (Cast(ObjectToLint) == nullptr) - { - // @TODO: Bubble up some sort of configuration error? - return true; - } +bool ULintRule_Texture_Size_NotTooBig::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + // If we aren't a texture, abort + if (Cast(ObjectToLint) == nullptr) { + // @TODO: Bubble up some sort of configuration error? + return true; + } - return Super::PassesRule(ObjectToLint, ParentRuleSet, OutRuleViolations); + return Super::PassesRule(ObjectToLint, ParentRuleSet, OutRuleViolations); } -bool ULintRule_Texture_Size_NotTooBig::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - const UTexture2D* Texture = CastChecked(ObjectToLint); +bool ULintRule_Texture_Size_NotTooBig::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + const UTexture2D* Texture = CastChecked(ObjectToLint); - const int32 TexSizeX = Texture->GetSizeX(); - const int32 TexSizeY = Texture->GetSizeY(); + const int32 TexSizeX = Texture->GetSizeX(); + const int32 TexSizeY = Texture->GetSizeY(); - // Check to see if textures are too big - if (TexSizeX > MaxTextureSizeX || TexSizeY > MaxTextureSizeY) - { - const FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_Texture_Size_NotTooBig_TooBig", "Please shrink your textures dimensions so that they fit within {0}x{1} pixels."); - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), FText::FormatOrdered(RecommendedAction, MaxTextureSizeX, MaxTextureSizeY))); - return false; - } + // Check to see if textures are too big + if (TexSizeX > MaxTextureSizeX || TexSizeY > MaxTextureSizeY) { + const FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_Texture_Size_NotTooBig_TooBig", "Please shrink your textures dimensions so that they fit within {0}x{1} pixels."); + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), FText::FormatOrdered(RecommendedAction, MaxTextureSizeX, MaxTextureSizeY))); + return false; + } - return true; -} \ No newline at end of file + return true; +} diff --git a/Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp b/Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp index 81dcaee..031f3e6 100644 --- a/Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp @@ -1,72 +1,59 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #include "LintRules/LintRule_Texture_Size_PowerOfTwo.h" #include "LintRuleSet.h" -#include "LinterNamingConvention.h" -ULintRule_Texture_Size_PowerOfTwo::ULintRule_Texture_Size_PowerOfTwo(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ - IgnoreTexturesInTheseGroups.Add(TEXTUREGROUP_UI); +ULintRule_Texture_Size_PowerOfTwo::ULintRule_Texture_Size_PowerOfTwo(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) { + IgnoreTexturesInTheseGroups.Add(TEXTUREGROUP_UI); } -bool ULintRule_Texture_Size_PowerOfTwo::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - // If we aren't a texture, abort - if (Cast(ObjectToLint) == nullptr) - { - // @TODO: Bubble up some sort of configuration error? - return true; - } +bool ULintRule_Texture_Size_PowerOfTwo::PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + // If we aren't a texture, abort + if (Cast(ObjectToLint) == nullptr) { + // @TODO: Bubble up some sort of configuration error? + return true; + } - // If we're to ignore this texture LOD group, abort - if (IgnoreTexturesInTheseGroups.Contains(Cast(ObjectToLint)->LODGroup)) - { - return true; - } + // If we're to ignore this texture LOD group, abort + if (IgnoreTexturesInTheseGroups.Contains(Cast(ObjectToLint)->LODGroup)) { + return true; + } - return Super::PassesRule(ObjectToLint, ParentRuleSet, OutRuleViolations); + return Super::PassesRule(ObjectToLint, ParentRuleSet, OutRuleViolations); } -bool ULintRule_Texture_Size_PowerOfTwo::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const -{ - const UTexture2D* Texture = CastChecked(ObjectToLint); +bool ULintRule_Texture_Size_PowerOfTwo::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + const UTexture2D* Texture = CastChecked(ObjectToLint); - int32 TexSizeX = Texture->GetSizeX(); - int32 TexSizeY = Texture->GetSizeY(); + int32 TexSizeX = Texture->GetSizeX(); + int32 TexSizeY = Texture->GetSizeY(); - const bool bXFail = ((TexSizeX & (TexSizeX - 1)) != 0); - const bool bYFail = ((TexSizeY & (TexSizeY - 1)) != 0); + const bool bXFail = ((TexSizeX & (TexSizeX - 1)) != 0); + const bool bYFail = ((TexSizeY & (TexSizeY - 1)) != 0); - const UEnum* TextureGroupEnum = StaticEnum(); - FString IgnoredLODGroupNames; + const UEnum* TextureGroupEnum = StaticEnum(); + FString IgnoredLODGroupNames; - for (TEnumAsByte LODGroup : IgnoreTexturesInTheseGroups) - { - IgnoredLODGroupNames += TextureGroupEnum->GetMetaData(TEXT("DisplayName"), LODGroup) + TEXT(", "); - } - IgnoredLODGroupNames.RemoveFromEnd(TEXT(", ")); + for (TEnumAsByte LODGroup : IgnoreTexturesInTheseGroups) { + IgnoredLODGroupNames += TextureGroupEnum->GetMetaData(TEXT("DisplayName"), LODGroup) + TEXT(", "); + } + IgnoredLODGroupNames.RemoveFromEnd(TEXT(", ")); - FText IgnoredLODGroupTip = IgnoredLODGroupNames.Len() > 0 ? FText::FormatOrdered(NSLOCTEXT("Linter", "LintRule_Texture_Size_PowerOfTwo_AllowedLODGroups", ". Alternatively, assign this texture to one of these LOD Groups: [{0}]"), FText::FromString(IgnoredLODGroupNames)) : FText::GetEmpty(); + FText IgnoredLODGroupTip = IgnoredLODGroupNames.Len() > 0 ? FText::FormatOrdered(NSLOCTEXT("Linter", "LintRule_Texture_Size_PowerOfTwo_AllowedLODGroups", ". Alternatively, assign this texture to one of these LOD Groups: [{0}]"), FText::FromString(IgnoredLODGroupNames)) : FText::GetEmpty(); - if (bXFail || bYFail) - { - FText RecommendedAction; - if (bXFail && bYFail) - { - RecommendedAction = FText::FormatOrdered(NSLOCTEXT("Linter", "LintRule_Texture_Size_PowerOfTwo_Fail_XY", "Please fix the width and height of this texture, currently {0} by {1}{2}"), TexSizeX, TexSizeY, IgnoredLODGroupTip); - } - else if (bXFail) - { - RecommendedAction = FText::FormatOrdered(NSLOCTEXT("Linter", "LintRule_Texture_Size_PowerOfTwo_Fail_X", "Please fix the width of this texture, currently {0}{1}"), TexSizeX, IgnoredLODGroupTip); - } - else if (bYFail) - { - RecommendedAction = FText::FormatOrdered(NSLOCTEXT("Linter", "LintRule_Texture_Size_PowerOfTwo_Fail_Y", "Please fix the height of this texture, currently {0}{1}"), TexSizeY, IgnoredLODGroupTip); - } + if (bXFail || bYFail) { + FText RecommendedAction; + if (bXFail && bYFail) { + RecommendedAction = FText::FormatOrdered(NSLOCTEXT("Linter", "LintRule_Texture_Size_PowerOfTwo_Fail_XY", "Please fix the width and height of this texture, currently {0} by {1}{2}"), TexSizeX, TexSizeY, IgnoredLODGroupTip); + } else if (bXFail) { + RecommendedAction = FText::FormatOrdered(NSLOCTEXT("Linter", "LintRule_Texture_Size_PowerOfTwo_Fail_X", "Please fix the width of this texture, currently {0}{1}"), TexSizeX, IgnoredLODGroupTip); + } else if (bYFail) { + RecommendedAction = FText::FormatOrdered(NSLOCTEXT("Linter", "LintRule_Texture_Size_PowerOfTwo_Fail_Y", "Please fix the height of this texture, currently {0}{1}"), TexSizeY, IgnoredLODGroupTip); + } - OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), RecommendedAction)); - return false; - } - - return true; -} \ No newline at end of file + OutRuleViolations.Push(FLintRuleViolation(ObjectToLint, GetClass(), RecommendedAction)); + return false; + } + + return true; +} diff --git a/Source/Linter/Private/LintRunner.cpp b/Source/Linter/Private/LintRunner.cpp index cfbbc56..8182e27 100644 --- a/Source/Linter/Private/LintRunner.cpp +++ b/Source/Linter/Private/LintRunner.cpp @@ -8,81 +8,63 @@ FCriticalSection FLintRunner::LintDataUpdateLock; -FLintRunner::FLintRunner(UObject* InLoadedObject, const ULintRuleSet* LintRuleSet, TArray* InpOutRuleViolations, FScopedSlowTask* InParentScopedSlowTask) - : LoadedObject(InLoadedObject) - , RuleSet(LintRuleSet) - , pOutRuleViolations(InpOutRuleViolations) - , pLoadedRuleList(LintRuleSet != nullptr ? LintRuleSet->GetLintRuleListForClass(InLoadedObject->GetClass()) : nullptr) - , ParentScopedSlowTask(InParentScopedSlowTask) -{ +FLintRunner::FLintRunner(UObject* InLoadedObject, const ULintRuleSet* LintRuleSet, TArray* InpOutRuleViolations, FScopedSlowTask* InParentScopedSlowTask) : + LoadedObject(InLoadedObject), + RuleSet(LintRuleSet), + pOutRuleViolations(InpOutRuleViolations), + pLoadedRuleList(LintRuleSet != nullptr ? LintRuleSet->GetLintRuleListForClass(InLoadedObject->GetClass()) : nullptr), + ParentScopedSlowTask(InParentScopedSlowTask) {} + +bool FLintRunner::RequiresGamethread() { + if (pLoadedRuleList != nullptr) { + return pLoadedRuleList->RequiresGameThread(); + } + + return false; } -bool FLintRunner::RequiresGamethread() -{ - if (pLoadedRuleList != nullptr) - { - return pLoadedRuleList->RequiresGameThread(); - } +bool FLintRunner::Init() { + if (LoadedObject == nullptr) { + return false; + } - return false; -} + if (RuleSet == nullptr) { + return false; + } + + if (pLoadedRuleList == nullptr) { + return false; + } + + if (pOutRuleViolations == nullptr) { + return false; + } -bool FLintRunner::Init() -{ - if (LoadedObject == nullptr) - { - return false; - } - - if (RuleSet == nullptr) - { - return false; - } - - if (pLoadedRuleList == nullptr) - { - return false; - } - - if (pOutRuleViolations == nullptr) - { - return false; - } - - return true; + return true; } -uint32 FLintRunner::Run() -{ - if (LoadedObject == nullptr || pLoadedRuleList == nullptr || RuleSet == nullptr || pOutRuleViolations == nullptr) - { - return 2; - } +uint32 FLintRunner::Run() { + if (LoadedObject == nullptr || pLoadedRuleList == nullptr || RuleSet == nullptr || pOutRuleViolations == nullptr) { + return 2; + } - FString const AssetPath = LoadedObject->GetPathName(); - UE_LOG(LogLinter, Display, TEXT("Loaded '%s'..."), *AssetPath); + const FString AssetPath = LoadedObject->GetPathName(); + UE_LOG(LogLinter, Display, TEXT("Loaded '%s'..."), *AssetPath); - TArray RuleViolations; - pLoadedRuleList->PassesRules(LoadedObject, RuleSet, RuleViolations); + TArray RuleViolations; + pLoadedRuleList->PassesRules(LoadedObject, RuleSet, RuleViolations); - if (RuleViolations.Num() > 0) - { - FScopeLock Lock(&LintDataUpdateLock); - pOutRuleViolations->Append(RuleViolations); - } + if (RuleViolations.Num() > 0) { + FScopeLock Lock(&LintDataUpdateLock); + pOutRuleViolations->Append(RuleViolations); + } - UE_LOG(LogLinter, Display, TEXT("Finished '%s'..."), *AssetPath); - return 0; + UE_LOG(LogLinter, Display, TEXT("Finished '%s'..."), *AssetPath); + return 0; } -void FLintRunner::Stop() -{ - return; // this runner doesn't have anything on-going so there is nothing to stop -} +void FLintRunner::Stop() {} -void FLintRunner::Exit() -{ - return; -} +void FLintRunner::Exit() {} -#undef LOCTEXT_NAMESPACE \ No newline at end of file +#undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/Linter.cpp b/Source/Linter/Private/Linter.cpp index 6c68285..32f5091 100644 --- a/Source/Linter/Private/Linter.cpp +++ b/Source/Linter/Private/Linter.cpp @@ -18,122 +18,107 @@ static const FName LinterTabName = "LinterTab"; -void FLinterModule::StartupModule() -{ - // Load the asset registry module - const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(FName("AssetRegistry")); - IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); - - if (AssetRegistry.IsLoadingAssets()) - { - AssetRegistry.OnFilesLoaded().AddRaw(this, &FLinterModule::OnInitialAssetRegistrySearchComplete); - } - else - { - OnInitialAssetRegistrySearchComplete(); - } - - // Integrate Linter actions into existing editor context menus - if (!IsRunningCommandlet()) - { - // Register slate style overrides - FLinterStyle::Initialize(); - const TSharedPtr StyleSetPtr = FLinterStyle::StyleSet; - - if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr("Settings")) - { - SettingsModule->RegisterSettings("Project", "Plugins", "Linter", - LOCTEXT("RuntimeSettingsName", "Linter"), - LOCTEXT("RuntimeSettingsDescription", "Configure the Linter plugin"), - GetMutableDefault()); - } - - // Install UI Hooks - FLinterContentBrowserExtensions::InstallHooks(this, &ContentBrowserExtenderDelegateHandle, &AssetExtenderDelegateHandle); - - //Register our UI - FGlobalTabmanager::Get()->RegisterNomadTabSpawner( - LinterTabName, - FOnSpawnTab::CreateStatic(&FLinterModule::SpawnTab, StyleSetPtr)) - .SetDisplayName(LOCTEXT("LinterTabName", "Linter")) - .SetTooltipText(LOCTEXT("LinterTabToolTip", "Linter")) - .SetMenuType(ETabSpawnerMenuType::Hidden); - - FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked("PropertyEditor"); - PropertyModule.RegisterCustomClassLayout(ULinterNamingConvention::StaticClass()->GetFName(), FOnGetDetailCustomizationInstance::CreateStatic(&FLinterNamingConventionDetails::MakeInstance)); - } +void FLinterModule::StartupModule() { + // Load the asset registry module + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(FName("AssetRegistry")); + IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); + + if (AssetRegistry.IsLoadingAssets()) { + AssetRegistry.OnFilesLoaded().AddRaw(this, &FLinterModule::OnInitialAssetRegistrySearchComplete); + } else { + OnInitialAssetRegistrySearchComplete(); + } + + // Integrate Linter actions into existing editor context menus + if (!IsRunningCommandlet()) { + // Register slate style overrides + FLinterStyle::Initialize(); + const TSharedPtr StyleSetPtr = FLinterStyle::StyleSet; + + if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr("Settings")) { + SettingsModule->RegisterSettings("Project", "Plugins", "Linter", + LOCTEXT("RuntimeSettingsName", "Linter"), + LOCTEXT("RuntimeSettingsDescription", "Configure the Linter plugin"), + GetMutableDefault()); + } + + // Install UI Hooks + FLinterContentBrowserExtensions::InstallHooks(this, &ContentBrowserExtenderDelegateHandle, &AssetExtenderDelegateHandle); + + //Register our UI + FGlobalTabmanager::Get()->RegisterNomadTabSpawner( + LinterTabName, + FOnSpawnTab::CreateStatic(&FLinterModule::SpawnTab, StyleSetPtr)) + .SetDisplayName(LOCTEXT("LinterTabName", "Linter")) + .SetTooltipText(LOCTEXT("LinterTabToolTip", "Linter")) + .SetMenuType(ETabSpawnerMenuType::Hidden); + + FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked("PropertyEditor"); + PropertyModule.RegisterCustomClassLayout(ULinterNamingConvention::StaticClass()->GetFName(), FOnGetDetailCustomizationInstance::CreateStatic(&FLinterNamingConventionDetails::MakeInstance)); + } } -void FLinterModule::ShutdownModule() -{ - if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr("Settings")) - { - SettingsModule->UnregisterSettings("Project", "Plugins", "Linter"); - } +void FLinterModule::ShutdownModule() { + if (ISettingsModule* SettingsModule = FModuleManager::GetModulePtr("Settings")) { + SettingsModule->UnregisterSettings("Project", "Plugins", "Linter"); + } - if (UObjectInitialized()) - { - FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked("PropertyEditor"); - PropertyModule.UnregisterCustomClassLayout(ULinterNamingConvention::StaticClass()->GetFName()); + if (UObjectInitialized()) { + FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked("PropertyEditor"); + PropertyModule.UnregisterCustomClassLayout(ULinterNamingConvention::StaticClass()->GetFName()); - FLinterContentBrowserExtensions::RemoveHooks(this, &ContentBrowserExtenderDelegateHandle, &AssetExtenderDelegateHandle); + FLinterContentBrowserExtensions::RemoveHooks(this, &ContentBrowserExtenderDelegateHandle, &AssetExtenderDelegateHandle); - if (FModuleManager::Get().IsModuleLoaded(TEXT("LevelEditor"))) - { - FLevelEditorModule& LevelEditorModule = FModuleManager::GetModuleChecked(TEXT("LevelEditor")); - LevelEditorModule.OnTabManagerChanged().Remove(LevelEditorTabManagerChangedHandle); - } + if (FModuleManager::Get().IsModuleLoaded(TEXT("LevelEditor"))) { + FLevelEditorModule& LevelEditorModule = FModuleManager::GetModuleChecked(TEXT("LevelEditor")); + LevelEditorModule.OnTabManagerChanged().Remove(LevelEditorTabManagerChangedHandle); + } - FGlobalTabmanager::Get()->UnregisterTabSpawner(LinterTabName); + FGlobalTabmanager::Get()->UnregisterTabSpawner(LinterTabName); - // Unregister slate style overrides - FLinterStyle::Shutdown(); - } + // Unregister slate style overrides + FLinterStyle::Shutdown(); + } } -TSharedRef FLinterModule::SpawnTab(const FSpawnTabArgs& TabSpawnArgs, TSharedPtr StyleSet) -{ - const FSlateBrush* IconBrush = StyleSet->GetBrush("Linter.Toolbar.Icon"); +TSharedRef FLinterModule::SpawnTab(const FSpawnTabArgs& TabSpawnArgs, TSharedPtr StyleSet) { + const FSlateBrush* IconBrush = StyleSet->GetBrush("Linter.Toolbar.Icon"); - const TSharedRef MajorTab = - SNew(SDockTab) - .TabRole(ETabRole::MajorTab); + const TSharedRef MajorTab = + SNew(SDockTab) + .TabRole(ETabRole::MajorTab); - MajorTab->SetContent(SNew(SLintWizard)); - MajorTab->SetTabIcon(IconBrush); + MajorTab->SetContent(SNew(SLintWizard)); + MajorTab->SetTabIcon(IconBrush); - return MajorTab; + return MajorTab; } -void FLinterModule::OnInitialAssetRegistrySearchComplete() -{ - TryToLoadAllLintRuleSets(); +void FLinterModule::OnInitialAssetRegistrySearchComplete() { + TryToLoadAllLintRuleSets(); } -void FLinterModule::TryToLoadAllLintRuleSets() -{ - const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(FName("AssetRegistry")); - const IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); +void FLinterModule::TryToLoadAllLintRuleSets() { + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(FName("AssetRegistry")); + const IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); - TArray FoundRuleSets; + TArray FoundRuleSets; #if UE_VERSION_NEWER_THAN(5, 1, 0) - AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetClassPathName(), FoundRuleSets, true); + AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetClassPathName(), FoundRuleSets, true); #else - AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetFName(), FoundRuleSets, true); + AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetFName(), FoundRuleSets, true); #endif - // Attempt to get all RuleSets in memory so that linting tools are better aware of them - for (const FAssetData& RuleSetData : FoundRuleSets) - { - if (!RuleSetData.IsAssetLoaded()) - { - RuleSetData.GetAsset(); - } - } + // Attempt to get all RuleSets in memory so that linting tools are better aware of them + for (const FAssetData& RuleSetData : FoundRuleSets) { + if (!RuleSetData.IsAssetLoaded()) { + RuleSetData.GetAsset(); + } + } } #undef LOCTEXT_NAMESPACE IMPLEMENT_MODULE(FLinterModule, Linter) -DEFINE_LOG_CATEGORY(LogLinter); \ No newline at end of file +DEFINE_LOG_CATEGORY(LogLinter); diff --git a/Source/Linter/Private/LinterCommandlet.cpp b/Source/Linter/Private/LinterCommandlet.cpp index 4c78a4b..59afad6 100644 --- a/Source/Linter/Private/LinterCommandlet.cpp +++ b/Source/Linter/Private/LinterCommandlet.cpp @@ -16,259 +16,220 @@ DEFINE_LOG_CATEGORY_STATIC(LinterCommandlet, All, All); -ULinterCommandlet::ULinterCommandlet(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ - IsClient = false; - IsServer = false; +ULinterCommandlet::ULinterCommandlet(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) { + IsClient = false; + IsServer = false; } -static void PrintUsage() -{ - UE_LOG(LinterCommandlet, Display, TEXT("Linter Usage: {Editor}.exe Project.uproject -run=Linter \"/Game/\"")); - UE_LOG(LinterCommandlet, Display, TEXT("")); - UE_LOG(LinterCommandlet, Display, TEXT("This will run the Linter on the provided project and will scan the supplied directory, example being the project's full Content/Game tree. Can add multiple paths as additional arguments.")); +static void PrintUsage() { + UE_LOG(LinterCommandlet, Display, TEXT("Linter Usage: {Editor}.exe Project.uproject -run=Linter \"/Game/\"")); + UE_LOG(LinterCommandlet, Display, TEXT("")); + UE_LOG(LinterCommandlet, Display, TEXT("This will run the Linter on the provided project and will scan the supplied directory, example being the project's full Content/Game tree. Can add multiple paths as additional arguments.")); } -int32 ULinterCommandlet::Main(const FString& InParams) -{ - FString Params = InParams; - // Parse command line. - TArray Paths; - TArray Switches; - TMap ParamsMap; - ParseCommandLine(*Params, Paths, Switches, ParamsMap); +int32 ULinterCommandlet::Main(const FString& InParams) { + FString Params = InParams; + // Parse command line. + TArray Paths; + TArray Switches; + TMap ParamsMap; + ParseCommandLine(*Params, Paths, Switches, ParamsMap); - UE_LOG(LinterCommandlet, Display, TEXT("Linter is indeed running!")); - FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); + UE_LOG(LinterCommandlet, Display, TEXT("Linter is indeed running!")); + FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); - UE_LOG(LinterCommandlet, Display, TEXT("Loading the asset registry...")); - AssetRegistryModule.Get().SearchAllAssets(/*bSynchronousSearch =*/true); - UE_LOG(LinterCommandlet, Display, TEXT("Finished loading the asset registry. Determining Rule Set...")); + UE_LOG(LinterCommandlet, Display, TEXT("Loading the asset registry...")); + AssetRegistryModule.Get().SearchAllAssets(/*bSynchronousSearch =*/true); + UE_LOG(LinterCommandlet, Display, TEXT("Finished loading the asset registry. Determining Rule Set...")); - ULintRuleSet* RuleSet = GetDefault()->DefaultLintRuleSet.LoadSynchronous(); - if (ParamsMap.Contains(TEXT("RuleSet"))) - { - const FString RuleSetName = *ParamsMap.FindChecked(TEXT("RuleSet")); - UE_LOG(LinterCommandlet, Display, TEXT("Trying to find Rule Set with Commandlet Name: %s"), *RuleSetName); + ULintRuleSet* RuleSet = GetDefault()->DefaultLintRuleSet.LoadSynchronous(); + if (ParamsMap.Contains(TEXT("RuleSet"))) { + const FString RuleSetName = *ParamsMap.FindChecked(TEXT("RuleSet")); + UE_LOG(LinterCommandlet, Display, TEXT("Trying to find Rule Set with Commandlet Name: %s"), *RuleSetName); - FLinterModule::TryToLoadAllLintRuleSets(); + FLinterModule::TryToLoadAllLintRuleSets(); - TArray FoundRuleSets; + TArray FoundRuleSets; #if UE_VERSION_NEWER_THAN(5, 1, 0) - AssetRegistryModule.Get().GetAssetsByClass(ULintRuleSet::StaticClass()->GetClassPathName(), FoundRuleSets, true); + AssetRegistryModule.Get().GetAssetsByClass(ULintRuleSet::StaticClass()->GetClassPathName(), FoundRuleSets, true); #else - AssetRegistryModule.Get().GetAssetsByClass(ULintRuleSet::StaticClass()->GetFName(), FoundRuleSets, true); + AssetRegistryModule.Get().GetAssetsByClass(ULintRuleSet::StaticClass()->GetFName(), FoundRuleSets, true); #endif - for (const FAssetData& RuleSetData : FoundRuleSets) - { - ULintRuleSet* LoadedRuleSet = Cast(RuleSetData.GetAsset()); - if (LoadedRuleSet != nullptr && LoadedRuleSet->NameForCommandlet == RuleSetName) - { - RuleSet = LoadedRuleSet; - UE_LOG(LinterCommandlet, Display, TEXT("Found Rule Set for name %s: %s"), *RuleSetName, *RuleSet->GetFullName()); - } - } - } - else - { - UE_LOG(LinterCommandlet, Display, TEXT("Using default rule set...")); - } - - if (RuleSet == nullptr) - { - UE_LOG(LinterCommandlet, Error, TEXT("Failed to load a rule set. Aborting. Returning error code 1.")); - return 1; - } - - UE_LOG(LinterCommandlet, Display, TEXT("Using rule set: %s"), *RuleSet->GetFullName()); - - if (Paths.Num() == 0) - { - Paths.Add(TEXT("/Game")); - } - - UE_LOG(LinterCommandlet, Display, TEXT("Attempting to Lint paths: %s"), *FString::Join(Paths, TEXT(", "))); - - const TArray RuleViolations = RuleSet->LintPath(Paths); - - int32 NumErrors = 0; - int32 NumWarnings = 0; - - for (const FLintRuleViolation& Violation : RuleViolations) - { - if (Violation.ViolatedRule->GetDefaultObject()->RuleSeverity <= ELintRuleSeverity::Error) - { - NumErrors++; - } - else - { - NumWarnings++; - } - } - - FString ResultsString = FText::FormatNamed(FText::FromString("Lint completed with {NumWarnings} {NumWarnings}|plural(one=warning,other=warnings), {NumErrors} {NumErrors}|plural(one=error,other=errors)."), TEXT("NumWarnings"), FText::FromString(FString::FromInt(NumWarnings)), TEXT("NumErrors"), FText::FromString(FString::FromInt(NumErrors))).ToString(); - UE_LOG(LinterCommandlet, Display, TEXT("Lint completed with %s."), *ResultsString); - - bool bWriteReport = Switches.Contains(TEXT("json")) || ParamsMap.Contains(TEXT("json")) || Switches.Contains(TEXT("html")) || ParamsMap.Contains(TEXT("html")); - if (bWriteReport) - { - UE_LOG(LinterCommandlet, Display, TEXT("Generating output report...")); - - TSharedPtr RootJsonObject = MakeShareable(new FJsonObject); - TArray> ViolatorJsonObjects; - - TArray UniqueViolators = FLintRuleViolation::AllRuleViolationViolators(RuleViolations); - for (const UObject* Violator : UniqueViolators) - { - TSharedPtr AssetJsonObject = MakeShareable(new FJsonObject); - TArray UniqueViolatorViolations = FLintRuleViolation::AllRuleViolationsWithViolator(RuleViolations, Violator); - - FAssetData AssetData; - if (UniqueViolatorViolations.Num() > 0) - { - UniqueViolatorViolations[0].PopulateAssetData(); - AssetData = UniqueViolatorViolations[0].ViolatorAssetData; - AssetJsonObject->SetStringField(TEXT("ViolatorAssetName"), AssetData.AssetName.ToString()); + for (const FAssetData& RuleSetData : FoundRuleSets) { + ULintRuleSet* LoadedRuleSet = Cast(RuleSetData.GetAsset()); + if (LoadedRuleSet != nullptr && LoadedRuleSet->NameForCommandlet == RuleSetName) { + RuleSet = LoadedRuleSet; + UE_LOG(LinterCommandlet, Display, TEXT("Found Rule Set for name %s: %s"), *RuleSetName, *RuleSet->GetFullName()); + } + } + } else { + UE_LOG(LinterCommandlet, Display, TEXT("Using default rule set...")); + } + + if (RuleSet == nullptr) { + UE_LOG(LinterCommandlet, Error, TEXT("Failed to load a rule set. Aborting. Returning error code 1.")); + return 1; + } + + UE_LOG(LinterCommandlet, Display, TEXT("Using rule set: %s"), *RuleSet->GetFullName()); + + if (Paths.Num() == 0) { + Paths.Add(TEXT("/Game")); + } + + UE_LOG(LinterCommandlet, Display, TEXT("Attempting to Lint paths: %s"), *FString::Join(Paths, TEXT(", "))); + + const TArray RuleViolations = RuleSet->LintPath(Paths); + + int32 NumErrors = 0; + int32 NumWarnings = 0; + + for (const FLintRuleViolation& Violation : RuleViolations) { + if (Violation.ViolatedRule->GetDefaultObject()->RuleSeverity <= ELintRuleSeverity::Error) { + NumErrors++; + } else { + NumWarnings++; + } + } + + FString ResultsString = FText::FormatNamed(FText::FromString("Lint completed with {NumWarnings} {NumWarnings}|plural(one=warning,other=warnings), {NumErrors} {NumErrors}|plural(one=error,other=errors)."), TEXT("NumWarnings"), FText::FromString(FString::FromInt(NumWarnings)), TEXT("NumErrors"), FText::FromString(FString::FromInt(NumErrors))).ToString(); + UE_LOG(LinterCommandlet, Display, TEXT("Lint completed with %s."), *ResultsString); + + bool bWriteReport = Switches.Contains(TEXT("json")) || ParamsMap.Contains(TEXT("json")) || Switches.Contains(TEXT("html")) || ParamsMap.Contains(TEXT("html")); + if (bWriteReport) { + UE_LOG(LinterCommandlet, Display, TEXT("Generating output report...")); + + TSharedPtr RootJsonObject = MakeShareable(new FJsonObject); + TArray> ViolatorJsonObjects; + + TArray UniqueViolators = FLintRuleViolation::AllRuleViolationViolators(RuleViolations); + for (const UObject* Violator : UniqueViolators) { + TSharedPtr AssetJsonObject = MakeShareable(new FJsonObject); + TArray UniqueViolatorViolations = FLintRuleViolation::AllRuleViolationsWithViolator(RuleViolations, Violator); + + FAssetData AssetData; + if (UniqueViolatorViolations.Num() > 0) { + UniqueViolatorViolations[0].PopulateAssetData(); + AssetData = UniqueViolatorViolations[0].ViolatorAssetData; + AssetJsonObject->SetStringField(TEXT("ViolatorAssetName"), AssetData.AssetName.ToString()); #if UE_VERSION_NEWER_THAN(5, 1, 0) - AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.GetObjectPathString()); + AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.GetObjectPathString()); #else - AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.ObjectPath.ToString()); + AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.ObjectPath.ToString()); #endif - AssetJsonObject->SetStringField(TEXT("ViolatorFullName"), AssetData.GetFullName()); - //@TODO: Thumbnail export? - - TArray> RuleViolationJsonObjects; - - for (const FLintRuleViolation& Violation : UniqueViolatorViolations) - { - ULintRule* LintRule = Violation.ViolatedRule->GetDefaultObject(); - check(LintRule != nullptr); - - TSharedPtr RuleJsonObject = MakeShareable(new FJsonObject); - RuleJsonObject->SetStringField(TEXT("RuleGroup"), LintRule->RuleGroup.ToString()); - RuleJsonObject->SetStringField(TEXT("RuleTitle"), LintRule->RuleTitle.ToString()); - RuleJsonObject->SetStringField(TEXT("RuleDesc"), LintRule->RuleDescription.ToString()); - RuleJsonObject->SetStringField(TEXT("RuleURL"), LintRule->RuleURL); - RuleJsonObject->SetNumberField(TEXT("RuleSeverity"), (int32)LintRule->RuleSeverity); - RuleJsonObject->SetStringField(TEXT("RuleRecommendedAction"), Violation.RecommendedAction.ToString()); - RuleViolationJsonObjects.Push(MakeShareable(new FJsonValueObject(RuleJsonObject))); - } - - AssetJsonObject->SetArrayField(TEXT("Violations"), RuleViolationJsonObjects); - } - - ViolatorJsonObjects.Add(MakeShareable(new FJsonValueObject(AssetJsonObject))); - - } - - // Save off our JSON to a string - RootJsonObject->SetArrayField(TEXT("Violators"), ViolatorJsonObjects); - FString JsonReport; - TSharedRef>> Writer = TJsonWriterFactory>::Create(&JsonReport); - FJsonSerializer::Serialize(RootJsonObject.ToSharedRef(), Writer); - - // write json file if requested - if (Switches.Contains(TEXT("json")) || ParamsMap.Contains(FString(TEXT("json")))) - { - FDateTime Now = FDateTime::Now(); - FString JsonOutputName = TEXT("lint-report-") + Now.ToString() + TEXT(".json"); - - const FString LintReportPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); - FString FullOutputPath = LintReportPath / JsonOutputName; - - if (ParamsMap.Contains(FString(TEXT("json")))) - { - const FString JsonOutputOverride = *ParamsMap.FindChecked(FString(TEXT("json"))); - if (FPaths::IsRelative(JsonOutputOverride)) - { - JsonOutputName = JsonOutputOverride; - FullOutputPath = LintReportPath / JsonOutputName; - } - else - { - FullOutputPath = JsonOutputOverride; - } - } - - FullOutputPath = FPaths::ConvertRelativePathToFull(FullOutputPath); - IFileManager::Get().MakeDirectory(*FPaths::GetPath(FullOutputPath), true); - - UE_LOG(LinterCommandlet, Display, TEXT("Exporting JSON report to %s"), *FullOutputPath); - if (FFileHelper::SaveStringToFile(JsonReport, *FullOutputPath)) - { - UE_LOG(LinterCommandlet, Display, TEXT("Exported JSON report successfully.")); - } - else - { - UE_LOG(LinterCommandlet, Error, TEXT("Failed to export JSON report. Aborting. Returning error code 1.")); - return 1; - } - } - - // write HTML report if requested - if (Switches.Contains(TEXT("html")) || ParamsMap.Contains(FString(TEXT("html")))) - { - FDateTime Now = FDateTime::Now(); - FString HtmlOutputName = TEXT("lint-report-") + Now.ToString() + TEXT(".html"); - - const FString LintReportPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); - FString FullOutputPath = LintReportPath / HtmlOutputName; - - if (ParamsMap.Contains(FString(TEXT("html")))) - { - const FString HtmlOutputOverride = *ParamsMap.FindChecked(TEXT("html")); - if (FPaths::IsRelative(HtmlOutputName)) - { - HtmlOutputName = HtmlOutputOverride; - FullOutputPath = LintReportPath / HtmlOutputName; - } - else - { - FullOutputPath = HtmlOutputOverride; - } - } - - FullOutputPath = FPaths::ConvertRelativePathToFull(FullOutputPath); - IFileManager::Get().MakeDirectory(*FPaths::GetPath(FullOutputPath), true); - UE_LOG(LinterCommandlet, Display, TEXT("Exporting HTML report to %s"), *FullOutputPath); - - FString TemplatePath = FPaths::Combine(*IPluginManager::Get().FindPlugin(TEXT("Linter"))->GetBaseDir(), TEXT("Resources"), TEXT("LintReportTemplate.html")); - UE_LOG(LinterCommandlet, Display, TEXT("Loading HTML report template from %s"), *TemplatePath); - - FString HTMLReport; - if (FFileHelper::LoadFileToString(HTMLReport, *TemplatePath)) - { - UE_LOG(LinterCommandlet, Display, TEXT("Loading HTML report template successfully.")); - - HTMLReport.ReplaceInline(TEXT("{% TITLE %}"), *FPaths::GetBaseFilename(FPaths::GetProjectFilePath())); - HTMLReport.ReplaceInline(TEXT("{% RESULTS %}"), *ResultsString); - HTMLReport.ReplaceInline(TEXT("{% LINT_REPORT %}"), *JsonReport); - } - else - { - UE_LOG(LinterCommandlet, Error, TEXT("Failed to load HTML report template.")); - return 1; - } - - if (FFileHelper::SaveStringToFile(HTMLReport, *FullOutputPath)) - { - UE_LOG(LinterCommandlet, Display, TEXT("Exported HTML report successfully.")); - } - else - { - UE_LOG(LinterCommandlet, Error, TEXT("Failed to export HTML report. Aborting. Returning error code 1.")); - return 1; - } - } - } - - if (NumErrors > 0 || (Switches.Contains(TEXT("TreatWarningsAsErrors")) && NumWarnings > 0)) - { - UE_LOG(LinterCommandlet, Display, TEXT("Lint completed with errors. Returning error code 2.")); - return 2; - } - - return 0; + AssetJsonObject->SetStringField(TEXT("ViolatorFullName"), AssetData.GetFullName()); + //@TODO: Thumbnail export? + + TArray> RuleViolationJsonObjects; + + for (const FLintRuleViolation& Violation : UniqueViolatorViolations) { + ULintRule* LintRule = Violation.ViolatedRule->GetDefaultObject(); + check(LintRule != nullptr); + + TSharedPtr RuleJsonObject = MakeShareable(new FJsonObject); + RuleJsonObject->SetStringField(TEXT("RuleGroup"), LintRule->RuleGroup.ToString()); + RuleJsonObject->SetStringField(TEXT("RuleTitle"), LintRule->RuleTitle.ToString()); + RuleJsonObject->SetStringField(TEXT("RuleDesc"), LintRule->RuleDescription.ToString()); + RuleJsonObject->SetStringField(TEXT("RuleURL"), LintRule->RuleURL); + RuleJsonObject->SetNumberField(TEXT("RuleSeverity"), static_cast(LintRule->RuleSeverity)); + RuleJsonObject->SetStringField(TEXT("RuleRecommendedAction"), Violation.RecommendedAction.ToString()); + RuleViolationJsonObjects.Push(MakeShareable(new FJsonValueObject(RuleJsonObject))); + } + + AssetJsonObject->SetArrayField(TEXT("Violations"), RuleViolationJsonObjects); + } + + ViolatorJsonObjects.Add(MakeShareable(new FJsonValueObject(AssetJsonObject))); + } + + // Save off our JSON to a string + RootJsonObject->SetArrayField(TEXT("Violators"), ViolatorJsonObjects); + FString JsonReport; + TSharedRef>> Writer = TJsonWriterFactory>::Create(&JsonReport); + FJsonSerializer::Serialize(RootJsonObject.ToSharedRef(), Writer); + + // write json file if requested + if (Switches.Contains(TEXT("json")) || ParamsMap.Contains(FString(TEXT("json")))) { + FDateTime Now = FDateTime::Now(); + FString JsonOutputName = TEXT("lint-report-") + Now.ToString() + TEXT(".json"); + + const FString LintReportPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); + FString FullOutputPath = LintReportPath / JsonOutputName; + + if (ParamsMap.Contains(FString(TEXT("json")))) { + const FString JsonOutputOverride = *ParamsMap.FindChecked(FString(TEXT("json"))); + if (FPaths::IsRelative(JsonOutputOverride)) { + JsonOutputName = JsonOutputOverride; + FullOutputPath = LintReportPath / JsonOutputName; + } else { + FullOutputPath = JsonOutputOverride; + } + } + + FullOutputPath = FPaths::ConvertRelativePathToFull(FullOutputPath); + IFileManager::Get().MakeDirectory(*FPaths::GetPath(FullOutputPath), true); + + UE_LOG(LinterCommandlet, Display, TEXT("Exporting JSON report to %s"), *FullOutputPath); + if (FFileHelper::SaveStringToFile(JsonReport, *FullOutputPath)) { + UE_LOG(LinterCommandlet, Display, TEXT("Exported JSON report successfully.")); + } else { + UE_LOG(LinterCommandlet, Error, TEXT("Failed to export JSON report. Aborting. Returning error code 1.")); + return 1; + } + } + + // write HTML report if requested + if (Switches.Contains(TEXT("html")) || ParamsMap.Contains(FString(TEXT("html")))) { + FDateTime Now = FDateTime::Now(); + FString HtmlOutputName = TEXT("lint-report-") + Now.ToString() + TEXT(".html"); + + const FString LintReportPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); + FString FullOutputPath = LintReportPath / HtmlOutputName; + + if (ParamsMap.Contains(FString(TEXT("html")))) { + const FString HtmlOutputOverride = *ParamsMap.FindChecked(TEXT("html")); + if (FPaths::IsRelative(HtmlOutputName)) { + HtmlOutputName = HtmlOutputOverride; + FullOutputPath = LintReportPath / HtmlOutputName; + } else { + FullOutputPath = HtmlOutputOverride; + } + } + + FullOutputPath = FPaths::ConvertRelativePathToFull(FullOutputPath); + IFileManager::Get().MakeDirectory(*FPaths::GetPath(FullOutputPath), true); + UE_LOG(LinterCommandlet, Display, TEXT("Exporting HTML report to %s"), *FullOutputPath); + + FString TemplatePath = FPaths::Combine(*IPluginManager::Get().FindPlugin(TEXT("Linter"))->GetBaseDir(), TEXT("Resources"), TEXT("LintReportTemplate.html")); + UE_LOG(LinterCommandlet, Display, TEXT("Loading HTML report template from %s"), *TemplatePath); + + FString HTMLReport; + if (FFileHelper::LoadFileToString(HTMLReport, *TemplatePath)) { + UE_LOG(LinterCommandlet, Display, TEXT("Loading HTML report template successfully.")); + + HTMLReport.ReplaceInline(TEXT("{% TITLE %}"), *FPaths::GetBaseFilename(FPaths::GetProjectFilePath())); + HTMLReport.ReplaceInline(TEXT("{% RESULTS %}"), *ResultsString); + HTMLReport.ReplaceInline(TEXT("{% LINT_REPORT %}"), *JsonReport); + } else { + UE_LOG(LinterCommandlet, Error, TEXT("Failed to load HTML report template.")); + return 1; + } + + if (FFileHelper::SaveStringToFile(HTMLReport, *FullOutputPath)) { + UE_LOG(LinterCommandlet, Display, TEXT("Exported HTML report successfully.")); + } else { + UE_LOG(LinterCommandlet, Error, TEXT("Failed to export HTML report. Aborting. Returning error code 1.")); + return 1; + } + } + } + + if (NumErrors > 0 || (Switches.Contains(TEXT("TreatWarningsAsErrors")) && NumWarnings > 0)) { + UE_LOG(LinterCommandlet, Display, TEXT("Lint completed with errors. Returning error code 2.")); + return 2; + } + + return 0; } diff --git a/Source/Linter/Private/LinterContentBrowserExtensions.cpp b/Source/Linter/Private/LinterContentBrowserExtensions.cpp index 96c4d45..a743d5e 100644 --- a/Source/Linter/Private/LinterContentBrowserExtensions.cpp +++ b/Source/Linter/Private/LinterContentBrowserExtensions.cpp @@ -2,7 +2,6 @@ #include "LinterContentBrowserExtensions.h" #include "Modules/ModuleManager.h" -#include "LevelEditor.h" #include "Framework/MultiBox/MultiBoxBuilder.h" #include "LinterStyle.h" #include "ContentBrowserModule.h" @@ -12,186 +11,168 @@ #include "Framework/Commands/UIAction.h" #include "Delegates/IDelegateInstance.h" #include "TooltipEditor/TooltipTool.h" -#include "Linter.h" -#include "BatchRenameTool/BatchRenameTool.h" #include "Misc/EngineVersionComparison.h" #define LOCTEXT_NAMESPACE "Linter" DEFINE_LOG_CATEGORY_STATIC(LinterContentBrowserExtensions, Log, All); -void FLinterContentBrowserExtensions::InstallHooks(FLinterModule* LinterModule, FDelegateHandle* pContentBrowserExtenderDelegateHandle, class FDelegateHandle* pAssetExtenderDelegateHandle) -{ - struct Local - { - // Path extensions - - static TSharedRef OnExtendContentBrowserAssetSelectionMenu(const TArray& SelectedPaths) - { - TSharedRef Extender = MakeShared(); - Extender->AddMenuExtension( - "PathContextSourceControl", - EExtensionHook::After, - TSharedPtr(), - FMenuExtensionDelegate::CreateStatic(&Local::ContentBrowserExtenderFunc, SelectedPaths) - ); - return Extender; - } - - static void ContentBrowserExtenderFunc(FMenuBuilder& MenuBuilder, const TArray SelectedPaths) - { - MenuBuilder.BeginSection("LinterContentBrowserContext", LOCTEXT("CB_LinterHeader", "Linter")); - { - MenuBuilder.AddMenuEntry( - LOCTEXT("CB_ScanProjectWithLinter", "Scan with Linter"), - LOCTEXT("CB_ScanProjectWithLinter_Tooltip", "Scan project content with Linter"), - FSlateIcon(FLinterStyle::GetStyleSetName(), "Linter.Toolbar.Icon"), - FUIAction(FExecuteAction::CreateLambda([SelectedPaths]() - { - if (FLinterModule* Linter = FModuleManager::GetModulePtr("Linter")) - { - if (Linter != nullptr) - { - Linter->SetDesiredLintPaths(SelectedPaths); - } +void FLinterContentBrowserExtensions::InstallHooks(FLinterModule* LinterModule, FDelegateHandle* pContentBrowserExtenderDelegateHandle, class FDelegateHandle* pAssetExtenderDelegateHandle) { + struct Local { + // Path extensions + + static TSharedRef OnExtendContentBrowserAssetSelectionMenu(const TArray& SelectedPaths) { + TSharedRef Extender = MakeShared(); + Extender->AddMenuExtension( + "PathContextSourceControl", + EExtensionHook::After, + TSharedPtr(), + FMenuExtensionDelegate::CreateStatic(&Local::ContentBrowserExtenderFunc, SelectedPaths) + ); + return Extender; + } + + static void ContentBrowserExtenderFunc(FMenuBuilder& MenuBuilder, const TArray SelectedPaths) { + MenuBuilder.BeginSection("LinterContentBrowserContext", LOCTEXT("CB_LinterHeader", "Linter")); + { + MenuBuilder.AddMenuEntry( + LOCTEXT("CB_ScanProjectWithLinter", "Scan with Linter"), + LOCTEXT("CB_ScanProjectWithLinter_Tooltip", "Scan project content with Linter"), + FSlateIcon(FLinterStyle::GetStyleSetName(), "Linter.Toolbar.Icon"), + FUIAction(FExecuteAction::CreateLambda([SelectedPaths]() { + if (FLinterModule* Linter = FModuleManager::GetModulePtr("Linter")) { + if (Linter != nullptr) { + Linter->SetDesiredLintPaths(SelectedPaths); + } #if UE_VERSION_NEWER_THAN(4, 26, 0) - FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab")); + FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab")); #else FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab")); #endif - } - })), - NAME_None, - EUserInterfaceActionType::Button); - } - MenuBuilder.EndSection(); - } - - // Asset extensions - - static TSharedRef OnExtendAssetSelectionMenu(const TArray& SelectedAssets) - { - TSharedRef Extender = MakeShared(); - Extender->AddMenuExtension( - "CommonAssetActions", - EExtensionHook::After, - nullptr, - FMenuExtensionDelegate::CreateStatic(&Local::AssetExtenderFunc, SelectedAssets) - ); - return Extender; - } - - static void AssetExtenderFunc(FMenuBuilder& MenuBuilder, const TArray SelectedAssets) - { - MenuBuilder.BeginSection("LinterAssetContext", LOCTEXT("CB_LinterHeader", "Linter")); - { - - // Run through the assets to determine if any are blueprints - bool bAnyBlueprintsSelected = false; - for (auto AssetIt = SelectedAssets.CreateConstIterator(); AssetIt; ++AssetIt) - { - const FAssetData& Asset = *AssetIt; - // Cannot rename redirectors or classes or cooked packages + } + })), + NAME_None, + EUserInterfaceActionType::Button); + } + MenuBuilder.EndSection(); + } + + // Asset extensions + + static TSharedRef OnExtendAssetSelectionMenu(const TArray& SelectedAssets) { + TSharedRef Extender = MakeShared(); + Extender->AddMenuExtension( + "CommonAssetActions", + EExtensionHook::After, + nullptr, + FMenuExtensionDelegate::CreateStatic(&Local::AssetExtenderFunc, SelectedAssets) + ); + return Extender; + } + + static void AssetExtenderFunc(FMenuBuilder& MenuBuilder, const TArray SelectedAssets) { + MenuBuilder.BeginSection("LinterAssetContext", LOCTEXT("CB_LinterHeader", "Linter")); + { + // Run through the assets to determine if any are blueprints + bool bAnyBlueprintsSelected = false; + for (auto AssetIt = SelectedAssets.CreateConstIterator(); AssetIt; ++AssetIt) { + const FAssetData& Asset = *AssetIt; + // Cannot rename redirectors or classes or cooked packages #if UE_VERSION_NEWER_THAN(5, 1, 0) - if (!Asset.IsRedirector() && Asset.AssetClassPath.GetAssetName() != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) + if (!Asset.IsRedirector() && Asset.AssetClassPath.GetAssetName() != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) #else - if (!Asset.IsRedirector() && Asset.AssetClass != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) + if (!Asset.IsRedirector() && Asset.AssetClass != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) #endif - { - if (Asset.GetClass()->IsChildOf(UBlueprint::StaticClass())) - { - bAnyBlueprintsSelected = true; - break; - } - } - } - - // If we have blueprints selected, enable blueprint tools - if (bAnyBlueprintsSelected) - { - // Add Tooltip Editor - MenuBuilder.AddMenuEntry( - LOCTEXT("CB_EditBlueprintTooltips", "Edit Blueprint Tooltips (Experimental)"), - LOCTEXT("CB_EditBlueprintTooltips_Tooltip", "Edit selected blueprints' templates definitions"), - FSlateIcon(FLinterStyle::GetStyleSetName(), "Linter.Toolbar.Icon"), - FUIAction(FExecuteAction::CreateLambda([SelectedAssets]() - { - UE_LOG(LinterContentBrowserExtensions, Display, TEXT("Opening Tooltip Tool window.")); - FTooltipTool AssetDlg(SelectedAssets); - if (AssetDlg.ShowModal() == FTooltipTool::Confirm) - { - UE_LOG(LinterContentBrowserExtensions, Display, TEXT("Tooltip Tool did the thing.")); - } - })), - NAME_None, - EUserInterfaceActionType::Button); - } - - // Run through the assets to see if any can be renamed - bool bAnyAssetCanBeRenamed = false; - for (auto AssetIt = SelectedAssets.CreateConstIterator(); AssetIt; ++AssetIt) - { - const FAssetData& Asset = *AssetIt; - // Cannot rename redirectors or classes or cooked packages + { + if (Asset.GetClass()->IsChildOf(UBlueprint::StaticClass())) { + bAnyBlueprintsSelected = true; + break; + } + } + } + + // If we have blueprints selected, enable blueprint tools + if (bAnyBlueprintsSelected) { + // Add Tooltip Editor + MenuBuilder.AddMenuEntry( + LOCTEXT("CB_EditBlueprintTooltips", "Edit Blueprint Tooltips (Experimental)"), + LOCTEXT("CB_EditBlueprintTooltips_Tooltip", "Edit selected blueprints' templates definitions"), + FSlateIcon(FLinterStyle::GetStyleSetName(), "Linter.Toolbar.Icon"), + FUIAction(FExecuteAction::CreateLambda([SelectedAssets]() { + UE_LOG(LinterContentBrowserExtensions, Display, TEXT("Opening Tooltip Tool window.")); + FTooltipTool AssetDlg(SelectedAssets); + if (AssetDlg.ShowModal() == FTooltipTool::Confirm) { + UE_LOG(LinterContentBrowserExtensions, Display, TEXT("Tooltip Tool did the thing.")); + } + })), + NAME_None, + EUserInterfaceActionType::Button); + } + + // Run through the assets to see if any can be renamed + bool bAnyAssetCanBeRenamed = false; + for (auto AssetIt = SelectedAssets.CreateConstIterator(); AssetIt; ++AssetIt) { + const FAssetData& Asset = *AssetIt; + // Cannot rename redirectors or classes or cooked packages #if UE_VERSION_NEWER_THAN(5, 1, 0) - if (!Asset.IsRedirector() && Asset.AssetClassPath.GetAssetName() != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) + if (!Asset.IsRedirector() && Asset.AssetClassPath.GetAssetName() != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) #else - if (!Asset.IsRedirector() && Asset.AssetClass != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) + if (!Asset.IsRedirector() && Asset.AssetClass != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) #endif - { - bAnyAssetCanBeRenamed = true; - break; - } - } - - if (bAnyAssetCanBeRenamed) - { - // Add Tooltip Editor - MenuBuilder.AddMenuEntry( - LOCTEXT("CB_BatchRenameAssets", "Batch Rename Assets (Experimental)"), - LOCTEXT("CB_BatchRenameAssets_Tooltip", "Perform a bulk rename operation on all of the selected assets"), - FSlateIcon(FLinterStyle::GetStyleSetName(), "Linter.Toolbar.Icon"), - FUIAction(FExecuteAction::CreateLambda([SelectedAssets]() - { - UE_LOG(LinterContentBrowserExtensions, Display, TEXT("Starting batch rename.")); - FDlgBatchRenameTool AssetDlg(SelectedAssets); - AssetDlg.ShowModal(); - })), - NAME_None, - EUserInterfaceActionType::Button); - } - } - MenuBuilder.EndSection(); - } - }; - - FContentBrowserModule& ContentBrowserModule = FModuleManager::LoadModuleChecked(TEXT("ContentBrowser")); - - // Path view extenders - TArray& CBMenuPathExtenderDelegates = ContentBrowserModule.GetAllPathViewContextMenuExtenders(); - CBMenuPathExtenderDelegates.Add(FContentBrowserMenuExtender_SelectedPaths::CreateStatic(&Local::OnExtendContentBrowserAssetSelectionMenu)); - *pContentBrowserExtenderDelegateHandle = CBMenuPathExtenderDelegates.Last().GetHandle(); - - // Asset extenders - TArray& CBMenuAssetExtenderDelegates = ContentBrowserModule.GetAllAssetViewContextMenuExtenders(); - CBMenuAssetExtenderDelegates.Add(FContentBrowserMenuExtender_SelectedAssets::CreateStatic(&Local::OnExtendAssetSelectionMenu)); - *pAssetExtenderDelegateHandle = CBMenuAssetExtenderDelegates.Last().GetHandle(); + { + bAnyAssetCanBeRenamed = true; + break; + } + } + + if (bAnyAssetCanBeRenamed) { + // Add Tooltip Editor + MenuBuilder.AddMenuEntry( + LOCTEXT("CB_BatchRenameAssets", "Batch Rename Assets (Experimental)"), + LOCTEXT("CB_BatchRenameAssets_Tooltip", "Perform a bulk rename operation on all of the selected assets"), + FSlateIcon(FLinterStyle::GetStyleSetName(), "Linter.Toolbar.Icon"), + FUIAction(FExecuteAction::CreateLambda([SelectedAssets]() { + UE_LOG(LinterContentBrowserExtensions, Display, TEXT("Starting batch rename.")); + FDlgBatchRenameTool AssetDlg(SelectedAssets); + AssetDlg.ShowModal(); + })), + NAME_None, + EUserInterfaceActionType::Button); + } + } + MenuBuilder.EndSection(); + } + }; + + FContentBrowserModule& ContentBrowserModule = FModuleManager::LoadModuleChecked(TEXT("ContentBrowser")); + + // Path view extenders + TArray& CBMenuPathExtenderDelegates = ContentBrowserModule.GetAllPathViewContextMenuExtenders(); + CBMenuPathExtenderDelegates.Add(FContentBrowserMenuExtender_SelectedPaths::CreateStatic(&Local::OnExtendContentBrowserAssetSelectionMenu)); + *pContentBrowserExtenderDelegateHandle = CBMenuPathExtenderDelegates.Last().GetHandle(); + + // Asset extenders + TArray& CBMenuAssetExtenderDelegates = ContentBrowserModule.GetAllAssetViewContextMenuExtenders(); + CBMenuAssetExtenderDelegates.Add(FContentBrowserMenuExtender_SelectedAssets::CreateStatic(&Local::OnExtendAssetSelectionMenu)); + *pAssetExtenderDelegateHandle = CBMenuAssetExtenderDelegates.Last().GetHandle(); } -void FLinterContentBrowserExtensions::RemoveHooks(FLinterModule* LinterModule, FDelegateHandle* pContentBrowserExtenderDelegateHandle, FDelegateHandle* pAssetExtenderDelegateHandle) -{ - if (FModuleManager::Get().IsModuleLoaded("ContentBrowser")) - { - FContentBrowserModule& ContentBrowserModule = FModuleManager::LoadModuleChecked(TEXT("ContentBrowser")); - - // Path view extenders - TArray& CBMenuExtenderDelegates = ContentBrowserModule.GetAllAssetContextMenuExtenders(); - CBMenuExtenderDelegates.RemoveAll([pContentBrowserExtenderDelegateHandle](const FContentBrowserMenuExtender_SelectedPaths & Delegate) { return Delegate.GetHandle() == *pContentBrowserExtenderDelegateHandle; }); - - // Asset extenders - TArray& CBMenuAssetExtenderDelegates = ContentBrowserModule.GetAllAssetViewContextMenuExtenders(); - CBMenuAssetExtenderDelegates.RemoveAll([pAssetExtenderDelegateHandle](const FContentBrowserMenuExtender_SelectedAssets & Delegate) { return Delegate.GetHandle() == *pAssetExtenderDelegateHandle; }); - } +void FLinterContentBrowserExtensions::RemoveHooks(FLinterModule* LinterModule, FDelegateHandle* pContentBrowserExtenderDelegateHandle, FDelegateHandle* pAssetExtenderDelegateHandle) { + if (FModuleManager::Get().IsModuleLoaded("ContentBrowser")) { + FContentBrowserModule& ContentBrowserModule = FModuleManager::LoadModuleChecked(TEXT("ContentBrowser")); + + // Path view extenders + TArray& CBMenuExtenderDelegates = ContentBrowserModule.GetAllAssetContextMenuExtenders(); + CBMenuExtenderDelegates.RemoveAll([pContentBrowserExtenderDelegateHandle](const FContentBrowserMenuExtender_SelectedPaths& Delegate) { + return Delegate.GetHandle() == *pContentBrowserExtenderDelegateHandle; + }); + + // Asset extenders + TArray& CBMenuAssetExtenderDelegates = ContentBrowserModule.GetAllAssetViewContextMenuExtenders(); + CBMenuAssetExtenderDelegates.RemoveAll([pAssetExtenderDelegateHandle](const FContentBrowserMenuExtender_SelectedAssets& Delegate) { + return Delegate.GetHandle() == *pAssetExtenderDelegateHandle; + }); + } } -#undef LOCTEXT_NAMESPACE \ No newline at end of file +#undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/LinterNamingConvention.cpp b/Source/Linter/Private/LinterNamingConvention.cpp index dd3f1ba..8f55014 100644 --- a/Source/Linter/Private/LinterNamingConvention.cpp +++ b/Source/Linter/Private/LinterNamingConvention.cpp @@ -6,163 +6,146 @@ #include "Templates/SharedPointer.h" #include "DetailCategoryBuilder.h" #include "IDetailChildrenBuilder.h" +#include "Misc/EngineVersionComparison.h" +#if UE_VERSION_NEWER_THAN(5, 0, 0) +#include "ObjectSaveContext.h" +#endif -TSharedRef FLinterNamingConventionDetails::MakeInstance() -{ - return MakeShareable(new FLinterNamingConventionDetails()); +TSharedRef FLinterNamingConventionDetails::MakeInstance() { + return MakeShareable(new FLinterNamingConventionDetails()); } -void FLinterNamingConventionDetails::CustomizeDetails(class IDetailLayoutBuilder& DetailBuilder) -{ - // Edit the Conventions category - IDetailCategoryBuilder& DetailCategory = DetailBuilder.EditCategory("Conventions"); - const TSharedRef NamingConventionsProperty = DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(ULinterNamingConvention, ClassNamingConventions), ULinterNamingConvention::StaticClass()); +void FLinterNamingConventionDetails::CustomizeDetails(class IDetailLayoutBuilder& DetailBuilder) { + // Edit the Conventions category + IDetailCategoryBuilder& DetailCategory = DetailBuilder.EditCategory("Conventions"); + const TSharedRef NamingConventionsProperty = DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(ULinterNamingConvention, ClassNamingConventions), ULinterNamingConvention::StaticClass()); - const TSharedRef ConventionsPropertyBuilder = MakeShareable(new FDetailArrayBuilder(NamingConventionsProperty)); - ConventionsPropertyBuilder->OnGenerateArrayElementWidget(FOnGenerateArrayElementWidget::CreateSP(this, &FLinterNamingConventionDetails::OnGenerateElementForDetails, &DetailBuilder)); + const TSharedRef ConventionsPropertyBuilder = MakeShareable(new FDetailArrayBuilder(NamingConventionsProperty)); + ConventionsPropertyBuilder->OnGenerateArrayElementWidget(FOnGenerateArrayElementWidget::CreateSP(this, &FLinterNamingConventionDetails::OnGenerateElementForDetails, &DetailBuilder)); - DetailCategory.AddCustomBuilder(ConventionsPropertyBuilder); + DetailCategory.AddCustomBuilder(ConventionsPropertyBuilder); } -void FLinterNamingConventionDetails::OnGenerateElementForDetails(const TSharedRef StructProperty, int32 ElementIndex, IDetailChildrenBuilder& ChildrenBuilder, IDetailLayoutBuilder* DetailLayout) -{ - const TSharedRef RemoveButton = PropertyCustomizationHelpers::MakeRemoveButton(FSimpleDelegate::CreateLambda([this, DetailLayout, ElementIndex] - { - const TSharedRef NamingConventionsProperty - = DetailLayout->GetProperty(GET_MEMBER_NAME_CHECKED(ULinterNamingConvention, ClassNamingConventions), ULinterNamingConvention::StaticClass()); - const TSharedPtr NamingConventionsPropertyHandle = NamingConventionsProperty->AsArray(); - NamingConventionsPropertyHandle->DeleteItem(ElementIndex); - } - )); - - ChildrenBuilder.AddCustomRow(FText::GetEmpty()) - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - [ - RemoveButton - ] - + SHorizontalBox::Slot() - .FillWidth(1.0f) - [ - SNew(SProperty, StructProperty->GetChildHandle("SoftClassPtr")) - .ShouldDisplayName(false) - ] - + SHorizontalBox::Slot() - .FillWidth(0.25f) - [ - SNew(SProperty, StructProperty->GetChildHandle("Variant")) - ] - + SHorizontalBox::Slot() - .FillWidth(0.25f) - [ - SNew(SProperty, StructProperty->GetChildHandle("Prefix")) - ] - + SHorizontalBox::Slot() - .FillWidth(0.25f) - [ - SNew(SProperty, StructProperty->GetChildHandle("Suffix")) - ] - ]; +void FLinterNamingConventionDetails::OnGenerateElementForDetails(const TSharedRef StructProperty, int32 ElementIndex, IDetailChildrenBuilder& ChildrenBuilder, IDetailLayoutBuilder* DetailLayout) { + const TSharedRef RemoveButton = PropertyCustomizationHelpers::MakeRemoveButton(FSimpleDelegate::CreateLambda([this, DetailLayout, ElementIndex] { + const TSharedRef NamingConventionsProperty + = DetailLayout->GetProperty(GET_MEMBER_NAME_CHECKED(ULinterNamingConvention, ClassNamingConventions), ULinterNamingConvention::StaticClass()); + const TSharedPtr NamingConventionsPropertyHandle = NamingConventionsProperty->AsArray(); + NamingConventionsPropertyHandle->DeleteItem(ElementIndex); + } + )); + + ChildrenBuilder.AddCustomRow(FText::GetEmpty()) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + [ + RemoveButton + ] + + SHorizontalBox::Slot() + .FillWidth(1.0f) + [ + SNew(SProperty, StructProperty->GetChildHandle("SoftClassPtr")) + .ShouldDisplayName(false) + ] + + SHorizontalBox::Slot() + .FillWidth(0.25f) + [ + SNew(SProperty, StructProperty->GetChildHandle("Variant")) + ] + + SHorizontalBox::Slot() + .FillWidth(0.25f) + [ + SNew(SProperty, StructProperty->GetChildHandle("Prefix")) + ] + + SHorizontalBox::Slot() + .FillWidth(0.25f) + [ + SNew(SProperty, StructProperty->GetChildHandle("Suffix")) + ] + ]; } -ULinterNamingConvention::ULinterNamingConvention(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ - ClassNamingConventions = TArray(); +ULinterNamingConvention::ULinterNamingConvention(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) { + ClassNamingConventions = TArray(); } -TArray ULinterNamingConvention::GetNamingConventionsForClassVariant(const TSoftClassPtr Class, FName Variant /*= NAME_None*/) const -{ - TArray NamingConventionList; - - UClass* SearchClass = Class.Get(); - while (NamingConventionList.Num() == 0 && SearchClass != nullptr) - { - NamingConventionList = ClassNamingConventions.FilterByPredicate([SearchClass, Variant](const FLinterNamingConventionInfo& Info) - { - return (Info.SoftClassPtr.Get() == SearchClass && Info.Variant == Variant); - }); - - // Abort if we try to go above UObject - if (SearchClass == UObject::StaticClass()) - { - break; - } - - // @HACK: Editor UI won't allow us to select the UObject class in some cases - if (SearchClass == UAnyObject_LinterDummyClass::StaticClass()) - { - SearchClass = UObject::StaticClass(); - continue; - } - - // Load our parent class in case we failed to get naming conventions - SearchClass = SearchClass->GetSuperClass(); - } - - return NamingConventionList; +TArray ULinterNamingConvention::GetNamingConventionsForClassVariant(const TSoftClassPtr Class, FName Variant /*= NAME_None*/) const { + TArray NamingConventionList; + + UClass* SearchClass = Class.Get(); + while (NamingConventionList.Num() == 0 && SearchClass != nullptr) { + NamingConventionList = ClassNamingConventions.FilterByPredicate([SearchClass, Variant](const FLinterNamingConventionInfo& Info) { + return (Info.SoftClassPtr.Get() == SearchClass && Info.Variant == Variant); + }); + + // Abort if we try to go above UObject + if (SearchClass == UObject::StaticClass()) { + break; + } + + // @HACK: Editor UI won't allow us to select the UObject class in some cases + if (SearchClass == UAnyObject_LinterDummyClass::StaticClass()) { + SearchClass = UObject::StaticClass(); + continue; + } + + // Load our parent class in case we failed to get naming conventions + SearchClass = SearchClass->GetSuperClass(); + } + + return NamingConventionList; } -void ULinterNamingConvention::SortConventions() -{ - ClassNamingConventions.Sort([](const FLinterNamingConventionInfo& A, const FLinterNamingConventionInfo& B) - { - if (A.SoftClassPtr.GetAssetName() < B.SoftClassPtr.GetAssetName()) - { - return true; - } - - if (A.SoftClassPtr.GetAssetName() == B.SoftClassPtr.GetAssetName()) - { - int32 Sort = A.Variant.Compare(B.Variant); - if (Sort < 0) - { - return true; - } - - if (Sort == 0) - { - Sort = A.Prefix.Compare(B.Prefix); - if (Sort < 0) - { - return true; - } - - if (Sort == 0) - { - Sort = A.Suffix.Compare(B.Suffix); - if (Sort <= 0) - { - return true; - } - return false; - } - - return false; - } - - return false; - } - - return false; - }); +void ULinterNamingConvention::SortConventions() { + ClassNamingConventions.Sort([](const FLinterNamingConventionInfo& A, const FLinterNamingConventionInfo& B) { + if (A.SoftClassPtr.GetAssetName() < B.SoftClassPtr.GetAssetName()) { + return true; + } + + if (A.SoftClassPtr.GetAssetName() == B.SoftClassPtr.GetAssetName()) { + int32 Sort = A.Variant.Compare(B.Variant); + if (Sort < 0) { + return true; + } + + if (Sort == 0) { + Sort = A.Prefix.Compare(B.Prefix); + if (Sort < 0) { + return true; + } + + if (Sort == 0) { + Sort = A.Suffix.Compare(B.Suffix); + if (Sort <= 0) { + return true; + } + return false; + } + + return false; + } + + return false; + } + + return false; + }); } #if UE_VERSION_NEWER_THAN(5, 0, 0) -void ULinterNamingConvention::PreSave(FObjectPreSaveContext ObjectSaveContext) -{ - Super::PreSave(ObjectSaveContext); +void ULinterNamingConvention::PreSave(FObjectPreSaveContext ObjectSaveContext) { + Super::PreSave(ObjectSaveContext); - SortConventions(); + SortConventions(); } #else -void ULinterNamingConvention::PreSave(const class ITargetPlatform* TargetPlatform) -{ - Super::PreSave(TargetPlatform); +void ULinterNamingConvention::PreSave(const class ITargetPlatform* TargetPlatform) { + Super::PreSave(TargetPlatform); - SortConventions(); + SortConventions(); } #endif diff --git a/Source/Linter/Private/LinterSettings.cpp b/Source/Linter/Private/LinterSettings.cpp index 86939aa..c32e19c 100644 --- a/Source/Linter/Private/LinterSettings.cpp +++ b/Source/Linter/Private/LinterSettings.cpp @@ -5,12 +5,10 @@ #include "LintRuleSet.h" -ULinterSettings::ULinterSettings(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ - if (DefaultLintRuleSet.IsNull()) - { - static ConstructorHelpers::FObjectFinder DefaultMarketplaceRuleSetRef(TEXT("LintRuleSet'/Linter/MarketplaceLinter/MarketplaceLintRuleSet.MarketplaceLintRuleSet'")); - DefaultLintRuleSet = DefaultMarketplaceRuleSetRef.Object; - } -} \ No newline at end of file +ULinterSettings::ULinterSettings(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) { + if (DefaultLintRuleSet.IsNull()) { + static ConstructorHelpers::FObjectFinder DefaultMarketplaceRuleSetRef(TEXT("LintRuleSet'/Linter/MarketplaceLinter/MarketplaceLintRuleSet.MarketplaceLintRuleSet'")); + DefaultLintRuleSet = DefaultMarketplaceRuleSetRef.Object; + } +} diff --git a/Source/Linter/Private/LinterStyle.cpp b/Source/Linter/Private/LinterStyle.cpp index 80ee20e..fe996ed 100644 --- a/Source/Linter/Private/LinterStyle.cpp +++ b/Source/Linter/Private/LinterStyle.cpp @@ -5,7 +5,11 @@ #include "Styling/SlateStyle.h" #include "Interfaces/IPluginManager.h" #include "Styling/SlateStyleRegistry.h" -#include "EditorStyleSet.h" +#include "Misc/EngineVersionComparison.h" + +#if UE_VERSION_OLDER_THAN(5, 1, 0) +using FAppStyle = FEditorStyle; +#endif #define IMAGE_PLUGIN_BRUSH( RelativePath, ... ) FSlateImageBrush( FLinterStyle::InContent( RelativePath, ".png" ), __VA_ARGS__ ) #define IMAGE_BRUSH(RelativePath, ...) FSlateImageBrush(StyleSet->RootToContentDir(RelativePath, TEXT(".png")), __VA_ARGS__) @@ -13,99 +17,98 @@ #define TTF_FONT(RelativePath, ...) FSlateFontInfo(StyleSet->RootToContentDir(RelativePath, TEXT(".ttf")), __VA_ARGS__) #define TTF_CORE_FONT(RelativePath, ...) FSlateFontInfo(StyleSet->RootToCoreContentDir(RelativePath, TEXT(".ttf") ), __VA_ARGS__) -FString FLinterStyle::InContent(const FString& RelativePath, const ANSICHAR* Extension) -{ - static FString ContentDir = IPluginManager::Get().FindPlugin(TEXT("Linter"))->GetContentDir(); - return (ContentDir / RelativePath) + Extension; +FString FLinterStyle::InContent(const FString& RelativePath, const ANSICHAR* Extension) { + static FString ContentDir = IPluginManager::Get().FindPlugin(TEXT("Linter"))->GetContentDir(); + return (ContentDir / RelativePath) + Extension; } -TSharedPtr< FSlateStyleSet > FLinterStyle::StyleSet = nullptr; -TSharedPtr< class ISlateStyle > FLinterStyle::Get() { return StyleSet; } +TSharedPtr FLinterStyle::StyleSet = nullptr; + +TSharedPtr FLinterStyle::Get() { + return StyleSet; +} -FName FLinterStyle::GetStyleSetName() -{ - static FName LinterStyleName(TEXT("LinterStyle")); - return LinterStyleName; +FName FLinterStyle::GetStyleSetName() { + static FName LinterStyleName(TEXT("LinterStyle")); + return LinterStyleName; } -void FLinterStyle::Initialize() -{ - // Const icon sizes - const FVector2D Icon8x8(8.0f, 8.0f); - const FVector2D Icon14x14(14.0f, 14.0f); - const FVector2D Icon16x16(16.0f, 16.0f); - const FVector2D Icon20x20(20.0f, 20.0f); - const FVector2D Icon40x40(40.0f, 40.0f); - const FVector2D Icon64x64(64.0f, 64.0f); - const FVector2D Icon128x128(128.0f, 128.0f); - - // Only register once - if (StyleSet.IsValid()) - { - return; - } - - StyleSet = MakeShareable(new FSlateStyleSet(GetStyleSetName())); - StyleSet->SetContentRoot(FPaths::EngineContentDir() / TEXT("Editor/Slate")); - StyleSet->SetCoreContentRoot(FPaths::EngineContentDir() / TEXT("Slate")); - - // Asset actions - { - StyleSet->Set("AssetActions.RunLinter", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_Texture_Run_16x"), Icon16x16)); - StyleSet->Set("AssetActions.BatchRename", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_Texture_Run_16x"), Icon16x16)); - StyleSet->Set("AssetActions.TooltipTool", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_Texture_Run_16x"), Icon16x16)); - - // Toolbar Button Icons - StyleSet->Set("Linter.Toolbar.Icon", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_Texture_Run_16x"), Icon16x16)); - - // Report Images - StyleSet->Set("Linter.Step.Unknown", new IMAGE_PLUGIN_BRUSH("Icons/CompileStatus_Unknown_64px", Icon64x64)); - StyleSet->Set("Linter.Step.Error", new IMAGE_PLUGIN_BRUSH("Icons/CompileStatus_Fail_64px", Icon64x64)); - StyleSet->Set("Linter.Step.Good", new IMAGE_PLUGIN_BRUSH("Icons/CompileStatus_Good_64px", Icon64x64)); - StyleSet->Set("Linter.Step.Working", new IMAGE_PLUGIN_BRUSH("Icons/CompileStatus_Working_64px", Icon64x64)); - StyleSet->Set("Linter.Step.Warning", new IMAGE_PLUGIN_BRUSH("Icons/CompileStatus_Warning_64px", Icon64x64)); - - StyleSet->Set("Linter.Report.Link", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_Help_Documentation_16x"), Icon16x16)); - StyleSet->Set("Linter.Report.Warning", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_MessageLog_Warning_14x"), Icon14x14)); - StyleSet->Set("Linter.Report.Error", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_MessageLog_Error_14x"), Icon14x14)); - - StyleSet->Set("Linter.Report.Info", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_MessageLog_Info_14x"), Icon20x20)); - - - StyleSet->Set("Linter.Step.BuildLighting.Thumbnail", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_MapCheck_64x"), Icon64x64)); - StyleSet->Set("Linter.Step.Package.Thumbnail", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_AddContent_64x"), Icon64x64)); - StyleSet->Set("Linter.Step.SaveAll.Thumbnail", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_file_saveall_64x"), Icon64x64)); - StyleSet->Set("Linter.Step.FixupRedirects.Thumbnail", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_tab_Toolbars_64x"), Icon64x64)); - - // PaCK Sizing - StyleSet->Set("Linter.Padding", 2.0f); - - // PaCK Fonts - const FTextBlockStyle NormalText = FAppStyle::GetWidgetStyle("NormalText"); - - FTextBlockStyle NameText = FTextBlockStyle(NormalText) - .SetColorAndOpacity(FLinearColor(0.9f, 0.9f, 0.9f)); - { - NameText.Font.Size = 14; - StyleSet->Set("Linter.Report.AssetName", NameText); - } - - FTextBlockStyle RuleTitleText = FTextBlockStyle(NormalText) - .SetColorAndOpacity(FLinearColor(0.8f, 0.8f, 0.8f)); - { - RuleTitleText.Font.Size = 12; - StyleSet->Set("Linter.Report.RuleTitle", RuleTitleText); - } - - FTextBlockStyle DescriptionText = FTextBlockStyle(NormalText) - .SetColorAndOpacity(FLinearColor(0.8f, 0.8f, 0.8f)); - { - DescriptionText.Font.Size = 10; - StyleSet->Set("Linter.Report.DescriptionText", DescriptionText); - } - } - - FSlateStyleRegistry::RegisterSlateStyle(*StyleSet.Get()); +void FLinterStyle::Initialize() { + // Const icon sizes + const FVector2D Icon8x8(8.0f, 8.0f); + const FVector2D Icon14x14(14.0f, 14.0f); + const FVector2D Icon16x16(16.0f, 16.0f); + const FVector2D Icon20x20(20.0f, 20.0f); + const FVector2D Icon40x40(40.0f, 40.0f); + const FVector2D Icon64x64(64.0f, 64.0f); + const FVector2D Icon128x128(128.0f, 128.0f); + + // Only register once + if (StyleSet.IsValid()) { + return; + } + + StyleSet = MakeShareable(new FSlateStyleSet(GetStyleSetName())); + StyleSet->SetContentRoot(FPaths::EngineContentDir() / TEXT("Editor/Slate")); + StyleSet->SetCoreContentRoot(FPaths::EngineContentDir() / TEXT("Slate")); + + // Asset actions + { + StyleSet->Set("AssetActions.RunLinter", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_Texture_Run_16x"), Icon16x16)); + StyleSet->Set("AssetActions.BatchRename", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_Texture_Run_16x"), Icon16x16)); + StyleSet->Set("AssetActions.TooltipTool", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_Texture_Run_16x"), Icon16x16)); + + // Toolbar Button Icons + StyleSet->Set("Linter.Toolbar.Icon", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_Texture_Run_16x"), Icon16x16)); + + // Report Images + StyleSet->Set("Linter.Step.Unknown", new IMAGE_PLUGIN_BRUSH("Icons/CompileStatus_Unknown_64px", Icon64x64)); + StyleSet->Set("Linter.Step.Error", new IMAGE_PLUGIN_BRUSH("Icons/CompileStatus_Fail_64px", Icon64x64)); + StyleSet->Set("Linter.Step.Good", new IMAGE_PLUGIN_BRUSH("Icons/CompileStatus_Good_64px", Icon64x64)); + StyleSet->Set("Linter.Step.Working", new IMAGE_PLUGIN_BRUSH("Icons/CompileStatus_Working_64px", Icon64x64)); + StyleSet->Set("Linter.Step.Warning", new IMAGE_PLUGIN_BRUSH("Icons/CompileStatus_Warning_64px", Icon64x64)); + + StyleSet->Set("Linter.Report.Link", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_Help_Documentation_16x"), Icon16x16)); + StyleSet->Set("Linter.Report.Warning", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_MessageLog_Warning_14x"), Icon14x14)); + StyleSet->Set("Linter.Report.Error", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_MessageLog_Error_14x"), Icon14x14)); + + StyleSet->Set("Linter.Report.Info", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_MessageLog_Info_14x"), Icon20x20)); + + + StyleSet->Set("Linter.Step.BuildLighting.Thumbnail", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_MapCheck_64x"), Icon64x64)); + StyleSet->Set("Linter.Step.Package.Thumbnail", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_AddContent_64x"), Icon64x64)); + StyleSet->Set("Linter.Step.SaveAll.Thumbnail", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_file_saveall_64x"), Icon64x64)); + StyleSet->Set("Linter.Step.FixupRedirects.Thumbnail", new IMAGE_PLUGIN_BRUSH(TEXT("Icons/icon_tab_Toolbars_64x"), Icon64x64)); + + // PaCK Sizing + StyleSet->Set("Linter.Padding", 2.0f); + + // PaCK Fonts + const FTextBlockStyle NormalText = FAppStyle::GetWidgetStyle("NormalText"); + + FTextBlockStyle NameText = FTextBlockStyle(NormalText) + .SetColorAndOpacity(FLinearColor(0.9f, 0.9f, 0.9f)); + { + NameText.Font.Size = 14; + StyleSet->Set("Linter.Report.AssetName", NameText); + } + + FTextBlockStyle RuleTitleText = FTextBlockStyle(NormalText) + .SetColorAndOpacity(FLinearColor(0.8f, 0.8f, 0.8f)); + { + RuleTitleText.Font.Size = 12; + StyleSet->Set("Linter.Report.RuleTitle", RuleTitleText); + } + + FTextBlockStyle DescriptionText = FTextBlockStyle(NormalText) + .SetColorAndOpacity(FLinearColor(0.8f, 0.8f, 0.8f)); + { + DescriptionText.Font.Size = 10; + StyleSet->Set("Linter.Report.DescriptionText", DescriptionText); + } + } + + FSlateStyleRegistry::RegisterSlateStyle(*StyleSet.Get()); }; #undef IMAGE_PLUGIN_BRUSH @@ -114,12 +117,10 @@ void FLinterStyle::Initialize() #undef TTF_FONT #undef TTF_CORE_FONT -void FLinterStyle::Shutdown() -{ - if (StyleSet.IsValid()) - { - FSlateStyleRegistry::UnRegisterSlateStyle(*StyleSet.Get()); - ensure(StyleSet.IsUnique()); - StyleSet.Reset(); - } +void FLinterStyle::Shutdown() { + if (StyleSet.IsValid()) { + FSlateStyleRegistry::UnRegisterSlateStyle(*StyleSet.Get()); + ensure(StyleSet.IsUnique()); + StyleSet.Reset(); + } } diff --git a/Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp b/Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp index 189453d..8e14664 100644 --- a/Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp +++ b/Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp @@ -1,199 +1,155 @@ #include "TooltipEditor/TooltipStringHelper.h" -FText FTooltipStringHelper::ParseFunctionRawTooltipGetDescription(FString RawTooltip, bool bRemoveNewlines/* = false*/) -{ - if (RawTooltip.Len() == 0) - { - return FText::GetEmpty(); - } - - TArray Lines; - RawTooltip.ParseIntoArrayLines(Lines); - - FString Description; - - for (FString Line : Lines) - { - if (Line.StartsWith(TEXT("@param"))) - { - break; - } - else if (Line.StartsWith(TEXT("@return"))) //@return is assumed to always be last - { - break; - } - else - { - if (Description.Len() > 0) - { - Description.Append(TEXT("\n")); - } - Description.Append(Line); - } - } - - if (bRemoveNewlines) - { - Description.ReplaceInline(TEXT("\r"), TEXT("")); - Description.ReplaceInline(TEXT("\n"), TEXT(" ")); - } - - return FText::FromString(Description); +FText FTooltipStringHelper::ParseFunctionRawTooltipGetDescription(FString RawTooltip, bool bRemoveNewlines/* = false*/) { + if (RawTooltip.Len() == 0) { + return FText::GetEmpty(); + } + + TArray Lines; + RawTooltip.ParseIntoArrayLines(Lines); + + FString Description; + + for (FString Line : Lines) { + if (Line.StartsWith(TEXT("@param"))) { + break; + } + if (Line.StartsWith(TEXT("@return"))) //@return is assumed to always be last + { + break; + } + if (Description.Len() > 0) { + Description.Append(TEXT("\n")); + } + Description.Append(Line); + } + + if (bRemoveNewlines) { + Description.ReplaceInline(TEXT("\r"), TEXT("")); + Description.ReplaceInline(TEXT("\n"), TEXT(" ")); + } + + return FText::FromString(Description); } -bool FTooltipStringHelper::ParseFunctionRawTooltip(FString RawTooltip, FText& OutFunctionDescription, TArray>& Inputs, TArray>& Outputs, FText& OutReturnText) -{ - if (RawTooltip.Len() == 0) - { - return false; - } - - TArray Lines; - RawTooltip.ParseIntoArrayLines(Lines); - - FString Description; - bool bParsingDescription = true; - - FText CurrentArgumentName; - FString CurrentArgumentTooltip; - bool bCurrentArgumentIsInput = true; - - for (FString Line : Lines) - { - if (Line.StartsWith(TEXT("@param"))) - { - if (!bParsingDescription) - { - if (bCurrentArgumentIsInput) - { - FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Inputs); - } - else - { - FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Outputs); - } - - CurrentArgumentName = FText::GetEmpty(); - CurrentArgumentTooltip.Empty(); - } - - bParsingDescription = false; - bCurrentArgumentIsInput = true; - - Line = Line.RightChop(6); - Line.TrimStartAndEndInline(); - - if (Line.StartsWith("[out]")) - { - bCurrentArgumentIsInput = false; - Line = Line.RightChop(5); - Line.TrimStartAndEndInline(); - } - - Line = Line.ConvertTabsToSpaces(4); - FString ArgumentName; - FString ArgumentTooltip; - if (Line.Split(TEXT(" "), &ArgumentName, &CurrentArgumentTooltip)) - { - CurrentArgumentName = FText::FromString(ArgumentName); - CurrentArgumentTooltip.TrimStartAndEndInline(); - } - } - else if (Line.StartsWith(TEXT("@return"))) //@return is assumed to always be last - { - if (!bParsingDescription) - { - if (bCurrentArgumentIsInput) - { - FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Inputs); - } - else - { - FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Outputs); - } - - CurrentArgumentName = FText::GetEmpty(); - CurrentArgumentTooltip.Empty(); - } - - Line = Line.RightChop(7); - Line.TrimStartAndEndInline(); - OutReturnText = FText::FromString(Line); - } - else - { - if (bParsingDescription) - { - if (Description.Len() > 0) - { - Description.Append(TEXT("\n")); - } - Description.Append(Line); - } - else - { - Line.TrimStartAndEndInline(); - CurrentArgumentTooltip.AppendChar(TEXT(' ')); - CurrentArgumentTooltip.Append(Line); - } - } - } - - if (!CurrentArgumentName.IsEmpty()) - { - if (!bParsingDescription) - { - if (bCurrentArgumentIsInput) - { - FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Inputs); - } - else - { - FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Outputs); - } - - CurrentArgumentName = FText::GetEmpty(); - CurrentArgumentTooltip.Empty(); - } - } - - OutFunctionDescription = FText::FromString(Description); - return true; +bool FTooltipStringHelper::ParseFunctionRawTooltip(FString RawTooltip, FText& OutFunctionDescription, TArray>& Inputs, TArray>& Outputs, FText& OutReturnText) { + if (RawTooltip.Len() == 0) { + return false; + } + + TArray Lines; + RawTooltip.ParseIntoArrayLines(Lines); + + FString Description; + bool bParsingDescription = true; + + FText CurrentArgumentName; + FString CurrentArgumentTooltip; + bool bCurrentArgumentIsInput = true; + + for (FString Line : Lines) { + if (Line.StartsWith(TEXT("@param"))) { + if (!bParsingDescription) { + if (bCurrentArgumentIsInput) { + FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Inputs); + } else { + FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Outputs); + } + + CurrentArgumentName = FText::GetEmpty(); + CurrentArgumentTooltip.Empty(); + } + + bParsingDescription = false; + bCurrentArgumentIsInput = true; + + Line = Line.RightChop(6); + Line.TrimStartAndEndInline(); + + if (Line.StartsWith("[out]")) { + bCurrentArgumentIsInput = false; + Line = Line.RightChop(5); + Line.TrimStartAndEndInline(); + } + + Line = Line.ConvertTabsToSpaces(4); + FString ArgumentName; + FString ArgumentTooltip; + if (Line.Split(TEXT(" "), &ArgumentName, &CurrentArgumentTooltip)) { + CurrentArgumentName = FText::FromString(ArgumentName); + CurrentArgumentTooltip.TrimStartAndEndInline(); + } + } else if (Line.StartsWith(TEXT("@return"))) //@return is assumed to always be last + { + if (!bParsingDescription) { + if (bCurrentArgumentIsInput) { + FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Inputs); + } else { + FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Outputs); + } + + CurrentArgumentName = FText::GetEmpty(); + CurrentArgumentTooltip.Empty(); + } + + Line = Line.RightChop(7); + Line.TrimStartAndEndInline(); + OutReturnText = FText::FromString(Line); + } else { + if (bParsingDescription) { + if (Description.Len() > 0) { + Description.Append(TEXT("\n")); + } + Description.Append(Line); + } else { + Line.TrimStartAndEndInline(); + CurrentArgumentTooltip.AppendChar(TEXT(' ')); + CurrentArgumentTooltip.Append(Line); + } + } + } + + if (!CurrentArgumentName.IsEmpty()) { + if (!bParsingDescription) { + if (bCurrentArgumentIsInput) { + FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Inputs); + } else { + FindAndUpdateArgumentTooltip(CurrentArgumentName, FText::FromString(CurrentArgumentTooltip), Outputs); + } + + CurrentArgumentName = FText::GetEmpty(); + CurrentArgumentTooltip.Empty(); + } + } + + OutFunctionDescription = FText::FromString(Description); + return true; } -FString FTooltipStringHelper::ConvertTooltipDataToRawTooltip(FText FunctionDescription, TArray> Inputs, TArray> Outputs) -{ - FString RawTooltip = FunctionDescription.ToString(); - for (const TSharedPtr Arg : Inputs) - { - RawTooltip.Append(FString::Printf(TEXT("\n@param %s %s\t\t\t%s"), TEXT(" "), *Arg->ArgumentName.ToString(), *Arg->Tooltip.ToString())); - } - - if (Outputs.Num() == 1) - { - RawTooltip.Append(FString::Printf(TEXT("\n@return %s"), *Outputs[0]->Tooltip.ToString())); - } - else - { - for (const TSharedPtr Arg : Outputs) - { - RawTooltip.Append(FString::Printf(TEXT("\n@param %s %s\t\t\t%s"), TEXT("[out]"), *Arg->ArgumentName.ToString(), *Arg->Tooltip.ToString())); - } - } - - return RawTooltip; +FString FTooltipStringHelper::ConvertTooltipDataToRawTooltip(FText FunctionDescription, TArray> Inputs, TArray> Outputs) { + FString RawTooltip = FunctionDescription.ToString(); + for (const TSharedPtr Arg : Inputs) { + RawTooltip.Append(FString::Printf(TEXT("\n@param %s %s\t\t\t%s"), TEXT(" "), *Arg->ArgumentName.ToString(), *Arg->Tooltip.ToString())); + } + + if (Outputs.Num() == 1) { + RawTooltip.Append(FString::Printf(TEXT("\n@return %s"), *Outputs[0]->Tooltip.ToString())); + } else { + for (const TSharedPtr Arg : Outputs) { + RawTooltip.Append(FString::Printf(TEXT("\n@param %s %s\t\t\t%s"), TEXT("[out]"), *Arg->ArgumentName.ToString(), *Arg->Tooltip.ToString())); + } + } + + return RawTooltip; } -bool FTooltipStringHelper::FindAndUpdateArgumentTooltip(FText ArgumentName, FText Tooltip, TArray>& Arguments) -{ - const TSharedPtr* FuncArg = Arguments.FindByPredicate([&](TSharedPtr Arg){ return Arg->ArgumentName.EqualTo(ArgumentName, ETextComparisonLevel::Quinary);}); - if (FuncArg != nullptr) - { - (*FuncArg)->Tooltip = Tooltip; - return true; - } - else - { - return false; - } +bool FTooltipStringHelper::FindAndUpdateArgumentTooltip(FText ArgumentName, FText Tooltip, TArray>& Arguments) { + const TSharedPtr* FuncArg = Arguments.FindByPredicate([&](TSharedPtr Arg) { + return Arg->ArgumentName.EqualTo(ArgumentName, ETextComparisonLevel::Quinary); + }); + if (FuncArg != nullptr) { + (*FuncArg)->Tooltip = Tooltip; + return true; + } + return false; } diff --git a/Source/Linter/Private/TooltipTool/TooltipTool.cpp b/Source/Linter/Private/TooltipTool/TooltipTool.cpp index 6336d86..0b45fea 100644 --- a/Source/Linter/Private/TooltipTool/TooltipTool.cpp +++ b/Source/Linter/Private/TooltipTool/TooltipTool.cpp @@ -17,27 +17,27 @@ #include "Kismet2/BlueprintEditorUtils.h" #include "FileHelpers.h" #include "Widgets/Layout/SSeparator.h" +#include "Misc/EngineVersionComparison.h" #define LOCTEXT_NAMESPACE "LinterTooltipTool" -FTooltipTool::FTooltipTool(const TArray Assets) -{ - for (auto Asset : Assets) - { - if (Asset.GetClass()->IsChildOf(UBlueprint::StaticClass())) - { - BlueprintsInternal.Push(Asset); - } - } - - for (int32 i = 0; i < BlueprintsInternal.Num(); ++i) - { - Blueprints.Push(TSharedPtr(&BlueprintsInternal[i])); - } - - if (FSlateApplication::IsInitialized()) - { - DialogWindow = SNew(SWindow) +#if UE_VERSION_OLDER_THAN(5, 1, 0) +using FAppStyle = FEditorStyle; +#endif + +FTooltipTool::FTooltipTool(const TArray Assets) { + for (auto Asset : Assets) { + if (Asset.GetClass()->IsChildOf(UBlueprint::StaticClass())) { + BlueprintsInternal.Push(Asset); + } + } + + for (int32 i = 0; i < BlueprintsInternal.Num(); ++i) { + Blueprints.Push(TSharedPtr(&BlueprintsInternal[i])); + } + + if (FSlateApplication::IsInitialized()) { + DialogWindow = SNew(SWindow) .Title(LOCTEXT("TooltipToolDlgTitle", "Blueprint Member Tooltip Tool")) .SupportsMinimize(false).SupportsMaximize(false) .SaneWindowPlacement(true) @@ -46,737 +46,694 @@ FTooltipTool::FTooltipTool(const TArray Assets) .MaxWidth(400.0f) .SizingRule(ESizingRule::Autosized); - const TSharedPtr DialogWrapper = - SNew(SBorder) + const TSharedPtr DialogWrapper = + SNew(SBorder) .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(4.0f) - [ - SAssignNew(DialogWidget, STooltipTool) + [ + SAssignNew(DialogWidget, STooltipTool) .ParentWindow(DialogWindow) .Blueprints(Blueprints) - ]; + ]; - DialogWindow->SetContent(DialogWrapper.ToSharedRef()); - } + DialogWindow->SetContent(DialogWrapper.ToSharedRef()); + } } -FTooltipTool::EResult FTooltipTool::ShowModal() -{ - //Show Dialog - GEditor->EditorAddModalWindow(DialogWindow.ToSharedRef()); - const EResult UserResponse = (EResult)DialogWidget->GetUserResponse(); - - if (UserResponse == Confirm) - { - +FTooltipTool::EResult FTooltipTool::ShowModal() { + //Show Dialog + GEditor->EditorAddModalWindow(DialogWindow.ToSharedRef()); + const EResult UserResponse = DialogWidget->GetUserResponse(); - } - return UserResponse; + if (UserResponse == Confirm) { } + return UserResponse; } -void STooltipTool::Construct(const FArguments& InArgs) -{ - UserResponse = FTooltipTool::Cancel; - ParentWindow = InArgs._ParentWindow.Get(); - Blueprints = InArgs._Blueprints; - check(Blueprints.IsSet() && Blueprints.Get().Num() > 0); - - this->ChildSlot[ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 0.0f) - [ - SNew(SHeader) - [ - SNew(STextBlock) - .Text(LOCTEXT("TooltipToolBlueprintHeader", "Blueprint")) - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SAssignNew(BlueprintComboBox, SComboBox>) +void STooltipTool::Construct(const FArguments& InArgs) { + UserResponse = FTooltipTool::Cancel; + ParentWindow = InArgs._ParentWindow.Get(); + Blueprints = InArgs._Blueprints; + check(Blueprints.IsSet() && Blueprints.Get().Num() > 0); + + this->ChildSlot[ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 0.0f) + [ + SNew(SHeader) + [ + SNew(STextBlock) + .Text(LOCTEXT("TooltipToolBlueprintHeader", "Blueprint")) + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SAssignNew(BlueprintComboBox, SComboBox>) .OptionsSource(&Blueprints.Get()) .InitiallySelectedItem(Blueprints.Get()[0]) .OnGenerateWidget_Lambda( - [](const TSharedPtr Item) - { - return SNew(STextBlock) + [](const TSharedPtr Item) { + return SNew(STextBlock) .Text(FText::FromName(Item->AssetName)) .ToolTipText(FText::FromString(Item->GetFullName())); - }) + }) .OnSelectionChanged_Lambda( - [&](TSharedPtr Item, ESelectInfo::Type SelectInfo) - { - VariableTooltipEditableTextBox->SetEnabled(false); - RebuildMemberList(); - }) - [ - SNew(STextBlock) - .Text(this, &STooltipTool::GetSelectedBlueprintText) - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .FillWidth(1.0f) - [ - SNew(SButton) - .OnClicked_Lambda( - [&] { - int32 Index = Blueprints.Get().Find(BlueprintComboBox->GetSelectedItem()); - Index = (Blueprints.Get().Num() + Index - 1) % Blueprints.Get().Num(); - BlueprintComboBox->SetSelectedItem(Blueprints.Get()[Index]); - return FReply::Handled(); - }) - [ - SNew(STextBlock) - .Text(LOCTEXT("TooltipToolBlueprintsPrevious", "Previous")) - ] - ] - + SHorizontalBox::Slot() - .FillWidth(1.0f) - [ - SNew(SButton) - .OnClicked_Lambda( - [&] { - int32 Index = Blueprints.Get().Find(BlueprintComboBox->GetSelectedItem()); - Index = (Index + 1) % Blueprints.Get().Num(); - BlueprintComboBox->SetSelectedItem(Blueprints.Get()[Index]); - return FReply::Handled(); - }) - [ - SNew(STextBlock) - .Text(LOCTEXT("TooltipToolBlueprintsNext", "Next")) - ] - ] - - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SButton) - .OnClicked_Lambda( - [&]{ - // Save package here if SCC is enabled because the user can use SCC to revert a change - TArray OutermostPackagesToSave; - for (auto&& Asset : Blueprints.Get()) - { - OutermostPackagesToSave.Add(Asset->GetPackage()); - } - FEditorFileUtils::PromptForCheckoutAndSave(OutermostPackagesToSave, true, false); - return FReply::Handled(); - }) - [ - SNew(STextBlock) - .Text(LOCTEXT("TooltipToolBlueprintsSaveButtonLabel", "Save All Blueprints")) - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SExpandableArea) + [&](TSharedPtr Item, ESelectInfo::Type SelectInfo) { + VariableTooltipEditableTextBox->SetEnabled(false); + RebuildMemberList(); + }) + [ + SNew(STextBlock) + .Text(this, &STooltipTool::GetSelectedBlueprintText) + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .FillWidth(1.0f) + [ + SNew(SButton) + .OnClicked_Lambda( + [&] { + int32 Index = Blueprints.Get().Find(BlueprintComboBox->GetSelectedItem()); + Index = (Blueprints.Get().Num() + Index - 1) % Blueprints.Get().Num(); + BlueprintComboBox->SetSelectedItem(Blueprints.Get()[Index]); + return FReply::Handled(); + }) + [ + SNew(STextBlock) + .Text(LOCTEXT("TooltipToolBlueprintsPrevious", "Previous")) + ] + ] + + SHorizontalBox::Slot() + .FillWidth(1.0f) + [ + SNew(SButton) + .OnClicked_Lambda( + [&] { + int32 Index = Blueprints.Get().Find(BlueprintComboBox->GetSelectedItem()); + Index = (Index + 1) % Blueprints.Get().Num(); + BlueprintComboBox->SetSelectedItem(Blueprints.Get()[Index]); + return FReply::Handled(); + }) + [ + SNew(STextBlock) + .Text(LOCTEXT("TooltipToolBlueprintsNext", "Next")) + ] + ] + + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SButton) + .OnClicked_Lambda( + [&] { + // Save package here if SCC is enabled because the user can use SCC to revert a change + TArray OutermostPackagesToSave; + for (auto&& Asset : Blueprints.Get()) { + OutermostPackagesToSave.Add(Asset->GetPackage()); + } + FEditorFileUtils::PromptForCheckoutAndSave(OutermostPackagesToSave, true, false); + return FReply::Handled(); + }) + [ + SNew(STextBlock) + .Text(LOCTEXT("TooltipToolBlueprintsSaveButtonLabel", "Save All Blueprints")) + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SExpandableArea) .InitiallyCollapsed(true) .AreaTitle(LOCTEXT("TooltipToolVariablesExpandableTitle", "Variables")) .BodyContent() - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SBox) - .HeightOverride(100.0f) - [ - SNew(SBorder) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SBox) + .HeightOverride(100.0f) + [ + SNew(SBorder) .BorderImage(FCoreStyle::Get().GetBrush("ToolPanel.GroupBorder")) .Padding(0.0f) - [ - SNew(SScrollBox) - .ScrollBarAlwaysVisible(true) - + SScrollBox::Slot() - [ - SAssignNew(MemberListView, SListView>) + [ + SNew(SScrollBox) + .ScrollBarAlwaysVisible(true) + + SScrollBox::Slot() + [ + SAssignNew(MemberListView, SListView>) .SelectionMode(ESelectionMode::Single) .ListItemsSource(&Members) .OnGenerateRow_Lambda( - [](TSharedPtr Item, const TSharedRef& OwnerTable) - { - return SNew(STableRow>, OwnerTable) - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(SImage) + [](TSharedPtr Item, const TSharedRef& OwnerTable) { + return SNew(STableRow>, OwnerTable) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(SImage) .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) - .Visibility_Lambda([Item] {return Item.IsValid() ? (Item->HasMetaData(FBlueprintMetadata::MD_Tooltip) && Item->GetMetaData(FBlueprintMetadata::MD_Tooltip).Len() > 0 ? EVisibility::Collapsed : EVisibility::HitTestInvisible) : EVisibility::Collapsed; }) - ] - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(STextBlock) - .Text(FText::FromString(Item->FriendlyName)) - ] - + SHorizontalBox::Slot() - .FillWidth(1.0f) - [ - SNew(STextBlock) + .Visibility_Lambda([Item] { + return Item.IsValid() ? (Item->HasMetaData(FBlueprintMetadata::MD_Tooltip) && Item->GetMetaData(FBlueprintMetadata::MD_Tooltip).Len() > 0 ? EVisibility::Collapsed : EVisibility::HitTestInvisible) : EVisibility::Collapsed; + }) + ] + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(STextBlock) + .Text(FText::FromString(Item->FriendlyName)) + ] + + SHorizontalBox::Slot() + .FillWidth(1.0f) + [ + SNew(STextBlock) .Text(UEdGraphSchema_K2::TypeToText(Item->VarType)) .Justification(ETextJustify::Right) - ] - ]; - }) + ] + ]; + }) .OnSelectionChanged_Lambda( - [&](const TSharedPtr Item, ESelectInfo::Type SelectInfo) - { - if (!Item.IsValid()) - { - VariableTooltipEditableTextBox->SetEnabled(false); - VariableTooltipEditableTextBox->SetText(FText::GetEmpty()); - return; - } - - VariableTooltipEditableTextBox->SetEnabled(true); - if (Item->HasMetaData(FBlueprintMetadata::MD_Tooltip)) - { - VariableTooltipEditableTextBox->SetText(FText::FromString(Item->GetMetaData(FBlueprintMetadata::MD_Tooltip))); - } - else - { - VariableTooltipEditableTextBox->SetText(FText::GetEmpty()); - } - }) - ] - ] - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SHeader) - [ - SNew(STextBlock) - .Text(LOCTEXT("TooltipToolTooltipHeader", "Tooltip")) - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SBox) - .HeightOverride(100.0f) - [ - SAssignNew(VariableTooltipEditableTextBox, SMultiLineEditableTextBox) + [&](const TSharedPtr Item, ESelectInfo::Type SelectInfo) { + if (!Item.IsValid()) { + VariableTooltipEditableTextBox->SetEnabled(false); + VariableTooltipEditableTextBox->SetText(FText::GetEmpty()); + return; + } + + VariableTooltipEditableTextBox->SetEnabled(true); + if (Item->HasMetaData(FBlueprintMetadata::MD_Tooltip)) { + VariableTooltipEditableTextBox->SetText(FText::FromString(Item->GetMetaData(FBlueprintMetadata::MD_Tooltip))); + } else { + VariableTooltipEditableTextBox->SetText(FText::GetEmpty()); + } + }) + ] + ] + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SHeader) + [ + SNew(STextBlock) + .Text(LOCTEXT("TooltipToolTooltipHeader", "Tooltip")) + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SBox) + .HeightOverride(100.0f) + [ + SAssignNew(VariableTooltipEditableTextBox, SMultiLineEditableTextBox) .AutoWrapText(true) .IsEnabled(false) .OnTextChanged_Lambda( - [&](const FText& NewText) - { - if (CommitOnTextChangeCheckBox->IsChecked()) - { - UpdateVariableTooltipText(NewText); - } - }) - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SAssignNew(CommitTextButton, SButton) - .OnClicked_Lambda([&] { /**UpdateVariableTooltipText(TooltipEditableTextBox->GetText());**/ return FReply::Handled(); }) - .Visibility_Lambda([&] {return CommitOnTextChangeCheckBox->IsChecked() ? EVisibility::Collapsed : EVisibility::Visible; }) - [ - SNew(STextBlock) - .Text(LOCTEXT("TooltipToolCommitTextButtonLabel", "Commit Text")) - ] - ] - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SExpandableArea) + [&](const FText& NewText) { + if (CommitOnTextChangeCheckBox->IsChecked()) { + UpdateVariableTooltipText(NewText); + } + }) + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SAssignNew(CommitTextButton, SButton) + .OnClicked_Lambda([&] { + /**UpdateVariableTooltipText(TooltipEditableTextBox->GetText());**/ + return FReply::Handled(); + }) + .Visibility_Lambda([&] { + return CommitOnTextChangeCheckBox->IsChecked() ? EVisibility::Collapsed : EVisibility::Visible; + }) + [ + SNew(STextBlock) + .Text(LOCTEXT("TooltipToolCommitTextButtonLabel", "Commit Text")) + ] + ] + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SExpandableArea) .InitiallyCollapsed(true) .AreaTitle(LOCTEXT("TooltipToolFunctionExpandableTitle", "Functions")) .BodyContent() - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SBox) - .HeightOverride(100.0f) - [ - SNew(SBorder) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SBox) + .HeightOverride(100.0f) + [ + SNew(SBorder) .BorderImage(FCoreStyle::Get().GetBrush("ToolPanel.GroupBorder")) .Padding(0.0f) - [ - SNew(SScrollBox) - .ScrollBarAlwaysVisible(true) - + SScrollBox::Slot() - [ - SAssignNew(FunctionListView, SListView>) + [ + SNew(SScrollBox) + .ScrollBarAlwaysVisible(true) + + SScrollBox::Slot() + [ + SAssignNew(FunctionListView, SListView>) .SelectionMode(ESelectionMode::Single) .ListItemsSource(&FunctionPointers) .OnGenerateRow_Lambda( - [](TSharedPtr Item, const TSharedRef& OwnerTable) - { - return SNew(STableRow>, OwnerTable) - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(SImage) + [](TSharedPtr Item, const TSharedRef& OwnerTable) { + return SNew(STableRow>, OwnerTable) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(SImage) .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) - .Visibility_Lambda([Item] {return (Item.IsValid() && Item->FunctionEntryNode != nullptr&& !Item->FunctionEntryNode->MetaData.ToolTip.IsEmptyOrWhitespace()) ? EVisibility::Collapsed : EVisibility::Visible; }) - ] - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(STextBlock) - .Text(FText::FromName(Item->FunctionName)) - ] - ]; - }) + .Visibility_Lambda([Item] { + return (Item.IsValid() && Item->FunctionEntryNode != nullptr && !Item->FunctionEntryNode->MetaData.ToolTip.IsEmptyOrWhitespace()) ? EVisibility::Collapsed : EVisibility::Visible; + }) + ] + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(STextBlock) + .Text(FText::FromName(Item->FunctionName)) + ] + ]; + }) .OnSelectionChanged_Lambda( - [&](const TSharedPtr Item, ESelectInfo::Type SelectInfo) - { - FunctionArgumentDescriptions.Empty(); - FunctionOutputDescriptions.Empty(); - - if (!Item.IsValid()) - { - FunctionArgumentListView->RebuildList(); - FunctionOutputListView->RebuildList(); - - FunctionDescriptionTooltipBox->SetEnabled(false); - FunctionArgumentListView->SetEnabled(false); - FunctionOutputListView->SetEnabled(false); - FunctionDescriptionTooltipBox->SetText(FText::GetEmpty()); - - return; - } - - check(Item->FunctionEntryNode); - TArray InputPins = Item->FunctionEntryNode->GetAllPins(); - for (const UEdGraphPin* Pin : InputPins) - { - if (Pin->Direction == EGPD_Output) - { - if (Pin->PinType.PinCategory != UEdGraphSchema_K2::PC_Exec) - { - FunctionArgumentDescriptions.Add(MakeShared(FText::FromString(Pin->GetName()), FText::GetEmpty(), UEdGraphSchema_K2::TypeToText(Pin->PinType))); - } - } - } - - if (Item->FunctionResultNode != nullptr) - { - TArray OutputPins = Item->FunctionResultNode->GetAllPins(); - for (const UEdGraphPin* Pin : OutputPins) - { - if (Pin->Direction == EGPD_Input) - { - if (Pin->PinType.PinCategory != UEdGraphSchema_K2::PC_Exec) - { - FunctionOutputDescriptions.Add(MakeShared(FText::FromString(Pin->GetName()), FText::GetEmpty(), UEdGraphSchema_K2::TypeToText(Pin->PinType))); - } - } - } - } - - FunctionDescriptionTooltipBox->SetEnabled(true); - FunctionArgumentListView->SetEnabled(true); - FunctionOutputListView->SetEnabled(true); - - FText FunctionDescription; - FText ReturnText; - - if (!FTooltipStringHelper::ParseFunctionRawTooltip(Item->FunctionEntryNode->MetaData.ToolTip.ToString(), CurrentFunctionDescription, FunctionArgumentDescriptions, FunctionOutputDescriptions, ReturnText)) - { - CurrentFunctionDescription = FText::GetEmpty(); - } - - if (!ReturnText.IsEmptyOrWhitespace() && FunctionOutputDescriptions.Num() > 0) - { - FunctionOutputDescriptions[FunctionOutputDescriptions.Num() - 1]->Tooltip = ReturnText; - } - - FunctionArgumentListView->RebuildList(); - FunctionOutputListView->RebuildList(); - - FunctionDescriptionTooltipBox->SetText(CurrentFunctionDescription); - - }) - ] - ] - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .AutoHeight() - [ - SNew(SHeader) - [ - SNew(STextBlock) - .Text(LOCTEXT("TooltipToolFunctionDesc", "Description")) - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - [ - SNew(SBox) - .HeightOverride(60.0f) - [ - SAssignNew(FunctionDescriptionTooltipBox, SMultiLineEditableTextBox) + [&](const TSharedPtr Item, ESelectInfo::Type SelectInfo) { + FunctionArgumentDescriptions.Empty(); + FunctionOutputDescriptions.Empty(); + + if (!Item.IsValid()) { + FunctionArgumentListView->RebuildList(); + FunctionOutputListView->RebuildList(); + + FunctionDescriptionTooltipBox->SetEnabled(false); + FunctionArgumentListView->SetEnabled(false); + FunctionOutputListView->SetEnabled(false); + FunctionDescriptionTooltipBox->SetText(FText::GetEmpty()); + + return; + } + + check(Item->FunctionEntryNode); + TArray InputPins = Item->FunctionEntryNode->GetAllPins(); + for (const UEdGraphPin* Pin : InputPins) { + if (Pin->Direction == EGPD_Output) { + if (Pin->PinType.PinCategory != UEdGraphSchema_K2::PC_Exec) { + FunctionArgumentDescriptions.Add(MakeShared(FText::FromString(Pin->GetName()), FText::GetEmpty(), UEdGraphSchema_K2::TypeToText(Pin->PinType))); + } + } + } + + if (Item->FunctionResultNode != nullptr) { + TArray OutputPins = Item->FunctionResultNode->GetAllPins(); + for (const UEdGraphPin* Pin : OutputPins) { + if (Pin->Direction == EGPD_Input) { + if (Pin->PinType.PinCategory != UEdGraphSchema_K2::PC_Exec) { + FunctionOutputDescriptions.Add(MakeShared(FText::FromString(Pin->GetName()), FText::GetEmpty(), UEdGraphSchema_K2::TypeToText(Pin->PinType))); + } + } + } + } + + FunctionDescriptionTooltipBox->SetEnabled(true); + FunctionArgumentListView->SetEnabled(true); + FunctionOutputListView->SetEnabled(true); + + FText FunctionDescription; + FText ReturnText; + + if (!FTooltipStringHelper::ParseFunctionRawTooltip(Item->FunctionEntryNode->MetaData.ToolTip.ToString(), CurrentFunctionDescription, FunctionArgumentDescriptions, FunctionOutputDescriptions, ReturnText)) { + CurrentFunctionDescription = FText::GetEmpty(); + } + + if (!ReturnText.IsEmptyOrWhitespace() && FunctionOutputDescriptions.Num() > 0) { + FunctionOutputDescriptions[FunctionOutputDescriptions.Num() - 1]->Tooltip = ReturnText; + } + + FunctionArgumentListView->RebuildList(); + FunctionOutputListView->RebuildList(); + + FunctionDescriptionTooltipBox->SetText(CurrentFunctionDescription); + }) + ] + ] + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .AutoHeight() + [ + SNew(SHeader) + [ + SNew(STextBlock) + .Text(LOCTEXT("TooltipToolFunctionDesc", "Description")) + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + [ + SNew(SBox) + .HeightOverride(60.0f) + [ + SAssignNew(FunctionDescriptionTooltipBox, SMultiLineEditableTextBox) .AutoWrapText(true) .IsEnabled(false) .OnTextChanged_Lambda( - [&](const FText& NewText) - { - if (CommitOnTextChangeCheckBox->IsChecked()) - { - if (!NewText.EqualTo(CurrentFunctionDescription)) - { - UpdateCurrentFunctionTooltipText(); - } - } - }) - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - [ - SNew(SHeader) - [ - SNew(STextBlock) - .Text(LOCTEXT("TooltipToolFunctionInputs", "Inputs")) - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - [ - SNew(SBox) + [&](const FText& NewText) { + if (CommitOnTextChangeCheckBox->IsChecked()) { + if (!NewText.EqualTo(CurrentFunctionDescription)) { + UpdateCurrentFunctionTooltipText(); + } + } + }) + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + [ + SNew(SHeader) + [ + SNew(STextBlock) + .Text(LOCTEXT("TooltipToolFunctionInputs", "Inputs")) + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + [ + SNew(SBox) .MinDesiredHeight(20.0f) .MaxDesiredHeight(100.0f) - [ - SNew(SBorder) + [ + SNew(SBorder) .BorderImage(FCoreStyle::Get().GetBrush("ToolPanel.GroupBorder")) .Padding(0.0f) - [ - SNew(SScrollBox) - .ScrollBarAlwaysVisible(true) - + SScrollBox::Slot() - [ - SAssignNew(FunctionArgumentListView, SListView>) + [ + SNew(SScrollBox) + .ScrollBarAlwaysVisible(true) + + SScrollBox::Slot() + [ + SAssignNew(FunctionArgumentListView, SListView>) .SelectionMode(ESelectionMode::None) .ListItemsSource(&FunctionArgumentDescriptions) .OnGenerateRow_Lambda( - [&](TSharedPtr Item, const TSharedRef& OwnerTable) - { - return SNew(STableRow>, OwnerTable) - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(SImage) + [&](TSharedPtr Item, const TSharedRef& OwnerTable) { + return SNew(STableRow>, OwnerTable) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(SImage) .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) - .Visibility_Lambda([Item] {return (Item.IsValid() && !Item->Tooltip.IsEmptyOrWhitespace()) ? EVisibility::Collapsed : EVisibility::Visible; }) - ] - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(STextBlock) - .Text(FText::FromString(FString::Printf(TEXT("%s (%s)"), *Item->ArgumentName.ToString(), *Item->ArgumentType.ToString()))) - ] - ] - + SVerticalBox::Slot() - .Padding(0.0f, 4.0f, 0.0f, 4.0f) - [ - SNew(SEditableTextBox) + .Visibility_Lambda([Item] { + return (Item.IsValid() && !Item->Tooltip.IsEmptyOrWhitespace()) ? EVisibility::Collapsed : EVisibility::Visible; + }) + ] + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(STextBlock) + .Text(FText::FromString(FString::Printf(TEXT("%s (%s)"), *Item->ArgumentName.ToString(), *Item->ArgumentType.ToString()))) + ] + ] + + SVerticalBox::Slot() + .Padding(0.0f, 4.0f, 0.0f, 4.0f) + [ + SNew(SEditableTextBox) .Text(Item->Tooltip) .OnTextChanged_Lambda( - [&](const FText& NewText) - { - if (CommitOnTextChangeCheckBox->IsChecked()) - { - UpdateCurrentFunctionTooltipText(); - } - }) - ] - ]; - }) - ] - ] - ] - ] - - + SVerticalBox::Slot() - .AutoHeight() - [ - SNew(SHeader) - [ - SNew(STextBlock) - .Text(LOCTEXT("TooltipToolFunctionOutputs", "Outputs")) - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - [ - SNew(SBox) + [&](const FText& NewText) { + if (CommitOnTextChangeCheckBox->IsChecked()) { + UpdateCurrentFunctionTooltipText(); + } + }) + ] + ]; + }) + ] + ] + ] + ] + + + SVerticalBox::Slot() + .AutoHeight() + [ + SNew(SHeader) + [ + SNew(STextBlock) + .Text(LOCTEXT("TooltipToolFunctionOutputs", "Outputs")) + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + [ + SNew(SBox) .MinDesiredHeight(20.0f) .MaxDesiredHeight(100.0f) - [ - SNew(SBorder) + [ + SNew(SBorder) .BorderImage(FCoreStyle::Get().GetBrush("ToolPanel.GroupBorder")) .Padding(0.0f) - [ - SNew(SScrollBox) - .ScrollBarAlwaysVisible(true) - + SScrollBox::Slot() - [ - SAssignNew(FunctionOutputListView, SListView>) + [ + SNew(SScrollBox) + .ScrollBarAlwaysVisible(true) + + SScrollBox::Slot() + [ + SAssignNew(FunctionOutputListView, SListView>) .SelectionMode(ESelectionMode::None) .ListItemsSource(&FunctionOutputDescriptions) .OnGenerateRow_Lambda( - [&](TSharedPtr Item, const TSharedRef& OwnerTable) - { - return SNew(STableRow>, OwnerTable) - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(SImage) + [&](TSharedPtr Item, const TSharedRef& OwnerTable) { + return SNew(STableRow>, OwnerTable) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(SImage) .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) - .Visibility_Lambda([Item] {return (Item.IsValid() && !Item->Tooltip.IsEmptyOrWhitespace()) ? EVisibility::Collapsed : EVisibility::Visible; }) - ] - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(STextBlock) - .Text(FText::FromString(FString::Printf(TEXT("%s (%s)"), *Item->ArgumentName.ToString(), *Item->ArgumentType.ToString()))) - ] - ] - + SVerticalBox::Slot() - .Padding(0.0f, 4.0f, 0.0f, 4.0f) - [ - SNew(SEditableTextBox) + .Visibility_Lambda([Item] { + return (Item.IsValid() && !Item->Tooltip.IsEmptyOrWhitespace()) ? EVisibility::Collapsed : EVisibility::Visible; + }) + ] + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(STextBlock) + .Text(FText::FromString(FString::Printf(TEXT("%s (%s)"), *Item->ArgumentName.ToString(), *Item->ArgumentType.ToString()))) + ] + ] + + SVerticalBox::Slot() + .Padding(0.0f, 4.0f, 0.0f, 4.0f) + [ + SNew(SEditableTextBox) .Text(Item->Tooltip) .OnTextChanged_Lambda( - [&](const FText& NewText) - { - if (CommitOnTextChangeCheckBox->IsChecked()) - { - UpdateCurrentFunctionTooltipText(); - } - }) - ] - ]; - }) - ] - ] - ] - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SAssignNew(CommitTextButton, SButton) - .OnClicked_Lambda([&] { UpdateVariableTooltipText(VariableTooltipEditableTextBox->GetText()); return FReply::Handled(); }) - .Visibility_Lambda([&] {return CommitOnTextChangeCheckBox->IsChecked() ? EVisibility::Collapsed : EVisibility::Visible; }) - [ - SNew(STextBlock) - .Text(LOCTEXT("TooltipToolCommitTextButtonLabel", "Commit Text")) - ] - ] - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) - [ - SNew(SSeparator) - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 0.0f) - [ - SNew(SExpandableArea) + [&](const FText& NewText) { + if (CommitOnTextChangeCheckBox->IsChecked()) { + UpdateCurrentFunctionTooltipText(); + } + }) + ] + ]; + }) + ] + ] + ] + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SAssignNew(CommitTextButton, SButton) + .OnClicked_Lambda([&] { + UpdateVariableTooltipText(VariableTooltipEditableTextBox->GetText()); + return FReply::Handled(); + }) + .Visibility_Lambda([&] { + return CommitOnTextChangeCheckBox->IsChecked() ? EVisibility::Collapsed : EVisibility::Visible; + }) + [ + SNew(STextBlock) + .Text(LOCTEXT("TooltipToolCommitTextButtonLabel", "Commit Text")) + ] + ] + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) + [ + SNew(SSeparator) + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 0.0f) + [ + SNew(SExpandableArea) .InitiallyCollapsed(true) .AreaTitle(LOCTEXT("TooltipToolBehaviorExpandableTitle", "Tool Behavior")) .BodyContent() - [ - SAssignNew(CommitOnTextChangeCheckBox, SCheckBox) - .IsChecked(ECheckBoxState::Checked) - [ - SNew(STextBlock) - .Text(LOCTEXT("TooltipToolCommitOnChangeLabel", "Commit Tooltip on Text Change")) - ] - ] - ] - ]; - - RebuildMemberList(); + [ + SAssignNew(CommitOnTextChangeCheckBox, SCheckBox) + .IsChecked(ECheckBoxState::Checked) + [ + SNew(STextBlock) + .Text(LOCTEXT("TooltipToolCommitOnChangeLabel", "Commit Tooltip on Text Change")) + ] + ] + ] + ]; + + RebuildMemberList(); } -FTooltipTool::EResult STooltipTool::GetUserResponse() const -{ - return UserResponse; +FTooltipTool::EResult STooltipTool::GetUserResponse() const { + return UserResponse; } -FReply STooltipTool::OnButtonClick(const FTooltipTool::EResult ButtonID) -{ - ParentWindow->RequestDestroyWindow(); - UserResponse = ButtonID; +FReply STooltipTool::OnButtonClick(const FTooltipTool::EResult ButtonID) { + ParentWindow->RequestDestroyWindow(); + UserResponse = ButtonID; - return FReply::Handled(); + return FReply::Handled(); } -FText STooltipTool::GetSelectedBlueprintText() const -{ - if (BlueprintComboBox->GetSelectedItem().IsValid()) - { - return FText::FromName(BlueprintComboBox->GetSelectedItem().Get()->AssetName); - } +FText STooltipTool::GetSelectedBlueprintText() const { + if (BlueprintComboBox->GetSelectedItem().IsValid()) { + return FText::FromName(BlueprintComboBox->GetSelectedItem().Get()->AssetName); + } - return FText::FromString(TEXT("No Blueprint Selected.")); + return FText::FromString(TEXT("No Blueprint Selected.")); } -void STooltipTool::UpdateVariableTooltipText(const FText& NewText) -{ - // Early out if text box isn't enabled - if (!VariableTooltipEditableTextBox->IsEnabled()) - { - return; - } - - TArray> SelectedMembers; - MemberListView->GetSelectedItems(SelectedMembers); - if (SelectedMembers.Num() == 1) - { - const TSharedPtr BlueprintAsset = BlueprintComboBox->GetSelectedItem(); - UBlueprint* Blueprint = CastChecked(BlueprintAsset->GetAsset()); - SelectedMembers[0]->SetMetaData(FBlueprintMetadata::MD_Tooltip, NewText.ToString()); - FBlueprintEditorUtils::SetBlueprintVariableMetaData(Blueprint, SelectedMembers[0]->VarName, nullptr, FBlueprintMetadata::MD_Tooltip, NewText.ToString()); - } - else - { - check(false); - } +void STooltipTool::UpdateVariableTooltipText(const FText& NewText) { + // Early out if text box isn't enabled + if (!VariableTooltipEditableTextBox->IsEnabled()) { + return; + } + + TArray> SelectedMembers; + MemberListView->GetSelectedItems(SelectedMembers); + if (SelectedMembers.Num() == 1) { + const TSharedPtr BlueprintAsset = BlueprintComboBox->GetSelectedItem(); + UBlueprint* Blueprint = CastChecked(BlueprintAsset->GetAsset()); + SelectedMembers[0]->SetMetaData(FBlueprintMetadata::MD_Tooltip, NewText.ToString()); + FBlueprintEditorUtils::SetBlueprintVariableMetaData(Blueprint, SelectedMembers[0]->VarName, nullptr, FBlueprintMetadata::MD_Tooltip, NewText.ToString()); + } else { + check(false); + } } -void STooltipTool::UpdateCurrentFunctionTooltipText() -{ - TArray> SelectedFunctions = FunctionListView->GetSelectedItems(); +void STooltipTool::UpdateCurrentFunctionTooltipText() { + TArray> SelectedFunctions = FunctionListView->GetSelectedItems(); - if (SelectedFunctions.Num() == 0) - { - return; - } + if (SelectedFunctions.Num() == 0) { + return; + } - check(SelectedFunctions.Num() == 1); //If anything is selected, only one thing should be selected. + check(SelectedFunctions.Num() == 1); //If anything is selected, only one thing should be selected. - for (int32 i = 0; i < FunctionArgumentDescriptions.Num(); i++) - { - // @TODO: Don't do this - TSharedRef Child = FunctionArgumentListView->WidgetFromItem(FunctionArgumentDescriptions[i])->GetContent()->GetChildren()->GetChildAt(1); - const SEditableTextBox& TooltipBox = static_cast(Child.Get()); - FunctionArgumentDescriptions[i]->Tooltip = TooltipBox.GetText(); - } + for (int32 i = 0; i < FunctionArgumentDescriptions.Num(); i++) { + // @TODO: Don't do this + TSharedRef Child = FunctionArgumentListView->WidgetFromItem(FunctionArgumentDescriptions[i])->GetContent()->GetChildren()->GetChildAt(1); + const SEditableTextBox& TooltipBox = static_cast(Child.Get()); + FunctionArgumentDescriptions[i]->Tooltip = TooltipBox.GetText(); + } - for (int32 i = 0; i < FunctionOutputDescriptions.Num(); i++) - { - TSharedRef Child = FunctionOutputListView->WidgetFromItem(FunctionOutputDescriptions[i])->GetContent()->GetChildren()->GetChildAt(1); - const SEditableTextBox& TooltipBox = static_cast(Child.Get()); - FunctionOutputDescriptions[i]->Tooltip = TooltipBox.GetText(); - } + for (int32 i = 0; i < FunctionOutputDescriptions.Num(); i++) { + TSharedRef Child = FunctionOutputListView->WidgetFromItem(FunctionOutputDescriptions[i])->GetContent()->GetChildren()->GetChildAt(1); + const SEditableTextBox& TooltipBox = static_cast(Child.Get()); + FunctionOutputDescriptions[i]->Tooltip = TooltipBox.GetText(); + } - const FString RawTooltip = FTooltipStringHelper::ConvertTooltipDataToRawTooltip(FunctionDescriptionTooltipBox->GetText(), FunctionArgumentDescriptions, FunctionOutputDescriptions); + const FString RawTooltip = FTooltipStringHelper::ConvertTooltipDataToRawTooltip(FunctionDescriptionTooltipBox->GetText(), FunctionArgumentDescriptions, FunctionOutputDescriptions); - const TSharedPtr FunctionPointer = SelectedFunctions[0]; - FunctionPointer->FunctionEntryNode->MetaData.ToolTip = FText::FromString(RawTooltip); + const TSharedPtr FunctionPointer = SelectedFunctions[0]; + FunctionPointer->FunctionEntryNode->MetaData.ToolTip = FText::FromString(RawTooltip); } -void STooltipTool::RebuildMemberList() -{ - Members.Empty(); - FunctionPointers.Empty(); - FunctionArgumentDescriptions.Empty(); - FunctionOutputDescriptions.Empty(); - - if (!BlueprintComboBox->GetSelectedItem().IsValid()) - { - return; - } - - UBlueprint* Blueprint = Cast(BlueprintComboBox->GetSelectedItem().Get()->GetAsset()); - - // Get variables - for (const FBPVariableDescription Member : Blueprint->NewVariables) - { - if ((Member.PropertyFlags & CPF_DisableEditOnInstance) != CPF_DisableEditOnInstance) - { - Members.Push(MakeShared(Member)); - } - } - - // Get functions - for (const UEdGraph* FunctionGraph : Blueprint->FunctionGraphs) - { - if (FunctionGraph->GetFName() != UEdGraphSchema_K2::FN_UserConstructionScript) - { - TWeakObjectPtr FuncEntryPtr; - TWeakObjectPtr FuncResultPtr; - FBlueprintEditorUtils::GetEntryAndResultNodes(FunctionGraph, FuncEntryPtr, FuncResultPtr); - - UK2Node_FunctionEntry* FunctionEntryNode = Cast(FuncEntryPtr.Get()); - UK2Node_FunctionResult* FunctionResultNode = Cast(FuncResultPtr.Get()); - - if (FunctionEntryNode != nullptr && FunctionEntryNode->IsEditable() && FunctionEntryNode->GetFunctionFlags() & FUNC_Public) - { - FunctionPointers.Push(MakeShared(FunctionEntryNode, FunctionResultNode, FunctionEntryNode->GetGraph()->GetFName())); - } - } - } - - MemberListView->RebuildList(); - FunctionListView->RebuildList(); - - if (Members.Num() > 0) - { - MemberListView->SetSelection(Members[0], ESelectInfo::Direct); - } - - if (FunctionPointers.Num() > 0) - { - FunctionListView->SetSelection(FunctionPointers[0], ESelectInfo::Direct); - } +void STooltipTool::RebuildMemberList() { + Members.Empty(); + FunctionPointers.Empty(); + FunctionArgumentDescriptions.Empty(); + FunctionOutputDescriptions.Empty(); + + if (!BlueprintComboBox->GetSelectedItem().IsValid()) { + return; + } + + UBlueprint* Blueprint = Cast(BlueprintComboBox->GetSelectedItem().Get()->GetAsset()); + + // Get variables + for (const FBPVariableDescription Member : Blueprint->NewVariables) { + if ((Member.PropertyFlags & CPF_DisableEditOnInstance) != CPF_DisableEditOnInstance) { + Members.Push(MakeShared(Member)); + } + } + + // Get functions + for (const UEdGraph* FunctionGraph : Blueprint->FunctionGraphs) { + if (FunctionGraph->GetFName() != UEdGraphSchema_K2::FN_UserConstructionScript) { + TWeakObjectPtr FuncEntryPtr; + TWeakObjectPtr FuncResultPtr; + FBlueprintEditorUtils::GetEntryAndResultNodes(FunctionGraph, FuncEntryPtr, FuncResultPtr); + + UK2Node_FunctionEntry* FunctionEntryNode = Cast(FuncEntryPtr.Get()); + UK2Node_FunctionResult* FunctionResultNode = Cast(FuncResultPtr.Get()); + + if (FunctionEntryNode != nullptr && FunctionEntryNode->IsEditable() && FunctionEntryNode->GetFunctionFlags() & FUNC_Public) { + FunctionPointers.Push(MakeShared(FunctionEntryNode, FunctionResultNode, FunctionEntryNode->GetGraph()->GetFName())); + } + } + } + + MemberListView->RebuildList(); + FunctionListView->RebuildList(); + + if (Members.Num() > 0) { + MemberListView->SetSelection(Members[0], ESelectInfo::Direct); + } + + if (FunctionPointers.Num() > 0) { + FunctionListView->SetSelection(FunctionPointers[0], ESelectInfo::Direct); + } } -#undef LOCTEXT_NAMESPACE \ No newline at end of file +#undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintReport.cpp b/Source/Linter/Private/UI/LintReport.cpp index 7132dcf..cbab7f9 100644 --- a/Source/Linter/Private/UI/LintReport.cpp +++ b/Source/Linter/Private/UI/LintReport.cpp @@ -26,405 +26,394 @@ #define LOCTEXT_NAMESPACE "Linter" -void SLintReport::Construct(const FArguments& Args) -{ - const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - - ChildSlot - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .VAlign(VAlign_Fill) - .AutoHeight() - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .HAlign(HAlign_Left) - .AutoWidth() - .Padding(PaddingAmount) - [ - SNew(SButton) +#if UE_VERSION_OLDER_THAN(5, 1, 0) +using FAppStyle = FEditorStyle; +#endif + +void SLintReport::Construct(const FArguments& Args) { + const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); + + ChildSlot + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .VAlign(VAlign_Fill) + .AutoHeight() + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .HAlign(HAlign_Left) + .AutoWidth() + .Padding(PaddingAmount) + [ + SNew(SButton) .Text(LOCTEXT("Rescan", "Rescan")) - .OnClicked_Lambda([this]() -> FReply { Rebuild(LastUsedRuleSet); return FReply::Handled(); }) - ] - + SHorizontalBox::Slot() - .HAlign(HAlign_Left) - .VAlign(VAlign_Center) - .AutoWidth() - .Padding(PaddingAmount) - [ - SAssignNew(ResultsTextBlockPtr, STextBlock) - ] - + SHorizontalBox::Slot() - .HAlign(HAlign_Fill) - .VAlign(VAlign_Center) - .FillWidth(1.0f) - .Padding(PaddingAmount) - [ - SNew(SSpacer) - ] - + SHorizontalBox::Slot() - .HAlign(HAlign_Right) - .AutoWidth() - .Padding(PaddingAmount) - [ - SNew(SButton) + .OnClicked_Lambda([this]() -> FReply { + Rebuild(LastUsedRuleSet); + return FReply::Handled(); + }) + ] + + SHorizontalBox::Slot() + .HAlign(HAlign_Left) + .VAlign(VAlign_Center) + .AutoWidth() + .Padding(PaddingAmount) + [ + SAssignNew(ResultsTextBlockPtr, STextBlock) + ] + + SHorizontalBox::Slot() + .HAlign(HAlign_Fill) + .VAlign(VAlign_Center) + .FillWidth(1.0f) + .Padding(PaddingAmount) + [ + SNew(SSpacer) + ] + + SHorizontalBox::Slot() + .HAlign(HAlign_Right) + .AutoWidth() + .Padding(PaddingAmount) + [ + SNew(SButton) .Text(LOCTEXT("ExportToJSON", "Export To JSON")) - .OnClicked_Lambda([this]() -> FReply - { - IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); - - const void* ParentWindowWindowHandle = FSlateApplication::Get().FindBestParentWindowHandleForDialogs(nullptr); - - const FText Title = LOCTEXT("ExportToJsonTitle", "Export Lint Report as JSON"); - const FString FileTypes = TEXT("Json (*.json)|*.json"); - - const FDateTime Now = FDateTime::Now(); - const FString Output = TEXT("lint-report-") + Now.ToString() + TEXT(".json"); - - FString DefaultPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); - DefaultPath = FPaths::ConvertRelativePathToFull(DefaultPath); - IFileManager::Get().MakeDirectory(*DefaultPath, true); - - TArray OutFilenames; - DesktopPlatform->SaveFileDialog( - ParentWindowWindowHandle, - Title.ToString(), - DefaultPath, - Output, - FileTypes, - EFileDialogFlags::None, - OutFilenames - ); - - if (OutFilenames.Num() > 0) - { - const FString WritePath = FPaths::ConvertRelativePathToFull(OutFilenames[0]); - FFileHelper::SaveStringToFile(JsonReport, *WritePath); - FPlatformProcess::LaunchURL(*WritePath, TEXT(""), nullptr); - } - - return FReply::Handled(); - }) - ] - + SHorizontalBox::Slot() - .HAlign(HAlign_Right) - .AutoWidth() - .Padding(PaddingAmount) - [ - SNew(SButton) + .OnClicked_Lambda([this]() -> FReply { + IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); + + const void* ParentWindowWindowHandle = FSlateApplication::Get().FindBestParentWindowHandleForDialogs(nullptr); + + const FText Title = LOCTEXT("ExportToJsonTitle", "Export Lint Report as JSON"); + const FString FileTypes = TEXT("Json (*.json)|*.json"); + + const FDateTime Now = FDateTime::Now(); + const FString Output = TEXT("lint-report-") + Now.ToString() + TEXT(".json"); + + FString DefaultPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); + DefaultPath = FPaths::ConvertRelativePathToFull(DefaultPath); + IFileManager::Get().MakeDirectory(*DefaultPath, true); + + TArray OutFilenames; + DesktopPlatform->SaveFileDialog( + ParentWindowWindowHandle, + Title.ToString(), + DefaultPath, + Output, + FileTypes, + EFileDialogFlags::None, + OutFilenames + ); + + if (OutFilenames.Num() > 0) { + const FString WritePath = FPaths::ConvertRelativePathToFull(OutFilenames[0]); + FFileHelper::SaveStringToFile(JsonReport, *WritePath); + FPlatformProcess::LaunchURL(*WritePath, TEXT(""), nullptr); + } + + return FReply::Handled(); + }) + ] + + SHorizontalBox::Slot() + .HAlign(HAlign_Right) + .AutoWidth() + .Padding(PaddingAmount) + [ + SNew(SButton) .Text(LOCTEXT("ExportToHTML", "Export To HTML")) - .OnClicked_Lambda([this]() -> FReply - { - IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); - - const void* ParentWindowWindowHandle = FSlateApplication::Get().FindBestParentWindowHandleForDialogs(nullptr); - - const FText Title = LOCTEXT("ExportToHTMLTitle", "Export Lint Report as HTML"); - const FString FileTypes = TEXT("HTML (*.html)|*.html"); - - const FDateTime Now = FDateTime::Now(); - const FString Output = TEXT("lint-report-") + Now.ToString() + TEXT(".html"); - - FString DefaultPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); - DefaultPath = FPaths::ConvertRelativePathToFull(DefaultPath); - IFileManager::Get().MakeDirectory(*DefaultPath, true); - - TArray OutFilenames; - DesktopPlatform->SaveFileDialog( - ParentWindowWindowHandle, - Title.ToString(), - DefaultPath, - Output, - FileTypes, - EFileDialogFlags::None, - OutFilenames - ); - - if (OutFilenames.Num() > 0) - { - const FString WritePath = FPaths::ConvertRelativePathToFull(OutFilenames[0]); - FFileHelper::SaveStringToFile(HTMLReport, *WritePath); - FPlatformProcess::LaunchURL(*WritePath, TEXT(""), nullptr); - } - - return FReply::Handled(); - }) - ] - ] - + SVerticalBox::Slot() - .VAlign(VAlign_Fill) - .FillHeight(1.0f) - .Padding(PaddingAmount) - [ - SAssignNew(AssetDetailsScrollBoxPtr, SScrollBox) - .ScrollBarAlwaysVisible(true) - ] - + SVerticalBox::Slot() - .VAlign(VAlign_Fill) - .FillHeight(1.0f) - .Padding(PaddingAmount) - [ - SAssignNew(RuleDetailsScrollBoxPtr, SScrollBox) + .OnClicked_Lambda([this]() -> FReply { + IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); + + const void* ParentWindowWindowHandle = FSlateApplication::Get().FindBestParentWindowHandleForDialogs(nullptr); + + const FText Title = LOCTEXT("ExportToHTMLTitle", "Export Lint Report as HTML"); + const FString FileTypes = TEXT("HTML (*.html)|*.html"); + + const FDateTime Now = FDateTime::Now(); + const FString Output = TEXT("lint-report-") + Now.ToString() + TEXT(".html"); + + FString DefaultPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); + DefaultPath = FPaths::ConvertRelativePathToFull(DefaultPath); + IFileManager::Get().MakeDirectory(*DefaultPath, true); + + TArray OutFilenames; + DesktopPlatform->SaveFileDialog( + ParentWindowWindowHandle, + Title.ToString(), + DefaultPath, + Output, + FileTypes, + EFileDialogFlags::None, + OutFilenames + ); + + if (OutFilenames.Num() > 0) { + const FString WritePath = FPaths::ConvertRelativePathToFull(OutFilenames[0]); + FFileHelper::SaveStringToFile(HTMLReport, *WritePath); + FPlatformProcess::LaunchURL(*WritePath, TEXT(""), nullptr); + } + + return FReply::Handled(); + }) + ] + ] + + SVerticalBox::Slot() + .VAlign(VAlign_Fill) + .FillHeight(1.0f) + .Padding(PaddingAmount) + [ + SAssignNew(AssetDetailsScrollBoxPtr, SScrollBox) + .ScrollBarAlwaysVisible(true) + ] + + SVerticalBox::Slot() + .VAlign(VAlign_Fill) + .FillHeight(1.0f) + .Padding(PaddingAmount) + [ + SAssignNew(RuleDetailsScrollBoxPtr, SScrollBox) .ScrollBarAlwaysVisible(true) .Visibility(EVisibility::Collapsed) - ] - // Bottom panel - + SVerticalBox::Slot() - .AutoHeight() - .VAlign(VAlign_Top) - [ - SNew(SBorder) + ] + // Bottom panel + + SVerticalBox::Slot() + .AutoHeight() + .VAlign(VAlign_Top) + [ + SNew(SBorder) .BorderImage(FAppStyle::GetBrush("NoBorder")) .Padding(FMargin(4.0f, 0.0f, 4.0f, 2.0f)) - //.Visibility_Lambda([&]() { return AssetErrorLists.Num() > 0 ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed; }) - [ - SNew(SBorder) + //.Visibility_Lambda([&]() { return AssetErrorLists.Num() > 0 ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed; }) + [ + SNew(SBorder) .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(FMargin(2.0f, 0.0f, 2.0f, 2.0f)) - [ - - SNew(SHorizontalBox) - // View mode combo button - +SHorizontalBox::Slot() - .FillWidth(1.f) - .VAlign(VAlign_Center) - .HAlign(HAlign_Right) - [ - SAssignNew( ViewOptionsComboButton, SComboButton ) + [ + + SNew(SHorizontalBox) + // View mode combo button + + SHorizontalBox::Slot() + .FillWidth(1.f) + .VAlign(VAlign_Center) + .HAlign(HAlign_Right) + [ + SAssignNew(ViewOptionsComboButton, SComboButton) .ContentPadding(0) - .ForegroundColor_Lambda([&]() { return ViewOptionsComboButton->IsHovered() ? FAppStyle::GetSlateColor("InvertedForeground") : FAppStyle::GetSlateColor("DefaultForeground"); }) - .ButtonStyle( FAppStyle::Get(), "ToggleButton" ) // Use the tool bar item style for this button - .OnGetMenuContent( this, &SLintReport::GetViewButtonContent ) + .ForegroundColor_Lambda([&]() { + return ViewOptionsComboButton->IsHovered() ? FAppStyle::GetSlateColor("InvertedForeground") : FAppStyle::GetSlateColor("DefaultForeground"); + }) + .ButtonStyle(FAppStyle::Get(), "ToggleButton") // Use the tool bar item style for this button + .OnGetMenuContent(this, &SLintReport::GetViewButtonContent) .ButtonContent() - [ - SNew(SHorizontalBox) - +SHorizontalBox::Slot() - .AutoWidth() - .VAlign(VAlign_Center) - [ - SNew(SImage).Image( FAppStyle::GetBrush("GenericViewButton") ) - ] - - +SHorizontalBox::Slot() - .AutoWidth() - .Padding(2, 0, 0, 0) - .VAlign(VAlign_Center) - [ - SNew(STextBlock).Text( LOCTEXT("ViewButton", "View Options") ) - ] - ] - ] - ] - ] - ] - ]; + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + .VAlign(VAlign_Center) + [ + SNew(SImage).Image(FAppStyle::GetBrush("GenericViewButton")) + ] + + + SHorizontalBox::Slot() + .AutoWidth() + .Padding(2, 0, 0, 0) + .VAlign(VAlign_Center) + [ + SNew(STextBlock).Text(LOCTEXT("ViewButton", "View Options")) + ] + ] + ] + ] + ] + ] + ]; } -void SLintReport::Rebuild(const ULintRuleSet* SelectedLintRuleSet) -{ - const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - - NumErrors = 0; - NumWarnings = 0; - bHasRanReport = false; - - if (SelectedLintRuleSet == nullptr) - { - SelectedLintRuleSet = GetDefault()->DefaultLintRuleSet.LoadSynchronous(); - } - - check(SelectedLintRuleSet != nullptr); - LastUsedRuleSet = SelectedLintRuleSet; - - AssetDetailsScrollBoxPtr->ClearChildren(); - RuleDetailsScrollBoxPtr->ClearChildren(); - RuleViolations.Reset(); - - FScopedSlowTask SlowTask(0, LOCTEXT("LintingInProgress", "Linting Assets...")); - SlowTask.MakeDialog(false); - - FLinterModule& LinterModule = FModuleManager::LoadModuleChecked(TEXT("Linter")); - TArray LintPaths = LinterModule.GetDesiredLintPaths(); - - RuleViolations = SelectedLintRuleSet->LintPathShared(LintPaths, &SlowTask); - - for (TSharedPtr Violation : RuleViolations) - { - if (Violation->ViolatedRule->GetDefaultObject()->RuleSeverity <= ELintRuleSeverity::Error) - { - NumErrors++; - } - else - { - NumWarnings++; - } - } - - TArray UniqueViolators = FLintRuleViolation::AllRuleViolationViolators(RuleViolations); - TSharedPtr ThumbnailPool = MakeShareable(new FAssetThumbnailPool(UniqueViolators.Num())); - - TSharedPtr RootJsonObject = MakeShareable(new FJsonObject); - TArray> ViolatorJsonObjects; - - for (UObject* Violator : UniqueViolators) - { - // We might as well build JSON data here as we're iterating through all our rule violations anyway - TSharedPtr AssetJsonObject = MakeShareable(new FJsonObject); - TArray> UniqueViolatorViolations = FLintRuleViolation::AllRuleViolationsWithViolatorShared(RuleViolations, Violator); - - FAssetData AssetData; - if (UniqueViolatorViolations.Num() > 0) - { - AssetData = UniqueViolatorViolations[0]->ViolatorAssetData; - AssetJsonObject->SetStringField(TEXT("ViolatorAssetName"), AssetData.AssetName.ToString()); +void SLintReport::Rebuild(const ULintRuleSet* SelectedLintRuleSet) { + const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); + + NumErrors = 0; + NumWarnings = 0; + bHasRanReport = false; + + if (SelectedLintRuleSet == nullptr) { + SelectedLintRuleSet = GetDefault()->DefaultLintRuleSet.LoadSynchronous(); + } + + check(SelectedLintRuleSet != nullptr); + LastUsedRuleSet = SelectedLintRuleSet; + + AssetDetailsScrollBoxPtr->ClearChildren(); + RuleDetailsScrollBoxPtr->ClearChildren(); + RuleViolations.Reset(); + + FScopedSlowTask SlowTask(0, LOCTEXT("LintingInProgress", "Linting Assets...")); + SlowTask.MakeDialog(false); + + FLinterModule& LinterModule = FModuleManager::LoadModuleChecked(TEXT("Linter")); + TArray LintPaths = LinterModule.GetDesiredLintPaths(); + + RuleViolations = SelectedLintRuleSet->LintPathShared(LintPaths, &SlowTask); + + for (TSharedPtr Violation : RuleViolations) { + if (Violation->ViolatedRule->GetDefaultObject()->RuleSeverity <= ELintRuleSeverity::Error) { + NumErrors++; + } else { + NumWarnings++; + } + } + + TArray UniqueViolators = FLintRuleViolation::AllRuleViolationViolators(RuleViolations); + TSharedPtr ThumbnailPool = MakeShareable(new FAssetThumbnailPool(UniqueViolators.Num())); + + TSharedPtr RootJsonObject = MakeShareable(new FJsonObject); + TArray> ViolatorJsonObjects; + + for (UObject* Violator : UniqueViolators) { + // We might as well build JSON data here as we're iterating through all our rule violations anyway + TSharedPtr AssetJsonObject = MakeShareable(new FJsonObject); + TArray> UniqueViolatorViolations = FLintRuleViolation::AllRuleViolationsWithViolatorShared(RuleViolations, Violator); + + FAssetData AssetData; + if (UniqueViolatorViolations.Num() > 0) { + AssetData = UniqueViolatorViolations[0]->ViolatorAssetData; + AssetJsonObject->SetStringField(TEXT("ViolatorAssetName"), AssetData.AssetName.ToString()); #if UE_VERSION_NEWER_THAN(5, 1, 0) - AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.GetObjectPathString()); + AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.GetObjectPathString()); #else - AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.ObjectPath.ToString()); + AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.ObjectPath.ToString()); #endif - AssetJsonObject->SetStringField(TEXT("ViolatorFullName"), AssetData.GetFullName()); - //@TODO: Thumbnail export? - - TArray> RuleViolationJsonObjects; - - for (TSharedPtr Violation : UniqueViolatorViolations) - { - ULintRule* LintRule = Violation->ViolatedRule->GetDefaultObject(); - check(LintRule != nullptr); - - TSharedPtr RuleJsonObject = MakeShareable(new FJsonObject); - RuleJsonObject->SetStringField(TEXT("RuleGroup"), LintRule->RuleGroup.ToString()); - RuleJsonObject->SetStringField(TEXT("RuleTitle"), LintRule->RuleTitle.ToString()); - RuleJsonObject->SetStringField(TEXT("RuleDesc"), LintRule->RuleDescription.ToString()); - RuleJsonObject->SetStringField(TEXT("RuleURL"), LintRule->RuleURL); - RuleJsonObject->SetNumberField(TEXT("RuleSeverity"), (int32)LintRule->RuleSeverity); - RuleJsonObject->SetStringField(TEXT("RuleRecommendedAction"), Violation->RecommendedAction.ToString()); - RuleViolationJsonObjects.Push(MakeShareable(new FJsonValueObject(RuleJsonObject))); - } - - AssetJsonObject->SetArrayField(TEXT("Violations"), RuleViolationJsonObjects); - } - - ViolatorJsonObjects.Add(MakeShareable(new FJsonValueObject(AssetJsonObject))); - - AssetDetailsScrollBoxPtr.Get()->AddSlot() - .HAlign(HAlign_Fill) - .VAlign(VAlign_Fill) - .Padding(PaddingAmount) - [ - SNew(SLintReportAssetDetails) + AssetJsonObject->SetStringField(TEXT("ViolatorFullName"), AssetData.GetFullName()); + //@TODO: Thumbnail export? + + TArray> RuleViolationJsonObjects; + + for (TSharedPtr Violation : UniqueViolatorViolations) { + ULintRule* LintRule = Violation->ViolatedRule->GetDefaultObject(); + check(LintRule != nullptr); + + TSharedPtr RuleJsonObject = MakeShareable(new FJsonObject); + RuleJsonObject->SetStringField(TEXT("RuleGroup"), LintRule->RuleGroup.ToString()); + RuleJsonObject->SetStringField(TEXT("RuleTitle"), LintRule->RuleTitle.ToString()); + RuleJsonObject->SetStringField(TEXT("RuleDesc"), LintRule->RuleDescription.ToString()); + RuleJsonObject->SetStringField(TEXT("RuleURL"), LintRule->RuleURL); + RuleJsonObject->SetNumberField(TEXT("RuleSeverity"), static_cast(LintRule->RuleSeverity)); + RuleJsonObject->SetStringField(TEXT("RuleRecommendedAction"), Violation->RecommendedAction.ToString()); + RuleViolationJsonObjects.Push(MakeShareable(new FJsonValueObject(RuleJsonObject))); + } + + AssetJsonObject->SetArrayField(TEXT("Violations"), RuleViolationJsonObjects); + } + + ViolatorJsonObjects.Add(MakeShareable(new FJsonValueObject(AssetJsonObject))); + + AssetDetailsScrollBoxPtr.Get()->AddSlot() + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) + .Padding(PaddingAmount) + [ + SNew(SLintReportAssetDetails) .AssetData(AssetData) .RuleViolations(UniqueViolatorViolations) .ThumbnailPool(ThumbnailPool) - ]; - } - - TMultiMap> ViolationsMappedByRule = FLintRuleViolation::AllRuleViolationsMappedByViolatedLintRuleShared(RuleViolations); - TSharedPtr RuleThumbnailPool = MakeShareable(new FAssetThumbnailPool(ViolationsMappedByRule.Num())); // Incase we ever want to render 'rule thumbnails' in the future - - TArray UniqueRules; - ViolationsMappedByRule.GetKeys(UniqueRules); - - for (const ULintRule* BrokenRule : UniqueRules) - { - TArray> ViolatorsOfBrokenRule; - ViolationsMappedByRule.MultiFind(BrokenRule, ViolatorsOfBrokenRule); - - if (ViolatorsOfBrokenRule.Num() > 0) - { - RuleDetailsScrollBoxPtr.Get()->AddSlot() - .HAlign(HAlign_Fill) - .VAlign(VAlign_Fill) - .Padding(PaddingAmount) - [ - SNew(SLintReportRuleDetails) + ]; + } + + TMultiMap> ViolationsMappedByRule = FLintRuleViolation::AllRuleViolationsMappedByViolatedLintRuleShared(RuleViolations); + TSharedPtr RuleThumbnailPool = MakeShareable(new FAssetThumbnailPool(ViolationsMappedByRule.Num())); // In case we ever want to render 'rule thumbnails' in the future + + TArray UniqueRules; + ViolationsMappedByRule.GetKeys(UniqueRules); + + for (const ULintRule* BrokenRule : UniqueRules) { + TArray> ViolatorsOfBrokenRule; + ViolationsMappedByRule.MultiFind(BrokenRule, ViolatorsOfBrokenRule); + + if (ViolatorsOfBrokenRule.Num() > 0) { + RuleDetailsScrollBoxPtr.Get()->AddSlot() + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) + .Padding(PaddingAmount) + [ + SNew(SLintReportRuleDetails) .RuleViolations(ViolatorsOfBrokenRule) .ThumbnailPool(RuleThumbnailPool) - ]; - } - } - - // Save off our JSON to a string - RootJsonObject->SetArrayField(TEXT("Violators"), ViolatorJsonObjects); - JsonReport.Empty(); - TSharedRef>> Writer = TJsonWriterFactory>::Create(&JsonReport); - FJsonSerializer::Serialize(RootJsonObject.ToSharedRef(), Writer); - - // Update Summary Text Block - int32 NumAssets = UniqueViolators.Num(); - FText ResultsSummary = FText::FormatNamed(LOCTEXT("ErrorWarningDisplay", "{NumAssets} {NumAssets}|plural(one=Asset,other=Assets), {NumErrors} {NumErrors}|plural(one=Error,other=Errors), {NumWarnings} {NumWarnings}|plural(one=Warning,other=Warnings)"), TEXT("NumAssets"), NumAssets, TEXT("NumErrors"), NumErrors, TEXT("NumWarnings"), NumWarnings); - ResultsTextBlockPtr->SetText(ResultsSummary); - - // Prepare the HTML Export - FString TemplatePath = FPaths::Combine(*IPluginManager::Get().FindPlugin(TEXT("Linter"))->GetBaseDir(), TEXT("Resources"), TEXT("LintReportTemplate.html")); - - if (FFileHelper::LoadFileToString(HTMLReport, *TemplatePath)) - { - HTMLReport.ReplaceInline(TEXT("{% TITLE %}"), *FPaths::GetBaseFilename(FPaths::GetProjectFilePath())); - HTMLReport.ReplaceInline(TEXT("{% RESULTS %}"), *ResultsSummary.ToString()); - HTMLReport.ReplaceInline(TEXT("{% LINT_REPORT %}"), *JsonReport); - } - - bHasRanReport = true; + ]; + } + } + + // Save off our JSON to a string + RootJsonObject->SetArrayField(TEXT("Violators"), ViolatorJsonObjects); + JsonReport.Empty(); + TSharedRef>> Writer = TJsonWriterFactory>::Create(&JsonReport); + FJsonSerializer::Serialize(RootJsonObject.ToSharedRef(), Writer); + + // Update Summary Text Block + int32 NumAssets = UniqueViolators.Num(); + FText ResultsSummary = FText::FormatNamed(LOCTEXT("ErrorWarningDisplay", "{NumAssets} {NumAssets}|plural(one=Asset,other=Assets), {NumErrors} {NumErrors}|plural(one=Error,other=Errors), {NumWarnings} {NumWarnings}|plural(one=Warning,other=Warnings)"), TEXT("NumAssets"), NumAssets, TEXT("NumErrors"), NumErrors, TEXT("NumWarnings"), NumWarnings); + ResultsTextBlockPtr->SetText(ResultsSummary); + + // Prepare the HTML Export + FString TemplatePath = FPaths::Combine(*IPluginManager::Get().FindPlugin(TEXT("Linter"))->GetBaseDir(), TEXT("Resources"), TEXT("LintReportTemplate.html")); + + if (FFileHelper::LoadFileToString(HTMLReport, *TemplatePath)) { + HTMLReport.ReplaceInline(TEXT("{% TITLE %}"), *FPaths::GetBaseFilename(FPaths::GetProjectFilePath())); + HTMLReport.ReplaceInline(TEXT("{% RESULTS %}"), *ResultsSummary.ToString()); + HTMLReport.ReplaceInline(TEXT("{% LINT_REPORT %}"), *JsonReport); + } + + bHasRanReport = true; } -TSharedRef SLintReport::GetViewButtonContent() -{ - FMenuBuilder MenuBuilder(/*bInShouldCloseWindowAfterMenuSelection=*/true, nullptr, TSharedPtr(), /*bCloseSelfOnly=*/ true); - - MenuBuilder.BeginSection("AssetViewType", LOCTEXT("ViewTypeHeading", "View Type")); - { - MenuBuilder.AddMenuEntry( - LOCTEXT("RuleFirstOption", "Assets by Guideline"), - LOCTEXT("RuleFirstOptionTooltip", "View failing assets as a categorized list of guidelines."), - FSlateIcon(), - FUIAction( - FExecuteAction::CreateLambda([&]() - { - if (AssetDetailsScrollBoxPtr.IsValid()) - { - AssetDetailsScrollBoxPtr->SetVisibility(EVisibility::SelfHitTestInvisible); - } - if (RuleDetailsScrollBoxPtr.IsValid()) - { - RuleDetailsScrollBoxPtr->SetVisibility(EVisibility::Collapsed); - } - }), - FCanExecuteAction(), - FIsActionChecked::CreateLambda([&]() { return AssetDetailsScrollBoxPtr.IsValid() && AssetDetailsScrollBoxPtr->GetVisibility().IsVisible(); }) - ), - NAME_None, - EUserInterfaceActionType::RadioButton - ); - - MenuBuilder.AddMenuEntry( - LOCTEXT("AssetsFirstOption", "Guidelines by Asset"), - LOCTEXT("AssetsFirstOptionTooltip", "View the failing assets one at a time with all their respective errors."), - FSlateIcon(), - FUIAction( - FExecuteAction::CreateLambda([&]() - { - if (AssetDetailsScrollBoxPtr.IsValid()) - { - AssetDetailsScrollBoxPtr->SetVisibility(EVisibility::Collapsed); - } - if (RuleDetailsScrollBoxPtr.IsValid()) - { - RuleDetailsScrollBoxPtr->SetVisibility(EVisibility::SelfHitTestInvisible); - } - }), - FCanExecuteAction(), - FIsActionChecked::CreateLambda([&]() { return RuleDetailsScrollBoxPtr.IsValid() && RuleDetailsScrollBoxPtr->GetVisibility().IsVisible(); }) - ), - NAME_None, - EUserInterfaceActionType::RadioButton - ); - } - - MenuBuilder.EndSection(); - - return MenuBuilder.MakeWidget(); +TSharedRef SLintReport::GetViewButtonContent() { + FMenuBuilder MenuBuilder(/*bInShouldCloseWindowAfterMenuSelection=*/true, nullptr, TSharedPtr(), /*bCloseSelfOnly=*/ true); + + MenuBuilder.BeginSection("AssetViewType", LOCTEXT("ViewTypeHeading", "View Type")); + { + MenuBuilder.AddMenuEntry( + LOCTEXT("RuleFirstOption", "Assets by Guideline"), + LOCTEXT("RuleFirstOptionTooltip", "View failing assets as a categorized list of guidelines."), + FSlateIcon(), + FUIAction( + FExecuteAction::CreateLambda([&]() { + if (AssetDetailsScrollBoxPtr.IsValid()) { + AssetDetailsScrollBoxPtr->SetVisibility(EVisibility::SelfHitTestInvisible); + } + if (RuleDetailsScrollBoxPtr.IsValid()) { + RuleDetailsScrollBoxPtr->SetVisibility(EVisibility::Collapsed); + } + }), + FCanExecuteAction(), + FIsActionChecked::CreateLambda([&]() { + return AssetDetailsScrollBoxPtr.IsValid() && AssetDetailsScrollBoxPtr->GetVisibility().IsVisible(); + }) + ), + NAME_None, + EUserInterfaceActionType::RadioButton + ); + + MenuBuilder.AddMenuEntry( + LOCTEXT("AssetsFirstOption", "Guidelines by Asset"), + LOCTEXT("AssetsFirstOptionTooltip", "View the failing assets one at a time with all their respective errors."), + FSlateIcon(), + FUIAction( + FExecuteAction::CreateLambda([&]() { + if (AssetDetailsScrollBoxPtr.IsValid()) { + AssetDetailsScrollBoxPtr->SetVisibility(EVisibility::Collapsed); + } + if (RuleDetailsScrollBoxPtr.IsValid()) { + RuleDetailsScrollBoxPtr->SetVisibility(EVisibility::SelfHitTestInvisible); + } + }), + FCanExecuteAction(), + FIsActionChecked::CreateLambda([&]() { + return RuleDetailsScrollBoxPtr.IsValid() && RuleDetailsScrollBoxPtr->GetVisibility().IsVisible(); + }) + ), + NAME_None, + EUserInterfaceActionType::RadioButton + ); + } + + MenuBuilder.EndSection(); + + return MenuBuilder.MakeWidget(); } -#undef LOCTEXT_NAMESPACE \ No newline at end of file +#undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintReportAssetDetails.cpp b/Source/Linter/Private/UI/LintReportAssetDetails.cpp index 0a440dc..1b5ebc4 100644 --- a/Source/Linter/Private/UI/LintReportAssetDetails.cpp +++ b/Source/Linter/Private/UI/LintReportAssetDetails.cpp @@ -14,128 +14,125 @@ #include "LintRule.h" #include "AssetThumbnail.h" #include "UI/LintReportAssetErrorList.h" +#include "Misc/EngineVersionComparison.h" #define LOCTEXT_NAMESPACE "LintReport" -void SLintReportAssetDetails::Construct(const FArguments& Args) -{ - AssetData = Args._AssetData; - RuleViolations = Args._RuleViolations; - ThumbnailPool = Args._ThumbnailPool; +#if UE_VERSION_OLDER_THAN(5, 1, 0) +using FAppStyle = FEditorStyle; +#endif - const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); +void SLintReportAssetDetails::Construct(const FArguments& Args) { + AssetData = Args._AssetData; + RuleViolations = Args._RuleViolations; + ThumbnailPool = Args._ThumbnailPool; - const FText AssetName = FText::FromString(AssetData.Get().AssetName.ToString()); - const FText AssetPath = FText::FromString(AssetData.Get().GetFullName()); + const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - const TSharedPtr AssetThumbnail = MakeShareable(new FAssetThumbnail(AssetData.Get().GetAsset(), 96, 96, ThumbnailPool.Get())); + const FText AssetName = FText::FromString(AssetData.Get().AssetName.ToString()); + const FText AssetPath = FText::FromString(AssetData.Get().GetFullName()); - int32 NumErrors = 0; - int32 NumWarnings = 0; + const TSharedPtr AssetThumbnail = MakeShareable(new FAssetThumbnail(AssetData.Get().GetAsset(), 96, 96, ThumbnailPool.Get())); - for (const TSharedPtr RuleViolation : RuleViolations.Get()) - { - switch (RuleViolation->ViolatedRule.Get()->GetDefaultObject()->RuleSeverity) - { - case ELintRuleSeverity::Error: - NumErrors++; - break; - case ELintRuleSeverity::Warning: - NumWarnings++; - break; - case ELintRuleSeverity::Info: - break; - //case ELintRuleSeverity::Ignore: - default: - break; - } - } + int32 NumErrors = 0; + int32 NumWarnings = 0; - ChildSlot - [ - SNew(SBorder) + for (const TSharedPtr RuleViolation : RuleViolations.Get()) { + switch (RuleViolation->ViolatedRule.Get()->GetDefaultObject()->RuleSeverity) { + case ELintRuleSeverity::Error: NumErrors++; + break; + case ELintRuleSeverity::Warning: NumWarnings++; + break; + case ELintRuleSeverity::Info: break; + //case ELintRuleSeverity::Ignore: + default: break; + } + } + + ChildSlot + [ + SNew(SBorder) .BorderImage(FAppStyle::GetBrush("NoBorder")) .Padding(PaddingAmount) - [ - SNew(SBorder) + [ + SNew(SBorder) .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(PaddingAmount) - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) - [ - SNew(SExpandableArea) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .AutoHeight() + .Padding(PaddingAmount) + [ + SNew(SExpandableArea) .InitiallyCollapsed(false) .HeaderContent() - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(STextBlock) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(STextBlock) .Text(AssetName) .TextStyle(FLinterStyle::Get(), "Linter.Report.AssetName") - ] - ] - .BodyContent() - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - .VAlign(VAlign_Top) - .Padding(PaddingAmount) - [ - SNew(SBox) + ] + ] + .BodyContent() + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + .VAlign(VAlign_Top) + .Padding(PaddingAmount) + [ + SNew(SBox) .WidthOverride(96.0f) .HeightOverride(96.0f) - [ - AssetThumbnail->MakeThumbnailWidget() - ] - ] - + SHorizontalBox::Slot() - .Padding(PaddingAmount) - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .AutoHeight() - .HAlign(HAlign_Left) - .Padding(PaddingAmount) - [ - SNew(SHyperlink) + [ + AssetThumbnail->MakeThumbnailWidget() + ] + ] + + SHorizontalBox::Slot() + .Padding(PaddingAmount) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .AutoHeight() + .HAlign(HAlign_Left) + .Padding(PaddingAmount) + [ + SNew(SHyperlink) .Text(AssetPath) - .OnNavigate_Lambda([&]() - { - const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); - FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); - TArray AssetDatas; - AssetDatas.Push(AssetData.Get()); - ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); - }) - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) - [ - SNew(STextBlock) + .OnNavigate_Lambda([&]() { + const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); + TArray AssetDatas; + AssetDatas.Push(AssetData.Get()); + ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); + }) + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(PaddingAmount) + [ + SNew(STextBlock) .Visibility((RuleViolations.Get().Num() > 0) ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed) .Text(FText::FormatNamed(LOCTEXT("ErrorWarningDisplay", "{NumErrors} {NumErrors}|plural(one=Error,other=Errors), {NumWarnings} {NumWarnings}|plural(one=Warning,other=Warnings)"), TEXT("NumErrors"), NumErrors, TEXT("NumWarnings"), NumWarnings)) - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) - [ - SNew(SLintReportAssetErrorList) - .RuleViolations(RuleViolations) - ] - ] - ] - ] - ] - ] - ]; + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(PaddingAmount) + [ + SNew(SLintReportAssetErrorList) + .RuleViolations(RuleViolations) + ] + ] + ] + ] + ] + ] + ]; } #undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintReportAssetError.cpp b/Source/Linter/Private/UI/LintReportAssetError.cpp index dd35b38..ea35e0c 100644 --- a/Source/Linter/Private/UI/LintReportAssetError.cpp +++ b/Source/Linter/Private/UI/LintReportAssetError.cpp @@ -5,108 +5,104 @@ #include "LinterStyle.h" #include "Widgets/SBoxPanel.h" #include "Widgets/Layout/SExpandableArea.h" -#include "Widgets/Input/SHyperlink.h" #include "LintRule.h" #include "Widgets/Layout/SBox.h" #define LOCTEXT_NAMESPACE "LintReport" -void SLintReportAssetError::Construct(const FArguments& Args) -{ - RuleViolation = Args._RuleViolation; - const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); +void SLintReportAssetError::Construct(const FArguments& Args) { + RuleViolation = Args._RuleViolation; + const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - const ULintRule* LintRule = RuleViolation.Get()->ViolatedRule.Get()->GetDefaultObject(); - check(LintRule != nullptr); + const ULintRule* LintRule = RuleViolation.Get()->ViolatedRule.Get()->GetDefaultObject(); + check(LintRule != nullptr); - const FSlateBrush* RuleIcon = nullptr; - const bool bHasURL = !LintRule->RuleURL.IsEmpty(); + const FSlateBrush* RuleIcon = nullptr; + const bool bHasURL = !LintRule->RuleURL.IsEmpty(); - switch (LintRule->RuleSeverity) - { - case ELintRuleSeverity::Error: - RuleIcon = FLinterStyle::Get()->GetBrush("Linter.Report.Error"); - break; - case ELintRuleSeverity::Warning: - RuleIcon = FLinterStyle::Get()->GetBrush("Linter.Report.Warning"); - break; - case ELintRuleSeverity::Info: - RuleIcon = FLinterStyle::Get()->GetBrush("Linter.Report.Info"); - break; - //case ELintRuleSeverity::Ignore: - default: - break; - } + switch (LintRule->RuleSeverity) { + case ELintRuleSeverity::Error: RuleIcon = FLinterStyle::Get()->GetBrush("Linter.Report.Error"); + break; + case ELintRuleSeverity::Warning: RuleIcon = FLinterStyle::Get()->GetBrush("Linter.Report.Warning"); + break; + case ELintRuleSeverity::Info: RuleIcon = FLinterStyle::Get()->GetBrush("Linter.Report.Info"); + break; + //case ELintRuleSeverity::Ignore: + default: break; + } - ChildSlot - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .AutoHeight() - .VAlign(VAlign_Center) - .Padding(PaddingAmount) - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .Padding(PaddingAmount) - .AutoWidth() - .VAlign(VAlign_Center) - .HAlign(HAlign_Left) - [ - SNew(SBox) + ChildSlot + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .AutoHeight() + .VAlign(VAlign_Center) + .Padding(PaddingAmount) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .Padding(PaddingAmount) + .AutoWidth() + .VAlign(VAlign_Center) + .HAlign(HAlign_Left) + [ + SNew(SBox) .WidthOverride(14.0f) .HeightOverride(14.0f) - [ - SNew(SImage) - .Image(RuleIcon) - ] - ] - + SHorizontalBox::Slot() - .Padding(PaddingAmount) - .AutoWidth() - .HAlign(HAlign_Left) - .VAlign(VAlign_Center) - [ - SNew(STextBlock) + [ + SNew(SImage) + .Image(RuleIcon) + ] + ] + + SHorizontalBox::Slot() + .Padding(PaddingAmount) + .AutoWidth() + .HAlign(HAlign_Left) + .VAlign(VAlign_Center) + [ + SNew(STextBlock) .Text(LintRule->RuleTitle) .TextStyle(FLinterStyle::Get(), "Linter.Report.RuleTitle") - ] - + SHorizontalBox::Slot() - .AutoWidth() - .HAlign(HAlign_Left) - .VAlign(VAlign_Center) - [ - SNew(SBox) + ] + + SHorizontalBox::Slot() + .AutoWidth() + .HAlign(HAlign_Left) + .VAlign(VAlign_Center) + [ + SNew(SBox) .WidthOverride(16.0f) .HeightOverride(16.0f) - [ - SNew(SImage) + [ + SNew(SImage) .Cursor(EMouseCursor::Hand) .Visibility(bHasURL ? EVisibility::Visible : EVisibility::Collapsed) - .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { FPlatformProcess::LaunchURL(*RuleViolation.Get()->ViolatedRule.Get()->GetDefaultObject()->RuleURL, nullptr, nullptr); return FReply::Handled(); }) + .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { + FPlatformProcess::LaunchURL(*RuleViolation.Get()->ViolatedRule.Get()->GetDefaultObject()->RuleURL, nullptr, nullptr); + return FReply::Handled(); + }) .Image(FLinterStyle::Get()->GetBrush("Linter.Report.Link")) - ] - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .VAlign(VAlign_Top) - .Padding(20.0f, PaddingAmount, PaddingAmount, PaddingAmount) - [ - SNew(STextBlock) + ] + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .VAlign(VAlign_Top) + .Padding(20.0f, PaddingAmount, PaddingAmount, PaddingAmount) + [ + SNew(STextBlock) .AutoWrapText(true) .Text(LintRule->RuleDescription) - ] - + SVerticalBox::Slot() - .AutoHeight() - .VAlign(VAlign_Top) - .Padding(20.0f, PaddingAmount, PaddingAmount, PaddingAmount) - [ - SNew(STextBlock) + ] + + SVerticalBox::Slot() + .AutoHeight() + .VAlign(VAlign_Top) + .Padding(20.0f, PaddingAmount, PaddingAmount, PaddingAmount) + [ + SNew(STextBlock) .AutoWrapText(true) .Text(RuleViolation.Get()->RecommendedAction) - ] - ]; + ] + ]; } #undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintReportAssetErrorList.cpp b/Source/Linter/Private/UI/LintReportAssetErrorList.cpp index ba62b51..465e1fa 100644 --- a/Source/Linter/Private/UI/LintReportAssetErrorList.cpp +++ b/Source/Linter/Private/UI/LintReportAssetErrorList.cpp @@ -2,32 +2,29 @@ #include "UI/LintReportAssetErrorList.h" #include "LinterStyle.h" -#include "IContentBrowserSingleton.h" #include "Framework/Views/ITypedTableView.h" #include "UI/LintReportAssetError.h" #include "LintRule.h" #define LOCTEXT_NAMESPACE "LintReport" -void SLintReportAssetErrorList::Construct(const FArguments& Args) -{ - RuleViolations = Args._RuleViolations; - const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); +void SLintReportAssetErrorList::Construct(const FArguments& Args) { + RuleViolations = Args._RuleViolations; + const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - ChildSlot - [ - SNew(SListView>) + ChildSlot + [ + SNew(SListView>) .SelectionMode(ESelectionMode::None) .ListItemsSource(&RuleViolations.Get()) - .OnGenerateRow_Lambda([&](const TSharedPtr InItem, const TSharedRef& OwnerTable) - { - return SNew(STableRow>, OwnerTable) - [ - SNew(SLintReportAssetError) - .RuleViolation(InItem) - ]; - }) - ]; + .OnGenerateRow_Lambda([&](const TSharedPtr InItem, const TSharedRef& OwnerTable) { + return SNew(STableRow>, OwnerTable) + [ + SNew(SLintReportAssetError) + .RuleViolation(InItem) + ]; + }) + ]; } #undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintReportRuleDetails.cpp b/Source/Linter/Private/UI/LintReportRuleDetails.cpp index 9586413..3746e81 100644 --- a/Source/Linter/Private/UI/LintReportRuleDetails.cpp +++ b/Source/Linter/Private/UI/LintReportRuleDetails.cpp @@ -9,197 +9,195 @@ #include "Widgets/Text/STextBlock.h" #include "LintRule.h" #include "AssetThumbnail.h" +#include "ContentBrowserModule.h" +#include "IContentBrowserSingleton.h" #include "LintReportRuleErrorList.h" +#include "SHyperlink.h" #include "Misc/EngineVersionComparison.h" - #define LOCTEXT_NAMESPACE "LintReport" -void SLintReportRuleDetails::Construct(const FArguments& Args) -{ - RuleViolations = Args._RuleViolations; - ThumbnailPool = Args._ThumbnailPool; - - const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - - check(RuleViolations.Get().Num() > 0 ); - ULintRule* BrokenRule = (RuleViolations.Get())[0]->ViolatedRule.GetDefaultObject(); - check(BrokenRule != nullptr); - - const FText RuleName = BrokenRule->RuleTitle; - const FText RuleDesc = BrokenRule->RuleDescription; - - RuleURL = BrokenRule->RuleURL; - - const FSlateBrush* RuleIcon = nullptr; - switch (BrokenRule->RuleSeverity) - { - case ELintRuleSeverity::Error: - RuleIcon = FLinterStyle::Get()->GetBrush("Linter.Report.Error"); - break; - case ELintRuleSeverity::Warning: - RuleIcon = FLinterStyle::Get()->GetBrush("Linter.Report.Warning"); - break; - case ELintRuleSeverity::Info: - RuleIcon = FLinterStyle::Get()->GetBrush("Linter.Report.Info"); - break; - //case ELintRuleSeverity::Ignore: - default: - break; - } - - const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); - const IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); +#if UE_VERSION_OLDER_THAN(5, 1, 0) +using FAppStyle = FEditorStyle; +#endif + +void SLintReportRuleDetails::Construct(const FArguments& Args) { + RuleViolations = Args._RuleViolations; + ThumbnailPool = Args._ThumbnailPool; + + const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); + + check(RuleViolations.Get().Num() > 0); + ULintRule* BrokenRule = (RuleViolations.Get())[0]->ViolatedRule.GetDefaultObject(); + check(BrokenRule != nullptr); + + const FText RuleName = BrokenRule->RuleTitle; + const FText RuleDesc = BrokenRule->RuleDescription; + + RuleURL = BrokenRule->RuleURL; + + const FSlateBrush* RuleIcon = nullptr; + switch (BrokenRule->RuleSeverity) { + case ELintRuleSeverity::Error: RuleIcon = FLinterStyle::Get()->GetBrush("Linter.Report.Error"); + break; + case ELintRuleSeverity::Warning: RuleIcon = FLinterStyle::Get()->GetBrush("Linter.Report.Warning"); + break; + case ELintRuleSeverity::Info: RuleIcon = FLinterStyle::Get()->GetBrush("Linter.Report.Info"); + break; + //case ELintRuleSeverity::Ignore: + default: break; + } + + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); + const IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); #if UE_VERSION_NEWER_THAN(5, 1, 0) - RuleAssetData = AssetRegistry.GetAssetByObjectPath(BrokenRule->GetPathName(), true); + RuleAssetData = AssetRegistry.GetAssetByObjectPath(BrokenRule->GetPathName(), true); #else - RuleAssetData = AssetRegistry.GetAssetByObjectPath(FName(*BrokenRule->GetPathName()), true); + RuleAssetData = AssetRegistry.GetAssetByObjectPath(FName(*BrokenRule->GetPathName()), true); #endif - FText RuleAssetPath; - if (RuleAssetData.IsValid()) - { - RuleAssetPath = FText::FromName(RuleAssetData.PackagePath); - } + FText RuleAssetPath; + if (RuleAssetData.IsValid()) { + RuleAssetPath = FText::FromName(RuleAssetData.PackagePath); + } - ChildSlot - [ - SNew(SBorder) + ChildSlot + [ + SNew(SBorder) .BorderImage(FAppStyle::GetBrush("NoBorder")) .Padding(PaddingAmount) - [ - SNew(SBorder) + [ + SNew(SBorder) .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(PaddingAmount) - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) - [ - SNew(SExpandableArea) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .AutoHeight() + .Padding(PaddingAmount) + [ + SNew(SExpandableArea) .InitiallyCollapsed(false) .HeaderContent() - [ - SNew(SHorizontalBox) - // Rule Thumbnail - + SHorizontalBox::Slot() - .AutoWidth() - .VAlign(VAlign_Top) - .Padding(PaddingAmount) - [ - SAssignNew(ThumbnailBox, SBox) + [ + SNew(SHorizontalBox) + // Rule Thumbnail + + SHorizontalBox::Slot() + .AutoWidth() + .VAlign(VAlign_Top) + .Padding(PaddingAmount) + [ + SAssignNew(ThumbnailBox, SBox) .WidthOverride(96.0f) .HeightOverride(96.0f) .Visibility(RuleAssetData.IsValid() ? EVisibility::HitTestInvisible : EVisibility::Collapsed) - ] - // Rule Icon - + SHorizontalBox::Slot() - .Padding(PaddingAmount) - .AutoWidth() - .VAlign(VAlign_Center) - .HAlign(HAlign_Left) - [ - SNew(SBox) + ] + // Rule Icon + + SHorizontalBox::Slot() + .Padding(PaddingAmount) + .AutoWidth() + .VAlign(VAlign_Center) + .HAlign(HAlign_Left) + [ + SNew(SBox) .WidthOverride(14.0f) .HeightOverride(14.0f) - [ - SNew(SImage) - .Image(RuleIcon) - ] - ] - // Rule Name - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(STextBlock) + [ + SNew(SImage) + .Image(RuleIcon) + ] + ] + // Rule Name + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(STextBlock) .Text(RuleName) .TextStyle(FLinterStyle::Get(), "Linter.Report.AssetName") - ] - // Link to Rule URL - + SHorizontalBox::Slot() - .AutoWidth() - .Padding(8.0f, 0.0) - [ - SNew(SImage) + ] + // Link to Rule URL + + SHorizontalBox::Slot() + .AutoWidth() + .Padding(8.0f, 0.0) + [ + SNew(SImage) .Image(FLinterStyle::Get()->GetBrush("Linter.Report.Link")) .Cursor(EMouseCursor::Hand) .Visibility(RuleURL.IsEmpty() ? EVisibility::Collapsed : EVisibility::Visible) - .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { FPlatformProcess::LaunchURL(*RuleURL, nullptr, nullptr); return FReply::Handled(); }) - ] - // Link to Rule Definition Asset - + SHorizontalBox::Slot() - .AutoWidth() - .Padding(8.0f, 0.0) - [ - SNew(SImage) + .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { + FPlatformProcess::LaunchURL(*RuleURL, nullptr, nullptr); + return FReply::Handled(); + }) + ] + // Link to Rule Definition Asset + + SHorizontalBox::Slot() + .AutoWidth() + .Padding(8.0f, 0.0) + [ + SNew(SImage) .Image(FLinterStyle::Get()->GetBrush("Linter.Report.Link")) .Cursor(EMouseCursor::Hand) .Visibility(EVisibility::Collapsed) - .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) - { - const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); - ContentBrowserModule.Get().SyncBrowserToAssets(TArray({ RuleAssetData })); - return FReply::Handled(); - }) - ] - // Asset Count - + SHorizontalBox::Slot() - .VAlign(VAlign_Center) - .AutoWidth() - .Padding(8.0f, 0.0) - [ - SNew(SHyperlink) + .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { + const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + ContentBrowserModule.Get().SyncBrowserToAssets(TArray({RuleAssetData})); + return FReply::Handled(); + }) + ] + // Asset Count + + SHorizontalBox::Slot() + .VAlign(VAlign_Center) + .AutoWidth() + .Padding(8.0f, 0.0) + [ + SNew(SHyperlink) .Text(FText::FormatNamed(LOCTEXT("AssetCountDisplay", "{NumAssets} {NumAssets}|plural(one=Asset,other=Assets)"), TEXT("NumAssets"), RuleViolations.Get().Num())) - .OnNavigate_Lambda([&]() - { - const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); - TArray AssetDatas; - - for (const TSharedPtr& RuleViolation : RuleViolations.Get()) - { - AssetDatas.Push(RuleViolation->ViolatorAssetData); - } - - ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); - }) - ] - ] - .BodyContent() - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .Padding(PaddingAmount) - .HAlign(HAlign_Left) - .AutoHeight() - [ - SNew(STextBlock) + .OnNavigate_Lambda([&]() { + const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + TArray AssetDatas; + + for (const TSharedPtr& RuleViolation : RuleViolations.Get()) { + AssetDatas.Push(RuleViolation->ViolatorAssetData); + } + + ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); + }) + ] + ] + .BodyContent() + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .Padding(PaddingAmount) + .HAlign(HAlign_Left) + .AutoHeight() + [ + SNew(STextBlock) .Text(RuleDesc) .AutoWrapText(true) .TextStyle(FLinterStyle::Get(), "Linter.Report.AssetName") - ] - + SVerticalBox::Slot() - .Padding(PaddingAmount) - .HAlign(HAlign_Left) - .AutoHeight() - [ - SNew(SLintReportRuleErrorList) - .RuleViolations(RuleViolations) - ] - ] - ] - ] - ] - ]; - - if (RuleAssetData.IsValid()) - { - const TSharedPtr RuleThumbnail = MakeShareable(new FAssetThumbnail(RuleAssetData, 96, 96, ThumbnailPool.Get())); - ThumbnailBox->SetContent(RuleThumbnail->MakeThumbnailWidget()); - } + ] + + SVerticalBox::Slot() + .Padding(PaddingAmount) + .HAlign(HAlign_Left) + .AutoHeight() + [ + SNew(SLintReportRuleErrorList) + .RuleViolations(RuleViolations) + ] + ] + ] + ] + ] + ]; + + if (RuleAssetData.IsValid()) { + const TSharedPtr RuleThumbnail = MakeShareable(new FAssetThumbnail(RuleAssetData, 96, 96, ThumbnailPool.Get())); + ThumbnailBox->SetContent(RuleThumbnail->MakeThumbnailWidget()); + } } #undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintReportRuleError.cpp b/Source/Linter/Private/UI/LintReportRuleError.cpp index 2996aec..af985af 100644 --- a/Source/Linter/Private/UI/LintReportRuleError.cpp +++ b/Source/Linter/Private/UI/LintReportRuleError.cpp @@ -14,53 +14,51 @@ #define LOCTEXT_NAMESPACE "LintReport" -void SLintReportRuleError::Construct(const FArguments& Args) -{ - RuleViolation = Args._RuleViolation; - const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); +void SLintReportRuleError::Construct(const FArguments& Args) { + RuleViolation = Args._RuleViolation; + const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - ChildSlot - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .AutoHeight() - .VAlign(VAlign_Center) - .Padding(PaddingAmount) - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .Padding(PaddingAmount) - .AutoWidth() - .HAlign(HAlign_Left) - .VAlign(VAlign_Center) - [ - SNew(SHyperlink) + ChildSlot + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .AutoHeight() + .VAlign(VAlign_Center) + .Padding(PaddingAmount) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .Padding(PaddingAmount) + .AutoWidth() + .HAlign(HAlign_Left) + .VAlign(VAlign_Center) + [ + SNew(SHyperlink) .Text(FText::FromName(RuleViolation.Get()->ViolatorAssetData.PackageName)) - .OnNavigate_Lambda([&]() - { - const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); - const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); - TArray AssetDatas; + .OnNavigate_Lambda([&]() { + const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); + TArray AssetDatas; #if UE_VERSION_NEWER_THAN(5, 1, 0) - AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(RuleViolation.Get()->ViolatorAssetData.GetSoftObjectPath())); + AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(RuleViolation.Get()->ViolatorAssetData.GetSoftObjectPath())); #else - AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(RuleViolation.Get()->ViolatorAssetData.ObjectPath)); + AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(RuleViolation.Get()->ViolatorAssetData.ObjectPath)); #endif - ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); - }) - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - .VAlign(VAlign_Top) - .Padding(20.0f, PaddingAmount, PaddingAmount, PaddingAmount) - [ - SNew(STextBlock) + ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); + }) + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .VAlign(VAlign_Top) + .Padding(20.0f, PaddingAmount, PaddingAmount, PaddingAmount) + [ + SNew(STextBlock) .AutoWrapText(true) .Text(RuleViolation.Get()->RecommendedAction) .Visibility(RuleViolation.Get()->RecommendedAction.IsEmpty() ? EVisibility::Collapsed : EVisibility::SelfHitTestInvisible) - ] - ]; + ] + ]; } #undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintReportRuleErrorList.cpp b/Source/Linter/Private/UI/LintReportRuleErrorList.cpp index 8929431..0e075a6 100644 --- a/Source/Linter/Private/UI/LintReportRuleErrorList.cpp +++ b/Source/Linter/Private/UI/LintReportRuleErrorList.cpp @@ -2,31 +2,28 @@ #include "UI/LintReportRuleErrorList.h" #include "LinterStyle.h" -#include "IContentBrowserSingleton.h" #include "Framework/Views/ITypedTableView.h" #include "LintRule.h" #include "UI/LintReportRuleError.h" #define LOCTEXT_NAMESPACE "LintReport" -void SLintReportRuleErrorList::Construct(const FArguments& Args) -{ - RuleViolations = Args._RuleViolations; - const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - ChildSlot - [ - SNew(SListView>) +void SLintReportRuleErrorList::Construct(const FArguments& Args) { + RuleViolations = Args._RuleViolations; + const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); + ChildSlot + [ + SNew(SListView>) .SelectionMode(ESelectionMode::None) .ListItemsSource(&RuleViolations.Get()) - .OnGenerateRow_Lambda([&](const TSharedPtr InItem, const TSharedRef& OwnerTable) - { - return SNew(STableRow>, OwnerTable) - [ - SNew(SLintReportRuleError) - .RuleViolation(InItem) - ]; - }) - ]; + .OnGenerateRow_Lambda([&](const TSharedPtr InItem, const TSharedRef& OwnerTable) { + return SNew(STableRow>, OwnerTable) + [ + SNew(SLintReportRuleError) + .RuleViolation(InItem) + ]; + }) + ]; } #undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintWizard.cpp b/Source/Linter/Private/UI/LintWizard.cpp index c816ee2..3998bd9 100644 --- a/Source/Linter/Private/UI/LintWizard.cpp +++ b/Source/Linter/Private/UI/LintWizard.cpp @@ -37,60 +37,56 @@ using FAppStyle = FEditorStyle; #endif BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION -void SLintWizard::Construct(const FArguments& InArgs) -{ - const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); +void SLintWizard::Construct(const FArguments& InArgs) { + const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - RuleSets = TArray>(); - // Try to load the default rule set - const ULintRuleSet* DefaultRuleSet = GetDefault()->DefaultLintRuleSet.LoadSynchronous(); + RuleSets = TArray>(); - // Even though this happens on module startup, we try force loading all rule sets again in case any new unloaded rule sets have been added - // or for some reason our existing rule sets were unloaded from memory - const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(FName("AssetRegistry")); - const IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); + // Try to load the default rule set + const ULintRuleSet* DefaultRuleSet = GetDefault()->DefaultLintRuleSet.LoadSynchronous(); - TArray FoundRuleSets; + // Even though this happens on module startup, we try force loading all rule sets again in case any new unloaded rule sets have been added + // or for some reason our existing rule sets were unloaded from memory + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(FName("AssetRegistry")); + const IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); + + TArray FoundRuleSets; #if UE_VERSION_NEWER_THAN(5, 1, 0) - AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetClassPathName(), FoundRuleSets, true); + AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetClassPathName(), FoundRuleSets, true); #else - AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetFName(), FoundRuleSets, true); + AssetRegistry.GetAssetsByClass(ULintRuleSet::StaticClass()->GetFName(), FoundRuleSets, true); #endif - - - // Attempt to get all RuleSets in memory so that linting tools are better aware of them - for (const FAssetData& RuleSetData : FoundRuleSets) - { - const ULintRuleSet* LoadedRuleSet = Cast(RuleSetData.GetAsset()); - if (LoadedRuleSet != nullptr) - { - FAssetData* newData = new FAssetData; - *newData = RuleSetData; - RuleSets.Push(MakeShareable(newData)); - if (LoadedRuleSet == DefaultRuleSet) - { - SelectedRuleSet = RuleSets.Last(); - } - } - } - - if (!SelectedRuleSet.IsValid() && RuleSets.Num() > 0) - { - SelectedRuleSet = RuleSets[0]; - } - - ChildSlot - [ - SNew(SBorder) + + + // Attempt to get all RuleSets in memory so that linting tools are better aware of them + for (const FAssetData& RuleSetData : FoundRuleSets) { + const ULintRuleSet* LoadedRuleSet = Cast(RuleSetData.GetAsset()); + if (LoadedRuleSet != nullptr) { + FAssetData* newData = new FAssetData; + *newData = RuleSetData; + RuleSets.Push(MakeShareable(newData)); + if (LoadedRuleSet == DefaultRuleSet) { + SelectedRuleSet = RuleSets.Last(); + } + } + } + + if (!SelectedRuleSet.IsValid() && RuleSets.Num() > 0) { + SelectedRuleSet = RuleSets[0]; + } + + ChildSlot + [ + SNew(SBorder) .Padding(18) .BorderImage(FAppStyle::GetBrush("Docking.Tab.ContentAreaBrush")) - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - [ - SAssignNew(MainWizard, SWizard) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + [ + SAssignNew(MainWizard, SWizard) .ShowPageList(false) .ShowCancelButton(false) .ButtonStyle(FAppStyle::Get(), "FlatButton.Default") @@ -98,593 +94,583 @@ void SLintWizard::Construct(const FArguments& InArgs) .FinishButtonStyle(FAppStyle::Get(), "FlatButton.Success") .ButtonTextStyle(FAppStyle::Get(), "LargeText") #if UE_VERSION_OLDER_THAN(5, 0, 0) - .ForegroundColor(FEditorStyle::Get().GetSlateColor("WhiteBrush")) + .ForegroundColor(FEditorStyle::Get().GetSlateColor("WhiteBrush")) #endif - .CanFinish(true) - .FinishButtonText(LOCTEXT("FinishButtonText", "Close")) - .OnFinished_Lambda([&]() - { + .CanFinish(true) + .FinishButtonText(LOCTEXT("FinishButtonText", "Close")) + .OnFinished_Lambda([&]() { #if UE_VERSION_NEWER_THAN(4, 26, 0) - FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab"))->RequestCloseTab(); + FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab"))->RequestCloseTab(); #else FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab"))->RequestCloseTab(); #endif - }) - + SWizard::Page() - .CanShow_Lambda([&]() { return RuleSets.Num() > 0; }) - [ - SNew(SVerticalBox) - // Title - +SVerticalBox::Slot() - .AutoHeight() - .Padding(0) - [ - SNew(STextBlock) - .TextStyle( FAppStyle::Get(), "NewClassDialog.PageTitle" ) + }) + + SWizard::Page() + .CanShow_Lambda([&]() { + return RuleSets.Num() > 0; + }) + [ + SNew(SVerticalBox) + // Title + + SVerticalBox::Slot() + .AutoHeight() + .Padding(0) + [ + SNew(STextBlock) + .TextStyle(FAppStyle::Get(), "NewClassDialog.PageTitle") .Text(LOCTEXT("LinterSelectionTitle", "Linter Rule Set Selection")) - ] - // Title spacer - +SVerticalBox::Slot() - .AutoHeight() - .Padding(0, 2, 0, 8) - [ - SNew(SSeparator) - ] - // Linter Selection - +SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) - [ - SAssignNew(RuleSetSelectionComboBox, SComboBox>) + ] + // Title spacer + + SVerticalBox::Slot() + .AutoHeight() + .Padding(0, 2, 0, 8) + [ + SNew(SSeparator) + ] + // Linter Selection + + SVerticalBox::Slot() + .AutoHeight() + .Padding(PaddingAmount) + [ + SAssignNew(RuleSetSelectionComboBox, SComboBox>) .OptionsSource(&RuleSets) .InitiallySelectedItem(SelectedRuleSet) - .OnGenerateWidget_Lambda([&](TSharedPtr LintRuleSet) - { - ULintRuleSet* RuleSet = Cast(LintRuleSet->GetAsset()); - if (RuleSet != nullptr) - { - return SNew(STextBlock).Text(RuleSet->RuleSetDescription.IsEmpty() ? FText::FromString(RuleSet->GetPathName()) : RuleSet->RuleSetDescription); - } - return SNew(STextBlock).Text(FText::FromString(TEXT("This Lint Rule Set Failed To Load? Uhhhh...."))); - }) - .OnSelectionChanged_Lambda([&](TSharedPtr Item, ESelectInfo::Type SelectInfo) { SelectedRuleSet = Item; RuleSetSelectionComboBox->RefreshOptions(); }) + .OnGenerateWidget_Lambda([&](TSharedPtr LintRuleSet) { + ULintRuleSet* RuleSet = Cast(LintRuleSet->GetAsset()); + if (RuleSet != nullptr) { + return SNew(STextBlock).Text(RuleSet->RuleSetDescription.IsEmpty() ? FText::FromString(RuleSet->GetPathName()) : RuleSet->RuleSetDescription); + } + return SNew(STextBlock).Text(FText::FromString(TEXT("This Lint Rule Set Failed To Load? Uhhhh...."))); + }) + .OnSelectionChanged_Lambda([&](TSharedPtr Item, ESelectInfo::Type SelectInfo) { + SelectedRuleSet = Item; + RuleSetSelectionComboBox->RefreshOptions(); + }) .ContentPadding(4.0f) - [ - SNew(STextBlock) - .Text_Lambda([&]() { return SelectedRuleSet->GetAsset() != nullptr ? Cast(SelectedRuleSet->GetAsset())->RuleSetDescription : FText::GetEmpty(); }) - ] - ] - ] - // Lint Report - + SWizard::Page() - .OnEnter(this, &SLintWizard::OnLintReportEntered) - .CanShow_Lambda([&]() { return RuleSets.Num() >= 1 && SelectedRuleSet.IsValid(); }) - [ - SNew(SVerticalBox) - // Title - + SVerticalBox::Slot() - .AutoHeight() - .Padding(0) - [ - SNew(STextBlock) - .TextStyle( FAppStyle::Get(), "NewClassDialog.PageTitle" ) + [ + SNew(STextBlock) + .Text_Lambda([&]() { + return SelectedRuleSet->GetAsset() != nullptr ? Cast(SelectedRuleSet->GetAsset())->RuleSetDescription : FText::GetEmpty(); + }) + ] + ] + ] + // Lint Report + + SWizard::Page() + .OnEnter(this, &SLintWizard::OnLintReportEntered) + .CanShow_Lambda([&]() { + return RuleSets.Num() >= 1 && SelectedRuleSet.IsValid(); + }) + [ + SNew(SVerticalBox) + // Title + + SVerticalBox::Slot() + .AutoHeight() + .Padding(0) + [ + SNew(STextBlock) + .TextStyle(FAppStyle::Get(), "NewClassDialog.PageTitle") .Text(LOCTEXT("LinterReportTitle", "Lint Report")) - ] - // Marketplace No Errors Required Text - + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) - [ - SNew(STextBlock) + ] + // Marketplace No Errors Required Text + + SVerticalBox::Slot() + .AutoHeight() + .Padding(PaddingAmount) + [ + SNew(STextBlock) .Text(LOCTEXT("MarketplaceNoErrorsRequired", "The Epic Marketplace requires you to have zero linting errors before submission and approval.")) - .Visibility_Lambda([&]() { return (LintReport.IsValid() && LintReport->bHasRanReport && LintReport->NumErrors > 0 && LintReport->LastUsedRuleSet != nullptr && LintReport->LastUsedRuleSet->bShowMarketplacePublishingInfoInLintWizard) ? EVisibility::HitTestInvisible : EVisibility::Collapsed; }) - ] - // Title spacer - +SVerticalBox::Slot() - .AutoHeight() - .Padding(0, 2, 0, 8) - [ - SNew(SSeparator) - ] - // Linter Report - +SVerticalBox::Slot() - .FillHeight(1.0f) - .VAlign(VAlign_Fill) - .HAlign(HAlign_Fill) - .Padding(PaddingAmount) - [ - SAssignNew(LintReport, SLintReport) - ] - ] - // Marketplace Info Page - + SWizard::Page() - .OnEnter(this, &SLintWizard::OnMarketplaceRecommendationsEntered) - .CanShow_Lambda([&]() { return LintReport.IsValid() && LintReport->bHasRanReport && LintReport->NumErrors <= 0 && LintReport->LastUsedRuleSet != nullptr && LintReport->LastUsedRuleSet->bShowMarketplacePublishingInfoInLintWizard; }) - [ - SNew(SVerticalBox) - // Title - +SVerticalBox::Slot() - .AutoHeight() - .Padding(0) - [ - SNew(STextBlock) - .TextStyle( FAppStyle::Get(), "NewClassDialog.PageTitle" ) + .Visibility_Lambda([&]() { + return (LintReport.IsValid() && LintReport->bHasRanReport && LintReport->NumErrors > 0 && LintReport->LastUsedRuleSet != nullptr && LintReport->LastUsedRuleSet->bShowMarketplacePublishingInfoInLintWizard) ? EVisibility::HitTestInvisible : EVisibility::Collapsed; + }) + ] + // Title spacer + + SVerticalBox::Slot() + .AutoHeight() + .Padding(0, 2, 0, 8) + [ + SNew(SSeparator) + ] + // Linter Report + + SVerticalBox::Slot() + .FillHeight(1.0f) + .VAlign(VAlign_Fill) + .HAlign(HAlign_Fill) + .Padding(PaddingAmount) + [ + SAssignNew(LintReport, SLintReport) + ] + ] + // Marketplace Info Page + + SWizard::Page() + .OnEnter(this, &SLintWizard::OnMarketplaceRecommendationsEntered) + .CanShow_Lambda([&]() { + return LintReport.IsValid() && LintReport->bHasRanReport && LintReport->NumErrors <= 0 && LintReport->LastUsedRuleSet != nullptr && LintReport->LastUsedRuleSet->bShowMarketplacePublishingInfoInLintWizard; + }) + [ + SNew(SVerticalBox) + // Title + + SVerticalBox::Slot() + .AutoHeight() + .Padding(0) + [ + SNew(STextBlock) + .TextStyle(FAppStyle::Get(), "NewClassDialog.PageTitle") .Text(LOCTEXT("MarketplaceInfoTitle", "Marketplace Recommendations")) - ] - // Title spacer - +SVerticalBox::Slot() - .AutoHeight() - .Padding(0, 2, 0, 8) - [ - SNew(SSeparator) - ] - + SVerticalBox::Slot() - .FillHeight(1.0f) - [ - SNew(SScrollBox) - + SScrollBox::Slot() - [ - SNew(SVerticalBox) - // Disclaimer - + SVerticalBox::Slot() - .VAlign(VAlign_Top) - .AutoHeight() - [ - SNew(SBorder) + ] + // Title spacer + + SVerticalBox::Slot() + .AutoHeight() + .Padding(0, 2, 0, 8) + [ + SNew(SSeparator) + ] + + SVerticalBox::Slot() + .FillHeight(1.0f) + [ + SNew(SScrollBox) + + SScrollBox::Slot() + [ + SNew(SVerticalBox) + // Disclaimer + + SVerticalBox::Slot() + .VAlign(VAlign_Top) + .AutoHeight() + [ + SNew(SBorder) .BorderImage(FAppStyle::GetBrush("NoBorder")) .Padding(PaddingAmount) - [ - SNew(SBorder) + [ + SNew(SBorder) .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(PaddingAmount) - [ - SNew(SHorizontalBox) - // Info image - + SHorizontalBox::Slot() - .AutoWidth() - .VAlign(VAlign_Center) - .Padding(28.0f, 8.0f) - [ - SNew(SImage).Image(FLinterStyle::Get()->GetBrush("Linter.Report.Info")) - ] - // Disclaimer text - +SHorizontalBox::Slot() - .VAlign(VAlign_Center) - .FillWidth(1.0f) - [ - SNew(SRichTextBlock) + [ + SNew(SHorizontalBox) + // Info image + + SHorizontalBox::Slot() + .AutoWidth() + .VAlign(VAlign_Center) + .Padding(28.0f, 8.0f) + [ + SNew(SImage).Image(FLinterStyle::Get()->GetBrush("Linter.Report.Info")) + ] + // Disclaimer text + + SHorizontalBox::Slot() + .VAlign(VAlign_Center) + .FillWidth(1.0f) + [ + SNew(SRichTextBlock) .Text(LOCTEXT("SuccessDisclaimer", "This product has successfully passed the Marketplace Guidlines Linter scan. Please note, however, that this does not guarantee this product's acceptance onto the Marketplace. We also recommend that you take the following actions listed below.")) .AutoWrapText(true) .TextStyle(FLinterStyle::Get(), "Linter.Report.DescriptionText") - ] - ] - ] - ] - // Fix Up Redirectors step widget - + SVerticalBox::Slot() - .AutoHeight() - .VAlign(VAlign_Fill) - .HAlign(HAlign_Fill) - .Padding(PaddingAmount) - [ - SNew(SStepWidget) + ] + ] + ] + ] + // Fix Up Redirectors step widget + + SVerticalBox::Slot() + .AutoHeight() + .VAlign(VAlign_Fill) + .HAlign(HAlign_Fill) + .Padding(PaddingAmount) + [ + SNew(SStepWidget) .StepName(LOCTEXT("FixUpRedirectsStepName", "Fix Up Redirectors")) .StepDesc(LOCTEXT("FixUpRedirectsStepDesc", "Resave all packages that point to redirectors in your project, and delete those redirectors if able to resave all the things referencing them.")) .Icon(FLinterStyle::Get()->GetBrush("Linter.Step.FixUpRedirects.Thumbnail")) .ShowStepStatusIcon(false) - .StepStatus_Lambda([this]() { return FixUpRedirectorStatus; }) + .StepStatus_Lambda([this]() { + return FixUpRedirectorStatus; + }) .StepActionText(LOCTEXT("FixUpRedirectsStepAction", "Fix Up Redirectors")) - .OnPerformAction_Lambda([this](FScopedSlowTask& ScopedSlowTask) - { - FixUpRedirectorStatus = InProgress; - bool bSuccess = true; - - const FAssetRegistryModule& AssetRegistryModule = FModuleManager::Get().LoadModuleChecked(TEXT("AssetRegistry")); - ScopedSlowTask.EnterProgressFrame(0, LOCTEXT("Linter.FixUpRedirects.FindingRedirectors", "Looking For redirectors...")); - - // Form a filter from the paths - FARFilter Filter; - Filter.bRecursivePaths = true; - Filter.PackagePaths.Add("/Game"); + .OnPerformAction_Lambda([this](FScopedSlowTask& ScopedSlowTask) { + FixUpRedirectorStatus = InProgress; + bool bSuccess = true; + + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::Get().LoadModuleChecked(TEXT("AssetRegistry")); + ScopedSlowTask.EnterProgressFrame(0, LOCTEXT("Linter.FixUpRedirects.FindingRedirectors", "Looking For redirectors...")); + + // Form a filter from the paths + FARFilter Filter; + Filter.bRecursivePaths = true; + Filter.PackagePaths.Add("/Game"); #if UE_VERSION_NEWER_THAN(5, 1, 0) - Filter.ClassPaths.Add(FTopLevelAssetPath{"ObjectRedirector"}); + Filter.ClassPaths.Add(FTopLevelAssetPath{"ObjectRedirector"}); #else - Filter.ClassNames.Add("ObjectRedirector"); + Filter.ClassNames.Add("ObjectRedirector"); #endif - // Query for a list of assets in the selected paths - TArray AssetList; - AssetRegistryModule.Get().GetAssets(Filter, AssetList); + // Query for a list of assets in the selected paths + TArray AssetList; + AssetRegistryModule.Get().GetAssets(Filter, AssetList); - if (AssetList.Num() > 0) - { - TArray ObjectPaths; - for (const auto& Asset : AssetList) - { + if (AssetList.Num() > 0) { + TArray ObjectPaths; + for (const auto& Asset : AssetList) { #if UE_VERSION_NEWER_THAN(5, 1, 0) - ObjectPaths.Add(Asset.GetObjectPathString()); + ObjectPaths.Add(Asset.GetObjectPathString()); #else - ObjectPaths.Add(Asset.ObjectPath.ToString()); + ObjectPaths.Add(Asset.ObjectPath.ToString()); #endif - } - - ScopedSlowTask.EnterProgressFrame(0.25f, LOCTEXT("Linter.FixUpRedirects.LoadingRedirectors", "Loading redirectors...")); - - TArray Objects; - if (LoadAssetsIfNeeded(ObjectPaths, Objects)) - { - // Transform Objects array to ObjectRedirectors array - TArray Redirectors; - for (auto&& Object : Objects) - { - auto Redirector = CastChecked(Object); - Redirectors.Add(Redirector); - } - - ScopedSlowTask.EnterProgressFrame(0.25f, LOCTEXT("Linter.FixUpRedirects.FixingRedirectors", "Fixing up redirectors...")); - - // Load the asset tools module - FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked(TEXT("AssetTools")); - AssetToolsModule.Get().FixupReferencers(Redirectors); - } - else - { - FNotificationInfo NotificationInfo(LOCTEXT("FixUpRedirectorsFailed", "Linter failed to load an object redirector when trying to fix up all redirectors.")); - NotificationInfo.ExpireDuration = 6.0f; - NotificationInfo.Hyperlink = FSimpleDelegate::CreateStatic([]() { FMessageLog("LoadErrors").Open(EMessageSeverity::Info, true); }); - NotificationInfo.HyperlinkText = LOCTEXT("LoadObjectHyperlink", "Show Message Log"); - FSlateNotificationManager::Get().AddNotification(NotificationInfo); - bSuccess = false; - } - } - - FixUpRedirectorStatus = bSuccess ? Success : Error; - }) - ] - // Build Lighting Widget - + SVerticalBox::Slot() - .Padding(PaddingAmount) - [ - SNew(SBorder) + } + + ScopedSlowTask.EnterProgressFrame(0.25f, LOCTEXT("Linter.FixUpRedirects.LoadingRedirectors", "Loading redirectors...")); + + TArray Objects; + if (LoadAssetsIfNeeded(ObjectPaths, Objects)) { + // Transform Objects array to ObjectRedirectors array + TArray Redirectors; + for (auto&& Object : Objects) { + auto Redirector = CastChecked(Object); + Redirectors.Add(Redirector); + } + + ScopedSlowTask.EnterProgressFrame(0.25f, LOCTEXT("Linter.FixUpRedirects.FixingRedirectors", "Fixing up redirectors...")); + + // Load the asset tools module + FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked(TEXT("AssetTools")); + AssetToolsModule.Get().FixupReferencers(Redirectors); + } else { + FNotificationInfo NotificationInfo(LOCTEXT("FixUpRedirectorsFailed", "Linter failed to load an object redirector when trying to fix up all redirectors.")); + NotificationInfo.ExpireDuration = 6.0f; + NotificationInfo.Hyperlink = FSimpleDelegate::CreateStatic([]() { + FMessageLog("LoadErrors").Open(EMessageSeverity::Info, true); + }); + NotificationInfo.HyperlinkText = LOCTEXT("LoadObjectHyperlink", "Show Message Log"); + FSlateNotificationManager::Get().AddNotification(NotificationInfo); + bSuccess = false; + } + } + + FixUpRedirectorStatus = bSuccess ? Success : Error; + }) + ] + // Build Lighting Widget + + SVerticalBox::Slot() + .Padding(PaddingAmount) + [ + SNew(SBorder) .BorderImage(FAppStyle::GetBrush("NoBorder")) .Padding(PaddingAmount) - .Visibility_Lambda([&](){ return (MapAssetDataList.Num() > 0) ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed; }) - [ - SNew(SBorder) + .Visibility_Lambda([&]() { + return (MapAssetDataList.Num() > 0) ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed; + }) + [ + SNew(SBorder) .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(PaddingAmount) - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .AutoHeight() - [ - SNew(SHorizontalBox) - // Template thumbnail image - + SHorizontalBox::Slot() - .Padding(4.0) - .AutoWidth() - .VAlign(VAlign_Top) - [ - SNew(SImage) - .Image(FLinterStyle::Get()->GetBrush("Linter.Step.BuildLighting.Thumbnail")) - ] - // Template name and description - + SHorizontalBox::Slot() - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) - [ - SNew(STextBlock) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .AutoHeight() + [ + SNew(SHorizontalBox) + // Template thumbnail image + + SHorizontalBox::Slot() + .Padding(4.0) + .AutoWidth() + .VAlign(VAlign_Top) + [ + SNew(SImage) + .Image(FLinterStyle::Get()->GetBrush("Linter.Step.BuildLighting.Thumbnail")) + ] + // Template name and description + + SHorizontalBox::Slot() + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .AutoHeight() + .Padding(PaddingAmount) + [ + SNew(STextBlock) .Text(LOCTEXT("BuildLightingStepName", "Build Lighting and Run Map Check")) .TextStyle(FLinterStyle::Get(), "Linter.Report.RuleTitle") - ] + ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) - [ - SNew(SRichTextBlock) + + SVerticalBox::Slot() + .AutoHeight() + .Padding(PaddingAmount) + [ + SNew(SRichTextBlock) .Text(LOCTEXT("BuildLightingStepDesc", "Open each map listed below and click Map Check in the Build Options Menu of the Level Editor Toolbar. If any Map Check errors are generated, resolve them before packaging your project. If any 'LIGHTING NEEDS TO BE REBUILT' errors are present press Ctrl+Shift+Semicolon to rebuild lighting.")) .TextStyle(FLinterStyle::Get(), "Linter.Report.DescriptionText") .AutoWrapText(true) - ] - ] - ] - + SVerticalBox::Slot() - .AutoHeight() - [ - SNew(SSeparator) - ] - + SVerticalBox::Slot() - .VAlign(VAlign_Fill) - .FillHeight(1.0f) - .Padding(PaddingAmount) - [ - SAssignNew(MarketplaceRecommendationMapScrollBoxPtr, SScrollBox) - .ScrollBarAlwaysVisible(true) - ] - ] - ] - ] - // Save All Step - + SVerticalBox::Slot() - .Padding(PaddingAmount) - .AutoHeight() - [ - SNew(SStepWidget) + ] + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + [ + SNew(SSeparator) + ] + + SVerticalBox::Slot() + .VAlign(VAlign_Fill) + .FillHeight(1.0f) + .Padding(PaddingAmount) + [ + SAssignNew(MarketplaceRecommendationMapScrollBoxPtr, SScrollBox) + .ScrollBarAlwaysVisible(true) + ] + ] + ] + ] + // Save All Step + + SVerticalBox::Slot() + .Padding(PaddingAmount) + .AutoHeight() + [ + SNew(SStepWidget) .StepName(LOCTEXT("SaveAllStepName", "Save All")) .StepDesc(LOCTEXT("SaveAllStepDesc", "Save all unsaved levels and assets to disk.")) .Icon(FLinterStyle::Get()->GetBrush("Linter.Step.SaveAll.Thumbnail")) .ShowStepStatusIcon(false) - .StepStatus_Lambda([this]() { return SaveAllStatus; }) + .StepStatus_Lambda([this]() { + return SaveAllStatus; + }) .StepActionText(LOCTEXT("SaveAllStepNameAction", "Save All")) - .OnPerformAction_Lambda([this](FScopedSlowTask& ScopedSlowTask) - { - SaveAllStatus = InProgress; - - // Taken from MainFrameActions.cpp SaveAll - const bool bPromptUserToSave = false; - const bool bSaveMapPackages = true; - const bool bSaveContentPackages = true; - const bool bFastSave = false; - const bool bNotifyNoPackagesSaved = false; - const bool bCanBeDeclined = false; - if (FEditorFileUtils::SaveDirtyPackages(bPromptUserToSave, bSaveMapPackages, bSaveContentPackages, bFastSave, bNotifyNoPackagesSaved, bCanBeDeclined)) - { - SaveAllStatus = Success; - } - else - { - FNotificationInfo NotificationInfo(LOCTEXT("SaveAllFailed", "Linter failed to save all dirty assets!")); - NotificationInfo.ExpireDuration = 6.0f; - NotificationInfo.Hyperlink = FSimpleDelegate::CreateStatic([]() { FMessageLog("LoadErrors").Open(EMessageSeverity::Info, true); }); - NotificationInfo.HyperlinkText = LOCTEXT("LoadObjectHyperlink", "Show Message Log"); - FSlateNotificationManager::Get().AddNotification(NotificationInfo); - SaveAllStatus = Error; - } - }) - ] - // Package Project step - + SVerticalBox::Slot() - .Padding(PaddingAmount) - .AutoHeight() - [ - SNew(SBorder) + .OnPerformAction_Lambda([this](FScopedSlowTask& ScopedSlowTask) { + SaveAllStatus = InProgress; + + // Taken from MainFrameActions.cpp SaveAll + constexpr bool bPromptUserToSave = false; + constexpr bool bSaveMapPackages = true; + constexpr bool bSaveContentPackages = true; + constexpr bool bFastSave = false; + constexpr bool bNotifyNoPackagesSaved = false; + constexpr bool bCanBeDeclined = false; + if (FEditorFileUtils::SaveDirtyPackages(bPromptUserToSave, bSaveMapPackages, bSaveContentPackages, bFastSave, bNotifyNoPackagesSaved, bCanBeDeclined)) { + SaveAllStatus = Success; + } else { + FNotificationInfo NotificationInfo(LOCTEXT("SaveAllFailed", "Linter failed to save all dirty assets!")); + NotificationInfo.ExpireDuration = 6.0f; + NotificationInfo.Hyperlink = FSimpleDelegate::CreateStatic([]() { + FMessageLog("LoadErrors").Open(EMessageSeverity::Info, true); + }); + NotificationInfo.HyperlinkText = LOCTEXT("LoadObjectHyperlink", "Show Message Log"); + FSlateNotificationManager::Get().AddNotification(NotificationInfo); + SaveAllStatus = Error; + } + }) + ] + // Package Project step + + SVerticalBox::Slot() + .Padding(PaddingAmount) + .AutoHeight() + [ + SNew(SBorder) .Visibility(EVisibility::Collapsed) .BorderImage(FAppStyle::GetBrush("NoBorder")) .Padding(PaddingAmount) - [ - SNew(SBorder) + [ + SNew(SBorder) .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(PaddingAmount) - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .Padding(4.0) - .AutoWidth() - .VAlign(VAlign_Top) - [ - SNew(SImage) - .Image(FLinterStyle::Get()->GetBrush("Linter.Step.Package.Thumbnail")) - ] - + SHorizontalBox::Slot() - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) - [ - SNew(STextBlock) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .Padding(4.0) + .AutoWidth() + .VAlign(VAlign_Top) + [ + SNew(SImage) + .Image(FLinterStyle::Get()->GetBrush("Linter.Step.Package.Thumbnail")) + ] + + SHorizontalBox::Slot() + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + .AutoHeight() + .Padding(PaddingAmount) + [ + SNew(STextBlock) .Text(LOCTEXT("PackageProduct", "Package Product to .Zip")) .TextStyle(FLinterStyle::Get(), "Linter.Report.RuleTitle") - ] + ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) - [ - SNew(SRichTextBlock) + + SVerticalBox::Slot() + .AutoHeight() + .Padding(PaddingAmount) + [ + SNew(SRichTextBlock) .Text(LOCTEXT("PackageProductDesc", "Upload this .zip file to a hosting site (GoogleDrive/Dropbox/etc.) and enter the download URL as the associated product's Project File Link in the Publisher Portal.")) .TextStyle(FLinterStyle::Get(), "Linter.Report.DescriptionText") .AutoWrapText(true) - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(SButton) - .OnClicked_Lambda([&]() - { - #if PLATFORM_WINDOWS - FText PlatformName = LOCTEXT("PlatformName_Windows", "Windows"); - #elif PLATFORM_MAC + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(PaddingAmount) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(SButton) + .OnClicked_Lambda([&]() { +#if PLATFORM_WINDOWS + FText PlatformName = LOCTEXT("PlatformName_Windows", "Windows"); +#elif PLATFORM_MAC FText PlatformName = LOCTEXT("PlatformName_Mac", "Mac"); - #elif PLATFORM_LINUX +#elif PLATFORM_LINUX FText PlatformName = LOCTEXT("PlatformName_Linux", "Linux"); - #else +#else FText PlatformName = LOCTEXT("PlatformName_Other", "Other OS"); - #endif - - bool bOpened = false; - TArray SaveFilenames; - IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); - if (DesktopPlatform != nullptr) - { - bOpened = DesktopPlatform->SaveFileDialog( - NULL, - NSLOCTEXT("UnrealEd", "ZipUpProject", "Zip file location").ToString(), - FPaths::ProjectDir(), - FApp::GetProjectName(), - TEXT("Zip file|*.zip"), - EFileDialogFlags::None, - SaveFilenames); - } - - // We never want to compile editor targets when invoking UAT in this context. - // If we are installed or don't have a compiler, we must assume we have a precompiled UAT. - const TCHAR* UATFlags = (FApp::GetEngineIsPromotedBuild() || FApp::IsEngineInstalled()) - ? TEXT("-nocompile -nocompileeditor") - : TEXT("-nocompileeditor"); - - if (bOpened) - { - for (FString FileName : SaveFilenames) - { - // Ensure path is full rather than relative (for macs) - FString FinalFileName = FPaths::ConvertRelativePathToFull(FileName); - FString ProjectPath = FPaths::IsProjectFilePathSet() ? FPaths::ConvertRelativePathToFull(FPaths::ProjectDir()) : FPaths::RootDir() / FApp::GetProjectName(); - - FString CommandLine = FString::Printf(TEXT("ZipProjectUp %s -project=\"%s\" -install=\"%s\""), UATFlags, *ProjectPath, *FinalFileName); - - IUATHelperModule::Get().CreateUatTask(CommandLine, PlatformName, LOCTEXT("ZipTaskName", "Zipping Up Project"), - LOCTEXT("ZipTaskShortName", "Zip Project Task"), FAppStyle::GetBrush(TEXT("MainFrame.CookContent"))); - } +#endif + + bool bOpened = false; + TArray SaveFilenames; + IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); + if (DesktopPlatform != nullptr) { + bOpened = DesktopPlatform->SaveFileDialog( + nullptr, + NSLOCTEXT("UnrealEd", "ZipUpProject", "Zip file location").ToString(), + FPaths::ProjectDir(), + FApp::GetProjectName(), + TEXT("Zip file|*.zip"), + EFileDialogFlags::None, + SaveFilenames); + } + + // We never want to compile editor targets when invoking UAT in this context. + // If we are installed or don't have a compiler, we must assume we have a precompiled UAT. + const TCHAR* UATFlags = (FApp::GetEngineIsPromotedBuild() || FApp::IsEngineInstalled()) + ? TEXT("-nocompile -nocompileeditor") + : TEXT("-nocompileeditor"); + + if (bOpened) { + for (FString FileName : SaveFilenames) { + // Ensure path is full rather than relative (for macs) + FString FinalFileName = FPaths::ConvertRelativePathToFull(FileName); + FString ProjectPath = FPaths::IsProjectFilePathSet() ? FPaths::ConvertRelativePathToFull(FPaths::ProjectDir()) : FPaths::RootDir() / FApp::GetProjectName(); + + FString CommandLine = FString::Printf(TEXT("ZipProjectUp %s -project=\"%s\" -install=\"%s\""), UATFlags, *ProjectPath, *FinalFileName); + + IUATHelperModule::Get().CreateUatTask(CommandLine, PlatformName, LOCTEXT("ZipTaskName", "Zipping Up Project"), + LOCTEXT("ZipTaskShortName", "Zip Project Task"), FAppStyle::GetBrush(TEXT("MainFrame.CookContent"))); + } #if UE_VERSION_NEWER_THAN(4, 26, 0) - FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab"))->RequestCloseTab(); + FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab"))->RequestCloseTab(); #else FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab"))->RequestCloseTab(); #endif - } - return FReply::Handled(); - }) - [ - SNew(STextBlock) - .Text(LOCTEXT("SelectOutputFolder", "Package Project into a .zip")) - ] - ] - ] - ] - ] - ] - ] - ] - ] - ] - ] - ] - ] - ]; - - // Determine all levels in the project for wizard purposes - FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); - TArray AssetDatas; - FARFilter Filter; + } + return FReply::Handled(); + }) + [ + SNew(STextBlock) + .Text(LOCTEXT("SelectOutputFolder", "Package Project into a .zip")) + ] + ] + ] + ] + ] + ] + ] + ] + ] + ] + ] + ] + ] + ]; + + // Determine all levels in the project for wizard purposes + FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + TArray AssetDatas; + FARFilter Filter; #if UE_VERSION_NEWER_THAN(5, 1, 0) - Filter.ClassPaths.Add(FTopLevelAssetPath(UWorld::StaticClass())); + Filter.ClassPaths.Add(FTopLevelAssetPath(UWorld::StaticClass())); #else - Filter.ClassNames.Add(UWorld::StaticClass()->GetFName()); + Filter.ClassNames.Add(UWorld::StaticClass()->GetFName()); #endif - Filter.bRecursivePaths = true; - Filter.PackagePaths.Add(TEXT("/Game")); - AssetRegistryModule.Get().GetAssets(Filter, AssetDatas); - - MapAssetDataList.Empty(); - for (FAssetData Asset : AssetDatas) - { - MapAssetDataList.Add(MakeShareable(new FAssetData(Asset))); - - MarketplaceRecommendationMapScrollBoxPtr.Get()->AddSlot() - .HAlign(HAlign_Fill) - .VAlign(VAlign_Fill) - .Padding(PaddingAmount) - [ - SNew(SAssetLinkWidget) - .AssetData(Asset) - ]; - } + Filter.bRecursivePaths = true; + Filter.PackagePaths.Add(TEXT("/Game")); + AssetRegistryModule.Get().GetAssets(Filter, AssetDatas); + + MapAssetDataList.Empty(); + for (FAssetData Asset : AssetDatas) { + MapAssetDataList.Add(MakeShareable(new FAssetData(Asset))); + + MarketplaceRecommendationMapScrollBoxPtr.Get()->AddSlot() + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) + .Padding(PaddingAmount) + [ + SNew(SAssetLinkWidget) + .AssetData(Asset) + ]; + } } + END_SLATE_FUNCTION_BUILD_OPTIMIZATION -void SLintWizard::OnLintReportEntered() -{ - LintReport->Rebuild(CastChecked(SelectedRuleSet->GetAsset())); +void SLintWizard::OnLintReportEntered() { + LintReport->Rebuild(CastChecked(SelectedRuleSet->GetAsset())); } -void SLintWizard::OnMarketplaceRecommendationsEntered() -{ - bOfferPackage = true; +void SLintWizard::OnMarketplaceRecommendationsEntered() { + bOfferPackage = true; } -bool SLintWizard::LoadAssetsIfNeeded(const TArray& ObjectPaths, TArray& LoadedObjects) -{ - bool bAnyObjectsWereLoadedOrUpdated = false; - - // Build a list of unloaded assets - TArray UnloadedObjectPaths; - bool bAtLeastOneUnloadedMap = false; - for (int32 PathIdx = 0; PathIdx < ObjectPaths.Num(); ++PathIdx) - { - const FString& ObjectPath = ObjectPaths[PathIdx]; - - UObject* FoundObject = FindObject(nullptr, *ObjectPath); - if (FoundObject) - { - LoadedObjects.Add(FoundObject); - } - else - { - // Unloaded asset, we will load it later - UnloadedObjectPaths.Add(ObjectPath); - if (FEditorFileUtils::IsMapPackageAsset(ObjectPath)) - { - bAtLeastOneUnloadedMap = true; - } - } - } - - // Make sure all selected objects are loaded, where possible - if (UnloadedObjectPaths.Num() > 0) - { - FScopedSlowTask SlowTask(UnloadedObjectPaths.Num(), LOCTEXT("LoadingObjects", "Loading Objects...")); - SlowTask.MakeDialog(); - - GIsEditorLoadingPackage = true; - - const ELoadFlags LoadFlags = LOAD_None; - bool bSomeObjectsFailedToLoad = false; - for (int32 PathIdx = 0; PathIdx < UnloadedObjectPaths.Num(); ++PathIdx) - { - const FString& ObjectPath = UnloadedObjectPaths[PathIdx]; - SlowTask.EnterProgressFrame(1, FText::Format(LOCTEXT("LoadingObjectf", "Loading {0}..."), FText::FromString(ObjectPath))); - - // Load up the object - UObject* LoadedObject = LoadObject(nullptr, *ObjectPath, nullptr, LoadFlags, nullptr); - if (LoadedObject) - { - LoadedObjects.Add(LoadedObject); - } - else - { - bSomeObjectsFailedToLoad = true; - } - - if (GWarn->ReceivedUserCancel()) - { - // If the user has canceled stop loading the remaining objects. We don't add the remaining objects to the failed string, - // this would only result in launching another dialog when by their actions the user clearly knows not all of the - // assets will have been loaded. - break; - } - } - GIsEditorLoadingPackage = false; - - if (bSomeObjectsFailedToLoad) - { - return false; - } - } - - return true; +bool SLintWizard::LoadAssetsIfNeeded(const TArray& ObjectPaths, TArray& LoadedObjects) { + bool bAnyObjectsWereLoadedOrUpdated = false; + + // Build a list of unloaded assets + TArray UnloadedObjectPaths; + bool bAtLeastOneUnloadedMap = false; + for (int32 PathIdx = 0; PathIdx < ObjectPaths.Num(); ++PathIdx) { + const FString& ObjectPath = ObjectPaths[PathIdx]; + + UObject* FoundObject = FindObject(nullptr, *ObjectPath); + if (FoundObject) { + LoadedObjects.Add(FoundObject); + } else { + // Unloaded asset, we will load it later + UnloadedObjectPaths.Add(ObjectPath); + if (FEditorFileUtils::IsMapPackageAsset(ObjectPath)) { + bAtLeastOneUnloadedMap = true; + } + } + } + + // Make sure all selected objects are loaded, where possible + if (UnloadedObjectPaths.Num() > 0) { + FScopedSlowTask SlowTask(UnloadedObjectPaths.Num(), LOCTEXT("LoadingObjects", "Loading Objects...")); + SlowTask.MakeDialog(); + + GIsEditorLoadingPackage = true; + + constexpr ELoadFlags LoadFlags = LOAD_None; + bool bSomeObjectsFailedToLoad = false; + for (int32 PathIdx = 0; PathIdx < UnloadedObjectPaths.Num(); ++PathIdx) { + const FString& ObjectPath = UnloadedObjectPaths[PathIdx]; + SlowTask.EnterProgressFrame(1, FText::Format(LOCTEXT("LoadingObjectf", "Loading {0}..."), FText::FromString(ObjectPath))); + + // Load up the object + UObject* LoadedObject = LoadObject(nullptr, *ObjectPath, nullptr, LoadFlags, nullptr); + if (LoadedObject) { + LoadedObjects.Add(LoadedObject); + } else { + bSomeObjectsFailedToLoad = true; + } + + if (GWarn->ReceivedUserCancel()) { + // If the user has canceled stop loading the remaining objects. We don't add the remaining objects to the failed string, + // this would only result in launching another dialog when by their actions the user clearly knows not all of the + // assets will have been loaded. + break; + } + } + GIsEditorLoadingPackage = false; + + if (bSomeObjectsFailedToLoad) { + return false; + } + } + + return true; } -#undef LOCTEXT_NAMESPACE \ No newline at end of file +#undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/SAssetLinkWidget.cpp b/Source/Linter/Private/UI/SAssetLinkWidget.cpp index 3860c2a..f700dd0 100644 --- a/Source/Linter/Private/UI/SAssetLinkWidget.cpp +++ b/Source/Linter/Private/UI/SAssetLinkWidget.cpp @@ -3,6 +3,7 @@ #include "UI/SAssetLinkWidget.h" #include "ContentBrowserModule.h" #include "IContentBrowserSingleton.h" +#include "LinterStyle.h" #include "SlateOptMacros.h" #include "AssetRegistry/AssetRegistryModule.h" #include "Widgets/SBoxPanel.h" @@ -11,34 +12,32 @@ BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION -void SAssetLinkWidget::Construct(const FArguments& Args) -{ - const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - AssetData = Args._AssetData; +void SAssetLinkWidget::Construct(const FArguments& Args) { + const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); + AssetData = Args._AssetData; - ChildSlot - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(SHyperlink) + ChildSlot + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(SHyperlink) .Text(FText::FromName(AssetData.Get().AssetName)) .Padding(PaddingAmount) - .OnNavigate_Lambda([&]() - { - const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); - const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); - TArray AssetDatas; + .OnNavigate_Lambda([&]() { + const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); + TArray AssetDatas; #if UE_VERSION_NEWER_THAN(5, 1, 0) - AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(AssetData.Get().GetObjectPathString())); + AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(AssetData.Get().GetObjectPathString())); #else - AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(AssetData.Get().ObjectPath)); + AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(AssetData.Get().ObjectPath)); #endif - ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); - }) - ] - ]; + ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); + }) + ] + ]; } -END_SLATE_FUNCTION_BUILD_OPTIMIZATION \ No newline at end of file +END_SLATE_FUNCTION_BUILD_OPTIMIZATION diff --git a/Source/Linter/Private/UI/SStepWidget.cpp b/Source/Linter/Private/UI/SStepWidget.cpp index 9893c51..8789991 100644 --- a/Source/Linter/Private/UI/SStepWidget.cpp +++ b/Source/Linter/Private/UI/SStepWidget.cpp @@ -9,156 +9,149 @@ #include "Widgets/Text/STextBlock.h" #include "Widgets/Images/SThrobber.h" #include "Widgets/Text/SRichTextBlock.h" +#include "Misc/EngineVersionComparison.h" -bool SStepWidget::IsStepCompleted(const bool bAllowWarning) const -{ - const EStepStatus Status = StepStatus.Get(); - if (bAllowWarning && Status == Warning) - { - return true; - } +#if UE_VERSION_OLDER_THAN(5, 1, 0) +using FAppStyle = FEditorStyle; +#endif - return Status == Success; +bool SStepWidget::IsStepCompleted(const bool bAllowWarning) const { + const EStepStatus Status = StepStatus.Get(); + if (bAllowWarning && Status == Warning) { + return true; + } + + return Status == Success; } -void SStepWidget::Construct(const FArguments& Args) -{ - const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); +void SStepWidget::Construct(const FArguments& Args) { + const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - StepStatus = Args._StepStatus; - OnPerformAction = Args._OnPerformAction; - StepActionText = Args._StepActionText; - ShowStepStatusIcon = Args._ShowStepStatusIcon; + StepStatus = Args._StepStatus; + OnPerformAction = Args._OnPerformAction; + StepActionText = Args._StepActionText; + ShowStepStatusIcon = Args._ShowStepStatusIcon; - // Visibility lambda based on whether step is in progress - auto VisibleIfInProgress = [this]() - { - return StepStatus.Get(NoStatus) == InProgress ? EVisibility::Visible : EVisibility::Collapsed; - }; + // Visibility lambda based on whether step is in progress + auto VisibleIfInProgress = [this]() { + return StepStatus.Get(NoStatus) == InProgress ? EVisibility::Visible : EVisibility::Collapsed; + }; - // Enabled lambda based on whether this widget has a step status that requires action - auto EnabledBasedOnStepStatus = [this]() -> bool - { - switch (StepStatus.Get(NoStatus)) - { - case NoStatus: - case InProgress: - case Success: - return false; - case Unknown: - case Warning: - case Error: - case NeedsUpdate: - return true; - } - return false; - }; + // Enabled lambda based on whether this widget has a step status that requires action + auto EnabledBasedOnStepStatus = [this]() -> bool { + switch (StepStatus.Get(NoStatus)) { + case NoStatus: + case InProgress: + case Success: return false; + case Unknown: + case Warning: + case Error: + case NeedsUpdate: return true; + } + return false; + }; - ChildSlot - [ - SNew(SBorder) + ChildSlot + [ + SNew(SBorder) .BorderImage(FAppStyle::GetBrush("NoBorder")) .Padding(PaddingAmount) - [ - SNew(SBorder) + [ + SNew(SBorder) .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) .Padding(PaddingAmount) - [ - SNew(SHorizontalBox) - // Status Image - + SHorizontalBox::Slot() - .Padding(PaddingAmount) - .AutoWidth() - [ - SNew(SImage) - .Visibility_Lambda([&]() { return StepStatus.Get(NoStatus) == NoStatus || !ShowStepStatusIcon.Get(true) ? EVisibility::Collapsed : EVisibility::Visible; }) - .Image_Lambda([&]() - { - switch (StepStatus.Get(NoStatus)) - { - case NoStatus: - case Unknown: - return FLinterStyle::Get()->GetBrush("Linter.Step.Unknown"); - case InProgress: - case NeedsUpdate: - return FLinterStyle::Get()->GetBrush("Linter.Step.Working"); - case Warning: - return FLinterStyle::Get()->GetBrush("Linter.Step.Warning"); - case Error: - return FLinterStyle::Get()->GetBrush("Linter.Step.Error"); - case Success: - return FLinterStyle::Get()->GetBrush("Linter.Step.Good"); - } + [ + SNew(SHorizontalBox) + // Status Image + + SHorizontalBox::Slot() + .Padding(PaddingAmount) + .AutoWidth() + [ + SNew(SImage) + .Visibility_Lambda([&]() { + return StepStatus.Get(NoStatus) == NoStatus || !ShowStepStatusIcon.Get(true) ? EVisibility::Collapsed : EVisibility::Visible; + }) + .Image_Lambda([&]() { + switch (StepStatus.Get(NoStatus)) { + case NoStatus: + case Unknown: return FLinterStyle::Get()->GetBrush("Linter.Step.Unknown"); + case InProgress: + case NeedsUpdate: return FLinterStyle::Get()->GetBrush("Linter.Step.Working"); + case Warning: return FLinterStyle::Get()->GetBrush("Linter.Step.Warning"); + case Error: return FLinterStyle::Get()->GetBrush("Linter.Step.Error"); + case Success: return FLinterStyle::Get()->GetBrush("Linter.Step.Good"); + } - return FLinterStyle::Get()->GetBrush("Linter.Step.Unknown"); - }) - ] - // Template thumbnail image - + SHorizontalBox::Slot() - .Padding(4.0) - .AutoWidth() - .VAlign(VAlign_Top) - [ - SNew(SImage) + return FLinterStyle::Get()->GetBrush("Linter.Step.Unknown"); + }) + ] + // Template thumbnail image + + SHorizontalBox::Slot() + .Padding(4.0) + .AutoWidth() + .VAlign(VAlign_Top) + [ + SNew(SImage) .Visibility(Args._Icon.IsSet() ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed) .Image(Args._Icon) - ] - // Template name and description - + SHorizontalBox::Slot() - [ - SNew(SVerticalBox) + ] + // Template name and description + + SHorizontalBox::Slot() + [ + SNew(SVerticalBox) - + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) - [ - SNew(STextBlock) + + SVerticalBox::Slot() + .AutoHeight() + .Padding(PaddingAmount) + [ + SNew(STextBlock) .Text(Args._StepName) .TextStyle(FLinterStyle::Get(), "Linter.Report.RuleTitle") - ] + ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) - [ - SNew(SRichTextBlock) + + SVerticalBox::Slot() + .AutoHeight() + .Padding(PaddingAmount) + [ + SNew(SRichTextBlock) .Text(Args._StepDesc) .TextStyle(FLinterStyle::Get(), "Linter.Report.DescriptionText") .AutoWrapText(true) - ] - + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(SButton) + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(PaddingAmount) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(SButton) .IsEnabled_Lambda(EnabledBasedOnStepStatus) - .Visibility_Lambda([&]() { return StepStatus.Get(NoStatus) == NoStatus ? EVisibility::Collapsed : EVisibility::Visible; }) - .OnClicked_Lambda([&]() - { - FScopedSlowTask SlowTask(1.0f, StepActionText.Get(FText())); - SlowTask.MakeDialog(); + .Visibility_Lambda([&]() { + return StepStatus.Get(NoStatus) == NoStatus ? EVisibility::Collapsed : EVisibility::Visible; + }) + .OnClicked_Lambda([&]() { + FScopedSlowTask SlowTask(1.0f, StepActionText.Get(FText())); + SlowTask.MakeDialog(); - OnPerformAction.ExecuteIfBound(SlowTask); - return FReply::Handled(); - }) - [ - SNew(STextBlock) - .Text(StepActionText) - ] - ] - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(SThrobber) - .Visibility_Lambda(VisibleIfInProgress) - ] - ] - ] - ] - ] - ]; -} \ No newline at end of file + OnPerformAction.ExecuteIfBound(SlowTask); + return FReply::Handled(); + }) + [ + SNew(STextBlock) + .Text(StepActionText) + ] + ] + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(SThrobber) + .Visibility_Lambda(VisibleIfInProgress) + ] + ] + ] + ] + ] + ]; +} diff --git a/Source/Linter/Public/AnyObject_LinterDummyClass.h b/Source/Linter/Public/AnyObject_LinterDummyClass.h index b7e188a..4142634 100644 --- a/Source/Linter/Public/AnyObject_LinterDummyClass.h +++ b/Source/Linter/Public/AnyObject_LinterDummyClass.h @@ -4,13 +4,11 @@ #include "AnyObject_LinterDummyClass.generated.h" + UCLASS(BlueprintType, Blueprintable) -class UAnyObject_LinterDummyClass : public UObject -{ - GENERATED_BODY() +class UAnyObject_LinterDummyClass : public UObject { + GENERATED_BODY() public: - - UAnyObject_LinterDummyClass(const FObjectInitializer& ObjectInitializer); + UAnyObject_LinterDummyClass(const FObjectInitializer& ObjectInitializer); }; - diff --git a/Source/Linter/Public/BatchRenameTool/BatchRenameTool.h b/Source/Linter/Public/BatchRenameTool/BatchRenameTool.h index 8ff0cf5..80c5bf9 100644 --- a/Source/Linter/Public/BatchRenameTool/BatchRenameTool.h +++ b/Source/Linter/Public/BatchRenameTool/BatchRenameTool.h @@ -5,9 +5,7 @@ #include "Widgets/Input/SEditableTextBox.h" #include "Widgets/Input/SCheckBox.h" #include "Widgets/SWindow.h" -#include "Widgets/SUserWidget.h" #include "Widgets/SCompoundWidget.h" -#include "Widgets/Layout/SUniformGridPanel.h" #define LOCTEXT_NAMESPACE "LinterBatchRenamer" @@ -17,94 +15,87 @@ * Wrapper class for SDlgBatchRenameTool. This class creates and launches a dialog then awaits the * result to return to the user. */ -class FDlgBatchRenameTool -{ +class FDlgBatchRenameTool { public: - enum EResult - { - Cancel = 0, // No/Cancel, normal usage would stop the current action - Confirm = 1, // Yes/Ok/Etc, normal usage would continue with action - }; + enum EResult { + Cancel = 0, + // No/Cancel, normal usage would stop the current action + Confirm = 1, + // Yes/Ok/Etc, normal usage would continue with action + }; - FDlgBatchRenameTool(const TArray Assets); + FDlgBatchRenameTool(const TArray Assets); - /** Shows the dialog box and waits for the user to respond. */ - EResult ShowModal(); + /** Shows the dialog box and waits for the user to respond. */ + EResult ShowModal(); - FString Prefix; - FString Suffix; - bool bRemovePrefix; - bool bRemoveSuffix; + FString Prefix; + FString Suffix; + bool bRemovePrefix; + bool bRemoveSuffix; - FString Find; - FString Replace; + FString Find; + FString Replace; private: + /** Cached pointer to the modal window */ + TSharedPtr DialogWindow; - /** Cached pointer to the modal window */ - TSharedPtr DialogWindow; + /** Cached pointer to the batch rename tool widget */ + TSharedPtr DialogWidget; - /** Cached pointer to the batch rename tool widget */ - TSharedPtr DialogWidget; - - const TArray SelectedAssets; + const TArray SelectedAssets; }; /** * Slate panel for batch renaming */ -class SDlgBatchRenameTool : public SCompoundWidget -{ +class SDlgBatchRenameTool : public SCompoundWidget { public: - - SLATE_BEGIN_ARGS(SDlgBatchRenameTool) - {} - /** Window in which this widget resides */ - SLATE_ATTRIBUTE(TSharedPtr, ParentWindow) - SLATE_END_ARGS() - - /** - * Constructs this widget - * - * @param InArgs The declaration data for this widget - */ - void Construct(const FArguments& InArgs); - - /** - * Returns the EResult of the button which the user pressed. Closing of the dialog - * in any other way than clicking "Ok" results in this returning a "Cancel" value - */ - FDlgBatchRenameTool::EResult GetUserResponse() const; + SLATE_BEGIN_ARGS(SDlgBatchRenameTool) {} + /** Window in which this widget resides */ + SLATE_ATTRIBUTE(TSharedPtr, ParentWindow) + SLATE_END_ARGS() + + /** + * Constructs this widget + * + * @param InArgs The declaration data for this widget + */ + void Construct(const FArguments& InArgs); + + /** + * Returns the EResult of the button which the user pressed. Closing of the dialog + * in any other way than clicking "Ok" results in this returning a "Cancel" value + */ + FDlgBatchRenameTool::EResult GetUserResponse() const; private: + /** + * Handles when a button is pressed, should be bound with appropriate EResult Key + * + * @param ButtonID - The return type of the button which has been pressed. + */ + FReply OnButtonClick(FDlgBatchRenameTool::EResult ButtonID) { + ParentWindow->RequestDestroyWindow(); + UserResponse = ButtonID; - /** - * Handles when a button is pressed, should be bound with appropriate EResult Key - * - * @param ButtonID - The return type of the button which has been pressed. - */ - FReply OnButtonClick(FDlgBatchRenameTool::EResult ButtonID) - { - ParentWindow->RequestDestroyWindow(); - UserResponse = ButtonID; + return FReply::Handled(); + } - return FReply::Handled(); - } + /** Stores the users response to this dialog */ + FDlgBatchRenameTool::EResult UserResponse; - /** Stores the users response to this dialog */ - FDlgBatchRenameTool::EResult UserResponse; - - /** Pointer to the window which holds this Widget, required for modal control */ - TSharedPtr ParentWindow; + /** Pointer to the window which holds this Widget, required for modal control */ + TSharedPtr ParentWindow; public: - - TSharedPtr PrefixTextBox; - TSharedPtr SuffixTextBox; - TSharedPtr FindTextBox; - TSharedPtr ReplaceTextBox; - TSharedPtr PrefixRemoveBox; - TSharedPtr SuffixRemoveBox; + TSharedPtr PrefixTextBox; + TSharedPtr SuffixTextBox; + TSharedPtr FindTextBox; + TSharedPtr ReplaceTextBox; + TSharedPtr PrefixRemoveBox; + TSharedPtr SuffixRemoveBox; }; -#undef LOCTEXT_NAMESPACE \ No newline at end of file +#undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Public/LintRule.h b/Source/Linter/Public/LintRule.h index ab8730a..34baaf8 100644 --- a/Source/Linter/Public/LintRule.h +++ b/Source/Linter/Public/LintRule.h @@ -9,109 +9,99 @@ class ULintRule; class ULintRuleSet; UENUM(BlueprintType) -enum class ELintRuleSeverity : uint8 -{ - Error, - Warning, - Info -// Ignore +enum class ELintRuleSeverity : uint8 { + Error, + Warning, + Info + // Ignore }; USTRUCT(BlueprintType) -struct LINTER_API FLintRuleViolation -{ - GENERATED_USTRUCT_BODY() - - FLintRuleViolation() - : Violator(nullptr) - , ViolatedRule(nullptr) - , RecommendedAction(FText::GetEmpty()) - { - } - - FLintRuleViolation(UObject* InViolator, const TSubclassOf InViolatedRule, const FText InRecommendedAction = FText::GetEmpty()) - : Violator(InViolator) - , ViolatedRule(InViolatedRule) - , RecommendedAction(InRecommendedAction) - { - } - - // I don't particularly like this way of extracting relevant data, but alas here we are. - static TArray AllRuleViolationsWithViolator(const TArray& RuleViolationCollection, const UObject* SearchViolator); - static TArray> AllRuleViolationsWithViolatorShared(const TArray& RuleViolationCollection, const UObject* SearchViolator); - static TArray> AllRuleViolationsWithViolatorShared(const TArray>& RuleViolationCollection, const UObject* SearchViolator); - static TArray AllRuleViolationsOfSpecificRule(const TArray& RuleViolationCollection, TSubclassOf SearchRule); - static TArray AllRuleViolationsOfRuleGroup(const TArray& RuleViolationCollection, FName SearchRuleGroup); - - static TArray AllRuleViolationViolators(const TArray& RuleViolationCollection); - static TArray AllRuleViolationViolators(const TArray>& RuleViolationCollection); - static TMultiMap AllRuleViolationsMappedByViolator(const TArray& RuleViolationCollection); - static TMultiMap AllRuleViolationsMappedByViolatedLintRule(const TArray& RuleViolationCollection); - static TMultiMap> AllRuleViolationsMappedByViolatedLintRuleShared(const TArray& RuleViolationCollection); - static TMultiMap> AllRuleViolationsMappedByViolatedLintRuleShared(const TArray>& RuleViolationCollection); - - bool PopulateAssetData(); - - UPROPERTY(EditAnywhere, Category = "Lint") - TWeakObjectPtr Violator; - - UPROPERTY(EditAnywhere, Category = "Lint") - TSubclassOf ViolatedRule; - - UPROPERTY(EditAnywhere, Category = "Lint") - FText RecommendedAction; - - FAssetData ViolatorAssetData; +struct LINTER_API FLintRuleViolation { + GENERATED_USTRUCT_BODY() + + FLintRuleViolation() : + Violator(nullptr), + ViolatedRule(nullptr), + RecommendedAction(FText::GetEmpty()) { } + + FLintRuleViolation(UObject* InViolator, const TSubclassOf InViolatedRule, const FText InRecommendedAction = FText::GetEmpty()) : + Violator(InViolator), + ViolatedRule(InViolatedRule), + RecommendedAction(InRecommendedAction) { } + + // I don't particularly like this way of extracting relevant data, but alas here we are. + static TArray AllRuleViolationsWithViolator(const TArray& RuleViolationCollection, const UObject* SearchViolator); + static TArray> AllRuleViolationsWithViolatorShared(const TArray& RuleViolationCollection, const UObject* SearchViolator); + static TArray> AllRuleViolationsWithViolatorShared(const TArray>& RuleViolationCollection, const UObject* SearchViolator); + static TArray AllRuleViolationsOfSpecificRule(const TArray& RuleViolationCollection, TSubclassOf SearchRule); + static TArray AllRuleViolationsOfRuleGroup(const TArray& RuleViolationCollection, FName SearchRuleGroup); + + static TArray AllRuleViolationViolators(const TArray& RuleViolationCollection); + static TArray AllRuleViolationViolators(const TArray>& RuleViolationCollection); + static TMultiMap AllRuleViolationsMappedByViolator(const TArray& RuleViolationCollection); + static TMultiMap AllRuleViolationsMappedByViolatedLintRule(const TArray& RuleViolationCollection); + static TMultiMap> AllRuleViolationsMappedByViolatedLintRuleShared(const TArray& RuleViolationCollection); + static TMultiMap> AllRuleViolationsMappedByViolatedLintRuleShared(const TArray>& RuleViolationCollection); + + bool PopulateAssetData(); + + UPROPERTY(EditAnywhere, Category = "Lint") + TWeakObjectPtr Violator; + + UPROPERTY(EditAnywhere, Category = "Lint") + TSubclassOf ViolatedRule; + + UPROPERTY(EditAnywhere, Category = "Lint") + FText RecommendedAction; + + FAssetData ViolatorAssetData; }; /** *Comment */ UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule : public UObject -{ - GENERATED_BODY() +class LINTER_API ULintRule : public UObject { + GENERATED_BODY() public: + ULintRule(const FObjectInitializer& ObjectInitializer); - ULintRule(const FObjectInitializer& ObjectInitializer); - - UPROPERTY(EditDefaultsOnly, Category = "Display") - FName RuleGroup; + UPROPERTY(EditDefaultsOnly, Category = "Display") + FName RuleGroup; - UPROPERTY(EditDefaultsOnly, Category = "Display") - FText RuleTitle; + UPROPERTY(EditDefaultsOnly, Category = "Display") + FText RuleTitle; - UPROPERTY(EditDefaultsOnly, Category = "Display") - FText RuleDescription; + UPROPERTY(EditDefaultsOnly, Category = "Display") + FText RuleDescription; - UPROPERTY(EditDefaultsOnly, Category = "Display") - FString RuleURL; + UPROPERTY(EditDefaultsOnly, Category = "Display") + FString RuleURL; - UPROPERTY(EditDefaultsOnly, Category = "Display") - ELintRuleSeverity RuleSeverity; + UPROPERTY(EditDefaultsOnly, Category = "Display") + ELintRuleSeverity RuleSeverity; - UPROPERTY(EditDefaultsOnly, Category = "Settings", AdvancedDisplay) - bool bRequiresGameThread = false; + UPROPERTY(EditDefaultsOnly, Category = "Settings", AdvancedDisplay) + bool bRequiresGameThread = false; - UFUNCTION(BlueprintCallable, Category = "Lint") - virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const; + UFUNCTION(BlueprintCallable, Category = "Lint") + virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const; - UFUNCTION(BlueprintCallable, Category = "Display") - virtual bool IsRuleSuppressed() const; + UFUNCTION(BlueprintCallable, Category = "Display") + virtual bool IsRuleSuppressed() const; - UFUNCTION(BlueprintNativeEvent, Category = "Display") - FName GetRuleBasedObjectVariantName(UObject* ObjectToLint) const; + UFUNCTION(BlueprintNativeEvent, Category = "Display") + FName GetRuleBasedObjectVariantName(UObject* ObjectToLint) const; protected: - - /* This is the function that child lint rules should override to perform the meat of the rule check - * You do not call this directly. Always call PassesRule. PassesRule forwards to the PassesRule_Internal ONLY IF - * data is valid and the rule is not suppressed, therefore it is worth checking. - */ - UFUNCTION(BlueprintNativeEvent, Category = "Lint") - bool PassesRule_Internal(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const; + /* This is the function that child lint rules should override to perform the meat of the rule check + * You do not call this directly. Always call PassesRule. PassesRule forwards to the PassesRule_Internal ONLY IF + * data is valid and the rule is not suppressed, therefore it is worth checking. + */ + UFUNCTION(BlueprintNativeEvent, Category = "Lint") + bool PassesRule_Internal(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const; private: - -}; \ No newline at end of file +}; diff --git a/Source/Linter/Public/LintRuleSet.h b/Source/Linter/Public/LintRuleSet.h index 49cbde6..651a3db 100644 --- a/Source/Linter/Public/LintRuleSet.h +++ b/Source/Linter/Public/LintRuleSet.h @@ -8,59 +8,54 @@ #include "LintRuleSet.generated.h" USTRUCT(BlueprintType) -struct LINTER_API FLintRuleList -{ - GENERATED_USTRUCT_BODY() +struct LINTER_API FLintRuleList { + GENERATED_USTRUCT_BODY() - FLintRuleList() - {} + FLintRuleList() {} - UPROPERTY(EditAnywhere, Category = Default) - TArray> LintRules; + UPROPERTY(EditAnywhere, Category = Default) + TArray> LintRules; - bool RequiresGameThread() const;; - bool PassesRules(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const; + bool RequiresGameThread() const;; + bool PassesRules(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const; }; /** *Comment */ UCLASS(BlueprintType, Blueprintable) -class LINTER_API ULintRuleSet : public UDataAsset -{ - GENERATED_BODY() +class LINTER_API ULintRuleSet : public UDataAsset { + GENERATED_BODY() public: - ULintRuleSet(const FObjectInitializer& ObjectInitializer); + ULintRuleSet(const FObjectInitializer& ObjectInitializer); - //UFUNCTION(BlueprintCallable, Category = "Conventions") - const FLintRuleList* GetLintRuleListForClass(TSoftClassPtr Class) const; + //UFUNCTION(BlueprintCallable, Category = "Conventions") + const FLintRuleList* GetLintRuleListForClass(TSoftClassPtr Class) const; - UFUNCTION(BlueprintCallable, Category = "Conventions") - ULinterNamingConvention* GetNamingConvention() const; + UFUNCTION(BlueprintCallable, Category = "Conventions") + ULinterNamingConvention* GetNamingConvention() const; - /** Invoke this with a list of asset paths to recursively lint all assets in paths. */ - //UFUNCTION(BlueprintCallable, Category = "Lint") - TArray LintPath(TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask = nullptr) const; + /** Invoke this with a list of asset paths to recursively lint all assets in paths. */ + //UFUNCTION(BlueprintCallable, Category = "Lint") + TArray LintPath(TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask = nullptr) const; - /** This is a temp dumb way to do this. */ - TArray> LintPathShared(TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask = nullptr) const; + /** This is a temp dumb way to do this. */ + TArray> LintPathShared(TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask = nullptr) const; - UPROPERTY(EditDefaultsOnly, Category = "Marketplace") - bool bShowMarketplacePublishingInfoInLintWizard = false; + UPROPERTY(EditDefaultsOnly, Category = "Marketplace") + bool bShowMarketplacePublishingInfoInLintWizard = false; - UPROPERTY(EditDefaultsOnly, Category = "Rules") - FText RuleSetDescription; + UPROPERTY(EditDefaultsOnly, Category = "Rules") + FText RuleSetDescription; - UPROPERTY(EditDefaultsOnly, Category = "Commandlet") - FString NameForCommandlet; + UPROPERTY(EditDefaultsOnly, Category = "Commandlet") + FString NameForCommandlet; protected: + UPROPERTY(EditDefaultsOnly, Category = "Rules") + TSoftObjectPtr NamingConvention; - UPROPERTY(EditDefaultsOnly, Category = "Rules") - TSoftObjectPtr NamingConvention; - - UPROPERTY(EditDefaultsOnly, Category = "Rules") - TMap, FLintRuleList> ClassLintRulesMap; - -}; \ No newline at end of file + UPROPERTY(EditDefaultsOnly, Category = "Rules") + TMap, FLintRuleList> ClassLintRulesMap; +}; diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h index b4d1b41..6427acf 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Base.h @@ -12,13 +12,12 @@ class ULintRuleSet; *Comment */ UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Blueprint_Base : public ULintRule -{ - GENERATED_BODY() +class LINTER_API ULintRule_Blueprint_Base : public ULintRule { + GENERATED_BODY() public: - ULintRule_Blueprint_Base(const FObjectInitializer& ObjectInitializer); + ULintRule_Blueprint_Base(const FObjectInitializer& ObjectInitializer); - // This does rule pre-checks. You probably want to override PassesRule_Internal_Implementation - virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; + // This does rule pre-checks. You probably want to override PassesRule_Internal_Implementation + virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; }; diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h index 32d59ad..390268d 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Compiles.h @@ -11,14 +11,12 @@ *Comment */ UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Blueprint_Compiles : public ULintRule_Blueprint_Base -{ - GENERATED_BODY() +class LINTER_API ULintRule_Blueprint_Compiles : public ULintRule_Blueprint_Base { + GENERATED_BODY() public: - ULintRule_Blueprint_Compiles(const FObjectInitializer& ObjectInitializer); + ULintRule_Blueprint_Compiles(const FObjectInitializer& ObjectInitializer); protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - -}; \ No newline at end of file + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; +}; diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h index d01aa07..b2c517e 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MaxNodes.h @@ -8,19 +8,17 @@ #include "LintRule_Blueprint_Funcs_MaxNodes.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Blueprint_Funcs_MaxNodes : public ULintRule_Blueprint_Base -{ - GENERATED_BODY() +class LINTER_API ULintRule_Blueprint_Funcs_MaxNodes : public ULintRule_Blueprint_Base { + GENERATED_BODY() public: - ULintRule_Blueprint_Funcs_MaxNodes(const FObjectInitializer& ObjectInitializer); + ULintRule_Blueprint_Funcs_MaxNodes(const FObjectInitializer& ObjectInitializer); - UPROPERTY(EditDefaultsOnly, Category = "Settings") - int32 MaxExpectedNonTrivialNodes = 50; + UPROPERTY(EditDefaultsOnly, Category = "Settings") + int32 MaxExpectedNonTrivialNodes = 50; - static bool IsNodeTrivial(const UEdGraphNode* Node); + static bool IsNodeTrivial(const UEdGraphNode* Node); protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - -}; \ No newline at end of file + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; +}; diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h index 2022592..337a3c0 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_MustHaveReturn.h @@ -7,13 +7,12 @@ #include "LintRule_Blueprint_Funcs_MustHaveReturn.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Blueprint_Funcs_MustHaveReturn : public ULintRule_Blueprint_Base -{ - GENERATED_BODY() +class LINTER_API ULintRule_Blueprint_Funcs_MustHaveReturn : public ULintRule_Blueprint_Base { + GENERATED_BODY() public: - ULintRule_Blueprint_Funcs_MustHaveReturn(const FObjectInitializer& ObjectInitializer); + ULintRule_Blueprint_Funcs_MustHaveReturn(const FObjectInitializer& ObjectInitializer); protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; -}; \ No newline at end of file + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; +}; diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h index d19b5bd..74524fe 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Funcs_PublicDescriptions.h @@ -7,14 +7,12 @@ #include "LintRule_Blueprint_Funcs_PublicDescriptions.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Blueprint_Funcs_PublicDescriptions : public ULintRule_Blueprint_Base -{ - GENERATED_BODY() +class LINTER_API ULintRule_Blueprint_Funcs_PublicDescriptions : public ULintRule_Blueprint_Base { + GENERATED_BODY() public: - ULintRule_Blueprint_Funcs_PublicDescriptions(const FObjectInitializer& ObjectInitializer); + ULintRule_Blueprint_Funcs_PublicDescriptions(const FObjectInitializer& ObjectInitializer); protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - -}; \ No newline at end of file + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; +}; diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h index 706e648..1975383 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_LooseNodes.h @@ -8,14 +8,12 @@ #include "LintRule_Blueprint_LooseNodes.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Blueprint_LooseNodes : public ULintRule_Blueprint_Base -{ - GENERATED_BODY() +class LINTER_API ULintRule_Blueprint_LooseNodes : public ULintRule_Blueprint_Base { + GENERATED_BODY() public: - ULintRule_Blueprint_LooseNodes(const FObjectInitializer& ObjectInitializer); + ULintRule_Blueprint_LooseNodes(const FObjectInitializer& ObjectInitializer); protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - -}; \ No newline at end of file + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; +}; diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h index 69246cb..2757a13 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_ConfigCategories.h @@ -8,17 +8,15 @@ #include "LintRule_Blueprint_Vars_ConfigCategories.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Blueprint_Vars_ConfigCategories : public ULintRule_Blueprint_Base -{ - GENERATED_BODY() +class LINTER_API ULintRule_Blueprint_Vars_ConfigCategories : public ULintRule_Blueprint_Base { + GENERATED_BODY() - UPROPERTY(EditDefaultsOnly, Category = "Settings") - int32 NumVariablesToRequireCategorization = 5; + UPROPERTY(EditDefaultsOnly, Category = "Settings") + int32 NumVariablesToRequireCategorization = 5; public: - ULintRule_Blueprint_Vars_ConfigCategories(const FObjectInitializer& ObjectInitializer); + ULintRule_Blueprint_Vars_ConfigCategories(const FObjectInitializer& ObjectInitializer); protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - -}; \ No newline at end of file + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; +}; diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h index d74fce4..22e4249 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_EditableMustHaveTooltip.h @@ -8,14 +8,12 @@ #include "LintRule_Blueprint_Vars_EditableMustHaveTooltip.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Blueprint_Vars_EditableMustHaveTooltip : public ULintRule_Blueprint_Base -{ - GENERATED_BODY() +class LINTER_API ULintRule_Blueprint_Vars_EditableMustHaveTooltip : public ULintRule_Blueprint_Base { + GENERATED_BODY() public: - ULintRule_Blueprint_Vars_EditableMustHaveTooltip(const FObjectInitializer& ObjectInitializer); + ULintRule_Blueprint_Vars_EditableMustHaveTooltip(const FObjectInitializer& ObjectInitializer); protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - -}; \ No newline at end of file + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; +}; diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h index f97849e..4228897 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NoConfigFlag.h @@ -8,14 +8,12 @@ #include "LintRule_Blueprint_Vars_NoConfigFlag.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Blueprint_Vars_NoConfigFlag : public ULintRule_Blueprint_Base -{ - GENERATED_BODY() +class LINTER_API ULintRule_Blueprint_Vars_NoConfigFlag : public ULintRule_Blueprint_Base { + GENERATED_BODY() public: - ULintRule_Blueprint_Vars_NoConfigFlag(const FObjectInitializer& ObjectInitializer); + ULintRule_Blueprint_Vars_NoConfigFlag(const FObjectInitializer& ObjectInitializer); protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - -}; \ No newline at end of file + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; +}; diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h index d63a6fc..6ce482a 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_NonAtomic.h @@ -9,16 +9,14 @@ #include "LintRule_Blueprint_Vars_NonAtomic.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Blueprint_Vars_NonAtomic : public ULintRule_Blueprint_Base -{ - GENERATED_BODY() +class LINTER_API ULintRule_Blueprint_Vars_NonAtomic : public ULintRule_Blueprint_Base { + GENERATED_BODY() public: - ULintRule_Blueprint_Vars_NonAtomic(const FObjectInitializer& ObjectInitializer); + ULintRule_Blueprint_Vars_NonAtomic(const FObjectInitializer& ObjectInitializer); - static bool IsVariableAtomic(FBPVariableDescription& VarDesc); + static bool IsVariableAtomic(FBPVariableDescription& VarDesc); protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - -}; \ No newline at end of file + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; +}; diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h index 262b5cd..ffc33a9 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_PluralArrays.h @@ -8,14 +8,12 @@ #include "LintRule_Blueprint_Vars_PluralArrays.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Blueprint_Vars_PluralArrays : public ULintRule_Blueprint_Base -{ - GENERATED_BODY() +class LINTER_API ULintRule_Blueprint_Vars_PluralArrays : public ULintRule_Blueprint_Base { + GENERATED_BODY() public: - ULintRule_Blueprint_Vars_PluralArrays(const FObjectInitializer& ObjectInitializer); + ULintRule_Blueprint_Vars_PluralArrays(const FObjectInitializer& ObjectInitializer); protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - -}; \ No newline at end of file + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; +}; diff --git a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h index d31dae4..de93ba0 100644 --- a/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h +++ b/Source/Linter/Public/LintRules/LintRule_Blueprint_Vars_Regex.h @@ -8,23 +8,21 @@ #include "LintRule_Blueprint_Vars_Regex.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Blueprint_Vars_Regex : public ULintRule_Blueprint_Base -{ - GENERATED_BODY() +class LINTER_API ULintRule_Blueprint_Vars_Regex : public ULintRule_Blueprint_Base { + GENERATED_BODY() public: - ULintRule_Blueprint_Vars_Regex(const FObjectInitializer& ObjectInitializer); + ULintRule_Blueprint_Vars_Regex(const FObjectInitializer& ObjectInitializer); - UPROPERTY(EditDefaultsOnly, Category = "Settings") - bool bUseLowercaseBPrefixForBooleans = true; + UPROPERTY(EditDefaultsOnly, Category = "Settings") + bool bUseLowercaseBPrefixForBooleans = true; - UPROPERTY(EditAnywhere, Category = "Settings") - FString RegexPatternString; + UPROPERTY(EditAnywhere, Category = "Settings") + FString RegexPatternString; - UPROPERTY(EditAnywhere, Category = "Settings") - bool bMustNotContainRegexPattern = true; + UPROPERTY(EditAnywhere, Category = "Settings") + bool bMustNotContainRegexPattern = true; protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - -}; \ No newline at end of file + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; +}; diff --git a/Source/Linter/Public/LintRules/LintRule_Collection.h b/Source/Linter/Public/LintRules/LintRule_Collection.h index 408ca2f..baa9cb3 100644 --- a/Source/Linter/Public/LintRules/LintRule_Collection.h +++ b/Source/Linter/Public/LintRules/LintRule_Collection.h @@ -7,17 +7,15 @@ #include "LintRule_Collection.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Collection : public ULintRule -{ - GENERATED_BODY() +class LINTER_API ULintRule_Collection : public ULintRule { + GENERATED_BODY() public: - ULintRule_Collection(const FObjectInitializer& ObjectInitializer); + ULintRule_Collection(const FObjectInitializer& ObjectInitializer); - UPROPERTY(EditDefaultsOnly, Category = "Settings") - TArray> SubRules; + UPROPERTY(EditDefaultsOnly, Category = "Settings") + TArray> SubRules; protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; }; diff --git a/Source/Linter/Public/LintRules/LintRule_IsNamedCorrectly_Base.h b/Source/Linter/Public/LintRules/LintRule_IsNamedCorrectly_Base.h index 95b611c..a59bcb5 100644 --- a/Source/Linter/Public/LintRules/LintRule_IsNamedCorrectly_Base.h +++ b/Source/Linter/Public/LintRules/LintRule_IsNamedCorrectly_Base.h @@ -7,17 +7,15 @@ UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_IsNamedCorrectly_Base : public ULintRule -{ - GENERATED_BODY() +class LINTER_API ULintRule_IsNamedCorrectly_Base : public ULintRule { + GENERATED_BODY() public: - ULintRule_IsNamedCorrectly_Base(const FObjectInitializer& ObjectInitializer); + ULintRule_IsNamedCorrectly_Base(const FObjectInitializer& ObjectInitializer); - UFUNCTION(BlueprintCallable, Category="Lint") - static FString BuildSuggestedName(FString CurrentName, FString DesiredPrefix, FString DesiredSuffix = TEXT("")); + UFUNCTION(BlueprintCallable, Category="Lint") + static FString BuildSuggestedName(FString CurrentName, FString DesiredPrefix, FString DesiredSuffix = TEXT("")); protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; }; diff --git a/Source/Linter/Public/LintRules/LintRule_ParticleSystem_EmitterNameRegex.h b/Source/Linter/Public/LintRules/LintRule_ParticleSystem_EmitterNameRegex.h index 4173b05..dd53ca6 100644 --- a/Source/Linter/Public/LintRules/LintRule_ParticleSystem_EmitterNameRegex.h +++ b/Source/Linter/Public/LintRules/LintRule_ParticleSystem_EmitterNameRegex.h @@ -7,32 +7,30 @@ #include "LintRule_ParticleSystem_EmitterNameRegex.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_ParticleSystem_EmitterNameRegex : public ULintRule -{ - GENERATED_BODY() +class LINTER_API ULintRule_ParticleSystem_EmitterNameRegex : public ULintRule { + GENERATED_BODY() public: - ULintRule_ParticleSystem_EmitterNameRegex(const FObjectInitializer& ObjectInitializer); + ULintRule_ParticleSystem_EmitterNameRegex(const FObjectInitializer& ObjectInitializer); - UPROPERTY(EditAnywhere, Category = "Settings") - int32 MinEmittersNeededToEnforce = 2; + UPROPERTY(EditAnywhere, Category = "Settings") + int32 MinEmittersNeededToEnforce = 2; - UPROPERTY(EditAnywhere, Category="Settings") - FString RegexPatternString; + UPROPERTY(EditAnywhere, Category="Settings") + FString RegexPatternString; - UPROPERTY(EditAnywhere, Category = "Settings") - bool bMustNotContainRegexPattern = true; + UPROPERTY(EditAnywhere, Category = "Settings") + bool bMustNotContainRegexPattern = true; - UPROPERTY(EditDefaultsOnly, Category = "Settings") - FText DisallowedRecommendedAction; + UPROPERTY(EditDefaultsOnly, Category = "Settings") + FText DisallowedRecommendedAction; - UPROPERTY(EditDefaultsOnly, Category = "Settings") - FText NonConformingRecommendedAction; + UPROPERTY(EditDefaultsOnly, Category = "Settings") + FText NonConformingRecommendedAction; - virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; + virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; }; diff --git a/Source/Linter/Public/LintRules/LintRule_Path_DisallowNames.h b/Source/Linter/Public/LintRules/LintRule_Path_DisallowNames.h index 8492417..1ef8c68 100644 --- a/Source/Linter/Public/LintRules/LintRule_Path_DisallowNames.h +++ b/Source/Linter/Public/LintRules/LintRule_Path_DisallowNames.h @@ -7,20 +7,18 @@ #include "LintRule_Path_DisallowNames.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Path_DisallowNames : public ULintRule -{ - GENERATED_BODY() +class LINTER_API ULintRule_Path_DisallowNames : public ULintRule { + GENERATED_BODY() public: - ULintRule_Path_DisallowNames(const FObjectInitializer& ObjectInitializer); + ULintRule_Path_DisallowNames(const FObjectInitializer& ObjectInitializer); - UPROPERTY(EditDefaultsOnly, Category = "Settings") - TArray DisallowedFolderNames; + UPROPERTY(EditDefaultsOnly, Category = "Settings") + TArray DisallowedFolderNames; - UPROPERTY(EditDefaultsOnly, Category = "Settings") - FText RecommendedAction; + UPROPERTY(EditDefaultsOnly, Category = "Settings") + FText RecommendedAction; protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; }; diff --git a/Source/Linter/Public/LintRules/LintRule_Path_IsNotTooLong.h b/Source/Linter/Public/LintRules/LintRule_Path_IsNotTooLong.h index 79375e8..d58d5ed 100644 --- a/Source/Linter/Public/LintRules/LintRule_Path_IsNotTooLong.h +++ b/Source/Linter/Public/LintRules/LintRule_Path_IsNotTooLong.h @@ -7,17 +7,15 @@ #include "LintRule_Path_IsNotTooLong.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Path_IsNotTooLong : public ULintRule -{ - GENERATED_BODY() +class LINTER_API ULintRule_Path_IsNotTooLong : public ULintRule { + GENERATED_BODY() public: - ULintRule_Path_IsNotTooLong(const FObjectInitializer& ObjectInitializer); + ULintRule_Path_IsNotTooLong(const FObjectInitializer& ObjectInitializer); - UPROPERTY(EditDefaultsOnly, Category = "Settings") - int32 MaxPathLimit = 140; + UPROPERTY(EditDefaultsOnly, Category = "Settings") + int32 MaxPathLimit = 140; protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; }; diff --git a/Source/Linter/Public/LintRules/LintRule_Path_NoTopLevel.h b/Source/Linter/Public/LintRules/LintRule_Path_NoTopLevel.h index ca3d0b3..a74249c 100644 --- a/Source/Linter/Public/LintRules/LintRule_Path_NoTopLevel.h +++ b/Source/Linter/Public/LintRules/LintRule_Path_NoTopLevel.h @@ -7,20 +7,18 @@ #include "LintRule_Path_NoTopLevel.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Path_NoTopLevel : public ULintRule -{ - GENERATED_BODY() +class LINTER_API ULintRule_Path_NoTopLevel : public ULintRule { + GENERATED_BODY() public: - ULintRule_Path_NoTopLevel(const FObjectInitializer& ObjectInitializer); + ULintRule_Path_NoTopLevel(const FObjectInitializer& ObjectInitializer); - UPROPERTY(EditDefaultsOnly, Category = "Display") - FText ZeroTopLevelFoldersRecommendedAction; + UPROPERTY(EditDefaultsOnly, Category = "Display") + FText ZeroTopLevelFoldersRecommendedAction; - UPROPERTY(EditDefaultsOnly, Category = "Display") - FText PleaseUseThisFolderRecommendedAction; + UPROPERTY(EditDefaultsOnly, Category = "Display") + FText PleaseUseThisFolderRecommendedAction; protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; }; diff --git a/Source/Linter/Public/LintRules/LintRule_Path_Regex.h b/Source/Linter/Public/LintRules/LintRule_Path_Regex.h index ef70cd1..02fd975 100644 --- a/Source/Linter/Public/LintRules/LintRule_Path_Regex.h +++ b/Source/Linter/Public/LintRules/LintRule_Path_Regex.h @@ -7,35 +7,33 @@ #include "LintRule_Path_Regex.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Path_Regex : public ULintRule -{ - GENERATED_BODY() +class LINTER_API ULintRule_Path_Regex : public ULintRule { + GENERATED_BODY() public: - ULintRule_Path_Regex(const FObjectInitializer& ObjectInitializer); + ULintRule_Path_Regex(const FObjectInitializer& ObjectInitializer); - UPROPERTY(EditAnywhere, Category="Settings") - FString RegexPatternString; + UPROPERTY(EditAnywhere, Category="Settings") + FString RegexPatternString; - UPROPERTY(EditAnywhere, Category = "Settings") - bool bMustNotContainRegexPattern = true; + UPROPERTY(EditAnywhere, Category = "Settings") + bool bMustNotContainRegexPattern = true; - UPROPERTY(EditAnywhere, Category = "Settings") - bool bCheckPerPathElement = true; + UPROPERTY(EditAnywhere, Category = "Settings") + bool bCheckPerPathElement = true; - UPROPERTY(EditDefaultsOnly, Category = "Settings|Whole Path") - FText DisallowedWholePathRecommendedAction; + UPROPERTY(EditDefaultsOnly, Category = "Settings|Whole Path") + FText DisallowedWholePathRecommendedAction; - UPROPERTY(EditDefaultsOnly, Category = "Settings|Whole Path") - FText NonConformingWholePathRecommendedAction; + UPROPERTY(EditDefaultsOnly, Category = "Settings|Whole Path") + FText NonConformingWholePathRecommendedAction; - UPROPERTY(EditDefaultsOnly, Category = "Settings|Path Element") - FText DisallowedPathElementRecommendedAction; + UPROPERTY(EditDefaultsOnly, Category = "Settings|Path Element") + FText DisallowedPathElementRecommendedAction; - UPROPERTY(EditDefaultsOnly, Category = "Settings|Path Element") - FText NonConformingPathElementRecommendedAction; + UPROPERTY(EditDefaultsOnly, Category = "Settings|Path Element") + FText NonConformingPathElementRecommendedAction; protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; }; diff --git a/Source/Linter/Public/LintRules/LintRule_SoundWave_SampleRate.h b/Source/Linter/Public/LintRules/LintRule_SoundWave_SampleRate.h index a816c2b..f2aebe0 100644 --- a/Source/Linter/Public/LintRules/LintRule_SoundWave_SampleRate.h +++ b/Source/Linter/Public/LintRules/LintRule_SoundWave_SampleRate.h @@ -7,20 +7,18 @@ #include "LintRule_SoundWave_SampleRate.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_SoundWave_SampleRate : public ULintRule -{ - GENERATED_BODY() +class LINTER_API ULintRule_SoundWave_SampleRate : public ULintRule { + GENERATED_BODY() public: - ULintRule_SoundWave_SampleRate(const FObjectInitializer& ObjectInitializer); + ULintRule_SoundWave_SampleRate(const FObjectInitializer& ObjectInitializer); - UPROPERTY(EditDefaultsOnly, Category = "Settings") - TArray ValidSampleRates; + UPROPERTY(EditDefaultsOnly, Category = "Settings") + TArray ValidSampleRates; - virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; + virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; }; diff --git a/Source/Linter/Public/LintRules/LintRule_StaticMesh_ValidUVs.h b/Source/Linter/Public/LintRules/LintRule_StaticMesh_ValidUVs.h index fd755fb..8f142b9 100644 --- a/Source/Linter/Public/LintRules/LintRule_StaticMesh_ValidUVs.h +++ b/Source/Linter/Public/LintRules/LintRule_StaticMesh_ValidUVs.h @@ -7,19 +7,17 @@ #include "LintRule_StaticMesh_ValidUVs.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_StaticMesh_ValidUVs : public ULintRule -{ - GENERATED_BODY() +class LINTER_API ULintRule_StaticMesh_ValidUVs : public ULintRule { + GENERATED_BODY() public: - ULintRule_StaticMesh_ValidUVs(const FObjectInitializer& ObjectInitializer); + ULintRule_StaticMesh_ValidUVs(const FObjectInitializer& ObjectInitializer); - UPROPERTY(EditDefaultsOnly, Category = "Settings") - bool bIgnoreMissingUVs = false; + UPROPERTY(EditDefaultsOnly, Category = "Settings") + bool bIgnoreMissingUVs = false; - virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; + virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; }; diff --git a/Source/Linter/Public/LintRules/LintRule_Texture_Size_NotTooBig.h b/Source/Linter/Public/LintRules/LintRule_Texture_Size_NotTooBig.h index 273e57f..f0f0959 100644 --- a/Source/Linter/Public/LintRules/LintRule_Texture_Size_NotTooBig.h +++ b/Source/Linter/Public/LintRules/LintRule_Texture_Size_NotTooBig.h @@ -7,22 +7,20 @@ #include "LintRule_Texture_Size_NotTooBig.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Texture_Size_NotTooBig : public ULintRule -{ - GENERATED_BODY() +class LINTER_API ULintRule_Texture_Size_NotTooBig : public ULintRule { + GENERATED_BODY() public: - ULintRule_Texture_Size_NotTooBig(const FObjectInitializer& ObjectInitializer); + ULintRule_Texture_Size_NotTooBig(const FObjectInitializer& ObjectInitializer); - UPROPERTY(EditDefaultsOnly, Category = "Settings") - int32 MaxTextureSizeX = 8192; + UPROPERTY(EditDefaultsOnly, Category = "Settings") + int32 MaxTextureSizeX = 8192; - UPROPERTY(EditDefaultsOnly, Category = "Settings") - int32 MaxTextureSizeY = 8192; + UPROPERTY(EditDefaultsOnly, Category = "Settings") + int32 MaxTextureSizeY = 8192; - virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; + virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; }; diff --git a/Source/Linter/Public/LintRules/LintRule_Texture_Size_PowerOfTwo.h b/Source/Linter/Public/LintRules/LintRule_Texture_Size_PowerOfTwo.h index feb482c..804edea 100644 --- a/Source/Linter/Public/LintRules/LintRule_Texture_Size_PowerOfTwo.h +++ b/Source/Linter/Public/LintRules/LintRule_Texture_Size_PowerOfTwo.h @@ -8,19 +8,17 @@ #include "LintRule_Texture_Size_PowerOfTwo.generated.h" UCLASS(BlueprintType, Blueprintable, Abstract) -class LINTER_API ULintRule_Texture_Size_PowerOfTwo : public ULintRule -{ - GENERATED_BODY() +class LINTER_API ULintRule_Texture_Size_PowerOfTwo : public ULintRule { + GENERATED_BODY() public: - ULintRule_Texture_Size_PowerOfTwo(const FObjectInitializer& ObjectInitializer); + ULintRule_Texture_Size_PowerOfTwo(const FObjectInitializer& ObjectInitializer); - UPROPERTY(EditDefaultsOnly, Category = "Settings") - TSet> IgnoreTexturesInTheseGroups; + UPROPERTY(EditDefaultsOnly, Category = "Settings") + TSet> IgnoreTexturesInTheseGroups; - virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; + virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; protected: - virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; - + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; }; diff --git a/Source/Linter/Public/LintRunner.h b/Source/Linter/Public/LintRunner.h index 4bc506d..3cb7aca 100644 --- a/Source/Linter/Public/LintRunner.h +++ b/Source/Linter/Public/LintRunner.h @@ -9,27 +9,24 @@ struct FLintRuleList; struct FLintRuleViolation; class ULintRuleSet; -class FLintRunner : public FRunnable -{ - +class FLintRunner : public FRunnable { public: + FLintRunner(UObject* InLoadedObject, const ULintRuleSet* LintRuleSet, TArray* InpOutRuleViolations, FScopedSlowTask* InParentScopedSlowTask); - FLintRunner(UObject* InLoadedObject, const ULintRuleSet* LintRuleSet, TArray* InpOutRuleViolations, FScopedSlowTask* InParentScopedSlowTask); - - virtual bool RequiresGamethread(); + virtual bool RequiresGamethread(); - virtual bool Init() override; - virtual uint32 Run() override; - virtual void Stop() override; - virtual void Exit() override; + virtual bool Init() override; + virtual uint32 Run() override; + virtual void Stop() override; + virtual void Exit() override; protected: - UObject* LoadedObject = nullptr; - const ULintRuleSet* RuleSet = nullptr; - TArray* pOutRuleViolations; + UObject* LoadedObject = nullptr; + const ULintRuleSet* RuleSet = nullptr; + TArray* pOutRuleViolations; - const FLintRuleList* pLoadedRuleList; - static FCriticalSection LintDataUpdateLock; + const FLintRuleList* pLoadedRuleList; + static FCriticalSection LintDataUpdateLock; - FScopedSlowTask* ParentScopedSlowTask; -}; \ No newline at end of file + FScopedSlowTask* ParentScopedSlowTask; +}; diff --git a/Source/Linter/Public/Linter.h b/Source/Linter/Public/Linter.h index 00ec685..fe268ff 100644 --- a/Source/Linter/Public/Linter.h +++ b/Source/Linter/Public/Linter.h @@ -8,48 +8,44 @@ class FLinterManagerBase; DECLARE_LOG_CATEGORY_EXTERN(LogLinter, Verbose, All); + DECLARE_LOG_CATEGORY_EXTERN(LogCommandlet, All, All); -class LINTER_API FLinterModule : public IModuleInterface -{ +class LINTER_API FLinterModule : public IModuleInterface { public: + /** IModuleInterface implementation */ + virtual void StartupModule() override; + virtual void ShutdownModule() override; + + static TSharedRef SpawnTab(const FSpawnTabArgs& TabSpawnArgs, TSharedPtr StyleSet); + + virtual bool SupportsDynamicReloading() override { + return false; + } - /** IModuleInterface implementation */ - virtual void StartupModule() override; - virtual void ShutdownModule() override; - - static TSharedRef SpawnTab(const FSpawnTabArgs& TabSpawnArgs, TSharedPtr StyleSet); - - virtual bool SupportsDynamicReloading() override - { - return false; - } - - virtual TArray GetDesiredLintPaths() - { - if (DesiredLintPaths.Num() == 0) - { - DesiredLintPaths.Push(TEXT("/Game")); - } - - return DesiredLintPaths; - } - virtual void SetDesiredLintPaths(TArray LintPaths) - { - DesiredLintPaths = LintPaths; - if (DesiredLintPaths.Num() == 0) - { - DesiredLintPaths.Push(TEXT("/Game")); - } - } + virtual TArray GetDesiredLintPaths() { + if (DesiredLintPaths.Num() == 0) { + DesiredLintPaths.Push(TEXT("/Game")); + } + + return DesiredLintPaths; + } + + virtual void SetDesiredLintPaths(TArray LintPaths) { + DesiredLintPaths = LintPaths; + if (DesiredLintPaths.Num() == 0) { + DesiredLintPaths.Push(TEXT("/Game")); + } + } private: - FDelegateHandle LevelEditorTabManagerChangedHandle; - FDelegateHandle ContentBrowserExtenderDelegateHandle; - FDelegateHandle AssetExtenderDelegateHandle; + FDelegateHandle LevelEditorTabManagerChangedHandle; + FDelegateHandle ContentBrowserExtenderDelegateHandle; + FDelegateHandle AssetExtenderDelegateHandle; + + TArray DesiredLintPaths; - TArray DesiredLintPaths; public: - void OnInitialAssetRegistrySearchComplete(); - static void TryToLoadAllLintRuleSets(); -}; \ No newline at end of file + void OnInitialAssetRegistrySearchComplete(); + static void TryToLoadAllLintRuleSets(); +}; diff --git a/Source/Linter/Public/LinterBase.h b/Source/Linter/Public/LinterBase.h index 3a8c32d..fa5c9c9 100644 --- a/Source/Linter/Public/LinterBase.h +++ b/Source/Linter/Public/LinterBase.h @@ -13,108 +13,90 @@ * This would simplify a lot of the data and structs being used here. -- Allar **/ -struct LINTER_API FLinterAssetError -{ - /** User friendly error message ready for displaying. */ - FText ErrorMessage; - - /** URL Link to link user to if they want more information on this error. */ - FString URLLink; - - FLinterAssetError(FText InErrorMessage, FString InURLLink = TEXT("")) - : ErrorMessage(InErrorMessage) - , URLLink(InURLLink) - { - } +struct LINTER_API FLinterAssetError { + /** User friendly error message ready for displaying. */ + FText ErrorMessage; + + /** URL Link to link user to if they want more information on this error. */ + FString URLLink; + + FLinterAssetError(FText InErrorMessage, FString InURLLink = TEXT("")) : + ErrorMessage(InErrorMessage), + URLLink(InURLLink) { } }; -struct LINTER_API FLinterAssetErrorList -{ - FString AssetName; - FString AssetPath; - FString SuggestedAssetName; - TArray> Errors; - TArray> Warnings; - - - FLinterAssetErrorList() {}; - - FLinterAssetErrorList(FString InAssetName, FString InAssetPath, TArray> InErrors, TArray> InWarnings, FString InSuggestedAssetName = TEXT("")) - : AssetName(InAssetName) - , AssetPath(InAssetPath) - , SuggestedAssetName(InSuggestedAssetName) - , Errors(InErrors) - , Warnings(InWarnings) - { - } - - FLinterAssetErrorList(const UObject* Object, TArray> InErrors, TArray> InWarnings, FString InSuggestedAssetName = TEXT("")) - : AssetName(Object->GetName()) - , AssetPath(Object->GetPathName()) - , SuggestedAssetName(InSuggestedAssetName) - , Errors(InErrors) - , Warnings(InWarnings) - - { - } - - void Reset() - { - AssetName.Empty(); - AssetPath.Empty(); - SuggestedAssetName.Empty(); - Errors.Empty(); - Warnings.Empty(); - } - - bool IsEmpty() - { - return Errors.Num() == 0 && Warnings.Num() == 0; - } - - bool HasErrors() - { - return Errors.Num() != 0; - } +struct LINTER_API FLinterAssetErrorList { + FString AssetName; + FString AssetPath; + FString SuggestedAssetName; + TArray> Errors; + TArray> Warnings; + + + FLinterAssetErrorList() {}; + + FLinterAssetErrorList(FString InAssetName, FString InAssetPath, TArray> InErrors, TArray> InWarnings, FString InSuggestedAssetName = TEXT("")) : + AssetName(InAssetName), + AssetPath(InAssetPath), + SuggestedAssetName(InSuggestedAssetName), + Errors(InErrors), + Warnings(InWarnings) { } + + FLinterAssetErrorList(const UObject* Object, TArray> InErrors, TArray> InWarnings, FString InSuggestedAssetName = TEXT("")) : + AssetName(Object->GetFName()), + AssetPath(Object->GetPathName()), + SuggestedAssetName(InSuggestedAssetName), + Errors(InErrors), + Warnings(InWarnings) { } + + void Reset() { + AssetName.Empty(); + AssetPath.Empty(); + SuggestedAssetName.Empty(); + Errors.Empty(); + Warnings.Empty(); + } + + bool IsEmpty() { + return Errors.Num() == 0 && Warnings.Num() == 0; + } + + bool HasErrors() { + return Errors.Num() != 0; + } }; /* Linter was originally built to store its data on a per-asset basis. * After Epic's purchase, UI needed a way to store data on a per-rule basis. * The following structs help out the LinterManager populate a per-rule list after Linting is complete. */ -struct LINTER_API FLinterAssetInfo -{ - FString AssetName; - FString AssetPath; - FString SuggestedAssetName; +struct LINTER_API FLinterAssetInfo { + FString AssetName; + FString AssetPath; + FString SuggestedAssetName; - FText RuleErrorContext; + FText RuleErrorContext; - FLinterAssetInfo(const UObject* Object, FText InRuleErrorContext = FText::GetEmpty(), FString InSuggestedAssetName = TEXT("")) - { - AssetName = Object->GetName(); - AssetPath = Object->GetPathName(); - SuggestedAssetName = InSuggestedAssetName; - } + FLinterAssetInfo(const UObject* Object, FText InRuleErrorContext = FText::GetEmpty(), FString InSuggestedAssetName = TEXT("")) { + AssetName = Object->GetName(); + AssetPath = Object->GetPathName(); + SuggestedAssetName = InSuggestedAssetName; + } }; -struct LINTER_API FLinterRuleErrorList -{ - FText RuleMessage; - FString RuleURL; - bool bWarning; - TArray> AssetInfos; - - FLinterRuleErrorList() - : bWarning(false) - { - } - - FLinterRuleErrorList(FText InRuleMessage, FText InRuleContext, bool bInWarning, const UObject* Object, FString InRuleURL, FString InSuggestedAssetName = TEXT("")) - : RuleMessage(InRuleMessage) - , RuleURL(InRuleURL) - , bWarning(bInWarning) - { - AssetInfos.Add(MakeShareable(new FLinterAssetInfo(Object, InRuleContext, InSuggestedAssetName))); - } -}; \ No newline at end of file +struct LINTER_API FLinterRuleErrorList { + FText RuleMessage; + FString RuleURL; + bool bWarning; + TArray> AssetInfos; + + FLinterRuleErrorList() : + bWarning(false) { } + + FLinterRuleErrorList(FText InRuleMessage, FText InRuleContext, bool bInWarning, const UObject* Object, FString InRuleURL, FString InSuggestedAssetName = TEXT("")) : + RuleMessage(InRuleMessage), + RuleURL(InRuleURL), + bWarning(bInWarning) { + AssetInfos.Add(MakeShareable(new FLinterAssetInfo(Object, InRuleContext, InSuggestedAssetName))); + } +}; diff --git a/Source/Linter/Public/LinterCommandlet.h b/Source/Linter/Public/LinterCommandlet.h index 3fa342e..7bb180b 100644 --- a/Source/Linter/Public/LinterCommandlet.h +++ b/Source/Linter/Public/LinterCommandlet.h @@ -5,13 +5,7 @@ #include "LinterCommandlet.generated.h" UCLASS() -class ULinterCommandlet : public UCommandlet -{ - GENERATED_UCLASS_BODY() - //~ Begin UCommandlet Interface - virtual int32 Main(const FString& Params) override; - - //~ End UCommandlet Interface +class ULinterCommandlet : public UCommandlet { + GENERATED_UCLASS_BODY() + virtual int32 Main(const FString& Params) override; }; - - diff --git a/Source/Linter/Public/LinterContentBrowserExtensions.h b/Source/Linter/Public/LinterContentBrowserExtensions.h index 65184f5..cd19e3c 100644 --- a/Source/Linter/Public/LinterContentBrowserExtensions.h +++ b/Source/Linter/Public/LinterContentBrowserExtensions.h @@ -5,9 +5,8 @@ class FLinterModule; // Integrate Linter actions into the Content Browser -class FLinterContentBrowserExtensions -{ +class FLinterContentBrowserExtensions { public: - static void InstallHooks(FLinterModule* LinterModule, class FDelegateHandle* pContentBrowserExtenderDelegateHandle, class FDelegateHandle* pAssetExtenderDelegateHandle); - static void RemoveHooks(FLinterModule* LinterModule, class FDelegateHandle* pContentBrowserExtenderDelegateHandle, class FDelegateHandle* pAssetExtenderDelegateHandle); -}; \ No newline at end of file + static void InstallHooks(FLinterModule* LinterModule, class FDelegateHandle* pContentBrowserExtenderDelegateHandle, class FDelegateHandle* pAssetExtenderDelegateHandle); + static void RemoveHooks(FLinterModule* LinterModule, class FDelegateHandle* pContentBrowserExtenderDelegateHandle, class FDelegateHandle* pAssetExtenderDelegateHandle); +}; diff --git a/Source/Linter/Public/LinterNamingConvention.h b/Source/Linter/Public/LinterNamingConvention.h index c24e997..c83864d 100644 --- a/Source/Linter/Public/LinterNamingConvention.h +++ b/Source/Linter/Public/LinterNamingConvention.h @@ -8,9 +8,6 @@ #include "PropertyHandle.h" #include "Engine/DataAsset.h" #include "Misc/EngineVersionComparison.h" -#if UE_VERSION_NEWER_THAN(5, 0, 0) -#include "UObject/ObjectSaveContext.h" -#endif #include "LinterNamingConvention.generated.h" @@ -18,71 +15,64 @@ * Class/Prefix/Suffix settings for Linter */ USTRUCT(BlueprintType) -struct LINTER_API FLinterNamingConventionInfo -{ - GENERATED_USTRUCT_BODY() +struct LINTER_API FLinterNamingConventionInfo { + GENERATED_USTRUCT_BODY() - FLinterNamingConventionInfo() - : SoftClassPtr(nullptr) - {} + FLinterNamingConventionInfo() : + SoftClassPtr(nullptr) {} - FLinterNamingConventionInfo(TSoftClassPtr InClass, FString InPrefix = TEXT(""), FString InSuffix = TEXT(""), FName InVariant = NAME_None) - : SoftClassPtr(InClass) - , Prefix(InPrefix) - , Suffix(InSuffix) - , Variant(InVariant) - {} + FLinterNamingConventionInfo(TSoftClassPtr InClass, FString InPrefix = TEXT(""), FString InSuffix = TEXT(""), FName InVariant = NAME_None) : + SoftClassPtr(InClass), + Prefix(InPrefix), + Suffix(InSuffix), + Variant(InVariant) {} - UPROPERTY(EditAnywhere, Category = Default, meta = (AllowAbstract = "")) - TSoftClassPtr SoftClassPtr; + UPROPERTY(EditAnywhere, Category = Default, meta = (AllowAbstract = "")) + TSoftClassPtr SoftClassPtr; - UPROPERTY(EditAnywhere, Category = Default) - FString Prefix; + UPROPERTY(EditAnywhere, Category = Default) + FString Prefix; - UPROPERTY(EditAnywhere, Category = Default) - FString Suffix; + UPROPERTY(EditAnywhere, Category = Default) + FString Suffix; - UPROPERTY(EditAnywhere, Category = Default) - FName Variant; + UPROPERTY(EditAnywhere, Category = Default) + FName Variant; }; -class FLinterNamingConventionDetails : public IDetailCustomization -{ +class FLinterNamingConventionDetails : public IDetailCustomization { public: - /** Makes a new instance of this detail layout class for a specific detail view requesting it */ - static TSharedRef MakeInstance(); + /** Makes a new instance of this detail layout class for a specific detail view requesting it */ + static TSharedRef MakeInstance(); - /** ILayoutDetails interface */ - virtual void CustomizeDetails(class IDetailLayoutBuilder& DetailBuilder) override; + /** ILayoutDetails interface */ + virtual void CustomizeDetails(class IDetailLayoutBuilder& DetailBuilder) override; - void OnGenerateElementForDetails(TSharedRef StructProperty, int32 ElementIndex, IDetailChildrenBuilder& ChildrenBuilder, IDetailLayoutBuilder* DetailLayout); + void OnGenerateElementForDetails(TSharedRef StructProperty, int32 ElementIndex, IDetailChildrenBuilder& ChildrenBuilder, IDetailLayoutBuilder* DetailLayout); }; /** * Contains a naming convention to be used by LinterManagers/LinterRules */ UCLASS(Abstract) -class LINTER_API ULinterNamingConvention : public UDataAsset -{ - GENERATED_BODY() +class LINTER_API ULinterNamingConvention : public UDataAsset { + GENERATED_BODY() public: + ULinterNamingConvention(const FObjectInitializer& ObjectInitializer); - ULinterNamingConvention(const FObjectInitializer& ObjectInitializer); + UPROPERTY(EditAnywhere, Category="Conventions", meta = (AllowAbstract = "")) + TArray ClassNamingConventions; - UPROPERTY(EditAnywhere, Category="Conventions", meta = (AllowAbstract = "")) - TArray ClassNamingConventions; + UFUNCTION(BlueprintCallable, Category="Conventions") + TArray GetNamingConventionsForClassVariant(TSoftClassPtr Class, FName Variant = NAME_None) const; - UFUNCTION(BlueprintCallable, Category="Conventions") - TArray GetNamingConventionsForClassVariant(TSoftClassPtr Class, FName Variant = NAME_None) const; - - UFUNCTION(Blueprintcallable, Category = "Conventions") - void SortConventions(); + UFUNCTION(Blueprintcallable, Category = "Conventions") + void SortConventions(); #if UE_VERSION_NEWER_THAN(5, 0, 0) - virtual void PreSave(FObjectPreSaveContext ObjectSaveContext) override; + virtual void PreSave(FObjectPreSaveContext ObjectSaveContext) override; #else - virtual void PreSave(const class ITargetPlatform* TargetPlatform) override; + virtual void PreSave(const class ITargetPlatform* TargetPlatform) override; #endif - }; diff --git a/Source/Linter/Public/LinterSettings.h b/Source/Linter/Public/LinterSettings.h index a56c7ca..6da5a39 100644 --- a/Source/Linter/Public/LinterSettings.h +++ b/Source/Linter/Public/LinterSettings.h @@ -11,15 +11,12 @@ * Implements the settings for the Linter plugin. */ UCLASS(config = Linter, defaultconfig) -class ULinterSettings : public UObject -{ - GENERATED_BODY() +class ULinterSettings : public UObject { + GENERATED_BODY() - ULinterSettings(const FObjectInitializer& ObjectInitializer); + ULinterSettings(const FObjectInitializer& ObjectInitializer); public: - - UPROPERTY(EditAnywhere, config, Category = Settings) - TSoftObjectPtr DefaultLintRuleSet; - + UPROPERTY(EditAnywhere, config, Category = Settings) + TSoftObjectPtr DefaultLintRuleSet; }; diff --git a/Source/Linter/Public/LinterStyle.h b/Source/Linter/Public/LinterStyle.h index 236384f..b758c6d 100644 --- a/Source/Linter/Public/LinterStyle.h +++ b/Source/Linter/Public/LinterStyle.h @@ -4,17 +4,17 @@ #include "CoreTypes.h" #include "Styling/ISlateStyle.h" -class FLinterStyle -{ +class FLinterStyle { public: - static void Initialize(); + static void Initialize(); - static void Shutdown(); + static void Shutdown(); - static TSharedPtr< class ISlateStyle > Get(); - static TSharedPtr< class FSlateStyleSet > StyleSet; + static TSharedPtr Get(); + static TSharedPtr StyleSet; + + static FName GetStyleSetName(); - static FName GetStyleSetName(); private: - static FString InContent(const FString& RelativePath, const ANSICHAR* Extension); -}; \ No newline at end of file + static FString InContent(const FString& RelativePath, const ANSICHAR* Extension); +}; diff --git a/Source/Linter/Public/TooltipEditor/TooltipStringHelper.h b/Source/Linter/Public/TooltipEditor/TooltipStringHelper.h index 5d41e74..18be9fe 100644 --- a/Source/Linter/Public/TooltipEditor/TooltipStringHelper.h +++ b/Source/Linter/Public/TooltipEditor/TooltipStringHelper.h @@ -6,34 +6,27 @@ /** * Helper struct for showing function tooltip widgets **/ -struct FBPFunctionArgumentDescription -{ - FText ArgumentName; - FText Tooltip; - FText ArgumentType; +struct FBPFunctionArgumentDescription { + FText ArgumentName; + FText Tooltip; + FText ArgumentType; - FBPFunctionArgumentDescription() - { - } + FBPFunctionArgumentDescription() { } - FBPFunctionArgumentDescription(FText InArgumentName, FText InTooltip, FText InArgumentType = FText::GetEmpty()) - : ArgumentName(InArgumentName) - , Tooltip(InTooltip) - , ArgumentType(InArgumentType) - { - } + FBPFunctionArgumentDescription(FText InArgumentName, FText InTooltip, FText InArgumentType = FText::GetEmpty()) : + ArgumentName(InArgumentName), + Tooltip(InTooltip), + ArgumentType(InArgumentType) { } - FText GetToolTipTextRef() - { - return Tooltip; - } + FText GetToolTipTextRef() { + return Tooltip; + } }; -class FTooltipStringHelper -{ +class FTooltipStringHelper { public: - static FText ParseFunctionRawTooltipGetDescription(FString RawTooltip, bool bRemoveNewlines = false); - static bool ParseFunctionRawTooltip(FString RawTooltip, FText& OutFunctionDescription, TArray>& Inputs, TArray>& Outputs, FText& OutReturnText); - static FString ConvertTooltipDataToRawTooltip(FText FunctionDescription, TArray> Inputs, TArray> Outputs); - static bool FindAndUpdateArgumentTooltip(FText ArgumentName, FText Tooltip, TArray>& Arguments); -}; \ No newline at end of file + static FText ParseFunctionRawTooltipGetDescription(FString RawTooltip, bool bRemoveNewlines = false); + static bool ParseFunctionRawTooltip(FString RawTooltip, FText& OutFunctionDescription, TArray>& Inputs, TArray>& Outputs, FText& OutReturnText); + static FString ConvertTooltipDataToRawTooltip(FText FunctionDescription, TArray> Inputs, TArray> Outputs); + static bool FindAndUpdateArgumentTooltip(FText ArgumentName, FText Tooltip, TArray>& Arguments); +}; diff --git a/Source/Linter/Public/TooltipEditor/TooltipTool.h b/Source/Linter/Public/TooltipEditor/TooltipTool.h index 70ba714..806ab09 100644 --- a/Source/Linter/Public/TooltipEditor/TooltipTool.h +++ b/Source/Linter/Public/TooltipEditor/TooltipTool.h @@ -3,9 +3,7 @@ #pragma once #include "Widgets/SCompoundWidget.h" -#include "Widgets/SUserWidget.h" #include "Widgets/SWindow.h" -#include "Widgets/Layout/SUniformGridPanel.h" #include "Widgets/Input/SCheckBox.h" #include "Widgets/Input/SComboBox.h" #include "Widgets/Input/SMultiLineEditableTextBox.h" @@ -23,22 +21,19 @@ /** * Helper struct for showing function tooltip widgets **/ -struct FBPFunctionPointers -{ - UK2Node_FunctionEntry* FunctionEntryNode; - UK2Node_FunctionResult* FunctionResultNode; - FName FunctionName; - - FBPFunctionPointers() - { - } - - FBPFunctionPointers(UK2Node_FunctionEntry* InFunctionEntryNode, UK2Node_FunctionResult* InFunctionResultNode, FName InFunctionName) - : FunctionEntryNode(InFunctionEntryNode) - , FunctionResultNode(InFunctionResultNode) - , FunctionName(InFunctionName) - { - } +struct FBPFunctionPointers { + UK2Node_FunctionEntry* FunctionEntryNode; + UK2Node_FunctionResult* FunctionResultNode; + FName FunctionName; + + FBPFunctionPointers() : + FunctionEntryNode{nullptr}, + FunctionResultNode{nullptr} {} + + FBPFunctionPointers(UK2Node_FunctionEntry* InFunctionEntryNode, UK2Node_FunctionResult* InFunctionResultNode, FName InFunctionName) : + FunctionEntryNode(InFunctionEntryNode), + FunctionResultNode(InFunctionResultNode), + FunctionName(InFunctionName) { } }; /** @@ -47,105 +42,97 @@ struct FBPFunctionPointers * Wrapper class for STooltipTool. This class creates and launches a dialog then awaits the * result to return to the user. */ -class FTooltipTool -{ +class FTooltipTool { public: - enum EResult - { - Cancel = 0, // No/Cancel, normal usage would stop the current action - Confirm = 1, // Yes/Ok/Etc, normal usage would continue with action - }; + enum EResult { + Cancel = 0, + // No/Cancel, normal usage would stop the current action + Confirm = 1, + // Yes/Ok/Etc, normal usage would continue with action + }; - FTooltipTool(const TArray Assets); + FTooltipTool(const TArray Assets); - /** Shows the dialog box and waits for the user to respond. */ - EResult ShowModal(); + /** Shows the dialog box and waits for the user to respond. */ + EResult ShowModal(); - TArray BlueprintsInternal; - TArray> Blueprints; + TArray BlueprintsInternal; + TArray> Blueprints; private: + /** Cached pointer to the modal window */ + TSharedPtr DialogWindow; - /** Cached pointer to the modal window */ - TSharedPtr DialogWindow; - - /** Cached pointer to the batch rename tool widget */ - TSharedPtr DialogWidget; + /** Cached pointer to the batch rename tool widget */ + TSharedPtr DialogWidget; }; /** * Slate panel for batch renaming */ -class STooltipTool : public SCompoundWidget -{ +class STooltipTool : public SCompoundWidget { public: - - SLATE_BEGIN_ARGS(STooltipTool) - {} - /** Window in which this widget resides */ - SLATE_ATTRIBUTE(TSharedPtr, ParentWindow) - SLATE_ATTRIBUTE(TArray>, Blueprints) - SLATE_END_ARGS() - - /** - * Constructs this widget - * - * @param InArgs The declaration data for this widget - */ - void Construct(const FArguments& InArgs); - - /** - * Returns the EResult of the button which the user pressed. Closing of the dialog - * in any other way than clicking "Ok" results in this returning a "Cancel" value - */ - FTooltipTool::EResult GetUserResponse() const; + SLATE_BEGIN_ARGS(STooltipTool) {} + /** Window in which this widget resides */ + SLATE_ATTRIBUTE(TSharedPtr, ParentWindow) + SLATE_ATTRIBUTE(TArray>, Blueprints) + SLATE_END_ARGS() + + /** + * Constructs this widget + * + * @param InArgs The declaration data for this widget + */ + void Construct(const FArguments& InArgs); + + /** + * Returns the EResult of the button which the user pressed. Closing of the dialog + * in any other way than clicking "Ok" results in this returning a "Cancel" value + */ + FTooltipTool::EResult GetUserResponse() const; private: + /** + * Handles when a button is pressed, should be bound with appropriate EResult Key + * + * @param ButtonID - The return type of the button which has been pressed. + */ + FReply OnButtonClick(FTooltipTool::EResult ButtonID); - /** - * Handles when a button is pressed, should be bound with appropriate EResult Key - * - * @param ButtonID - The return type of the button which has been pressed. - */ - FReply OnButtonClick(FTooltipTool::EResult ButtonID); - - FText GetSelectedBlueprintText() const; + FText GetSelectedBlueprintText() const; - void UpdateVariableTooltipText(const FText& NewText); - void UpdateCurrentFunctionTooltipText(); + void UpdateVariableTooltipText(const FText& NewText); + void UpdateCurrentFunctionTooltipText(); - void RebuildMemberList(); + void RebuildMemberList(); - /** Stores the users response to this dialog */ - FTooltipTool::EResult UserResponse; + /** Stores the users response to this dialog */ + FTooltipTool::EResult UserResponse; - /** Pointer to the window which holds this Widget, required for modal control */ - TSharedPtr ParentWindow; + /** Pointer to the window which holds this Widget, required for modal control */ + TSharedPtr ParentWindow; public: + TAttribute>> Blueprints; + TSharedPtr>> BlueprintComboBox; + FText CurrentFunctionDescription; - - TAttribute>> Blueprints; - TSharedPtr>> BlueprintComboBox; - - FText CurrentFunctionDescription; - - TArray> FunctionPointers; - TSharedPtr>> FunctionListView; - TSharedPtr FunctionDescriptionTooltipBox; - TArray> FunctionArgumentDescriptions; - TSharedPtr>> FunctionArgumentListView; - TArray> FunctionOutputDescriptions; - TSharedPtr>> FunctionOutputListView; + TArray> FunctionPointers; + TSharedPtr>> FunctionListView; + TSharedPtr FunctionDescriptionTooltipBox; + TArray> FunctionArgumentDescriptions; + TSharedPtr>> FunctionArgumentListView; + TArray> FunctionOutputDescriptions; + TSharedPtr>> FunctionOutputListView; - TArray> Members; - TSharedPtr>> MemberListView; - TSharedPtr VariableTooltipEditableTextBox; + TArray> Members; + TSharedPtr>> MemberListView; + TSharedPtr VariableTooltipEditableTextBox; - TSharedPtr CommitTextButton; - TSharedPtr CommitOnTextChangeCheckBox; + TSharedPtr CommitTextButton; + TSharedPtr CommitOnTextChangeCheckBox; }; -#undef LOCTEXT_NAMESPACE \ No newline at end of file +#undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Public/UI/LintReport.h b/Source/Linter/Public/UI/LintReport.h index 5ca7c49..8825a40 100644 --- a/Source/Linter/Public/UI/LintReport.h +++ b/Source/Linter/Public/UI/LintReport.h @@ -7,35 +7,28 @@ #include "LintRule.h" -class SLintReport : public SCompoundWidget -{ +class SLintReport : public SCompoundWidget { public: + SLATE_BEGIN_ARGS(SLintReport) { } - SLATE_BEGIN_ARGS(SLintReport) - { - } - - SLATE_END_ARGS() + SLATE_END_ARGS() public: - - void Construct(const FArguments& Args); - void Rebuild(const ULintRuleSet* SelectedLintRuleSet); - TSharedRef GetViewButtonContent(); - - const ULintRuleSet* LastUsedRuleSet = nullptr; - - TSharedPtr ResultsTextBlockPtr; - TArray> RuleViolations; - TSharedPtr ViewOptionsComboButton; - TSharedPtr AssetDetailsScrollBoxPtr; - TSharedPtr RuleDetailsScrollBoxPtr; - FString JsonReport; - FString HTMLReport; - - bool bHasRanReport = false; - int32 NumErrors = 0; - int32 NumWarnings = 0; - - -}; \ No newline at end of file + void Construct(const FArguments& Args); + void Rebuild(const ULintRuleSet* SelectedLintRuleSet); + TSharedRef GetViewButtonContent(); + + const ULintRuleSet* LastUsedRuleSet = nullptr; + + TSharedPtr ResultsTextBlockPtr; + TArray> RuleViolations; + TSharedPtr ViewOptionsComboButton; + TSharedPtr AssetDetailsScrollBoxPtr; + TSharedPtr RuleDetailsScrollBoxPtr; + FString JsonReport; + FString HTMLReport; + + bool bHasRanReport = false; + int32 NumErrors = 0; + int32 NumWarnings = 0; +}; diff --git a/Source/Linter/Public/UI/LintReportAssetDetails.h b/Source/Linter/Public/UI/LintReportAssetDetails.h index e8934d6..96051a9 100644 --- a/Source/Linter/Public/UI/LintReportAssetDetails.h +++ b/Source/Linter/Public/UI/LintReportAssetDetails.h @@ -3,25 +3,19 @@ #include "Widgets/SCompoundWidget.h" #include "LintRule.h" -class SLintReportAssetDetails : public SCompoundWidget -{ +class SLintReportAssetDetails : public SCompoundWidget { public: + SLATE_BEGIN_ARGS(SLintReportAssetDetails) { } + SLATE_ATTRIBUTE(FAssetData, AssetData) + SLATE_ATTRIBUTE(TArray>, RuleViolations) + SLATE_ATTRIBUTE(TSharedPtr, ThumbnailPool) - SLATE_BEGIN_ARGS(SLintReportAssetDetails) - { - } - SLATE_ATTRIBUTE(FAssetData, AssetData) - SLATE_ATTRIBUTE(TArray>, RuleViolations) - SLATE_ATTRIBUTE(TSharedPtr, ThumbnailPool) - - SLATE_END_ARGS() - - TAttribute AssetData; - TAttribute>> RuleViolations; - TAttribute> ThumbnailPool; + SLATE_END_ARGS() + TAttribute AssetData; + TAttribute>> RuleViolations; + TAttribute> ThumbnailPool; public: - - void Construct(const FArguments& Args); -}; \ No newline at end of file + void Construct(const FArguments& Args); +}; diff --git a/Source/Linter/Public/UI/LintReportAssetError.h b/Source/Linter/Public/UI/LintReportAssetError.h index 4c4a542..e55259e 100644 --- a/Source/Linter/Public/UI/LintReportAssetError.h +++ b/Source/Linter/Public/UI/LintReportAssetError.h @@ -3,21 +3,15 @@ #include "Widgets/SCompoundWidget.h" #include "LintRule.h" -class SLintReportAssetError : public SCompoundWidget -{ +class SLintReportAssetError : public SCompoundWidget { public: + SLATE_BEGIN_ARGS(SLintReportAssetError) { } + SLATE_ATTRIBUTE(TSharedPtr, RuleViolation) - SLATE_BEGIN_ARGS(SLintReportAssetError) - { - } - SLATE_ATTRIBUTE(TSharedPtr, RuleViolation) - - SLATE_END_ARGS() - - TAttribute> RuleViolation; + SLATE_END_ARGS() + TAttribute> RuleViolation; public: - - void Construct(const FArguments& Args); -}; \ No newline at end of file + void Construct(const FArguments& Args); +}; diff --git a/Source/Linter/Public/UI/LintReportAssetErrorList.h b/Source/Linter/Public/UI/LintReportAssetErrorList.h index 3d121b1..32673f4 100644 --- a/Source/Linter/Public/UI/LintReportAssetErrorList.h +++ b/Source/Linter/Public/UI/LintReportAssetErrorList.h @@ -6,20 +6,15 @@ struct FLintRuleViolation; -class SLintReportAssetErrorList : public SCompoundWidget -{ +class SLintReportAssetErrorList : public SCompoundWidget { public: + SLATE_BEGIN_ARGS(SLintReportAssetErrorList) { } + SLATE_ATTRIBUTE(TArray>, RuleViolations) - SLATE_BEGIN_ARGS(SLintReportAssetErrorList) - { - } - SLATE_ATTRIBUTE(TArray>, RuleViolations) + SLATE_END_ARGS() - SLATE_END_ARGS() - - TAttribute>> RuleViolations; + TAttribute>> RuleViolations; public: - - void Construct(const FArguments& Args); -}; \ No newline at end of file + void Construct(const FArguments& Args); +}; diff --git a/Source/Linter/Public/UI/LintReportRuleDetails.h b/Source/Linter/Public/UI/LintReportRuleDetails.h index fab0e24..6094ee0 100644 --- a/Source/Linter/Public/UI/LintReportRuleDetails.h +++ b/Source/Linter/Public/UI/LintReportRuleDetails.h @@ -3,28 +3,22 @@ #include "Widgets/SCompoundWidget.h" #include "LintRule.h" -class SLintReportRuleDetails : public SCompoundWidget -{ +class SLintReportRuleDetails : public SCompoundWidget { public: + SLATE_BEGIN_ARGS(SLintReportRuleDetails) { } + SLATE_ATTRIBUTE(TArray>, RuleViolations) + SLATE_ATTRIBUTE(TSharedPtr, ThumbnailPool) - SLATE_BEGIN_ARGS(SLintReportRuleDetails) - { - } - SLATE_ATTRIBUTE(TArray>, RuleViolations) - SLATE_ATTRIBUTE(TSharedPtr, ThumbnailPool) - - SLATE_END_ARGS() - - TAttribute>> RuleViolations; - TAttribute> ThumbnailPool; + SLATE_END_ARGS() + TAttribute>> RuleViolations; + TAttribute> ThumbnailPool; public: - - void Construct(const FArguments& Args); + void Construct(const FArguments& Args); private: - FString RuleURL; - FAssetData RuleAssetData; - TSharedPtr ThumbnailBox; -}; \ No newline at end of file + FString RuleURL; + FAssetData RuleAssetData; + TSharedPtr ThumbnailBox; +}; diff --git a/Source/Linter/Public/UI/LintReportRuleError.h b/Source/Linter/Public/UI/LintReportRuleError.h index dd2890c..7e8df5a 100644 --- a/Source/Linter/Public/UI/LintReportRuleError.h +++ b/Source/Linter/Public/UI/LintReportRuleError.h @@ -1,23 +1,18 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once + #include "Widgets/SCompoundWidget.h" #include "LintRule.h" -class SLintReportRuleError : public SCompoundWidget -{ +class SLintReportRuleError : public SCompoundWidget { public: + SLATE_BEGIN_ARGS(SLintReportRuleError) { } + SLATE_ATTRIBUTE(TSharedPtr, RuleViolation) - SLATE_BEGIN_ARGS(SLintReportRuleError) - { - } - SLATE_ATTRIBUTE(TSharedPtr, RuleViolation) - - SLATE_END_ARGS() - - TAttribute> RuleViolation; + SLATE_END_ARGS() + TAttribute> RuleViolation; public: - - void Construct(const FArguments& Args); -}; \ No newline at end of file + void Construct(const FArguments& Args); +}; diff --git a/Source/Linter/Public/UI/LintReportRuleErrorList.h b/Source/Linter/Public/UI/LintReportRuleErrorList.h index 988109d..961724f 100644 --- a/Source/Linter/Public/UI/LintReportRuleErrorList.h +++ b/Source/Linter/Public/UI/LintReportRuleErrorList.h @@ -6,20 +6,15 @@ struct FLintRuleViolation; -class SLintReportRuleErrorList : public SCompoundWidget -{ +class SLintReportRuleErrorList : public SCompoundWidget { public: + SLATE_BEGIN_ARGS(SLintReportRuleErrorList) { } + SLATE_ATTRIBUTE(TArray>, RuleViolations) - SLATE_BEGIN_ARGS(SLintReportRuleErrorList) - { - } - SLATE_ATTRIBUTE(TArray>, RuleViolations) + SLATE_END_ARGS() - SLATE_END_ARGS() - - TAttribute>> RuleViolations; + TAttribute>> RuleViolations; public: - - void Construct(const FArguments& Args); -}; \ No newline at end of file + void Construct(const FArguments& Args); +}; diff --git a/Source/Linter/Public/UI/LintWizard.h b/Source/Linter/Public/UI/LintWizard.h index a4506ae..48d46ae 100644 --- a/Source/Linter/Public/UI/LintWizard.h +++ b/Source/Linter/Public/UI/LintWizard.h @@ -6,49 +6,44 @@ #include "Widgets/SCompoundWidget.h" #include "Widgets/Workflow/SWizard.h" #include "UI/SStepWidget.h" - #include "LintReport.h" -/** - * - */ -class LINTER_API SLintWizard : public SCompoundWidget -{ + +class LINTER_API SLintWizard : public SCompoundWidget { public: - SLATE_BEGIN_ARGS(SLintWizard) - {} - SLATE_END_ARGS() + SLATE_BEGIN_ARGS(SLintWizard) {} + SLATE_END_ARGS() - /** Constructs this widget with InArgs */ - void Construct(const FArguments& InArgs); + /** Constructs this widget with InArgs */ + void Construct(const FArguments& InArgs); - /** The wizard widget */ - TSharedPtr MainWizard; + /** The wizard widget */ + TSharedPtr MainWizard; - /** The Lint Report widget */ - TSharedPtr LintReport; + /** The Lint Report widget */ + TSharedPtr LintReport; - /** The Linter combo box selection to use to select a linter rule set. */ - TSharedPtr>> RuleSetSelectionComboBox; + /** The Linter combo box selection to use to select a linter rule set. */ + TSharedPtr>> RuleSetSelectionComboBox; - /** List of Linter managers grabbed from the Linter Module on widget creation */ - TArray> RuleSets; + /** List of Linter managers grabbed from the Linter Module on widget creation */ + TArray> RuleSets; - /** List of maps in the project used for wizard purposes */ - TArray> MapAssetDataList; + /** List of maps in the project used for wizard purposes */ + TArray> MapAssetDataList; - /** Scrollbox for list of map assets in marketplace recommendation page */ - TSharedPtr MarketplaceRecommendationMapScrollBoxPtr; + /** Scrollbox for list of map assets in marketplace recommendation page */ + TSharedPtr MarketplaceRecommendationMapScrollBoxPtr; - /** Currently selected Linter Rule Set */ - TSharedPtr SelectedRuleSet; + /** Currently selected Linter Rule Set */ + TSharedPtr SelectedRuleSet; - bool bOfferPackage = false; - EStepStatus FixUpRedirectorStatus = Unknown; - EStepStatus SaveAllStatus = Unknown; + bool bOfferPackage = false; + EStepStatus FixUpRedirectorStatus = Unknown; + EStepStatus SaveAllStatus = Unknown; - void OnLintReportEntered(); - void OnMarketplaceRecommendationsEntered(); + void OnLintReportEntered(); + void OnMarketplaceRecommendationsEntered(); - bool LoadAssetsIfNeeded(const TArray& ObjectPaths, TArray& LoadedObjects); + bool LoadAssetsIfNeeded(const TArray& ObjectPaths, TArray& LoadedObjects); }; diff --git a/Source/Linter/Public/UI/SAssetLinkWidget.h b/Source/Linter/Public/UI/SAssetLinkWidget.h index 71d5e82..629fa9d 100644 --- a/Source/Linter/Public/UI/SAssetLinkWidget.h +++ b/Source/Linter/Public/UI/SAssetLinkWidget.h @@ -1,25 +1,19 @@ // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #pragma once -#include "LinterStyle.h" #include "Widgets/DeclarativeSyntaxSupport.h" #include "Widgets/SCompoundWidget.h" -class SAssetLinkWidget : public SCompoundWidget -{ +class SAssetLinkWidget : public SCompoundWidget { public: + SLATE_BEGIN_ARGS(SAssetLinkWidget) { } - SLATE_BEGIN_ARGS(SAssetLinkWidget) - { - } + SLATE_ATTRIBUTE(FAssetData, AssetData) - SLATE_ATTRIBUTE(FAssetData, AssetData) + SLATE_END_ARGS() - SLATE_END_ARGS() - - TAttribute AssetData; + TAttribute AssetData; public: - - void Construct(const FArguments& Args); -}; \ No newline at end of file + void Construct(const FArguments& Args); +}; diff --git a/Source/Linter/Public/UI/SStepWidget.h b/Source/Linter/Public/UI/SStepWidget.h index 6b2f3f8..1d0a4d9 100644 --- a/Source/Linter/Public/UI/SStepWidget.h +++ b/Source/Linter/Public/UI/SStepWidget.h @@ -7,59 +7,55 @@ enum EStepStatus { - NoStatus, - Unknown, - InProgress, - NeedsUpdate, - Warning, - Error, - Success + NoStatus, + Unknown, + InProgress, + NeedsUpdate, + Warning, + Error, + Success }; // Called when a step's action is invoked DECLARE_DELEGATE_OneParam(FOnStepPerformAction, FScopedSlowTask&); /* Widget that represents a 'step' or 'choice' in the PaCK wizard. */ -class SStepWidget : public SCompoundWidget -{ +class SStepWidget : public SCompoundWidget { public: + SLATE_BEGIN_ARGS(SStepWidget) : + _StepStatus(NoStatus), + _ShowStepStatusIcon(true) { } - SLATE_BEGIN_ARGS(SStepWidget) - : _StepStatus(NoStatus) - , _ShowStepStatusIcon(true) - { - } + /** Name to display for this step. */ + SLATE_ATTRIBUTE(FText, StepName) - /** Name to display for this step. */ - SLATE_ATTRIBUTE(FText, StepName) + /** Description to display for this step. */ + SLATE_ATTRIBUTE(FText, StepDesc) - /** Description to display for this step. */ - SLATE_ATTRIBUTE(FText, StepDesc) + /** Text to display within the action button for this step. */ + SLATE_ATTRIBUTE(FText, StepActionText) - /** Text to display within the action button for this step. */ - SLATE_ATTRIBUTE(FText, StepActionText) + /** Slate Brush to use as the thumbnail icon for this step. */ + SLATE_ATTRIBUTE(const FSlateBrush*, Icon) - /** Slate Brush to use as the thumbnail icon for this step. */ - SLATE_ATTRIBUTE(const FSlateBrush*, Icon) + /** Current status for this step. */ + SLATE_ATTRIBUTE(EStepStatus, StepStatus) - /** Current status for this step. */ - SLATE_ATTRIBUTE(EStepStatus, StepStatus) + /** Current status for this step. */ + SLATE_ATTRIBUTE(bool, ShowStepStatusIcon) - /** Current status for this step. */ - SLATE_ATTRIBUTE(bool, ShowStepStatusIcon) + /** Delegate to fire when this step's action is invoked. */ + SLATE_EVENT(FOnStepPerformAction, OnPerformAction) - /** Delegate to fire when this step's action is invoked. */ - SLATE_EVENT(FOnStepPerformAction, OnPerformAction) - - SLATE_END_ARGS() + SLATE_END_ARGS() public: - TAttribute StepStatus; - TAttribute StepActionText; - FOnStepPerformAction OnPerformAction; - TAttribute ShowStepStatusIcon; + TAttribute StepStatus; + TAttribute StepActionText; + FOnStepPerformAction OnPerformAction; + TAttribute ShowStepStatusIcon; - bool IsStepCompleted(bool bAllowWarning = true) const; + bool IsStepCompleted(bool bAllowWarning = true) const; - void Construct(const FArguments& Args); -}; \ No newline at end of file + void Construct(const FArguments& Args); +}; diff --git a/Source/MarketplaceLinter/MarketplaceLinter.Build.cs b/Source/MarketplaceLinter/MarketplaceLinter.Build.cs index d153125..39075ef 100644 --- a/Source/MarketplaceLinter/MarketplaceLinter.Build.cs +++ b/Source/MarketplaceLinter/MarketplaceLinter.Build.cs @@ -2,45 +2,15 @@ using UnrealBuildTool; -public class MarketplaceLinter : ModuleRules -{ - public MarketplaceLinter(ReadOnlyTargetRules Target) : base(Target) - { - PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; +public class MarketplaceLinter : ModuleRules { + public MarketplaceLinter(ReadOnlyTargetRules Target) : base(Target) { + PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - PublicDependencyModuleNames.AddRange( - new [] - { - "Core", - "Linter" - } - ); - - - PrivateDependencyModuleNames.AddRange( - new [] - { - "CoreUObject", - "Engine", - "Slate", - "SlateCore", - "RenderCore", - "UnrealEd", - "GraphEditor", - "AssetTools", - "EditorStyle", - "Projects", - "BlueprintGraph", - "InputCore", - "StandaloneRenderer", - "PropertyEditor", - "LevelEditor", - "LauncherPlatform", - "AppFramework", - "DesktopPlatform", - "UATHelper" - // ... add private dependencies that you statically link with here ... - } - ); - } + PublicDependencyModuleNames.AddRange(new[] { "Core", "Linter" }); + PrivateDependencyModuleNames.AddRange(new[] { + "CoreUObject", "Engine", "Slate", "SlateCore", "RenderCore", "UnrealEd", "GraphEditor", "AssetTools", + "EditorStyle", "Projects", "BlueprintGraph", "InputCore", "StandaloneRenderer", "PropertyEditor", + "LevelEditor", "LauncherPlatform", "AppFramework", "DesktopPlatform", "UATHelper" + }); + } } \ No newline at end of file diff --git a/Source/MarketplaceLinter/Private/MarketplaceLinter.cpp b/Source/MarketplaceLinter/Private/MarketplaceLinter.cpp index 7f0bcf3..8de877a 100644 --- a/Source/MarketplaceLinter/Private/MarketplaceLinter.cpp +++ b/Source/MarketplaceLinter/Private/MarketplaceLinter.cpp @@ -1,22 +1,7 @@ // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #include "MarketplaceLinter.h" -#include "ISettingsModule.h" -#define LOCTEXT_NAMESPACE "FMarketplaceLinterModule" -void FMarketplaceLinterModule::StartupModule() -{ - -} - -void FMarketplaceLinterModule::ShutdownModule() -{ - -} - - -#undef LOCTEXT_NAMESPACE - -IMPLEMENT_MODULE(FMarketplaceLinterModule, MarketplaceLinter) -DEFINE_LOG_CATEGORY(LogMarketplaceLinter); \ No newline at end of file +IMPLEMENT_MODULE(FDefaultModuleImpl, MarketplaceLinter) +DEFINE_LOG_CATEGORY(LogMarketplaceLinter); diff --git a/Source/MarketplaceLinter/Private/MarketplaceNamingConvention.cpp b/Source/MarketplaceLinter/Private/MarketplaceNamingConvention.cpp index 4d0fd9d..794cfaf 100644 --- a/Source/MarketplaceLinter/Private/MarketplaceNamingConvention.cpp +++ b/Source/MarketplaceLinter/Private/MarketplaceNamingConvention.cpp @@ -2,109 +2,107 @@ #include "MarketplaceNamingConvention.h" -UMarketplaceNamingConvention::UMarketplaceNamingConvention(const FObjectInitializer& ObjectInitializer) - : Super(ObjectInitializer) -{ +UMarketplaceNamingConvention::UMarketplaceNamingConvention(const FObjectInitializer& ObjectInitializer) : + Super(ObjectInitializer) { #define SCRIPT_PATH(ScriptPath) TSoftClassPtr(FSoftObjectPath(TEXT("/Script/" #ScriptPath))) #define ADD_PREFIX(ClassName, Prefix) ClassNamingConventions.Push(FLinterNamingConventionInfo(TSoftClassPtr(FSoftObjectPath(TEXT("/Script/Engine." #ClassName))), Prefix)); #define ADD_PREFIX_SUFFIX(ClassName, Prefix, Suffix) ClassNamingConventions.Push(FLinterNamingConventionInfo(TSoftClassPtr(FSoftObjectPath(TEXT("/Script/Engine." #ClassName))), Prefix, Suffix)); - // Animation - ADD_PREFIX(AimOffsetBlendSpace, "AO_"); - ADD_PREFIX(AimOffsetBlendSpace1D, "AO_"); - ADD_PREFIX(AnimBlueprint, "ABP_"); - ADD_PREFIX(AnimComposite, "AC_"); - ADD_PREFIX(AnimMontage, "AM_"); - ADD_PREFIX(AnimSequence, "A_"); - ADD_PREFIX(BlendSpace, "BS_"); - ADD_PREFIX(BlendSpace1D, "BS_"); - ADD_PREFIX(MorphTarget, "MT_"); - ADD_PREFIX(Rig, "Rig_"); - ADD_PREFIX(SkeletalMesh, "SK_"); - ADD_PREFIX(Skeleton, "SKEL_"); - - - // Artificial Intelligence - ADD_PREFIX(AIController, "AIC_"); - ADD_PREFIX(BehaviorTree, "BT_"); - ADD_PREFIX(BlackboardData, "BB_"); - ADD_PREFIX(BTDecorator, "BTDecorator_"); - ADD_PREFIX(BTService, "BTService_"); - ADD_PREFIX(BTTaskNode, "BTTask_"); - - // Blueprints - ADD_PREFIX(Blueprint, "BP_"); - ADD_PREFIX(BlueprintFunctionLibrary, "BPFL_"); - ADD_PREFIX(Interface, "BPI_"); - ClassNamingConventions.Push(FLinterNamingConventionInfo(SCRIPT_PATH("IntroTutorials.EditorTutorial"), "TBP_")); - ADD_PREFIX(UserDefinedEnum, "E"); - ADD_PREFIX(UserDefinedStruct, "F"); - - // Materials - ADD_PREFIX(Material, "M_"); - ADD_PREFIX(Material, "MA_"); - ADD_PREFIX(Material, "MAT_"); - ADD_PREFIX(MaterialFunction, "MF_"); - ADD_PREFIX(MaterialInstance, "MI_"); - ADD_PREFIX(MaterialInstanceConstant, "MI_"); - ADD_PREFIX(MaterialParameterCollection, "MPC_"); - ADD_PREFIX(SubsurfaceProfile, "SP_"); - - // Textures - ADD_PREFIX(Texture2D, "T_"); - ADD_PREFIX(TextureCube, "TC_"); - ADD_PREFIX(TextureRenderTarget2D, "RT_"); - ADD_PREFIX(TextureRenderTargetCube, "RTC_"); - ADD_PREFIX(TextureLightProfile, "TLP_"); - - // Media - ClassNamingConventions.Push(FLinterNamingConventionInfo(SCRIPT_PATH("MediaAssets.MediaTexture"), "MT_")); - ClassNamingConventions.Push(FLinterNamingConventionInfo(SCRIPT_PATH("MediaAssets.MediaPlayer"), "MP_")); - - // Miscellaneous - ADD_PREFIX(VectorFieldAnimated, "VFA_"); - ADD_PREFIX(CameraAnim, "CA_"); - ADD_PREFIX(CurveLinearColor, "Curve_"); - ADD_PREFIX(CurveTable, "Curve_"); - ADD_PREFIX(DataTable, "DT_"); - ADD_PREFIX(CurveFloat, "Curve_"); - ADD_PREFIX(ForceFeedbackEffect, "FFE_"); - ADD_PREFIX(MatineeAnimInterface, "Matinee_"); - ADD_PREFIX(ObjectLibrary, "OL_"); - ADD_PREFIX(VectorFieldStatic, "VF_"); - ADD_PREFIX(TouchInterface, "TI_"); - ADD_PREFIX(CurveVector, "Curve_"); - ADD_PREFIX(StaticMesh, "SM_"); - ADD_PREFIX(StaticMesh, "S_"); - - // Paper 2D - - // Physics - ADD_PREFIX(PhysicalMaterial, "PM_"); - ADD_PREFIX(PhysicsAsset, "PHYS_"); - - // Sounds - ADD_PREFIX(DialogueVoice, "DV_"); - ADD_PREFIX(DialogueWave, "DW_"); - ADD_PREFIX(ReverbEffect, "Reverb_"); - ADD_PREFIX(SoundAttenuation, "ATT_"); - ADD_PREFIX(SoundClass, ""); - ADD_PREFIX(SoundConcurrency, "_SC"); - ADD_PREFIX_SUFFIX(SoundCue, "A_", "_Cue"); - ADD_PREFIX(SoundMix, "Mix_"); - ADD_PREFIX(SoundWave, "A_"); - - // User Interface - ADD_PREFIX(Font, "Font_"); - ADD_PREFIX(SlateBrushAsset, "Brush_"); - ADD_PREFIX(SlateWidgetStyleAsset, "Style_"); - ADD_PREFIX(WidgetBlueprint, "WBP_"); - - // Effects - ADD_PREFIX(ParticleSystem, "PS_"); + // Animation + ADD_PREFIX(AimOffsetBlendSpace, "AO_"); + ADD_PREFIX(AimOffsetBlendSpace1D, "AO_"); + ADD_PREFIX(AnimBlueprint, "ABP_"); + ADD_PREFIX(AnimComposite, "AC_"); + ADD_PREFIX(AnimMontage, "AM_"); + ADD_PREFIX(AnimSequence, "A_"); + ADD_PREFIX(BlendSpace, "BS_"); + ADD_PREFIX(BlendSpace1D, "BS_"); + ADD_PREFIX(MorphTarget, "MT_"); + ADD_PREFIX(Rig, "Rig_"); + ADD_PREFIX(SkeletalMesh, "SK_"); + ADD_PREFIX(Skeleton, "SKEL_"); + + + // Artificial Intelligence + ADD_PREFIX(AIController, "AIC_"); + ADD_PREFIX(BehaviorTree, "BT_"); + ADD_PREFIX(BlackboardData, "BB_"); + ADD_PREFIX(BTDecorator, "BTDecorator_"); + ADD_PREFIX(BTService, "BTService_"); + ADD_PREFIX(BTTaskNode, "BTTask_"); + + // Blueprints + ADD_PREFIX(Blueprint, "BP_"); + ADD_PREFIX(BlueprintFunctionLibrary, "BPFL_"); + ADD_PREFIX(Interface, "BPI_"); + ClassNamingConventions.Push(FLinterNamingConventionInfo(SCRIPT_PATH("IntroTutorials.EditorTutorial"), "TBP_")); + ADD_PREFIX(UserDefinedEnum, "E"); + ADD_PREFIX(UserDefinedStruct, "F"); + + // Materials + ADD_PREFIX(Material, "M_"); + ADD_PREFIX(Material, "MA_"); + ADD_PREFIX(Material, "MAT_"); + ADD_PREFIX(MaterialFunction, "MF_"); + ADD_PREFIX(MaterialInstance, "MI_"); + ADD_PREFIX(MaterialInstanceConstant, "MI_"); + ADD_PREFIX(MaterialParameterCollection, "MPC_"); + ADD_PREFIX(SubsurfaceProfile, "SP_"); + + // Textures + ADD_PREFIX(Texture2D, "T_"); + ADD_PREFIX(TextureCube, "TC_"); + ADD_PREFIX(TextureRenderTarget2D, "RT_"); + ADD_PREFIX(TextureRenderTargetCube, "RTC_"); + ADD_PREFIX(TextureLightProfile, "TLP_"); + + // Media + ClassNamingConventions.Push(FLinterNamingConventionInfo(SCRIPT_PATH("MediaAssets.MediaTexture"), "MT_")); + ClassNamingConventions.Push(FLinterNamingConventionInfo(SCRIPT_PATH("MediaAssets.MediaPlayer"), "MP_")); + + // Miscellaneous + ADD_PREFIX(VectorFieldAnimated, "VFA_"); + ADD_PREFIX(CameraAnim, "CA_"); + ADD_PREFIX(CurveLinearColor, "Curve_"); + ADD_PREFIX(CurveTable, "Curve_"); + ADD_PREFIX(DataTable, "DT_"); + ADD_PREFIX(CurveFloat, "Curve_"); + ADD_PREFIX(ForceFeedbackEffect, "FFE_"); + ADD_PREFIX(MatineeAnimInterface, "Matinee_"); + ADD_PREFIX(ObjectLibrary, "OL_"); + ADD_PREFIX(VectorFieldStatic, "VF_"); + ADD_PREFIX(TouchInterface, "TI_"); + ADD_PREFIX(CurveVector, "Curve_"); + ADD_PREFIX(StaticMesh, "SM_"); + ADD_PREFIX(StaticMesh, "S_"); + + // Paper 2D + + // Physics + ADD_PREFIX(PhysicalMaterial, "PM_"); + ADD_PREFIX(PhysicsAsset, "PHYS_"); + + // Sounds + ADD_PREFIX(DialogueVoice, "DV_"); + ADD_PREFIX(DialogueWave, "DW_"); + ADD_PREFIX(ReverbEffect, "Reverb_"); + ADD_PREFIX(SoundAttenuation, "ATT_"); + ADD_PREFIX(SoundClass, ""); + ADD_PREFIX(SoundConcurrency, "_SC"); + ADD_PREFIX_SUFFIX(SoundCue, "A_", "_Cue"); + ADD_PREFIX(SoundMix, "Mix_"); + ADD_PREFIX(SoundWave, "A_"); + + // User Interface + ADD_PREFIX(Font, "Font_"); + ADD_PREFIX(SlateBrushAsset, "Brush_"); + ADD_PREFIX(SlateWidgetStyleAsset, "Style_"); + ADD_PREFIX(WidgetBlueprint, "WBP_"); + + // Effects + ADD_PREFIX(ParticleSystem, "PS_"); #undef ADD_PREFIX - SortConventions(); + SortConventions(); } - diff --git a/Source/MarketplaceLinter/Public/MarketplaceLinter.h b/Source/MarketplaceLinter/Public/MarketplaceLinter.h index 30e1bcf..b704d72 100644 --- a/Source/MarketplaceLinter/Public/MarketplaceLinter.h +++ b/Source/MarketplaceLinter/Public/MarketplaceLinter.h @@ -3,13 +3,3 @@ #pragma once DECLARE_LOG_CATEGORY_EXTERN(LogMarketplaceLinter, Verbose, All); - -class MARKETPLACELINTER_API FMarketplaceLinterModule : public IModuleInterface -{ -public: - - /** IModuleInterface implementation */ - virtual void StartupModule() override; - virtual void ShutdownModule() override; - -}; \ No newline at end of file diff --git a/Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h b/Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h index 8eb7caa..1cc86fc 100644 --- a/Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h +++ b/Source/MarketplaceLinter/Public/MarketplaceNamingConvention.h @@ -7,12 +7,9 @@ UCLASS() -class UMarketplaceNamingConvention : public ULinterNamingConvention -{ - GENERATED_BODY() +class UMarketplaceNamingConvention : public ULinterNamingConvention { + GENERATED_BODY() public: - - UMarketplaceNamingConvention(const FObjectInitializer& ObjectInitializer); - + UMarketplaceNamingConvention(const FObjectInitializer& ObjectInitializer); }; From fec42ac83d5fea1e95d2127335a5cda8af6b7deb Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Sat, 14 Oct 2023 02:34:02 +0200 Subject: [PATCH 15/28] Updated README.md --- README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7c5f974..ebee8d3 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,4 @@ # Linter -Currently WIP release of Linter. - -@TODO: - -* 4.27 patchups per community -* Compilation and release guide \ No newline at end of file +Linter for Unreal Blueprints. Based of the [Linter v2](https://ue5.style), made compatible with Unreal Engine 5. +The original version can still be found on the [Marketplace](https://www.unrealengine.com/marketplace/product/linter-v2). From aeba4eeb694f98d7560ebc2700f8bfa52917020a Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Wed, 18 Oct 2023 11:39:32 +0200 Subject: [PATCH 16/28] Fixed wrong Imports --- .../BatchRenameTool/BatchRenameTool.cpp | 23 ++++++++++--------- .../Linter/Private/LinterNamingConvention.cpp | 8 +++---- .../Private/UI/LintReportRuleDetails.cpp | 21 +++++++++-------- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp b/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp index 78f09aa..86546ee 100644 --- a/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp +++ b/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp @@ -1,23 +1,24 @@ // Copyright 2016 Gamemakin LLC. All Rights Reserved. #include "BatchRenameTool/BatchRenameTool.h" -#include "Framework/Application/SlateApplication.h" -#include "Framework/Text/TextLayout.h" -#include "Widgets/Layout/SBox.h" -#include "Widgets/Text/STextBlock.h" -#include "Widgets/Input/SButton.h" -#include "Types/SlateEnums.h" -#include "Editor.h" + #include "AssetToolsModule.h" -#include "Modules/ModuleManager.h" +#include "Editor.h" #include "IAssetTools.h" -#include "SUniformGridPanel.h" -#include "Widgets/Notifications/SNotificationList.h" +#include "Framework/Application/SlateApplication.h" #include "Framework/Notifications/NotificationManager.h" +#include "Framework/Text/TextLayout.h" #include "Logging/MessageLog.h" #include "Logging/TokenizedMessage.h" -#include "Widgets/Layout/SSeparator.h" #include "Misc/EngineVersionComparison.h" +#include "Modules/ModuleManager.h" +#include "Types/SlateEnums.h" +#include "Widgets/Input/SButton.h" +#include "Widgets/Layout/SBox.h" +#include "Widgets/Layout/SSeparator.h" +#include "Widgets/Layout/SUniformGridPanel.h" +#include "Widgets/Notifications/SNotificationList.h" +#include "Widgets/Text/STextBlock.h" #define LOCTEXT_NAMESPACE "LinterBatchRenamer" diff --git a/Source/Linter/Private/LinterNamingConvention.cpp b/Source/Linter/Private/LinterNamingConvention.cpp index 8f55014..0cbeb69 100644 --- a/Source/Linter/Private/LinterNamingConvention.cpp +++ b/Source/Linter/Private/LinterNamingConvention.cpp @@ -1,14 +1,14 @@ #include "LinterNamingConvention.h" #include "AnyObject_LinterDummyClass.h" -#include "DetailLayoutBuilder.h" -#include "PropertyCustomizationHelpers.h" -#include "Templates/SharedPointer.h" #include "DetailCategoryBuilder.h" +#include "DetailLayoutBuilder.h" #include "IDetailChildrenBuilder.h" +#include "PropertyCustomizationHelpers.h" #include "Misc/EngineVersionComparison.h" +#include "Templates/SharedPointer.h" #if UE_VERSION_NEWER_THAN(5, 0, 0) -#include "ObjectSaveContext.h" +#include "UObject/ObjectSaveContext.h" #endif TSharedRef FLinterNamingConventionDetails::MakeInstance() { diff --git a/Source/Linter/Private/UI/LintReportRuleDetails.cpp b/Source/Linter/Private/UI/LintReportRuleDetails.cpp index 3746e81..6dc0607 100644 --- a/Source/Linter/Private/UI/LintReportRuleDetails.cpp +++ b/Source/Linter/Private/UI/LintReportRuleDetails.cpp @@ -1,19 +1,20 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #include "UI/LintReportRuleDetails.h" -#include "LinterStyle.h" -#include "Widgets/Layout/SBorder.h" -#include "Widgets/SBoxPanel.h" -#include "Widgets/Layout/SExpandableArea.h" -#include "AssetRegistry/AssetRegistryModule.h" -#include "Internationalization/Internationalization.h" -#include "Widgets/Text/STextBlock.h" -#include "LintRule.h" + #include "AssetThumbnail.h" #include "ContentBrowserModule.h" #include "IContentBrowserSingleton.h" -#include "LintReportRuleErrorList.h" -#include "SHyperlink.h" +#include "LinterStyle.h" +#include "LintRule.h" +#include "AssetRegistry/AssetRegistryModule.h" +#include "Internationalization/Internationalization.h" #include "Misc/EngineVersionComparison.h" +#include "UI/LintReportRuleErrorList.h" +#include "Widgets/SBoxPanel.h" +#include "Widgets/Input/SHyperlink.h" +#include "Widgets/Layout/SBorder.h" +#include "Widgets/Layout/SExpandableArea.h" +#include "Widgets/Text/STextBlock.h" #define LOCTEXT_NAMESPACE "LintReport" From e1b47997047af8294fe3724f3191932d803f98e8 Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Wed, 8 Nov 2023 14:41:23 +0100 Subject: [PATCH 17/28] Fix Content Menu Entry Generation --- Source/Linter/Linter.Build.cs | 2 +- Source/Linter/Private/Linter.cpp | 20 +- .../LinterContentBrowserExtensions.cpp | 248 ++++++++---------- Source/Linter/Public/Linter.h | 8 +- .../Public/LinterContentBrowserExtensions.h | 4 +- 5 files changed, 117 insertions(+), 165 deletions(-) diff --git a/Source/Linter/Linter.Build.cs b/Source/Linter/Linter.Build.cs index eb064ff..4e07e6d 100644 --- a/Source/Linter/Linter.Build.cs +++ b/Source/Linter/Linter.Build.cs @@ -10,7 +10,7 @@ public Linter(ReadOnlyTargetRules Target) : base(Target) { PrivateDependencyModuleNames.AddRange(new[] { "CoreUObject", "Engine", "Slate", "SlateCore", "AppFramework", "InputCore", "UnrealEd", "GraphEditor", "AssetTools", "EditorStyle", "BlueprintGraph", "PropertyEditor", - "LauncherPlatform", "Projects", "DesktopPlatform", "Json", "UATHelper" + "LauncherPlatform", "Projects", "DesktopPlatform", "Json", "UATHelper", "ToolMenus", "ContentBrowser", "ContentBrowserData" }); PublicIncludePathModuleNames.Add("Launch"); diff --git a/Source/Linter/Private/Linter.cpp b/Source/Linter/Private/Linter.cpp index 32f5091..ba79e25 100644 --- a/Source/Linter/Private/Linter.cpp +++ b/Source/Linter/Private/Linter.cpp @@ -3,7 +3,6 @@ #include "Linter.h" #include "ISettingsModule.h" #include "Framework/Docking/TabManager.h" -#include "LevelEditor.h" #include "Styling/SlateStyle.h" #include "PropertyEditorModule.h" #include "LinterStyle.h" @@ -16,8 +15,10 @@ #define LOCTEXT_NAMESPACE "FLinterModule" + static const FName LinterTabName = "LinterTab"; + void FLinterModule::StartupModule() { // Load the asset registry module const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(FName("AssetRegistry")); @@ -43,12 +44,10 @@ void FLinterModule::StartupModule() { } // Install UI Hooks - FLinterContentBrowserExtensions::InstallHooks(this, &ContentBrowserExtenderDelegateHandle, &AssetExtenderDelegateHandle); + FLinterContentBrowserExtensions::InstallHooks(); //Register our UI - FGlobalTabmanager::Get()->RegisterNomadTabSpawner( - LinterTabName, - FOnSpawnTab::CreateStatic(&FLinterModule::SpawnTab, StyleSetPtr)) + FGlobalTabmanager::Get()->RegisterNomadTabSpawner(LinterTabName, FOnSpawnTab::CreateStatic(&FLinterModule::SpawnTab, StyleSetPtr)) .SetDisplayName(LOCTEXT("LinterTabName", "Linter")) .SetTooltipText(LOCTEXT("LinterTabToolTip", "Linter")) .SetMenuType(ETabSpawnerMenuType::Hidden); @@ -67,13 +66,8 @@ void FLinterModule::ShutdownModule() { FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked("PropertyEditor"); PropertyModule.UnregisterCustomClassLayout(ULinterNamingConvention::StaticClass()->GetFName()); - FLinterContentBrowserExtensions::RemoveHooks(this, &ContentBrowserExtenderDelegateHandle, &AssetExtenderDelegateHandle); - - if (FModuleManager::Get().IsModuleLoaded(TEXT("LevelEditor"))) { - FLevelEditorModule& LevelEditorModule = FModuleManager::GetModuleChecked(TEXT("LevelEditor")); - LevelEditorModule.OnTabManagerChanged().Remove(LevelEditorTabManagerChangedHandle); - } - + // Remove Hooks and Tabs + FLinterContentBrowserExtensions::RemoveHooks(); FGlobalTabmanager::Get()->UnregisterTabSpawner(LinterTabName); // Unregister slate style overrides @@ -113,7 +107,7 @@ void FLinterModule::TryToLoadAllLintRuleSets() { // Attempt to get all RuleSets in memory so that linting tools are better aware of them for (const FAssetData& RuleSetData : FoundRuleSets) { if (!RuleSetData.IsAssetLoaded()) { - RuleSetData.GetAsset(); + (void)RuleSetData.GetAsset(); } } } diff --git a/Source/Linter/Private/LinterContentBrowserExtensions.cpp b/Source/Linter/Private/LinterContentBrowserExtensions.cpp index a743d5e..50ed329 100644 --- a/Source/Linter/Private/LinterContentBrowserExtensions.cpp +++ b/Source/Linter/Private/LinterContentBrowserExtensions.cpp @@ -1,178 +1,138 @@ // Copyright 1998-2018 Epic Games, Inc. All Rights Reserved. #include "LinterContentBrowserExtensions.h" -#include "Modules/ModuleManager.h" -#include "Framework/MultiBox/MultiBoxBuilder.h" #include "LinterStyle.h" #include "ContentBrowserModule.h" #include "Linter.h" #include "BatchRenameTool/BatchRenameTool.h" -#include "Framework/MultiBox/MultiBoxExtender.h" -#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); -void FLinterContentBrowserExtensions::InstallHooks(FLinterModule* LinterModule, FDelegateHandle* pContentBrowserExtenderDelegateHandle, class FDelegateHandle* pAssetExtenderDelegateHandle) { - struct Local { - // Path extensions - - static TSharedRef OnExtendContentBrowserAssetSelectionMenu(const TArray& SelectedPaths) { - TSharedRef Extender = MakeShared(); - Extender->AddMenuExtension( - "PathContextSourceControl", - EExtensionHook::After, - TSharedPtr(), - FMenuExtensionDelegate::CreateStatic(&Local::ContentBrowserExtenderFunc, SelectedPaths) - ); - return Extender; - } - static void ContentBrowserExtenderFunc(FMenuBuilder& MenuBuilder, const TArray SelectedPaths) { - MenuBuilder.BeginSection("LinterContentBrowserContext", LOCTEXT("CB_LinterHeader", "Linter")); - { - MenuBuilder.AddMenuEntry( - LOCTEXT("CB_ScanProjectWithLinter", "Scan with Linter"), - LOCTEXT("CB_ScanProjectWithLinter_Tooltip", "Scan project content with Linter"), - FSlateIcon(FLinterStyle::GetStyleSetName(), "Linter.Toolbar.Icon"), - FUIAction(FExecuteAction::CreateLambda([SelectedPaths]() { - if (FLinterModule* Linter = FModuleManager::GetModulePtr("Linter")) { - if (Linter != nullptr) { - Linter->SetDesiredLintPaths(SelectedPaths); - } -#if UE_VERSION_NEWER_THAN(4, 26, 0) - FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab")); -#else - FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab")); -#endif - } - })), - NAME_None, - EUserInterfaceActionType::Button); - } - MenuBuilder.EndSection(); - } +namespace { - // Asset extensions - - static TSharedRef OnExtendAssetSelectionMenu(const TArray& SelectedAssets) { - TSharedRef Extender = MakeShared(); - Extender->AddMenuExtension( - "CommonAssetActions", - EExtensionHook::After, - nullptr, - FMenuExtensionDelegate::CreateStatic(&Local::AssetExtenderFunc, SelectedAssets) - ); - return Extender; - } +void RunLinterForAssets(const TArray& SelectedPaths) { + // Set Paths to Linter + if (FLinterModule* Linter = FModuleManager::GetModulePtr("Linter")) { + Linter->SetDesiredLintPaths(SelectedPaths); + } - static void AssetExtenderFunc(FMenuBuilder& MenuBuilder, const TArray SelectedAssets) { - MenuBuilder.BeginSection("LinterAssetContext", LOCTEXT("CB_LinterHeader", "Linter")); - { - // Run through the assets to determine if any are blueprints - bool bAnyBlueprintsSelected = false; - for (auto AssetIt = SelectedAssets.CreateConstIterator(); AssetIt; ++AssetIt) { - const FAssetData& Asset = *AssetIt; - // Cannot rename redirectors or classes or cooked packages -#if UE_VERSION_NEWER_THAN(5, 1, 0) - if (!Asset.IsRedirector() && Asset.AssetClassPath.GetAssetName() != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) + // Execute Linter +#if UE_VERSION_NEWER_THAN(4, 26, 0) + FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab")); #else - if (!Asset.IsRedirector() && Asset.AssetClass != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) + FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab")); #endif - { - if (Asset.GetClass()->IsChildOf(UBlueprint::StaticClass())) { - bAnyBlueprintsSelected = true; - break; - } - } - } +} - // If we have blueprints selected, enable blueprint tools - if (bAnyBlueprintsSelected) { - // Add Tooltip Editor - MenuBuilder.AddMenuEntry( - LOCTEXT("CB_EditBlueprintTooltips", "Edit Blueprint Tooltips (Experimental)"), - LOCTEXT("CB_EditBlueprintTooltips_Tooltip", "Edit selected blueprints' templates definitions"), - FSlateIcon(FLinterStyle::GetStyleSetName(), "Linter.Toolbar.Icon"), - FUIAction(FExecuteAction::CreateLambda([SelectedAssets]() { - UE_LOG(LinterContentBrowserExtensions, Display, TEXT("Opening Tooltip Tool window.")); - FTooltipTool AssetDlg(SelectedAssets); - if (AssetDlg.ShowModal() == FTooltipTool::Confirm) { - UE_LOG(LinterContentBrowserExtensions, Display, TEXT("Tooltip Tool did the thing.")); - } - })), - NAME_None, - EUserInterfaceActionType::Button); - } +void EditBlueprintTooltips(const TArray SelectedAssets) { + UE_LOG(LinterContentBrowserExtensions, Display, TEXT("Opening Tooltip Tool window.")); + FTooltipTool{SelectedAssets}.ShowModal(); +} + +void BatchRenameAssets(const TArray SelectedAssets) { + UE_LOG(LinterContentBrowserExtensions, Display, TEXT("Starting batch rename.")); + FDlgBatchRenameTool{SelectedAssets}.ShowModal(); +} - // Run through the assets to see if any can be renamed - bool bAnyAssetCanBeRenamed = false; - for (auto AssetIt = SelectedAssets.CreateConstIterator(); AssetIt; ++AssetIt) { - const FAssetData& Asset = *AssetIt; - // Cannot rename redirectors or classes or cooked packages +// Asset Context Menu is dynamic -> some options will only be displayed if +// you have certain types of Blueprints or Assets selected +void CreateDynamicAssetSelectionMenu(UToolMenu* InMenu) { + const auto* Context = InMenu->FindContext(); + FToolMenuSection& Section = InMenu->AddSection("Linter", LOCTEXT("LinterSection", "Linter")); + + // Convert BrowserItems to their AssetData + TArray Assets; + for (const auto& Asset : Context->SelectedItems) { + FAssetData AssetData; + Asset.Legacy_TryGetAssetData(AssetData); + Assets.Add(AssetData); + } + + // Run through the assets to determine if any are blueprints or can be renamed + bool bAnyBlueprintsSelected = false; + bool bAnyAssetCanBeRenamed = false; + + for (const auto& Asset : Assets) { + // Cannot rename redirectors or classes or cooked packages #if UE_VERSION_NEWER_THAN(5, 1, 0) - if (!Asset.IsRedirector() && Asset.AssetClassPath.GetAssetName() != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) + if (!Asset.IsRedirector() && Asset.AssetClassPath.GetAssetName() != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) #else - if (!Asset.IsRedirector() && Asset.AssetClass != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) + if (!Asset.IsRedirector() && Asset.AssetClass != NAME_Class && !(Asset.PackageFlags & PKG_FilterEditorOnly)) #endif - { - bAnyAssetCanBeRenamed = true; - break; - } - } - - if (bAnyAssetCanBeRenamed) { - // Add Tooltip Editor - MenuBuilder.AddMenuEntry( - LOCTEXT("CB_BatchRenameAssets", "Batch Rename Assets (Experimental)"), - LOCTEXT("CB_BatchRenameAssets_Tooltip", "Perform a bulk rename operation on all of the selected assets"), - FSlateIcon(FLinterStyle::GetStyleSetName(), "Linter.Toolbar.Icon"), - FUIAction(FExecuteAction::CreateLambda([SelectedAssets]() { - UE_LOG(LinterContentBrowserExtensions, Display, TEXT("Starting batch rename.")); - FDlgBatchRenameTool AssetDlg(SelectedAssets); - AssetDlg.ShowModal(); - })), - NAME_None, - EUserInterfaceActionType::Button); - } + { + bAnyAssetCanBeRenamed = true; + + if (Asset.GetClass()->IsChildOf(UBlueprint::StaticClass())) { + bAnyBlueprintsSelected = true; + break; } - MenuBuilder.EndSection(); } - }; + } + + // If we have blueprints selected, add Tooltip Editor + if (bAnyBlueprintsSelected) { + Section.AddMenuEntry( + "EditBlueprintTooltips", + LOCTEXT("EditBlueprintTooltips", "Edit Blueprint Tooltips (Experimental)"), + LOCTEXT("EditBlueprintTooltips_Tooltip", "Edit selected blueprints' templates definitions"), + FSlateIcon(FLinterStyle::GetStyleSetName(), "Linter.Toolbar.Icon"), + FExecuteAction::CreateStatic(&EditBlueprintTooltips, Assets) + ); + } + + // If blueprints can be renamed, add the batch rename option + if (bAnyAssetCanBeRenamed) { + Section.AddMenuEntry( + "BatchRename", + LOCTEXT("BatchRenameAssets", "Batch Rename Assets (Experimental)"), + LOCTEXT("BatchRenameAssets_Tooltip", "Perform a bulk rename operation on all of the selected assets"), + FSlateIcon(FLinterStyle::GetStyleSetName(), "Linter.Toolbar.Icon"), + FExecuteAction::CreateStatic(&BatchRenameAssets, Assets) + ); + } +} + +} - FContentBrowserModule& ContentBrowserModule = FModuleManager::LoadModuleChecked(TEXT("ContentBrowser")); - // Path view extenders - TArray& CBMenuPathExtenderDelegates = ContentBrowserModule.GetAllPathViewContextMenuExtenders(); - CBMenuPathExtenderDelegates.Add(FContentBrowserMenuExtender_SelectedPaths::CreateStatic(&Local::OnExtendContentBrowserAssetSelectionMenu)); - *pContentBrowserExtenderDelegateHandle = CBMenuPathExtenderDelegates.Last().GetHandle(); +void FLinterContentBrowserExtensions::InstallHooks() { + // Run Linter on Selected Folder(s) + UToolMenu* ContentBrowserMenu = UToolMenus::Get()->ExtendMenu("ContentBrowser.FolderContextMenu"); + ContentBrowserMenu->AddSection("Linter", LOCTEXT("LinterSection", "Linter")) + .AddMenuEntry( + "LintAssets", + LOCTEXT("ScanWithLinter", "Scan with Linter"), + LOCTEXT("ScanWithLinter_Tooltip", "Scan project content with Linter"), + FSlateIcon(FLinterStyle::GetStyleSetName(), "Linter.Toolbar.Icon"), + FToolMenuExecuteAction::CreateLambda([](const FToolMenuContext& InContext) { + if (const UContentBrowserDataMenuContext_FolderMenu* Context = InContext.FindContext()) { + TArray SelectedPaths; + for (const auto& Asset : Context->SelectedItems) { + SelectedPaths.Add(Asset.GetVirtualPath().ToString()); + } + + RunLinterForAssets(SelectedPaths); + } + }) + ); - // Asset extenders - TArray& CBMenuAssetExtenderDelegates = ContentBrowserModule.GetAllAssetViewContextMenuExtenders(); - CBMenuAssetExtenderDelegates.Add(FContentBrowserMenuExtender_SelectedAssets::CreateStatic(&Local::OnExtendAssetSelectionMenu)); - *pAssetExtenderDelegateHandle = CBMenuAssetExtenderDelegates.Last().GetHandle(); + // BatchRename and TooltipEditor + UToolMenu* AssetMenu = UToolMenus::Get()->ExtendMenu("ContentBrowser.AssetContextMenu"); + AssetMenu->AddDynamicSection("Linter", FNewToolMenuDelegate::CreateStatic(&CreateDynamicAssetSelectionMenu), {"AssetContextExploreMenuOptions", EToolMenuInsertType::After}); } -void FLinterContentBrowserExtensions::RemoveHooks(FLinterModule* LinterModule, FDelegateHandle* pContentBrowserExtenderDelegateHandle, FDelegateHandle* pAssetExtenderDelegateHandle) { - if (FModuleManager::Get().IsModuleLoaded("ContentBrowser")) { - FContentBrowserModule& ContentBrowserModule = FModuleManager::LoadModuleChecked(TEXT("ContentBrowser")); - - // Path view extenders - TArray& CBMenuExtenderDelegates = ContentBrowserModule.GetAllAssetContextMenuExtenders(); - CBMenuExtenderDelegates.RemoveAll([pContentBrowserExtenderDelegateHandle](const FContentBrowserMenuExtender_SelectedPaths& Delegate) { - return Delegate.GetHandle() == *pContentBrowserExtenderDelegateHandle; - }); - - // Asset extenders - TArray& CBMenuAssetExtenderDelegates = ContentBrowserModule.GetAllAssetViewContextMenuExtenders(); - CBMenuAssetExtenderDelegates.RemoveAll([pAssetExtenderDelegateHandle](const FContentBrowserMenuExtender_SelectedAssets& Delegate) { - return Delegate.GetHandle() == *pAssetExtenderDelegateHandle; - }); - } +void FLinterContentBrowserExtensions::RemoveHooks() { + UToolMenu* ContentBrowserMenu = UToolMenus::Get()->ExtendMenu("ContentBrowser.FolderContextMenu"); + ContentBrowserMenu->RemoveSection("Linter"); + + UToolMenu* AssetMenu = UToolMenus::Get()->ExtendMenu("ContentBrowser.AssetContextMenu"); + AssetMenu->RemoveSection("Linter"); } #undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Public/Linter.h b/Source/Linter/Public/Linter.h index fe268ff..41202cc 100644 --- a/Source/Linter/Public/Linter.h +++ b/Source/Linter/Public/Linter.h @@ -5,12 +5,14 @@ #include "Widgets/Docking/SDockTab.h" #include "Styling/SlateStyle.h" + class FLinterManagerBase; -DECLARE_LOG_CATEGORY_EXTERN(LogLinter, Verbose, All); +DECLARE_LOG_CATEGORY_EXTERN(LogLinter, Verbose, All); DECLARE_LOG_CATEGORY_EXTERN(LogCommandlet, All, All); + class LINTER_API FLinterModule : public IModuleInterface { public: /** IModuleInterface implementation */ @@ -39,10 +41,6 @@ class LINTER_API FLinterModule : public IModuleInterface { } private: - FDelegateHandle LevelEditorTabManagerChangedHandle; - FDelegateHandle ContentBrowserExtenderDelegateHandle; - FDelegateHandle AssetExtenderDelegateHandle; - TArray DesiredLintPaths; public: diff --git a/Source/Linter/Public/LinterContentBrowserExtensions.h b/Source/Linter/Public/LinterContentBrowserExtensions.h index cd19e3c..d027d4c 100644 --- a/Source/Linter/Public/LinterContentBrowserExtensions.h +++ b/Source/Linter/Public/LinterContentBrowserExtensions.h @@ -7,6 +7,6 @@ class FLinterModule; // Integrate Linter actions into the Content Browser class FLinterContentBrowserExtensions { public: - static void InstallHooks(FLinterModule* LinterModule, class FDelegateHandle* pContentBrowserExtenderDelegateHandle, class FDelegateHandle* pAssetExtenderDelegateHandle); - static void RemoveHooks(FLinterModule* LinterModule, class FDelegateHandle* pContentBrowserExtenderDelegateHandle, class FDelegateHandle* pAssetExtenderDelegateHandle); + static void InstallHooks(); + static void RemoveHooks(); }; From 77dada17a69c2d1af3fbd77a72db6c43f7802d1a Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Wed, 8 Nov 2023 16:38:03 +0100 Subject: [PATCH 18/28] Fix TextBlockStyle not found --- Source/Linter/Private/UI/LintWizard.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Linter/Private/UI/LintWizard.cpp b/Source/Linter/Private/UI/LintWizard.cpp index 3998bd9..df6be3b 100644 --- a/Source/Linter/Private/UI/LintWizard.cpp +++ b/Source/Linter/Private/UI/LintWizard.cpp @@ -117,7 +117,7 @@ void SLintWizard::Construct(const FArguments& InArgs) { .Padding(0) [ SNew(STextBlock) - .TextStyle(FAppStyle::Get(), "NewClassDialog.PageTitle") + .Font(FAppStyle::Get().GetFontStyle("HeadingSmall")) .Text(LOCTEXT("LinterSelectionTitle", "Linter Rule Set Selection")) ] // Title spacer @@ -169,7 +169,7 @@ void SLintWizard::Construct(const FArguments& InArgs) { .Padding(0) [ SNew(STextBlock) - .TextStyle(FAppStyle::Get(), "NewClassDialog.PageTitle") + .Font(FAppStyle::Get().GetFontStyle("HeadingSmall")) .Text(LOCTEXT("LinterReportTitle", "Lint Report")) ] // Marketplace No Errors Required Text @@ -214,7 +214,7 @@ void SLintWizard::Construct(const FArguments& InArgs) { .Padding(0) [ SNew(STextBlock) - .TextStyle(FAppStyle::Get(), "NewClassDialog.PageTitle") + .Font(FAppStyle::Get().GetFontStyle("HeadingSmall")) .Text(LOCTEXT("MarketplaceInfoTitle", "Marketplace Recommendations")) ] // Title spacer From 80a20ce603cb77b66b4576f96f6574fd7a85b46b Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Wed, 8 Nov 2023 21:53:57 +0100 Subject: [PATCH 19/28] Fix Slate Formatting --- .clang-format | 6 +- .../BatchRenameTool/BatchRenameTool.cpp | 18 +- Source/Linter/Private/Linter.cpp | 4 + .../Linter/Private/LinterNamingConvention.cpp | 4 + .../Private/TooltipTool/TooltipTool.cpp | 674 +++++++++--------- Source/Linter/Private/UI/LintReport.cpp | 300 ++++---- .../Private/UI/LintReportAssetDetails.cpp | 72 +- .../Private/UI/LintReportAssetError.cpp | 80 ++- .../Private/UI/LintReportRuleDetails.cpp | 132 ++-- .../Linter/Private/UI/LintReportRuleError.cpp | 56 +- .../Private/UI/LintReportRuleErrorList.cpp | 24 +- Source/Linter/Private/UI/LintWizard.cpp | 514 ++++++------- Source/Linter/Private/UI/SAssetLinkWidget.cpp | 25 +- Source/Linter/Private/UI/SStepWidget.cpp | 98 +-- 14 files changed, 1044 insertions(+), 963 deletions(-) diff --git a/.clang-format b/.clang-format index a478f6d..35a9c91 100644 --- a/.clang-format +++ b/.clang-format @@ -2,7 +2,7 @@ Language: Cpp BasedOnStyle: Google AccessModifierOffset: -4 -AlignAfterOpenBracket: Align +AlignAfterOpenBracket: BlockIndent AlignConsecutiveMacros: None AlignConsecutiveAssignments: None AlignConsecutiveDeclarations: None @@ -82,8 +82,10 @@ IndentPPDirectives: None IndentWidth: 4 IndentWrappedFunctionNames: false KeepEmptyLinesAtTheStartOfBlocks: false +LambdaBodyIndentation: OuterScope MaxEmptyLinesToKeep: 3 NamespaceIndentation: None +PackConstructorInitializers: CurrentLine PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 1 PenaltyBreakComment: 300 @@ -93,6 +95,7 @@ PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 200 PointerAlignment: Left +QualifierAlignment: Left RawStringFormats: - Language: Cpp Delimiters: @@ -107,6 +110,7 @@ RawStringFormats: BasedOnStyle: google ReferenceAlignment: Left ReflowComments: true +SeparateDefinitionBlocks: Always SortIncludes: Never SortUsingDeclarations: false SpaceAfterCStyleCast: false diff --git a/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp b/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp index 86546ee..9c82a51 100644 --- a/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp +++ b/Source/Linter/Private/BatchRenameTool/BatchRenameTool.cpp @@ -31,21 +31,25 @@ FDlgBatchRenameTool::FDlgBatchRenameTool(const TArray Assets) : bRemoveSuffix(false), SelectedAssets(Assets) { if (FSlateApplication::IsInitialized()) { + // clang-format off + // @formatter:off DialogWindow = SNew(SWindow) - .Title(LOCTEXT("BatchRenameToolDlgTitle", "Batch Rename Tool")) - .SupportsMinimize(false).SupportsMaximize(false) - .SaneWindowPlacement(true) - .AutoCenter(EAutoCenter::PreferredWorkArea) - .ClientSize(FVector2D(350, 165)); + .Title(LOCTEXT("BatchRenameToolDlgTitle", "Batch Rename Tool")) + .SupportsMinimize(false).SupportsMaximize(false) + .SaneWindowPlacement(true) + .AutoCenter(EAutoCenter::PreferredWorkArea) + .ClientSize(FVector2D(350, 165)); const TSharedPtr DialogWrapper = SNew(SBorder) - .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) - .Padding(4.0f) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) + .Padding(4.0f) [ SAssignNew(DialogWidget, SDlgBatchRenameTool) .ParentWindow(DialogWindow) ]; + // clang-format on + // @formatter:on DialogWindow->SetContent(DialogWrapper.ToSharedRef()); } diff --git a/Source/Linter/Private/Linter.cpp b/Source/Linter/Private/Linter.cpp index ba79e25..fa3f8c7 100644 --- a/Source/Linter/Private/Linter.cpp +++ b/Source/Linter/Private/Linter.cpp @@ -79,9 +79,13 @@ void FLinterModule::ShutdownModule() { TSharedRef FLinterModule::SpawnTab(const FSpawnTabArgs& TabSpawnArgs, TSharedPtr StyleSet) { const FSlateBrush* IconBrush = StyleSet->GetBrush("Linter.Toolbar.Icon"); + // clang-format off + // @formatter:off const TSharedRef MajorTab = SNew(SDockTab) .TabRole(ETabRole::MajorTab); + // clang-format on + // @formatter:on MajorTab->SetContent(SNew(SLintWizard)); MajorTab->SetTabIcon(IconBrush); diff --git a/Source/Linter/Private/LinterNamingConvention.cpp b/Source/Linter/Private/LinterNamingConvention.cpp index 0cbeb69..933aaec 100644 --- a/Source/Linter/Private/LinterNamingConvention.cpp +++ b/Source/Linter/Private/LinterNamingConvention.cpp @@ -36,6 +36,8 @@ void FLinterNamingConventionDetails::OnGenerateElementForDetails(const TSharedRe } )); + // clang-format off + // @formatter:off ChildrenBuilder.AddCustomRow(FText::GetEmpty()) [ SNew(SHorizontalBox) @@ -66,6 +68,8 @@ void FLinterNamingConventionDetails::OnGenerateElementForDetails(const TSharedRe SNew(SProperty, StructProperty->GetChildHandle("Suffix")) ] ]; + // clang-format on + // @formatter:on } ULinterNamingConvention::ULinterNamingConvention(const FObjectInitializer& ObjectInitializer) : diff --git a/Source/Linter/Private/TooltipTool/TooltipTool.cpp b/Source/Linter/Private/TooltipTool/TooltipTool.cpp index 0b45fea..902ccca 100644 --- a/Source/Linter/Private/TooltipTool/TooltipTool.cpp +++ b/Source/Linter/Private/TooltipTool/TooltipTool.cpp @@ -37,24 +37,28 @@ FTooltipTool::FTooltipTool(const TArray Assets) { } if (FSlateApplication::IsInitialized()) { + // clang-format off + // @formatter:off DialogWindow = SNew(SWindow) - .Title(LOCTEXT("TooltipToolDlgTitle", "Blueprint Member Tooltip Tool")) - .SupportsMinimize(false).SupportsMaximize(false) - .SaneWindowPlacement(true) - .AutoCenter(EAutoCenter::PreferredWorkArea) - .MinWidth(400.0f) - .MaxWidth(400.0f) - .SizingRule(ESizingRule::Autosized); + .Title(LOCTEXT("TooltipToolDlgTitle", "Blueprint Member Tooltip Tool")) + .SupportsMinimize(false).SupportsMaximize(false) + .SaneWindowPlacement(true) + .AutoCenter(EAutoCenter::PreferredWorkArea) + .MinWidth(400.0f) + .MaxWidth(400.0f) + .SizingRule(ESizingRule::Autosized); const TSharedPtr DialogWrapper = SNew(SBorder) - .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) - .Padding(4.0f) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) + .Padding(4.0f) [ SAssignNew(DialogWidget, STooltipTool) - .ParentWindow(DialogWindow) - .Blueprints(Blueprints) + .ParentWindow(DialogWindow) + .Blueprints(Blueprints) ]; + // clang-format on + // @formatter:on DialogWindow->SetContent(DialogWrapper.ToSharedRef()); } @@ -75,11 +79,13 @@ void STooltipTool::Construct(const FArguments& InArgs) { Blueprints = InArgs._Blueprints; check(Blueprints.IsSet() && Blueprints.Get().Num() > 0); + // clang-format off + // @formatter:off this->ChildSlot[ SNew(SVerticalBox) + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 0.0f) + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 0.0f) [ SNew(SHeader) [ @@ -88,44 +94,42 @@ void STooltipTool::Construct(const FArguments& InArgs) { ] ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) [ SAssignNew(BlueprintComboBox, SComboBox>) - .OptionsSource(&Blueprints.Get()) - .InitiallySelectedItem(Blueprints.Get()[0]) - .OnGenerateWidget_Lambda( - [](const TSharedPtr Item) { - return SNew(STextBlock) - .Text(FText::FromName(Item->AssetName)) - .ToolTipText(FText::FromString(Item->GetFullName())); - }) - .OnSelectionChanged_Lambda( - [&](TSharedPtr Item, ESelectInfo::Type SelectInfo) { - VariableTooltipEditableTextBox->SetEnabled(false); - RebuildMemberList(); - }) + .OptionsSource(&Blueprints.Get()) + .InitiallySelectedItem(Blueprints.Get()[0]) + .OnGenerateWidget_Lambda([](const TSharedPtr Item) { + return + SNew(STextBlock) + .Text(FText::FromName(Item->AssetName)) + .ToolTipText(FText::FromString(Item->GetFullName())); + }) + .OnSelectionChanged_Lambda([&](TSharedPtr Item, ESelectInfo::Type SelectInfo) { + VariableTooltipEditableTextBox->SetEnabled(false); + RebuildMemberList(); + }) [ SNew(STextBlock) .Text(this, &STooltipTool::GetSelectedBlueprintText) ] ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) [ SNew(SHorizontalBox) + SHorizontalBox::Slot() .FillWidth(1.0f) [ SNew(SButton) - .OnClicked_Lambda( - [&] { - int32 Index = Blueprints.Get().Find(BlueprintComboBox->GetSelectedItem()); - Index = (Blueprints.Get().Num() + Index - 1) % Blueprints.Get().Num(); - BlueprintComboBox->SetSelectedItem(Blueprints.Get()[Index]); - return FReply::Handled(); - }) + .OnClicked_Lambda([&]() { + int32 Index = Blueprints.Get().Find(BlueprintComboBox->GetSelectedItem()); + Index = (Blueprints.Get().Num() + Index - 1) % Blueprints.Get().Num(); + BlueprintComboBox->SetSelectedItem(Blueprints.Get()[Index]); + return FReply::Handled(); + }) [ SNew(STextBlock) .Text(LOCTEXT("TooltipToolBlueprintsPrevious", "Previous")) @@ -135,13 +139,12 @@ void STooltipTool::Construct(const FArguments& InArgs) { .FillWidth(1.0f) [ SNew(SButton) - .OnClicked_Lambda( - [&] { - int32 Index = Blueprints.Get().Find(BlueprintComboBox->GetSelectedItem()); - Index = (Index + 1) % Blueprints.Get().Num(); - BlueprintComboBox->SetSelectedItem(Blueprints.Get()[Index]); - return FReply::Handled(); - }) + .OnClicked_Lambda([&]() { + int32 Index = Blueprints.Get().Find(BlueprintComboBox->GetSelectedItem()); + Index = (Index + 1) % Blueprints.Get().Num(); + BlueprintComboBox->SetSelectedItem(Blueprints.Get()[Index]); + return FReply::Handled(); + }) [ SNew(STextBlock) .Text(LOCTEXT("TooltipToolBlueprintsNext", "Next")) @@ -150,104 +153,102 @@ void STooltipTool::Construct(const FArguments& InArgs) { ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) [ SNew(SButton) - .OnClicked_Lambda( - [&] { - // Save package here if SCC is enabled because the user can use SCC to revert a change - TArray OutermostPackagesToSave; - for (auto&& Asset : Blueprints.Get()) { - OutermostPackagesToSave.Add(Asset->GetPackage()); - } - FEditorFileUtils::PromptForCheckoutAndSave(OutermostPackagesToSave, true, false); - return FReply::Handled(); - }) + .OnClicked_Lambda([&]() { + // Save package here if SCC is enabled because the user can use SCC to revert a change + TArray OutermostPackagesToSave; + for (auto&& Asset : Blueprints.Get()) { + OutermostPackagesToSave.Add(Asset->GetPackage()); + } + FEditorFileUtils::PromptForCheckoutAndSave(OutermostPackagesToSave, true, false); + return FReply::Handled(); + }) [ SNew(STextBlock) .Text(LOCTEXT("TooltipToolBlueprintsSaveButtonLabel", "Save All Blueprints")) ] ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) [ SNew(SExpandableArea) - .InitiallyCollapsed(true) - .AreaTitle(LOCTEXT("TooltipToolVariablesExpandableTitle", "Variables")) - .BodyContent() + .InitiallyCollapsed(true) + .AreaTitle(LOCTEXT("TooltipToolVariablesExpandableTitle", "Variables")) + .BodyContent() [ SNew(SVerticalBox) + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) [ SNew(SBox) .HeightOverride(100.0f) [ SNew(SBorder) - .BorderImage(FCoreStyle::Get().GetBrush("ToolPanel.GroupBorder")) - .Padding(0.0f) + .BorderImage(FCoreStyle::Get().GetBrush("ToolPanel.GroupBorder")) + .Padding(0.0f) [ SNew(SScrollBox) .ScrollBarAlwaysVisible(true) + SScrollBox::Slot() [ SAssignNew(MemberListView, SListView>) - .SelectionMode(ESelectionMode::Single) - .ListItemsSource(&Members) - .OnGenerateRow_Lambda( - [](TSharedPtr Item, const TSharedRef& OwnerTable) { - return SNew(STableRow>, OwnerTable) - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(SImage) - .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) - .Visibility_Lambda([Item] { - return Item.IsValid() ? (Item->HasMetaData(FBlueprintMetadata::MD_Tooltip) && Item->GetMetaData(FBlueprintMetadata::MD_Tooltip).Len() > 0 ? EVisibility::Collapsed : EVisibility::HitTestInvisible) : EVisibility::Collapsed; - }) - ] - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(STextBlock) - .Text(FText::FromString(Item->FriendlyName)) - ] - + SHorizontalBox::Slot() - .FillWidth(1.0f) - [ - SNew(STextBlock) - .Text(UEdGraphSchema_K2::TypeToText(Item->VarType)) - .Justification(ETextJustify::Right) - ] - ]; - }) - .OnSelectionChanged_Lambda( - [&](const TSharedPtr Item, ESelectInfo::Type SelectInfo) { - if (!Item.IsValid()) { - VariableTooltipEditableTextBox->SetEnabled(false); - VariableTooltipEditableTextBox->SetText(FText::GetEmpty()); - return; - } - - VariableTooltipEditableTextBox->SetEnabled(true); - if (Item->HasMetaData(FBlueprintMetadata::MD_Tooltip)) { - VariableTooltipEditableTextBox->SetText(FText::FromString(Item->GetMetaData(FBlueprintMetadata::MD_Tooltip))); - } else { - VariableTooltipEditableTextBox->SetText(FText::GetEmpty()); - } - }) + .SelectionMode(ESelectionMode::Single) + .ListItemsSource(&Members) + .OnGenerateRow_Lambda([](TSharedPtr Item, const TSharedRef& OwnerTable) { + return + SNew(STableRow>, OwnerTable) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(SImage) + .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) + .Visibility_Lambda([Item] { + return Item.IsValid() ? (Item->HasMetaData(FBlueprintMetadata::MD_Tooltip) && Item->GetMetaData(FBlueprintMetadata::MD_Tooltip).Len() > 0 ? EVisibility::Collapsed : EVisibility::HitTestInvisible) : EVisibility::Collapsed; + }) + ] + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(STextBlock) + .Text(FText::FromString(Item->FriendlyName)) + ] + + SHorizontalBox::Slot() + .FillWidth(1.0f) + [ + SNew(STextBlock) + .Text(UEdGraphSchema_K2::TypeToText(Item->VarType)) + .Justification(ETextJustify::Right) + ] + ]; + }) + .OnSelectionChanged_Lambda([&](const TSharedPtr Item, ESelectInfo::Type SelectInfo) { + if (!Item.IsValid()) { + VariableTooltipEditableTextBox->SetEnabled(false); + VariableTooltipEditableTextBox->SetText(FText::GetEmpty()); + return; + } + + VariableTooltipEditableTextBox->SetEnabled(true); + if (Item->HasMetaData(FBlueprintMetadata::MD_Tooltip)) { + VariableTooltipEditableTextBox->SetText(FText::FromString(Item->GetMetaData(FBlueprintMetadata::MD_Tooltip))); + } else { + VariableTooltipEditableTextBox->SetText(FText::GetEmpty()); + } + }) ] ] ] ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) [ SNew(SHeader) [ @@ -256,35 +257,34 @@ void STooltipTool::Construct(const FArguments& InArgs) { ] ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) [ SNew(SBox) .HeightOverride(100.0f) [ SAssignNew(VariableTooltipEditableTextBox, SMultiLineEditableTextBox) - .AutoWrapText(true) - .IsEnabled(false) - .OnTextChanged_Lambda( - [&](const FText& NewText) { - if (CommitOnTextChangeCheckBox->IsChecked()) { - UpdateVariableTooltipText(NewText); - } - }) + .AutoWrapText(true) + .IsEnabled(false) + .OnTextChanged_Lambda([&](const FText& NewText) { + if (CommitOnTextChangeCheckBox->IsChecked()) { + UpdateVariableTooltipText(NewText); + } + }) ] ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) [ SAssignNew(CommitTextButton, SButton) - .OnClicked_Lambda([&] { - /**UpdateVariableTooltipText(TooltipEditableTextBox->GetText());**/ - return FReply::Handled(); - }) - .Visibility_Lambda([&] { - return CommitOnTextChangeCheckBox->IsChecked() ? EVisibility::Collapsed : EVisibility::Visible; - }) + .OnClicked_Lambda([&]() { + /**UpdateVariableTooltipText(TooltipEditableTextBox->GetText());**/ + return FReply::Handled(); + }) + .Visibility_Lambda([&]() { + return CommitOnTextChangeCheckBox->IsChecked() ? EVisibility::Collapsed : EVisibility::Visible; + }) [ SNew(STextBlock) .Text(LOCTEXT("TooltipToolCommitTextButtonLabel", "Commit Text")) @@ -293,120 +293,119 @@ void STooltipTool::Construct(const FArguments& InArgs) { ] ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) [ SNew(SExpandableArea) - .InitiallyCollapsed(true) - .AreaTitle(LOCTEXT("TooltipToolFunctionExpandableTitle", "Functions")) - .BodyContent() + .InitiallyCollapsed(true) + .AreaTitle(LOCTEXT("TooltipToolFunctionExpandableTitle", "Functions")) + .BodyContent() [ SNew(SVerticalBox) + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) [ SNew(SBox) .HeightOverride(100.0f) [ SNew(SBorder) - .BorderImage(FCoreStyle::Get().GetBrush("ToolPanel.GroupBorder")) - .Padding(0.0f) + .BorderImage(FCoreStyle::Get().GetBrush("ToolPanel.GroupBorder")) + .Padding(0.0f) [ SNew(SScrollBox) .ScrollBarAlwaysVisible(true) + SScrollBox::Slot() [ SAssignNew(FunctionListView, SListView>) - .SelectionMode(ESelectionMode::Single) - .ListItemsSource(&FunctionPointers) - .OnGenerateRow_Lambda( - [](TSharedPtr Item, const TSharedRef& OwnerTable) { - return SNew(STableRow>, OwnerTable) - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(SImage) - .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) - .Visibility_Lambda([Item] { - return (Item.IsValid() && Item->FunctionEntryNode != nullptr && !Item->FunctionEntryNode->MetaData.ToolTip.IsEmptyOrWhitespace()) ? EVisibility::Collapsed : EVisibility::Visible; - }) - ] - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(STextBlock) - .Text(FText::FromName(Item->FunctionName)) - ] - ]; - }) - .OnSelectionChanged_Lambda( - [&](const TSharedPtr Item, ESelectInfo::Type SelectInfo) { - FunctionArgumentDescriptions.Empty(); - FunctionOutputDescriptions.Empty(); - - if (!Item.IsValid()) { - FunctionArgumentListView->RebuildList(); - FunctionOutputListView->RebuildList(); - - FunctionDescriptionTooltipBox->SetEnabled(false); - FunctionArgumentListView->SetEnabled(false); - FunctionOutputListView->SetEnabled(false); - FunctionDescriptionTooltipBox->SetText(FText::GetEmpty()); - - return; - } - - check(Item->FunctionEntryNode); - TArray InputPins = Item->FunctionEntryNode->GetAllPins(); - for (const UEdGraphPin* Pin : InputPins) { - if (Pin->Direction == EGPD_Output) { - if (Pin->PinType.PinCategory != UEdGraphSchema_K2::PC_Exec) { - FunctionArgumentDescriptions.Add(MakeShared(FText::FromString(Pin->GetName()), FText::GetEmpty(), UEdGraphSchema_K2::TypeToText(Pin->PinType))); - } - } - } - - if (Item->FunctionResultNode != nullptr) { - TArray OutputPins = Item->FunctionResultNode->GetAllPins(); - for (const UEdGraphPin* Pin : OutputPins) { - if (Pin->Direction == EGPD_Input) { - if (Pin->PinType.PinCategory != UEdGraphSchema_K2::PC_Exec) { - FunctionOutputDescriptions.Add(MakeShared(FText::FromString(Pin->GetName()), FText::GetEmpty(), UEdGraphSchema_K2::TypeToText(Pin->PinType))); - } - } - } - } - - FunctionDescriptionTooltipBox->SetEnabled(true); - FunctionArgumentListView->SetEnabled(true); - FunctionOutputListView->SetEnabled(true); - - FText FunctionDescription; - FText ReturnText; - - if (!FTooltipStringHelper::ParseFunctionRawTooltip(Item->FunctionEntryNode->MetaData.ToolTip.ToString(), CurrentFunctionDescription, FunctionArgumentDescriptions, FunctionOutputDescriptions, ReturnText)) { - CurrentFunctionDescription = FText::GetEmpty(); - } - - if (!ReturnText.IsEmptyOrWhitespace() && FunctionOutputDescriptions.Num() > 0) { - FunctionOutputDescriptions[FunctionOutputDescriptions.Num() - 1]->Tooltip = ReturnText; - } - - FunctionArgumentListView->RebuildList(); - FunctionOutputListView->RebuildList(); - - FunctionDescriptionTooltipBox->SetText(CurrentFunctionDescription); - }) + .SelectionMode(ESelectionMode::Single) + .ListItemsSource(&FunctionPointers) + .OnGenerateRow_Lambda([](TSharedPtr Item, const TSharedRef& OwnerTable) { + return + SNew(STableRow>, OwnerTable) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(SImage) + .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) + .Visibility_Lambda([Item] { + return (Item.IsValid() && Item->FunctionEntryNode != nullptr && !Item->FunctionEntryNode->MetaData.ToolTip.IsEmptyOrWhitespace()) ? EVisibility::Collapsed : EVisibility::Visible; + }) + ] + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(STextBlock) + .Text(FText::FromName(Item->FunctionName)) + ] + ]; + }) + .OnSelectionChanged_Lambda([&](const TSharedPtr Item, ESelectInfo::Type SelectInfo) { + FunctionArgumentDescriptions.Empty(); + FunctionOutputDescriptions.Empty(); + + if (!Item.IsValid()) { + FunctionArgumentListView->RebuildList(); + FunctionOutputListView->RebuildList(); + + FunctionDescriptionTooltipBox->SetEnabled(false); + FunctionArgumentListView->SetEnabled(false); + FunctionOutputListView->SetEnabled(false); + FunctionDescriptionTooltipBox->SetText(FText::GetEmpty()); + + return; + } + + check(Item->FunctionEntryNode); + TArray InputPins = Item->FunctionEntryNode->GetAllPins(); + for (const UEdGraphPin* Pin : InputPins) { + if (Pin->Direction == EGPD_Output) { + if (Pin->PinType.PinCategory != UEdGraphSchema_K2::PC_Exec) { + FunctionArgumentDescriptions.Add(MakeShared(FText::FromString(Pin->GetName()), FText::GetEmpty(), UEdGraphSchema_K2::TypeToText(Pin->PinType))); + } + } + } + + if (Item->FunctionResultNode != nullptr) { + TArray OutputPins = Item->FunctionResultNode->GetAllPins(); + for (const UEdGraphPin* Pin : OutputPins) { + if (Pin->Direction == EGPD_Input) { + if (Pin->PinType.PinCategory != UEdGraphSchema_K2::PC_Exec) { + FunctionOutputDescriptions.Add(MakeShared(FText::FromString(Pin->GetName()), FText::GetEmpty(), UEdGraphSchema_K2::TypeToText(Pin->PinType))); + } + } + } + } + + FunctionDescriptionTooltipBox->SetEnabled(true); + FunctionArgumentListView->SetEnabled(true); + FunctionOutputListView->SetEnabled(true); + + FText FunctionDescription; + FText ReturnText; + + if (!FTooltipStringHelper::ParseFunctionRawTooltip(Item->FunctionEntryNode->MetaData.ToolTip.ToString(), CurrentFunctionDescription, FunctionArgumentDescriptions, FunctionOutputDescriptions, ReturnText)) { + CurrentFunctionDescription = FText::GetEmpty(); + } + + if (!ReturnText.IsEmptyOrWhitespace() && FunctionOutputDescriptions.Num() > 0) { + FunctionOutputDescriptions[FunctionOutputDescriptions.Num() - 1]->Tooltip = ReturnText; + } + + FunctionArgumentListView->RebuildList(); + FunctionOutputListView->RebuildList(); + + FunctionDescriptionTooltipBox->SetText(CurrentFunctionDescription); + }) ] ] ] ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) [ SNew(SVerticalBox) + SVerticalBox::Slot() @@ -425,16 +424,15 @@ void STooltipTool::Construct(const FArguments& InArgs) { .HeightOverride(60.0f) [ SAssignNew(FunctionDescriptionTooltipBox, SMultiLineEditableTextBox) - .AutoWrapText(true) - .IsEnabled(false) - .OnTextChanged_Lambda( - [&](const FText& NewText) { - if (CommitOnTextChangeCheckBox->IsChecked()) { - if (!NewText.EqualTo(CurrentFunctionDescription)) { - UpdateCurrentFunctionTooltipText(); - } - } - }) + .AutoWrapText(true) + .IsEnabled(false) + .OnTextChanged_Lambda([&](const FText& NewText) { + if (CommitOnTextChangeCheckBox->IsChecked()) { + if (!NewText.EqualTo(CurrentFunctionDescription)) { + UpdateCurrentFunctionTooltipText(); + } + } + }) ] ] + SVerticalBox::Slot() @@ -450,58 +448,56 @@ void STooltipTool::Construct(const FArguments& InArgs) { .AutoHeight() [ SNew(SBox) - .MinDesiredHeight(20.0f) - .MaxDesiredHeight(100.0f) + .MinDesiredHeight(20.0f) + .MaxDesiredHeight(100.0f) [ SNew(SBorder) - .BorderImage(FCoreStyle::Get().GetBrush("ToolPanel.GroupBorder")) - .Padding(0.0f) + .BorderImage(FCoreStyle::Get().GetBrush("ToolPanel.GroupBorder")) + .Padding(0.0f) [ SNew(SScrollBox) .ScrollBarAlwaysVisible(true) + SScrollBox::Slot() [ SAssignNew(FunctionArgumentListView, SListView>) - .SelectionMode(ESelectionMode::None) - .ListItemsSource(&FunctionArgumentDescriptions) - .OnGenerateRow_Lambda( - [&](TSharedPtr Item, const TSharedRef& OwnerTable) { - return SNew(STableRow>, OwnerTable) - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(SImage) - .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) - .Visibility_Lambda([Item] { - return (Item.IsValid() && !Item->Tooltip.IsEmptyOrWhitespace()) ? EVisibility::Collapsed : EVisibility::Visible; - }) - ] - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(STextBlock) - .Text(FText::FromString(FString::Printf(TEXT("%s (%s)"), *Item->ArgumentName.ToString(), *Item->ArgumentType.ToString()))) - ] - ] - + SVerticalBox::Slot() - .Padding(0.0f, 4.0f, 0.0f, 4.0f) - [ - SNew(SEditableTextBox) - .Text(Item->Tooltip) - .OnTextChanged_Lambda( - [&](const FText& NewText) { - if (CommitOnTextChangeCheckBox->IsChecked()) { - UpdateCurrentFunctionTooltipText(); - } - }) - ] - ]; - }) + .SelectionMode(ESelectionMode::None) + .ListItemsSource(&FunctionArgumentDescriptions) + .OnGenerateRow_Lambda([&](TSharedPtr Item, const TSharedRef& OwnerTable) { + return SNew(STableRow>, OwnerTable) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(SImage) + .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) + .Visibility_Lambda([Item] { + return (Item.IsValid() && !Item->Tooltip.IsEmptyOrWhitespace()) ? EVisibility::Collapsed : EVisibility::Visible; + }) + ] + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(STextBlock) + .Text(FText::FromString(FString::Printf(TEXT("%s (%s)"), *Item->ArgumentName.ToString(), *Item->ArgumentType.ToString()))) + ] + ] + + SVerticalBox::Slot() + .Padding(0.0f, 4.0f, 0.0f, 4.0f) + [ + SNew(SEditableTextBox) + .Text(Item->Tooltip) + .OnTextChanged_Lambda([&](const FText& NewText) { + if (CommitOnTextChangeCheckBox->IsChecked()) { + UpdateCurrentFunctionTooltipText(); + } + }) + ] + ]; + }) ] ] ] @@ -520,75 +516,73 @@ void STooltipTool::Construct(const FArguments& InArgs) { .AutoHeight() [ SNew(SBox) - .MinDesiredHeight(20.0f) - .MaxDesiredHeight(100.0f) + .MinDesiredHeight(20.0f) + .MaxDesiredHeight(100.0f) [ SNew(SBorder) - .BorderImage(FCoreStyle::Get().GetBrush("ToolPanel.GroupBorder")) - .Padding(0.0f) + .BorderImage(FCoreStyle::Get().GetBrush("ToolPanel.GroupBorder")) + .Padding(0.0f) [ SNew(SScrollBox) .ScrollBarAlwaysVisible(true) + SScrollBox::Slot() [ SAssignNew(FunctionOutputListView, SListView>) - .SelectionMode(ESelectionMode::None) - .ListItemsSource(&FunctionOutputDescriptions) - .OnGenerateRow_Lambda( - [&](TSharedPtr Item, const TSharedRef& OwnerTable) { - return SNew(STableRow>, OwnerTable) - [ - SNew(SVerticalBox) - + SVerticalBox::Slot() - [ - SNew(SHorizontalBox) - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(SImage) - .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) - .Visibility_Lambda([Item] { - return (Item.IsValid() && !Item->Tooltip.IsEmptyOrWhitespace()) ? EVisibility::Collapsed : EVisibility::Visible; - }) - ] - + SHorizontalBox::Slot() - .AutoWidth() - [ - SNew(STextBlock) - .Text(FText::FromString(FString::Printf(TEXT("%s (%s)"), *Item->ArgumentName.ToString(), *Item->ArgumentType.ToString()))) - ] - ] - + SVerticalBox::Slot() - .Padding(0.0f, 4.0f, 0.0f, 4.0f) - [ - SNew(SEditableTextBox) - .Text(Item->Tooltip) - .OnTextChanged_Lambda( - [&](const FText& NewText) { - if (CommitOnTextChangeCheckBox->IsChecked()) { - UpdateCurrentFunctionTooltipText(); - } - }) - ] - ]; - }) + .SelectionMode(ESelectionMode::None) + .ListItemsSource(&FunctionOutputDescriptions) + .OnGenerateRow_Lambda([&](TSharedPtr Item, const TSharedRef& OwnerTable) { + return SNew(STableRow>, OwnerTable) + [ + SNew(SVerticalBox) + + SVerticalBox::Slot() + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(SImage) + .Image(FAppStyle::GetBrush(TEXT("Icons.Error"))) + .Visibility_Lambda([Item] { + return (Item.IsValid() && !Item->Tooltip.IsEmptyOrWhitespace()) ? EVisibility::Collapsed : EVisibility::Visible; + }) + ] + + SHorizontalBox::Slot() + .AutoWidth() + [ + SNew(STextBlock) + .Text(FText::FromString(FString::Printf(TEXT("%s (%s)"), *Item->ArgumentName.ToString(), *Item->ArgumentType.ToString()))) + ] + ] + + SVerticalBox::Slot() + .Padding(0.0f, 4.0f, 0.0f, 4.0f) + [ + SNew(SEditableTextBox) + .Text(Item->Tooltip) + .OnTextChanged_Lambda([&](const FText& NewText) { + if (CommitOnTextChangeCheckBox->IsChecked()) { + UpdateCurrentFunctionTooltipText(); + } + }) + ] + ]; + }) ] ] ] ] ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) [ SAssignNew(CommitTextButton, SButton) - .OnClicked_Lambda([&] { - UpdateVariableTooltipText(VariableTooltipEditableTextBox->GetText()); - return FReply::Handled(); - }) - .Visibility_Lambda([&] { - return CommitOnTextChangeCheckBox->IsChecked() ? EVisibility::Collapsed : EVisibility::Visible; - }) + .OnClicked_Lambda([&] { + UpdateVariableTooltipText(VariableTooltipEditableTextBox->GetText()); + return FReply::Handled(); + }) + .Visibility_Lambda([&] { + return CommitOnTextChangeCheckBox->IsChecked() ? EVisibility::Collapsed : EVisibility::Visible; + }) [ SNew(STextBlock) .Text(LOCTEXT("TooltipToolCommitTextButtonLabel", "Commit Text")) @@ -597,19 +591,19 @@ void STooltipTool::Construct(const FArguments& InArgs) { ] ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 4.0f) + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 4.0f) [ SNew(SSeparator) ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(8.0f, 4.0f, 8.0f, 0.0f) + .AutoHeight() + .Padding(8.0f, 4.0f, 8.0f, 0.0f) [ SNew(SExpandableArea) - .InitiallyCollapsed(true) - .AreaTitle(LOCTEXT("TooltipToolBehaviorExpandableTitle", "Tool Behavior")) - .BodyContent() + .InitiallyCollapsed(true) + .AreaTitle(LOCTEXT("TooltipToolBehaviorExpandableTitle", "Tool Behavior")) + .BodyContent() [ SAssignNew(CommitOnTextChangeCheckBox, SCheckBox) .IsChecked(ECheckBoxState::Checked) @@ -620,6 +614,8 @@ void STooltipTool::Construct(const FArguments& InArgs) { ] ] ]; + // clang-format on + // @formatter:on RebuildMemberList(); } diff --git a/Source/Linter/Private/UI/LintReport.cpp b/Source/Linter/Private/UI/LintReport.cpp index cbab7f9..a1ffa62 100644 --- a/Source/Linter/Private/UI/LintReport.cpp +++ b/Source/Linter/Private/UI/LintReport.cpp @@ -33,189 +33,193 @@ using FAppStyle = FEditorStyle; void SLintReport::Construct(const FArguments& Args) { const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); + // clang-format off + // @formatter:off ChildSlot [ SNew(SVerticalBox) + SVerticalBox::Slot() - .VAlign(VAlign_Fill) - .AutoHeight() + .VAlign(VAlign_Fill) + .AutoHeight() [ SNew(SHorizontalBox) + SHorizontalBox::Slot() - .HAlign(HAlign_Left) - .AutoWidth() - .Padding(PaddingAmount) + .HAlign(HAlign_Left) + .AutoWidth() + .Padding(PaddingAmount) [ SNew(SButton) - .Text(LOCTEXT("Rescan", "Rescan")) - .OnClicked_Lambda([this]() -> FReply { - Rebuild(LastUsedRuleSet); - return FReply::Handled(); - }) + .Text(LOCTEXT("Rescan", "Rescan")) + .OnClicked_Lambda([this]() -> FReply { + Rebuild(LastUsedRuleSet); + return FReply::Handled(); + }) ] + SHorizontalBox::Slot() - .HAlign(HAlign_Left) - .VAlign(VAlign_Center) - .AutoWidth() - .Padding(PaddingAmount) + .HAlign(HAlign_Left) + .VAlign(VAlign_Center) + .AutoWidth() + .Padding(PaddingAmount) [ SAssignNew(ResultsTextBlockPtr, STextBlock) ] + SHorizontalBox::Slot() - .HAlign(HAlign_Fill) - .VAlign(VAlign_Center) - .FillWidth(1.0f) - .Padding(PaddingAmount) + .HAlign(HAlign_Fill) + .VAlign(VAlign_Center) + .FillWidth(1.0f) + .Padding(PaddingAmount) [ SNew(SSpacer) ] + SHorizontalBox::Slot() - .HAlign(HAlign_Right) - .AutoWidth() - .Padding(PaddingAmount) + .HAlign(HAlign_Right) + .AutoWidth() + .Padding(PaddingAmount) [ SNew(SButton) - .Text(LOCTEXT("ExportToJSON", "Export To JSON")) - .OnClicked_Lambda([this]() -> FReply { - IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); - - const void* ParentWindowWindowHandle = FSlateApplication::Get().FindBestParentWindowHandleForDialogs(nullptr); - - const FText Title = LOCTEXT("ExportToJsonTitle", "Export Lint Report as JSON"); - const FString FileTypes = TEXT("Json (*.json)|*.json"); - - const FDateTime Now = FDateTime::Now(); - const FString Output = TEXT("lint-report-") + Now.ToString() + TEXT(".json"); - - FString DefaultPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); - DefaultPath = FPaths::ConvertRelativePathToFull(DefaultPath); - IFileManager::Get().MakeDirectory(*DefaultPath, true); - - TArray OutFilenames; - DesktopPlatform->SaveFileDialog( - ParentWindowWindowHandle, - Title.ToString(), - DefaultPath, - Output, - FileTypes, - EFileDialogFlags::None, - OutFilenames - ); - - if (OutFilenames.Num() > 0) { - const FString WritePath = FPaths::ConvertRelativePathToFull(OutFilenames[0]); - FFileHelper::SaveStringToFile(JsonReport, *WritePath); - FPlatformProcess::LaunchURL(*WritePath, TEXT(""), nullptr); - } - - return FReply::Handled(); - }) + .Text(LOCTEXT("ExportToJSON", "Export To JSON")) + .OnClicked_Lambda([this]() -> FReply { + IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); + + const void* ParentWindowWindowHandle = FSlateApplication::Get().FindBestParentWindowHandleForDialogs(nullptr); + + const FText Title = LOCTEXT("ExportToJsonTitle", "Export Lint Report as JSON"); + const FString FileTypes = TEXT("Json (*.json)|*.json"); + + const FDateTime Now = FDateTime::Now(); + const FString Output = TEXT("lint-report-") + Now.ToString() + TEXT(".json"); + + FString DefaultPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); + DefaultPath = FPaths::ConvertRelativePathToFull(DefaultPath); + IFileManager::Get().MakeDirectory(*DefaultPath, true); + + TArray OutFilenames; + DesktopPlatform->SaveFileDialog( + ParentWindowWindowHandle, + Title.ToString(), + DefaultPath, + Output, + FileTypes, + EFileDialogFlags::None, + OutFilenames + ); + + if (OutFilenames.Num() > 0) { + const FString WritePath = FPaths::ConvertRelativePathToFull(OutFilenames[0]); + FFileHelper::SaveStringToFile(JsonReport, *WritePath); + FPlatformProcess::LaunchURL(*WritePath, TEXT(""), nullptr); + } + + return FReply::Handled(); + }) ] + SHorizontalBox::Slot() - .HAlign(HAlign_Right) - .AutoWidth() - .Padding(PaddingAmount) + .HAlign(HAlign_Right) + .AutoWidth() + .Padding(PaddingAmount) [ SNew(SButton) - .Text(LOCTEXT("ExportToHTML", "Export To HTML")) - .OnClicked_Lambda([this]() -> FReply { - IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); - - const void* ParentWindowWindowHandle = FSlateApplication::Get().FindBestParentWindowHandleForDialogs(nullptr); - - const FText Title = LOCTEXT("ExportToHTMLTitle", "Export Lint Report as HTML"); - const FString FileTypes = TEXT("HTML (*.html)|*.html"); - - const FDateTime Now = FDateTime::Now(); - const FString Output = TEXT("lint-report-") + Now.ToString() + TEXT(".html"); - - FString DefaultPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); - DefaultPath = FPaths::ConvertRelativePathToFull(DefaultPath); - IFileManager::Get().MakeDirectory(*DefaultPath, true); - - TArray OutFilenames; - DesktopPlatform->SaveFileDialog( - ParentWindowWindowHandle, - Title.ToString(), - DefaultPath, - Output, - FileTypes, - EFileDialogFlags::None, - OutFilenames - ); - - if (OutFilenames.Num() > 0) { - const FString WritePath = FPaths::ConvertRelativePathToFull(OutFilenames[0]); - FFileHelper::SaveStringToFile(HTMLReport, *WritePath); - FPlatformProcess::LaunchURL(*WritePath, TEXT(""), nullptr); - } - - return FReply::Handled(); - }) + .Text(LOCTEXT("ExportToHTML", "Export To HTML")) + .OnClicked_Lambda([this]() -> FReply { + IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get(); + + const void* ParentWindowWindowHandle = FSlateApplication::Get().FindBestParentWindowHandleForDialogs(nullptr); + + const FText Title = LOCTEXT("ExportToHTMLTitle", "Export Lint Report as HTML"); + const FString FileTypes = TEXT("HTML (*.html)|*.html"); + + const FDateTime Now = FDateTime::Now(); + const FString Output = TEXT("lint-report-") + Now.ToString() + TEXT(".html"); + + FString DefaultPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); + DefaultPath = FPaths::ConvertRelativePathToFull(DefaultPath); + IFileManager::Get().MakeDirectory(*DefaultPath, true); + + TArray OutFilenames; + DesktopPlatform->SaveFileDialog( + ParentWindowWindowHandle, + Title.ToString(), + DefaultPath, + Output, + FileTypes, + EFileDialogFlags::None, + OutFilenames + ); + + if (OutFilenames.Num() > 0) { + const FString WritePath = FPaths::ConvertRelativePathToFull(OutFilenames[0]); + FFileHelper::SaveStringToFile(HTMLReport, *WritePath); + FPlatformProcess::LaunchURL(*WritePath, TEXT(""), nullptr); + } + + return FReply::Handled(); + }) ] ] + SVerticalBox::Slot() - .VAlign(VAlign_Fill) - .FillHeight(1.0f) - .Padding(PaddingAmount) + .VAlign(VAlign_Fill) + .FillHeight(1.0f) + .Padding(PaddingAmount) [ SAssignNew(AssetDetailsScrollBoxPtr, SScrollBox) .ScrollBarAlwaysVisible(true) ] + SVerticalBox::Slot() - .VAlign(VAlign_Fill) - .FillHeight(1.0f) - .Padding(PaddingAmount) + .VAlign(VAlign_Fill) + .FillHeight(1.0f) + .Padding(PaddingAmount) [ SAssignNew(RuleDetailsScrollBoxPtr, SScrollBox) - .ScrollBarAlwaysVisible(true) - .Visibility(EVisibility::Collapsed) + .ScrollBarAlwaysVisible(true) + .Visibility(EVisibility::Collapsed) ] // Bottom panel + SVerticalBox::Slot() - .AutoHeight() - .VAlign(VAlign_Top) + .AutoHeight() + .VAlign(VAlign_Top) [ SNew(SBorder) - .BorderImage(FAppStyle::GetBrush("NoBorder")) - .Padding(FMargin(4.0f, 0.0f, 4.0f, 2.0f)) - //.Visibility_Lambda([&]() { return AssetErrorLists.Num() > 0 ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed; }) + .BorderImage(FAppStyle::GetBrush("NoBorder")) + .Padding(FMargin(4.0f, 0.0f, 4.0f, 2.0f)) + // .Visibility_Lambda([&]() { return AssetErrorLists.Num() > 0 ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed; }) [ SNew(SBorder) - .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) - .Padding(FMargin(2.0f, 0.0f, 2.0f, 2.0f)) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) + .Padding(FMargin(2.0f, 0.0f, 2.0f, 2.0f)) [ SNew(SHorizontalBox) // View mode combo button + SHorizontalBox::Slot() - .FillWidth(1.f) - .VAlign(VAlign_Center) - .HAlign(HAlign_Right) + .FillWidth(1.f) + .VAlign(VAlign_Center) + .HAlign(HAlign_Right) [ SAssignNew(ViewOptionsComboButton, SComboButton) - .ContentPadding(0) - .ForegroundColor_Lambda([&]() { - return ViewOptionsComboButton->IsHovered() ? FAppStyle::GetSlateColor("InvertedForeground") : FAppStyle::GetSlateColor("DefaultForeground"); - }) - .ButtonStyle(FAppStyle::Get(), "ToggleButton") // Use the tool bar item style for this button - .OnGetMenuContent(this, &SLintReport::GetViewButtonContent) - .ButtonContent() + .ContentPadding(0) + .ForegroundColor_Lambda([&]() { + return ViewOptionsComboButton->IsHovered() ? FAppStyle::GetSlateColor("InvertedForeground") : FAppStyle::GetSlateColor("DefaultForeground"); + }) + .ButtonStyle(FAppStyle::Get(), "ToggleButton") // Use the tool bar item style for this button + .OnGetMenuContent(this, &SLintReport::GetViewButtonContent) + .ButtonContent() [ SNew(SHorizontalBox) + SHorizontalBox::Slot() - .AutoWidth() - .VAlign(VAlign_Center) + .AutoWidth() + .VAlign(VAlign_Center) [ - SNew(SImage).Image(FAppStyle::GetBrush("GenericViewButton")) + SNew(SImage) + .Image(FAppStyle::GetBrush("GenericViewButton")) ] + SHorizontalBox::Slot() - .AutoWidth() - .Padding(2, 0, 0, 0) - .VAlign(VAlign_Center) + .AutoWidth() + .Padding(2, 0, 0, 0) + .VAlign(VAlign_Center) [ - SNew(STextBlock).Text(LOCTEXT("ViewButton", "View Options")) + SNew(STextBlock) + .Text(LOCTEXT("ViewButton", "View Options")) ] ] ] @@ -223,6 +227,8 @@ void SLintReport::Construct(const FArguments& Args) { ] ] ]; + // clang-format on + // @formatter:on } void SLintReport::Rebuild(const ULintRuleSet* SelectedLintRuleSet) { @@ -303,16 +309,20 @@ void SLintReport::Rebuild(const ULintRuleSet* SelectedLintRuleSet) { ViolatorJsonObjects.Add(MakeShareable(new FJsonValueObject(AssetJsonObject))); + // clang-format off + // @formatter:off AssetDetailsScrollBoxPtr.Get()->AddSlot() - .HAlign(HAlign_Fill) - .VAlign(VAlign_Fill) - .Padding(PaddingAmount) - [ - SNew(SLintReportAssetDetails) - .AssetData(AssetData) - .RuleViolations(UniqueViolatorViolations) - .ThumbnailPool(ThumbnailPool) - ]; + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) + .Padding(PaddingAmount) + [ + SNew(SLintReportAssetDetails) + .AssetData(AssetData) + .RuleViolations(UniqueViolatorViolations) + .ThumbnailPool(ThumbnailPool) + ]; + // clang-format on + // @formatter:on } TMultiMap> ViolationsMappedByRule = FLintRuleViolation::AllRuleViolationsMappedByViolatedLintRuleShared(RuleViolations); @@ -326,15 +336,19 @@ void SLintReport::Rebuild(const ULintRuleSet* SelectedLintRuleSet) { ViolationsMappedByRule.MultiFind(BrokenRule, ViolatorsOfBrokenRule); if (ViolatorsOfBrokenRule.Num() > 0) { + // clang-format off + // @formatter:off RuleDetailsScrollBoxPtr.Get()->AddSlot() - .HAlign(HAlign_Fill) - .VAlign(VAlign_Fill) - .Padding(PaddingAmount) - [ - SNew(SLintReportRuleDetails) - .RuleViolations(ViolatorsOfBrokenRule) - .ThumbnailPool(RuleThumbnailPool) - ]; + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) + .Padding(PaddingAmount) + [ + SNew(SLintReportRuleDetails) + .RuleViolations(ViolatorsOfBrokenRule) + .ThumbnailPool(RuleThumbnailPool) + ]; + // clang-format on + // @formatter:on } } diff --git a/Source/Linter/Private/UI/LintReportAssetDetails.cpp b/Source/Linter/Private/UI/LintReportAssetDetails.cpp index 1b5ebc4..8a24cfc 100644 --- a/Source/Linter/Private/UI/LintReportAssetDetails.cpp +++ b/Source/Linter/Private/UI/LintReportAssetDetails.cpp @@ -50,45 +50,47 @@ void SLintReportAssetDetails::Construct(const FArguments& Args) { } } + // clang-format off + // @formatter:off ChildSlot [ SNew(SBorder) - .BorderImage(FAppStyle::GetBrush("NoBorder")) - .Padding(PaddingAmount) + .BorderImage(FAppStyle::GetBrush("NoBorder")) + .Padding(PaddingAmount) [ SNew(SBorder) - .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) - .Padding(PaddingAmount) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) + .Padding(PaddingAmount) [ SNew(SVerticalBox) + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) + .AutoHeight() + .Padding(PaddingAmount) [ SNew(SExpandableArea) - .InitiallyCollapsed(false) - .HeaderContent() + .InitiallyCollapsed(false) + .HeaderContent() [ SNew(SHorizontalBox) + SHorizontalBox::Slot() .AutoWidth() [ SNew(STextBlock) - .Text(AssetName) - .TextStyle(FLinterStyle::Get(), "Linter.Report.AssetName") + .Text(AssetName) + .TextStyle(FLinterStyle::Get(), "Linter.Report.AssetName") ] ] .BodyContent() [ SNew(SHorizontalBox) + SHorizontalBox::Slot() - .AutoWidth() - .VAlign(VAlign_Top) - .Padding(PaddingAmount) + .AutoWidth() + .VAlign(VAlign_Top) + .Padding(PaddingAmount) [ SNew(SBox) - .WidthOverride(96.0f) - .HeightOverride(96.0f) + .WidthOverride(96.0f) + .HeightOverride(96.0f) [ AssetThumbnail->MakeThumbnailWidget() ] @@ -98,31 +100,35 @@ void SLintReportAssetDetails::Construct(const FArguments& Args) { [ SNew(SVerticalBox) + SVerticalBox::Slot() - .AutoHeight() - .HAlign(HAlign_Left) - .Padding(PaddingAmount) + .AutoHeight() + .HAlign(HAlign_Left) + .Padding(PaddingAmount) [ SNew(SHyperlink) - .Text(AssetPath) - .OnNavigate_Lambda([&]() { - const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); - FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); - TArray AssetDatas; - AssetDatas.Push(AssetData.Get()); - ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); - }) + .Text(AssetPath) + .OnNavigate_Lambda([&]() { + const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); + TArray AssetDatas; + AssetDatas.Push(AssetData.Get()); + ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); + }) ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) + .AutoHeight() + .Padding(PaddingAmount) [ SNew(STextBlock) - .Visibility((RuleViolations.Get().Num() > 0) ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed) - .Text(FText::FormatNamed(LOCTEXT("ErrorWarningDisplay", "{NumErrors} {NumErrors}|plural(one=Error,other=Errors), {NumWarnings} {NumWarnings}|plural(one=Warning,other=Warnings)"), TEXT("NumErrors"), NumErrors, TEXT("NumWarnings"), NumWarnings)) + .Visibility((RuleViolations.Get().Num() > 0) ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed) + .Text(FText::FormatNamed( + LOCTEXT("ErrorWarningDisplay", "{NumErrors} {NumErrors}|plural(one=Error,other=Errors), {NumWarnings} {NumWarnings}|plural(one=Warning,other=Warnings)"), + TEXT("NumErrors"), NumErrors, + TEXT("NumWarnings"), NumWarnings + )) ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) + .AutoHeight() + .Padding(PaddingAmount) [ SNew(SLintReportAssetErrorList) .RuleViolations(RuleViolations) @@ -133,6 +139,8 @@ void SLintReportAssetDetails::Construct(const FArguments& Args) { ] ] ]; + // clang-format on + // @formatter:on } #undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintReportAssetError.cpp b/Source/Linter/Private/UI/LintReportAssetError.cpp index ea35e0c..a1436f5 100644 --- a/Source/Linter/Private/UI/LintReportAssetError.cpp +++ b/Source/Linter/Private/UI/LintReportAssetError.cpp @@ -30,79 +30,83 @@ void SLintReportAssetError::Construct(const FArguments& Args) { //case ELintRuleSeverity::Ignore: default: break; } - + + // clang-format off + // @formatter:off ChildSlot [ SNew(SVerticalBox) + SVerticalBox::Slot() - .AutoHeight() - .VAlign(VAlign_Center) - .Padding(PaddingAmount) + .AutoHeight() + .VAlign(VAlign_Center) + .Padding(PaddingAmount) [ SNew(SHorizontalBox) + SHorizontalBox::Slot() - .Padding(PaddingAmount) - .AutoWidth() - .VAlign(VAlign_Center) - .HAlign(HAlign_Left) + .Padding(PaddingAmount) + .AutoWidth() + .VAlign(VAlign_Center) + .HAlign(HAlign_Left) [ SNew(SBox) - .WidthOverride(14.0f) - .HeightOverride(14.0f) + .WidthOverride(14.0f) + .HeightOverride(14.0f) [ SNew(SImage) .Image(RuleIcon) ] ] + SHorizontalBox::Slot() - .Padding(PaddingAmount) - .AutoWidth() - .HAlign(HAlign_Left) - .VAlign(VAlign_Center) + .Padding(PaddingAmount) + .AutoWidth() + .HAlign(HAlign_Left) + .VAlign(VAlign_Center) [ SNew(STextBlock) - .Text(LintRule->RuleTitle) - .TextStyle(FLinterStyle::Get(), "Linter.Report.RuleTitle") + .Text(LintRule->RuleTitle) + .TextStyle(FLinterStyle::Get(), "Linter.Report.RuleTitle") ] + SHorizontalBox::Slot() - .AutoWidth() - .HAlign(HAlign_Left) - .VAlign(VAlign_Center) + .AutoWidth() + .HAlign(HAlign_Left) + .VAlign(VAlign_Center) [ SNew(SBox) - .WidthOverride(16.0f) - .HeightOverride(16.0f) + .WidthOverride(16.0f) + .HeightOverride(16.0f) [ SNew(SImage) - .Cursor(EMouseCursor::Hand) - .Visibility(bHasURL ? EVisibility::Visible : EVisibility::Collapsed) - .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { - FPlatformProcess::LaunchURL(*RuleViolation.Get()->ViolatedRule.Get()->GetDefaultObject()->RuleURL, nullptr, nullptr); - return FReply::Handled(); - }) - .Image(FLinterStyle::Get()->GetBrush("Linter.Report.Link")) + .Cursor(EMouseCursor::Hand) + .Visibility(bHasURL ? EVisibility::Visible : EVisibility::Collapsed) + .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { + FPlatformProcess::LaunchURL(*RuleViolation.Get()->ViolatedRule.Get()->GetDefaultObject()->RuleURL, nullptr, nullptr); + return FReply::Handled(); + }) + .Image(FLinterStyle::Get()->GetBrush("Linter.Report.Link")) ] ] ] + SVerticalBox::Slot() - .AutoHeight() - .VAlign(VAlign_Top) - .Padding(20.0f, PaddingAmount, PaddingAmount, PaddingAmount) + .AutoHeight() + .VAlign(VAlign_Top) + .Padding(20.0f, PaddingAmount, PaddingAmount, PaddingAmount) [ SNew(STextBlock) - .AutoWrapText(true) - .Text(LintRule->RuleDescription) + .AutoWrapText(true) + .Text(LintRule->RuleDescription) ] + SVerticalBox::Slot() - .AutoHeight() - .VAlign(VAlign_Top) - .Padding(20.0f, PaddingAmount, PaddingAmount, PaddingAmount) + .AutoHeight() + .VAlign(VAlign_Top) + .Padding(20.0f, PaddingAmount, PaddingAmount, PaddingAmount) [ SNew(STextBlock) - .AutoWrapText(true) - .Text(RuleViolation.Get()->RecommendedAction) + .AutoWrapText(true) + .Text(RuleViolation.Get()->RecommendedAction) ] ]; + // clang-format on + // @formatter:on } #undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintReportRuleDetails.cpp b/Source/Linter/Private/UI/LintReportRuleDetails.cpp index 6dc0607..041122a 100644 --- a/Source/Linter/Private/UI/LintReportRuleDetails.cpp +++ b/Source/Linter/Private/UI/LintReportRuleDetails.cpp @@ -62,50 +62,50 @@ void SLintReportRuleDetails::Construct(const FArguments& Args) { if (RuleAssetData.IsValid()) { RuleAssetPath = FText::FromName(RuleAssetData.PackagePath); } - - - + + // clang-format off + // @formatter:off ChildSlot [ SNew(SBorder) - .BorderImage(FAppStyle::GetBrush("NoBorder")) - .Padding(PaddingAmount) + .BorderImage(FAppStyle::GetBrush("NoBorder")) + .Padding(PaddingAmount) [ SNew(SBorder) - .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) - .Padding(PaddingAmount) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) + .Padding(PaddingAmount) [ SNew(SVerticalBox) + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) + .AutoHeight() + .Padding(PaddingAmount) [ SNew(SExpandableArea) - .InitiallyCollapsed(false) - .HeaderContent() + .InitiallyCollapsed(false) + .HeaderContent() [ SNew(SHorizontalBox) // Rule Thumbnail + SHorizontalBox::Slot() - .AutoWidth() - .VAlign(VAlign_Top) - .Padding(PaddingAmount) + .AutoWidth() + .VAlign(VAlign_Top) + .Padding(PaddingAmount) [ SAssignNew(ThumbnailBox, SBox) - .WidthOverride(96.0f) - .HeightOverride(96.0f) - .Visibility(RuleAssetData.IsValid() ? EVisibility::HitTestInvisible : EVisibility::Collapsed) + .WidthOverride(96.0f) + .HeightOverride(96.0f) + .Visibility(RuleAssetData.IsValid() ? EVisibility::HitTestInvisible : EVisibility::Collapsed) ] // Rule Icon + SHorizontalBox::Slot() - .Padding(PaddingAmount) - .AutoWidth() - .VAlign(VAlign_Center) - .HAlign(HAlign_Left) + .Padding(PaddingAmount) + .AutoWidth() + .VAlign(VAlign_Center) + .HAlign(HAlign_Left) [ SNew(SBox) - .WidthOverride(14.0f) - .HeightOverride(14.0f) + .WidthOverride(14.0f) + .HeightOverride(14.0f) [ SNew(SImage) .Image(RuleIcon) @@ -116,75 +116,75 @@ void SLintReportRuleDetails::Construct(const FArguments& Args) { .AutoWidth() [ SNew(STextBlock) - .Text(RuleName) - .TextStyle(FLinterStyle::Get(), "Linter.Report.AssetName") + .Text(RuleName) + .TextStyle(FLinterStyle::Get(), "Linter.Report.AssetName") ] // Link to Rule URL + SHorizontalBox::Slot() - .AutoWidth() - .Padding(8.0f, 0.0) + .AutoWidth() + .Padding(8.0f, 0.0) [ SNew(SImage) - .Image(FLinterStyle::Get()->GetBrush("Linter.Report.Link")) - .Cursor(EMouseCursor::Hand) - .Visibility(RuleURL.IsEmpty() ? EVisibility::Collapsed : EVisibility::Visible) - .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { - FPlatformProcess::LaunchURL(*RuleURL, nullptr, nullptr); - return FReply::Handled(); - }) + .Image(FLinterStyle::Get()->GetBrush("Linter.Report.Link")) + .Cursor(EMouseCursor::Hand) + .Visibility(RuleURL.IsEmpty() ? EVisibility::Collapsed : EVisibility::Visible) + .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { + FPlatformProcess::LaunchURL(*RuleURL, nullptr, nullptr); + return FReply::Handled(); + }) ] // Link to Rule Definition Asset + SHorizontalBox::Slot() - .AutoWidth() - .Padding(8.0f, 0.0) + .AutoWidth() + .Padding(8.0f, 0.0) [ SNew(SImage) - .Image(FLinterStyle::Get()->GetBrush("Linter.Report.Link")) - .Cursor(EMouseCursor::Hand) - .Visibility(EVisibility::Collapsed) - .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { - const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); - ContentBrowserModule.Get().SyncBrowserToAssets(TArray({RuleAssetData})); - return FReply::Handled(); - }) + .Image(FLinterStyle::Get()->GetBrush("Linter.Report.Link")) + .Cursor(EMouseCursor::Hand) + .Visibility(EVisibility::Collapsed) + .OnMouseButtonDown_Lambda([&](const FGeometry& Geo, const FPointerEvent& Event) { + const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + ContentBrowserModule.Get().SyncBrowserToAssets(TArray({RuleAssetData})); + return FReply::Handled(); + }) ] // Asset Count + SHorizontalBox::Slot() - .VAlign(VAlign_Center) - .AutoWidth() - .Padding(8.0f, 0.0) + .VAlign(VAlign_Center) + .AutoWidth() + .Padding(8.0f, 0.0) [ SNew(SHyperlink) - .Text(FText::FormatNamed(LOCTEXT("AssetCountDisplay", "{NumAssets} {NumAssets}|plural(one=Asset,other=Assets)"), TEXT("NumAssets"), RuleViolations.Get().Num())) - .OnNavigate_Lambda([&]() { - const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); - TArray AssetDatas; + .Text(FText::FormatNamed(LOCTEXT("AssetCountDisplay", "{NumAssets} {NumAssets}|plural(one=Asset,other=Assets)"), TEXT("NumAssets"), RuleViolations.Get().Num())) + .OnNavigate_Lambda([&]() { + const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + TArray AssetDatas; - for (const TSharedPtr& RuleViolation : RuleViolations.Get()) { - AssetDatas.Push(RuleViolation->ViolatorAssetData); - } + for (const TSharedPtr& RuleViolation : RuleViolations.Get()) { + AssetDatas.Push(RuleViolation->ViolatorAssetData); + } - ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); - }) + ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); + }) ] ] .BodyContent() [ SNew(SVerticalBox) + SVerticalBox::Slot() - .Padding(PaddingAmount) - .HAlign(HAlign_Left) - .AutoHeight() + .Padding(PaddingAmount) + .HAlign(HAlign_Left) + .AutoHeight() [ SNew(STextBlock) - .Text(RuleDesc) - .AutoWrapText(true) - .TextStyle(FLinterStyle::Get(), "Linter.Report.AssetName") + .Text(RuleDesc) + .AutoWrapText(true) + .TextStyle(FLinterStyle::Get(), "Linter.Report.AssetName") ] + SVerticalBox::Slot() - .Padding(PaddingAmount) - .HAlign(HAlign_Left) - .AutoHeight() + .Padding(PaddingAmount) + .HAlign(HAlign_Left) + .AutoHeight() [ SNew(SLintReportRuleErrorList) .RuleViolations(RuleViolations) @@ -194,6 +194,8 @@ void SLintReportRuleDetails::Construct(const FArguments& Args) { ] ] ]; + // clang-format on + // @formatter:on if (RuleAssetData.IsValid()) { const TSharedPtr RuleThumbnail = MakeShareable(new FAssetThumbnail(RuleAssetData, 96, 96, ThumbnailPool.Get())); diff --git a/Source/Linter/Private/UI/LintReportRuleError.cpp b/Source/Linter/Private/UI/LintReportRuleError.cpp index af985af..89cd9a1 100644 --- a/Source/Linter/Private/UI/LintReportRuleError.cpp +++ b/Source/Linter/Private/UI/LintReportRuleError.cpp @@ -17,48 +17,52 @@ void SLintReportRuleError::Construct(const FArguments& Args) { RuleViolation = Args._RuleViolation; const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - + + // clang-format off + // @formatter:off ChildSlot [ SNew(SVerticalBox) + SVerticalBox::Slot() - .AutoHeight() - .VAlign(VAlign_Center) - .Padding(PaddingAmount) + .AutoHeight() + .VAlign(VAlign_Center) + .Padding(PaddingAmount) [ SNew(SHorizontalBox) + SHorizontalBox::Slot() - .Padding(PaddingAmount) - .AutoWidth() - .HAlign(HAlign_Left) - .VAlign(VAlign_Center) + .Padding(PaddingAmount) + .AutoWidth() + .HAlign(HAlign_Left) + .VAlign(VAlign_Center) [ SNew(SHyperlink) - .Text(FText::FromName(RuleViolation.Get()->ViolatorAssetData.PackageName)) - .OnNavigate_Lambda([&]() { - const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); - const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); - TArray AssetDatas; -#if UE_VERSION_NEWER_THAN(5, 1, 0) - AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(RuleViolation.Get()->ViolatorAssetData.GetSoftObjectPath())); -#else - AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(RuleViolation.Get()->ViolatorAssetData.ObjectPath)); -#endif - ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); - }) + .Text(FText::FromName(RuleViolation.Get()->ViolatorAssetData.PackageName)) + .OnNavigate_Lambda([&]() { + const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); + TArray AssetDatas; + #if UE_VERSION_NEWER_THAN(5, 1, 0) + AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(RuleViolation.Get()->ViolatorAssetData.GetSoftObjectPath())); + #else + AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(RuleViolation.Get()->ViolatorAssetData.ObjectPath)); + #endif + ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); + }) ] ] + SVerticalBox::Slot() - .AutoHeight() - .VAlign(VAlign_Top) - .Padding(20.0f, PaddingAmount, PaddingAmount, PaddingAmount) + .AutoHeight() + .VAlign(VAlign_Top) + .Padding(20.0f, PaddingAmount, PaddingAmount, PaddingAmount) [ SNew(STextBlock) - .AutoWrapText(true) - .Text(RuleViolation.Get()->RecommendedAction) - .Visibility(RuleViolation.Get()->RecommendedAction.IsEmpty() ? EVisibility::Collapsed : EVisibility::SelfHitTestInvisible) + .AutoWrapText(true) + .Text(RuleViolation.Get()->RecommendedAction) + .Visibility(RuleViolation.Get()->RecommendedAction.IsEmpty() ? EVisibility::Collapsed : EVisibility::SelfHitTestInvisible) ] ]; + // clang-format on + // @formatter:on } #undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintReportRuleErrorList.cpp b/Source/Linter/Private/UI/LintReportRuleErrorList.cpp index 0e075a6..8f62866 100644 --- a/Source/Linter/Private/UI/LintReportRuleErrorList.cpp +++ b/Source/Linter/Private/UI/LintReportRuleErrorList.cpp @@ -11,19 +11,25 @@ void SLintReportRuleErrorList::Construct(const FArguments& Args) { RuleViolations = Args._RuleViolations; const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); + + // clang-format off + // @formatter:off ChildSlot [ SNew(SListView>) - .SelectionMode(ESelectionMode::None) - .ListItemsSource(&RuleViolations.Get()) - .OnGenerateRow_Lambda([&](const TSharedPtr InItem, const TSharedRef& OwnerTable) { - return SNew(STableRow>, OwnerTable) - [ - SNew(SLintReportRuleError) - .RuleViolation(InItem) - ]; - }) + .SelectionMode(ESelectionMode::None) + .ListItemsSource(&RuleViolations.Get()) + .OnGenerateRow_Lambda([&](const TSharedPtr InItem, const TSharedRef& OwnerTable) { + return + SNew(STableRow>, OwnerTable) + [ + SNew(SLintReportRuleError) + .RuleViolation(InItem) + ]; + }) ]; + // clang-format on + // @formatter:on } #undef LOCTEXT_NAMESPACE diff --git a/Source/Linter/Private/UI/LintWizard.cpp b/Source/Linter/Private/UI/LintWizard.cpp index df6be3b..1eb9e6c 100644 --- a/Source/Linter/Private/UI/LintWizard.cpp +++ b/Source/Linter/Private/UI/LintWizard.cpp @@ -30,12 +30,14 @@ #include "LinterSettings.h" #include "UI/SAssetLinkWidget.h" + #define LOCTEXT_NAMESPACE "LintWizard" #if UE_VERSION_OLDER_THAN(5, 1, 0) using FAppStyle = FEditorStyle; #endif + BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION void SLintWizard::Construct(const FArguments& InArgs) { @@ -77,22 +79,24 @@ void SLintWizard::Construct(const FArguments& InArgs) { SelectedRuleSet = RuleSets[0]; } + // clang-format off + // @formatter:off ChildSlot [ SNew(SBorder) - .Padding(18) - .BorderImage(FAppStyle::GetBrush("Docking.Tab.ContentAreaBrush")) + .Padding(18) + .BorderImage(FAppStyle::GetBrush("Docking.Tab.ContentAreaBrush")) [ SNew(SVerticalBox) + SVerticalBox::Slot() [ SAssignNew(MainWizard, SWizard) - .ShowPageList(false) - .ShowCancelButton(false) - .ButtonStyle(FAppStyle::Get(), "FlatButton.Default") - .CancelButtonStyle(FAppStyle::Get(), "FlatButton.Default") - .FinishButtonStyle(FAppStyle::Get(), "FlatButton.Success") - .ButtonTextStyle(FAppStyle::Get(), "LargeText") + .ShowPageList(false) + .ShowCancelButton(false) + .ButtonStyle(FAppStyle::Get(), "FlatButton.Default") + .CancelButtonStyle(FAppStyle::Get(), "FlatButton.Default") + .FinishButtonStyle(FAppStyle::Get(), "FlatButton.Success") + .ButtonTextStyle(FAppStyle::Get(), "LargeText") #if UE_VERSION_OLDER_THAN(5, 0, 0) .ForegroundColor(FEditorStyle::Get().GetSlateColor("WhiteBrush")) #endif @@ -102,7 +106,7 @@ void SLintWizard::Construct(const FArguments& InArgs) { #if UE_VERSION_NEWER_THAN(4, 26, 0) FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab"))->RequestCloseTab(); #else - FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab"))->RequestCloseTab(); + FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab"))->RequestCloseTab(); #endif }) + SWizard::Page() @@ -113,40 +117,45 @@ void SLintWizard::Construct(const FArguments& InArgs) { SNew(SVerticalBox) // Title + SVerticalBox::Slot() - .AutoHeight() - .Padding(0) + .AutoHeight() + .Padding(0) [ SNew(STextBlock) - .Font(FAppStyle::Get().GetFontStyle("HeadingSmall")) - .Text(LOCTEXT("LinterSelectionTitle", "Linter Rule Set Selection")) + .Font(FAppStyle::Get().GetFontStyle("HeadingSmall")) + .Text(LOCTEXT("LinterSelectionTitle", "Linter Rule Set Selection")) ] // Title spacer + SVerticalBox::Slot() - .AutoHeight() - .Padding(0, 2, 0, 8) + .AutoHeight() + .Padding(0, 2, 0, 8) [ SNew(SSeparator) ] // Linter Selection + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) + .AutoHeight() + .Padding(PaddingAmount) [ SAssignNew(RuleSetSelectionComboBox, SComboBox>) - .OptionsSource(&RuleSets) - .InitiallySelectedItem(SelectedRuleSet) - .OnGenerateWidget_Lambda([&](TSharedPtr LintRuleSet) { - ULintRuleSet* RuleSet = Cast(LintRuleSet->GetAsset()); - if (RuleSet != nullptr) { - return SNew(STextBlock).Text(RuleSet->RuleSetDescription.IsEmpty() ? FText::FromString(RuleSet->GetPathName()) : RuleSet->RuleSetDescription); - } - return SNew(STextBlock).Text(FText::FromString(TEXT("This Lint Rule Set Failed To Load? Uhhhh...."))); - }) - .OnSelectionChanged_Lambda([&](TSharedPtr Item, ESelectInfo::Type SelectInfo) { - SelectedRuleSet = Item; - RuleSetSelectionComboBox->RefreshOptions(); - }) - .ContentPadding(4.0f) + .OptionsSource(&RuleSets) + .InitiallySelectedItem(SelectedRuleSet) + .OnGenerateWidget_Lambda([&](TSharedPtr LintRuleSet) { + ULintRuleSet* RuleSet = Cast(LintRuleSet->GetAsset()); + if (RuleSet != nullptr) { + return + SNew(STextBlock) + .Text(RuleSet->RuleSetDescription.IsEmpty() ? FText::FromString(RuleSet->GetPathName()) : RuleSet->RuleSetDescription); + } + + return + SNew(STextBlock) + .Text(FText::FromString(TEXT("This Lint Rule Set Failed To Load? Uhhhh...."))); + }) + .OnSelectionChanged_Lambda([&](TSharedPtr Item, ESelectInfo::Type SelectInfo) { + SelectedRuleSet = Item; + RuleSetSelectionComboBox->RefreshOptions(); + }) + .ContentPadding(4.0f) [ SNew(STextBlock) .Text_Lambda([&]() { @@ -157,70 +166,70 @@ void SLintWizard::Construct(const FArguments& InArgs) { ] // Lint Report + SWizard::Page() - .OnEnter(this, &SLintWizard::OnLintReportEntered) - .CanShow_Lambda([&]() { - return RuleSets.Num() >= 1 && SelectedRuleSet.IsValid(); - }) + .OnEnter(this, &SLintWizard::OnLintReportEntered) + .CanShow_Lambda([&]() { + return RuleSets.Num() >= 1 && SelectedRuleSet.IsValid(); + }) [ SNew(SVerticalBox) // Title + SVerticalBox::Slot() - .AutoHeight() - .Padding(0) + .AutoHeight() + .Padding(0) [ SNew(STextBlock) - .Font(FAppStyle::Get().GetFontStyle("HeadingSmall")) - .Text(LOCTEXT("LinterReportTitle", "Lint Report")) + .Font(FAppStyle::Get().GetFontStyle("HeadingSmall")) + .Text(LOCTEXT("LinterReportTitle", "Lint Report")) ] // Marketplace No Errors Required Text + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) + .AutoHeight() + .Padding(PaddingAmount) [ SNew(STextBlock) - .Text(LOCTEXT("MarketplaceNoErrorsRequired", "The Epic Marketplace requires you to have zero linting errors before submission and approval.")) - .Visibility_Lambda([&]() { - return (LintReport.IsValid() && LintReport->bHasRanReport && LintReport->NumErrors > 0 && LintReport->LastUsedRuleSet != nullptr && LintReport->LastUsedRuleSet->bShowMarketplacePublishingInfoInLintWizard) ? EVisibility::HitTestInvisible : EVisibility::Collapsed; - }) + .Text(LOCTEXT("MarketplaceNoErrorsRequired", "The Epic Marketplace requires you to have zero linting errors before submission and approval.")) + .Visibility_Lambda([&]() { + return (LintReport.IsValid() && LintReport->bHasRanReport && LintReport->NumErrors > 0 && LintReport->LastUsedRuleSet != nullptr && LintReport->LastUsedRuleSet->bShowMarketplacePublishingInfoInLintWizard) ? EVisibility::HitTestInvisible : EVisibility::Collapsed; + }) ] // Title spacer + SVerticalBox::Slot() - .AutoHeight() - .Padding(0, 2, 0, 8) + .AutoHeight() + .Padding(0, 2, 0, 8) [ SNew(SSeparator) ] // Linter Report + SVerticalBox::Slot() - .FillHeight(1.0f) - .VAlign(VAlign_Fill) - .HAlign(HAlign_Fill) - .Padding(PaddingAmount) + .FillHeight(1.0f) + .VAlign(VAlign_Fill) + .HAlign(HAlign_Fill) + .Padding(PaddingAmount) [ SAssignNew(LintReport, SLintReport) ] ] // Marketplace Info Page + SWizard::Page() - .OnEnter(this, &SLintWizard::OnMarketplaceRecommendationsEntered) - .CanShow_Lambda([&]() { - return LintReport.IsValid() && LintReport->bHasRanReport && LintReport->NumErrors <= 0 && LintReport->LastUsedRuleSet != nullptr && LintReport->LastUsedRuleSet->bShowMarketplacePublishingInfoInLintWizard; - }) + .OnEnter(this, &SLintWizard::OnMarketplaceRecommendationsEntered) + .CanShow_Lambda([&]() { + return LintReport.IsValid() && LintReport->bHasRanReport && LintReport->NumErrors <= 0 && LintReport->LastUsedRuleSet != nullptr && LintReport->LastUsedRuleSet->bShowMarketplacePublishingInfoInLintWizard; + }) [ SNew(SVerticalBox) // Title + SVerticalBox::Slot() - .AutoHeight() - .Padding(0) + .AutoHeight() + .Padding(0) [ SNew(STextBlock) - .Font(FAppStyle::Get().GetFontStyle("HeadingSmall")) - .Text(LOCTEXT("MarketplaceInfoTitle", "Marketplace Recommendations")) + .Font(FAppStyle::Get().GetFontStyle("HeadingSmall")) + .Text(LOCTEXT("MarketplaceInfoTitle", "Marketplace Recommendations")) ] // Title spacer + SVerticalBox::Slot() - .AutoHeight() - .Padding(0, 2, 0, 8) + .AutoHeight() + .Padding(0, 2, 0, 8) [ SNew(SSeparator) ] @@ -233,131 +242,132 @@ void SLintWizard::Construct(const FArguments& InArgs) { SNew(SVerticalBox) // Disclaimer + SVerticalBox::Slot() - .VAlign(VAlign_Top) - .AutoHeight() + .VAlign(VAlign_Top) + .AutoHeight() [ SNew(SBorder) - .BorderImage(FAppStyle::GetBrush("NoBorder")) - .Padding(PaddingAmount) + .BorderImage(FAppStyle::GetBrush("NoBorder")) + .Padding(PaddingAmount) [ SNew(SBorder) - .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) - .Padding(PaddingAmount) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) + .Padding(PaddingAmount) [ SNew(SHorizontalBox) // Info image + SHorizontalBox::Slot() - .AutoWidth() - .VAlign(VAlign_Center) - .Padding(28.0f, 8.0f) + .AutoWidth() + .VAlign(VAlign_Center) + .Padding(28.0f, 8.0f) [ - SNew(SImage).Image(FLinterStyle::Get()->GetBrush("Linter.Report.Info")) + SNew(SImage) + .Image(FLinterStyle::Get()->GetBrush("Linter.Report.Info")) ] // Disclaimer text + SHorizontalBox::Slot() - .VAlign(VAlign_Center) - .FillWidth(1.0f) + .VAlign(VAlign_Center) + .FillWidth(1.0f) [ SNew(SRichTextBlock) - .Text(LOCTEXT("SuccessDisclaimer", "This product has successfully passed the Marketplace Guidlines Linter scan. Please note, however, that this does not guarantee this product's acceptance onto the Marketplace. We also recommend that you take the following actions listed below.")) - .AutoWrapText(true) - .TextStyle(FLinterStyle::Get(), "Linter.Report.DescriptionText") + .Text(LOCTEXT("SuccessDisclaimer", "This product has successfully passed the Marketplace Guidlines Linter scan. Please note, however, that this does not guarantee this product's acceptance onto the Marketplace. We also recommend that you take the following actions listed below.")) + .AutoWrapText(true) + .TextStyle(FLinterStyle::Get(), "Linter.Report.DescriptionText") ] ] ] ] // Fix Up Redirectors step widget + SVerticalBox::Slot() - .AutoHeight() - .VAlign(VAlign_Fill) - .HAlign(HAlign_Fill) - .Padding(PaddingAmount) + .AutoHeight() + .VAlign(VAlign_Fill) + .HAlign(HAlign_Fill) + .Padding(PaddingAmount) [ SNew(SStepWidget) - .StepName(LOCTEXT("FixUpRedirectsStepName", "Fix Up Redirectors")) - .StepDesc(LOCTEXT("FixUpRedirectsStepDesc", "Resave all packages that point to redirectors in your project, and delete those redirectors if able to resave all the things referencing them.")) - .Icon(FLinterStyle::Get()->GetBrush("Linter.Step.FixUpRedirects.Thumbnail")) - .ShowStepStatusIcon(false) - .StepStatus_Lambda([this]() { - return FixUpRedirectorStatus; - }) - .StepActionText(LOCTEXT("FixUpRedirectsStepAction", "Fix Up Redirectors")) - .OnPerformAction_Lambda([this](FScopedSlowTask& ScopedSlowTask) { - FixUpRedirectorStatus = InProgress; - bool bSuccess = true; - - const FAssetRegistryModule& AssetRegistryModule = FModuleManager::Get().LoadModuleChecked(TEXT("AssetRegistry")); - ScopedSlowTask.EnterProgressFrame(0, LOCTEXT("Linter.FixUpRedirects.FindingRedirectors", "Looking For redirectors...")); - - // Form a filter from the paths - FARFilter Filter; - Filter.bRecursivePaths = true; - Filter.PackagePaths.Add("/Game"); -#if UE_VERSION_NEWER_THAN(5, 1, 0) - Filter.ClassPaths.Add(FTopLevelAssetPath{"ObjectRedirector"}); -#else - Filter.ClassNames.Add("ObjectRedirector"); -#endif - - // Query for a list of assets in the selected paths - TArray AssetList; - AssetRegistryModule.Get().GetAssets(Filter, AssetList); - - if (AssetList.Num() > 0) { - TArray ObjectPaths; - for (const auto& Asset : AssetList) { -#if UE_VERSION_NEWER_THAN(5, 1, 0) - ObjectPaths.Add(Asset.GetObjectPathString()); -#else - ObjectPaths.Add(Asset.ObjectPath.ToString()); -#endif - } - - ScopedSlowTask.EnterProgressFrame(0.25f, LOCTEXT("Linter.FixUpRedirects.LoadingRedirectors", "Loading redirectors...")); - - TArray Objects; - if (LoadAssetsIfNeeded(ObjectPaths, Objects)) { - // Transform Objects array to ObjectRedirectors array - TArray Redirectors; - for (auto&& Object : Objects) { - auto Redirector = CastChecked(Object); - Redirectors.Add(Redirector); - } - - ScopedSlowTask.EnterProgressFrame(0.25f, LOCTEXT("Linter.FixUpRedirects.FixingRedirectors", "Fixing up redirectors...")); - - // Load the asset tools module - FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked(TEXT("AssetTools")); - AssetToolsModule.Get().FixupReferencers(Redirectors); - } else { - FNotificationInfo NotificationInfo(LOCTEXT("FixUpRedirectorsFailed", "Linter failed to load an object redirector when trying to fix up all redirectors.")); - NotificationInfo.ExpireDuration = 6.0f; - NotificationInfo.Hyperlink = FSimpleDelegate::CreateStatic([]() { - FMessageLog("LoadErrors").Open(EMessageSeverity::Info, true); - }); - NotificationInfo.HyperlinkText = LOCTEXT("LoadObjectHyperlink", "Show Message Log"); - FSlateNotificationManager::Get().AddNotification(NotificationInfo); - bSuccess = false; - } - } - - FixUpRedirectorStatus = bSuccess ? Success : Error; - }) + .StepName(LOCTEXT("FixUpRedirectsStepName", "Fix Up Redirectors")) + .StepDesc(LOCTEXT("FixUpRedirectsStepDesc", "Resave all packages that point to redirectors in your project, and delete those redirectors if able to resave all the things referencing them.")) + .Icon(FLinterStyle::Get()->GetBrush("Linter.Step.FixUpRedirects.Thumbnail")) + .ShowStepStatusIcon(false) + .StepStatus_Lambda([this]() { + return FixUpRedirectorStatus; + }) + .StepActionText(LOCTEXT("FixUpRedirectsStepAction", "Fix Up Redirectors")) + .OnPerformAction_Lambda([this](FScopedSlowTask& ScopedSlowTask) { + FixUpRedirectorStatus = InProgress; + bool bSuccess = true; + + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::Get().LoadModuleChecked(TEXT("AssetRegistry")); + ScopedSlowTask.EnterProgressFrame(0, LOCTEXT("Linter.FixUpRedirects.FindingRedirectors", "Looking For redirectors...")); + + // Form a filter from the paths + FARFilter Filter; + Filter.bRecursivePaths = true; + Filter.PackagePaths.Add("/Game"); + #if UE_VERSION_NEWER_THAN(5, 1, 0) + Filter.ClassPaths.Add(FTopLevelAssetPath{"ObjectRedirector"}); + #else + Filter.ClassNames.Add("ObjectRedirector"); + #endif + + // Query for a list of assets in the selected paths + TArray AssetList; + AssetRegistryModule.Get().GetAssets(Filter, AssetList); + + if (AssetList.Num() > 0) { + TArray ObjectPaths; + for (const auto& Asset : AssetList) { + #if UE_VERSION_NEWER_THAN(5, 1, 0) + ObjectPaths.Add(Asset.GetObjectPathString()); + #else + ObjectPaths.Add(Asset.ObjectPath.ToString()); + #endif + } + + ScopedSlowTask.EnterProgressFrame(0.25f, LOCTEXT("Linter.FixUpRedirects.LoadingRedirectors", "Loading redirectors...")); + + TArray Objects; + if (LoadAssetsIfNeeded(ObjectPaths, Objects)) { + // Transform Objects array to ObjectRedirectors array + TArray Redirectors; + for (auto&& Object : Objects) { + auto Redirector = CastChecked(Object); + Redirectors.Add(Redirector); + } + + ScopedSlowTask.EnterProgressFrame(0.25f, LOCTEXT("Linter.FixUpRedirects.FixingRedirectors", "Fixing up redirectors...")); + + // Load the asset tools module + FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked(TEXT("AssetTools")); + AssetToolsModule.Get().FixupReferencers(Redirectors); + } else { + FNotificationInfo NotificationInfo(LOCTEXT("FixUpRedirectorsFailed", "Linter failed to load an object redirector when trying to fix up all redirectors.")); + NotificationInfo.ExpireDuration = 6.0f; + NotificationInfo.Hyperlink = FSimpleDelegate::CreateStatic([]() { + FMessageLog("LoadErrors").Open(EMessageSeverity::Info, true); + }); + NotificationInfo.HyperlinkText = LOCTEXT("LoadObjectHyperlink", "Show Message Log"); + FSlateNotificationManager::Get().AddNotification(NotificationInfo); + bSuccess = false; + } + } + + FixUpRedirectorStatus = bSuccess ? Success : Error; + }) ] // Build Lighting Widget + SVerticalBox::Slot() .Padding(PaddingAmount) [ SNew(SBorder) - .BorderImage(FAppStyle::GetBrush("NoBorder")) - .Padding(PaddingAmount) - .Visibility_Lambda([&]() { - return (MapAssetDataList.Num() > 0) ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed; - }) + .BorderImage(FAppStyle::GetBrush("NoBorder")) + .Padding(PaddingAmount) + .Visibility_Lambda([&]() { + return (MapAssetDataList.Num() > 0) ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed; + }) [ SNew(SBorder) - .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) - .Padding(PaddingAmount) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) + .Padding(PaddingAmount) [ SNew(SVerticalBox) + SVerticalBox::Slot() @@ -366,9 +376,9 @@ void SLintWizard::Construct(const FArguments& InArgs) { SNew(SHorizontalBox) // Template thumbnail image + SHorizontalBox::Slot() - .Padding(4.0) - .AutoWidth() - .VAlign(VAlign_Top) + .Padding(4.0) + .AutoWidth() + .VAlign(VAlign_Top) [ SNew(SImage) .Image(FLinterStyle::Get()->GetBrush("Linter.Step.BuildLighting.Thumbnail")) @@ -378,22 +388,22 @@ void SLintWizard::Construct(const FArguments& InArgs) { [ SNew(SVerticalBox) + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) + .AutoHeight() + .Padding(PaddingAmount) [ SNew(STextBlock) - .Text(LOCTEXT("BuildLightingStepName", "Build Lighting and Run Map Check")) - .TextStyle(FLinterStyle::Get(), "Linter.Report.RuleTitle") + .Text(LOCTEXT("BuildLightingStepName", "Build Lighting and Run Map Check")) + .TextStyle(FLinterStyle::Get(), "Linter.Report.RuleTitle") ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) + .AutoHeight() + .Padding(PaddingAmount) [ SNew(SRichTextBlock) - .Text(LOCTEXT("BuildLightingStepDesc", "Open each map listed below and click Map Check in the Build Options Menu of the Level Editor Toolbar. If any Map Check errors are generated, resolve them before packaging your project. If any 'LIGHTING NEEDS TO BE REBUILT' errors are present press Ctrl+Shift+Semicolon to rebuild lighting.")) - .TextStyle(FLinterStyle::Get(), "Linter.Report.DescriptionText") - .AutoWrapText(true) + .Text(LOCTEXT("BuildLightingStepDesc", "Open each map listed below and click Map Check in the Build Options Menu of the Level Editor Toolbar. If any Map Check errors are generated, resolve them before packaging your project. If any 'LIGHTING NEEDS TO BE REBUILT' errors are present press Ctrl+Shift+Semicolon to rebuild lighting.")) + .TextStyle(FLinterStyle::Get(), "Linter.Report.DescriptionText") + .AutoWrapText(true) ] ] ] @@ -403,9 +413,9 @@ void SLintWizard::Construct(const FArguments& InArgs) { SNew(SSeparator) ] + SVerticalBox::Slot() - .VAlign(VAlign_Fill) - .FillHeight(1.0f) - .Padding(PaddingAmount) + .VAlign(VAlign_Fill) + .FillHeight(1.0f) + .Padding(PaddingAmount) [ SAssignNew(MarketplaceRecommendationMapScrollBoxPtr, SScrollBox) .ScrollBarAlwaysVisible(true) @@ -415,64 +425,64 @@ void SLintWizard::Construct(const FArguments& InArgs) { ] // Save All Step + SVerticalBox::Slot() - .Padding(PaddingAmount) - .AutoHeight() + .Padding(PaddingAmount) + .AutoHeight() [ SNew(SStepWidget) - .StepName(LOCTEXT("SaveAllStepName", "Save All")) - .StepDesc(LOCTEXT("SaveAllStepDesc", "Save all unsaved levels and assets to disk.")) - .Icon(FLinterStyle::Get()->GetBrush("Linter.Step.SaveAll.Thumbnail")) - .ShowStepStatusIcon(false) - .StepStatus_Lambda([this]() { - return SaveAllStatus; - }) - .StepActionText(LOCTEXT("SaveAllStepNameAction", "Save All")) - .OnPerformAction_Lambda([this](FScopedSlowTask& ScopedSlowTask) { - SaveAllStatus = InProgress; - - // Taken from MainFrameActions.cpp SaveAll - constexpr bool bPromptUserToSave = false; - constexpr bool bSaveMapPackages = true; - constexpr bool bSaveContentPackages = true; - constexpr bool bFastSave = false; - constexpr bool bNotifyNoPackagesSaved = false; - constexpr bool bCanBeDeclined = false; - if (FEditorFileUtils::SaveDirtyPackages(bPromptUserToSave, bSaveMapPackages, bSaveContentPackages, bFastSave, bNotifyNoPackagesSaved, bCanBeDeclined)) { - SaveAllStatus = Success; - } else { - FNotificationInfo NotificationInfo(LOCTEXT("SaveAllFailed", "Linter failed to save all dirty assets!")); - NotificationInfo.ExpireDuration = 6.0f; - NotificationInfo.Hyperlink = FSimpleDelegate::CreateStatic([]() { - FMessageLog("LoadErrors").Open(EMessageSeverity::Info, true); - }); - NotificationInfo.HyperlinkText = LOCTEXT("LoadObjectHyperlink", "Show Message Log"); - FSlateNotificationManager::Get().AddNotification(NotificationInfo); - SaveAllStatus = Error; - } - }) + .StepName(LOCTEXT("SaveAllStepName", "Save All")) + .StepDesc(LOCTEXT("SaveAllStepDesc", "Save all unsaved levels and assets to disk.")) + .Icon(FLinterStyle::Get()->GetBrush("Linter.Step.SaveAll.Thumbnail")) + .ShowStepStatusIcon(false) + .StepStatus_Lambda([this]() { + return SaveAllStatus; + }) + .StepActionText(LOCTEXT("SaveAllStepNameAction", "Save All")) + .OnPerformAction_Lambda([this](FScopedSlowTask& ScopedSlowTask) { + SaveAllStatus = InProgress; + + // Taken from MainFrameActions.cpp SaveAll + constexpr bool bPromptUserToSave = false; + constexpr bool bSaveMapPackages = true; + constexpr bool bSaveContentPackages = true; + constexpr bool bFastSave = false; + constexpr bool bNotifyNoPackagesSaved = false; + constexpr bool bCanBeDeclined = false; + if (FEditorFileUtils::SaveDirtyPackages(bPromptUserToSave, bSaveMapPackages, bSaveContentPackages, bFastSave, bNotifyNoPackagesSaved, bCanBeDeclined)) { + SaveAllStatus = Success; + } else { + FNotificationInfo NotificationInfo(LOCTEXT("SaveAllFailed", "Linter failed to save all dirty assets!")); + NotificationInfo.ExpireDuration = 6.0f; + NotificationInfo.Hyperlink = FSimpleDelegate::CreateStatic([]() { + FMessageLog("LoadErrors").Open(EMessageSeverity::Info, true); + }); + NotificationInfo.HyperlinkText = LOCTEXT("LoadObjectHyperlink", "Show Message Log"); + FSlateNotificationManager::Get().AddNotification(NotificationInfo); + SaveAllStatus = Error; + } + }) ] // Package Project step + SVerticalBox::Slot() - .Padding(PaddingAmount) - .AutoHeight() + .Padding(PaddingAmount) + .AutoHeight() [ SNew(SBorder) - .Visibility(EVisibility::Collapsed) - .BorderImage(FAppStyle::GetBrush("NoBorder")) - .Padding(PaddingAmount) + .Visibility(EVisibility::Collapsed) + .BorderImage(FAppStyle::GetBrush("NoBorder")) + .Padding(PaddingAmount) [ SNew(SBorder) - .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) - .Padding(PaddingAmount) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) + .Padding(PaddingAmount) [ SNew(SVerticalBox) + SVerticalBox::Slot() [ SNew(SHorizontalBox) + SHorizontalBox::Slot() - .Padding(4.0) - .AutoWidth() - .VAlign(VAlign_Top) + .Padding(4.0) + .AutoWidth() + .VAlign(VAlign_Top) [ SNew(SImage) .Image(FLinterStyle::Get()->GetBrush("Linter.Step.Package.Thumbnail")) @@ -481,26 +491,26 @@ void SLintWizard::Construct(const FArguments& InArgs) { [ SNew(SVerticalBox) + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) + .AutoHeight() + .Padding(PaddingAmount) [ SNew(STextBlock) - .Text(LOCTEXT("PackageProduct", "Package Product to .Zip")) - .TextStyle(FLinterStyle::Get(), "Linter.Report.RuleTitle") + .Text(LOCTEXT("PackageProduct", "Package Product to .Zip")) + .TextStyle(FLinterStyle::Get(), "Linter.Report.RuleTitle") ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) + .AutoHeight() + .Padding(PaddingAmount) [ SNew(SRichTextBlock) - .Text(LOCTEXT("PackageProductDesc", "Upload this .zip file to a hosting site (GoogleDrive/Dropbox/etc.) and enter the download URL as the associated product's Project File Link in the Publisher Portal.")) - .TextStyle(FLinterStyle::Get(), "Linter.Report.DescriptionText") - .AutoWrapText(true) + .Text(LOCTEXT("PackageProductDesc", "Upload this .zip file to a hosting site (GoogleDrive/Dropbox/etc.) and enter the download URL as the associated product's Project File Link in the Publisher Portal.")) + .TextStyle(FLinterStyle::Get(), "Linter.Report.DescriptionText") + .AutoWrapText(true) ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) + .AutoHeight() + .Padding(PaddingAmount) [ SNew(SHorizontalBox) + SHorizontalBox::Slot() @@ -508,15 +518,15 @@ void SLintWizard::Construct(const FArguments& InArgs) { [ SNew(SButton) .OnClicked_Lambda([&]() { -#if PLATFORM_WINDOWS + #if PLATFORM_WINDOWS FText PlatformName = LOCTEXT("PlatformName_Windows", "Windows"); -#elif PLATFORM_MAC - FText PlatformName = LOCTEXT("PlatformName_Mac", "Mac"); -#elif PLATFORM_LINUX - FText PlatformName = LOCTEXT("PlatformName_Linux", "Linux"); -#else - FText PlatformName = LOCTEXT("PlatformName_Other", "Other OS"); -#endif + #elif PLATFORM_MAC + FText PlatformName = LOCTEXT("PlatformName_Mac", "Mac"); + #elif PLATFORM_LINUX + FText PlatformName = LOCTEXT("PlatformName_Linux", "Linux"); + #else + FText PlatformName = LOCTEXT("PlatformName_Other", "Other OS"); + #endif bool bOpened = false; TArray SaveFilenames; @@ -546,16 +556,22 @@ void SLintWizard::Construct(const FArguments& InArgs) { FString CommandLine = FString::Printf(TEXT("ZipProjectUp %s -project=\"%s\" -install=\"%s\""), UATFlags, *ProjectPath, *FinalFileName); - IUATHelperModule::Get().CreateUatTask(CommandLine, PlatformName, LOCTEXT("ZipTaskName", "Zipping Up Project"), - LOCTEXT("ZipTaskShortName", "Zip Project Task"), FAppStyle::GetBrush(TEXT("MainFrame.CookContent"))); + IUATHelperModule::Get().CreateUatTask( + CommandLine, + PlatformName, + LOCTEXT("ZipTaskName", "Zipping Up Project"), + LOCTEXT("ZipTaskShortName", "Zip Project Task"), + FAppStyle::GetBrush(TEXT("MainFrame.CookContent")) + ); } -#if UE_VERSION_NEWER_THAN(4, 26, 0) + #if UE_VERSION_NEWER_THAN(4, 26, 0) FGlobalTabmanager::Get()->TryInvokeTab(FName("LinterTab"))->RequestCloseTab(); -#else - FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab"))->RequestCloseTab(); -#endif + #else + FGlobalTabmanager::Get()->InvokeTab(FName("LinterTab"))->RequestCloseTab(); + #endif } + return FReply::Handled(); }) [ @@ -575,6 +591,8 @@ void SLintWizard::Construct(const FArguments& InArgs) { ] ] ]; + // clang-format on + // @formatter:on // Determine all levels in the project for wizard purposes FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); @@ -593,14 +611,18 @@ void SLintWizard::Construct(const FArguments& InArgs) { for (FAssetData Asset : AssetDatas) { MapAssetDataList.Add(MakeShareable(new FAssetData(Asset))); + // clang-format off + // @formatter:off MarketplaceRecommendationMapScrollBoxPtr.Get()->AddSlot() - .HAlign(HAlign_Fill) - .VAlign(VAlign_Fill) - .Padding(PaddingAmount) - [ - SNew(SAssetLinkWidget) - .AssetData(Asset) - ]; + .HAlign(HAlign_Fill) + .VAlign(VAlign_Fill) + .Padding(PaddingAmount) + [ + SNew(SAssetLinkWidget) + .AssetData(Asset) + ]; + // clang-format on + // @formatter:on } } diff --git a/Source/Linter/Private/UI/SAssetLinkWidget.cpp b/Source/Linter/Private/UI/SAssetLinkWidget.cpp index f700dd0..3e099a2 100644 --- a/Source/Linter/Private/UI/SAssetLinkWidget.cpp +++ b/Source/Linter/Private/UI/SAssetLinkWidget.cpp @@ -16,6 +16,8 @@ void SAssetLinkWidget::Construct(const FArguments& Args) { const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); AssetData = Args._AssetData; + // clang-format off + // @formatter:off ChildSlot [ SNew(SHorizontalBox) @@ -23,21 +25,24 @@ void SAssetLinkWidget::Construct(const FArguments& Args) { .AutoWidth() [ SNew(SHyperlink) - .Text(FText::FromName(AssetData.Get().AssetName)) - .Padding(PaddingAmount) - .OnNavigate_Lambda([&]() { - const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); - const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); - TArray AssetDatas; + .Text(FText::FromName(AssetData.Get().AssetName)) + .Padding(PaddingAmount) + .OnNavigate_Lambda([&]() { + const FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked("ContentBrowser"); + const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); + + TArray AssetDatas; #if UE_VERSION_NEWER_THAN(5, 1, 0) - AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(AssetData.Get().GetObjectPathString())); + AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(AssetData.Get().GetObjectPathString())); #else - AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(AssetData.Get().ObjectPath)); + AssetDatas.Push(AssetRegistryModule.Get().GetAssetByObjectPath(AssetData.Get().ObjectPath)); #endif - ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); - }) + ContentBrowserModule.Get().SyncBrowserToAssets(AssetDatas); + }) ] ]; + // clang-format on + // @formatter:on } END_SLATE_FUNCTION_BUILD_OPTIMIZATION diff --git a/Source/Linter/Private/UI/SStepWidget.cpp b/Source/Linter/Private/UI/SStepWidget.cpp index 8789991..fcfe505 100644 --- a/Source/Linter/Private/UI/SStepWidget.cpp +++ b/Source/Linter/Private/UI/SStepWidget.cpp @@ -51,49 +51,51 @@ void SStepWidget::Construct(const FArguments& Args) { return false; }; + // clang-format off + // @formatter:off ChildSlot [ SNew(SBorder) - .BorderImage(FAppStyle::GetBrush("NoBorder")) - .Padding(PaddingAmount) + .BorderImage(FAppStyle::GetBrush("NoBorder")) + .Padding(PaddingAmount) [ SNew(SBorder) - .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) - .Padding(PaddingAmount) + .BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder")) + .Padding(PaddingAmount) [ SNew(SHorizontalBox) // Status Image + SHorizontalBox::Slot() - .Padding(PaddingAmount) - .AutoWidth() + .Padding(PaddingAmount) + .AutoWidth() [ SNew(SImage) - .Visibility_Lambda([&]() { - return StepStatus.Get(NoStatus) == NoStatus || !ShowStepStatusIcon.Get(true) ? EVisibility::Collapsed : EVisibility::Visible; - }) - .Image_Lambda([&]() { - switch (StepStatus.Get(NoStatus)) { - case NoStatus: - case Unknown: return FLinterStyle::Get()->GetBrush("Linter.Step.Unknown"); - case InProgress: - case NeedsUpdate: return FLinterStyle::Get()->GetBrush("Linter.Step.Working"); - case Warning: return FLinterStyle::Get()->GetBrush("Linter.Step.Warning"); - case Error: return FLinterStyle::Get()->GetBrush("Linter.Step.Error"); - case Success: return FLinterStyle::Get()->GetBrush("Linter.Step.Good"); - } + .Visibility_Lambda([&]() { + return StepStatus.Get(NoStatus) == NoStatus || !ShowStepStatusIcon.Get(true) ? EVisibility::Collapsed : EVisibility::Visible; + }) + .Image_Lambda([&]() { + switch (StepStatus.Get(NoStatus)) { + case NoStatus: + case Unknown: return FLinterStyle::Get()->GetBrush("Linter.Step.Unknown"); + case InProgress: + case NeedsUpdate: return FLinterStyle::Get()->GetBrush("Linter.Step.Working"); + case Warning: return FLinterStyle::Get()->GetBrush("Linter.Step.Warning"); + case Error: return FLinterStyle::Get()->GetBrush("Linter.Step.Error"); + case Success: return FLinterStyle::Get()->GetBrush("Linter.Step.Good"); + } - return FLinterStyle::Get()->GetBrush("Linter.Step.Unknown"); - }) + return FLinterStyle::Get()->GetBrush("Linter.Step.Unknown"); + }) ] // Template thumbnail image + SHorizontalBox::Slot() - .Padding(4.0) - .AutoWidth() - .VAlign(VAlign_Top) + .Padding(4.0) + .AutoWidth() + .VAlign(VAlign_Top) [ SNew(SImage) - .Visibility(Args._Icon.IsSet() ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed) - .Image(Args._Icon) + .Visibility(Args._Icon.IsSet() ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed) + .Image(Args._Icon) ] // Template name and description + SHorizontalBox::Slot() @@ -101,43 +103,43 @@ void SStepWidget::Construct(const FArguments& Args) { SNew(SVerticalBox) + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) + .AutoHeight() + .Padding(PaddingAmount) [ SNew(STextBlock) - .Text(Args._StepName) - .TextStyle(FLinterStyle::Get(), "Linter.Report.RuleTitle") + .Text(Args._StepName) + .TextStyle(FLinterStyle::Get(), "Linter.Report.RuleTitle") ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) + .AutoHeight() + .Padding(PaddingAmount) [ SNew(SRichTextBlock) - .Text(Args._StepDesc) - .TextStyle(FLinterStyle::Get(), "Linter.Report.DescriptionText") - .AutoWrapText(true) + .Text(Args._StepDesc) + .TextStyle(FLinterStyle::Get(), "Linter.Report.DescriptionText") + .AutoWrapText(true) ] + SVerticalBox::Slot() - .AutoHeight() - .Padding(PaddingAmount) + .AutoHeight() + .Padding(PaddingAmount) [ SNew(SHorizontalBox) + SHorizontalBox::Slot() .AutoWidth() [ SNew(SButton) - .IsEnabled_Lambda(EnabledBasedOnStepStatus) - .Visibility_Lambda([&]() { - return StepStatus.Get(NoStatus) == NoStatus ? EVisibility::Collapsed : EVisibility::Visible; - }) - .OnClicked_Lambda([&]() { - FScopedSlowTask SlowTask(1.0f, StepActionText.Get(FText())); - SlowTask.MakeDialog(); + .IsEnabled_Lambda(EnabledBasedOnStepStatus) + .Visibility_Lambda([&]() { + return StepStatus.Get(NoStatus) == NoStatus ? EVisibility::Collapsed : EVisibility::Visible; + }) + .OnClicked_Lambda([&]() { + FScopedSlowTask SlowTask(1.0f, StepActionText.Get(FText())); + SlowTask.MakeDialog(); - OnPerformAction.ExecuteIfBound(SlowTask); - return FReply::Handled(); - }) + OnPerformAction.ExecuteIfBound(SlowTask); + return FReply::Handled(); + }) [ SNew(STextBlock) .Text(StepActionText) @@ -154,4 +156,6 @@ void SStepWidget::Construct(const FArguments& Args) { ] ] ]; + // clang-format off + // @formatter:off } From 49f69144536ecf1e823ea0204b15001100cd1dd5 Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Thu, 9 Nov 2023 12:00:46 +0100 Subject: [PATCH 20/28] Fix no Files being linted --- .../Linter/Private/LinterContentBrowserExtensions.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Source/Linter/Private/LinterContentBrowserExtensions.cpp b/Source/Linter/Private/LinterContentBrowserExtensions.cpp index 50ed329..340846d 100644 --- a/Source/Linter/Private/LinterContentBrowserExtensions.cpp +++ b/Source/Linter/Private/LinterContentBrowserExtensions.cpp @@ -1,6 +1,7 @@ // Copyright 1998-2018 Epic Games, Inc. All Rights Reserved. #include "LinterContentBrowserExtensions.h" +#include "ContentBrowserMenuContexts.h" #include "LinterStyle.h" #include "ContentBrowserModule.h" #include "Linter.h" @@ -111,13 +112,8 @@ void FLinterContentBrowserExtensions::InstallHooks() { LOCTEXT("ScanWithLinter_Tooltip", "Scan project content with Linter"), FSlateIcon(FLinterStyle::GetStyleSetName(), "Linter.Toolbar.Icon"), FToolMenuExecuteAction::CreateLambda([](const FToolMenuContext& InContext) { - if (const UContentBrowserDataMenuContext_FolderMenu* Context = InContext.FindContext()) { - TArray SelectedPaths; - for (const auto& Asset : Context->SelectedItems) { - SelectedPaths.Add(Asset.GetVirtualPath().ToString()); - } - - RunLinterForAssets(SelectedPaths); + if (const auto* Context = InContext.FindContext()) { + RunLinterForAssets(Context->SelectedPackagePaths); } }) ); From 36c7848d44a3871978e55b9d44b32122e1b788aa Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Wed, 8 Nov 2023 21:59:15 +0100 Subject: [PATCH 21/28] Bump Version --- LICENSE | 2 ++ Linter.uplugin | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/LICENSE b/LICENSE index 0e41278..2184c01 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,8 @@ MIT License Copyright (c) 2021 Unreal Engine Plug-ins +Copyright (c) 2023, Forschungszentrum Jülich GmbH. + Jonathan Windgassen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Linter.uplugin b/Linter.uplugin index 7fb6a19..33e7f57 100644 --- a/Linter.uplugin +++ b/Linter.uplugin @@ -1,14 +1,13 @@ { "FileVersion": 3, - "Version": 10, - "VersionName": "2.3", + "Version": 11, + "VersionName": "3.0", "FriendlyName": "Linter", "Description": "", "Category": "Other", - "CreatedBy": "Michael Allar", + "CreatedBy": "Michael Allar, Jonathan Windgassen", "CreatedByURL": "https://gamemak.in", "DocsURL": "http://discord.gamemak.in", - "MarketplaceURL": "com.epicgames.launcher://ue/marketplace/content/ca0639af6339476da86fa3bcf15de8ec", "SupportURL": "http://discord.gamemak.in", "CanContainContent": true, "Installed": false, From 3f09b1507f0d6724b5fc9edb56a18cc39dd851ed Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Mon, 19 Feb 2024 15:15:08 +0100 Subject: [PATCH 22/28] Removed unnecessary copies in for loops --- Source/Linter/Private/LintRule.cpp | 2 +- Source/Linter/Private/LintRuleSet.cpp | 2 +- Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp | 4 ++-- Source/Linter/Private/TooltipTool/TooltipTool.cpp | 2 +- Source/Linter/Private/UI/LintReportAssetDetails.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Linter/Private/LintRule.cpp b/Source/Linter/Private/LintRule.cpp index 96d3082..4670b8b 100644 --- a/Source/Linter/Private/LintRule.cpp +++ b/Source/Linter/Private/LintRule.cpp @@ -109,7 +109,7 @@ TArray> FLintRuleViolation::AllRuleViolationsWith // This should really be done when the structs are first created TArray> SharedViolations; TArray Violations = AllRuleViolationsWithViolator(RuleViolationCollection, SearchViolator); - for (const FLintRuleViolation Violation : Violations) { + for (const FLintRuleViolation& Violation : Violations) { SharedViolations.Push(MakeShared(Violation)); } diff --git a/Source/Linter/Private/LintRuleSet.cpp b/Source/Linter/Private/LintRuleSet.cpp index d69e4d4..f8b6a29 100644 --- a/Source/Linter/Private/LintRuleSet.cpp +++ b/Source/Linter/Private/LintRuleSet.cpp @@ -95,7 +95,7 @@ TArray> ULintRuleSet::LintPathShared(const TArray TArray RuleViolations = LintPath(AssetPaths, ParentScopedSlowTask); TArray> SharedRuleViolations; - for (const FLintRuleViolation Violation : RuleViolations) { + for (const FLintRuleViolation& Violation : RuleViolations) { TSharedPtr SharedViolation = MakeShared(Violation); SharedViolation->PopulateAssetData(); SharedRuleViolations.Push(SharedViolation); diff --git a/Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp b/Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp index 8e14664..507c201 100644 --- a/Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp +++ b/Source/Linter/Private/TooltipTool/TooltipStringHelper.cpp @@ -128,14 +128,14 @@ bool FTooltipStringHelper::ParseFunctionRawTooltip(FString RawTooltip, FText& Ou FString FTooltipStringHelper::ConvertTooltipDataToRawTooltip(FText FunctionDescription, TArray> Inputs, TArray> Outputs) { FString RawTooltip = FunctionDescription.ToString(); - for (const TSharedPtr Arg : Inputs) { + for (const auto& Arg : Inputs) { RawTooltip.Append(FString::Printf(TEXT("\n@param %s %s\t\t\t%s"), TEXT(" "), *Arg->ArgumentName.ToString(), *Arg->Tooltip.ToString())); } if (Outputs.Num() == 1) { RawTooltip.Append(FString::Printf(TEXT("\n@return %s"), *Outputs[0]->Tooltip.ToString())); } else { - for (const TSharedPtr Arg : Outputs) { + for (const auto& Arg : Outputs) { RawTooltip.Append(FString::Printf(TEXT("\n@param %s %s\t\t\t%s"), TEXT("[out]"), *Arg->ArgumentName.ToString(), *Arg->Tooltip.ToString())); } } diff --git a/Source/Linter/Private/TooltipTool/TooltipTool.cpp b/Source/Linter/Private/TooltipTool/TooltipTool.cpp index 902ccca..e3c2a5d 100644 --- a/Source/Linter/Private/TooltipTool/TooltipTool.cpp +++ b/Source/Linter/Private/TooltipTool/TooltipTool.cpp @@ -698,7 +698,7 @@ void STooltipTool::RebuildMemberList() { UBlueprint* Blueprint = Cast(BlueprintComboBox->GetSelectedItem().Get()->GetAsset()); // Get variables - for (const FBPVariableDescription Member : Blueprint->NewVariables) { + for (const FBPVariableDescription& Member : Blueprint->NewVariables) { if ((Member.PropertyFlags & CPF_DisableEditOnInstance) != CPF_DisableEditOnInstance) { Members.Push(MakeShared(Member)); } diff --git a/Source/Linter/Private/UI/LintReportAssetDetails.cpp b/Source/Linter/Private/UI/LintReportAssetDetails.cpp index 8a24cfc..e842e4c 100644 --- a/Source/Linter/Private/UI/LintReportAssetDetails.cpp +++ b/Source/Linter/Private/UI/LintReportAssetDetails.cpp @@ -38,7 +38,7 @@ void SLintReportAssetDetails::Construct(const FArguments& Args) { int32 NumErrors = 0; int32 NumWarnings = 0; - for (const TSharedPtr RuleViolation : RuleViolations.Get()) { + for (const auto& RuleViolation : RuleViolations.Get()) { switch (RuleViolation->ViolatedRule.Get()->GetDefaultObject()->RuleSeverity) { case ELintRuleSeverity::Error: NumErrors++; break; From 607a25560b4f4e1afecd2d52f617c2c365812491 Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Thu, 29 Feb 2024 00:50:22 +0100 Subject: [PATCH 23/28] Introduced LintResults Object Collects the information collected during a lint run in a confined Object. Centralized JSON and HTML Generation --- Source/Linter/Private/LintRule.cpp | 2 +- Source/Linter/Private/LintRuleSet.cpp | 153 ++++++++++++++++++--- Source/Linter/Private/LinterCommandlet.cpp | 110 +++------------ Source/Linter/Private/UI/LintReport.cpp | 82 ++--------- Source/Linter/Private/UI/LintWizard.cpp | 4 +- Source/Linter/Public/LintRuleSet.h | 58 +++++--- Source/Linter/Public/UI/LintReport.h | 9 +- 7 files changed, 211 insertions(+), 207 deletions(-) diff --git a/Source/Linter/Private/LintRule.cpp b/Source/Linter/Private/LintRule.cpp index 4670b8b..b8a6b54 100644 --- a/Source/Linter/Private/LintRule.cpp +++ b/Source/Linter/Private/LintRule.cpp @@ -139,7 +139,7 @@ TArray FLintRuleViolation::AllRuleViolationsOfRuleGroup(cons TArray FLintRuleViolation::AllRuleViolationViolators(const TArray& RuleViolationCollection) { TArray Violators; for (const FLintRuleViolation& RuleViolation : RuleViolationCollection) { - Violators.Add(RuleViolation.Violator.Get()); + Violators.AddUnique(RuleViolation.Violator.Get()); } return Violators; } diff --git a/Source/Linter/Private/LintRuleSet.cpp b/Source/Linter/Private/LintRuleSet.cpp index f8b6a29..f5e0ac1 100644 --- a/Source/Linter/Private/LintRuleSet.cpp +++ b/Source/Linter/Private/LintRuleSet.cpp @@ -1,28 +1,135 @@ #include "LintRuleSet.h" #include "AnyObject_LinterDummyClass.h" +#include "IPluginManager.h" +#include "JsonObjectWrapper.h" #include "LintRunner.h" #include "Linter.h" #include "AssetRegistry/AssetRegistryModule.h" #include "Modules/ModuleManager.h" #include "HAL/RunnableThread.h" -ULintRuleSet::ULintRuleSet(const FObjectInitializer& ObjectInitializer) : - Super(ObjectInitializer) {} + +TArray> ULintResults::GetSharedViolations() const { + TArray> SharedRuleViolations; + for (const FLintRuleViolation& Violation : Violations) { + TSharedPtr SharedViolation = MakeShared(Violation); + SharedViolation->PopulateAssetData(); + SharedRuleViolations.Push(SharedViolation); + } + + return SharedRuleViolations; +} + +TSharedPtr ULintResults::GenerateJsonReport() const { + auto Report = MakeShared(); + + Report->SetStringField("Project", FPaths::GetBaseFilename(FPaths::GetProjectFilePath())); + Report->SetStringField("Result", Result.ToString()); + Report->SetNumberField("Warnings", Warnings); + Report->SetNumberField("Errors", Errors); + + TArray> PathArray; + for (const auto& Path : Paths) { + PathArray.Add(MakeShared(Path)); + } + Report->SetArrayField("Paths", PathArray); + + TArray> AssetsArray; + for (const auto& Asset : CheckedAssets) { +#if UE_VERSION_NEWER_THAN(5, 1, 0) + AssetsArray.Add(MakeShared(Asset.GetObjectPathString())); +#else + AssetsArray.Add(MakeShared(Asset.ObjectPath.ToString())); +#endif + } + Report->SetArrayField("CheckedAssets", AssetsArray); + + TArray> ViolationsArray; + for (const UObject* Violator : FLintRuleViolation::AllRuleViolationViolators(Violations)) { + TSharedPtr ViolationObject = MakeShareable(new FJsonObject); + + FAssetData AssetData; + TArray ViolatorViolations = FLintRuleViolation::AllRuleViolationsWithViolator(Violations, Violator); + + if (ViolatorViolations.Num() > 0) { + ViolatorViolations[0].PopulateAssetData(); + AssetData = ViolatorViolations[0].ViolatorAssetData; + + ViolationObject->SetStringField("AssetName", AssetData.AssetName.ToString()); + ViolationObject->SetStringField("AssetFullName", AssetData.GetFullName()); +#if UE_VERSION_NEWER_THAN(5, 1, 0) + ViolationObject->SetStringField("AssetPath", AssetData.GetObjectPathString()); +#else + ViolationObject->SetStringField("ViolatorAssetPath", AssetData.ObjectPath.ToString()); +#endif + //@TODO: Thumbnail export? + + TArray> ViolationObjects; + for (const FLintRuleViolation& Violation : ViolatorViolations) { + ULintRule* LintRule = Violation.ViolatedRule->GetDefaultObject(); + check(LintRule != nullptr); + + TSharedPtr RuleJsonObject = MakeShareable(new FJsonObject); + RuleJsonObject->SetStringField("Group", LintRule->RuleGroup.ToString()); + RuleJsonObject->SetStringField("Title", LintRule->RuleTitle.ToString()); + RuleJsonObject->SetStringField("Description", LintRule->RuleDescription.ToString()); + RuleJsonObject->SetStringField("RuleURL", LintRule->RuleURL); + RuleJsonObject->SetNumberField("Severity", static_cast(LintRule->RuleSeverity)); + RuleJsonObject->SetStringField("RecommendedAction", Violation.RecommendedAction.ToString()); + + ViolationObjects.Add(MakeShared(RuleJsonObject)); + } + + ViolationObject->SetArrayField("Violations", ViolationObjects); + } + + ViolationsArray.Add(MakeShared(ViolationObject)); + } + Report->SetArrayField("Violators", ViolationsArray); + + return Report; +} + +FString ULintResults::GenerateJsonReportString() const { + const TSharedPtr Report = GenerateJsonReport(); + + FString ReportString; + const TSharedRef>> Writer = TJsonWriterFactory>::Create(&ReportString); + FJsonSerializer::Serialize(Report.ToSharedRef(), Writer); + + return ReportString; +} + +FString ULintResults::GenerateHTML() const { + const FString ReportString = GenerateJsonReportString(); + + static const FString TemplatePath = IPluginManager::Get().FindPlugin("Linter")->GetBaseDir() / "Resources" /"LintReportTemplate.html"; + UE_LOG(LogLinter, Display, TEXT("Loading HTML report template from %s"), *TemplatePath); + + FString Template; + if (!FFileHelper::LoadFileToString(Template, *TemplatePath)) { + UE_LOG(LogLinter, Error, TEXT("Could not load HTML report template.")); + } + + Template.ReplaceInline(TEXT("{% Report %}"), *ReportString); + return Template; +} ULinterNamingConvention* ULintRuleSet::GetNamingConvention() const { return NamingConvention.Get(); } -TArray ULintRuleSet::LintPath(TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask /*= nullptr*/) const { +ULintResults* ULintRuleSet::LintPath(TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask /*= nullptr*/) const { // ReSharper disable once CppExpressionWithoutSideEffects NamingConvention.LoadSynchronous(); - TArray RuleViolations; + ULintResults* Results = NewObject(); if (AssetPaths.Num() == 0) { AssetPaths.Push(TEXT("/Game")); } + Results->Paths = AssetPaths; // Begin loading assets const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked(TEXT("AssetRegistry")); @@ -31,8 +138,6 @@ TArray ULintRuleSet::LintPath(TArray AssetPaths, FS AssetRegistryModule.Get().SearchAllAssets(/*bSynchronousSearch =*/true); UE_LOG(LogLinter, Display, TEXT("Finished loading the asset registry. Loading assets...")); - TArray AssetList; - FARFilter ARFilter; ARFilter.bRecursivePaths = true; @@ -41,23 +146,23 @@ TArray ULintRuleSet::LintPath(TArray AssetPaths, FS ARFilter.PackagePaths.Push(FName(*AssetPath)); } - AssetRegistryModule.Get().GetAssets(ARFilter, AssetList); + AssetRegistryModule.Get().GetAssets(ARFilter, Results->CheckedAssets); TArray LintRunners; TArray Threads; if (ParentScopedSlowTask != nullptr) { - ParentScopedSlowTask->TotalAmountOfWork = AssetList.Num() + 2; + ParentScopedSlowTask->TotalAmountOfWork = Results->CheckedAssets.Num() + 2; ParentScopedSlowTask->CompletedWork = 0.0f; } - for (const FAssetData& Asset : AssetList) { + for (const FAssetData& Asset : Results->CheckedAssets) { check(Asset.IsValid()); UE_LOG(LogLinter, Verbose, TEXT("Creating Lint Thread for asset \"%s\"."), *Asset.AssetName.ToString()); UObject* Object = Asset.GetAsset(); check(Object != nullptr); - FLintRunner* Runner = new FLintRunner(Object, this, &RuleViolations, ParentScopedSlowTask); + FLintRunner* Runner = new FLintRunner(Object, this, &Results->Violations, ParentScopedSlowTask); check(Runner != nullptr); LintRunners.Add(Runner); @@ -88,20 +193,24 @@ TArray ULintRuleSet::LintPath(TArray AssetPaths, FS ParentScopedSlowTask->EnterProgressFrame(1.0f, NSLOCTEXT("Linter", "ScanTaskFinished", "Tabulating Data...")); } - return RuleViolations; -} - -TArray> ULintRuleSet::LintPathShared(const TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask /*= nullptr*/) const { - TArray RuleViolations = LintPath(AssetPaths, ParentScopedSlowTask); - - TArray> SharedRuleViolations; - for (const FLintRuleViolation& Violation : RuleViolations) { - TSharedPtr SharedViolation = MakeShared(Violation); - SharedViolation->PopulateAssetData(); - SharedRuleViolations.Push(SharedViolation); + // Count Errors and Warnings + for (const FLintRuleViolation& Violation : Results->Violations) { + if (Violation.ViolatedRule->GetDefaultObject()->RuleSeverity <= ELintRuleSeverity::Error) { + Results->Errors++; + } else { + Results->Warnings++; + } } - return SharedRuleViolations; + // Generate Result String + Results->Result = FText::FormatNamed( + FText::FromString("Linted {NumAssets} Assets: {NumWarnings} {NumWarnings}|plural(one=warning,other=warnings), {NumErrors} {NumErrors}|plural(one=error,other=errors)."), + TEXT("NumAssets"), FText::FromString(FString::FromInt(Results->CheckedAssets.Num())), + TEXT("NumWarnings"), FText::FromString(FString::FromInt(Results->Warnings)), + TEXT("NumErrors"), FText::FromString(FString::FromInt(Results->Errors)) + ); + + return Results; } const FLintRuleList* ULintRuleSet::GetLintRuleListForClass(const TSoftClassPtr Class) const { diff --git a/Source/Linter/Private/LinterCommandlet.cpp b/Source/Linter/Private/LinterCommandlet.cpp index 59afad6..d368a80 100644 --- a/Source/Linter/Private/LinterCommandlet.cpp +++ b/Source/Linter/Private/LinterCommandlet.cpp @@ -1,6 +1,7 @@ // Copyright 2020 Gamemakin LLC. All Rights Reserved. #include "LinterCommandlet.h" + #include "AssetRegistry/AssetRegistryModule.h" #include "Dom/JsonObject.h" #include "Dom/JsonValue.h" @@ -72,97 +73,31 @@ int32 ULinterCommandlet::Main(const FString& InParams) { UE_LOG(LinterCommandlet, Error, TEXT("Failed to load a rule set. Aborting. Returning error code 1.")); return 1; } - UE_LOG(LinterCommandlet, Display, TEXT("Using rule set: %s"), *RuleSet->GetFullName()); if (Paths.Num() == 0) { Paths.Add(TEXT("/Game")); } - UE_LOG(LinterCommandlet, Display, TEXT("Attempting to Lint paths: %s"), *FString::Join(Paths, TEXT(", "))); - const TArray RuleViolations = RuleSet->LintPath(Paths); - - int32 NumErrors = 0; - int32 NumWarnings = 0; - - for (const FLintRuleViolation& Violation : RuleViolations) { - if (Violation.ViolatedRule->GetDefaultObject()->RuleSeverity <= ELintRuleSeverity::Error) { - NumErrors++; - } else { - NumWarnings++; - } - } - - FString ResultsString = FText::FormatNamed(FText::FromString("Lint completed with {NumWarnings} {NumWarnings}|plural(one=warning,other=warnings), {NumErrors} {NumErrors}|plural(one=error,other=errors)."), TEXT("NumWarnings"), FText::FromString(FString::FromInt(NumWarnings)), TEXT("NumErrors"), FText::FromString(FString::FromInt(NumErrors))).ToString(); - UE_LOG(LinterCommandlet, Display, TEXT("Lint completed with %s."), *ResultsString); + const ULintResults* LintResults = RuleSet->LintPath(Paths); + UE_LOG(LinterCommandlet, Display, TEXT("%s"), *LintResults->Result.ToString()); - bool bWriteReport = Switches.Contains(TEXT("json")) || ParamsMap.Contains(TEXT("json")) || Switches.Contains(TEXT("html")) || ParamsMap.Contains(TEXT("html")); - if (bWriteReport) { + if (Switches.Contains("json") || ParamsMap.Contains("json") || Switches.Contains("html") || ParamsMap.Contains("html")) { UE_LOG(LinterCommandlet, Display, TEXT("Generating output report...")); - TSharedPtr RootJsonObject = MakeShareable(new FJsonObject); - TArray> ViolatorJsonObjects; - - TArray UniqueViolators = FLintRuleViolation::AllRuleViolationViolators(RuleViolations); - for (const UObject* Violator : UniqueViolators) { - TSharedPtr AssetJsonObject = MakeShareable(new FJsonObject); - TArray UniqueViolatorViolations = FLintRuleViolation::AllRuleViolationsWithViolator(RuleViolations, Violator); - - FAssetData AssetData; - if (UniqueViolatorViolations.Num() > 0) { - UniqueViolatorViolations[0].PopulateAssetData(); - AssetData = UniqueViolatorViolations[0].ViolatorAssetData; - AssetJsonObject->SetStringField(TEXT("ViolatorAssetName"), AssetData.AssetName.ToString()); -#if UE_VERSION_NEWER_THAN(5, 1, 0) - AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.GetObjectPathString()); -#else - AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.ObjectPath.ToString()); -#endif - AssetJsonObject->SetStringField(TEXT("ViolatorFullName"), AssetData.GetFullName()); - //@TODO: Thumbnail export? - - TArray> RuleViolationJsonObjects; - - for (const FLintRuleViolation& Violation : UniqueViolatorViolations) { - ULintRule* LintRule = Violation.ViolatedRule->GetDefaultObject(); - check(LintRule != nullptr); - - TSharedPtr RuleJsonObject = MakeShareable(new FJsonObject); - RuleJsonObject->SetStringField(TEXT("RuleGroup"), LintRule->RuleGroup.ToString()); - RuleJsonObject->SetStringField(TEXT("RuleTitle"), LintRule->RuleTitle.ToString()); - RuleJsonObject->SetStringField(TEXT("RuleDesc"), LintRule->RuleDescription.ToString()); - RuleJsonObject->SetStringField(TEXT("RuleURL"), LintRule->RuleURL); - RuleJsonObject->SetNumberField(TEXT("RuleSeverity"), static_cast(LintRule->RuleSeverity)); - RuleJsonObject->SetStringField(TEXT("RuleRecommendedAction"), Violation.RecommendedAction.ToString()); - RuleViolationJsonObjects.Push(MakeShareable(new FJsonValueObject(RuleJsonObject))); - } - - AssetJsonObject->SetArrayField(TEXT("Violations"), RuleViolationJsonObjects); - } - - ViolatorJsonObjects.Add(MakeShareable(new FJsonValueObject(AssetJsonObject))); - } - - // Save off our JSON to a string - RootJsonObject->SetArrayField(TEXT("Violators"), ViolatorJsonObjects); - FString JsonReport; - TSharedRef>> Writer = TJsonWriterFactory>::Create(&JsonReport); - FJsonSerializer::Serialize(RootJsonObject.ToSharedRef(), Writer); - - // write json file if requested - if (Switches.Contains(TEXT("json")) || ParamsMap.Contains(FString(TEXT("json")))) { + // Write JSON file if requested + if (Switches.Contains("json") || ParamsMap.Contains(FString("json"))) { FDateTime Now = FDateTime::Now(); - FString JsonOutputName = TEXT("lint-report-") + Now.ToString() + TEXT(".json"); + FString JsonOutputName = "lint-report-" + Now.ToString() + ".json"; - const FString LintReportPath = FPaths::ProjectSavedDir() / TEXT("LintReports"); + const FString LintReportPath = FPaths::ProjectSavedDir() / "LintReports"; FString FullOutputPath = LintReportPath / JsonOutputName; - if (ParamsMap.Contains(FString(TEXT("json")))) { - const FString JsonOutputOverride = *ParamsMap.FindChecked(FString(TEXT("json"))); + if (ParamsMap.Contains("json")) { + const FString JsonOutputOverride = *ParamsMap.FindChecked(FString("json")); if (FPaths::IsRelative(JsonOutputOverride)) { - JsonOutputName = JsonOutputOverride; - FullOutputPath = LintReportPath / JsonOutputName; + FullOutputPath = LintReportPath / JsonOutputOverride; } else { FullOutputPath = JsonOutputOverride; } @@ -170,9 +105,10 @@ int32 ULinterCommandlet::Main(const FString& InParams) { FullOutputPath = FPaths::ConvertRelativePathToFull(FullOutputPath); IFileManager::Get().MakeDirectory(*FPaths::GetPath(FullOutputPath), true); - UE_LOG(LinterCommandlet, Display, TEXT("Exporting JSON report to %s"), *FullOutputPath); - if (FFileHelper::SaveStringToFile(JsonReport, *FullOutputPath)) { + + const FString ReportString = LintResults->GenerateJsonReportString(); + if (FFileHelper::SaveStringToFile(ReportString, *FullOutputPath)) { UE_LOG(LinterCommandlet, Display, TEXT("Exported JSON report successfully.")); } else { UE_LOG(LinterCommandlet, Error, TEXT("Failed to export JSON report. Aborting. Returning error code 1.")); @@ -202,21 +138,7 @@ int32 ULinterCommandlet::Main(const FString& InParams) { IFileManager::Get().MakeDirectory(*FPaths::GetPath(FullOutputPath), true); UE_LOG(LinterCommandlet, Display, TEXT("Exporting HTML report to %s"), *FullOutputPath); - FString TemplatePath = FPaths::Combine(*IPluginManager::Get().FindPlugin(TEXT("Linter"))->GetBaseDir(), TEXT("Resources"), TEXT("LintReportTemplate.html")); - UE_LOG(LinterCommandlet, Display, TEXT("Loading HTML report template from %s"), *TemplatePath); - - FString HTMLReport; - if (FFileHelper::LoadFileToString(HTMLReport, *TemplatePath)) { - UE_LOG(LinterCommandlet, Display, TEXT("Loading HTML report template successfully.")); - - HTMLReport.ReplaceInline(TEXT("{% TITLE %}"), *FPaths::GetBaseFilename(FPaths::GetProjectFilePath())); - HTMLReport.ReplaceInline(TEXT("{% RESULTS %}"), *ResultsString); - HTMLReport.ReplaceInline(TEXT("{% LINT_REPORT %}"), *JsonReport); - } else { - UE_LOG(LinterCommandlet, Error, TEXT("Failed to load HTML report template.")); - return 1; - } - + const FString HTMLReport = LintResults->GenerateHTML(); if (FFileHelper::SaveStringToFile(HTMLReport, *FullOutputPath)) { UE_LOG(LinterCommandlet, Display, TEXT("Exported HTML report successfully.")); } else { @@ -226,7 +148,7 @@ int32 ULinterCommandlet::Main(const FString& InParams) { } } - if (NumErrors > 0 || (Switches.Contains(TEXT("TreatWarningsAsErrors")) && NumWarnings > 0)) { + if (LintResults->Errors > 0 || (Switches.Contains(TEXT("TreatWarningsAsErrors")) && LintResults->Warnings > 0)) { UE_LOG(LinterCommandlet, Display, TEXT("Lint completed with errors. Returning error code 2.")); return 2; } diff --git a/Source/Linter/Private/UI/LintReport.cpp b/Source/Linter/Private/UI/LintReport.cpp index a1ffa62..927f234 100644 --- a/Source/Linter/Private/UI/LintReport.cpp +++ b/Source/Linter/Private/UI/LintReport.cpp @@ -233,9 +233,6 @@ void SLintReport::Construct(const FArguments& Args) { void SLintReport::Rebuild(const ULintRuleSet* SelectedLintRuleSet) { const float PaddingAmount = FLinterStyle::Get()->GetFloat("Linter.Padding"); - - NumErrors = 0; - NumWarnings = 0; bHasRanReport = false; if (SelectedLintRuleSet == nullptr) { @@ -255,60 +252,20 @@ void SLintReport::Rebuild(const ULintRuleSet* SelectedLintRuleSet) { FLinterModule& LinterModule = FModuleManager::LoadModuleChecked(TEXT("Linter")); TArray LintPaths = LinterModule.GetDesiredLintPaths(); - RuleViolations = SelectedLintRuleSet->LintPathShared(LintPaths, &SlowTask); - - for (TSharedPtr Violation : RuleViolations) { - if (Violation->ViolatedRule->GetDefaultObject()->RuleSeverity <= ELintRuleSeverity::Error) { - NumErrors++; - } else { - NumWarnings++; - } - } + LintResults = SelectedLintRuleSet->LintPath(LintPaths, &SlowTask); + RuleViolations = LintResults->GetSharedViolations(); TArray UniqueViolators = FLintRuleViolation::AllRuleViolationViolators(RuleViolations); - TSharedPtr ThumbnailPool = MakeShareable(new FAssetThumbnailPool(UniqueViolators.Num())); - - TSharedPtr RootJsonObject = MakeShareable(new FJsonObject); - TArray> ViolatorJsonObjects; + TSharedPtr ThumbnailPool = MakeShared(UniqueViolators.Num()); - for (UObject* Violator : UniqueViolators) { - // We might as well build JSON data here as we're iterating through all our rule violations anyway - TSharedPtr AssetJsonObject = MakeShareable(new FJsonObject); - TArray> UniqueViolatorViolations = FLintRuleViolation::AllRuleViolationsWithViolatorShared(RuleViolations, Violator); + for (const UObject* Violator : UniqueViolators) { + TArray> Violations = FLintRuleViolation::AllRuleViolationsWithViolatorShared(RuleViolations, Violator); FAssetData AssetData; - if (UniqueViolatorViolations.Num() > 0) { - AssetData = UniqueViolatorViolations[0]->ViolatorAssetData; - AssetJsonObject->SetStringField(TEXT("ViolatorAssetName"), AssetData.AssetName.ToString()); -#if UE_VERSION_NEWER_THAN(5, 1, 0) - AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.GetObjectPathString()); -#else - AssetJsonObject->SetStringField(TEXT("ViolatorAssetPath"), AssetData.ObjectPath.ToString()); -#endif - AssetJsonObject->SetStringField(TEXT("ViolatorFullName"), AssetData.GetFullName()); - //@TODO: Thumbnail export? - - TArray> RuleViolationJsonObjects; - - for (TSharedPtr Violation : UniqueViolatorViolations) { - ULintRule* LintRule = Violation->ViolatedRule->GetDefaultObject(); - check(LintRule != nullptr); - - TSharedPtr RuleJsonObject = MakeShareable(new FJsonObject); - RuleJsonObject->SetStringField(TEXT("RuleGroup"), LintRule->RuleGroup.ToString()); - RuleJsonObject->SetStringField(TEXT("RuleTitle"), LintRule->RuleTitle.ToString()); - RuleJsonObject->SetStringField(TEXT("RuleDesc"), LintRule->RuleDescription.ToString()); - RuleJsonObject->SetStringField(TEXT("RuleURL"), LintRule->RuleURL); - RuleJsonObject->SetNumberField(TEXT("RuleSeverity"), static_cast(LintRule->RuleSeverity)); - RuleJsonObject->SetStringField(TEXT("RuleRecommendedAction"), Violation->RecommendedAction.ToString()); - RuleViolationJsonObjects.Push(MakeShareable(new FJsonValueObject(RuleJsonObject))); - } - - AssetJsonObject->SetArrayField(TEXT("Violations"), RuleViolationJsonObjects); + if (Violations.Num() > 0) { + AssetData = Violations[0]->ViolatorAssetData; } - ViolatorJsonObjects.Add(MakeShareable(new FJsonValueObject(AssetJsonObject))); - // clang-format off // @formatter:off AssetDetailsScrollBoxPtr.Get()->AddSlot() @@ -318,7 +275,7 @@ void SLintReport::Rebuild(const ULintRuleSet* SelectedLintRuleSet) { [ SNew(SLintReportAssetDetails) .AssetData(AssetData) - .RuleViolations(UniqueViolatorViolations) + .RuleViolations(Violations) .ThumbnailPool(ThumbnailPool) ]; // clang-format on @@ -326,7 +283,7 @@ void SLintReport::Rebuild(const ULintRuleSet* SelectedLintRuleSet) { } TMultiMap> ViolationsMappedByRule = FLintRuleViolation::AllRuleViolationsMappedByViolatedLintRuleShared(RuleViolations); - TSharedPtr RuleThumbnailPool = MakeShareable(new FAssetThumbnailPool(ViolationsMappedByRule.Num())); // In case we ever want to render 'rule thumbnails' in the future + TSharedPtr RuleThumbnailPool = MakeShared(ViolationsMappedByRule.Num()); // In case we ever want to render 'rule thumbnails' in the future TArray UniqueRules; ViolationsMappedByRule.GetKeys(UniqueRules); @@ -352,25 +309,12 @@ void SLintReport::Rebuild(const ULintRuleSet* SelectedLintRuleSet) { } } - // Save off our JSON to a string - RootJsonObject->SetArrayField(TEXT("Violators"), ViolatorJsonObjects); - JsonReport.Empty(); - TSharedRef>> Writer = TJsonWriterFactory>::Create(&JsonReport); - FJsonSerializer::Serialize(RootJsonObject.ToSharedRef(), Writer); - // Update Summary Text Block - int32 NumAssets = UniqueViolators.Num(); - FText ResultsSummary = FText::FormatNamed(LOCTEXT("ErrorWarningDisplay", "{NumAssets} {NumAssets}|plural(one=Asset,other=Assets), {NumErrors} {NumErrors}|plural(one=Error,other=Errors), {NumWarnings} {NumWarnings}|plural(one=Warning,other=Warnings)"), TEXT("NumAssets"), NumAssets, TEXT("NumErrors"), NumErrors, TEXT("NumWarnings"), NumWarnings); - ResultsTextBlockPtr->SetText(ResultsSummary); + ResultsTextBlockPtr->SetText(LintResults->Result); - // Prepare the HTML Export - FString TemplatePath = FPaths::Combine(*IPluginManager::Get().FindPlugin(TEXT("Linter"))->GetBaseDir(), TEXT("Resources"), TEXT("LintReportTemplate.html")); - - if (FFileHelper::LoadFileToString(HTMLReport, *TemplatePath)) { - HTMLReport.ReplaceInline(TEXT("{% TITLE %}"), *FPaths::GetBaseFilename(FPaths::GetProjectFilePath())); - HTMLReport.ReplaceInline(TEXT("{% RESULTS %}"), *ResultsSummary.ToString()); - HTMLReport.ReplaceInline(TEXT("{% LINT_REPORT %}"), *JsonReport); - } + // Genereate JSON and HTML reports + JsonReport = LintResults->GenerateJsonReportString(); + HTMLReport = LintResults->GenerateHTML(); bHasRanReport = true; } diff --git a/Source/Linter/Private/UI/LintWizard.cpp b/Source/Linter/Private/UI/LintWizard.cpp index 1eb9e6c..7a61d46 100644 --- a/Source/Linter/Private/UI/LintWizard.cpp +++ b/Source/Linter/Private/UI/LintWizard.cpp @@ -189,7 +189,7 @@ void SLintWizard::Construct(const FArguments& InArgs) { SNew(STextBlock) .Text(LOCTEXT("MarketplaceNoErrorsRequired", "The Epic Marketplace requires you to have zero linting errors before submission and approval.")) .Visibility_Lambda([&]() { - return (LintReport.IsValid() && LintReport->bHasRanReport && LintReport->NumErrors > 0 && LintReport->LastUsedRuleSet != nullptr && LintReport->LastUsedRuleSet->bShowMarketplacePublishingInfoInLintWizard) ? EVisibility::HitTestInvisible : EVisibility::Collapsed; + return (LintReport.IsValid() && LintReport->bHasRanReport && LintReport->LintResults->Errors > 0 && LintReport->LastUsedRuleSet != nullptr && LintReport->LastUsedRuleSet->bShowMarketplacePublishingInfoInLintWizard) ? EVisibility::HitTestInvisible : EVisibility::Collapsed; }) ] // Title spacer @@ -213,7 +213,7 @@ void SLintWizard::Construct(const FArguments& InArgs) { + SWizard::Page() .OnEnter(this, &SLintWizard::OnMarketplaceRecommendationsEntered) .CanShow_Lambda([&]() { - return LintReport.IsValid() && LintReport->bHasRanReport && LintReport->NumErrors <= 0 && LintReport->LastUsedRuleSet != nullptr && LintReport->LastUsedRuleSet->bShowMarketplacePublishingInfoInLintWizard; + return LintReport.IsValid() && LintReport->bHasRanReport && LintReport->LintResults->Errors <= 0 && LintReport->LastUsedRuleSet != nullptr && LintReport->LastUsedRuleSet->bShowMarketplacePublishingInfoInLintWizard; }) [ SNew(SVerticalBox) diff --git a/Source/Linter/Public/LintRuleSet.h b/Source/Linter/Public/LintRuleSet.h index 651a3db..9ee978c 100644 --- a/Source/Linter/Public/LintRuleSet.h +++ b/Source/Linter/Public/LintRuleSet.h @@ -1,47 +1,73 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #pragma once - #include "LinterNamingConvention.h" #include "Misc/ScopedSlowTask.h" #include "LintRule.h" #include "LintRuleSet.generated.h" + USTRUCT(BlueprintType) struct LINTER_API FLintRuleList { - GENERATED_USTRUCT_BODY() - - FLintRuleList() {} + GENERATED_BODY() UPROPERTY(EditAnywhere, Category = Default) TArray> LintRules; - bool RequiresGameThread() const;; + bool RequiresGameThread() const; bool PassesRules(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const; }; -/** - *Comment - */ + UCLASS(BlueprintType, Blueprintable) -class LINTER_API ULintRuleSet : public UDataAsset { +class ULintResults : public UObject { GENERATED_BODY() public: - ULintRuleSet(const FObjectInitializer& ObjectInitializer); + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Lint") + int32 Warnings = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Lint") + int32 Errors = 0; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Lint") + FText Result; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Lint") + TArray Paths; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Lint") + TArray CheckedAssets; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Lint") + TArray Violations; + + TArray> GetSharedViolations() const; + + TSharedPtr GenerateJsonReport() const; + + UFUNCTION(BlueprintCallable, Category = "Lint") + FString GenerateJsonReportString() const; + + UFUNCTION(BlueprintCallable, Category = "Lint") + FString GenerateHTML() const; +}; - //UFUNCTION(BlueprintCallable, Category = "Conventions") + +UCLASS(BlueprintType, Blueprintable) +class LINTER_API ULintRuleSet : public UDataAsset { + GENERATED_BODY() + +public: + // UFUNCTION(BlueprintCallable, Category = "Conventions") const FLintRuleList* GetLintRuleListForClass(TSoftClassPtr Class) const; UFUNCTION(BlueprintCallable, Category = "Conventions") ULinterNamingConvention* GetNamingConvention() const; /** Invoke this with a list of asset paths to recursively lint all assets in paths. */ - //UFUNCTION(BlueprintCallable, Category = "Lint") - TArray LintPath(TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask = nullptr) const; - - /** This is a temp dumb way to do this. */ - TArray> LintPathShared(TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask = nullptr) const; + // UFUNCTION(BlueprintCallable, Category = "Lint") + ULintResults* LintPath(TArray AssetPaths, FScopedSlowTask* ParentScopedSlowTask = nullptr) const; UPROPERTY(EditDefaultsOnly, Category = "Marketplace") bool bShowMarketplacePublishingInfoInLintWizard = false; diff --git a/Source/Linter/Public/UI/LintReport.h b/Source/Linter/Public/UI/LintReport.h index 8825a40..8d1f7ed 100644 --- a/Source/Linter/Public/UI/LintReport.h +++ b/Source/Linter/Public/UI/LintReport.h @@ -7,6 +7,9 @@ #include "LintRule.h" +class ULintResults; + + class SLintReport : public SCompoundWidget { public: SLATE_BEGIN_ARGS(SLintReport) { } @@ -21,14 +24,14 @@ class SLintReport : public SCompoundWidget { const ULintRuleSet* LastUsedRuleSet = nullptr; TSharedPtr ResultsTextBlockPtr; - TArray> RuleViolations; TSharedPtr ViewOptionsComboButton; TSharedPtr AssetDetailsScrollBoxPtr; TSharedPtr RuleDetailsScrollBoxPtr; + + ULintResults* LintResults = nullptr; + TArray> RuleViolations; FString JsonReport; FString HTMLReport; bool bHasRanReport = false; - int32 NumErrors = 0; - int32 NumWarnings = 0; }; From 31b6df236d1f213a3c7a02e32b0903642958e6a6 Mon Sep 17 00:00:00 2001 From: "j.windgassen" Date: Thu, 29 Feb 2024 10:20:38 +0100 Subject: [PATCH 24/28] Add RuleSet Name to Report --- Source/Linter/Private/LintRuleSet.cpp | 5 +++-- Source/Linter/Public/LintRuleSet.h | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/Linter/Private/LintRuleSet.cpp b/Source/Linter/Private/LintRuleSet.cpp index f5e0ac1..2dcec85 100644 --- a/Source/Linter/Private/LintRuleSet.cpp +++ b/Source/Linter/Private/LintRuleSet.cpp @@ -1,8 +1,7 @@ #include "LintRuleSet.h" #include "AnyObject_LinterDummyClass.h" -#include "IPluginManager.h" -#include "JsonObjectWrapper.h" +#include "Interfaces/IPluginManager.h" #include "LintRunner.h" #include "Linter.h" #include "AssetRegistry/AssetRegistryModule.h" @@ -25,6 +24,7 @@ TSharedPtr ULintResults::GenerateJsonReport() const { auto Report = MakeShared(); Report->SetStringField("Project", FPaths::GetBaseFilename(FPaths::GetProjectFilePath())); + Report->SetStringField("LintRuleSet", LintRuleSet); Report->SetStringField("Result", Result.ToString()); Report->SetNumberField("Warnings", Warnings); Report->SetNumberField("Errors", Errors); @@ -125,6 +125,7 @@ ULintResults* ULintRuleSet::LintPath(TArray AssetPaths, FScopedSlowTask NamingConvention.LoadSynchronous(); ULintResults* Results = NewObject(); + Results->LintRuleSet = NameForCommandlet; if (AssetPaths.Num() == 0) { AssetPaths.Push(TEXT("/Game")); diff --git a/Source/Linter/Public/LintRuleSet.h b/Source/Linter/Public/LintRuleSet.h index 9ee978c..0541a47 100644 --- a/Source/Linter/Public/LintRuleSet.h +++ b/Source/Linter/Public/LintRuleSet.h @@ -23,7 +23,10 @@ UCLASS(BlueprintType, Blueprintable) class ULintResults : public UObject { GENERATED_BODY() -public: +public: + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Lint") + FString LintRuleSet; + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Lint") int32 Warnings = 0; From 553cdbeba2efe9c5a8a150fdce2bdfefce66efe5 Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Thu, 29 Feb 2024 23:20:47 +0100 Subject: [PATCH 25/28] New HTML Report Template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🌟Fancy & Interactive 🌟 --- Resources/LintReportTemplate.html | 458 +++++++++++++++++++++++------- 1 file changed, 360 insertions(+), 98 deletions(-) diff --git a/Resources/LintReportTemplate.html b/Resources/LintReportTemplate.html index e7a51f8..8c991b1 100644 --- a/Resources/LintReportTemplate.html +++ b/Resources/LintReportTemplate.html @@ -1,101 +1,363 @@ - - - - - - {% TITLE %} Lint Report - - - - - - - - - - - - - - - - -
-
-
-

Results - {% RESULTS %}

-
-
-
-
-
- - - + + + + + Lint Report + + + + + + + + + + +
+

Lint Results for 

+

+
+ +
+
+ + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + + + + + + \ No newline at end of file From 4987cbb6588a2762495386c0eb1e9e8c9a605875 Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Fri, 1 Mar 2024 00:24:23 +0100 Subject: [PATCH 26/28] Added Usage and Install Instructions to Readme --- README.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ebee8d3..cad1989 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,59 @@ # Linter Linter for Unreal Blueprints. Based of the [Linter v2](https://ue5.style), made compatible with Unreal Engine 5. -The original version can still be found on the [Marketplace](https://www.unrealengine.com/marketplace/product/linter-v2). +The original version can still be found on the [Marketplace](https://www.unrealengine.com/marketplace/product/linter-v2) or the original [GitHub Repository](https://github.com/ue4plugins/Linter). + +## Usage +The Linter can be used in two ways: + +### Usage in Editor +The Linter can be used to lint Assets in the Editor. +To do so, select the Assets you want to lint. These can be single Assets or multiple Assets/Folders. +When right-clicking on a selected Asset, you can find the **Linter** option at the bottom the context menu: + +### Usage as Commandlet +The Linter can also be used as a Commandlet and executed from the command line: +`UnrealEditor-Cmd.exe -run=Linter ` +If no Path is provided, the Linter will default to `/Game` and lint the whole Content Directory. + +Advanced Options: +- `-RuleSet=` Specify a custom LintRuleSet to use (see below). Default: **Marketplace** +- `-json and -json=` Write the Linter output to a JSON file. Default: **\/Saved/LintReports/** +- `-html and -html=` Write the Linter output to a interactive HTML file. Default: **\/Saved/LintReports/** +- Both `-json` and `-html` can be absolute or relative paths and can contain a filename for the file. Both Options can be used at the same time. + +### Understanding RuleSets +The Linter works with a Collection of LintRules, which are grouped into RuleSets. +Each LintRule can check for a specific quality or style issue in a Blueprint. +The Linter provides 2 RuleSets by default: +- `Marketplace` checks against the [Epic Games Marketplace Guidelines](https://www.unrealengine.com/marketplace-guidelines) +- `ue4.style` checks against the [ue4.style](http://ue4.style/) guidelines. + +You can define your own RuleSets by creating a new DataAsset of type `LintRuleSet` and adding LintRules to it. +To create new LintRules, subclass `ULintRule` and override the `PassesRule` function. +When using the Linter as a Commandlet, you can specify a RuleSet, predefined or your own, with the `-RuleSet` option. + +## Installation + +### Into a Project +To install the Linter into a Project, simply clone the `Linter` folder into the `Plugins` folder of your Project. + +### Into the Engine +To install the Linter into the Engine, clone the `Linter` into some Place on your Computer. +You then need to Build the Plugin using the UAT and copy the built Plugin into the `Engine/Plugins/Marketplace/` folder. + +```bash +# Clone Repository +git clone https://github.com/jwindgassen/Linter.git Linter + +# Build Plugin. Both Paths must be absolute, otherwise UAT will complain. +# You cannot Build the Plugin directly into the Engine folder! +/Engine/Build/BatchFiles/RunUAT.bat BuildPlugin -Plugin=`pwd`/Linter/Linter.uplugin -Package=`pwd`/Linter_ + +# Copy Plugin into Engine and Clean up +cp -r Linter_ /Engine/Plugins/Marketplace/Linter +rm -r Linter Linter_ +``` + +If you have [ue4cli](https://github.com/adamrehn/ue4cli) installed (which I highly recommend), you can simply use `ue4 uat` +instead of `/Engine/Build/BatchFiles/RunUAT.bat` From 5cd22168a23a872b2d1e178d5675ca1e9f71f6fc Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Tue, 26 Mar 2024 23:44:47 +0100 Subject: [PATCH 27/28] Fix TextureSize Getters Errors were causing non-zero return values when executing the Commandlet. There might be a Bug in 5.3, but this will work for now. --- .../LintRules/LintRule_Texture_Size_NotTooBig.cpp | 13 +++++++++++-- .../LintRules/LintRule_Texture_Size_PowerOfTwo.cpp | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp b/Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp index 2dbeda7..4e4db94 100644 --- a/Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Texture_Size_NotTooBig.cpp @@ -1,5 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #include "LintRules/LintRule_Texture_Size_NotTooBig.h" + +#include "Linter.h" #include "LintRuleSet.h" ULintRule_Texture_Size_NotTooBig::ULintRule_Texture_Size_NotTooBig(const FObjectInitializer& ObjectInitializer) : @@ -18,8 +20,15 @@ bool ULintRule_Texture_Size_NotTooBig::PassesRule(UObject* ObjectToLint, const U bool ULintRule_Texture_Size_NotTooBig::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { const UTexture2D* Texture = CastChecked(ObjectToLint); - const int32 TexSizeX = Texture->GetSizeX(); - const int32 TexSizeY = Texture->GetSizeY(); + // ToDo: Make Texture->GetSizeX() work again (possibly Bug in 5.3?) + const FTexturePlatformData* PlatformData = Texture->GetPlatformData(); + if (!PlatformData) { + UE_LOG(LogLinter, Warning, TEXT("Could not get Platform Data for Texture!")) + return true; + } + + int32 TexSizeX = PlatformData->SizeX; + int32 TexSizeY = PlatformData->SizeY; // Check to see if textures are too big if (TexSizeX > MaxTextureSizeX || TexSizeY > MaxTextureSizeY) { diff --git a/Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp b/Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp index 031f3e6..50259a1 100644 --- a/Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp +++ b/Source/Linter/Private/LintRules/LintRule_Texture_Size_PowerOfTwo.cpp @@ -1,5 +1,7 @@ // Copyright 2019-2020 Gamemakin LLC. All Rights Reserved. #include "LintRules/LintRule_Texture_Size_PowerOfTwo.h" + +#include "Linter.h" #include "LintRuleSet.h" ULintRule_Texture_Size_PowerOfTwo::ULintRule_Texture_Size_PowerOfTwo(const FObjectInitializer& ObjectInitializer) : @@ -25,8 +27,15 @@ bool ULintRule_Texture_Size_PowerOfTwo::PassesRule(UObject* ObjectToLint, const bool ULintRule_Texture_Size_PowerOfTwo::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { const UTexture2D* Texture = CastChecked(ObjectToLint); - int32 TexSizeX = Texture->GetSizeX(); - int32 TexSizeY = Texture->GetSizeY(); + // ToDo: Make Texture->GetSizeX() work again (possibly Bug in 5.3?) + const FTexturePlatformData* PlatformData = Texture->GetPlatformData(); + if (!PlatformData) { + UE_LOG(LogLinter, Warning, TEXT("Could not get Platform Data for Texture!")) + return true; + } + + int32 TexSizeX = PlatformData->SizeX; + int32 TexSizeY = PlatformData->SizeY; const bool bXFail = ((TexSizeX & (TexSizeX - 1)) != 0); const bool bYFail = ((TexSizeY & (TexSizeY - 1)) != 0); From 22fbb7db60a084fd6e29ed94495eae12649d143a Mon Sep 17 00:00:00 2001 From: Jonathan Windgassen Date: Thu, 31 Jul 2025 00:38:10 +0200 Subject: [PATCH 28/28] Added LintRule for LightingNeedsToBeRebuilt --- .../GamemakinLinterRuleSet.uasset | Bin 5939 -> 6543 bytes ...GMLR_Level_LightingNeedsToBeRebuilt.uasset | Bin 0 -> 7252 bytes .../LintRule_Level_LightingNeedsToRebuilt.cpp | 32 ++++++++++++++++++ .../LintRule_Level_LightingNeedsToRebuilt.h | 21 ++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 Content/GamemakinLinter/LintRules/GMLR_Level_LightingNeedsToBeRebuilt.uasset create mode 100644 Source/Linter/Private/LintRules/LintRule_Level_LightingNeedsToRebuilt.cpp create mode 100644 Source/Linter/Public/LintRules/LintRule_Level_LightingNeedsToRebuilt.h diff --git a/Content/GamemakinLinter/GamemakinLinterRuleSet.uasset b/Content/GamemakinLinter/GamemakinLinterRuleSet.uasset index 55509cf334f4895c37c4c16888543a0efb9ab311..83fa00242aafefd9424ac8b1e207cc5a7c8219b1 100644 GIT binary patch literal 6543 zcmbW6e{fV+700h6_yd|&DYUkwG@*qULIO#4lWb!lyPIstxJkB2Xa^&#FS|F%Yj*c- z-+P;|{9_qv2O0m67F(sYe?&XX*xKp%i%~}_GgT{&I-p`Hv{j*0sx9)Pkzyd8?|bhq zFPr4OO-|$9)VBe+1 zuh)$Ee-^6#4Bfl$7RJ`maa~wW>0DjcCM9`N8kSQtUw3B`yoc*lp_ql}S0}qLeReTp zWpu3d`D<$Gd^H|lV}q}uaeYIruO(FDZ)^#MJhg#fodI7Zn7YPpS!%ZZiyIglr*jwz zEn}>c$~G$L@m)VXzVPO*15FoC?%coW*oi+bZ{2!iV$*@ki}$ZN|9Cxk*g;1Y(qA$A z+KS-?OX#Yya&xP)X{B#KsqFPwibT)QM+Plbh zQ)3(Z<*PIijEv@*_3qob6U~xM9#Yhxl1xgec!Cx{Mez9QPnnvjkM*TzvPBD_P*R*- zD*9Ckp0TU{As*9nX8k9A@a~;-J0it~r9mE6Vp2lhAz@h1l9rZYoGsC_yKg4QT5>I1 zGsX!+w{pv(O;GhH1A3n6zR$gQ1y9kVtGVWy4ypH`7j!RU>&1HZ%ml`zmv6t`wO8)d z56;6M^rEki)sd~)mVp?1ZCzVOxH}q%L}@J3GR+}-@fvIL&8ccAlZt844rzO*5+?({ zKlin3Jhag}h=w9tf zJ^ziHPR(s*jb|ax@#{)bjl0Zv^!5!05TpzAjxZnLiD+0J9MUPabaEcodX)h0=KUEt zp|h>S7go+;R3eh9%Q5n_Xlqi|X^%5P3_H1JTcW1$K1C#bh+K|V#GdDRFE~Z~JXc4> z;1G`uYb^FcTjaBaH;K5EQF(1kG@^`hwQHbvRAJv=>la3HXUJ+J)Zd0l64R$jDg5^1G)Y(_UR|~zf4-?(q zd#*LttC@Y2sK;NpyA5fE(PqvENpb4{FGpsQQe!E;~X7V9on!3L2EuGFx z^%3IYXO4aW*@WZSA8p z)RbazLPsRT%otRPzeW~c8V(0bH@A99d-QCAm$qf(I5#Q)Eu+%ts|$I8o;puMZHuqb zOMjkPe@md=2i=#Tk>L-H>&781fVgqkN+E6>_I8LH zhs_(}#vuuUxN+D+A#NOA#LeD4Cg#cs zpLVk+_B=OE?5TF{4Edqe9phkp;-WL;9VhV#jRaq|W)s*HcFEKfTlPAyS+?HGWBe8b zb-+5mO)PA>w%fPVxr0-C$ipDW1TPWzA1ddmTtp?3YgDdMnV|ANDp#m{NCjU=|4U_@ z$_G@=QF))r1uBNYS$@#Z{Cv>ieWjaX%PMPFQPly3S5EyBSZz-_MZ=wxBaU$MWeFRx zsA7A4t2VUdLSw!`*^QMOAAG5@A+Veid=7&ki(mhK>N)18E zECe4$4Ts8bPql`WmWd@`s4Om*6Bk)GK4u-U{;=kSAWes05EdF|)7RpU#Rwt)euowa zju30D8 Z9Kqa+4H5<*BX2g|UwruG3h_b!{{IH-;YR=f literal 5939 zcmbVQeQ;b=6+e6#5-4JE#AZjwiL_l5V~ zHr@V%or2bmGmcOhEyy2Lrj8)P_%R*FakLH~)^U{bp->QQ3)m`!mRd_q8_(~(cV9M} z-M5>Z%-x%J?(dv??#KCf@8Hgrk9{~fIr-%>qIs8*MIYhccSoN-exiNP+4-;4?+g7h zQui6=buA+LDEGZuN^n?dfA%qPMm0}F|2xxah?QO&2w8XM>SK5pOS_P%e;$pwG@+UFlW{7CB$qf5^n`O}il zO)pH`y8rzAy(>>Y*aThB0|UzGI{y9QZAXa(six-k&Ol9{NC?FcwSl^Zrs4n=vuO9y zmKyx?TUO+|#^%Xi-l9pY-^UDJkD4-t?(0&LBB^XqQ~96!(g_h0CYfd5-q%oySg(>) zQzKz5wN<1{RZG$0iaVe0nTuqdYuXH*k6-)FQNM>ytOb@EzOMB>eS_`M!LXJbQ<*_e zU82_DtVAQ}RNNR`uWakphFHNL-}~{_*10H18)ly{(|U@YQzj;G>V?i=runuF(e&no z8t)KBTvx}ixdt^IFtp}bsp{4EaE8^9NJ1GQaqu^L+GZtwhoT$2o6rzeOfjPADsKwC zdG630^mGoXrm{I9`ZX`vBN3kQObsU_7o{qCVB ze!X@slSdP2T}gy=UC9^}IJEbMHM7?eRgAcj2(!b}j&&Dywv?`++hG3?Lt#zVMchne zX!NZG`)9F^sG^%{oPA@kGpU*!6QItZ*LUBYs4v}$sA7(?lkgete!TyTSE$Ij-4G0q ziue|T;!k!(KU?~g{bC!tlW6D|jB4XT-!R-iuF+3c1&7<_q9dkm7lXZ;$#=0`9idmM zc72^gCHZ2Ov-x;?#qAq5-@{u>=eujyUX?Z0nHo_!n|!tHf$nU!9Z~7-?f&ZP868Sx zZ23WZpd+13X2J=@Fer5WclTWh2(D06*T#fyW~lq=W9mHSwkOhJOy`hBi-P`&YqL3B zA|-To!y#MGibuw3KgQ$slR3WaTb!fpCwJHRjA&6+`6=WEH^SN$$zb2J>asMa56TUm zgJJs7_}Igr&KjB?92xKnZF~b(D`g#k8~hlub>E65H_w2~3~mhF{aEs}WvCOzvx658 zN0!~Qt1?Sd-r&Tz`uXLRGjO@VhjCvzQ(J>Wm&Q8*qMIWgP2T_EmDwww9y}Ou;NBAz zOJ@pa2M0#IvHT17BG*rwV#@g$amV3r#Bj(KBGB1iH$7h_sCe7~`BCT6>U z4);{)(#5tH5GwA}^u!QVZ5p^5^(a{vi#OUT2`hVg!j)W#R>sUsLR5C8)gjc(cBxy% zeM`_E34{awKyyP!u%(gz0u7;#_NG81SJCZF&9sq0g{qwV!Dp)Kn--Jm@@ye2$)?55 z1KbPrHkZ3t52(@ZC>QeqqDMfCiIF?e|c6|(si#?;vm7lZ5oLW%>u%or3qAgL!8^Acl_IY3?*RE;1n%;#)~ zCni(^ro9N}MYdVKJr=SDnAHXJ;GINLne$Jso@`8c2^d6lke42WG>{kOavS1_L1qAX z=|PqPd0`NAL0%ZddXN_e!5`#>LDUC%VNhj)yf8>AATJD(Ajk`Y)C}^%AhCnIFi4Xi zFO2j#FU(?Fji;Wgb1?7l9d}q(hYA6NGuw}^H%$1XQVJo#qOrxyZaop$p1`kgI=s0TDxtDLEq3#F~Xe(OPowf?J?uWt5q zby?Fo|#d7#(_!cEp^#G++U@hZ#j%)Qp>rQZ?)N?HW! z43uOPaE9^L43c5Ox;Hk92sJ&Z-tK6xv*0G@d7aZ+9Rlb-`G9>66K^6QsaXnHGsv4H zz3xOFK^ZArL8JpIh$|?C-_0Y8&mbUI7%@%?Grr`zD<}C^o=Hkt+Q~eE((hgCkj12R n(p%)r|IVYpb8p~gQdsubi|qgLjMJ3+RK@=nyQ6fFKbQX>ZGVoH diff --git a/Content/GamemakinLinter/LintRules/GMLR_Level_LightingNeedsToBeRebuilt.uasset b/Content/GamemakinLinter/LintRules/GMLR_Level_LightingNeedsToBeRebuilt.uasset new file mode 100644 index 0000000000000000000000000000000000000000..486bf3e34993675159c2dc525f37a7b6c2da0c16 GIT binary patch literal 7252 zcmd@ZZBSI#^`fW{#TaAM+F~AxB8sr=!UEbR?k9o>2#Zash>zV1`{HBY`rcb`ts1n} zN!w&v^3h}_A5Lr?TVrONYNL)OEghYH&BQjDwoYs`ol>XTWLk};Nz~GF?t6FlEh20_ z`m2ZG-Fwg1J@?#m&;8i`Z!CP_!@g*D=hH;;GOO_raXV? z&qZ_Z0^FDT*Hv6!J}~}YJIPPCZCp4%6L7m`=C0q_5IS(~&FTC9_{&Q<`vJH84_l>| zTn!iAT~)h(!7E2z>jB(={mj9fhHu?_WZUTjdunew?*QEW`i;}Q-h-a=)B2v!gxneP z0Owx!>>2;cSMz^#VCv5JjL>-p;NA-#9JuIy^6JF5O82;q`->LK3wo62oIQqCuT}ShM)PJ1sO{q*IDe zvTNBlYtV@6t6E!_`NE(?md(7`}{A?`= zCBjNEs*#%VO)*5)!}?3uzT-+(Ep}6{z>HoUdnyM9Vmg3Nsq5^aOSyn<6oVVYPFkk~ zMOoS`;=H0REh+{nnX1PhK@%HA6})PAVCLI<*GvH%u5K^YSY+X(J-YTUPvK}0U#%*! zC>c1q@D+{;NV-hP?C&4jj@b=)TAJ#}oqdm1qONAKn}$|Pw5Oq?L!&y`@~d~f3H;X- zrOVZDLroBr6ZapszXVaPUQ@c4InaA?g+hi;kQhhIGVB3j+7s|lAZ?N{>|tFFd^ zNq^hOb2rd^0lF!PJh??r)nq8Xd}2yBeUl2abyE} zH7qJcwR=g6P0q&H=8G;F`6xs#p55X_HJohZOR{dWqX2`Iqgx^>6=h$D6lFf0g-%SU zA=9cHIWw)8At74$Y;-Z^F=M*)o=trv(DKp_F(&J6ZD~Yqn}^i?DR3%9j3@NrQ#nuM z^R_u(#R>L>SkRM9<#4O923gyfx3(2_aV_(5pT1j=$E9xQ{=so-dMv|Eg>5BI<&~9@z5Uu)=doTdac0%m=q90OBH_bsv z3#suj=i>OoKw*Frj4)(`xWgbUHVX0q>;QZZgN+~oL;0=&U%5#gjnA0|-&N4JC{4bi zH2G|4@VyWHmZiaW1^B9l;VU$8TnFmIAVnC?FBJxfeQ}pX7>$qnel$KfsW2FgkJ~&N z-@;+^-GK3#XjWLmYQQuUPY@gs#qGD^unwwHba6VC@0dc@f#)L&A0GY?aOJFGHA41a z>KOre|0DH>`Vc<0^o4SEhBXerJI(t0qx5I8jX1tulZnq6mnk+YxCR%P#GWs3>d56t zr2e=+@iM{rQ4g*mEHSg;E{AZp<)mp~ zhX1D1A4=j_un)Y9AYdE+|821a@uLCCr0#R+9<#2&UO&=)nEsxU0Z!U)t|zo7T?;T| z_{MDnU+FPx}tDoi|872p^e;QrCJYLD4I%?w5Tk` z@#uy$f}2#L$K-(yNhv35b|6l7oGFs*OwKTkfd?CXZS{)UCCY5eVXtB&_mH}S*s=w5rt4v3ttcEBHg5eY$O`P z#z;MB2YfpT16BixNv6~)Xhne!u`%H7fW7@p8=# z;DZSCmI2pU!<$JA_j$6f$tF)7ct&S(F%lplB7ueoXv!eDCdYE{Upx3wB0k2u5oVyB zY$ja$dUz4&0VxH%oa9Y2el(;q0GRPE@)&P-}9BT`-qTm&bvW>vOBf1cLgjRHrg@B!4$|igIbR*_^P&Z|x zPU^PezE0*48~iUJYe*|8f?BEBLW-T$=MV>!NGmhjBkKb zKry;?P-r6SeYVM96~d@RKmn@|J`^w^ByzadtnhO;Hkktm>Aj!d+2)x{*11z(gzuo{jz3Sn5o8?t}ldq8`s?gdB7xo7hFinwh|!rHLj3>lGs zvNFj{m~u=p2v*lv<=Mal#xl&H@V;UC=hi`?hY`{q)JM-9%N}>4am9(;A0L~#_GrLr z2jMp^JV0|`^M{9V1b#)zH=69LChBO!n$dolXl1`&_?_;m@+!Nx% z$5mPCD|gu7Xhn##*e>v2Mug_D5|cxMn+k6B%g8LVTdOJg2@ih)QydPk#8KreE3NSQ zJkCmcxy@hhaJlSur_EMYT1ierPc^zAX+ngZXWVq8OZqig0}^xquQ ziCD0#g)<-4_2`n4k{B&3*7Uec=fXUsybh%_cxFM@^R& OutRuleViolations) const { + if (!Cast(ObjectToLint)) { + return true; + } + + return Super::PassesRule(ObjectToLint, ParentRuleSet, OutRuleViolations); +} + +bool ULintRule_Level_LightingNeedsToRebuilt::PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const { + UWorld* World = CastChecked(ObjectToLint); + + GetRendererModule().UpdateMapNeedsLightingFullyRebuiltState(World); + if (World->NumLightingUnbuiltObjects > 0 || World->NumUnbuiltReflectionCaptures > 0) { + const FText RecommendedAction = NSLOCTEXT("Linter", "LintRule_Level_LightingNeedsToRebuilt", "Rebuild the Lighting of {0}"); + OutRuleViolations.Push( + FLintRuleViolation(ObjectToLint, GetClass(), FText::FormatOrdered(RecommendedAction, FText::FromString(World->GetMapName()))) + ); + return false; + } + + return true; +} \ No newline at end of file diff --git a/Source/Linter/Public/LintRules/LintRule_Level_LightingNeedsToRebuilt.h b/Source/Linter/Public/LintRules/LintRule_Level_LightingNeedsToRebuilt.h new file mode 100644 index 0000000..9503d52 --- /dev/null +++ b/Source/Linter/Public/LintRules/LintRule_Level_LightingNeedsToRebuilt.h @@ -0,0 +1,21 @@ +// Copyright (c) 2021-2025, Forschungszentrum Jülich GmbH. All rights reserved. + +#pragma once + +#include "CoreMinimal.h" +#include "LintRule.h" +#include "LintRule_Level_LightingNeedsToRebuilt.generated.h" + + +UCLASS(BlueprintType, Blueprintable) +class LINTER_API ULintRule_Level_LightingNeedsToRebuilt : public ULintRule { + GENERATED_BODY() + +public: + ULintRule_Level_LightingNeedsToRebuilt(const FObjectInitializer& ObjectInitializer); + + virtual bool PassesRule(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; + +protected: + virtual bool PassesRule_Internal_Implementation(UObject* ObjectToLint, const ULintRuleSet* ParentRuleSet, TArray& OutRuleViolations) const override; +};