DepthOfFieldModelEditor.cs
1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using UnityEngine.PostProcessing;
namespace UnityEditor.PostProcessing
{
using Settings = DepthOfFieldModel.Settings;
[PostProcessingModelEditor(typeof(DepthOfFieldModel))]
public class DepthOfFieldModelEditor : PostProcessingModelEditor
{
SerializedProperty m_FocusDistance;
SerializedProperty m_Aperture;
SerializedProperty m_FocalLength;
SerializedProperty m_UseCameraFov;
SerializedProperty m_KernelSize;
public override void OnEnable()
{
m_FocusDistance = FindSetting((Settings x) => x.focusDistance);
m_Aperture = FindSetting((Settings x) => x.aperture);
m_FocalLength = FindSetting((Settings x) => x.focalLength);
m_UseCameraFov = FindSetting((Settings x) => x.useCameraFov);
m_KernelSize = FindSetting((Settings x) => x.kernelSize);
}
public override void OnInspectorGUI()
{
EditorGUILayout.PropertyField(m_FocusDistance);
EditorGUILayout.PropertyField(m_Aperture, EditorGUIHelper.GetContent("Aperture (f-stop)"));
EditorGUILayout.PropertyField(m_UseCameraFov, EditorGUIHelper.GetContent("Use Camera FOV"));
if (!m_UseCameraFov.boolValue)
EditorGUILayout.PropertyField(m_FocalLength, EditorGUIHelper.GetContent("Focal Length (mm)"));
EditorGUILayout.PropertyField(m_KernelSize);
}
}
}