changed way that the the new menu is generated. Added category name to proxies
This commit is contained in:
@@ -16,6 +16,9 @@ namespace FlaxEditor.Content
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Animation Graph Function";
|
public override string Name => "Animation Graph Function";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Animation";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override EditorWindow Open(Editor editor, ContentItem item)
|
public override EditorWindow Open(Editor editor, ContentItem item)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ namespace FlaxEditor.Content
|
|||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Animation Graph";
|
public override string Name => "Animation Graph";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Animation";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override EditorWindow Open(Editor editor, ContentItem item)
|
public override EditorWindow Open(Editor editor, ContentItem item)
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ namespace FlaxEditor.Content
|
|||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Animation";
|
public override string Name => "Animation";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Animation";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanReimport(ContentItem item)
|
public override bool CanReimport(ContentItem item)
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ namespace FlaxEditor.Content
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract string TypeName { get; }
|
public abstract string TypeName { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The category name used to sort in context menus
|
||||||
|
/// </summary>
|
||||||
|
public abstract string CategoryName { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if this proxy supports the given asset type id at the given path.
|
/// Checks if this proxy supports the given asset type id at the given path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ namespace FlaxEditor.Content
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Audio Clip";
|
public override string Name => "Audio Clip";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Audio";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanReimport(ContentItem item)
|
public override bool CanReimport(ContentItem item)
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ namespace FlaxEditor.Content
|
|||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Collision Data";
|
public override string Name => "Collision Data";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Physics";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override EditorWindow Open(Editor editor, ContentItem item)
|
public override EditorWindow Open(Editor editor, ContentItem item)
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ namespace FlaxEditor.Content
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Cube Texture";
|
public override string Name => "Cube Texture";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Texture";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanReimport(ContentItem item)
|
public override bool CanReimport(ContentItem item)
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ namespace FlaxEditor.Content
|
|||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Font";
|
public override string Name => "Font";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Font";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanReimport(ContentItem item)
|
public override bool CanReimport(ContentItem item)
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ namespace FlaxEditor.Content
|
|||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Gameplay Globals";
|
public override string Name => "Gameplay Globals";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Globals";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override EditorWindow Open(Editor editor, ContentItem item)
|
public override EditorWindow Open(Editor editor, ContentItem item)
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ namespace FlaxEditor.Content
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "IES Profile";
|
public override string Name => "IES Profile";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Lighting";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanReimport(ContentItem item)
|
public override bool CanReimport(ContentItem item)
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ namespace FlaxEditor.Content
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Json Asset";
|
public override string Name => "Json Asset";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Json Asset";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string FileExtension => Extension;
|
public override string FileExtension => Extension;
|
||||||
@@ -165,6 +168,20 @@ namespace FlaxEditor.Content
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name { get; } = Utilities.Utils.GetPropertyNameUI(typeof(T).Name);
|
public override string Name { get; } = Utilities.Utils.GetPropertyNameUI(typeof(T).Name);
|
||||||
|
|
||||||
|
private string _categoryName;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => _categoryName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the category name
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">This is the category name</param>
|
||||||
|
public void SetCategoryName(string name)
|
||||||
|
{
|
||||||
|
_categoryName = name;
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanCreate(ContentFolder targetLocation)
|
public override bool CanCreate(ContentFolder targetLocation)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ namespace FlaxEditor.Content
|
|||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Material Function";
|
public override string Name => "Material Function";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Material";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override EditorWindow Open(Editor editor, ContentItem item)
|
public override EditorWindow Open(Editor editor, ContentItem item)
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ namespace FlaxEditor.Content
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Material Instance";
|
public override string Name => "Material Instance";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Material";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override EditorWindow Open(Editor editor, ContentItem item)
|
public override EditorWindow Open(Editor editor, ContentItem item)
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ namespace FlaxEditor.Content
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Material";
|
public override string Name => "Material";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Material";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override EditorWindow Open(Editor editor, ContentItem item)
|
public override EditorWindow Open(Editor editor, ContentItem item)
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ namespace FlaxEditor.Content
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Model";
|
public override string Name => "Model";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Model";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanReimport(ContentItem item)
|
public override bool CanReimport(ContentItem item)
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ namespace FlaxEditor.Content
|
|||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Particle Emitter Function";
|
public override string Name => "Particle Emitter Function";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Particles";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override EditorWindow Open(Editor editor, ContentItem item)
|
public override EditorWindow Open(Editor editor, ContentItem item)
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ namespace FlaxEditor.Content
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Particle Emitter";
|
public override string Name => "Particle Emitter";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Particles";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override EditorWindow Open(Editor editor, ContentItem item)
|
public override EditorWindow Open(Editor editor, ContentItem item)
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ namespace FlaxEditor.Content
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Particle System";
|
public override string Name => "Particle System";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Particles";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override EditorWindow Open(Editor editor, ContentItem item)
|
public override EditorWindow Open(Editor editor, ContentItem item)
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ namespace FlaxEditor.Content
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Prefab";
|
public override string Name => "Prefab";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Prefab";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string FileExtension => Extension;
|
public override string FileExtension => Extension;
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ namespace FlaxEditor.Content
|
|||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Previews Cache";
|
public override string Name => "Previews Cache";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Previews Cache";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override EditorWindow Open(Editor editor, ContentItem item)
|
public override EditorWindow Open(Editor editor, ContentItem item)
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ namespace FlaxEditor.Content
|
|||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Scene Animation";
|
public override string Name => "Scene Animation";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Animation";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override EditorWindow Open(Editor editor, ContentItem item)
|
public override EditorWindow Open(Editor editor, ContentItem item)
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ namespace FlaxEditor.Content
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Scene";
|
public override string Name => "Scene";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Scene";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string FileExtension => Extension;
|
public override string FileExtension => Extension;
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ namespace FlaxEditor.Content
|
|||||||
/// Gets the settings type.
|
/// Gets the settings type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Type Type => _type;
|
public Type Type => _type;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Settings";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="SettingsProxy"/> class.
|
/// Initializes a new instance of the <see cref="SettingsProxy"/> class.
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ namespace FlaxEditor.Content
|
|||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Shader";
|
public override string Name => "Shader";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Shader";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanReimport(ContentItem item)
|
public override bool CanReimport(ContentItem item)
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ namespace FlaxEditor.Content
|
|||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Skeleton Mask";
|
public override string Name => "Skeleton Mask";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Animation";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override EditorWindow Open(Editor editor, ContentItem item)
|
public override EditorWindow Open(Editor editor, ContentItem item)
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ namespace FlaxEditor.Content
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Skinned Model";
|
public override string Name => "Skinned Model";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Model";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanReimport(ContentItem item)
|
public override bool CanReimport(ContentItem item)
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ namespace FlaxEditor.Content
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Sprite Atlas";
|
public override string Name => "Sprite Atlas";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Sprites";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanReimport(ContentItem item)
|
public override bool CanReimport(ContentItem item)
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ namespace FlaxEditor.Content
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Texture";
|
public override string Name => "Texture";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Texture";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanReimport(ContentItem item)
|
public override bool CanReimport(ContentItem item)
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ namespace FlaxEditor.Content
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Name => "Visual Script";
|
public override string Name => "Visual Script";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string CategoryName => "Scripting";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override EditorWindow Open(Editor editor, ContentItem item)
|
public override EditorWindow Open(Editor editor, ContentItem item)
|
||||||
|
|||||||
@@ -927,7 +927,9 @@ namespace FlaxEditor.Modules
|
|||||||
Proxy.Add(new VisualScriptProxy());
|
Proxy.Add(new VisualScriptProxy());
|
||||||
Proxy.Add(new LocalizedStringTableProxy());
|
Proxy.Add(new LocalizedStringTableProxy());
|
||||||
Proxy.Add(new FileProxy());
|
Proxy.Add(new FileProxy());
|
||||||
Proxy.Add(new SpawnableJsonAssetProxy<PhysicalMaterial>());
|
var pm = new SpawnableJsonAssetProxy<PhysicalMaterial>();
|
||||||
|
pm.SetCategoryName("Physics");
|
||||||
|
Proxy.Add(pm);
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
Proxy.Add(new SettingsProxy(typeof(GameSettings), Editor.Instance.Icons.GameSettings128));
|
Proxy.Add(new SettingsProxy(typeof(GameSettings), Editor.Instance.Icons.GameSettings128));
|
||||||
|
|||||||
@@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using FlaxEditor.Content;
|
using FlaxEditor.Content;
|
||||||
using FlaxEditor.GUI.ContextMenu;
|
using FlaxEditor.GUI.ContextMenu;
|
||||||
using FlaxEngine;
|
using FlaxEngine;
|
||||||
using FlaxEngine.Assertions;
|
using FlaxEngine.Assertions;
|
||||||
|
using FlaxEngine.GUI;
|
||||||
using FlaxEngine.Json;
|
using FlaxEngine.Json;
|
||||||
|
|
||||||
namespace FlaxEditor.Windows
|
namespace FlaxEditor.Windows
|
||||||
@@ -17,35 +19,6 @@ namespace FlaxEditor.Windows
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<ContextMenu, ContentItem> ContextMenuShow;
|
public event Action<ContextMenu, ContentItem> ContextMenuShow;
|
||||||
|
|
||||||
private readonly List<string> _animationGroupNames = new List<string>()
|
|
||||||
{
|
|
||||||
"Animation",
|
|
||||||
"Animation Graph",
|
|
||||||
"Animation Graph Function",
|
|
||||||
"Skeleton Mask",
|
|
||||||
"Scene Animation",
|
|
||||||
};
|
|
||||||
|
|
||||||
private readonly List<string> _particleGroupNames = new List<string>()
|
|
||||||
{
|
|
||||||
"Particle Emitter",
|
|
||||||
"Particle Emitter Function",
|
|
||||||
"Particle System",
|
|
||||||
};
|
|
||||||
|
|
||||||
private readonly List<string> _materialGroupNames = new List<string>()
|
|
||||||
{
|
|
||||||
"Material",
|
|
||||||
"Material Function",
|
|
||||||
"Material Instance",
|
|
||||||
};
|
|
||||||
|
|
||||||
private readonly List<string> _physicsGroupNames = new List<string>()
|
|
||||||
{
|
|
||||||
"Collision Data",
|
|
||||||
"Physical Material",
|
|
||||||
};
|
|
||||||
|
|
||||||
private void ShowContextMenuForItem(ContentItem item, ref Float2 location, bool isTreeNode)
|
private void ShowContextMenuForItem(ContentItem item, ref Float2 location, bool isTreeNode)
|
||||||
{
|
{
|
||||||
Assert.IsNull(_newElement);
|
Assert.IsNull(_newElement);
|
||||||
@@ -180,6 +153,28 @@ namespace FlaxEditor.Windows
|
|||||||
cm.AddButton("New folder", NewFolder);
|
cm.AddButton("New folder", NewFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// categorize the asset proxies according to their category name
|
||||||
|
Dictionary<string, List<AssetProxy>> categorizedProxyList = new Dictionary<string, List<AssetProxy>>();
|
||||||
|
for (int i = 0; i < Editor.ContentDatabase.Proxy.Count; i++)
|
||||||
|
{
|
||||||
|
var p = Editor.ContentDatabase.Proxy[i];
|
||||||
|
if (p.CanCreate(folder))
|
||||||
|
{
|
||||||
|
if (p is AssetProxy ap)
|
||||||
|
{
|
||||||
|
if (categorizedProxyList.ContainsKey(ap.CategoryName))
|
||||||
|
{
|
||||||
|
categorizedProxyList.TryGetValue(ap.CategoryName, out var apList);
|
||||||
|
apList?.Add(ap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
categorizedProxyList.Add(ap.CategoryName, new List<AssetProxy>() {ap});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
c = cm.AddChildMenu("New");
|
c = cm.AddChildMenu("New");
|
||||||
c.ContextMenu.Tag = item;
|
c.ContextMenu.Tag = item;
|
||||||
c.ContextMenu.AutoSort = true;
|
c.ContextMenu.AutoSort = true;
|
||||||
@@ -189,17 +184,27 @@ namespace FlaxEditor.Windows
|
|||||||
var p = Editor.ContentDatabase.Proxy[i];
|
var p = Editor.ContentDatabase.Proxy[i];
|
||||||
if (p.CanCreate(folder))
|
if (p.CanCreate(folder))
|
||||||
{
|
{
|
||||||
if (_animationGroupNames.Contains(p.Name))
|
if (p is AssetProxy ap && categorizedProxyList.TryGetValue(ap.CategoryName, out var apList))
|
||||||
AddContentProxyToMenu(c.ContextMenu, p, "Animation");
|
{
|
||||||
else if (_particleGroupNames.Contains(p.Name))
|
if (apList.Contains(ap))
|
||||||
AddContentProxyToMenu(c.ContextMenu, p, "Particles");
|
{
|
||||||
else if (_materialGroupNames.Contains(p.Name))
|
if (apList.Count > 1)
|
||||||
AddContentProxyToMenu(c.ContextMenu, p, "Materials");
|
{
|
||||||
else if (_physicsGroupNames.Contains(p.Name))
|
var childMenu = c.ContextMenu.GetOrAddChildMenu(ap.CategoryName);
|
||||||
AddContentProxyToMenu(c.ContextMenu, p, "Physics");
|
childMenu.ContextMenu.AutoSort = true;
|
||||||
|
childMenu.ContextMenu.AddButton(p.Name, () => NewItem(p));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
c.ContextMenu.AddButton(p.Name, () => NewItem(p));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
c.ContextMenu.AddButton(p.Name, () => NewItem(p));
|
c.ContextMenu.AddButton(p.Name, () => NewItem(p));
|
||||||
|
}
|
||||||
|
|
||||||
newItems++;
|
newItems++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -218,21 +223,6 @@ namespace FlaxEditor.Windows
|
|||||||
cm.Show(this, location);
|
cm.Show(this, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddContentProxyToMenu(ContextMenu contextMenu, ContentProxy contentProxy, string menuName)
|
|
||||||
{
|
|
||||||
var childMenu = contextMenu.GetChildMenu(menuName);
|
|
||||||
if (childMenu == null)
|
|
||||||
{
|
|
||||||
var c = contextMenu.AddChildMenu(menuName);
|
|
||||||
c.ContextMenu.AutoSort = true;
|
|
||||||
c.ContextMenu.AddButton(contentProxy.Name, () => NewItem(contentProxy));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
childMenu.ContextMenu.AddButton(contentProxy.Name, () => NewItem(contentProxy));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnExpandAllClicked(ContextMenuButton button)
|
private void OnExpandAllClicked(ContextMenuButton button)
|
||||||
{
|
{
|
||||||
CurrentViewFolder.Node.ExpandAll();
|
CurrentViewFolder.Node.ExpandAll();
|
||||||
|
|||||||
Reference in New Issue
Block a user