Validator: Skipping render pipeline check on shader, fi no RenderPipeline tag is found
Validator: Skipping textures in material, if marked as PerRendererData, HideInInspector or NonModifiableTextureData Validator: Fixed issue, where arrays weren't iterated correctly, which resulted in an exception Window: Added warning and error count
This commit is contained in:
parent
9dd45f536e
commit
eb46c22ffc
7 changed files with 93 additions and 12 deletions
|
|
@ -423,8 +423,18 @@ namespace Module.ProjectValidator.Editor
|
|||
|
||||
var fieldPath = parentFieldPath;
|
||||
ProjectValidatorUtility.AppendToFieldPath(e.FieldInfo, ref fieldPath);
|
||||
|
||||
if (value is IEnumerable<object> ie)
|
||||
|
||||
if (value is Array arr)
|
||||
{
|
||||
for (var j = 0; j < arr.Length; j++)
|
||||
{
|
||||
var eObj = arr.GetValue(j);
|
||||
var fieldPathArrElement = fieldPath;
|
||||
ProjectValidatorUtility.AppendToFieldPath(j, ref fieldPathArrElement);
|
||||
Validate(assetGuid, relativePath, fieldPathArrElement, eObj, e.Entry, report);
|
||||
}
|
||||
}
|
||||
else if (value is IEnumerable<object> ie)
|
||||
{
|
||||
var idx = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,16 +28,20 @@ namespace Module.ProjectValidator.Editor
|
|||
|
||||
var tagSearch = new ShaderTagId("RenderPipeline");
|
||||
var tagPipeline = new ShaderTagId(pipeline.renderPipelineShaderTag);
|
||||
var hasKeyword = false;
|
||||
|
||||
for (var i = 0; i < shader.passCount; i++)
|
||||
{
|
||||
var tagPass = shader.FindPassTagValue(i, tagSearch);
|
||||
|
||||
if (tagPass != ShaderTagId.none)
|
||||
hasKeyword = true;
|
||||
|
||||
if (tagPass == tagPipeline)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return !hasKeyword;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -16,10 +16,13 @@ namespace Module.ProjectValidator.Editor
|
|||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var propertyType = obj.shader.GetPropertyType(i);
|
||||
var propertyFlags = obj.shader.GetPropertyFlags(i);
|
||||
|
||||
if (propertyType != ShaderPropertyType.Texture)
|
||||
continue;
|
||||
|
||||
if ((propertyFlags & (ShaderPropertyFlags.PerRendererData | ShaderPropertyFlags.HideInInspector | ShaderPropertyFlags.NonModifiableTextureData)) != 0)
|
||||
continue;
|
||||
|
||||
var propertyName = obj.shader.GetPropertyName(i);
|
||||
var propertyValue = obj.GetTexture(propertyName);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,12 +8,18 @@ namespace Module.ProjectValidator.Editor
|
|||
{
|
||||
internal sealed class EditorProjectValidatorWindow : EditorWindow
|
||||
{
|
||||
private VisualElement _groupWarnings;
|
||||
private Label _labelWarnings;
|
||||
|
||||
private VisualElement _groupErrors;
|
||||
private Label _labelErrors;
|
||||
|
||||
private MultiColumnTreeView _treeView;
|
||||
private string _searchFilter;
|
||||
|
||||
|
||||
private readonly List<TreeViewItemData<Report.Entry>> _list = new();
|
||||
private readonly List<TreeViewItemData<Report.Entry>> _filteredList = new();
|
||||
|
||||
|
||||
public void CreateGUI()
|
||||
{
|
||||
var root = rootVisualElement;
|
||||
|
|
@ -21,6 +27,15 @@ namespace Module.ProjectValidator.Editor
|
|||
root.styleSheets.Add(EditorAssetUtility.LoadFirstAsset<StyleSheet>("StyleSheetEditorProjectValidatorWindow"));
|
||||
root.Add(asset.Instantiate());
|
||||
|
||||
_groupWarnings = root.Q<VisualElement>("status-warnings");
|
||||
_labelWarnings = _groupWarnings.Q<Label>("label-warnings");
|
||||
|
||||
_groupErrors = root.Q<VisualElement>("status-errors");
|
||||
_labelErrors = _groupErrors.Q<Label>("label-errors");
|
||||
|
||||
_groupWarnings.style.display = DisplayStyle.None;
|
||||
_groupErrors.style.display = DisplayStyle.None;
|
||||
|
||||
root.Q<ToolbarButton>("button-run").clicked += OnToolbarButtonRunClicked;
|
||||
root.Q<ToolbarButton>("button-clear").clicked += OnToolbarButtonClearClicked;
|
||||
root.Q<ToolbarSearchField>().RegisterValueChangedCallback(OnToolbarSearchFieldChanged);
|
||||
|
|
@ -61,11 +76,26 @@ namespace Module.ProjectValidator.Editor
|
|||
|
||||
_list.Clear();
|
||||
|
||||
for (var i = 0; i < Report.Active.Entries.Count; i++)
|
||||
var entries = Report.Active.Entries;
|
||||
var warningCount = 0;
|
||||
var errorCount = 0;
|
||||
|
||||
for (var i = 0; i < entries.Count; i++)
|
||||
{
|
||||
_list.Add(new TreeViewItemData<Report.Entry>(i, Report.Active.Entries[i]));
|
||||
_list.Add(new TreeViewItemData<Report.Entry>(i, entries[i]));
|
||||
|
||||
if (entries[i].Severity == EValidatorSeverity.Warning)
|
||||
warningCount++;
|
||||
if (entries[i].Severity == EValidatorSeverity.Error)
|
||||
errorCount++;
|
||||
}
|
||||
|
||||
_groupWarnings.style.display = warningCount > 0 ? DisplayStyle.Flex : DisplayStyle.None;
|
||||
_labelWarnings.text = warningCount.ToString();
|
||||
|
||||
_groupErrors.style.display = errorCount > 0 ? DisplayStyle.Flex : DisplayStyle.None;
|
||||
_labelErrors.text = errorCount.ToString();
|
||||
|
||||
Filter();
|
||||
}
|
||||
|
||||
|
|
@ -124,6 +154,8 @@ namespace Module.ProjectValidator.Editor
|
|||
|
||||
private void OnToolbarButtonClearClicked()
|
||||
{
|
||||
_groupWarnings.style.display = DisplayStyle.None;
|
||||
_groupErrors.style.display = DisplayStyle.None;
|
||||
ValidatorRunner.Clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
-unity-font-style: bold;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.toolbar-button-settings {
|
||||
width: 24px;
|
||||
min-width: 24px;
|
||||
|
|
@ -30,3 +28,27 @@
|
|||
-unity-background-scale-mode: scale-to-fit;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.warning-icon {
|
||||
background-image: url("project://database/Packages/com.module.project-validator/Editor/Icons/editor_project_validator_warning.png?fileID=2800000&guid=5dce0f250980ffb459470fac33dfab59&type=3#editor_project_validator_warning");
|
||||
width: 16px;
|
||||
min-width: 16px;
|
||||
max-width: 16px;
|
||||
max-height: 16px;
|
||||
min-height: 16px;
|
||||
height: 16px;
|
||||
-unity-background-scale-mode: scale-to-fit;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.error-icon {
|
||||
background-image: url("project://database/Packages/com.module.project-validator/Editor/Icons/editor_project_validator_error.png?fileID=2800000&guid=7b6c61a2cf824b74c87cb49759531c79&type=3#editor_project_validator_error");
|
||||
width: 16px;
|
||||
min-width: 16px;
|
||||
max-width: 16px;
|
||||
max-height: 16px;
|
||||
min-height: 16px;
|
||||
height: 16px;
|
||||
-unity-background-scale-mode: scale-to-fit;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,16 @@
|
|||
<uie:Toolbar name="toolbar">
|
||||
<uie:ToolbarButton text="Run" name="button-run" style="margin-left: 2px;"/>
|
||||
<uie:ToolbarButton text="Clear" name="button-clear"/>
|
||||
<uie:ToolbarSpacer style="flex-grow: 1;"/>
|
||||
<uie:ToolbarSpacer name="spacing" style="flex-grow: 1;"/>
|
||||
<ui:VisualElement name="status-errors" style="flex-grow: 0; flex-direction: row; align-self: center; margin-left: 4px;">
|
||||
<ui:Label text="9999" name="label-errors" double-click-selects-word="false" triple-click-selects-line="false" display-tooltip-when-elided="false" style="flex-grow: 1; -unity-text-align: middle-center;"/>
|
||||
<ui:VisualElement name="icon" class="error-icon" style="flex-grow: 1;"/>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="status-warnings" style="flex-grow: 0; flex-direction: row; align-self: center; margin-right: 4px;">
|
||||
<ui:Label text="9999" name="label-warnings" double-click-selects-word="false" triple-click-selects-line="false" display-tooltip-when-elided="false" style="flex-grow: 1; -unity-text-align: middle-center;"/>
|
||||
<ui:VisualElement name="icon" class="warning-icon" style="flex-grow: 1;"/>
|
||||
</ui:VisualElement>
|
||||
<uie:ToolbarSpacer name="spacing" style="flex-grow: 1;"/>
|
||||
<uie:ToolbarSearchField name="search-field"/>
|
||||
<uie:ToolbarButton text="" name="button-settings" class="toolbar-button-settings"/>
|
||||
</uie:Toolbar>
|
||||
|
|
@ -17,4 +26,5 @@
|
|||
</ui:Columns>
|
||||
<ui:SortColumnDescriptions/>
|
||||
</ui:MultiColumnTreeView>
|
||||
<ui:Image/>
|
||||
</ui:UXML>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue