Merge remote-tracking branch 'origin/master' into 1.5

# Conflicts:
#	Source/Engine/Content/JsonAsset.cpp
This commit is contained in:
Wojciech Figat
2022-10-19 13:36:46 +02:00
32 changed files with 362 additions and 98 deletions

View File

@@ -7,6 +7,7 @@ using FlaxEditor.CustomEditors;
using FlaxEditor.CustomEditors.Editors;
using FlaxEditor.CustomEditors.Elements;
using FlaxEditor.GUI;
using FlaxEditor.GUI.Tree;
using FlaxEditor.Viewport.Cameras;
using FlaxEditor.Viewport.Previews;
using FlaxEngine;
@@ -166,8 +167,21 @@ namespace FlaxEditor.Windows.Assets
var proxy = (PropertiesProxy)Values[0];
int nodeIndex = (int)checkBox.Tag;
proxy.NodesMask[nodeIndex] = checkBox.Checked;
if (Input.GetKey(KeyboardKeys.Shift))
SetTreeChecked(checkBox.Parent as TreeNode, checkBox.Checked);
proxy.Window.MarkAsEdited();
}
private void SetTreeChecked(TreeNode tree, bool state)
{
foreach (var node in tree.Children)
{
if (node is TreeNode treeNode)
SetTreeChecked(treeNode, state);
else if (node is CheckBox checkBox)
checkBox.Checked = state;
}
}
}
}

View File

@@ -27,6 +27,8 @@ namespace FlaxEditor.Windows
private const string ProjectDataLastViewedFolder = "LastViewedFolder";
private bool _isWorkspaceDirty;
private SplitPanel _split;
private Panel _contentViewPanel;
private Panel _contentTreePanel;
private ContentView _view;
private readonly ToolStrip _toolStrip;
@@ -95,7 +97,7 @@ namespace FlaxEditor.Windows
};
// Split panel
_split = new SplitPanel(options.Options.Interface.ContentWindowOrientation, ScrollBars.Both, ScrollBars.Vertical)
_split = new SplitPanel(options.Options.Interface.ContentWindowOrientation, ScrollBars.None, ScrollBars.None)
{
AnchorPreset = AnchorPresets.StretchAll,
Offsets = new Margin(0, 0, _toolStrip.Bottom, 0),
@@ -120,11 +122,20 @@ namespace FlaxEditor.Windows
};
_foldersSearchBox.TextChanged += OnFoldersSearchBoxTextChanged;
// Content tree panel
_contentTreePanel = new Panel
{
AnchorPreset = AnchorPresets.StretchAll,
Offsets = new Margin(0, 0, headerPanel.Bottom, 0),
IsScrollable = true,
ScrollBars = ScrollBars.Both,
Parent = _split.Panel1,
};
// Content structure tree
_tree = new Tree(false)
{
Y = headerPanel.Bottom,
Parent = _split.Panel1,
Parent = _contentTreePanel,
};
_tree.SelectedChanged += OnTreeSelectionChanged;
headerPanel.Parent = _split.Panel1;
@@ -159,13 +170,23 @@ namespace FlaxEditor.Windows
_viewDropdown.Items.Add(((ContentItemSearchFilter)i).ToString());
_viewDropdown.PopupCreate += OnViewDropdownPopupCreate;
// Content view panel
_contentViewPanel = new Panel
{
AnchorPreset = AnchorPresets.StretchAll,
Offsets = new Margin(0, 0, contentItemsSearchPanel.Bottom + 4, 0),
IsScrollable = true,
ScrollBars = ScrollBars.Vertical,
Parent = _split.Panel2,
};
// Content View
_view = new ContentView
{
AnchorPreset = AnchorPresets.HorizontalStretchTop,
Offsets = new Margin(0, 0, contentItemsSearchPanel.Bottom + 4, 0),
Offsets = new Margin(0, 0, 0, 0),
IsScrollable = true,
Parent = _split.Panel2,
Parent = _contentViewPanel,
};
_view.OnOpen += Open;
_view.OnNavigateBack += NavigateBackward;
@@ -271,6 +292,30 @@ namespace FlaxEditor.Windows
RefreshView(SelectedNode);
}
/// <summary>
/// Enables or disables vertical and horizontal scrolling on the content tree panel
/// </summary>
/// <param name="enabled">The state to set scrolling to</param>
public void ScrollingOnTreeView(bool enabled)
{
if (_contentTreePanel.VScrollBar != null)
_contentTreePanel.VScrollBar.ThumbEnabled = enabled;
if (_contentTreePanel.HScrollBar != null)
_contentTreePanel.HScrollBar.ThumbEnabled = enabled;
}
/// <summary>
/// Enables or disables vertical and horizontal scrolling on the content view panel
/// </summary>
/// <param name="enabled">The state to set scrolling to</param>
public void ScrollingOnContentView(bool enabled)
{
if (_contentViewPanel.VScrollBar != null)
_contentViewPanel.VScrollBar.ThumbEnabled = enabled;
if (_contentViewPanel.HScrollBar != null)
_contentViewPanel.HScrollBar.ThumbEnabled = enabled;
}
/// <summary>
/// Shows popup dialog with UI to rename content item.
/// </summary>
@@ -285,6 +330,7 @@ namespace FlaxEditor.Windows
_split.Panel2.VScrollBar.ThumbEnabled = false;
if (_split.Panel2.HScrollBar != null)
_split.Panel2.HScrollBar.ThumbEnabled = false;
ScrollingOnContentView(false);
// Show rename popup
var popup = RenamePopup.Show(item, item.TextRectangle, item.ShortName, true);
@@ -298,6 +344,7 @@ namespace FlaxEditor.Windows
_split.Panel2.VScrollBar.ThumbEnabled = true;
if (_split.Panel2.HScrollBar != null)
_split.Panel2.HScrollBar.ThumbEnabled = true;
ScrollingOnContentView(true);
// Check if was creating new element
if (_newElement != null)

