Refactor #1266 (code quality and simplicity)
This commit is contained in:
@@ -1,257 +0,0 @@
|
||||
using FlaxEditor.Content;
|
||||
using FlaxEditor.Content.GUI;
|
||||
using FlaxEngine;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace FlaxEditor.Content
|
||||
{
|
||||
/// <summary>
|
||||
/// class with is controling visability of items in content window
|
||||
/// </summary>
|
||||
internal class ContentFilter
|
||||
{
|
||||
#region Filters Config
|
||||
/// <summary>
|
||||
/// all suported files by engine Content Folder
|
||||
/// </summary>
|
||||
public static readonly List<string> SuportedFileExtencionsInContentFolder = new List<string>()
|
||||
{
|
||||
".flax",
|
||||
".json",
|
||||
".scene",
|
||||
".prefab",
|
||||
};
|
||||
/// <summary>
|
||||
/// all suported files by engine Source Folder
|
||||
/// </summary>
|
||||
public static readonly List<string> SuportedFileExtencionsInSourceFolder = new List<string>()
|
||||
{
|
||||
".shader",
|
||||
".cs",
|
||||
".h",
|
||||
".cpp",
|
||||
};
|
||||
/// <summary>
|
||||
/// ignores folders in source folder (top layer),
|
||||
/// for example obj folder is default c# project folder
|
||||
/// </summary>
|
||||
internal static readonly List<string> HideFoldersInSourceFolder = new List<string>()
|
||||
{
|
||||
"obj", // default c# project folder
|
||||
"Properties", // c# project stuff ?
|
||||
};
|
||||
/// <summary>
|
||||
/// ignores files in source folder (top layer),
|
||||
/// </summary>
|
||||
internal static readonly List<string> HideFilesInSourceFolder = new List<string>() //dont edit
|
||||
{
|
||||
"Game.csproj", //solucion file
|
||||
"Game.Gen.cs", //auto-generated not be edited
|
||||
"GameEditorTarget.Build.cs",
|
||||
"GameTarget.Build.cs",
|
||||
};
|
||||
#endregion
|
||||
internal static ContentItem gameSettings;
|
||||
internal static List<ContentItem> buildFiles;
|
||||
|
||||
internal static ContentTreeNode settings;
|
||||
internal static ContentTreeNode shaders;
|
||||
internal static ProjectTreeNode engine;
|
||||
internal static List<ProjectTreeNode> plugins = new();
|
||||
internal static List<ContentItem> FilterFolder(ContentFolder folder)
|
||||
{
|
||||
return FilterFolder(folder, SuportedFileExtencionsInContentFolder.ToArray(), SuportedFileExtencionsInSourceFolder.ToArray());
|
||||
}
|
||||
internal static List<ContentItem> FilterFolder(ContentFolder folder, string[] FileExtencionsInContentFolder, string[] ExtencionsInSourceFolder)
|
||||
{
|
||||
if (folder.CanHaveAssets)
|
||||
{
|
||||
for (int i = 0; i < folder.Children.Count; i++)
|
||||
{
|
||||
bool Visible = false;
|
||||
for (int j = 0; j < FileExtencionsInContentFolder.Length; j++)
|
||||
{
|
||||
if ((folder.Children[i].Path.EndsWith(FileExtencionsInContentFolder[j]) || folder.Children[i].IsFolder))
|
||||
{
|
||||
if (folder.Children[i].Visible)
|
||||
{
|
||||
Visible = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
folder.Children[i].Visible = Visible;
|
||||
}
|
||||
}
|
||||
else if (folder.CanHaveScripts)
|
||||
{
|
||||
for (int i = 0; i < folder.Children.Count; i++)
|
||||
{
|
||||
bool Visible = false;
|
||||
for (int j = 0; j < ExtencionsInSourceFolder.Length; j++)
|
||||
{
|
||||
if ((folder.Children[i].Path.EndsWith(ExtencionsInSourceFolder[j]) || folder.Children[i].IsFolder))
|
||||
{
|
||||
if (folder.Children[i].Visible)
|
||||
{
|
||||
Visible = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
folder.Children[i].Visible = Visible;
|
||||
}
|
||||
}
|
||||
return folder.Children;
|
||||
}
|
||||
internal static ProjectTreeNode Filter(ProjectTreeNode tree)
|
||||
{
|
||||
var content = tree.Children[0] as ContentTreeNode;
|
||||
var source = tree.Children[1] as ContentTreeNode;
|
||||
//filter content folder (top layer)
|
||||
buildFiles = new();
|
||||
for (int i = 0; i < content.Folder.Children.Count; i++)
|
||||
{
|
||||
if (content.Folder.Children[i].FileName == "GameSettings.json")
|
||||
{
|
||||
gameSettings = content.Folder.Children[i];
|
||||
content.Folder.Children[i].Visible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int hindenCount = 0;
|
||||
|
||||
for (int i = content.Children.Count - 1; i >= 0; i--)//we are starting from back it faster
|
||||
{
|
||||
var node = content.Children[i] as ContentTreeNode;
|
||||
if (node.Folder.FileName == "Settings")
|
||||
{
|
||||
settings = node;
|
||||
hindenCount++;
|
||||
node.Visible = false;
|
||||
node.Folder.Visible = false;
|
||||
}
|
||||
if (node.Folder.FileName == "Shaders")
|
||||
{
|
||||
shaders = node;
|
||||
hindenCount++;
|
||||
node.Visible = false;
|
||||
node.Folder.Visible = false;
|
||||
|
||||
}
|
||||
if (hindenCount == 2)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
|
||||
//filter source folder (top layer)
|
||||
hindenCount = 0;
|
||||
for (int i = 0; i < source.Folder.Children.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < HideFilesInSourceFolder.Count; j++)
|
||||
{
|
||||
if (source.Folder.Children[i].FileName == HideFilesInSourceFolder[j])
|
||||
{
|
||||
source.Folder.Children[i].Visible = false;
|
||||
hindenCount++;
|
||||
if(i > 1)
|
||||
{
|
||||
buildFiles.Add(source.Folder.Children[i]);
|
||||
}
|
||||
if (HideFilesInSourceFolder.Count == hindenCount) goto HideFilesInSourceFolderComplited;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
HideFilesInSourceFolderComplited:
|
||||
hindenCount = 0;
|
||||
for (int i = source.Children.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var node = source.Children[i] as ContentTreeNode;
|
||||
for (int j = 0; j < HideFoldersInSourceFolder.Count; j++)
|
||||
{
|
||||
if (node.Folder.FileName == HideFoldersInSourceFolder[j])
|
||||
{
|
||||
node.Visible = false;
|
||||
node.Folder.Visible = false;
|
||||
hindenCount++;
|
||||
if (HideFoldersInSourceFolder.Count == hindenCount) goto HideFoldersInSourceFolderComplited;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
HideFoldersInSourceFolderComplited:
|
||||
//content
|
||||
return tree;
|
||||
}
|
||||
internal static void UpdateFilterVisability(ContentSettingsDropdown dropdown)
|
||||
{
|
||||
engine.Visible = false;
|
||||
engine.Folder.Visible = false;
|
||||
|
||||
foreach (var item in plugins)
|
||||
{
|
||||
item.Visible = false;
|
||||
item.Folder.Visible = false;
|
||||
}
|
||||
foreach (var item in buildFiles)
|
||||
{
|
||||
item.Visible = false;
|
||||
}
|
||||
gameSettings.Visible = false;
|
||||
settings.Visible = false;
|
||||
settings.Folder.Visible = false;
|
||||
|
||||
shaders.Visible = false;
|
||||
shaders.Folder.Visible = false;
|
||||
|
||||
for (int i = 0; i < dropdown.Selection.Count; i++)
|
||||
{
|
||||
if (dropdown.Selection[i] == 0) //Show Engine Content
|
||||
{
|
||||
engine.Visible = true;
|
||||
engine.Folder.Visible = true;
|
||||
}
|
||||
|
||||
if (dropdown.Selection[i] == 1)//Show Plugin Content
|
||||
{
|
||||
foreach (var item in plugins)
|
||||
{
|
||||
item.Visible = true;
|
||||
item.Folder.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (dropdown.Selection[i] == 2)//Show Build Files
|
||||
{
|
||||
foreach (var item in buildFiles)
|
||||
{
|
||||
item.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (dropdown.Selection[i] == 3)//Show Game Settings
|
||||
{
|
||||
gameSettings.Visible = true;
|
||||
settings.Visible = true;
|
||||
settings.Folder.Visible = true;
|
||||
}
|
||||
|
||||
if (dropdown.Selection[i] == 4)//"Show Shader Source"
|
||||
{
|
||||
shaders.Visible = true;
|
||||
shaders.Folder.Visible = true;
|
||||
}
|
||||
}
|
||||
engine.ParentTree.PerformLayout();
|
||||
Editor.Instance.Windows.ContentWin.RefreshView();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using FlaxEditor.GUI;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.GUI.Drag;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
@@ -72,7 +73,6 @@ namespace FlaxEditor.Content.GUI
|
||||
|
||||
if (_dragOverItems == null)
|
||||
_dragOverItems = new DragItems(ValidateDragItem);
|
||||
|
||||
_dragOverItems.OnDragEnter(data);
|
||||
var result = GetDragEffect(data);
|
||||
_validDragOver = result != DragDropEffect.None;
|
||||
@@ -122,4 +122,70 @@ namespace FlaxEditor.Content.GUI
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
sealed class ContentNavigationSeparator : ComboBox
|
||||
{
|
||||
public ContentNavigationButton Target;
|
||||
|
||||
public ContentNavigationSeparator(ContentNavigationButton target, float x, float y, float height)
|
||||
{
|
||||
Target = target;
|
||||
Bounds = new Rectangle(x, y, 16, height);
|
||||
Offsets = new Margin(Bounds.X, Bounds.Width, Bounds.Y, Bounds.Height);
|
||||
UpdateTransform();
|
||||
|
||||
MaximumItemsInViewCount = 20;
|
||||
var style = Style.Current;
|
||||
BackgroundColor = style.BackgroundNormal;
|
||||
BackgroundColorHighlighted = BackgroundColor;
|
||||
BackgroundColorSelected = BackgroundColor;
|
||||
}
|
||||
|
||||
protected override ContextMenu OnCreatePopup()
|
||||
{
|
||||
// Update items
|
||||
ClearItems();
|
||||
foreach (var child in Target.TargetNode.Children)
|
||||
{
|
||||
if (child is ContentTreeNode node)
|
||||
{
|
||||
if (node.Folder.VisibleInHierarchy) // Respect the filter set by ContentFilterConfig.Filter(...)
|
||||
AddItem(node.Folder.ShortName);
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnCreatePopup();
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
var style = Style.Current;
|
||||
var rect = new Rectangle(Float2.Zero, Size);
|
||||
var color = IsDragOver ? style.BackgroundSelected * 0.6f : (_mouseDown ? style.BackgroundSelected : (IsMouseOver ? style.BackgroundHighlighted : Color.Transparent));
|
||||
Render2D.FillRectangle(rect, color);
|
||||
Render2D.DrawSprite(Editor.Instance.Icons.ArrowRight12, new Rectangle(rect.Location.X, rect.Y + rect.Size.Y * 0.25f, rect.Size.X, rect.Size.X), EnabledInHierarchy ? style.Foreground : style.ForegroundDisabled);
|
||||
}
|
||||
|
||||
protected override void OnLayoutMenuButton(ContextMenuButton button, int index, bool construct = false)
|
||||
{
|
||||
button.Icon = Editor.Instance.Icons.FolderClosed32;
|
||||
if (_tooltips != null && _tooltips.Length > index)
|
||||
button.TooltipText = _tooltips[index];
|
||||
}
|
||||
|
||||
protected override void OnItemClicked(int index)
|
||||
{
|
||||
base.OnItemClicked(index);
|
||||
|
||||
var item = _items[index];
|
||||
foreach (var child in Target.TargetNode.Children)
|
||||
{
|
||||
if (child is ContentTreeNode node && node.Folder.ShortName == item)
|
||||
{
|
||||
Editor.Instance.Windows.ContentWin.Navigate(node);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using FlaxEditor.GUI;
|
||||
using FlaxEngine;
|
||||
|
||||
namespace FlaxEditor.Content.GUI
|
||||
{
|
||||
internal class ContentNavigationBar : NavigationBar
|
||||
{
|
||||
ToolStrip _toolstrip;
|
||||
internal float ofssetFromRightEdge = 80;
|
||||
internal ContentNavigationBar(ToolStrip toolstrip) : base()
|
||||
{
|
||||
_toolstrip = toolstrip;
|
||||
}
|
||||
/// <inheritdoc />
|
||||
protected override void Arrange()
|
||||
{
|
||||
base.Arrange();
|
||||
var lastToolstripButton = _toolstrip.LastButton;
|
||||
var parentSize = Parent.Size;
|
||||
Bounds = new Rectangle
|
||||
(
|
||||
new Float2(lastToolstripButton.Right, 0),
|
||||
new Float2(parentSize.X - X - ofssetFromRightEdge, _toolstrip.Height)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
using FlaxEditor;
|
||||
using FlaxEditor.GUI;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FlaxEditor.Content.GUI
|
||||
{
|
||||
internal class ContentNavigationButtonSeparator : ComboBox
|
||||
{
|
||||
public ContentNavigationButton Target { get; }
|
||||
public ContentNavigationButtonSeparator(ContentNavigationButton target, float x, float y,float height)
|
||||
{
|
||||
Target = target;
|
||||
Bounds = new Rectangle(x, y, 16, height);
|
||||
Offsets = new Margin(Bounds.X, Bounds.Width, Bounds.Y, Bounds.Height);
|
||||
UpdateTransform();
|
||||
|
||||
MaximumItemsInViewCount = 20;
|
||||
var style = Style.Current;
|
||||
BackgroundColor = style.BackgroundNormal;
|
||||
BackgroundColorHighlighted = BackgroundColor;
|
||||
BackgroundColorSelected = BackgroundColor;
|
||||
}
|
||||
protected override ContextMenu OnCreatePopup()
|
||||
{
|
||||
UpdateDropDownItems();
|
||||
return base.OnCreatePopup();
|
||||
}
|
||||
internal void UpdateDropDownItems()
|
||||
{
|
||||
ClearItems();
|
||||
_items = new();
|
||||
for (int i = 0; i < Target.TargetNode.Children.Count; i++)
|
||||
{
|
||||
if (Target.TargetNode.Children[i] is ContentTreeNode node)
|
||||
{
|
||||
if (node.Folder.VisibleInHierarchy) // respect the filter set by ContentFilterConfig.Filter(...)
|
||||
AddItem(node.Folder.ShortName);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public override void Draw()
|
||||
{
|
||||
// Cache data
|
||||
var style = Style.Current;
|
||||
var clientRect = new Rectangle(Float2.Zero, Size);
|
||||
// Draw background
|
||||
if (IsDragOver)
|
||||
{
|
||||
Render2D.FillRectangle(clientRect, Style.Current.BackgroundSelected * 0.6f);
|
||||
}
|
||||
else if (_mouseDown)
|
||||
{
|
||||
Render2D.FillRectangle(clientRect, style.BackgroundSelected);
|
||||
}
|
||||
else if (IsMouseOver)
|
||||
{
|
||||
Render2D.FillRectangle(clientRect, style.BackgroundHighlighted);
|
||||
}
|
||||
|
||||
Render2D.DrawSprite(Editor.Instance.Icons.ArrowRight12, new Rectangle(clientRect.Location.X, clientRect.Y + ((Size.Y / 2f)/2f), Size.X, Size.X), EnabledInHierarchy ? Style.Current.Foreground : Style.Current.ForegroundDisabled);
|
||||
}
|
||||
protected override void OnLayoutMenuButton(ref ContextMenuButton button, int index, bool construct = false)
|
||||
{
|
||||
var style = Style.Current;
|
||||
button.Icon = Editor.Instance.Icons.FolderClosed32;
|
||||
if (_tooltips != null && _tooltips.Length > index)
|
||||
{
|
||||
button.TooltipText = _tooltips[index];
|
||||
}
|
||||
}
|
||||
protected override void OnItemClicked(int index)
|
||||
{
|
||||
base.OnItemClicked(index);
|
||||
if (Target.TargetNode.Children[index] is ContentTreeNode node)
|
||||
{
|
||||
Editor.Instance.Windows.ContentWin.Navigate(node);
|
||||
}
|
||||
// Navigate calls the OnDestroy at some point dont place code below or editor will crash
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
using FlaxEditor.Content;
|
||||
using FlaxEditor.CustomEditors.Editors;
|
||||
using FlaxEditor.GUI;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.States;
|
||||
using FlaxEditor.Utilities;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
using FlaxEngine.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace FlaxEditor.Content.GUI
|
||||
{
|
||||
class ContentSettingsDropdown : ComboBox
|
||||
{
|
||||
internal readonly List<string> Settings = new()
|
||||
{
|
||||
"Show Engine Content",
|
||||
"Show Plugin Content",
|
||||
"Show Build Files",
|
||||
"Show Game Settings",
|
||||
"Show Shader Source"
|
||||
};
|
||||
public ContentSettingsDropdown()
|
||||
{
|
||||
SupportMultiSelect = true;
|
||||
MaximumItemsInViewCount = 20;
|
||||
var style = Style.Current;
|
||||
BackgroundColor = style.BackgroundNormal;
|
||||
BackgroundColorHighlighted = BackgroundColor;
|
||||
BackgroundColorSelected = BackgroundColor;
|
||||
|
||||
}
|
||||
protected override ContextMenu OnCreatePopup()
|
||||
{
|
||||
UpdateDropDownItems();
|
||||
return base.OnCreatePopup();
|
||||
}
|
||||
internal void UpdateDropDownItems()
|
||||
{
|
||||
ClearItems();
|
||||
|
||||
for (int i = 0; i < Settings.Count; i++)
|
||||
{
|
||||
AddItem(Settings[i]);
|
||||
}
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public override void Draw()
|
||||
{
|
||||
// Cache data
|
||||
var style = Style.Current;
|
||||
var clientRect = new Rectangle(Float2.Zero, Size);
|
||||
// Draw background
|
||||
if (IsDragOver)
|
||||
{
|
||||
Render2D.FillRectangle(clientRect, Style.Current.BackgroundSelected * 0.6f);
|
||||
}
|
||||
else if (_mouseDown)
|
||||
{
|
||||
Render2D.FillRectangle(clientRect, style.BackgroundSelected);
|
||||
}
|
||||
else if (IsMouseOver)
|
||||
{
|
||||
Render2D.FillRectangle(clientRect, style.BackgroundHighlighted);
|
||||
}
|
||||
float size = (Size.Y / 1.5f); //Icon size
|
||||
// Draw text
|
||||
Render2D.DrawText(Font.GetFont(), "Settings", new Rectangle(size, 0, Size.X - Size.Y, Size.Y), TextColor, TextAlignment.Center, TextAlignment.Center);
|
||||
Render2D.DrawSprite(Editor.Instance.Icons.Settings12, new Rectangle((Size.Y - size) / 2.0f, (Size.Y - size) / 2.0f, size, size));
|
||||
}
|
||||
protected override void OnLayoutMenuButton(ref ContextMenuButton button, int index, bool construct = false)
|
||||
{
|
||||
var style = Style.Current;
|
||||
if (_selectedIndices.Contains(index))
|
||||
{
|
||||
button.Icon = style.CheckBoxTick;
|
||||
}
|
||||
else
|
||||
{
|
||||
button.Icon = SpriteHandle.Default;
|
||||
}
|
||||
if (_tooltips != null && _tooltips.Length > index)
|
||||
{
|
||||
button.TooltipText = _tooltips[index];
|
||||
}
|
||||
}
|
||||
protected override void OnSelectedIndexChanged()
|
||||
{
|
||||
ContentFilter.UpdateFilterVisability(this);
|
||||
base.OnSelectedIndexChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -441,11 +441,9 @@ namespace FlaxEditor.Content
|
||||
{
|
||||
get
|
||||
{
|
||||
// Skip when hidden
|
||||
if (!Visible)
|
||||
{
|
||||
return Rectangle.Empty;
|
||||
}
|
||||
|
||||
var view = Parent as ContentView;
|
||||
var size = Size;
|
||||
switch (view?.ViewType ?? ContentViewType.Tiles)
|
||||
@@ -453,7 +451,7 @@ namespace FlaxEditor.Content
|
||||
case ContentViewType.Tiles:
|
||||
{
|
||||
var textHeight = DefaultTextHeight * size.X / DefaultWidth;
|
||||
return new Rectangle(0, size.Y - textHeight, size.X - 2, textHeight);
|
||||
return new Rectangle(0, size.Y - textHeight, size.X, textHeight);
|
||||
}
|
||||
case ContentViewType.List:
|
||||
{
|
||||
@@ -671,8 +669,6 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public override void Draw()
|
||||
{
|
||||
|
||||
// Cache data
|
||||
var size = Size;
|
||||
var style = Style.Current;
|
||||
var view = Parent as ContentView;
|
||||
|
||||
@@ -17,6 +17,6 @@ namespace FlaxEditor.Content
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string NavButtonLabel => string.Empty;
|
||||
public override string NavButtonLabel => " /";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
|
||||
namespace FlaxEditor.GUI
|
||||
{
|
||||
@@ -399,13 +399,14 @@ namespace FlaxEditor.GUI
|
||||
OnItemClicked((int)btn.Tag);
|
||||
if (SupportMultiSelect)
|
||||
{
|
||||
// Don't hide in multi-select, so user can edit multiple elements instead of just one
|
||||
UpdateButtons();
|
||||
_popupMenu?.PerformLayout();
|
||||
}
|
||||
else
|
||||
{
|
||||
_popupMenu?.Hide();
|
||||
}//[nori_sc] don't hide it Support MultiSelect is on actions per min is important for UX, if some one wont to set more then 5 elements in multi select menu let them do it
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -423,13 +424,15 @@ namespace FlaxEditor.GUI
|
||||
if (_items.Count > 0)
|
||||
{
|
||||
UpdateButtons();
|
||||
|
||||
// Show dropdown list
|
||||
_popupMenu.MinimumWidth = Width;
|
||||
_popupMenu.Show(this, new Float2(1, Height));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// update buttons layout and repains
|
||||
/// Updates buttons layout.
|
||||
/// </summary>
|
||||
private void UpdateButtons()
|
||||
{
|
||||
@@ -443,7 +446,7 @@ namespace FlaxEditor.GUI
|
||||
for (int i = 0; i < _items.Count; i++)
|
||||
{
|
||||
var btn = _popupMenu.AddButton(_items[i]);
|
||||
OnLayoutMenuButton(ref btn, i, true);
|
||||
OnLayoutMenuButton(btn, i, true);
|
||||
btn.Tag = i;
|
||||
}
|
||||
}
|
||||
@@ -457,25 +460,23 @@ namespace FlaxEditor.GUI
|
||||
if (itemControls[i] is ContextMenuButton btn)
|
||||
{
|
||||
btn.Text = _items[i];
|
||||
OnLayoutMenuButton(ref btn, i, true);
|
||||
OnLayoutMenuButton(btn, i, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// caled when button is created or repainted u can overite it to give the button custom look
|
||||
/// Called when button is created or updated. Can be used to customize the visuals.
|
||||
/// </summary>
|
||||
/// <param name="button">button refrance</param>
|
||||
/// <param name="index">curent item index</param>
|
||||
/// <param name="button">The button.</param>
|
||||
/// <param name="index">The item index.</param>
|
||||
/// <param name="construct">true if button is created else it is repainting the button</param>
|
||||
protected virtual void OnLayoutMenuButton(ref FlaxEditor.GUI.ContextMenu.ContextMenuButton button,int index, bool construct = false)
|
||||
protected virtual void OnLayoutMenuButton(ContextMenuButton button, int index, bool construct = false)
|
||||
{
|
||||
var style = Style.Current;
|
||||
button.Checked = _selectedIndices.Contains(index);
|
||||
if (_tooltips != null && _tooltips.Length > index)
|
||||
{
|
||||
button.TooltipText = _tooltips[index];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -498,6 +499,8 @@ namespace FlaxEditor.GUI
|
||||
_popupMenu = null;
|
||||
}
|
||||
|
||||
if (IsDisposing)
|
||||
return;
|
||||
_selectedIndices.Clear();
|
||||
_selectedIndices = null;
|
||||
_items.Clear();
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace FlaxEditor.GUI.ContextMenu
|
||||
|
||||
// Draw icon
|
||||
const float iconSize = 14;
|
||||
var icon = Checked ? Style.Current.CheckBoxTick : Icon;
|
||||
var icon = Checked ? style.CheckBoxTick : Icon;
|
||||
if (icon.IsValid)
|
||||
Render2D.DrawSprite(icon, new Rectangle(-iconSize - 1, (Height - iconSize) / 2, iconSize, iconSize), textColor);
|
||||
}
|
||||
|
||||
@@ -50,14 +50,9 @@ namespace FlaxEditor.GUI
|
||||
{
|
||||
if (toolstrip == null)
|
||||
return;
|
||||
|
||||
var lastToolstripButton = toolstrip.LastButton;
|
||||
var parentSize = Parent.Size;
|
||||
Bounds = new Rectangle
|
||||
(
|
||||
new Float2(lastToolstripButton.Right + 8.0f, 0),
|
||||
new Float2(parentSize.X - X - 8.0f, toolstrip.Height)
|
||||
);
|
||||
Bounds = new Rectangle(lastToolstripButton.Right + 8.0f, 0, parentSize.X - X - 8.0f, toolstrip.Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -902,6 +902,23 @@ namespace FlaxEditor.Modules
|
||||
}
|
||||
if (sortChildren)
|
||||
node.SortChildren();
|
||||
|
||||
// Ignore some special folders
|
||||
if (node is MainContentTreeNode mainNode && mainNode.Folder.ShortName == "Source")
|
||||
{
|
||||
var mainNodeChild = mainNode.Folder.Find(StringUtils.CombinePaths(mainNode.Path, "obj")) as ContentFolder;
|
||||
if (mainNodeChild != null)
|
||||
{
|
||||
mainNodeChild.Visible = false;
|
||||
mainNodeChild.Node.Visible = false;
|
||||
}
|
||||
mainNodeChild = mainNode.Folder.Find(StringUtils.CombinePaths(mainNode.Path, "Properties")) as ContentFolder;
|
||||
if (mainNodeChild != null)
|
||||
{
|
||||
mainNodeChild.Visible = false;
|
||||
mainNodeChild.Node.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadScripts(ContentTreeNode parent, string[] files)
|
||||
|
||||
@@ -196,18 +196,19 @@ namespace FlaxEditor.Windows
|
||||
}
|
||||
float x = NavigationBar.DefaultButtonsMargin;
|
||||
float h = _toolStrip.ItemsHeight - 2 * ToolStrip.DefaultMarginV;
|
||||
for (int i = nodes.Count - 2; i >= 0; i--)
|
||||
for (int i = nodes.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var button = new ContentNavigationButton(nodes[i], x - 100, ToolStrip.DefaultMarginV, h);
|
||||
var button = new ContentNavigationButton(nodes[i], x, ToolStrip.DefaultMarginV, h);
|
||||
button.PerformLayout();
|
||||
x += button.Width + NavigationBar.DefaultButtonsMargin;
|
||||
_navigationBar.AddChild(button);
|
||||
if (i == 0)
|
||||
continue;
|
||||
var buttonSeparator = new ContentNavigationButtonSeparator(button, x, ToolStrip.DefaultMarginV, h);
|
||||
buttonSeparator.PerformLayout();
|
||||
x += buttonSeparator.Width + NavigationBar.DefaultButtonsMargin;
|
||||
_navigationBar.AddChild(buttonSeparator);
|
||||
if (i > 0)
|
||||
{
|
||||
var separator = new ContentNavigationSeparator(button, x, ToolStrip.DefaultMarginV, h);
|
||||
separator.PerformLayout();
|
||||
x += separator.Width + NavigationBar.DefaultButtonsMargin;
|
||||
_navigationBar.AddChild(separator);
|
||||
}
|
||||
}
|
||||
nodes.Clear();
|
||||
|
||||
@@ -224,21 +225,13 @@ namespace FlaxEditor.Windows
|
||||
/// <summary>
|
||||
/// Gets the current view folder.
|
||||
/// </summary>
|
||||
public ContentFolder CurrentViewFolder
|
||||
{
|
||||
get
|
||||
{
|
||||
var node = SelectedNode;
|
||||
return node?.Folder;
|
||||
}
|
||||
}
|
||||
public ContentFolder CurrentViewFolder => SelectedNode?.Folder;
|
||||
|
||||
/// <summary>
|
||||
/// Shows the root folder.
|
||||
/// </summary>
|
||||
public void ShowRoot()
|
||||
{
|
||||
// Show root folder
|
||||
_tree.Select(_root);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,6 +191,7 @@ namespace FlaxEditor.Windows
|
||||
}
|
||||
|
||||
// Search by filter only
|
||||
bool showAllFiles = _showAllFiles;
|
||||
if (string.IsNullOrWhiteSpace(query))
|
||||
{
|
||||
if (SelectedNode == _root)
|
||||
@@ -199,12 +200,12 @@ namespace FlaxEditor.Windows
|
||||
for (int i = 0; i < _root.ChildrenCount; i++)
|
||||
{
|
||||
if (_root.GetChild(i) is ContentTreeNode node)
|
||||
UpdateItemsSearchFilter(node.Folder, items, filters);
|
||||
UpdateItemsSearchFilter(node.Folder, items, filters, showAllFiles);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateItemsSearchFilter(CurrentViewFolder, items, filters);
|
||||
UpdateItemsSearchFilter(CurrentViewFolder, items, filters, showAllFiles);
|
||||
}
|
||||
}
|
||||
// Search by asset ID
|
||||
@@ -221,12 +222,12 @@ namespace FlaxEditor.Windows
|
||||
for (int i = 0; i < _root.ChildrenCount; i++)
|
||||
{
|
||||
if (_root.GetChild(i) is ContentTreeNode node)
|
||||
UpdateItemsSearchFilter(node.Folder, items, filters, query);
|
||||
UpdateItemsSearchFilter(node.Folder, items, filters, showAllFiles, query);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateItemsSearchFilter(CurrentViewFolder, items, filters, query);
|
||||
UpdateItemsSearchFilter(CurrentViewFolder, items, filters, showAllFiles, query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,42 +235,34 @@ namespace FlaxEditor.Windows
|
||||
_view.ShowItems(items, _sortType);
|
||||
}
|
||||
|
||||
private void UpdateItemsSearchFilter(ContentFolder folder, List<ContentItem> items, bool[] filters)
|
||||
private void UpdateItemsSearchFilter(ContentFolder folder, List<ContentItem> items, bool[] filters, bool showAllFiles)
|
||||
{
|
||||
for (int i = 0; i < folder.Children.Count; i++)
|
||||
{
|
||||
var child = folder.Children[i];
|
||||
|
||||
if (child is ContentFolder childFolder)
|
||||
{
|
||||
UpdateItemsSearchFilter(childFolder, items, filters);
|
||||
UpdateItemsSearchFilter(childFolder, items, filters, showAllFiles);
|
||||
}
|
||||
else
|
||||
else if (filters[(int)child.SearchFilter] && (showAllFiles || !(child is FileItem)))
|
||||
{
|
||||
if (filters[(int)child.SearchFilter])
|
||||
{
|
||||
items.Add(child);
|
||||
}
|
||||
items.Add(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateItemsSearchFilter(ContentFolder folder, List<ContentItem> items, bool[] filters, string filterText)
|
||||
private void UpdateItemsSearchFilter(ContentFolder folder, List<ContentItem> items, bool[] filters, bool showAllFiles, string filterText)
|
||||
{
|
||||
for (int i = 0; i < folder.Children.Count; i++)
|
||||
{
|
||||
var child = folder.Children[i];
|
||||
|
||||
if (child is ContentFolder childFolder)
|
||||
{
|
||||
UpdateItemsSearchFilter(childFolder, items, filters, filterText);
|
||||
UpdateItemsSearchFilter(childFolder, items, filters, showAllFiles, filterText);
|
||||
}
|
||||
else if (filters[(int)child.SearchFilter])
|
||||
else if (filters[(int)child.SearchFilter] && (showAllFiles || !(child is FileItem)) && QueryFilterHelper.Match(filterText, child.ShortName))
|
||||
{
|
||||
if (filters[(int)child.SearchFilter] && QueryFilterHelper.Match(filterText, child.ShortName))
|
||||
{
|
||||
items.Add(child);
|
||||
}
|
||||
items.Add(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using FlaxEditor.Content;
|
||||
using FlaxEditor.Content.GUI;
|
||||
@@ -39,14 +40,13 @@ namespace FlaxEditor.Windows
|
||||
private readonly ToolStripButton _navigateForwardButton;
|
||||
private readonly ToolStripButton _navigateUpButton;
|
||||
|
||||
private ContentNavigationBar _navigationBar;
|
||||
private NavigationBar _navigationBar;
|
||||
private Tree _tree;
|
||||
private TextBox _foldersSearchBox;
|
||||
private TextBox _itemsSearchBox;
|
||||
private ViewDropdown _viewDropdown;
|
||||
private ContentSettingsDropdown _ContentSettingDropdown;
|
||||
private const float _ContentDropdownSizeX = 100;
|
||||
private SortType _sortType;
|
||||
private bool _showEngineFiles = true, _showPluginsFiles = true, _showAllFiles = true;
|
||||
|
||||
private RootContentTreeNode _root;
|
||||
|
||||
@@ -66,6 +66,57 @@ namespace FlaxEditor.Windows
|
||||
/// </summary>
|
||||
public ContentView View => _view;
|
||||
|
||||
internal bool ShowEngineFiles
|
||||
{
|
||||
get => _showEngineFiles;
|
||||
set
|
||||
{
|
||||
if (_showEngineFiles != value)
|
||||
{
|
||||
_showEngineFiles = value;
|
||||
if (Editor.ContentDatabase.Engine != null)
|
||||
{
|
||||
Editor.ContentDatabase.Engine.Visible = value;
|
||||
Editor.ContentDatabase.Engine.Folder.Visible = value;
|
||||
RefreshView();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal bool ShowPluginsFiles
|
||||
{
|
||||
get => _showPluginsFiles;
|
||||
set
|
||||
{
|
||||
if (_showPluginsFiles != value)
|
||||
{
|
||||
_showPluginsFiles = value;
|
||||
foreach (var project in Editor.ContentDatabase.Projects)
|
||||
{
|
||||
if (project == Editor.ContentDatabase.Game || project == Editor.ContentDatabase.Engine)
|
||||
continue;
|
||||
project.Visible = value;
|
||||
project.Folder.Visible = value;
|
||||
RefreshView();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal bool ShowAllFiles
|
||||
{
|
||||
get => _showAllFiles;
|
||||
set
|
||||
{
|
||||
if (_showAllFiles != value)
|
||||
{
|
||||
_showAllFiles = value;
|
||||
RefreshView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ContentWindow"/> class.
|
||||
/// </summary>
|
||||
@@ -75,7 +126,7 @@ namespace FlaxEditor.Windows
|
||||
{
|
||||
Title = "Content";
|
||||
Icon = editor.Icons.Folder32;
|
||||
|
||||
|
||||
// Content database events
|
||||
editor.ContentDatabase.WorkspaceModified += () => _isWorkspaceDirty = true;
|
||||
editor.ContentDatabase.ItemRemoved += OnContentDatabaseItemRemoved;
|
||||
@@ -110,24 +161,11 @@ namespace FlaxEditor.Windows
|
||||
_navigateForwardButton = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.Right64, NavigateForward).LinkTooltip("Navigate forward");
|
||||
_navigateUpButton = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.Up64, NavigateUp).LinkTooltip("Navigate up");
|
||||
_toolStrip.AddSeparator();
|
||||
|
||||
// Navigation bar
|
||||
|
||||
_navigationBar = new ContentNavigationBar(_toolStrip)
|
||||
_navigationBar = new NavigationBar
|
||||
{
|
||||
Parent = _toolStrip,
|
||||
ofssetFromRightEdge = _ContentDropdownSizeX
|
||||
};
|
||||
var DropdownSettingsPanel = new Panel(ScrollBars.None)
|
||||
{
|
||||
Parent = _toolStrip,
|
||||
Size = new Float2(_ContentDropdownSizeX, _toolStrip.Height)
|
||||
};
|
||||
//setings Dropdown
|
||||
_ContentSettingDropdown = new ContentSettingsDropdown
|
||||
{
|
||||
AnchorPreset = AnchorPresets.StretchAll,
|
||||
Parent = DropdownSettingsPanel,
|
||||
Offsets = new Margin(2, 4, 4, 4)
|
||||
};
|
||||
|
||||
// Split panel
|
||||
@@ -231,10 +269,6 @@ namespace FlaxEditor.Windows
|
||||
private ContextMenu OnViewDropdownPopupCreate(ComboBox comboBox)
|
||||
{
|
||||
var menu = new ContextMenu();
|
||||
|
||||
var showFileExtensionsButton = menu.AddButton("Show file extensions", () => View.ShowFileExtensions = !View.ShowFileExtensions);
|
||||
showFileExtensionsButton.Checked = View.ShowFileExtensions;
|
||||
showFileExtensionsButton.AutoCheck = true;
|
||||
|
||||
var viewScale = menu.AddButton("View Scale");
|
||||
viewScale.CloseMenuOnClick = false;
|
||||
@@ -259,6 +293,33 @@ namespace FlaxEditor.Windows
|
||||
}
|
||||
};
|
||||
|
||||
var show = menu.AddChildMenu("Show");
|
||||
{
|
||||
var b = show.ContextMenu.AddButton("File extensions", () => View.ShowFileExtensions = !View.ShowFileExtensions);
|
||||
b.TooltipText = "Shows all files with extensions";
|
||||
b.Checked = View.ShowFileExtensions;
|
||||
b.CloseMenuOnClick = false;
|
||||
b.AutoCheck = true;
|
||||
|
||||
b = show.ContextMenu.AddButton("Engine files", () => ShowEngineFiles = !ShowEngineFiles);
|
||||
b.TooltipText = "Shows in-built engine content";
|
||||
b.Checked = ShowEngineFiles;
|
||||
b.CloseMenuOnClick = false;
|
||||
b.AutoCheck = true;
|
||||
|
||||
b = show.ContextMenu.AddButton("Plugins files", () => ShowPluginsFiles = !ShowPluginsFiles);
|
||||
b.TooltipText = "Shows plugin projects content";
|
||||
b.Checked = ShowPluginsFiles;
|
||||
b.CloseMenuOnClick = false;
|
||||
b.AutoCheck = true;
|
||||
|
||||
b = show.ContextMenu.AddButton("All files", () => ShowAllFiles = !ShowAllFiles);
|
||||
b.TooltipText = "Shows all files including other than assets and source code";
|
||||
b.Checked = ShowAllFiles;
|
||||
b.CloseMenuOnClick = false;
|
||||
b.AutoCheck = true;
|
||||
}
|
||||
|
||||
var filters = menu.AddChildMenu("Filters");
|
||||
for (int i = 0; i < _viewDropdown.Items.Count; i++)
|
||||
{
|
||||
@@ -367,7 +428,7 @@ namespace FlaxEditor.Windows
|
||||
{
|
||||
if (!item.CanRename)
|
||||
return;
|
||||
|
||||
|
||||
// Show element in the view
|
||||
Select(item, true);
|
||||
|
||||
@@ -444,10 +505,7 @@ namespace FlaxEditor.Windows
|
||||
if (!Editor.ContentEditing.IsValidAssetName(item, newShortName, out string hint))
|
||||
{
|
||||
// Invalid name
|
||||
MessageBox.Show("Given asset name is invalid. " + hint,
|
||||
"Invalid name",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
MessageBox.Show("Given asset name is invalid. " + hint, "Invalid name", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -893,7 +951,7 @@ namespace FlaxEditor.Windows
|
||||
if (target == _root)
|
||||
{
|
||||
// Special case for root folder
|
||||
List<ContentItem> items = new List<ContentItem>(8);
|
||||
var items = new List<ContentItem>(8);
|
||||
for (int i = 0; i < _root.ChildrenCount; i++)
|
||||
{
|
||||
if (_root.GetChild(i) is ContentTreeNode node)
|
||||
@@ -905,9 +963,11 @@ namespace FlaxEditor.Windows
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Show folder contents
|
||||
_view.ShowItems(ContentFilter.FilterFolder(target.Folder), _sortType, false, true);
|
||||
var items = target.Folder.Children;
|
||||
if (!_showAllFiles)
|
||||
items = items.Where(x => !(x is FileItem)).ToList();
|
||||
_view.ShowItems(items, _sortType, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -930,12 +990,6 @@ namespace FlaxEditor.Windows
|
||||
_navigateUpButton.Enabled = folder != null && _tree.SelectedNode != _root;
|
||||
}
|
||||
|
||||
private void RemoveFolder2Root(ContentTreeNode node)
|
||||
{
|
||||
// Remove from the root
|
||||
_root.RemoveChild(node);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnInit()
|
||||
{
|
||||
@@ -947,18 +1001,20 @@ namespace FlaxEditor.Windows
|
||||
_root.Expand(true);
|
||||
|
||||
// Add game project on top, plugins in the middle and engine at bottom
|
||||
_root.AddChild(ContentFilter.Filter(Editor.ContentDatabase.Game));
|
||||
_root.AddChild(Editor.ContentDatabase.Game);
|
||||
Editor.ContentDatabase.Projects.Sort();
|
||||
foreach (var project in Editor.ContentDatabase.Projects)
|
||||
{
|
||||
project.SortChildrenRecursive();
|
||||
if (project == Editor.ContentDatabase.Game || project == Editor.ContentDatabase.Engine)
|
||||
continue;
|
||||
project.Visible = _showPluginsFiles;
|
||||
project.Folder.Visible = _showPluginsFiles;
|
||||
_root.AddChild(project);
|
||||
ContentFilter.plugins.Add(project);
|
||||
}
|
||||
Editor.ContentDatabase.Engine.Visible = _showEngineFiles;
|
||||
Editor.ContentDatabase.Engine.Folder.Visible = _showEngineFiles;
|
||||
_root.AddChild(Editor.ContentDatabase.Engine);
|
||||
ContentFilter.engine = Editor.ContentDatabase.Engine;
|
||||
|
||||
Editor.ContentDatabase.Game?.Expand(true);
|
||||
_tree.Margin = new Margin(0.0f, 0.0f, -16.0f, 2.0f); // Hide root node
|
||||
@@ -1029,7 +1085,6 @@ namespace FlaxEditor.Windows
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseUp(Float2 location, MouseButton button)
|
||||
{
|
||||
// Check if it's a right mouse button
|
||||
if (button == MouseButton.Right)
|
||||
{
|
||||
// Find control that is under the mouse
|
||||
@@ -1067,6 +1122,15 @@ namespace FlaxEditor.Windows
|
||||
|
||||
return base.OnMouseUp(location, button);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void PerformLayoutBeforeChildren()
|
||||
{
|
||||
base.PerformLayoutBeforeChildren();
|
||||
|
||||
_navigationBar?.UpdateBounds(_toolStrip);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool UseLayoutData => true;
|
||||
|
||||
@@ -1076,13 +1140,10 @@ namespace FlaxEditor.Windows
|
||||
LayoutSerializeSplitter(writer, "Split", _split);
|
||||
writer.WriteAttributeString("Scale", _view.ViewScale.ToString(CultureInfo.InvariantCulture));
|
||||
writer.WriteAttributeString("ShowFileExtensions", _view.ShowFileExtensions.ToString());
|
||||
writer.WriteAttributeString("ShowEngineFiles", ShowEngineFiles.ToString());
|
||||
writer.WriteAttributeString("ShowPluginsFiles", ShowPluginsFiles.ToString());
|
||||
writer.WriteAttributeString("ShowAllFiles", ShowAllFiles.ToString());
|
||||
writer.WriteAttributeString("ViewType", _view.ViewType.ToString());
|
||||
for (int i = 0; i < _ContentSettingDropdown.Selection.Count; i++)
|
||||
{
|
||||
if(_ContentSettingDropdown.Selection.Count != 0)
|
||||
writer.WriteAttributeString(_ContentSettingDropdown.Settings[_ContentSettingDropdown.Selection[i]].Replace(' ', '_'), _ContentSettingDropdown.Selection[i].ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -1093,17 +1154,14 @@ namespace FlaxEditor.Windows
|
||||
_view.ViewScale = value1;
|
||||
if (bool.TryParse(node.GetAttribute("ShowFileExtensions"), out bool value2))
|
||||
_view.ShowFileExtensions = value2;
|
||||
if (bool.TryParse(node.GetAttribute("ShowEngineFiles"), out value2))
|
||||
ShowEngineFiles = value2;
|
||||
if (bool.TryParse(node.GetAttribute("ShowPluginsFiles"), out value2))
|
||||
ShowPluginsFiles = value2;
|
||||
if (bool.TryParse(node.GetAttribute("ShowAllFiles"), out value2))
|
||||
ShowAllFiles = value2;
|
||||
if (Enum.TryParse(node.GetAttribute("ViewType"), out ContentViewType viewType))
|
||||
_view.ViewType = viewType;
|
||||
|
||||
for (int i = 0; i < _ContentSettingDropdown.Settings.Count; i++)
|
||||
{
|
||||
int flag;
|
||||
if (int.TryParse(node.GetAttribute(_ContentSettingDropdown.Settings[i].Replace(' ', '_')), out flag))
|
||||
_ContentSettingDropdown.Selection.Add(flag);
|
||||
|
||||
}
|
||||
ContentFilter.UpdateFilterVisability(_ContentSettingDropdown);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user