TonemappingEditor.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. using UnityEngine.Rendering.Universal;
  2. namespace UnityEditor.Rendering.Universal
  3. {
  4. [VolumeComponentEditor(typeof(Tonemapping))]
  5. sealed class TonemappingEditor : VolumeComponentEditor
  6. {
  7. SerializedDataParameter m_Mode;
  8. public override void OnEnable()
  9. {
  10. var o = new PropertyFetcher<Tonemapping>(serializedObject);
  11. m_Mode = Unpack(o.Find(x => x.mode));
  12. }
  13. public override void OnInspectorGUI()
  14. {
  15. if (UniversalRenderPipeline.asset?.postProcessingFeatureSet == PostProcessingFeatureSet.PostProcessingV2)
  16. {
  17. EditorGUILayout.HelpBox(UniversalRenderPipelineAssetEditor.Styles.postProcessingGlobalWarning, MessageType.Warning);
  18. return;
  19. }
  20. PropertyField(m_Mode);
  21. // Display a warning if the user is trying to use a tonemap while rendering in LDR
  22. if (UniversalRenderPipeline.asset?.supportsHDR == false)
  23. EditorGUILayout.HelpBox("Tonemapping should only be used when working in HDR.", MessageType.Warning);
  24. }
  25. }
  26. }