TMP_BitmapShaderGUI.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using UnityEngine;
  2. using UnityEditor;
  3. namespace TMPro.EditorUtilities
  4. {
  5. public class TMP_BitmapShaderGUI : TMP_BaseShaderGUI
  6. {
  7. static bool s_Face = true;
  8. protected override void DoGUI()
  9. {
  10. s_Face = BeginPanel("Face", s_Face);
  11. if (s_Face)
  12. {
  13. DoFacePanel();
  14. }
  15. EndPanel();
  16. s_DebugExtended = BeginPanel("Debug Settings", s_DebugExtended);
  17. if (s_DebugExtended)
  18. {
  19. DoDebugPanel();
  20. }
  21. EndPanel();
  22. }
  23. void DoFacePanel()
  24. {
  25. EditorGUI.indentLevel += 1;
  26. if (m_Material.HasProperty(ShaderUtilities.ID_FaceTex))
  27. {
  28. DoColor("_FaceColor", "Color");
  29. DoTexture2D("_FaceTex", "Texture", true);
  30. }
  31. else
  32. {
  33. DoColor("_Color", "Color");
  34. DoSlider("_DiffusePower", "Diffuse Power");
  35. }
  36. EditorGUI.indentLevel -= 1;
  37. EditorGUILayout.Space();
  38. }
  39. void DoDebugPanel()
  40. {
  41. EditorGUI.indentLevel += 1;
  42. DoTexture2D("_MainTex", "Font Atlas");
  43. if (m_Material.HasProperty(ShaderUtilities.ID_VertexOffsetX))
  44. {
  45. if (m_Material.HasProperty(ShaderUtilities.ID_Padding))
  46. {
  47. EditorGUILayout.Space();
  48. DoFloat("_Padding", "Padding");
  49. }
  50. EditorGUILayout.Space();
  51. DoFloat("_VertexOffsetX", "Offset X");
  52. DoFloat("_VertexOffsetY", "Offset Y");
  53. }
  54. if (m_Material.HasProperty(ShaderUtilities.ID_MaskSoftnessX))
  55. {
  56. EditorGUILayout.Space();
  57. DoFloat("_MaskSoftnessX", "Softness X");
  58. DoFloat("_MaskSoftnessY", "Softness Y");
  59. DoVector("_ClipRect", "Clip Rect", s_LbrtVectorLabels);
  60. }
  61. if (m_Material.HasProperty(ShaderUtilities.ID_StencilID))
  62. {
  63. EditorGUILayout.Space();
  64. DoFloat("_Stencil", "Stencil ID");
  65. DoFloat("_StencilComp", "Stencil Comp");
  66. }
  67. EditorGUI.indentLevel -= 1;
  68. EditorGUILayout.Space();
  69. }
  70. }
  71. }