IMHOTEP Framework
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
VignetteAndChromaticAberrationEditor.cs
1 using System;
2 using UnityEditor;
3 using UnityEngine;
4 
5 namespace UnityStandardAssets.ImageEffects
6 {
7  [CustomEditor (typeof(VignetteAndChromaticAberration))]
9  {
10  private SerializedObject m_SerObj;
11  private SerializedProperty m_Mode;
12  private SerializedProperty m_Intensity; // intensity == 0 disables pre pass (optimization)
13  private SerializedProperty m_ChromaticAberration;
14  private SerializedProperty m_AxialAberration;
15  private SerializedProperty m_Blur; // blur == 0 disables blur pass (optimization)
16  private SerializedProperty m_BlurSpread;
17  private SerializedProperty m_BlurDistance;
18  private SerializedProperty m_LuminanceDependency;
19 
20 
21  void OnEnable ()
22  {
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");
32  }
33 
34 
35  public override void OnInspectorGUI ()
36  {
37  m_SerObj.Update ();
38 
39  EditorGUILayout.LabelField("Simulates the common lens artifacts 'Vignette' and 'Aberration'", EditorStyles.miniLabel);
40 
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"));
45 
46  EditorGUILayout.Separator ();
47 
48  EditorGUILayout.PropertyField (m_Mode, new GUIContent("Aberration"));
49  if (m_Mode.intValue>0)
50  {
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);
55  }
56  else
57  EditorGUILayout.PropertyField (m_ChromaticAberration, new GUIContent(" Chromatic Aberration"));
58 
59  m_SerObj.ApplyModifiedProperties();
60  }
61  }
62 }