5 namespace UnityStandardAssets.ImageEffects
7 [CustomEditor (typeof(DepthOfFieldDeprecated))]
10 SerializedObject serObj;
12 SerializedProperty simpleTweakMode;
14 SerializedProperty focalPoint;
15 SerializedProperty smoothness;
17 SerializedProperty focalSize;
19 SerializedProperty focalZDistance;
20 SerializedProperty focalStartCurve;
21 SerializedProperty focalEndCurve;
23 SerializedProperty visualizeCoc;
25 SerializedProperty resolution;
26 SerializedProperty quality;
28 SerializedProperty objectFocus;
30 SerializedProperty bokeh;
31 SerializedProperty bokehScale;
32 SerializedProperty bokehIntensity;
33 SerializedProperty bokehThresholdLuminance;
34 SerializedProperty bokehThresholdContrast;
35 SerializedProperty bokehDownsample;
36 SerializedProperty bokehTexture;
37 SerializedProperty bokehDestination;
39 SerializedProperty bluriness;
40 SerializedProperty maxBlurSpread;
41 SerializedProperty foregroundBlurExtrude;
44 serObj =
new SerializedObject (target);
46 simpleTweakMode = serObj.FindProperty (
"simpleTweakMode");
49 focalPoint = serObj.FindProperty (
"focalPoint");
50 smoothness = serObj.FindProperty (
"smoothness");
53 focalZDistance = serObj.FindProperty (
"focalZDistance");
54 focalStartCurve = serObj.FindProperty (
"focalZStartCurve");
55 focalEndCurve = serObj.FindProperty (
"focalZEndCurve");
56 focalSize = serObj.FindProperty (
"focalSize");
58 visualizeCoc = serObj.FindProperty (
"visualize");
60 objectFocus = serObj.FindProperty (
"objectFocus");
62 resolution = serObj.FindProperty (
"resolution");
63 quality = serObj.FindProperty (
"quality");
64 bokehThresholdContrast = serObj.FindProperty (
"bokehThresholdContrast");
65 bokehThresholdLuminance = serObj.FindProperty (
"bokehThresholdLuminance");
67 bokeh = serObj.FindProperty (
"bokeh");
68 bokehScale = serObj.FindProperty (
"bokehScale");
69 bokehIntensity = serObj.FindProperty (
"bokehIntensity");
70 bokehDownsample = serObj.FindProperty (
"bokehDownsample");
71 bokehTexture = serObj.FindProperty (
"bokehTexture");
72 bokehDestination = serObj.FindProperty (
"bokehDestination");
74 bluriness = serObj.FindProperty (
"bluriness");
75 maxBlurSpread = serObj.FindProperty (
"maxBlurSpread");
76 foregroundBlurExtrude = serObj.FindProperty (
"foregroundBlurExtrude");
80 public override void OnInspectorGUI () {
88 if (!go.GetComponent<Camera>())
91 if (simpleTweakMode.boolValue)
92 GUILayout.Label (
"Current: "+go.GetComponent<Camera>().name+
", near "+go.GetComponent<Camera>().nearClipPlane+
", far: "+go.GetComponent<Camera>().farClipPlane+
", focal: "+focalPoint.floatValue, EditorStyles.miniBoldLabel);
94 GUILayout.Label (
"Current: "+go.GetComponent<Camera>().name+
", near "+go.GetComponent<Camera>().nearClipPlane+
", far: "+go.GetComponent<Camera>().farClipPlane+
", focal: "+focalZDistance.floatValue, EditorStyles.miniBoldLabel);
96 EditorGUILayout.PropertyField (resolution,
new GUIContent(
"Resolution"));
97 EditorGUILayout.PropertyField (quality,
new GUIContent(
"Quality"));
99 EditorGUILayout.PropertyField (simpleTweakMode,
new GUIContent(
"Simple tweak"));
100 EditorGUILayout.PropertyField (visualizeCoc,
new GUIContent(
"Visualize focus"));
101 EditorGUILayout.PropertyField (bokeh,
new GUIContent(
"Enable bokeh"));
104 EditorGUILayout.Separator ();
106 GUILayout.Label (
"Focal Settings", EditorStyles.boldLabel);
108 if (simpleTweakMode.boolValue) {
109 focalPoint.floatValue = EditorGUILayout.Slider (
"Focal distance", focalPoint.floatValue, go.GetComponent<Camera>().nearClipPlane, go.GetComponent<Camera>().farClipPlane);
110 EditorGUILayout.PropertyField (objectFocus,
new GUIContent(
"Transform"));
111 EditorGUILayout.PropertyField (smoothness,
new GUIContent(
"Smoothness"));
112 focalSize.floatValue = EditorGUILayout.Slider (
"Focal size", focalSize.floatValue, 0.0f, (go.GetComponent<Camera>().farClipPlane - go.GetComponent<Camera>().nearClipPlane));
115 focalZDistance.floatValue = EditorGUILayout.Slider (
"Distance", focalZDistance.floatValue, go.GetComponent<Camera>().nearClipPlane, go.GetComponent<Camera>().farClipPlane);
116 EditorGUILayout.PropertyField (objectFocus,
new GUIContent(
"Transform"));
117 focalSize.floatValue = EditorGUILayout.Slider (
"Size", focalSize.floatValue, 0.0f, (go.GetComponent<Camera>().farClipPlane - go.GetComponent<Camera>().nearClipPlane));
118 focalStartCurve.floatValue = EditorGUILayout.Slider (
"Start curve", focalStartCurve.floatValue, 0.05f, 20.0f);
119 focalEndCurve.floatValue = EditorGUILayout.Slider (
"End curve", focalEndCurve.floatValue, 0.05f, 20.0f);
122 EditorGUILayout.Separator ();
124 GUILayout.Label (
"Blur (Fore- and Background)", EditorStyles.boldLabel);
125 EditorGUILayout.PropertyField (bluriness,
new GUIContent(
"Blurriness"));
126 EditorGUILayout.PropertyField (maxBlurSpread,
new GUIContent(
"Blur spread"));
128 if (quality.enumValueIndex > 0) {
129 EditorGUILayout.PropertyField (foregroundBlurExtrude,
new GUIContent(
"Foreground size"));
132 EditorGUILayout.Separator ();
134 if (bokeh.boolValue) {
135 EditorGUILayout.Separator ();
136 GUILayout.Label (
"Bokeh Settings", EditorStyles.boldLabel);
137 EditorGUILayout.PropertyField (bokehDestination,
new GUIContent(
"Destination"));
138 bokehIntensity.floatValue = EditorGUILayout.Slider (
"Intensity", bokehIntensity.floatValue, 0.0f, 1.0f);
139 bokehThresholdLuminance.floatValue = EditorGUILayout.Slider (
"Min luminance", bokehThresholdLuminance.floatValue, 0.0f, 0.99f);
140 bokehThresholdContrast.floatValue = EditorGUILayout.Slider (
"Min contrast", bokehThresholdContrast.floatValue, 0.0f, 0.25f);
141 bokehDownsample.intValue = EditorGUILayout.IntSlider (
"Downsample", bokehDownsample.intValue, 1, 3);
142 bokehScale.floatValue = EditorGUILayout.Slider (
"Size scale", bokehScale.floatValue, 0.0f, 20.0f);
143 EditorGUILayout.PropertyField (bokehTexture ,
new GUIContent(
"Texture mask"));
146 serObj.ApplyModifiedProperties();