Added support to scan prefabs

This commit is contained in:
Anders Ejlersen 2026-05-19 20:15:30 +02:00
parent 269789b36f
commit 591693da1d
11 changed files with 159 additions and 62 deletions

View file

@ -13,21 +13,21 @@ namespace Module.ProjectValidator.Editor
private readonly Dictionary<GUID, MappingEntry> _assetToSeverityMapping = new();
private readonly Dictionary<int, MappingEntry> _instanceToSeverityMapping = new();
public void Add(GUID assetGuid, string scenePath, string fieldPath, Attribute attribute, EValidatorSeverity severity, string message)
public void Add(GUID assetGuid, string relativePath, string fieldPath, Attribute attribute, EValidatorSeverity severity, string message)
{
var type = ProjectValidatorUtility.GetAttributeShortName(attribute);
Add(assetGuid, scenePath, fieldPath, type, severity, message);
Add(assetGuid, relativePath, fieldPath, type, severity, message);
}
public void Add(GUID assetGuid, string scenePath, string fieldPath, string type, EValidatorSeverity severity, string message)
public void Add(GUID assetGuid, string relativePath, string fieldPath, string type, EValidatorSeverity severity, string message)
{
Entries.Add(new Entry
{
AssetGuid = assetGuid,
AssetName = EditorAssetUtility.GetAssetName(assetGuid),
ScenePath = scenePath,
RelativePath = relativePath,
FieldPath = fieldPath,
ScenePathRichText = ProjectValidatorUtility.ApplyRichTextToScenePath(scenePath),
RelativePathRichText = ProjectValidatorUtility.ApplyRichTextToRelativePath(relativePath),
FieldPathRichText = ProjectValidatorUtility.ApplyRichTextToFieldPath(fieldPath),
Type = type,
Severity = severity,
@ -74,7 +74,7 @@ namespace Module.ProjectValidator.Editor
return false;
}
public bool TryGetSeverityFor(GUID assetGuid, string scenePath, out MappingEntry mapping)
public bool TryGetSeverityFor(GUID assetGuid, string relativePath, out MappingEntry mapping)
{
if (!_assetToSeverityMapping.TryGetValue(assetGuid, out mapping))
return false;
@ -83,7 +83,7 @@ namespace Module.ProjectValidator.Editor
for (var i = 0; i < Entries.Count; i++)
{
if (Entries[i].AssetGuid != assetGuid || Entries[i].ScenePath != scenePath || Entries[i].Severity <= mapping.Severity)
if (Entries[i].AssetGuid != assetGuid || Entries[i].RelativePath != relativePath || Entries[i].Severity <= mapping.Severity)
continue;
mapping = new MappingEntry(Entries[i].Severity, false);
@ -110,10 +110,10 @@ namespace Module.ProjectValidator.Editor
public GUID AssetGuid;
public string AssetName;
public string ScenePath;
public string RelativePath;
public string FieldPath;
public string ScenePathRichText;
public string RelativePathRichText;
public string FieldPathRichText;
public string Type;
@ -124,7 +124,7 @@ namespace Module.ProjectValidator.Editor
public bool Filter(string filter)
{
return AssetName.Contains(filter, StringComparison.InvariantCultureIgnoreCase) ||
ScenePath.Contains(filter, StringComparison.InvariantCultureIgnoreCase) ||
RelativePath.Contains(filter, StringComparison.InvariantCultureIgnoreCase) ||
FieldPath.Contains(filter, StringComparison.InvariantCultureIgnoreCase) ||
Type.Contains(filter, StringComparison.InvariantCultureIgnoreCase) ||
SeverityResult.Contains(filter, StringComparison.InvariantCultureIgnoreCase) ||