VideoResolveOptionsDrawer.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEditor;
  5. namespace RenderHeads.Media.AVProVideo.Editor
  6. {
  7. #if AVPRO_FEATURE_VIDEORESOLVE
  8. [CustomPropertyDrawer(typeof(VideoResolveOptions))]
  9. public class VideoResolveOptionsDrawer : PropertyDrawer
  10. {
  11. public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { return 0f; }
  12. public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
  13. {
  14. EditorGUI.BeginProperty(position, GUIContent.none, property);
  15. SerializedProperty propApplyHSBC = property.FindPropertyRelative("applyHSBC");
  16. EditorGUILayout.PropertyField(propApplyHSBC, new GUIContent("Image Adjustments"));
  17. if (propApplyHSBC.boolValue)
  18. {
  19. SerializedProperty propHue = property.FindPropertyRelative("hue");
  20. SerializedProperty propSaturation = property.FindPropertyRelative("saturation");
  21. SerializedProperty propBrightness = property.FindPropertyRelative("brightness");
  22. SerializedProperty propContrast = property.FindPropertyRelative("contrast");
  23. SerializedProperty propGamma = property.FindPropertyRelative("gamma");
  24. EditorGUILayout.PropertyField(propHue);
  25. EditorGUILayout.PropertyField(propSaturation);
  26. EditorGUILayout.PropertyField(propBrightness);
  27. EditorGUILayout.PropertyField(propContrast);
  28. EditorGUILayout.PropertyField(propGamma);
  29. }
  30. {
  31. SerializedProperty propTint = property.FindPropertyRelative("tint");
  32. SerializedProperty propGenerateMipMaps = property.FindPropertyRelative("generateMipmaps");
  33. EditorGUILayout.PropertyField(propTint);
  34. EditorGUILayout.PropertyField(propGenerateMipMaps);
  35. }
  36. EditorGUI.EndProperty();
  37. }
  38. }
  39. [CustomPropertyDrawer(typeof(VideoResolve))]
  40. public class VideoResolveDrawer : PropertyDrawer
  41. {
  42. public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { return 0f; }
  43. public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
  44. {
  45. EditorGUI.BeginProperty(position, GUIContent.none, property);
  46. SerializedProperty propOptions = property.FindPropertyRelative("_options");
  47. SerializedProperty propTargetRenderTexture = property.FindPropertyRelative("_targetRenderTexture");
  48. EditorGUILayout.PropertyField(propOptions, true);
  49. EditorGUILayout.PropertyField(propTargetRenderTexture, new GUIContent("Render Texture"));
  50. if (propTargetRenderTexture.objectReferenceValue != null)
  51. {
  52. SerializedProperty propTargetRenderTextureScale = property.FindPropertyRelative("_targetRenderTextureScale");
  53. EditorGUILayout.PropertyField(propTargetRenderTextureScale);
  54. }
  55. EditorGUI.EndProperty();
  56. }
  57. }
  58. #endif
  59. }