update shader variant collector

着色器变种收集界面增加单次照射数量的控制。
pull/72/head
hevinci 2023-02-27 19:02:16 +08:00
parent 365ed560f6
commit 4da2bf441f
3 changed files with 30 additions and 4 deletions

View File

@ -13,5 +13,10 @@ namespace YooAsset.Editor
/// 收集的包裹名称
/// </summary>
public string CollectPackage = string.Empty;
/// <summary>
/// 容器值
/// </summary>
public int ProcessCapacity = 1000;
}
}

View File

@ -24,6 +24,7 @@ namespace YooAsset.Editor
private TextField _collectOutputField;
private Label _currentShaderCountField;
private Label _currentVariantCountField;
private SliderInt _processCapacitySlider;
private PopupField<string> _packageField;
public void CreateGUI()
@ -72,6 +73,23 @@ namespace YooAsset.Editor
packageContainer.Add(_packageField);
}
// 容器值
_processCapacitySlider = root.Q<SliderInt>("ProcessCapacity");
_processCapacitySlider.SetValueWithoutNotify(ShaderVariantCollectorSettingData.Setting.ProcessCapacity);
#if !UNITY_2020_3_OR_NEWER
_processCapacitySlider.label = $"Capacity ({_processCapacitySlider.value})";
_processCapacitySlider.RegisterValueChangedCallback(evt =>
{
ShaderVariantCollectorSettingData.Setting.ProcessCapacity = _processCapacitySlider.value;
_processCapacitySlider.label = $"Capacity ({_processCapacitySlider.value})";
});
#else
_processCapacitySlider.RegisterValueChangedCallback(evt =>
{
ShaderVariantCollectorSettingData.Setting.ProcessCapacity = _processCapacitySlider.value;
});
#endif
_currentShaderCountField = root.Q<Label>("CurrentShaderCount");
_currentVariantCountField = root.Q<Label>("CurrentVariantCount");
@ -103,7 +121,8 @@ namespace YooAsset.Editor
{
string savePath = ShaderVariantCollectorSettingData.Setting.SavePath;
string packageName = ShaderVariantCollectorSettingData.Setting.CollectPackage;
ShaderVariantCollector.Run(savePath, packageName, int.MaxValue, null);
int processCapacity = _processCapacitySlider.value;
ShaderVariantCollector.Run(savePath, packageName, processCapacity, null);
}
// 构建包裹相关

View File

@ -1,10 +1,12 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements">
<uie:Toolbar name="Toolbar" style="display: flex; flex-direction: row-reverse;" />
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
<ui:VisualElement name="CollectContainer">
<ui:TextField picking-mode="Ignore" label="文件保存路径" name="CollectOutput" style="height: 22px;" />
<ui:VisualElement name="PackageContainer" style="height: 24px;" />
<ui:VisualElement name="PackageContainer" style="height: 24px;">
<uie:Toolbar name="Toolbar" style="display: flex; flex-direction: row-reverse;" />
</ui:VisualElement>
<ui:Label text="Current Shader Count" display-tooltip-when-elided="true" name="CurrentShaderCount" style="height: 20px; padding-left: 4px;" />
<ui:Label text="Current Variant Count" display-tooltip-when-elided="true" name="CurrentVariantCount" style="height: 20px; padding-left: 4px;" />
<ui:SliderInt picking-mode="Ignore" label="Capacity" value="9999" high-value="1000" name="ProcessCapacity" low-value="10" show-input-field="true" />
<ui:Button text="开始搜集" display-tooltip-when-elided="true" name="CollectButton" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" />
</ui:VisualElement>
</ui:UXML>