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.

569 lines
19 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. using System;
  6. using System.Collections.Generic;
  7. namespace AmplifyShaderEditor
  8. {
  9. public enum ToolButtonType
  10. {
  11. Update = 0,
  12. Live,
  13. OpenSourceCode,
  14. CleanUnusedNodes,
  15. //SelectShader,
  16. New,
  17. Open,
  18. Save,
  19. Library,
  20. Options,
  21. Help,
  22. MasterNode,
  23. FocusOnMasterNode,
  24. FocusOnSelection,
  25. ShowInfoWindow,
  26. ShowTipsWindow,
  27. ShowConsole
  28. }
  29. public enum ToolbarType
  30. {
  31. File,
  32. Help
  33. }
  34. public class ToolbarMenuTab
  35. {
  36. private Rect m_tabArea;
  37. private GenericMenu m_tabMenu;
  38. public ToolbarMenuTab( float x, float y, float width, float height )
  39. {
  40. m_tabMenu = new GenericMenu();
  41. m_tabArea = new Rect( x, y, width, height );
  42. }
  43. public void ShowMenu()
  44. {
  45. m_tabMenu.DropDown( m_tabArea );
  46. }
  47. public void AddItem( string itemName, GenericMenu.MenuFunction callback )
  48. {
  49. m_tabMenu.AddItem( new GUIContent( itemName ), false, callback );
  50. }
  51. }
  52. [Serializable]
  53. public sealed class ToolsWindow : MenuParent
  54. {
  55. private static readonly Color RightIconsColorOff = new Color( 1f, 1f, 1f, 0.8f );
  56. private static readonly Color LeftIconsColorOff = new Color( 1f, 1f, 1f, 0.5f );
  57. private static readonly Color RightIconsColorOn = new Color( 1f, 1f, 1f, 1.0f );
  58. private static readonly Color LeftIconsColorOn = new Color( 1f, 1f, 1f, 0.8f );
  59. private const float TabY = 9;
  60. private const float TabX = 5;
  61. private const string ShaderFileTitleStr = "Current Shader";
  62. private const string FileToolbarStr = "File";
  63. private const string HelpToolbarStr = "Help";
  64. private const string LiveShaderStr = "Live Shader";
  65. private const string LoadOnSelectionStr = "Load on selection";
  66. private const string CurrentObjectStr = "Current Object: ";
  67. public ToolsMenuButton.ToolButtonPressed ToolButtonPressedEvt;
  68. //private GUIStyle m_toolbarButtonStyle;
  69. private GUIStyle m_toggleStyle;
  70. private GUIStyle m_borderStyle;
  71. private ToolsMenuButton m_updateButton;
  72. private ToolsMenuButton m_liveButton;
  73. private ToolsMenuButton m_openSourceCodeButton;
  74. private ToolsMenuButton m_focusOnSelectionButton;
  75. private ToolsMenuButton m_focusOnMasterNodeButton;
  76. private ToolsMenuButton m_showInfoWindowButton;
  77. private ToolsMenuButton m_showTipsWindowButton;
  78. private ToolsMenuButton m_cleanUnusedNodesButton;
  79. private ToolsMenuButton m_showConsoleWindowButton;
  80. //Used for collision detection to invalidate inputs on graph area
  81. private Rect m_areaLeft = new Rect( 0, 0, 140, 40 );
  82. private Rect m_areaRight = new Rect( 0, 0, 75, 40 );
  83. private Rect m_boxRect;
  84. private Rect m_borderRect;
  85. public const double InactivityRefreshTime = 0.25;
  86. private int m_currentSelected = 0;
  87. //Search Bar
  88. private const string SearchBarId = "ASE_SEARCH_BAR";
  89. private bool m_searchBarVisible = false;
  90. private bool m_selectSearchBarTextfield = false;
  91. private bool m_refreshSearchResultList = false;
  92. private Rect m_searchBarSize;
  93. private string m_searchBarValue = string.Empty;
  94. private List<ParentNode> m_searchResultNodes = new List<ParentNode>();
  95. // width and height are between [0,1] and represent a percentage of the total screen area
  96. public ToolsWindow( AmplifyShaderEditorWindow parentWindow ) : base( parentWindow, 0, 0, 0, 64, "Tools", MenuAnchor.TOP_LEFT, MenuAutoSize.NONE )
  97. {
  98. m_updateButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.Update, 0, 0, -1, -1, IOUtils.UpdateOutdatedGUID, string.Empty, "Create and apply shader to material.", 5 );
  99. m_updateButton.ToolButtonPressedEvt += OnButtonPressedEvent;
  100. m_updateButton.AddState( IOUtils.UpdateOFFGUID );
  101. m_updateButton.AddState( IOUtils.UpdateUpToDatedGUID );
  102. m_liveButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.Live, 0, 0, -1, -1, IOUtils.LiveOffGUID, string.Empty, "Automatically saves shader when canvas is changed.", 50 );
  103. m_liveButton.ToolButtonPressedEvt += OnButtonPressedEvent;
  104. m_liveButton.AddState( IOUtils.LiveOnGUID );
  105. m_liveButton.AddState( IOUtils.LivePendingGUID );
  106. //ToolsMenuButton cleanUnusedNodesButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.CleanUnusedNodes, 0, 0, -1, -1, IOUtils.CleanupOFFGUID, string.Empty, "Remove all nodes not connected to the master node.", 77 );
  107. //cleanUnusedNodesButton.ToolButtonPressedEvt += OnButtonPressedEvent;
  108. //cleanUnusedNodesButton.AddState( IOUtils.CleanUpOnGUID );
  109. //m_list[ ( int ) ToolButtonType.CleanUnusedNodes ] = cleanUnusedNodesButton;
  110. m_openSourceCodeButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.OpenSourceCode, 0, 0, -1, -1, IOUtils.OpenSourceCodeOFFGUID, string.Empty, "Open shader file in your default shader editor.", 80, false );
  111. m_openSourceCodeButton.ToolButtonPressedEvt += OnButtonPressedEvent;
  112. m_openSourceCodeButton.AddState( IOUtils.OpenSourceCodeONGUID );
  113. m_cleanUnusedNodesButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.CleanUnusedNodes, 0, 0, -1, -1, IOUtils.CleanupOFFGUID, string.Empty, "Remove all nodes not connected to the master node.", 77 );
  114. m_cleanUnusedNodesButton.ToolButtonPressedEvt += OnButtonPressedEvent;
  115. m_cleanUnusedNodesButton.AddState( IOUtils.CleanUpOnGUID );
  116. m_showConsoleWindowButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.ShowConsole, 0, 0, -1, -1, IOUtils.ShowConsoleWindowGUID, string.Empty, "Show internal console", 74 );
  117. m_showConsoleWindowButton.ToolButtonPressedEvt += OnButtonPressedEvent;
  118. m_showConsoleWindowButton.AddState( IOUtils.ShowConsoleWindowGUID );
  119. m_focusOnMasterNodeButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.FocusOnMasterNode, 0, 0, -1, -1, IOUtils.FocusNodeGUID, string.Empty, "Focus on active master node.", -1, false );
  120. m_focusOnMasterNodeButton.ToolButtonPressedEvt += OnButtonPressedEvent;
  121. m_focusOnSelectionButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.FocusOnSelection, 0, 0, -1, -1, IOUtils.FitViewGUID, string.Empty, "Focus on selection or fit to screen if none selected." );
  122. m_focusOnSelectionButton.ToolButtonPressedEvt += OnButtonPressedEvent;
  123. m_showInfoWindowButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.ShowInfoWindow, 0, 0, -1, -1, IOUtils.ShowInfoWindowGUID, string.Empty, "Open Helper Window." );
  124. m_showInfoWindowButton.ToolButtonPressedEvt += OnButtonPressedEvent;
  125. m_showTipsWindowButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.ShowTipsWindow, 0, 0, -1, -1, IOUtils.ShowTipsWindowGUID, string.Empty, "Open Quick Tips!" );
  126. m_showTipsWindowButton.ToolButtonPressedEvt += OnButtonPressedEvent;
  127. m_searchBarSize = new Rect( 0, TabY + 4, 110, 60 );
  128. }
  129. void OnShowPortLegend()
  130. {
  131. ParentWindow.ShowPortInfo();
  132. }
  133. override public void Destroy()
  134. {
  135. base.Destroy();
  136. //for ( int i = 0; i < m_list.Length; i++ )
  137. //{
  138. // m_list[ i ].Destroy();
  139. //}
  140. //m_list = null;
  141. m_searchResultNodes.Clear();
  142. m_searchResultNodes = null;
  143. m_updateButton.Destroy();
  144. m_updateButton = null;
  145. m_liveButton.Destroy();
  146. m_liveButton = null;
  147. m_openSourceCodeButton.Destroy();
  148. m_openSourceCodeButton = null;
  149. m_focusOnMasterNodeButton.Destroy();
  150. m_focusOnMasterNodeButton = null;
  151. m_focusOnSelectionButton.Destroy();
  152. m_focusOnSelectionButton = null;
  153. m_showInfoWindowButton.Destroy();
  154. m_showInfoWindowButton = null;
  155. m_showTipsWindowButton.Destroy();
  156. m_showTipsWindowButton = null;
  157. m_cleanUnusedNodesButton.Destroy();
  158. m_cleanUnusedNodesButton = null;
  159. m_showConsoleWindowButton.Destroy();
  160. m_showConsoleWindowButton = null;
  161. }
  162. void OnButtonPressedEvent( ToolButtonType type )
  163. {
  164. if ( ToolButtonPressedEvt != null )
  165. ToolButtonPressedEvt( type );
  166. }
  167. public override void Draw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus )
  168. {
  169. base.Draw( parentPosition, mousePosition, mouseButtonId, hasKeyboadFocus );
  170. Color bufferedColor = GUI.color;
  171. m_areaLeft.x = m_transformedArea.x + TabX;
  172. m_areaRight.x = m_transformedArea.x + m_transformedArea.width - 75 - TabX;
  173. //if ( m_toolbarButtonStyle == null )
  174. //{
  175. // m_toolbarButtonStyle = new GUIStyle( UIUtils.Button );
  176. // m_toolbarButtonStyle.fixedWidth = 100;
  177. //}
  178. if ( m_toggleStyle == null )
  179. {
  180. m_toggleStyle = UIUtils.Toggle;
  181. }
  182. //for ( int i = 0; i < m_list.Length; i++ )
  183. //{
  184. // GUI.color = m_list[ i ].IsInside( mousePosition ) ? LeftIconsColorOn : LeftIconsColorOff;
  185. // m_list[ i ].Draw( TabX + m_transformedArea.x + m_list[ i ].ButtonSpacing, TabY );
  186. //}
  187. GUI.color = m_updateButton.IsInside( mousePosition ) ? LeftIconsColorOn : LeftIconsColorOff;
  188. m_updateButton.Draw( TabX + m_transformedArea.x + m_updateButton.ButtonSpacing, TabY );
  189. GUI.color = m_liveButton.IsInside( mousePosition ) ? LeftIconsColorOn : LeftIconsColorOff;
  190. m_liveButton.Draw( TabX + m_transformedArea.x + m_liveButton.ButtonSpacing, TabY );
  191. GUI.color = m_openSourceCodeButton.IsInside( mousePosition ) ? LeftIconsColorOn : LeftIconsColorOff;
  192. m_openSourceCodeButton.Draw( TabX + m_transformedArea.x + m_openSourceCodeButton.ButtonSpacing, TabY );
  193. if ( m_searchBarVisible )
  194. {
  195. m_searchBarSize.x = m_transformedArea.x + m_transformedArea.width - 270 - TabX;
  196. string currentFocus = GUI.GetNameOfFocusedControl();
  197. if ( Event.current.type == EventType.KeyDown )
  198. {
  199. KeyCode keyCode = Event.current.keyCode;
  200. if ( Event.current.shift )
  201. {
  202. if ( keyCode == KeyCode.F3 ||
  203. ( ( keyCode == KeyCode.KeypadEnter || keyCode == KeyCode.Return ) &&
  204. ( currentFocus.Equals( SearchBarId ) || string.IsNullOrEmpty( currentFocus ) ) ) )
  205. SelectPrevious();
  206. }
  207. else
  208. {
  209. if ( keyCode == KeyCode.F3 ||
  210. ( ( keyCode == KeyCode.KeypadEnter || keyCode == KeyCode.Return ) &&
  211. ( currentFocus.Equals( SearchBarId ) || string.IsNullOrEmpty( currentFocus ) ) ) )
  212. SelectNext();
  213. }
  214. }
  215. if( currentFocus.Equals( SearchBarId ) || ( m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.MouseDown && m_searchBarSize.Contains( m_parentWindow.CameraDrawInfo.MousePosition ) ) || m_selectSearchBarTextfield )
  216. {
  217. EditorGUI.BeginChangeCheck();
  218. {
  219. GUI.SetNextControlName( SearchBarId );
  220. m_searchBarValue = EditorGUI.TextField( m_searchBarSize, m_searchBarValue, UIUtils.ToolbarSearchTextfield );
  221. }
  222. if ( EditorGUI.EndChangeCheck() )
  223. {
  224. m_refreshSearchResultList = true;
  225. }
  226. } else
  227. {
  228. GUI.Label( m_searchBarSize, m_searchBarValue, UIUtils.ToolbarSearchTextfield );
  229. }
  230. m_searchBarSize.x += m_searchBarSize.width;
  231. if ( m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.MouseDown && m_searchBarSize.Contains( m_parentWindow.CameraDrawInfo.MousePosition ) )
  232. {
  233. if ( string.IsNullOrEmpty( m_searchBarValue ) )
  234. {
  235. m_searchBarVisible = false;
  236. m_refreshSearchResultList = false;
  237. }
  238. else
  239. {
  240. m_searchBarValue = string.Empty;
  241. m_searchResultNodes.Clear();
  242. m_currentSelected = -1;
  243. }
  244. }
  245. GUI.Label( m_searchBarSize, string.Empty, UIUtils.ToolbarSearchCancelButton );
  246. if ( Event.current.isKey && Event.current.keyCode == KeyCode.Escape )
  247. {
  248. m_searchBarVisible = false;
  249. m_refreshSearchResultList = false;
  250. GUI.FocusControl( null );
  251. m_selectSearchBarTextfield = false;
  252. }
  253. if ( m_refreshSearchResultList && ( m_parentWindow.CurrentInactiveTime > InactivityRefreshTime ) )
  254. {
  255. RefreshList();
  256. }
  257. }
  258. if ( m_selectSearchBarTextfield )
  259. {
  260. m_selectSearchBarTextfield = false;
  261. EditorGUI.FocusTextInControl( SearchBarId );
  262. //GUI.FocusControl( SearchBarId );
  263. }
  264. //if ( Event.current.control && Event.current.isKey && Event.current.keyCode == KeyCode.F && Event.current.type == EventType.KeyDown )
  265. if( m_parentWindow.CurrentCommandName.Equals("Find") )
  266. {
  267. if ( !m_searchBarVisible )
  268. {
  269. m_searchBarVisible = true;
  270. m_refreshSearchResultList = false;
  271. }
  272. m_selectSearchBarTextfield = true;
  273. }
  274. GUI.color = m_focusOnSelectionButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff;
  275. m_focusOnSelectionButton.Draw( m_transformedArea.x + m_transformedArea.width - 30 - TabX, TabY );
  276. GUI.color = m_focusOnMasterNodeButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff;
  277. m_focusOnMasterNodeButton.Draw( m_transformedArea.x + m_transformedArea.width - 65 - TabX, TabY );
  278. GUI.color = m_showInfoWindowButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff;
  279. m_showInfoWindowButton.Draw( m_transformedArea.x + m_transformedArea.width - 110 - TabX, TabY );
  280. //GUI.color = m_showTipsWindowButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff;
  281. //m_showTipsWindowButton.Draw( m_transformedArea.x + m_transformedArea.width - 140 - TabX, TabY );
  282. GUI.color = m_cleanUnusedNodesButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff;
  283. m_cleanUnusedNodesButton.Draw( m_transformedArea.x + m_transformedArea.width - 140 - TabX, TabY );
  284. GUI.color = bufferedColor;
  285. //GUI.color = m_showConsoleWindowButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff;
  286. //m_showConsoleWindowButton.Draw( m_transformedArea.x + m_transformedArea.width - 170 - TabX, TabY );
  287. //GUI.color = bufferedColor;
  288. }
  289. public void OnNodeRemovedFromGraph( ParentNode node )
  290. {
  291. m_searchResultNodes.Remove( node );
  292. }
  293. int m_previousNodeCount = 0;
  294. void RefreshList()
  295. {
  296. m_refreshSearchResultList = false;
  297. m_currentSelected = -1;
  298. m_searchResultNodes.Clear();
  299. if ( !string.IsNullOrEmpty( m_searchBarValue ) )
  300. {
  301. List<ParentNode> nodes = m_parentWindow.CurrentGraph.AllNodes;
  302. int count = nodes.Count;
  303. m_previousNodeCount = count;
  304. for ( int i = 0; i < count; i++ )
  305. {
  306. if ( nodes[ i ].TitleContent.text.IndexOf( m_searchBarValue, StringComparison.CurrentCultureIgnoreCase ) >= 0 )
  307. {
  308. m_searchResultNodes.Add( nodes[ i ] );
  309. }
  310. }
  311. }
  312. }
  313. void SelectNext()
  314. {
  315. if ( m_refreshSearchResultList || m_parentWindow.CurrentGraph.AllNodes.Count != m_previousNodeCount )
  316. {
  317. RefreshList();
  318. }
  319. if ( m_searchResultNodes.Count > 0 )
  320. {
  321. m_currentSelected = ( m_currentSelected + 1 ) % m_searchResultNodes.Count;
  322. m_parentWindow.FocusOnNode( m_searchResultNodes[ m_currentSelected ], 1, true ,true);
  323. }
  324. }
  325. void SelectPrevious()
  326. {
  327. if ( m_refreshSearchResultList || m_parentWindow.CurrentGraph.AllNodes.Count != m_previousNodeCount )
  328. {
  329. RefreshList();
  330. }
  331. if ( m_searchResultNodes.Count > 0 )
  332. {
  333. m_currentSelected = ( m_currentSelected > 1 ) ? ( m_currentSelected - 1 ) : ( m_searchResultNodes.Count - 1 );
  334. m_parentWindow.FocusOnNode( m_searchResultNodes[ m_currentSelected ], 1, true );
  335. }
  336. }
  337. public void SetStateOnButton( ToolButtonType button, int state, string tooltip )
  338. {
  339. switch ( button )
  340. {
  341. case ToolButtonType.New:
  342. case ToolButtonType.Open:
  343. case ToolButtonType.Save:
  344. case ToolButtonType.Library:
  345. case ToolButtonType.Options:
  346. case ToolButtonType.Help:
  347. case ToolButtonType.MasterNode: break;
  348. case ToolButtonType.OpenSourceCode:
  349. {
  350. m_openSourceCodeButton.SetStateOnButton( state, tooltip );
  351. }
  352. break;
  353. case ToolButtonType.Update:
  354. {
  355. m_updateButton.SetStateOnButton( state, tooltip );
  356. }
  357. break;
  358. case ToolButtonType.Live:
  359. {
  360. m_liveButton.SetStateOnButton( state, tooltip );
  361. }
  362. break;
  363. case ToolButtonType.CleanUnusedNodes:
  364. //case eToolButtonType.SelectShader:
  365. {
  366. m_cleanUnusedNodesButton.SetStateOnButton( state, tooltip );
  367. }
  368. break;
  369. case ToolButtonType.FocusOnMasterNode:
  370. {
  371. m_focusOnMasterNodeButton.SetStateOnButton( state, tooltip );
  372. }
  373. break;
  374. case ToolButtonType.FocusOnSelection:
  375. {
  376. m_focusOnSelectionButton.SetStateOnButton( state, tooltip );
  377. }
  378. break;
  379. case ToolButtonType.ShowInfoWindow:
  380. {
  381. m_showInfoWindowButton.SetStateOnButton( state, tooltip );
  382. }
  383. break;
  384. case ToolButtonType.ShowTipsWindow:
  385. {
  386. m_showTipsWindowButton.SetStateOnButton( state, tooltip );
  387. }
  388. break;
  389. case ToolButtonType.ShowConsole:
  390. {
  391. m_showConsoleWindowButton.SetStateOnButton( state, tooltip );
  392. }
  393. break;
  394. }
  395. }
  396. public void SetStateOnButton( ToolButtonType button, int state )
  397. {
  398. switch ( button )
  399. {
  400. case ToolButtonType.New:
  401. case ToolButtonType.Open:
  402. case ToolButtonType.Save:
  403. case ToolButtonType.Library:
  404. case ToolButtonType.Options:
  405. case ToolButtonType.Help:
  406. case ToolButtonType.MasterNode: break;
  407. case ToolButtonType.OpenSourceCode:
  408. {
  409. m_openSourceCodeButton.SetStateOnButton( state );
  410. }
  411. break;
  412. case ToolButtonType.Update:
  413. {
  414. m_updateButton.SetStateOnButton( state );
  415. }
  416. break;
  417. case ToolButtonType.Live:
  418. {
  419. m_liveButton.SetStateOnButton( state );
  420. }
  421. break;
  422. case ToolButtonType.CleanUnusedNodes:
  423. //case eToolButtonType.SelectShader:
  424. {
  425. m_cleanUnusedNodesButton.SetStateOnButton( state );
  426. }
  427. break;
  428. case ToolButtonType.FocusOnMasterNode:
  429. {
  430. m_focusOnMasterNodeButton.SetStateOnButton( state );
  431. }
  432. break;
  433. case ToolButtonType.FocusOnSelection:
  434. {
  435. m_focusOnSelectionButton.SetStateOnButton( state );
  436. }
  437. break;
  438. case ToolButtonType.ShowInfoWindow:
  439. {
  440. m_showInfoWindowButton.SetStateOnButton( state );
  441. }
  442. break;
  443. case ToolButtonType.ShowTipsWindow:
  444. {
  445. m_showTipsWindowButton.SetStateOnButton( state );
  446. }break;
  447. case ToolButtonType.ShowConsole:
  448. {
  449. m_showConsoleWindowButton.SetStateOnButton( state );
  450. }
  451. break;
  452. }
  453. }
  454. public void DrawShaderTitle( MenuParent nodeParametersWindow, MenuParent paletteWindow, float availableCanvasWidth, float graphAreaHeight, string shaderName )
  455. {
  456. float leftAdjust = nodeParametersWindow.IsMaximized ? nodeParametersWindow.RealWidth : 0;
  457. float rightAdjust = paletteWindow.IsMaximized ? 0 : paletteWindow.RealWidth;
  458. m_boxRect = new Rect( leftAdjust + rightAdjust, 0, availableCanvasWidth, 35 );
  459. m_boxRect.x += paletteWindow.IsMaximized ? 0 : -paletteWindow.RealWidth;
  460. m_boxRect.width += nodeParametersWindow.IsMaximized ? 0 : nodeParametersWindow.RealWidth;
  461. m_boxRect.width += paletteWindow.IsMaximized ? 0 : paletteWindow.RealWidth;
  462. m_borderRect = new Rect( m_boxRect );
  463. m_borderRect.height = graphAreaHeight;
  464. if ( m_borderStyle == null )
  465. {
  466. m_borderStyle = ( ParentWindow.CurrentGraph.CurrentMasterNode == null ) ? UIUtils.GetCustomStyle( CustomStyle.ShaderFunctionBorder ) : UIUtils.GetCustomStyle( CustomStyle.ShaderBorder );
  467. }
  468. GUI.Label( m_borderRect, shaderName, m_borderStyle );
  469. GUI.Label( m_boxRect, shaderName, UIUtils.GetCustomStyle( CustomStyle.MainCanvasTitle ) );
  470. }
  471. public override bool IsInside( Vector2 position )
  472. {
  473. if ( !m_isActive )
  474. return false;
  475. return m_boxRect.Contains( position ) || m_areaLeft.Contains( position ) || m_areaRight.Contains( position );
  476. }
  477. public GUIStyle BorderStyle
  478. {
  479. get { return m_borderStyle; }
  480. set { m_borderStyle = value; }
  481. }
  482. }
  483. }