Update custom pass to global custom pass
This commit is contained in:
63
Editor/ProjectSetting/UTSRendererSettingProvider.cs
Normal file
63
Editor/ProjectSetting/UTSRendererSettingProvider.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace Unity.Toonshader.Editor
|
||||
{
|
||||
public class UTSRendererSettingProvider : SettingsProvider
|
||||
{
|
||||
class Styles
|
||||
{
|
||||
public static GUIContent outline = new GUIContent("Outline Setting");
|
||||
public static GUIContent hairShadow = new GUIContent("Hair Shadow Setting");
|
||||
}
|
||||
|
||||
private SerializedObject _customSettings;
|
||||
|
||||
public UTSRendererSettingProvider(string path, SettingsScope scopes, IEnumerable<string> keywords = null) : base(path, scopes, keywords)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnActivate(string searchContext, VisualElement rootElement)
|
||||
{
|
||||
_customSettings = UTSRenderPassSetting.GetSerializedSettings();
|
||||
}
|
||||
|
||||
public override void OnGUI(string searchContext)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUILayout.PropertyField(_customSettings.FindProperty("outlineSetting"), Styles.outline);
|
||||
EditorGUILayout.PropertyField(_customSettings.FindProperty("hairShadowSetting"), Styles.hairShadow);
|
||||
_customSettings.ApplyModifiedPropertiesWithoutUndo();
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
RegisterUTSRenderPass.NotifyRendererSettingChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsSettingsAvailable()
|
||||
{
|
||||
return File.Exists(UTSRenderPassSetting.RENDERER_SETTING_ASSET_PATH);
|
||||
}
|
||||
|
||||
[SettingsProvider]
|
||||
public static SettingsProvider Create()
|
||||
{
|
||||
if (IsSettingsAvailable())
|
||||
{
|
||||
var provider = new UTSRendererSettingProvider("Project/UTS", SettingsScope.Project)
|
||||
{
|
||||
keywords = GetSearchKeywordsFromGUIContentProperties<Styles>()
|
||||
};
|
||||
|
||||
return provider;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user