@@ -28,6 +28,7 @@ public abstract class Tree<TNode, TData>: TreeBase<TNode, TData>
2828 [ NonSerialized ] private TNode rightClickNextRenderNode ;
2929
3030 [ NonSerialized ] private int controlId ;
31+ [ NonSerialized ] private bool isBusy ;
3132
3233 public bool IsInitialized { get { return Nodes != null && Nodes . Count > 0 && ! String . IsNullOrEmpty ( Nodes [ 0 ] . Path ) ; } }
3334 public bool RequiresRepaint { get ; private set ; }
@@ -75,7 +76,7 @@ public Rect Render(Rect treeDisplayRect, Vector2 scroll, Action<TNode> singleCli
7576 if ( titleDisplay )
7677 {
7778 var isSelected = SelectedNode != null && SelectedNode . Path == titleNode . Path ;
78- renderResult = titleNode . Render ( rect , Styles . TreeIndentation , isSelected , FolderStyle , treeNodeStyle , activeTreeNodeStyle ) ;
79+ renderResult = titleNode . Render ( rect , Styles . TreeIndentation , isSelected , IsBusy , FolderStyle , treeNodeStyle , activeTreeNodeStyle ) ;
7980 }
8081
8182 if ( renderResult == TreeNodeRenderResult . VisibilityChange )
@@ -109,7 +110,7 @@ public Rect Render(Rect treeDisplayRect, Vector2 scroll, Action<TNode> singleCli
109110 if ( display )
110111 {
111112 var isSelected = SelectedNode != null && SelectedNode . Path == node . Path ;
112- renderResult = node . Render ( rect , Styles . TreeIndentation , isSelected , FolderStyle , treeNodeStyle , activeTreeNodeStyle ) ;
113+ renderResult = node . Render ( rect , Styles . TreeIndentation , isSelected , IsBusy , FolderStyle , treeNodeStyle , activeTreeNodeStyle ) ;
113114 }
114115
115116 if ( renderResult == TreeNodeRenderResult . VisibilityChange )
@@ -153,6 +154,12 @@ protected bool TreeHasFocus
153154
154155 public abstract bool ViewHasFocus { get ; set ; }
155156
157+ public bool IsBusy
158+ {
159+ get { return isBusy ; }
160+ set { isBusy = value ; }
161+ }
162+
156163 public void Focus ( )
157164 {
158165 bool selectionChanged = false ;
@@ -406,10 +413,15 @@ public void Load()
406413 content = new GUIContent ( Label , Icon ) ;
407414 }
408415
409- public TreeNodeRenderResult Render ( Rect rect , float indentation , bool isSelected , GUIStyle toggleStyle , GUIStyle nodeStyle , GUIStyle activeNodeStyle )
416+ public TreeNodeRenderResult Render ( Rect rect , float indentation , bool isSelected , bool treeIsBusy , GUIStyle toggleStyle , GUIStyle nodeStyle , GUIStyle activeNodeStyle )
410417 {
411418 var renderResult = TreeNodeRenderResult . None ;
412419
420+ if ( treeIsBusy )
421+ {
422+ GUI . enabled = false ;
423+ }
424+
413425 if ( IsHidden )
414426 return renderResult ;
415427
@@ -500,6 +512,11 @@ public TreeNodeRenderResult Render(Rect rect, float indentation, bool isSelected
500512 GUI . DrawTexture ( statusRect , IconBadge ) ;
501513 }
502514
515+ if ( treeIsBusy )
516+ {
517+ GUI . enabled = true ;
518+ }
519+
503520 return renderResult ;
504521 }
505522
0 commit comments