A game about forced loneliness, made by TACStudios
at master 93 lines 2.6 kB view raw
1using UnityEngine; 2using UnityEditor; 3 4namespace TMPro.EditorUtilities 5{ 6 public class TMP_BitmapShaderGUI : TMP_BaseShaderGUI 7 { 8 static bool s_Face = true; 9 10 protected override void DoGUI() 11 { 12 s_Face = BeginPanel("Face", s_Face); 13 if (s_Face) 14 { 15 DoFacePanel(); 16 } 17 18 EndPanel(); 19 20 s_DebugExtended = BeginPanel("Debug Settings", s_DebugExtended); 21 if (s_DebugExtended) 22 { 23 DoDebugPanel(); 24 } 25 26 EndPanel(); 27 } 28 29 void DoFacePanel() 30 { 31 EditorGUI.indentLevel += 1; 32 if (m_Material.HasProperty(ShaderUtilities.ID_FaceTex)) 33 { 34 DoColor("_FaceColor", "Color"); 35 DoTexture2D("_FaceTex", "Texture", true); 36 } 37 else 38 { 39 DoColor("_Color", "Color"); 40 DoSlider("_DiffusePower", "Diffuse Power"); 41 } 42 43 EditorGUI.indentLevel -= 1; 44 45 EditorGUILayout.Space(); 46 } 47 48 void DoDebugPanel() 49 { 50 EditorGUI.indentLevel += 1; 51 DoTexture2D("_MainTex", "Font Atlas"); 52 if (m_Material.HasProperty(ShaderUtilities.ID_VertexOffsetX)) 53 { 54 if (m_Material.HasProperty(ShaderUtilities.ID_Padding)) 55 { 56 EditorGUILayout.Space(); 57 DoFloat("_Padding", "Padding"); 58 } 59 60 EditorGUILayout.Space(); 61 DoFloat("_VertexOffsetX", "Offset X"); 62 DoFloat("_VertexOffsetY", "Offset Y"); 63 } 64 65 if (m_Material.HasProperty(ShaderUtilities.ID_MaskSoftnessX)) 66 { 67 EditorGUILayout.Space(); 68 DoFloat("_MaskSoftnessX", "Softness X"); 69 DoFloat("_MaskSoftnessY", "Softness Y"); 70 DoVector("_ClipRect", "Clip Rect", s_LbrtVectorLabels); 71 } 72 73 if (m_Material.HasProperty(ShaderUtilities.ID_StencilID)) 74 { 75 EditorGUILayout.Space(); 76 DoFloat("_Stencil", "Stencil ID"); 77 DoFloat("_StencilComp", "Stencil Comp"); 78 } 79 80 if (m_Material.HasProperty(ShaderUtilities.ShaderTag_CullMode)) 81 { 82 EditorGUILayout.Space(); 83 DoPopup("_CullMode", "Cull Mode", s_CullingTypeLabels); 84 } 85 86 EditorGUILayout.Space(); 87 88 EditorGUI.indentLevel -= 1; 89 90 EditorGUILayout.Space(); 91 } 92 } 93}