You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.4 KiB

  1. // Amplify Shader Editor - Visual Shader Editing Tool
  2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
  3. using UnityEngine;
  4. using UnityEditor;
  5. namespace AmplifyShaderEditor
  6. {
  7. public sealed class ToolsMenuButtonSep : ToolsMenuButtonParent
  8. {
  9. private Color m_splitterColor = EditorGUIUtility.isProSkin ? new Color( 0.157f, 0.157f, 0.157f ) : new Color( 0.5f, 0.5f, 0.5f );
  10. [SerializeField]
  11. private GUIStyle m_sepStyle;
  12. public ToolsMenuButtonSep( AmplifyShaderEditorWindow parentWindow = null, string text = null, string tooltip = null, float buttonSpacing = -1 ) : base( parentWindow, text, tooltip, buttonSpacing ) { }
  13. public override void Draw()
  14. {
  15. base.Draw();
  16. if ( m_sepStyle == null )
  17. {
  18. m_sepStyle = new GUIStyle();
  19. m_sepStyle.normal.background = Texture2D.whiteTexture;
  20. m_sepStyle.hover.background = Texture2D.whiteTexture;
  21. m_sepStyle.active.background = Texture2D.whiteTexture;
  22. m_sepStyle.onNormal.background = Texture2D.whiteTexture;
  23. m_sepStyle.onHover.background = Texture2D.whiteTexture;
  24. m_sepStyle.onActive.background = Texture2D.whiteTexture;
  25. m_sepStyle.stretchHeight = true;
  26. }
  27. Color originalColor = GUI.color;
  28. GUI.color = m_splitterColor;
  29. GUILayout.Box( string.Empty, m_sepStyle, GUILayout.MaxWidth( 2 ), GUILayout.ExpandHeight( true ) );
  30. GUI.color = originalColor;
  31. }
  32. public override void Destroy()
  33. {
  34. m_sepStyle = null;
  35. }
  36. }
  37. }