Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Source/BUIValidator/Private/BUIValidatorSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ bool FBUIValidatorGroup::ShouldGroupValidateAsset( UObject* InAsset ) const
bool bMatchAnyPath = MatchConditions.Paths.Num() == 0;
for ( const auto& Path : MatchConditions.Paths )
{
if ( AssetPathInUnreal.StartsWith( Path.Path ) )
if ( Path.Type == EBUIPathType::StartsWith && AssetPathInUnreal.StartsWith( Path.Path ) ||
Path.Type == EBUIPathType::EndsWith && AssetPathInUnreal.EndsWith( Path.Path ) ||
Path.Type == EBUIPathType::Contains && AssetPathInUnreal.Contains( Path.Path ) )
{
bMatchAnyPath = true;
break;
Expand Down
28 changes: 26 additions & 2 deletions Source/BUIValidator/Public/BUIValidatorSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,28 @@ enum class EBUITextureSizeRequirement
PowerOfTwo,
};

UENUM()
enum class EBUIPathType
{
Contains,
EndsWith,
StartsWith,
};

USTRUCT( meta = ( ToolTip = " Match any part of an asset directory." ) )
struct FBUIPathFilter
{
GENERATED_BODY()

// Which part of the directory path to search in. `EndsWith` and `Contains` are useful for content plugins. `StartsWith` is the default for backwards-compatibility.
UPROPERTY( EditAnywhere, meta = ( DisplayName = "Path" ) )
EBUIPathType Type = EBUIPathType::StartsWith;

// Match UTexture2D assets under any of these directories
UPROPERTY( EditAnywhere, meta = ( DisplayName = "Path segment" ) )
FString Path;
};

USTRUCT( meta = ( ToolTip = "All parts of a rule must pass in order for the rule to be applied" ) )
struct FBUIMatchConditions
{
Expand All @@ -23,8 +45,10 @@ struct FBUIMatchConditions
TArray<FString> Prefixes = { "T_UI_" };

// Match UTexture2D assets under any of these directories
UPROPERTY( EditAnywhere, meta = ( ContentDir, TitleProperty = "Path" ) )
TArray<FDirectoryPath> Paths;
UPROPERTY( EditAnywhere, meta = ( TitleProperty = "Path" ) )
TArray<FBUIPathFilter> Paths = {
{ EBUIPathType::Contains, "/UI/" }
};
};

USTRUCT()
Expand Down