View File

@@ -131,6 +131,7 @@ namespace FlaxEditor.Windows
private TextBox _searchBox;
private Tree _tree;
private Panel _sceneTreePanel;
private bool _isUpdatingSelection;
private bool _isMouseDown;
@@ -143,10 +144,9 @@ namespace FlaxEditor.Windows
/// </summary>
/// <param name="editor">The editor.</param>
public SceneTreeWindow(Editor editor)
: base(editor, true, ScrollBars.Both)
: base(editor, true, ScrollBars.None)
{
Title = "Scene";
ScrollMargin = new Margin(0, 0, 0, 100.0f);
// Scene searching query input box
var headerPanel = new ContainerControl
@@ -165,19 +165,29 @@ namespace FlaxEditor.Windows
};
_searchBox.TextChanged += OnSearchBoxTextChanged;
// Scene tree panel
_sceneTreePanel = new Panel
{
AnchorPreset = AnchorPresets.StretchAll,
Offsets = new Margin(0, 0, headerPanel.Bottom, 0),
IsScrollable = true,
ScrollBars = ScrollBars.Both,
Parent = this,
};
// Create scene structure tree
var root = editor.Scene.Root;
root.TreeNode.ChildrenIndent = 0;
root.TreeNode.Expand();
_tree = new Tree(true)
{
Y = headerPanel.Bottom,
Margin = new Margin(0.0f, 0.0f, -16.0f, 0.0f), // Hide root node
IsScrollable = true,
};
_tree.AddChild(root.TreeNode);
_tree.SelectedChanged += Tree_OnSelectedChanged;
_tree.RightClick += OnTreeRightClick;
_tree.Parent = this;
_tree.Parent = _sceneTreePanel;
headerPanel.Parent = this;
// Setup input actions
@@ -188,6 +198,18 @@ namespace FlaxEditor.Windows
InputActions.Add(options => options.Rename, Rename);
}
/// <summary>
/// Enables or disables vertical and horizontal scrolling on the scene tree panel.
/// </summary>
/// <param name="enabled">The state to set scrolling to</param>
public void ScrollingOnSceneTreeView(bool enabled)
{
if (_sceneTreePanel.VScrollBar != null)
_sceneTreePanel.VScrollBar.ThumbEnabled = enabled;
if (_sceneTreePanel.HScrollBar != null)
_sceneTreePanel.HScrollBar.ThumbEnabled = enabled;
}
private void OnSearchBoxTextChanged()
{
// Skip events during setup or init stuff