Changed the outline layer and hair shadow caster layer from LayerMask to RenderingLayerMask;

This commit is contained in:
Misaki
2024-11-18 01:06:42 +09:00
parent 1f63c6f4cb
commit ae9b32162d
24 changed files with 345 additions and 188 deletions

View File

@@ -1,20 +0,0 @@
//namespace Unity.Toonshader.Editor
//{
//[CustomEditor(typeof(BoxLightAdjustment))]
//public class BoxLightAdjustmentInspector : UnityEditor.Editor
//{
// private void OnEnable()
// {
// var boxLightAdjustment = target as BoxLightAdjustment;
// }
// public override VisualElement CreateInspectorGUI()
// {
// var root = new VisualElement();
// return root;
// }
//}
//}

View File

@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: e2b76b74e6ec63546bdb3963e2c88d12

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9a21a25f83d3dad42aa1b4093139f6dc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,37 @@
using System;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
namespace Unity.Toonshader.Editor
{
public class ConverterInitializer
{
[InitializeOnLoadMethod]
public static void Initialize()
{
ConverterHelper.RegisterTwoSideConverter<Vector3, Quaternion>(
nameof(QuaternionToVector3Converter),
QuaternionToVector3Converter.ConvertTo,
QuaternionToVector3Converter.ConvertBack);
}
}
public static class ConverterHelper
{
public static void RegisterTwoSideConverter<TSource, TResult>(string groupName, Func<TSource, TResult> convertTo, Func<TResult, TSource> convertBack)
{
var converterGroup = new ConverterGroup(groupName);
converterGroup.AddConverter((ref TSource v) => convertTo(v));
converterGroup.AddConverter((ref TResult v) => convertBack(v));
ConverterGroups.RegisterConverterGroup(converterGroup);
}
public static void RegisterOneSideConverter<T1, T2>(string groupName, Func<T1, T2> convertTo)
{
var converterGroup = new ConverterGroup(groupName);
converterGroup.AddConverter((ref T1 v) => convertTo(v));
ConverterGroups.RegisterConverterGroup(converterGroup);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 091c419e57c2e4a409d8b8e29f34bb03

View File

@@ -0,0 +1,17 @@
using UnityEngine;
namespace Unity.Toonshader.Editor
{
public struct QuaternionToVector3Converter
{
public static Quaternion ConvertTo(Vector3 vector3)
{
return Quaternion.Euler(vector3);
}
public static Vector3 ConvertBack(Quaternion quaternion)
{
return quaternion.eulerAngles;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 53711690ac788e5428e8410cfbd884a2

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 783d1b02b4eadd948b710b06dfbaa8c3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,35 @@
using Unity.Rendering.HighDefinition.Toon;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
namespace Unity.Toonshader.Editor
{
[CustomEditor(typeof(BoxLightAdjustment))]
public class BoxLightAdjustmentView : UnityEditor.Editor
{
[SerializeField]
private VisualTreeAsset _visualTreeAsset;
public override VisualElement CreateInspectorGUI()
{
if (_visualTreeAsset == null)
{
return base.CreateInspectorGUI();
}
var boxLightAdjustment = (BoxLightAdjustment)target;
var root = new VisualElement
{
dataSource = target
};
var visualTreeElement = _visualTreeAsset.Instantiate();
root.Add(visualTreeElement);
return root;
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: e2b76b74e6ec63546bdb3963e2c88d12
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- _visualTreeAsset: {fileID: 9197481963319205126, guid: 07d7b21993f220949ab376752a658be4,
type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,50 @@
<engine:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:engine="UnityEngine.UIElements" xmlns:editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<engine:VisualElement data-source-type="Unity.Rendering.HighDefinition.Toon.BoxLightAdjustment, Unity.Toonshader" style="flex-grow: 1;">
<engine:Label text="Rendering" style="-unity-font-style: bold; margin-top: 4px; margin-bottom: 2px;" />
<engine:VisualElement name="renderingGroup" style="padding-left: 8px;">
<editor:RenderingLayerMaskField label="Layer Mask" value="DynamicTransform" type="UnityEngine.Rendering.HighDefinition.RenderingLayerMask, Unity.RenderPipelines.HighDefinition.Runtime">
<Bindings>
<engine:DataBinding property="value" data-source-path="LayerMask" data-source-type="Unity.Rendering.HighDefinition.Toon.BoxLightAdjustment, Unity.Toonshader" binding-mode="TwoWay" />
</Bindings>
</editor:RenderingLayerMaskField>
<editor:ObjectField label="Source Light" type="UnityEngine.Light, UnityEngine.CoreModule">
<Bindings>
<engine:DataBinding property="value" data-source-path="BindingSourceLight" binding-mode="TwoWay" />
</Bindings>
</editor:ObjectField>
<editor:ObjectField label="Target Box Light" type="UnityEngine.Light, UnityEngine.CoreModule">
<Bindings>
<engine:DataBinding property="value" data-source-path="TargetBoxLight" binding-mode="TwoWay" />
</Bindings>
</editor:ObjectField>
</engine:VisualElement>
<engine:Label text="Tracking" style="-unity-font-style: bold; margin-top: 4px; margin-bottom: 2px;" />
<engine:VisualElement name="trackingGroup" style="padding-left: 8px;">
<editor:ObjectField label="Tracked Transform" type="UnityEngine.Transform, UnityEngine.CoreModule">
<Bindings>
<engine:DataBinding property="value" data-source-path="trackedTransform" binding-mode="TwoWay" />
</Bindings>
</editor:ObjectField>
<engine:DropdownField label="Follow Position" choices="Disable,Enable" index="0">
<Bindings>
<engine:DataBinding property="index" data-source-path="followGameObjectPosition" binding-mode="TwoWay" />
</Bindings>
</engine:DropdownField>
<engine:DropdownField label="Follow Rotation" choices="Disable,Enable" index="0">
<Bindings>
<engine:DataBinding property="index" data-source-path="followGameObjectRotation" binding-mode="TwoWay" />
</Bindings>
</engine:DropdownField>
<engine:Vector3Field label="Position Offset">
<Bindings>
<engine:DataBinding property="value" data-source-path="positionOffset" binding-mode="TwoWay" />
</Bindings>
</engine:Vector3Field>
<engine:Vector3Field label="Rotation Offset">
<Bindings>
<engine:DataBinding property="value" data-source-path="rotationOffset" binding-mode="TwoWay" source-to-ui-converters="QuaternionToVector3Converter" ui-to-source-converters="QuaternionToVector3Converter" />
</Bindings>
</engine:Vector3Field>
</engine:VisualElement>
</engine:VisualElement>
</engine:UXML>

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 07d7b21993f220949ab376752a658be4
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}