Brak opisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LiftGammaGainEditor.cs 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using UnityEngine;
  2. using UnityEngine.Rendering.Universal;
  3. namespace UnityEditor.Rendering.Universal
  4. {
  5. [CustomEditor(typeof(LiftGammaGain))]
  6. sealed class LiftGammaGainEditor : VolumeComponentEditor
  7. {
  8. private static class Styles
  9. {
  10. public static readonly GUIContent liftLabel = EditorGUIUtility.TrTextContent("Lift", "Use this to control and apply a hue to the dark tones. This has a more exaggerated effect on shadows.");
  11. public static readonly GUIContent gammaLabel = EditorGUIUtility.TrTextContent("Gamma", "Use this to control and apply a hue to the mid-range tones with a power function.");
  12. public static readonly GUIContent gainLabel = EditorGUIUtility.TrTextContent("Gain", "Use this to increase and apply a hue to the signal and make highlights brighter.");
  13. }
  14. SerializedDataParameter m_Lift;
  15. SerializedDataParameter m_Gamma;
  16. SerializedDataParameter m_Gain;
  17. readonly TrackballUIDrawer m_TrackballUIDrawer = new TrackballUIDrawer();
  18. public override void OnEnable()
  19. {
  20. var o = new PropertyFetcher<LiftGammaGain>(serializedObject);
  21. m_Lift = Unpack(o.Find(x => x.lift));
  22. m_Gamma = Unpack(o.Find(x => x.gamma));
  23. m_Gain = Unpack(o.Find(x => x.gain));
  24. }
  25. public override void OnInspectorGUI()
  26. {
  27. using (new EditorGUILayout.HorizontalScope())
  28. {
  29. m_TrackballUIDrawer.OnGUI(m_Lift.value, enableOverrides ? m_Lift.overrideState : null, Styles.liftLabel, GetLiftValue);
  30. GUILayout.Space(4f);
  31. m_TrackballUIDrawer.OnGUI(m_Gamma.value, enableOverrides ? m_Gamma.overrideState : null, Styles.gammaLabel, GetLiftValue);
  32. GUILayout.Space(4f);
  33. m_TrackballUIDrawer.OnGUI(m_Gain.value, enableOverrides ? m_Gain.overrideState : null, Styles.gainLabel, GetLiftValue);
  34. }
  35. }
  36. static Vector3 GetLiftValue(Vector4 x) => new Vector3(x.x + x.w, x.y + x.w, x.z + x.w);
  37. }
  38. }