5 namespace UnityStandardAssets.ImageEffects
7 [CustomEditor (typeof(EdgeDetection))]
10 SerializedObject serObj;
12 SerializedProperty mode;
13 SerializedProperty sensitivityDepth;
14 SerializedProperty sensitivityNormals;
16 SerializedProperty lumThreshold;
18 SerializedProperty edgesOnly;
19 SerializedProperty edgesOnlyBgColor;
21 SerializedProperty edgeExp;
22 SerializedProperty sampleDist;
26 serObj =
new SerializedObject (target);
28 mode = serObj.FindProperty(
"mode");
30 sensitivityDepth = serObj.FindProperty(
"sensitivityDepth");
31 sensitivityNormals = serObj.FindProperty(
"sensitivityNormals");
33 lumThreshold = serObj.FindProperty(
"lumThreshold");
35 edgesOnly = serObj.FindProperty(
"edgesOnly");
36 edgesOnlyBgColor = serObj.FindProperty(
"edgesOnlyBgColor");
38 edgeExp = serObj.FindProperty(
"edgeExp");
39 sampleDist = serObj.FindProperty(
"sampleDist");
43 public override void OnInspectorGUI () {
46 GUILayout.Label(
"Detects spatial differences and converts into black outlines", EditorStyles.miniBoldLabel);
47 EditorGUILayout.PropertyField (mode,
new GUIContent(
"Mode"));
49 if (mode.intValue < 2) {
50 EditorGUILayout.PropertyField (sensitivityDepth,
new GUIContent(
" Depth Sensitivity"));
51 EditorGUILayout.PropertyField (sensitivityNormals,
new GUIContent(
" Normals Sensitivity"));
53 else if (mode.intValue < 4) {
54 EditorGUILayout.PropertyField (edgeExp,
new GUIContent(
" Edge Exponent"));
58 EditorGUILayout.PropertyField (lumThreshold,
new GUIContent(
" Luminance Threshold"));
61 EditorGUILayout.PropertyField (sampleDist,
new GUIContent(
" Sample Distance"));
63 EditorGUILayout.Separator ();
65 GUILayout.Label (
"Background Options");
66 edgesOnly.floatValue = EditorGUILayout.Slider (
" Edges only", edgesOnly.floatValue, 0.0f, 1.0f);
67 EditorGUILayout.PropertyField (edgesOnlyBgColor,
new GUIContent (
" Color"));
69 serObj.ApplyModifiedProperties();