5 namespace UnityStandardAssets.ImageEffects
7 [CustomEditor (typeof(VignetteAndChromaticAberration))]
10 private SerializedObject m_SerObj;
11 private SerializedProperty m_Mode;
12 private SerializedProperty m_Intensity;
13 private SerializedProperty m_ChromaticAberration;
14 private SerializedProperty m_AxialAberration;
15 private SerializedProperty m_Blur;
16 private SerializedProperty m_BlurSpread;
17 private SerializedProperty m_BlurDistance;
18 private SerializedProperty m_LuminanceDependency;
23 m_SerObj =
new SerializedObject (target);
24 m_Mode = m_SerObj.FindProperty (
"mode");
25 m_Intensity = m_SerObj.FindProperty (
"intensity");
26 m_ChromaticAberration = m_SerObj.FindProperty (
"chromaticAberration");
27 m_AxialAberration = m_SerObj.FindProperty (
"axialAberration");
28 m_Blur = m_SerObj.FindProperty (
"blur");
29 m_BlurSpread = m_SerObj.FindProperty (
"blurSpread");
30 m_LuminanceDependency = m_SerObj.FindProperty (
"luminanceDependency");
31 m_BlurDistance = m_SerObj.FindProperty (
"blurDistance");
35 public override void OnInspectorGUI ()
39 EditorGUILayout.LabelField(
"Simulates the common lens artifacts 'Vignette' and 'Aberration'", EditorStyles.miniLabel);
41 EditorGUILayout.Slider(m_Intensity, 0.0f, 1.0f,
new GUIContent(
"Vignetting"));
42 EditorGUILayout.Slider(m_Blur, 0.0f, 1.0f,
new GUIContent(
" Blurred Corners"));
43 if (m_Blur.floatValue>0.0f)
44 EditorGUILayout.Slider(m_BlurSpread, 0.0f, 1.0f,
new GUIContent(
" Blur Distance"));
46 EditorGUILayout.Separator ();
48 EditorGUILayout.PropertyField (m_Mode,
new GUIContent(
"Aberration"));
49 if (m_Mode.intValue>0)
51 EditorGUILayout.Slider(m_ChromaticAberration, 0.0f, 5.0f,
new GUIContent(
" Tangential Aberration"));
52 EditorGUILayout.Slider(m_AxialAberration, 0.0f, 5.0f,
new GUIContent(
" Axial Aberration"));
53 m_LuminanceDependency.floatValue = EditorGUILayout.Slider(
" Contrast Dependency", m_LuminanceDependency.floatValue, 0.001f, 1.0f);
54 m_BlurDistance.floatValue = EditorGUILayout.Slider(
" Blur Distance", m_BlurDistance.floatValue, 0.001f, 5.0f);
57 EditorGUILayout.PropertyField (m_ChromaticAberration,
new GUIContent(
" Chromatic Aberration"));
59 m_SerObj.ApplyModifiedProperties();