Added HairBlendingSetting in UTSRenderPassSetting; Added MaterialType to UTS; Added MaterialFeature scope to UTS material editor; Merged HairBlendingPass and HairShadowPass into UTSPass; Fixed the bug that character box light can not update rotation correctly according to bound light source;
66 lines
2.1 KiB
C#
66 lines
2.1 KiB
C#
using System.Collections.Generic;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace Misaki.HdrpToon.Editor
|
|
{
|
|
public class UTSRendererSettingProvider : SettingsProvider
|
|
{
|
|
class Styles
|
|
{
|
|
public static GUIContent hairShadow = new("Hair Shadow");
|
|
public static GUIContent hairBlending = new("Hair Blending");
|
|
public static GUIContent outline = new("Outline");
|
|
}
|
|
|
|
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 = UTSRenderPassSettings.GetSerializedSettings();
|
|
}
|
|
|
|
public override void OnGUI(string searchContext)
|
|
{
|
|
EditorGUI.BeginChangeCheck();
|
|
|
|
EditorGUILayout.PropertyField(_customSettings.FindProperty("hairShadowSetting"), Styles.hairShadow);
|
|
EditorGUILayout.PropertyField(_customSettings.FindProperty("hairBlendingSetting"), Styles.hairBlending);
|
|
EditorGUILayout.PropertyField(_customSettings.FindProperty("outlineSetting"), Styles.outline);
|
|
_customSettings.ApplyModifiedPropertiesWithoutUndo();
|
|
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
UTSRenderPassRegistrar.NotifyRendererSettingChanged();
|
|
}
|
|
|
|
}
|
|
|
|
public static bool IsSettingsAvailable()
|
|
{
|
|
return EditorBuildSettings.TryGetConfigObject<UTSRenderPassSettings>(UTSRenderPassSettings.UTS_RENDERING_SETTINGS_NAME, out _);
|
|
}
|
|
|
|
[SettingsProvider]
|
|
public static SettingsProvider Create()
|
|
{
|
|
if (IsSettingsAvailable())
|
|
{
|
|
var provider = new UTSRendererSettingProvider("Project/UTS", SettingsScope.Project)
|
|
{
|
|
keywords = GetSearchKeywordsFromGUIContentProperties<Styles>()
|
|
};
|
|
|
|
return provider;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
}
|