LutifyEditor.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Lutify - Unity Asset
  2. // Copyright (c) 2015 - Thomas Hourdel
  3. // http://www.thomashourdel.com
  4. using UnityEngine;
  5. using UnityEditor;
  6. [CustomEditor(typeof(Lutify))]
  7. public class LutifyEditor : Editor
  8. {
  9. SerializedProperty p_LookupTexture;
  10. SerializedProperty p_Split;
  11. SerializedProperty p_ForceCompatibility;
  12. SerializedProperty p_LutFiltering;
  13. SerializedProperty p_Blend;
  14. void OnEnable()
  15. {
  16. p_LookupTexture = serializedObject.FindProperty("LookupTexture");
  17. p_Split = serializedObject.FindProperty("Split");
  18. p_ForceCompatibility = serializedObject.FindProperty("ForceCompatibility");
  19. p_LutFiltering = serializedObject.FindProperty("LutFiltering");
  20. p_Blend = serializedObject.FindProperty("Blend");
  21. }
  22. public override void OnInspectorGUI()
  23. {
  24. serializedObject.Update();
  25. Texture2D lut = (Texture2D)p_LookupTexture.objectReferenceValue;
  26. EditorGUILayout.BeginHorizontal();
  27. {
  28. EditorGUILayout.PrefixLabel("Lookup Texture");
  29. EditorGUILayout.BeginHorizontal();
  30. {
  31. lut = (Texture2D)EditorGUILayout.ObjectField(lut, typeof(Texture2D), false);
  32. if (GUILayout.Button("N", EditorStyles.miniButton)) lut = null;
  33. }
  34. EditorGUILayout.EndHorizontal();
  35. }
  36. EditorGUILayout.EndHorizontal();
  37. p_LookupTexture.objectReferenceValue = lut;
  38. EditorGUILayout.PropertyField(p_Split);
  39. EditorGUILayout.PropertyField(p_ForceCompatibility);
  40. EditorGUILayout.PropertyField(p_LutFiltering);
  41. EditorGUILayout.PropertyField(p_Blend);
  42. if (LutifyBrowser.inst == null)
  43. {
  44. if (GUILayout.Button("Open LUT Gallery"))
  45. LutifyBrowser.Init(target as Lutify);
  46. }
  47. else
  48. {
  49. if (GUILayout.Button("Close LUT Gallery"))
  50. LutifyBrowser.inst.Close();
  51. }
  52. serializedObject.ApplyModifiedProperties();
  53. }
  54. }