diff --git a/Source/BUIValidator/Private/BUIValidatorSettings.cpp b/Source/BUIValidator/Private/BUIValidatorSettings.cpp index b2d5b3c..b4399e7 100644 --- a/Source/BUIValidator/Private/BUIValidatorSettings.cpp +++ b/Source/BUIValidator/Private/BUIValidatorSettings.cpp @@ -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; diff --git a/Source/BUIValidator/Public/BUIValidatorSettings.h b/Source/BUIValidator/Public/BUIValidatorSettings.h index fa3c94c..b37e391 100644 --- a/Source/BUIValidator/Public/BUIValidatorSettings.h +++ b/Source/BUIValidator/Public/BUIValidatorSettings.h @@ -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 { @@ -23,8 +45,10 @@ struct FBUIMatchConditions TArray Prefixes = { "T_UI_" }; // Match UTexture2D assets under any of these directories - UPROPERTY( EditAnywhere, meta = ( ContentDir, TitleProperty = "Path" ) ) - TArray Paths; + UPROPERTY( EditAnywhere, meta = ( TitleProperty = "Path" ) ) + TArray Paths = { + { EBUIPathType::Contains, "/UI/" } + }; }; USTRUCT()