RenderTexureAntiAliasingDrawer.cs 1.1 KB

123456789101112131415161718192021222324252627282930
  1. #if UNITY_EDITOR
  2. using UnityEngine;
  3. using UnityEditor;
  4. using UnityEditor.IMGUI.Controls;
  5. namespace Unity.RenderStreaming.Editor
  6. {
  7. [CustomPropertyDrawer(typeof(RenderTextureAntiAliasingAttribute))]
  8. public class RenderTexureAntiAliasingDrawer : PropertyDrawer
  9. {
  10. readonly GUIContent[] renderTextureAntiAliasing = new GUIContent[4]
  11. {
  12. EditorGUIUtility.TrTextContent("None"),
  13. EditorGUIUtility.TrTextContent("2 samples"),
  14. EditorGUIUtility.TrTextContent("4 samples"),
  15. EditorGUIUtility.TrTextContent("8 samples")
  16. };
  17. readonly int[] renderTextureAntiAliasingValues = new int[4] { 1, 2, 4, 8 };
  18. readonly GUIContent antiAliasing =
  19. EditorGUIUtility.TrTextContent("Anti-aliasing", "Number of anti-aliasing samples.");
  20. public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
  21. {
  22. EditorGUI.IntPopup(position, property, renderTextureAntiAliasing, renderTextureAntiAliasingValues, antiAliasing);
  23. }
  24. }
  25. }
  26. #endif