Styling.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using UnityEngine;
  2. using UnityEngine.Rendering.PostProcessing;
  3. namespace UnityEditor.Rendering.PostProcessing
  4. {
  5. /// <summary>
  6. /// Common styles used for Post-processing editor controls.
  7. /// </summary>
  8. public static class Styling
  9. {
  10. /// <summary>
  11. /// Style for the override checkbox.
  12. /// </summary>
  13. public static readonly GUIStyle smallTickbox;
  14. /// <summary>
  15. /// Style for the labels in the toolbar of each effect.
  16. /// </summary>
  17. public static readonly GUIStyle miniLabelButton;
  18. static readonly Color splitterDark;
  19. static readonly Color splitterLight;
  20. /// <summary>
  21. /// Color of UI splitters.
  22. /// </summary>
  23. public static Color splitter { get { return EditorGUIUtility.isProSkin ? splitterDark : splitterLight; } }
  24. static readonly Texture2D paneOptionsIconDark;
  25. static readonly Texture2D paneOptionsIconLight;
  26. /// <summary>
  27. /// Option icon used in effect headers.
  28. /// </summary>
  29. public static Texture2D paneOptionsIcon { get { return EditorGUIUtility.isProSkin ? paneOptionsIconDark : paneOptionsIconLight; } }
  30. /// <summary>
  31. /// Style for effect header labels.
  32. /// </summary>
  33. public static readonly GUIStyle headerLabel;
  34. static readonly Color headerBackgroundDark;
  35. static readonly Color headerBackgroundLight;
  36. /// <summary>
  37. /// Color of effect header backgrounds.
  38. /// </summary>
  39. public static Color headerBackground { get { return EditorGUIUtility.isProSkin ? headerBackgroundDark : headerBackgroundLight; } }
  40. /// <summary>
  41. /// Style for the trackball labels.
  42. /// </summary>
  43. public static readonly GUIStyle wheelLabel;
  44. /// <summary>
  45. /// Style for the trackball cursors.
  46. /// </summary>
  47. public static readonly GUIStyle wheelThumb;
  48. /// <summary>
  49. /// Size of the trackball cursors.
  50. /// </summary>
  51. public static readonly Vector2 wheelThumbSize;
  52. /// <summary>
  53. /// Style for the curve editor position info.
  54. /// </summary>
  55. public static readonly GUIStyle preLabel;
  56. static Styling()
  57. {
  58. smallTickbox = new GUIStyle("ShurikenToggle");
  59. miniLabelButton = new GUIStyle(EditorStyles.miniLabel);
  60. miniLabelButton.normal = new GUIStyleState
  61. {
  62. background = RuntimeUtilities.transparentTexture,
  63. scaledBackgrounds = null,
  64. textColor = Color.grey
  65. };
  66. var activeState = new GUIStyleState
  67. {
  68. background = RuntimeUtilities.transparentTexture,
  69. scaledBackgrounds = null,
  70. textColor = Color.white
  71. };
  72. miniLabelButton.active = activeState;
  73. miniLabelButton.onNormal = activeState;
  74. miniLabelButton.onActive = activeState;
  75. splitterDark = new Color(0.12f, 0.12f, 0.12f, 1.333f);
  76. splitterLight = new Color(0.6f, 0.6f, 0.6f, 1.333f);
  77. headerBackgroundDark = new Color(0.1f, 0.1f, 0.1f, 0.2f);
  78. headerBackgroundLight = new Color(1f, 1f, 1f, 0.2f);
  79. paneOptionsIconDark = (Texture2D)EditorGUIUtility.Load("Builtin Skins/DarkSkin/Images/pane options.png");
  80. paneOptionsIconLight = (Texture2D)EditorGUIUtility.Load("Builtin Skins/LightSkin/Images/pane options.png");
  81. headerLabel = new GUIStyle(EditorStyles.miniLabel);
  82. wheelThumb = new GUIStyle("ColorPicker2DThumb");
  83. wheelThumbSize = new Vector2(
  84. !Mathf.Approximately(wheelThumb.fixedWidth, 0f) ? wheelThumb.fixedWidth : wheelThumb.padding.horizontal,
  85. !Mathf.Approximately(wheelThumb.fixedHeight, 0f) ? wheelThumb.fixedHeight : wheelThumb.padding.vertical
  86. );
  87. wheelLabel = new GUIStyle(EditorStyles.miniLabel);
  88. preLabel = new GUIStyle("ShurikenLabel");
  89. }
  90. }
  91. }