Merge branch 'add-root-tree-line-option' of https://github.com/Tryibion/FlaxEngine into Tryibion-add-root-tree-line-option
This commit is contained in:
@@ -67,6 +67,11 @@ namespace FlaxEditor.GUI.Tree
|
||||
/// Gets the first selected node or null.
|
||||
/// </summary>
|
||||
public TreeNode SelectedNode => Selection.Count > 0 ? Selection[0] : null;
|
||||
|
||||
/// <summary>
|
||||
/// Allow nodes to Draw the root tree line.
|
||||
/// </summary>
|
||||
public bool DrawRootTreeLine = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the margin for the child tree nodes.
|
||||
|
||||
@@ -762,7 +762,7 @@ namespace FlaxEditor.GUI.Tree
|
||||
{
|
||||
TreeNode parentNode = Parent as TreeNode;
|
||||
bool thisNodeIsLast = false;
|
||||
while (parentNode != null && parentNode != ParentTree.Children[0])
|
||||
while (parentNode != null && (parentNode != ParentTree.Children[0] || _tree.DrawRootTreeLine))
|
||||
{
|
||||
float bottomOffset = 0;
|
||||
float topOffset = 0;
|
||||
@@ -773,7 +773,7 @@ namespace FlaxEditor.GUI.Tree
|
||||
if (thisNodeIsLast && parentNode.Children.Count == 1)
|
||||
bottomOffset = topOffset != 0 ? 4 : 2;
|
||||
|
||||
if (Parent == parentNode && this == Parent.Children[Parent.Children.Count - 1] && !_opened)
|
||||
if (Parent == parentNode && this == Parent.Children[^1] && !_opened)
|
||||
{
|
||||
thisNodeIsLast = true;
|
||||
bottomOffset = topOffset != 0 ? 4 : 2;
|
||||
|
||||
@@ -56,6 +56,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
public PrefabTree()
|
||||
: base(true)
|
||||
{
|
||||
DrawRootTreeLine = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ namespace FlaxEditor.Windows
|
||||
{
|
||||
Margin = new Margin(0.0f, 0.0f, -16.0f, _sceneTreePanel.ScrollBarsSize), // Hide root node
|
||||
IsScrollable = true,
|
||||
DrawRootTreeLine = false,
|
||||
};
|
||||
_tree.AddChild(root.TreeNode);
|
||||
_tree.SelectedChanged += Tree_OnSelectedChanged;
|
||||
|
||||
Reference in New Issue
Block a user