1- using UnityEngine ;
1+ using UnityEngine ;
22using UnityEngine . Rendering . PostProcessing ;
33
44namespace UnityEditor . Rendering . PostProcessing
@@ -11,12 +11,17 @@ public sealed class PostProcessDebugEditor : BaseEditor<PostProcessDebug>
1111 SerializedProperty m_HistogramEnabled ;
1212 SerializedProperty m_WaveformEnabled ;
1313 SerializedProperty m_VectorscopeEnabled ;
14+ SerializedProperty m_Overlay ;
15+
16+ SerializedObject m_LayerObject ;
1417
15- SerializedObject m_Monitors ;
1618 SerializedProperty m_LightMeterShowCurves ;
1719 SerializedProperty m_HistogramChannel ;
1820 SerializedProperty m_WaveformExposure ;
1921 SerializedProperty m_VectorscopeExposure ;
22+
23+ SerializedProperty m_MotionColorIntensity ;
24+ SerializedProperty m_MotionGridSize ;
2025
2126 void OnEnable ( )
2227 {
@@ -25,6 +30,7 @@ void OnEnable()
2530 m_HistogramEnabled = FindProperty ( x => x . histogram ) ;
2631 m_WaveformEnabled = FindProperty ( x => x . waveform ) ;
2732 m_VectorscopeEnabled = FindProperty ( x => x . vectorscope ) ;
33+ m_Overlay = FindProperty ( x => x . debugOverlay ) ;
2834
2935 if ( m_PostProcessLayer . objectReferenceValue != null )
3036 RebuildProperties ( ) ;
@@ -35,12 +41,15 @@ void RebuildProperties()
3541 if ( m_PostProcessLayer . objectReferenceValue == null )
3642 return ;
3743
38- m_Monitors = new SerializedObject ( m_Target . postProcessLayer ) ;
44+ m_LayerObject = new SerializedObject ( m_Target . postProcessLayer ) ;
45+
46+ m_LightMeterShowCurves = m_LayerObject . FindProperty ( "debugLayer.lightMeter.showCurves" ) ;
47+ m_HistogramChannel = m_LayerObject . FindProperty ( "debugLayer.histogram.channel" ) ;
48+ m_WaveformExposure = m_LayerObject . FindProperty ( "debugLayer.waveform.exposure" ) ;
49+ m_VectorscopeExposure = m_LayerObject . FindProperty ( "debugLayer.vectorscope.exposure" ) ;
3950
40- m_LightMeterShowCurves = m_Monitors . FindProperty ( "monitors.lightMeter.showCurves" ) ;
41- m_HistogramChannel = m_Monitors . FindProperty ( "monitors.histogram.channel" ) ;
42- m_WaveformExposure = m_Monitors . FindProperty ( "monitors.waveform.exposure" ) ;
43- m_VectorscopeExposure = m_Monitors . FindProperty ( "monitors.vectorscope.exposure" ) ;
51+ m_MotionColorIntensity = m_LayerObject . FindProperty ( "debugLayer.overlaySettings.motionColorIntensity" ) ;
52+ m_MotionGridSize = m_LayerObject . FindProperty ( "debugLayer.overlaySettings.motionGridSize" ) ;
4453 }
4554
4655 public override void OnInspectorGUI ( )
@@ -50,21 +59,41 @@ public override void OnInspectorGUI()
5059 using ( var changed = new EditorGUI . ChangeCheckScope ( ) )
5160 {
5261 EditorGUILayout . PropertyField ( m_PostProcessLayer ) ;
62+ serializedObject . ApplyModifiedProperties ( ) ; // Needed to rebuild properties after a change
63+ serializedObject . Update ( ) ;
5364
5465 if ( changed . changed )
5566 RebuildProperties ( ) ;
5667 }
5768
5869 if ( m_PostProcessLayer . objectReferenceValue != null )
5970 {
60- m_Monitors . Update ( ) ;
71+ m_LayerObject . Update ( ) ;
72+
73+ // Overlays
74+ EditorGUILayout . Space ( ) ;
75+ EditorGUILayout . LabelField ( EditorUtilities . GetContent ( "Overlay" ) , EditorStyles . boldLabel ) ;
76+ EditorGUI . indentLevel ++ ;
77+ EditorGUILayout . PropertyField ( m_Overlay ) ;
78+ DoOverlayGUI ( DebugOverlay . MotionVectors , m_MotionColorIntensity , m_MotionGridSize ) ;
79+
80+ // Special cases
81+ if ( m_Overlay . intValue == ( int ) DebugOverlay . NANTracker && m_Target . postProcessLayer . stopNaNPropagation )
82+ EditorGUILayout . HelpBox ( "Disable \" Stop NaN Propagation\" in the Post-process layer or NaNs will be overwritten!" , MessageType . Warning ) ;
6183
84+ EditorGUI . indentLevel -- ;
85+
86+ // Monitors
87+ EditorGUILayout . Space ( ) ;
88+ EditorGUILayout . LabelField ( EditorUtilities . GetContent ( "Monitors" ) , EditorStyles . boldLabel ) ;
89+ EditorGUI . indentLevel ++ ;
6290 DoMonitorGUI ( EditorUtilities . GetContent ( "Light Meter" ) , m_LightMeterEnabled , m_LightMeterShowCurves ) ;
6391 DoMonitorGUI ( EditorUtilities . GetContent ( "Histogram" ) , m_HistogramEnabled , m_HistogramChannel ) ;
6492 DoMonitorGUI ( EditorUtilities . GetContent ( "Waveform" ) , m_WaveformEnabled , m_WaveformExposure ) ;
6593 DoMonitorGUI ( EditorUtilities . GetContent ( "Vectoscope" ) , m_VectorscopeEnabled , m_VectorscopeExposure ) ;
94+ EditorGUI . indentLevel -- ;
6695
67- m_Monitors . ApplyModifiedProperties ( ) ;
96+ m_LayerObject . ApplyModifiedProperties ( ) ;
6897 }
6998
7099 serializedObject . ApplyModifiedProperties ( ) ;
@@ -83,8 +112,19 @@ void DoMonitorGUI(GUIContent content, SerializedProperty prop, params Serialized
83112 foreach ( var p in settings )
84113 EditorGUILayout . PropertyField ( p ) ;
85114 EditorGUI . indentLevel -- ;
86- EditorGUILayout . Space ( ) ;
87115 }
88116 }
117+
118+ void DoOverlayGUI ( DebugOverlay overlay , params SerializedProperty [ ] settings )
119+ {
120+ if ( m_Overlay . intValue != ( int ) overlay )
121+ return ;
122+
123+ if ( settings == null || settings . Length == 0 )
124+ return ;
125+
126+ foreach ( var p in settings )
127+ EditorGUILayout . PropertyField ( p ) ;
128+ }
89129 }
90130}
0 commit comments