From 3f135c832e90a3b96fd0eca3f899b7af26bd8b36 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Thu, 27 Oct 2022 23:05:51 -0500 Subject: [PATCH 01/22] organized the "new" child context menu into categories. --- .../Windows/ContentWindow.ContextMenu.cs | 62 ++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/Source/Editor/Windows/ContentWindow.ContextMenu.cs b/Source/Editor/Windows/ContentWindow.ContextMenu.cs index 7368c4efd..0bff62ab4 100644 --- a/Source/Editor/Windows/ContentWindow.ContextMenu.cs +++ b/Source/Editor/Windows/ContentWindow.ContextMenu.cs @@ -1,6 +1,7 @@ // Copyright (c) 2012-2022 Wojciech Figat. All rights reserved. using System; +using System.Collections.Generic; using FlaxEditor.Content; using FlaxEditor.GUI.ContextMenu; using FlaxEngine; @@ -16,6 +17,40 @@ namespace FlaxEditor.Windows /// public event Action ContextMenuShow; + private readonly string _animationMenuName = "Animation"; + private readonly string _materialMenuName = "Materials"; + private readonly string _particleMenuName = "Particles"; + private readonly string _physicsMenuName = "Physics"; + + private readonly List _animationGroupNames = new List() + { + "Animation", + "Animation Graph", + "Animation Graph Function", + "Skeleton Mask", + "Scene Animation", + }; + + private readonly List _particleGroup = new List() + { + "Particle Emitter", + "Particle Emitter Function", + "Particle System", + }; + + private readonly List _materialGroup = new List() + { + "Material", + "Material Function", + "Material Instance", + }; + + private readonly List _physicsGroup = new List() + { + "Collision Data", + "Physical Material", + }; + private void ShowContextMenuForItem(ContentItem item, ref Float2 location, bool isTreeNode) { Assert.IsNull(_newElement); @@ -159,7 +194,17 @@ namespace FlaxEditor.Windows var p = Editor.ContentDatabase.Proxy[i]; if (p.CanCreate(folder)) { - c.ContextMenu.AddButton(p.Name, () => NewItem(p)); + if (_animationGroupNames.Contains(p.Name)) + AddContentProxyToMenu(c.ContextMenu, p, _animationMenuName); + else if (_particleGroup.Contains(p.Name)) + AddContentProxyToMenu(c.ContextMenu, p, _particleMenuName); + else if (_materialGroup.Contains(p.Name)) + AddContentProxyToMenu(c.ContextMenu, p, _materialMenuName); + else if (_physicsGroup.Contains(p.Name)) + AddContentProxyToMenu(c.ContextMenu, p, _physicsMenuName); + else + c.ContextMenu.AddButton(p.Name, () => NewItem(p)); + newItems++; } } @@ -178,6 +223,21 @@ namespace FlaxEditor.Windows 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) { CurrentViewFolder.Node.ExpandAll(); From 3c689a4697a7ecdb83747c988f6ed8ef65dad700 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Fri, 28 Oct 2022 08:32:52 -0500 Subject: [PATCH 02/22] removed not needed variables and fixed variable names --- .../Windows/ContentWindow.ContextMenu.cs | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/Source/Editor/Windows/ContentWindow.ContextMenu.cs b/Source/Editor/Windows/ContentWindow.ContextMenu.cs index 0bff62ab4..c0dcc9b14 100644 --- a/Source/Editor/Windows/ContentWindow.ContextMenu.cs +++ b/Source/Editor/Windows/ContentWindow.ContextMenu.cs @@ -17,11 +17,6 @@ namespace FlaxEditor.Windows /// public event Action ContextMenuShow; - private readonly string _animationMenuName = "Animation"; - private readonly string _materialMenuName = "Materials"; - private readonly string _particleMenuName = "Particles"; - private readonly string _physicsMenuName = "Physics"; - private readonly List _animationGroupNames = new List() { "Animation", @@ -31,21 +26,21 @@ namespace FlaxEditor.Windows "Scene Animation", }; - private readonly List _particleGroup = new List() + private readonly List _particleGroupNames = new List() { "Particle Emitter", "Particle Emitter Function", "Particle System", }; - private readonly List _materialGroup = new List() + private readonly List _materialGroupNames = new List() { "Material", "Material Function", "Material Instance", }; - private readonly List _physicsGroup = new List() + private readonly List _physicsGroupNames = new List() { "Collision Data", "Physical Material", @@ -195,13 +190,13 @@ namespace FlaxEditor.Windows if (p.CanCreate(folder)) { if (_animationGroupNames.Contains(p.Name)) - AddContentProxyToMenu(c.ContextMenu, p, _animationMenuName); - else if (_particleGroup.Contains(p.Name)) - AddContentProxyToMenu(c.ContextMenu, p, _particleMenuName); - else if (_materialGroup.Contains(p.Name)) - AddContentProxyToMenu(c.ContextMenu, p, _materialMenuName); - else if (_physicsGroup.Contains(p.Name)) - AddContentProxyToMenu(c.ContextMenu, p, _physicsMenuName); + AddContentProxyToMenu(c.ContextMenu, p, "Animation"); + else if (_particleGroupNames.Contains(p.Name)) + AddContentProxyToMenu(c.ContextMenu, p, "Particles"); + else if (_materialGroupNames.Contains(p.Name)) + AddContentProxyToMenu(c.ContextMenu, p, "Materials"); + else if (_physicsGroupNames.Contains(p.Name)) + AddContentProxyToMenu(c.ContextMenu, p, "Physics"); else c.ContextMenu.AddButton(p.Name, () => NewItem(p)); From 050635b2cde5ae403598d813c699e89d757dfede Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sun, 30 Oct 2022 14:30:32 -0500 Subject: [PATCH 03/22] changed way that the the new menu is generated. Added category name to proxies --- .../Proxy/AnimationGraphFunctionProxy.cs | 3 + .../Content/Proxy/AnimationGraphProxy.cs | 3 + Source/Editor/Content/Proxy/AnimationProxy.cs | 3 + Source/Editor/Content/Proxy/AssetProxy.cs | 5 + Source/Editor/Content/Proxy/AudioClipProxy.cs | 3 + .../Content/Proxy/CollisionDataProxy.cs | 3 + .../Editor/Content/Proxy/CubeTextureProxy.cs | 3 + Source/Editor/Content/Proxy/FontProxy.cs | 3 + .../Content/Proxy/GameplayGlobalsProxy.cs | 3 + .../Editor/Content/Proxy/IESProfileProxy.cs | 3 + Source/Editor/Content/Proxy/JsonAssetProxy.cs | 17 ++++ .../Content/Proxy/MaterialFunctionProxy.cs | 3 + .../Content/Proxy/MaterialInstanceProxy.cs | 3 + Source/Editor/Content/Proxy/MaterialProxy.cs | 3 + Source/Editor/Content/Proxy/ModelProxy.cs | 3 + .../Proxy/ParticleEmitterFunctionProxy.cs | 3 + .../Content/Proxy/ParticleEmitterProxy.cs | 3 + .../Content/Proxy/ParticleSystemProxy.cs | 3 + Source/Editor/Content/Proxy/PrefabProxy.cs | 3 + .../Content/Proxy/PreviewsCacheProxy.cs | 3 + .../Content/Proxy/SceneAnimationProxy.cs | 3 + Source/Editor/Content/Proxy/SceneProxy.cs | 3 + Source/Editor/Content/Proxy/SettingsProxy.cs | 3 + Source/Editor/Content/Proxy/ShaderProxy.cs | 3 + .../Editor/Content/Proxy/SkeletonMaskProxy.cs | 3 + .../Editor/Content/Proxy/SkinnedModelProxy.cs | 3 + .../Editor/Content/Proxy/SpriteAtlasProxy.cs | 3 + Source/Editor/Content/Proxy/TextureProxy.cs | 3 + .../Editor/Content/Proxy/VisualScriptProxy.cs | 3 + .../Editor/Modules/ContentDatabaseModule.cs | 4 +- .../Windows/ContentWindow.ContextMenu.cs | 96 +++++++++---------- 31 files changed, 149 insertions(+), 54 deletions(-) diff --git a/Source/Editor/Content/Proxy/AnimationGraphFunctionProxy.cs b/Source/Editor/Content/Proxy/AnimationGraphFunctionProxy.cs index c4ea2e09a..cb611d2f8 100644 --- a/Source/Editor/Content/Proxy/AnimationGraphFunctionProxy.cs +++ b/Source/Editor/Content/Proxy/AnimationGraphFunctionProxy.cs @@ -16,6 +16,9 @@ namespace FlaxEditor.Content /// public override string Name => "Animation Graph Function"; + /// + public override string CategoryName => "Animation"; + /// public override EditorWindow Open(Editor editor, ContentItem item) { diff --git a/Source/Editor/Content/Proxy/AnimationGraphProxy.cs b/Source/Editor/Content/Proxy/AnimationGraphProxy.cs index 3c445c104..103fee18e 100644 --- a/Source/Editor/Content/Proxy/AnimationGraphProxy.cs +++ b/Source/Editor/Content/Proxy/AnimationGraphProxy.cs @@ -15,6 +15,9 @@ namespace FlaxEditor.Content { /// public override string Name => "Animation Graph"; + + /// + public override string CategoryName => "Animation"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/AnimationProxy.cs b/Source/Editor/Content/Proxy/AnimationProxy.cs index bda0fa98d..07b613dcb 100644 --- a/Source/Editor/Content/Proxy/AnimationProxy.cs +++ b/Source/Editor/Content/Proxy/AnimationProxy.cs @@ -18,6 +18,9 @@ namespace FlaxEditor.Content { /// public override string Name => "Animation"; + + /// + public override string CategoryName => "Animation"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/AssetProxy.cs b/Source/Editor/Content/Proxy/AssetProxy.cs index 6516dbc37..772b00a20 100644 --- a/Source/Editor/Content/Proxy/AssetProxy.cs +++ b/Source/Editor/Content/Proxy/AssetProxy.cs @@ -22,6 +22,11 @@ namespace FlaxEditor.Content /// public abstract string TypeName { get; } + /// + /// The category name used to sort in context menus + /// + public abstract string CategoryName { get; } + /// /// Checks if this proxy supports the given asset type id at the given path. /// diff --git a/Source/Editor/Content/Proxy/AudioClipProxy.cs b/Source/Editor/Content/Proxy/AudioClipProxy.cs index 8b9ace491..f52802234 100644 --- a/Source/Editor/Content/Proxy/AudioClipProxy.cs +++ b/Source/Editor/Content/Proxy/AudioClipProxy.cs @@ -62,6 +62,9 @@ namespace FlaxEditor.Content /// public override string Name => "Audio Clip"; + + /// + public override string CategoryName => "Audio"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/CollisionDataProxy.cs b/Source/Editor/Content/Proxy/CollisionDataProxy.cs index cca8a8192..4bddbf063 100644 --- a/Source/Editor/Content/Proxy/CollisionDataProxy.cs +++ b/Source/Editor/Content/Proxy/CollisionDataProxy.cs @@ -42,6 +42,9 @@ namespace FlaxEditor.Content { /// public override string Name => "Collision Data"; + + /// + public override string CategoryName => "Physics"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/CubeTextureProxy.cs b/Source/Editor/Content/Proxy/CubeTextureProxy.cs index d89771b13..653e71ce3 100644 --- a/Source/Editor/Content/Proxy/CubeTextureProxy.cs +++ b/Source/Editor/Content/Proxy/CubeTextureProxy.cs @@ -20,6 +20,9 @@ namespace FlaxEditor.Content /// public override string Name => "Cube Texture"; + + /// + public override string CategoryName => "Texture"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/FontProxy.cs b/Source/Editor/Content/Proxy/FontProxy.cs index 10f0d9076..bb78d5ab0 100644 --- a/Source/Editor/Content/Proxy/FontProxy.cs +++ b/Source/Editor/Content/Proxy/FontProxy.cs @@ -17,6 +17,9 @@ namespace FlaxEditor.Content { /// public override string Name => "Font"; + + /// + public override string CategoryName => "Font"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/GameplayGlobalsProxy.cs b/Source/Editor/Content/Proxy/GameplayGlobalsProxy.cs index 7c8a7268d..60a9b78bb 100644 --- a/Source/Editor/Content/Proxy/GameplayGlobalsProxy.cs +++ b/Source/Editor/Content/Proxy/GameplayGlobalsProxy.cs @@ -15,6 +15,9 @@ namespace FlaxEditor.Content { /// public override string Name => "Gameplay Globals"; + + /// + public override string CategoryName => "Globals"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/IESProfileProxy.cs b/Source/Editor/Content/Proxy/IESProfileProxy.cs index 55b4c8d47..8ec932106 100644 --- a/Source/Editor/Content/Proxy/IESProfileProxy.cs +++ b/Source/Editor/Content/Proxy/IESProfileProxy.cs @@ -20,6 +20,9 @@ namespace FlaxEditor.Content /// public override string Name => "IES Profile"; + + /// + public override string CategoryName => "Lighting"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/JsonAssetProxy.cs b/Source/Editor/Content/Proxy/JsonAssetProxy.cs index 3f2863f74..2f48a1b6c 100644 --- a/Source/Editor/Content/Proxy/JsonAssetProxy.cs +++ b/Source/Editor/Content/Proxy/JsonAssetProxy.cs @@ -31,6 +31,9 @@ namespace FlaxEditor.Content /// public override string Name => "Json Asset"; + + /// + public override string CategoryName => "Json Asset"; /// public override string FileExtension => Extension; @@ -165,6 +168,20 @@ namespace FlaxEditor.Content /// public override string Name { get; } = Utilities.Utils.GetPropertyNameUI(typeof(T).Name); + private string _categoryName; + + /// + public override string CategoryName => _categoryName; + + /// + /// Sets the category name + /// + /// This is the category name + public void SetCategoryName(string name) + { + _categoryName = name; + } + /// public override bool CanCreate(ContentFolder targetLocation) { diff --git a/Source/Editor/Content/Proxy/MaterialFunctionProxy.cs b/Source/Editor/Content/Proxy/MaterialFunctionProxy.cs index 702f04706..c2c317342 100644 --- a/Source/Editor/Content/Proxy/MaterialFunctionProxy.cs +++ b/Source/Editor/Content/Proxy/MaterialFunctionProxy.cs @@ -15,6 +15,9 @@ namespace FlaxEditor.Content { /// public override string Name => "Material Function"; + + /// + public override string CategoryName => "Material"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/MaterialInstanceProxy.cs b/Source/Editor/Content/Proxy/MaterialInstanceProxy.cs index 663c191ef..ea0a73cbe 100644 --- a/Source/Editor/Content/Proxy/MaterialInstanceProxy.cs +++ b/Source/Editor/Content/Proxy/MaterialInstanceProxy.cs @@ -20,6 +20,9 @@ namespace FlaxEditor.Content /// public override string Name => "Material Instance"; + + /// + public override string CategoryName => "Material"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/MaterialProxy.cs b/Source/Editor/Content/Proxy/MaterialProxy.cs index e2e74eb14..2da83bf96 100644 --- a/Source/Editor/Content/Proxy/MaterialProxy.cs +++ b/Source/Editor/Content/Proxy/MaterialProxy.cs @@ -21,6 +21,9 @@ namespace FlaxEditor.Content /// public override string Name => "Material"; + + /// + public override string CategoryName => "Material"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/ModelProxy.cs b/Source/Editor/Content/Proxy/ModelProxy.cs index b99d15134..ed0633ce4 100644 --- a/Source/Editor/Content/Proxy/ModelProxy.cs +++ b/Source/Editor/Content/Proxy/ModelProxy.cs @@ -21,6 +21,9 @@ namespace FlaxEditor.Content /// public override string Name => "Model"; + + /// + public override string CategoryName => "Model"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/ParticleEmitterFunctionProxy.cs b/Source/Editor/Content/Proxy/ParticleEmitterFunctionProxy.cs index 24cc22690..c56e5f695 100644 --- a/Source/Editor/Content/Proxy/ParticleEmitterFunctionProxy.cs +++ b/Source/Editor/Content/Proxy/ParticleEmitterFunctionProxy.cs @@ -15,6 +15,9 @@ namespace FlaxEditor.Content { /// public override string Name => "Particle Emitter Function"; + + /// + public override string CategoryName => "Particles"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/ParticleEmitterProxy.cs b/Source/Editor/Content/Proxy/ParticleEmitterProxy.cs index 089c614da..391670085 100644 --- a/Source/Editor/Content/Proxy/ParticleEmitterProxy.cs +++ b/Source/Editor/Content/Proxy/ParticleEmitterProxy.cs @@ -22,6 +22,9 @@ namespace FlaxEditor.Content /// public override string Name => "Particle Emitter"; + + /// + public override string CategoryName => "Particles"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/ParticleSystemProxy.cs b/Source/Editor/Content/Proxy/ParticleSystemProxy.cs index c19e84a78..b1fda9b60 100644 --- a/Source/Editor/Content/Proxy/ParticleSystemProxy.cs +++ b/Source/Editor/Content/Proxy/ParticleSystemProxy.cs @@ -46,6 +46,9 @@ namespace FlaxEditor.Content /// public override string Name => "Particle System"; + + /// + public override string CategoryName => "Particles"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/PrefabProxy.cs b/Source/Editor/Content/Proxy/PrefabProxy.cs index 64eb1d9f1..16e00069f 100644 --- a/Source/Editor/Content/Proxy/PrefabProxy.cs +++ b/Source/Editor/Content/Proxy/PrefabProxy.cs @@ -31,6 +31,9 @@ namespace FlaxEditor.Content /// public override string Name => "Prefab"; + + /// + public override string CategoryName => "Prefab"; /// public override string FileExtension => Extension; diff --git a/Source/Editor/Content/Proxy/PreviewsCacheProxy.cs b/Source/Editor/Content/Proxy/PreviewsCacheProxy.cs index b3bc6e73f..16c6ae9f2 100644 --- a/Source/Editor/Content/Proxy/PreviewsCacheProxy.cs +++ b/Source/Editor/Content/Proxy/PreviewsCacheProxy.cs @@ -15,6 +15,9 @@ namespace FlaxEditor.Content { /// public override string Name => "Previews Cache"; + + /// + public override string CategoryName => "Previews Cache"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/SceneAnimationProxy.cs b/Source/Editor/Content/Proxy/SceneAnimationProxy.cs index 30409208e..4bebe20f6 100644 --- a/Source/Editor/Content/Proxy/SceneAnimationProxy.cs +++ b/Source/Editor/Content/Proxy/SceneAnimationProxy.cs @@ -40,6 +40,9 @@ namespace FlaxEditor.Content { /// public override string Name => "Scene Animation"; + + /// + public override string CategoryName => "Animation"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/SceneProxy.cs b/Source/Editor/Content/Proxy/SceneProxy.cs index 7856fa064..6be481250 100644 --- a/Source/Editor/Content/Proxy/SceneProxy.cs +++ b/Source/Editor/Content/Proxy/SceneProxy.cs @@ -19,6 +19,9 @@ namespace FlaxEditor.Content /// public override string Name => "Scene"; + + /// + public override string CategoryName => "Scene"; /// public override string FileExtension => Extension; diff --git a/Source/Editor/Content/Proxy/SettingsProxy.cs b/Source/Editor/Content/Proxy/SettingsProxy.cs index 0bbd2830f..abe63f06e 100644 --- a/Source/Editor/Content/Proxy/SettingsProxy.cs +++ b/Source/Editor/Content/Proxy/SettingsProxy.cs @@ -20,6 +20,9 @@ namespace FlaxEditor.Content /// Gets the settings type. /// public Type Type => _type; + + /// + public override string CategoryName => "Settings"; /// /// Initializes a new instance of the class. diff --git a/Source/Editor/Content/Proxy/ShaderProxy.cs b/Source/Editor/Content/Proxy/ShaderProxy.cs index b65949460..76fd02897 100644 --- a/Source/Editor/Content/Proxy/ShaderProxy.cs +++ b/Source/Editor/Content/Proxy/ShaderProxy.cs @@ -14,6 +14,9 @@ namespace FlaxEditor.Content { /// public override string Name => "Shader"; + + /// + public override string CategoryName => "Shader"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/SkeletonMaskProxy.cs b/Source/Editor/Content/Proxy/SkeletonMaskProxy.cs index 2a90820b0..d84bf3fe8 100644 --- a/Source/Editor/Content/Proxy/SkeletonMaskProxy.cs +++ b/Source/Editor/Content/Proxy/SkeletonMaskProxy.cs @@ -15,6 +15,9 @@ namespace FlaxEditor.Content { /// public override string Name => "Skeleton Mask"; + + /// + public override string CategoryName => "Animation"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/SkinnedModelProxy.cs b/Source/Editor/Content/Proxy/SkinnedModelProxy.cs index 597c69a1d..18276604e 100644 --- a/Source/Editor/Content/Proxy/SkinnedModelProxy.cs +++ b/Source/Editor/Content/Proxy/SkinnedModelProxy.cs @@ -20,6 +20,9 @@ namespace FlaxEditor.Content /// public override string Name => "Skinned Model"; + + /// + public override string CategoryName => "Model"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/SpriteAtlasProxy.cs b/Source/Editor/Content/Proxy/SpriteAtlasProxy.cs index 5184abafb..fce7e22e5 100644 --- a/Source/Editor/Content/Proxy/SpriteAtlasProxy.cs +++ b/Source/Editor/Content/Proxy/SpriteAtlasProxy.cs @@ -20,6 +20,9 @@ namespace FlaxEditor.Content /// public override string Name => "Sprite Atlas"; + + /// + public override string CategoryName => "Sprites"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/TextureProxy.cs b/Source/Editor/Content/Proxy/TextureProxy.cs index 67de33851..ce292d5b3 100644 --- a/Source/Editor/Content/Proxy/TextureProxy.cs +++ b/Source/Editor/Content/Proxy/TextureProxy.cs @@ -20,6 +20,9 @@ namespace FlaxEditor.Content /// public override string Name => "Texture"; + + /// + public override string CategoryName => "Texture"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/VisualScriptProxy.cs b/Source/Editor/Content/Proxy/VisualScriptProxy.cs index b065a4fcd..540e46945 100644 --- a/Source/Editor/Content/Proxy/VisualScriptProxy.cs +++ b/Source/Editor/Content/Proxy/VisualScriptProxy.cs @@ -24,6 +24,9 @@ namespace FlaxEditor.Content /// public override string Name => "Visual Script"; + + /// + public override string CategoryName => "Scripting"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Modules/ContentDatabaseModule.cs b/Source/Editor/Modules/ContentDatabaseModule.cs index a3ee714ae..990d42615 100644 --- a/Source/Editor/Modules/ContentDatabaseModule.cs +++ b/Source/Editor/Modules/ContentDatabaseModule.cs @@ -927,7 +927,9 @@ namespace FlaxEditor.Modules Proxy.Add(new VisualScriptProxy()); Proxy.Add(new LocalizedStringTableProxy()); Proxy.Add(new FileProxy()); - Proxy.Add(new SpawnableJsonAssetProxy()); + var pm = new SpawnableJsonAssetProxy(); + pm.SetCategoryName("Physics"); + Proxy.Add(pm); // Settings Proxy.Add(new SettingsProxy(typeof(GameSettings), Editor.Instance.Icons.GameSettings128)); diff --git a/Source/Editor/Windows/ContentWindow.ContextMenu.cs b/Source/Editor/Windows/ContentWindow.ContextMenu.cs index c0dcc9b14..7f27e0cd3 100644 --- a/Source/Editor/Windows/ContentWindow.ContextMenu.cs +++ b/Source/Editor/Windows/ContentWindow.ContextMenu.cs @@ -2,10 +2,12 @@ using System; using System.Collections.Generic; +using System.Linq; using FlaxEditor.Content; using FlaxEditor.GUI.ContextMenu; using FlaxEngine; using FlaxEngine.Assertions; +using FlaxEngine.GUI; using FlaxEngine.Json; namespace FlaxEditor.Windows @@ -17,35 +19,6 @@ namespace FlaxEditor.Windows /// public event Action ContextMenuShow; - private readonly List _animationGroupNames = new List() - { - "Animation", - "Animation Graph", - "Animation Graph Function", - "Skeleton Mask", - "Scene Animation", - }; - - private readonly List _particleGroupNames = new List() - { - "Particle Emitter", - "Particle Emitter Function", - "Particle System", - }; - - private readonly List _materialGroupNames = new List() - { - "Material", - "Material Function", - "Material Instance", - }; - - private readonly List _physicsGroupNames = new List() - { - "Collision Data", - "Physical Material", - }; - private void ShowContextMenuForItem(ContentItem item, ref Float2 location, bool isTreeNode) { Assert.IsNull(_newElement); @@ -180,6 +153,28 @@ namespace FlaxEditor.Windows cm.AddButton("New folder", NewFolder); } + // categorize the asset proxies according to their category name + Dictionary> categorizedProxyList = new Dictionary>(); + 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() {ap}); + } + } + } + } + c = cm.AddChildMenu("New"); c.ContextMenu.Tag = item; c.ContextMenu.AutoSort = true; @@ -189,17 +184,27 @@ namespace FlaxEditor.Windows var p = Editor.ContentDatabase.Proxy[i]; if (p.CanCreate(folder)) { - if (_animationGroupNames.Contains(p.Name)) - AddContentProxyToMenu(c.ContextMenu, p, "Animation"); - else if (_particleGroupNames.Contains(p.Name)) - AddContentProxyToMenu(c.ContextMenu, p, "Particles"); - else if (_materialGroupNames.Contains(p.Name)) - AddContentProxyToMenu(c.ContextMenu, p, "Materials"); - else if (_physicsGroupNames.Contains(p.Name)) - AddContentProxyToMenu(c.ContextMenu, p, "Physics"); + if (p is AssetProxy ap && categorizedProxyList.TryGetValue(ap.CategoryName, out var apList)) + { + if (apList.Contains(ap)) + { + if (apList.Count > 1) + { + var childMenu = c.ContextMenu.GetOrAddChildMenu(ap.CategoryName); + childMenu.ContextMenu.AutoSort = true; + childMenu.ContextMenu.AddButton(p.Name, () => NewItem(p)); + } + else + { + c.ContextMenu.AddButton(p.Name, () => NewItem(p)); + } + } + } else + { c.ContextMenu.AddButton(p.Name, () => NewItem(p)); - + } + newItems++; } } @@ -218,21 +223,6 @@ namespace FlaxEditor.Windows 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) { CurrentViewFolder.Node.ExpandAll(); From a1e4400994396f7dc4a7f560a4e6134f49d57cc7 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Wed, 2 Nov 2022 17:57:40 -0500 Subject: [PATCH 04/22] changed to use attribute to add items to the content context menu, this also allows users to add their own items to the CM --- .../Proxy/AnimationGraphFunctionProxy.cs | 4 +- .../Content/Proxy/AnimationGraphProxy.cs | 4 +- Source/Editor/Content/Proxy/AnimationProxy.cs | 4 +- Source/Editor/Content/Proxy/AssetProxy.cs | 5 - Source/Editor/Content/Proxy/AudioClipProxy.cs | 3 - .../Editor/Content/Proxy/CSharpScriptProxy.cs | 1 + .../Content/Proxy/CollisionDataProxy.cs | 4 +- Source/Editor/Content/Proxy/CppProxy.cs | 3 + .../Editor/Content/Proxy/CubeTextureProxy.cs | 3 - Source/Editor/Content/Proxy/FontProxy.cs | 3 - .../Content/Proxy/GameplayGlobalsProxy.cs | 4 +- .../Editor/Content/Proxy/IESProfileProxy.cs | 3 - Source/Editor/Content/Proxy/JsonAssetProxy.cs | 18 +-- .../Content/Proxy/MaterialFunctionProxy.cs | 4 +- .../Content/Proxy/MaterialInstanceProxy.cs | 4 +- Source/Editor/Content/Proxy/MaterialProxy.cs | 4 +- Source/Editor/Content/Proxy/ModelProxy.cs | 3 - .../Proxy/ParticleEmitterFunctionProxy.cs | 4 +- .../Content/Proxy/ParticleEmitterProxy.cs | 4 +- .../Content/Proxy/ParticleSystemProxy.cs | 4 +- Source/Editor/Content/Proxy/PrefabProxy.cs | 4 +- .../Content/Proxy/PreviewsCacheProxy.cs | 3 - .../Content/Proxy/SceneAnimationProxy.cs | 3 - Source/Editor/Content/Proxy/SceneProxy.cs | 4 +- Source/Editor/Content/Proxy/SettingsProxy.cs | 4 +- Source/Editor/Content/Proxy/ShaderProxy.cs | 3 - .../Editor/Content/Proxy/SkeletonMaskProxy.cs | 4 +- .../Editor/Content/Proxy/SkinnedModelProxy.cs | 3 - .../Editor/Content/Proxy/SpriteAtlasProxy.cs | 3 - Source/Editor/Content/Proxy/TextureProxy.cs | 3 - .../Editor/Content/Proxy/VisualScriptProxy.cs | 4 +- .../Editor/Modules/ContentDatabaseModule.cs | 4 +- .../Windows/ContentWindow.ContextMenu.cs | 105 ++++++++++-------- Source/Engine/Physics/PhysicalMaterial.h | 2 +- .../Attributes/Editor/ContentContextMenu.cs | 26 +++++ 35 files changed, 109 insertions(+), 152 deletions(-) create mode 100644 Source/Engine/Scripting/Attributes/Editor/ContentContextMenu.cs diff --git a/Source/Editor/Content/Proxy/AnimationGraphFunctionProxy.cs b/Source/Editor/Content/Proxy/AnimationGraphFunctionProxy.cs index cb611d2f8..a8092a162 100644 --- a/Source/Editor/Content/Proxy/AnimationGraphFunctionProxy.cs +++ b/Source/Editor/Content/Proxy/AnimationGraphFunctionProxy.cs @@ -11,14 +11,12 @@ namespace FlaxEditor.Content /// A asset proxy object. /// /// + [ContentContextMenu("New/Animation/Animation Graph Function")] public class AnimationGraphFunctionProxy : BinaryAssetProxy { /// public override string Name => "Animation Graph Function"; - /// - public override string CategoryName => "Animation"; - /// public override EditorWindow Open(Editor editor, ContentItem item) { diff --git a/Source/Editor/Content/Proxy/AnimationGraphProxy.cs b/Source/Editor/Content/Proxy/AnimationGraphProxy.cs index 103fee18e..7f43b8c7b 100644 --- a/Source/Editor/Content/Proxy/AnimationGraphProxy.cs +++ b/Source/Editor/Content/Proxy/AnimationGraphProxy.cs @@ -11,13 +11,11 @@ namespace FlaxEditor.Content /// A asset proxy object. /// /// + [ContentContextMenu("New/Animation/Animation Graph")] public class AnimationGraphProxy : BinaryAssetProxy { /// public override string Name => "Animation Graph"; - - /// - public override string CategoryName => "Animation"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/AnimationProxy.cs b/Source/Editor/Content/Proxy/AnimationProxy.cs index 07b613dcb..eb8c892ab 100644 --- a/Source/Editor/Content/Proxy/AnimationProxy.cs +++ b/Source/Editor/Content/Proxy/AnimationProxy.cs @@ -14,13 +14,11 @@ namespace FlaxEditor.Content /// A asset proxy object. /// /// + [ContentContextMenu("New/Animation/Animation")] public class AnimationProxy : BinaryAssetProxy { /// public override string Name => "Animation"; - - /// - public override string CategoryName => "Animation"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/AssetProxy.cs b/Source/Editor/Content/Proxy/AssetProxy.cs index 772b00a20..6516dbc37 100644 --- a/Source/Editor/Content/Proxy/AssetProxy.cs +++ b/Source/Editor/Content/Proxy/AssetProxy.cs @@ -22,11 +22,6 @@ namespace FlaxEditor.Content /// public abstract string TypeName { get; } - /// - /// The category name used to sort in context menus - /// - public abstract string CategoryName { get; } - /// /// Checks if this proxy supports the given asset type id at the given path. /// diff --git a/Source/Editor/Content/Proxy/AudioClipProxy.cs b/Source/Editor/Content/Proxy/AudioClipProxy.cs index f52802234..8b9ace491 100644 --- a/Source/Editor/Content/Proxy/AudioClipProxy.cs +++ b/Source/Editor/Content/Proxy/AudioClipProxy.cs @@ -62,9 +62,6 @@ namespace FlaxEditor.Content /// public override string Name => "Audio Clip"; - - /// - public override string CategoryName => "Audio"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/CSharpScriptProxy.cs b/Source/Editor/Content/Proxy/CSharpScriptProxy.cs index 332695695..a871d0589 100644 --- a/Source/Editor/Content/Proxy/CSharpScriptProxy.cs +++ b/Source/Editor/Content/Proxy/CSharpScriptProxy.cs @@ -12,6 +12,7 @@ namespace FlaxEditor.Content /// Context proxy object for C# script files. /// /// + [ContentContextMenu("New/C# Script")] public class CSharpScriptProxy : ScriptProxy { /// diff --git a/Source/Editor/Content/Proxy/CollisionDataProxy.cs b/Source/Editor/Content/Proxy/CollisionDataProxy.cs index 4bddbf063..b6ff2e75f 100644 --- a/Source/Editor/Content/Proxy/CollisionDataProxy.cs +++ b/Source/Editor/Content/Proxy/CollisionDataProxy.cs @@ -38,13 +38,11 @@ namespace FlaxEditor.Content /// A asset proxy object. /// /// + [ContentContextMenu("New/Physics/Collision Data")] class CollisionDataProxy : BinaryAssetProxy { /// public override string Name => "Collision Data"; - - /// - public override string CategoryName => "Physics"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/CppProxy.cs b/Source/Editor/Content/Proxy/CppProxy.cs index d975b8778..6581dccd2 100644 --- a/Source/Editor/Content/Proxy/CppProxy.cs +++ b/Source/Editor/Content/Proxy/CppProxy.cs @@ -75,6 +75,7 @@ namespace FlaxEditor.Content /// Context proxy object for C++ script files. /// /// + [ContentContextMenu("New/C++/C++ Script")] public class CppScriptProxy : CppProxy { /// @@ -98,6 +99,7 @@ namespace FlaxEditor.Content /// Context proxy object for C++ Json Asset files. /// /// + [ContentContextMenu("New/C++/C++ Function Library")] public class CppStaticClassProxy : CppProxy { /// @@ -115,6 +117,7 @@ namespace FlaxEditor.Content /// Context proxy object for C++ Json Asset files. /// /// + [ContentContextMenu("New/C++/C++ Json Asset")] public class CppAssetProxy : CppProxy { /// diff --git a/Source/Editor/Content/Proxy/CubeTextureProxy.cs b/Source/Editor/Content/Proxy/CubeTextureProxy.cs index 653e71ce3..d89771b13 100644 --- a/Source/Editor/Content/Proxy/CubeTextureProxy.cs +++ b/Source/Editor/Content/Proxy/CubeTextureProxy.cs @@ -20,9 +20,6 @@ namespace FlaxEditor.Content /// public override string Name => "Cube Texture"; - - /// - public override string CategoryName => "Texture"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/FontProxy.cs b/Source/Editor/Content/Proxy/FontProxy.cs index bb78d5ab0..10f0d9076 100644 --- a/Source/Editor/Content/Proxy/FontProxy.cs +++ b/Source/Editor/Content/Proxy/FontProxy.cs @@ -17,9 +17,6 @@ namespace FlaxEditor.Content { /// public override string Name => "Font"; - - /// - public override string CategoryName => "Font"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/GameplayGlobalsProxy.cs b/Source/Editor/Content/Proxy/GameplayGlobalsProxy.cs index 60a9b78bb..af391a8c4 100644 --- a/Source/Editor/Content/Proxy/GameplayGlobalsProxy.cs +++ b/Source/Editor/Content/Proxy/GameplayGlobalsProxy.cs @@ -11,13 +11,11 @@ namespace FlaxEditor.Content /// A asset proxy object. /// /// + [ContentContextMenu("New/Gameplay Globals")] public class GameplayGlobalsProxy : BinaryAssetProxy { /// public override string Name => "Gameplay Globals"; - - /// - public override string CategoryName => "Globals"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/IESProfileProxy.cs b/Source/Editor/Content/Proxy/IESProfileProxy.cs index 8ec932106..55b4c8d47 100644 --- a/Source/Editor/Content/Proxy/IESProfileProxy.cs +++ b/Source/Editor/Content/Proxy/IESProfileProxy.cs @@ -20,9 +20,6 @@ namespace FlaxEditor.Content /// public override string Name => "IES Profile"; - - /// - public override string CategoryName => "Lighting"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/JsonAssetProxy.cs b/Source/Editor/Content/Proxy/JsonAssetProxy.cs index 2f48a1b6c..8bfaae384 100644 --- a/Source/Editor/Content/Proxy/JsonAssetProxy.cs +++ b/Source/Editor/Content/Proxy/JsonAssetProxy.cs @@ -22,6 +22,7 @@ namespace FlaxEditor.Content /// Json assets proxy. /// /// + [ContentContextMenu("New/Json Asset")] public abstract class JsonAssetProxy : JsonAssetBaseProxy { /// @@ -31,9 +32,6 @@ namespace FlaxEditor.Content /// public override string Name => "Json Asset"; - - /// - public override string CategoryName => "Json Asset"; /// public override string FileExtension => Extension; @@ -168,20 +166,6 @@ namespace FlaxEditor.Content /// public override string Name { get; } = Utilities.Utils.GetPropertyNameUI(typeof(T).Name); - private string _categoryName; - - /// - public override string CategoryName => _categoryName; - - /// - /// Sets the category name - /// - /// This is the category name - public void SetCategoryName(string name) - { - _categoryName = name; - } - /// public override bool CanCreate(ContentFolder targetLocation) { diff --git a/Source/Editor/Content/Proxy/MaterialFunctionProxy.cs b/Source/Editor/Content/Proxy/MaterialFunctionProxy.cs index c2c317342..f8c868cb5 100644 --- a/Source/Editor/Content/Proxy/MaterialFunctionProxy.cs +++ b/Source/Editor/Content/Proxy/MaterialFunctionProxy.cs @@ -11,13 +11,11 @@ namespace FlaxEditor.Content /// A asset proxy object. /// /// + [ContentContextMenu("New/Material/Material Function")] public class MaterialFunctionProxy : BinaryAssetProxy { /// public override string Name => "Material Function"; - - /// - public override string CategoryName => "Material"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/MaterialInstanceProxy.cs b/Source/Editor/Content/Proxy/MaterialInstanceProxy.cs index ea0a73cbe..60ff9bc51 100644 --- a/Source/Editor/Content/Proxy/MaterialInstanceProxy.cs +++ b/Source/Editor/Content/Proxy/MaterialInstanceProxy.cs @@ -14,15 +14,13 @@ namespace FlaxEditor.Content /// A asset proxy object. /// /// + [ContentContextMenu("New/Material/Material Instance")] public class MaterialInstanceProxy : BinaryAssetProxy { private MaterialPreview _preview; /// public override string Name => "Material Instance"; - - /// - public override string CategoryName => "Material"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/MaterialProxy.cs b/Source/Editor/Content/Proxy/MaterialProxy.cs index 2da83bf96..68c9c81b7 100644 --- a/Source/Editor/Content/Proxy/MaterialProxy.cs +++ b/Source/Editor/Content/Proxy/MaterialProxy.cs @@ -15,15 +15,13 @@ namespace FlaxEditor.Content /// A asset proxy object. /// /// + [ContentContextMenu("New/Material/Material")] public class MaterialProxy : BinaryAssetProxy { private MaterialPreview _preview; /// public override string Name => "Material"; - - /// - public override string CategoryName => "Material"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/ModelProxy.cs b/Source/Editor/Content/Proxy/ModelProxy.cs index ed0633ce4..b99d15134 100644 --- a/Source/Editor/Content/Proxy/ModelProxy.cs +++ b/Source/Editor/Content/Proxy/ModelProxy.cs @@ -21,9 +21,6 @@ namespace FlaxEditor.Content /// public override string Name => "Model"; - - /// - public override string CategoryName => "Model"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/ParticleEmitterFunctionProxy.cs b/Source/Editor/Content/Proxy/ParticleEmitterFunctionProxy.cs index c56e5f695..b508bb818 100644 --- a/Source/Editor/Content/Proxy/ParticleEmitterFunctionProxy.cs +++ b/Source/Editor/Content/Proxy/ParticleEmitterFunctionProxy.cs @@ -11,13 +11,11 @@ namespace FlaxEditor.Content /// A asset proxy object. /// /// + [ContentContextMenu("New/Particles/Particle Emitter Function")] public class ParticleEmitterFunctionProxy : BinaryAssetProxy { /// public override string Name => "Particle Emitter Function"; - - /// - public override string CategoryName => "Particles"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/ParticleEmitterProxy.cs b/Source/Editor/Content/Proxy/ParticleEmitterProxy.cs index 391670085..be07720d2 100644 --- a/Source/Editor/Content/Proxy/ParticleEmitterProxy.cs +++ b/Source/Editor/Content/Proxy/ParticleEmitterProxy.cs @@ -15,6 +15,7 @@ namespace FlaxEditor.Content /// A asset proxy object. /// /// + [ContentContextMenu("New/Particles/Particle Emitter")] public class ParticleEmitterProxy : BinaryAssetProxy { private ParticleEmitterPreview _preview; @@ -22,9 +23,6 @@ namespace FlaxEditor.Content /// public override string Name => "Particle Emitter"; - - /// - public override string CategoryName => "Particles"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/ParticleSystemProxy.cs b/Source/Editor/Content/Proxy/ParticleSystemProxy.cs index b1fda9b60..38301afdf 100644 --- a/Source/Editor/Content/Proxy/ParticleSystemProxy.cs +++ b/Source/Editor/Content/Proxy/ParticleSystemProxy.cs @@ -39,6 +39,7 @@ namespace FlaxEditor.Content /// A asset proxy object. /// /// + [ContentContextMenu("New/Particles/Particle System")] public class ParticleSystemProxy : BinaryAssetProxy { private ParticleSystemPreview _preview; @@ -46,9 +47,6 @@ namespace FlaxEditor.Content /// public override string Name => "Particle System"; - - /// - public override string CategoryName => "Particles"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/PrefabProxy.cs b/Source/Editor/Content/Proxy/PrefabProxy.cs index 16e00069f..a4610b25a 100644 --- a/Source/Editor/Content/Proxy/PrefabProxy.cs +++ b/Source/Editor/Content/Proxy/PrefabProxy.cs @@ -15,6 +15,7 @@ namespace FlaxEditor.Content /// Content proxy for . /// /// + [ContentContextMenu("New/Prefab")] public sealed class PrefabProxy : JsonAssetBaseProxy { private PrefabPreview _preview; @@ -31,9 +32,6 @@ namespace FlaxEditor.Content /// public override string Name => "Prefab"; - - /// - public override string CategoryName => "Prefab"; /// public override string FileExtension => Extension; diff --git a/Source/Editor/Content/Proxy/PreviewsCacheProxy.cs b/Source/Editor/Content/Proxy/PreviewsCacheProxy.cs index 16c6ae9f2..b3bc6e73f 100644 --- a/Source/Editor/Content/Proxy/PreviewsCacheProxy.cs +++ b/Source/Editor/Content/Proxy/PreviewsCacheProxy.cs @@ -15,9 +15,6 @@ namespace FlaxEditor.Content { /// public override string Name => "Previews Cache"; - - /// - public override string CategoryName => "Previews Cache"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/SceneAnimationProxy.cs b/Source/Editor/Content/Proxy/SceneAnimationProxy.cs index 4bebe20f6..30409208e 100644 --- a/Source/Editor/Content/Proxy/SceneAnimationProxy.cs +++ b/Source/Editor/Content/Proxy/SceneAnimationProxy.cs @@ -40,9 +40,6 @@ namespace FlaxEditor.Content { /// public override string Name => "Scene Animation"; - - /// - public override string CategoryName => "Animation"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/SceneProxy.cs b/Source/Editor/Content/Proxy/SceneProxy.cs index 6be481250..cecd825a1 100644 --- a/Source/Editor/Content/Proxy/SceneProxy.cs +++ b/Source/Editor/Content/Proxy/SceneProxy.cs @@ -10,6 +10,7 @@ namespace FlaxEditor.Content /// Content proxy for . /// /// + [ContentContextMenu("New/Scene")] public sealed class SceneProxy : JsonAssetBaseProxy { /// @@ -19,9 +20,6 @@ namespace FlaxEditor.Content /// public override string Name => "Scene"; - - /// - public override string CategoryName => "Scene"; /// public override string FileExtension => Extension; diff --git a/Source/Editor/Content/Proxy/SettingsProxy.cs b/Source/Editor/Content/Proxy/SettingsProxy.cs index abe63f06e..651ba62d2 100644 --- a/Source/Editor/Content/Proxy/SettingsProxy.cs +++ b/Source/Editor/Content/Proxy/SettingsProxy.cs @@ -11,6 +11,7 @@ namespace FlaxEditor.Content /// Content proxy for json settings assets (e.g or ). /// /// + [ContentContextMenu("New/Settings")] public class SettingsProxy : JsonAssetProxy { private readonly Type _type; @@ -20,9 +21,6 @@ namespace FlaxEditor.Content /// Gets the settings type. /// public Type Type => _type; - - /// - public override string CategoryName => "Settings"; /// /// Initializes a new instance of the class. diff --git a/Source/Editor/Content/Proxy/ShaderProxy.cs b/Source/Editor/Content/Proxy/ShaderProxy.cs index 76fd02897..b65949460 100644 --- a/Source/Editor/Content/Proxy/ShaderProxy.cs +++ b/Source/Editor/Content/Proxy/ShaderProxy.cs @@ -14,9 +14,6 @@ namespace FlaxEditor.Content { /// public override string Name => "Shader"; - - /// - public override string CategoryName => "Shader"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/SkeletonMaskProxy.cs b/Source/Editor/Content/Proxy/SkeletonMaskProxy.cs index d84bf3fe8..ab78a1e09 100644 --- a/Source/Editor/Content/Proxy/SkeletonMaskProxy.cs +++ b/Source/Editor/Content/Proxy/SkeletonMaskProxy.cs @@ -11,13 +11,11 @@ namespace FlaxEditor.Content /// A asset proxy object. /// /// + [ContentContextMenu("New/Animation/Skeleton Mask")] public class SkeletonMaskProxy : BinaryAssetProxy { /// public override string Name => "Skeleton Mask"; - - /// - public override string CategoryName => "Animation"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Content/Proxy/SkinnedModelProxy.cs b/Source/Editor/Content/Proxy/SkinnedModelProxy.cs index 18276604e..597c69a1d 100644 --- a/Source/Editor/Content/Proxy/SkinnedModelProxy.cs +++ b/Source/Editor/Content/Proxy/SkinnedModelProxy.cs @@ -20,9 +20,6 @@ namespace FlaxEditor.Content /// public override string Name => "Skinned Model"; - - /// - public override string CategoryName => "Model"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/SpriteAtlasProxy.cs b/Source/Editor/Content/Proxy/SpriteAtlasProxy.cs index fce7e22e5..5184abafb 100644 --- a/Source/Editor/Content/Proxy/SpriteAtlasProxy.cs +++ b/Source/Editor/Content/Proxy/SpriteAtlasProxy.cs @@ -20,9 +20,6 @@ namespace FlaxEditor.Content /// public override string Name => "Sprite Atlas"; - - /// - public override string CategoryName => "Sprites"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/TextureProxy.cs b/Source/Editor/Content/Proxy/TextureProxy.cs index ce292d5b3..67de33851 100644 --- a/Source/Editor/Content/Proxy/TextureProxy.cs +++ b/Source/Editor/Content/Proxy/TextureProxy.cs @@ -20,9 +20,6 @@ namespace FlaxEditor.Content /// public override string Name => "Texture"; - - /// - public override string CategoryName => "Texture"; /// public override bool CanReimport(ContentItem item) diff --git a/Source/Editor/Content/Proxy/VisualScriptProxy.cs b/Source/Editor/Content/Proxy/VisualScriptProxy.cs index 540e46945..afd105131 100644 --- a/Source/Editor/Content/Proxy/VisualScriptProxy.cs +++ b/Source/Editor/Content/Proxy/VisualScriptProxy.cs @@ -15,6 +15,7 @@ namespace FlaxEditor.Content /// A asset proxy object. /// /// + [ContentContextMenu("New/Visual Script")] public class VisualScriptProxy : BinaryAssetProxy, IScriptTypesContainer { internal VisualScriptProxy() @@ -24,9 +25,6 @@ namespace FlaxEditor.Content /// public override string Name => "Visual Script"; - - /// - public override string CategoryName => "Scripting"; /// public override EditorWindow Open(Editor editor, ContentItem item) diff --git a/Source/Editor/Modules/ContentDatabaseModule.cs b/Source/Editor/Modules/ContentDatabaseModule.cs index 990d42615..a3ee714ae 100644 --- a/Source/Editor/Modules/ContentDatabaseModule.cs +++ b/Source/Editor/Modules/ContentDatabaseModule.cs @@ -927,9 +927,7 @@ namespace FlaxEditor.Modules Proxy.Add(new VisualScriptProxy()); Proxy.Add(new LocalizedStringTableProxy()); Proxy.Add(new FileProxy()); - var pm = new SpawnableJsonAssetProxy(); - pm.SetCategoryName("Physics"); - Proxy.Add(pm); + Proxy.Add(new SpawnableJsonAssetProxy()); // Settings Proxy.Add(new SettingsProxy(typeof(GameSettings), Editor.Instance.Icons.GameSettings128)); diff --git a/Source/Editor/Windows/ContentWindow.ContextMenu.cs b/Source/Editor/Windows/ContentWindow.ContextMenu.cs index 7f27e0cd3..36d3e4938 100644 --- a/Source/Editor/Windows/ContentWindow.ContextMenu.cs +++ b/Source/Editor/Windows/ContentWindow.ContextMenu.cs @@ -1,6 +1,7 @@ // Copyright (c) 2012-2022 Wojciech Figat. All rights reserved. using System; +using System.CodeDom; using System.Collections.Generic; using System.Linq; using FlaxEditor.Content; @@ -152,64 +153,78 @@ namespace FlaxEditor.Windows { cm.AddButton("New folder", NewFolder); } - - // categorize the asset proxies according to their category name - Dictionary> categorizedProxyList = new Dictionary>(); - for (int i = 0; i < Editor.ContentDatabase.Proxy.Count; i++) + + // loop through each proxy and user defined json type and add them to the context menu + foreach (var type in Editor.CodeEditing.All.Get()) { - var p = Editor.ContentDatabase.Proxy[i]; + if (type.IsAbstract || !type.HasAttribute(typeof(ContentContextMenuAttribute), true)) + continue; + + ContentContextMenuAttribute attribute = null; + foreach (var typeAttribute in type.GetAttributes(true)) + { + if (typeAttribute is ContentContextMenuAttribute contentContextMenuAttribute) + { + attribute = contentContextMenuAttribute; + break; + } + } + + ContentProxy p; + if (type.Type.IsSubclassOf(typeof(ContentProxy))) + { + p = Editor.ContentDatabase.Proxy.Find(T => T.GetType() == type.Type); + } + else + { + // user can use attribute to put their own assets into the content context menu + var generic = typeof(SpawnableJsonAssetProxy<>).MakeGenericType(type.Type); + var instance = Activator.CreateInstance(generic); + dynamic obj = instance; + p = obj as AssetProxy; + } + + if (p == null) + continue; + + // create menus if (p.CanCreate(folder)) { - if (p is AssetProxy ap) + var splitPath = attribute.Path.Split('/'); + ContextMenuChildMenu childCM = null; + bool mainCM = true; + for (int i = 0; i < splitPath?.Length; i++) { - if (categorizedProxyList.ContainsKey(ap.CategoryName)) + if (i == splitPath.Length - 1) { - categorizedProxyList.TryGetValue(ap.CategoryName, out var apList); - apList?.Add(ap); + if (mainCM) + { + cm.AddButton(splitPath[i].Trim(), () => NewItem(p)); + mainCM = false; + } + else + { + childCM?.ContextMenu.AddButton(splitPath[i].Trim(), () => NewItem(p)); + childCM.ContextMenu.AutoSort = true; + } } else { - categorizedProxyList.Add(ap.CategoryName, new List() {ap}); + if (mainCM) + { + childCM = cm.GetOrAddChildMenu(splitPath[i].Trim()); + mainCM = false; + } + else + { + childCM = childCM?.ContextMenu.GetOrAddChildMenu(splitPath[i].Trim()); + } + childCM.ContextMenu.AutoSort = true; } } } } - c = cm.AddChildMenu("New"); - c.ContextMenu.Tag = item; - c.ContextMenu.AutoSort = true; - int newItems = 0; - 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 && categorizedProxyList.TryGetValue(ap.CategoryName, out var apList)) - { - if (apList.Contains(ap)) - { - if (apList.Count > 1) - { - var childMenu = c.ContextMenu.GetOrAddChildMenu(ap.CategoryName); - childMenu.ContextMenu.AutoSort = true; - childMenu.ContextMenu.AddButton(p.Name, () => NewItem(p)); - } - else - { - c.ContextMenu.AddButton(p.Name, () => NewItem(p)); - } - } - } - else - { - c.ContextMenu.AddButton(p.Name, () => NewItem(p)); - } - - newItems++; - } - } - c.Enabled = newItems > 0; - if (folder.CanHaveAssets) { cm.AddButton("Import file", () => diff --git a/Source/Engine/Physics/PhysicalMaterial.h b/Source/Engine/Physics/PhysicalMaterial.h index 0d8356546..b46c1a294 100644 --- a/Source/Engine/Physics/PhysicalMaterial.h +++ b/Source/Engine/Physics/PhysicalMaterial.h @@ -8,7 +8,7 @@ /// /// Physical materials are used to define the response of a physical object when interacting dynamically with the world. /// -API_CLASS() class FLAXENGINE_API PhysicalMaterial final : public ISerializable +API_CLASS(Attributes = "ContentContextMenu(\"New/Physics/Physical Material\")") class FLAXENGINE_API PhysicalMaterial final : public ISerializable { API_AUTO_SERIALIZATION(); DECLARE_SCRIPTING_TYPE_MINIMAL(PhysicalMaterial); diff --git a/Source/Engine/Scripting/Attributes/Editor/ContentContextMenu.cs b/Source/Engine/Scripting/Attributes/Editor/ContentContextMenu.cs new file mode 100644 index 000000000..ee9956ede --- /dev/null +++ b/Source/Engine/Scripting/Attributes/Editor/ContentContextMenu.cs @@ -0,0 +1,26 @@ +using System; + +namespace FlaxEngine +{ + /// + /// This attribute is used to show content items that can be created in the content browser context menu. Separate the subcontext menus with a /. + /// + [Serializable] + [AttributeUsage(AttributeTargets.Class)] + public class ContentContextMenuAttribute : Attribute + { + /// + /// The path to be used in the context menu + /// + public string Path; + + /// + /// Initializes a new instance of the class. + /// + /// The path to use to create the context menu + public ContentContextMenuAttribute(string path) + { + Path = path; + } + } +} From 7487b468d344f5341c2bc563f09a97f788381699 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Wed, 2 Nov 2022 18:37:11 -0500 Subject: [PATCH 05/22] added extra checks --- Source/Editor/Windows/ContentWindow.ContextMenu.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Editor/Windows/ContentWindow.ContextMenu.cs b/Source/Editor/Windows/ContentWindow.ContextMenu.cs index 36d3e4938..db4ed13d8 100644 --- a/Source/Editor/Windows/ContentWindow.ContextMenu.cs +++ b/Source/Editor/Windows/ContentWindow.ContextMenu.cs @@ -157,9 +157,9 @@ namespace FlaxEditor.Windows // loop through each proxy and user defined json type and add them to the context menu foreach (var type in Editor.CodeEditing.All.Get()) { - if (type.IsAbstract || !type.HasAttribute(typeof(ContentContextMenuAttribute), true)) + if (type.IsAbstract || !type.HasAttribute(typeof(ContentContextMenuAttribute), true) || Editor.CodeEditing.Actors.Get().Contains(type) || Editor.CodeEditing.Scripts.Get().Contains(type)) continue; - + ContentContextMenuAttribute attribute = null; foreach (var typeAttribute in type.GetAttributes(true)) { From 2dca30305f6b38d8549a0a2fbd6b15c86a13e249 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Thu, 3 Nov 2022 08:12:40 -0500 Subject: [PATCH 06/22] added shader source and removed unused variables/includes --- Source/Editor/Content/Proxy/ShaderSourceProxy.cs | 1 + Source/Editor/Windows/ContentWindow.ContextMenu.cs | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/Editor/Content/Proxy/ShaderSourceProxy.cs b/Source/Editor/Content/Proxy/ShaderSourceProxy.cs index 86020c997..9b2ec22d5 100644 --- a/Source/Editor/Content/Proxy/ShaderSourceProxy.cs +++ b/Source/Editor/Content/Proxy/ShaderSourceProxy.cs @@ -13,6 +13,7 @@ namespace FlaxEditor.Content /// Context proxy object for shader source files (represented by ). /// /// + [ContentContextMenu("New/Shader Source")] public class ShaderSourceProxy : ContentProxy { /// diff --git a/Source/Editor/Windows/ContentWindow.ContextMenu.cs b/Source/Editor/Windows/ContentWindow.ContextMenu.cs index db4ed13d8..aaf0bacb4 100644 --- a/Source/Editor/Windows/ContentWindow.ContextMenu.cs +++ b/Source/Editor/Windows/ContentWindow.ContextMenu.cs @@ -1,14 +1,10 @@ // Copyright (c) 2012-2022 Wojciech Figat. All rights reserved. using System; -using System.CodeDom; -using System.Collections.Generic; -using System.Linq; using FlaxEditor.Content; using FlaxEditor.GUI.ContextMenu; using FlaxEngine; using FlaxEngine.Assertions; -using FlaxEngine.GUI; using FlaxEngine.Json; namespace FlaxEditor.Windows @@ -43,7 +39,6 @@ namespace FlaxEditor.Windows // Create context menu ContextMenuButton b; - ContextMenuChildMenu c; ContextMenu cm = new ContextMenu { Tag = item From de4d3d97f211970f67a157d2a3b0613c2bb9c3bf Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Fri, 4 Nov 2022 07:10:24 -0500 Subject: [PATCH 07/22] removed not needed variable --- Source/Editor/Windows/ContentWindow.ContextMenu.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/Editor/Windows/ContentWindow.ContextMenu.cs b/Source/Editor/Windows/ContentWindow.ContextMenu.cs index aaf0bacb4..56cba9b9e 100644 --- a/Source/Editor/Windows/ContentWindow.ContextMenu.cs +++ b/Source/Editor/Windows/ContentWindow.ContextMenu.cs @@ -175,8 +175,7 @@ namespace FlaxEditor.Windows // user can use attribute to put their own assets into the content context menu var generic = typeof(SpawnableJsonAssetProxy<>).MakeGenericType(type.Type); var instance = Activator.CreateInstance(generic); - dynamic obj = instance; - p = obj as AssetProxy; + p = instance as AssetProxy; } if (p == null) From c817b639274b21cf75cdcb340601ff35f93bbce1 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Fri, 4 Nov 2022 10:53:29 -0500 Subject: [PATCH 08/22] made it easier to scroll and resize the material source window. and added the ability to change if the text can be scrolled in the text box --- Source/Editor/Utilities/Utils.cs | 29 ++++++++++++++++------ Source/Engine/UI/GUI/Common/TextBoxBase.cs | 7 +++++- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Source/Editor/Utilities/Utils.cs b/Source/Editor/Utilities/Utils.cs index 5fdaae91a..0cf8238b1 100644 --- a/Source/Editor/Utilities/Utils.cs +++ b/Source/Editor/Utilities/Utils.cs @@ -738,9 +738,10 @@ namespace FlaxEditor.Utilities var settings = CreateWindowSettings.Default; settings.ActivateWhenFirstShown = true; - settings.AllowMaximize = false; + settings.AllowMaximize = true; settings.AllowMinimize = false; - settings.HasSizingFrame = false; + settings.HasSizingFrame = true; + settings.HasBorder = true; settings.StartPosition = WindowStartPosition.CenterParent; settings.Size = new Float2(500, 600) * (parentWindow?.DpiScale ?? Platform.DpiScale); settings.Parent = parentWindow; @@ -753,12 +754,26 @@ namespace FlaxEditor.Utilities Parent = dialog.GUI, }; copyButton.Clicked += () => Clipboard.Text = source; - - var sourceTextBox = new TextBox(true, 2, copyButton.Bottom + 4, settings.Size.X - 4); - sourceTextBox.Height = settings.Size.Y - sourceTextBox.Top - 2; + + var backPanel = new Panel + { + AnchorPreset = AnchorPresets.StretchAll, + Offsets = new Margin(0, 0, copyButton.Bottom + 4, 0), + ScrollBars = ScrollBars.Both, + IsScrollable = true, + Parent = dialog.GUI, + }; + + var sourceTextBox = new TextBox(true, 0, 0, 0); + sourceTextBox.Parent = backPanel; + sourceTextBox.AnchorPreset = AnchorPresets.HorizontalStretchTop; sourceTextBox.Text = source; - sourceTextBox.Parent = dialog.GUI; - + sourceTextBox.Height = sourceTextBox.TextSize.Y; + sourceTextBox.Width = sourceTextBox.TextSize.X; + sourceTextBox.TextChanged += () => sourceTextBox.Height = sourceTextBox.TextSize.Y; + sourceTextBox.CanScrollMultilineText = false; + sourceTextBox.IsScrollable = true; + dialog.Show(); dialog.Focus(); } diff --git a/Source/Engine/UI/GUI/Common/TextBoxBase.cs b/Source/Engine/UI/GUI/Common/TextBoxBase.cs index d78bd3d6b..50b5b0945 100644 --- a/Source/Engine/UI/GUI/Common/TextBoxBase.cs +++ b/Source/Engine/UI/GUI/Common/TextBoxBase.cs @@ -229,6 +229,11 @@ namespace FlaxEngine.GUI [EditorOrder(529)] public bool ClipText { get; set; } = true; + /// + /// Gets or sets a value indicating whether you can scroll the text in the text box + /// + public bool CanScrollMultilineText { get; set; } = true; + /// /// Gets or sets textbox background color when the control is selected (has focus). /// @@ -1157,7 +1162,7 @@ namespace FlaxEngine.GUI return true; // Multiline scroll - if (IsMultiline && _text.Length != 0) + if (IsMultiline && _text.Length != 0 && CanScrollMultilineText) { TargetViewOffset = Float2.Clamp(_targetViewOffset - new Float2(0, delta * 10.0f), Float2.Zero, new Float2(_targetViewOffset.X, _textSize.Y)); return true; From 6ace0961b3ccdddd2f0806ba31310e7b1184879c Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Fri, 4 Nov 2022 10:57:47 -0500 Subject: [PATCH 09/22] added to resize the x and y on text changed --- Source/Editor/Utilities/Utils.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Editor/Utilities/Utils.cs b/Source/Editor/Utilities/Utils.cs index 0cf8238b1..1b9ebb752 100644 --- a/Source/Editor/Utilities/Utils.cs +++ b/Source/Editor/Utilities/Utils.cs @@ -770,7 +770,11 @@ namespace FlaxEditor.Utilities sourceTextBox.Text = source; sourceTextBox.Height = sourceTextBox.TextSize.Y; sourceTextBox.Width = sourceTextBox.TextSize.X; - sourceTextBox.TextChanged += () => sourceTextBox.Height = sourceTextBox.TextSize.Y; + sourceTextBox.TextChanged += () => + { + sourceTextBox.Height = sourceTextBox.TextSize.Y; + sourceTextBox.Width = sourceTextBox.TextSize.X; + }; sourceTextBox.CanScrollMultilineText = false; sourceTextBox.IsScrollable = true; From 14f64b5b20be0f3a77a0ba7488b23878f207a9ca Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Fri, 4 Nov 2022 12:58:42 -0500 Subject: [PATCH 10/22] dont close when clicking on view editor CM buttons that are not buttons. --- Source/Editor/Viewport/EditorViewport.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/Editor/Viewport/EditorViewport.cs b/Source/Editor/Viewport/EditorViewport.cs index 96b0abf04..4e44ae833 100644 --- a/Source/Editor/Viewport/EditorViewport.cs +++ b/Source/Editor/Viewport/EditorViewport.cs @@ -539,6 +539,7 @@ namespace FlaxEditor.Viewport // Orthographic { var ortho = ViewWidgetButtonMenu.AddButton("Orthographic"); + ortho.CloseMenuOnClick = false; var orthoValue = new CheckBox(90, 2, _isOrtho) { Parent = ortho @@ -578,6 +579,7 @@ namespace FlaxEditor.Viewport // Field of View { var fov = ViewWidgetButtonMenu.AddButton("Field Of View"); + fov.CloseMenuOnClick = false; var fovValue = new FloatValueBox(1, 90, 2, 70.0f, 35.0f, 160.0f, 0.1f) { Parent = fov @@ -594,6 +596,7 @@ namespace FlaxEditor.Viewport // Ortho Scale { var orthoSize = ViewWidgetButtonMenu.AddButton("Ortho Scale"); + orthoSize.CloseMenuOnClick = false; var orthoSizeValue = new FloatValueBox(_orthoSize, 90, 2, 70.0f, 0.001f, 100000.0f, 0.01f) { Parent = orthoSize @@ -610,6 +613,7 @@ namespace FlaxEditor.Viewport // Near Plane { var nearPlane = ViewWidgetButtonMenu.AddButton("Near Plane"); + nearPlane.CloseMenuOnClick = false; var nearPlaneValue = new FloatValueBox(2.0f, 90, 2, 70.0f, 0.001f, 1000.0f) { Parent = nearPlane @@ -621,6 +625,7 @@ namespace FlaxEditor.Viewport // Far Plane { var farPlane = ViewWidgetButtonMenu.AddButton("Far Plane"); + farPlane.CloseMenuOnClick = false; var farPlaneValue = new FloatValueBox(1000, 90, 2, 70.0f, 10.0f) { Parent = farPlane @@ -632,6 +637,7 @@ namespace FlaxEditor.Viewport // Brightness { var brightness = ViewWidgetButtonMenu.AddButton("Brightness"); + brightness.CloseMenuOnClick = false; var brightnessValue = new FloatValueBox(1.0f, 90, 2, 70.0f, 0.001f, 10.0f, 0.001f) { Parent = brightness @@ -643,6 +649,7 @@ namespace FlaxEditor.Viewport // Resolution { var resolution = ViewWidgetButtonMenu.AddButton("Resolution"); + resolution.CloseMenuOnClick = false; var resolutionValue = new FloatValueBox(1.0f, 90, 2, 70.0f, 0.1f, 4.0f, 0.001f) { Parent = resolution @@ -654,6 +661,7 @@ namespace FlaxEditor.Viewport // Invert Panning { var invert = ViewWidgetButtonMenu.AddButton("Invert Panning"); + invert.CloseMenuOnClick = false; var invertValue = new CheckBox(90, 2, _invertPanning) { Parent = invert From 3ac77121f561e858e99fd0826cbd2c57836d2c65 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sun, 6 Nov 2022 13:45:06 -0600 Subject: [PATCH 11/22] made readonly text and fixed sizing --- Source/Editor/Utilities/Utils.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Source/Editor/Utilities/Utils.cs b/Source/Editor/Utilities/Utils.cs index 1b9ebb752..269ce07d0 100644 --- a/Source/Editor/Utilities/Utils.cs +++ b/Source/Editor/Utilities/Utils.cs @@ -769,14 +769,11 @@ namespace FlaxEditor.Utilities sourceTextBox.AnchorPreset = AnchorPresets.HorizontalStretchTop; sourceTextBox.Text = source; sourceTextBox.Height = sourceTextBox.TextSize.Y; - sourceTextBox.Width = sourceTextBox.TextSize.X; - sourceTextBox.TextChanged += () => - { - sourceTextBox.Height = sourceTextBox.TextSize.Y; - sourceTextBox.Width = sourceTextBox.TextSize.X; - }; + sourceTextBox.IsReadOnly = true; sourceTextBox.CanScrollMultilineText = false; sourceTextBox.IsScrollable = true; + + backPanel.SizeChanged += control => { sourceTextBox.Width = (control.Size.X >= sourceTextBox.TextSize.X) ? control.Width : sourceTextBox.TextSize.X + 30; }; dialog.Show(); dialog.Focus(); From 68a5073b2946d7e84c344ae2b4120d8f1559f6be Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Mon, 14 Nov 2022 18:45:44 -0600 Subject: [PATCH 12/22] fixed issue when asset picker has no value on particle effect --- .../Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs b/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs index c78700bf7..bd15db916 100644 --- a/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs +++ b/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs @@ -94,6 +94,12 @@ namespace FlaxEditor.CustomEditors.Dedicated } Refresh(); var parameters = effect.Parameters; + if (parameters.Length == 0) + { + base.Refresh(); + return; + } + for (int i = 0; i < ChildrenEditors.Count; i++) { if (_isActive != effect.IsActive || _parametersVersion != effect.ParametersVersion) From ade5166977bc706f1e7a37936db38aba0f8c6a47 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Mon, 14 Nov 2022 20:00:54 -0600 Subject: [PATCH 13/22] fix editor updating base values --- Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs b/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs index bd15db916..3356768fd 100644 --- a/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs +++ b/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs @@ -96,7 +96,7 @@ namespace FlaxEditor.CustomEditors.Dedicated var parameters = effect.Parameters; if (parameters.Length == 0) { - base.Refresh(); + base.RefreshRootChild(); return; } From 911ca7f9953c8fa32f9816a332c7bc95159df05e Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Mon, 14 Nov 2022 19:27:37 +0200 Subject: [PATCH 14/22] Support MSBuild in preview version Visual Studio in build scripts --- Development/Scripts/Windows/GetMSBuildPath.bat | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Development/Scripts/Windows/GetMSBuildPath.bat b/Development/Scripts/Windows/GetMSBuildPath.bat index 4945c1015..fac1db727 100644 --- a/Development/Scripts/Windows/GetMSBuildPath.bat +++ b/Development/Scripts/Windows/GetMSBuildPath.bat @@ -11,6 +11,16 @@ for /f "delims=" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer goto End ) ) +for /f "delims=" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere" -latest -prerelease -products * -requires Microsoft.Component.MSBuild -property installationPath') do ( + if exist "%%i\MSBuild\15.0\Bin\MSBuild.exe" ( + set MSBUILD_PATH="%%i\MSBuild\15.0\Bin\MSBuild.exe" + goto End + ) + if exist "%%i\MSBuild\Current\Bin\MSBuild.exe" ( + set MSBUILD_PATH="%%i\MSBuild\Current\Bin\MSBuild.exe" + goto End + ) +) :VsWhereNotFound if exist "%ProgramFiles(x86)%\MSBuild\14.0\bin\MSBuild.exe" ( From 54e30c35e9081c9beee53fe76c5ea9370db08235 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Sun, 14 Aug 2022 22:47:32 +0300 Subject: [PATCH 15/22] Fix crash when shader cache file is empty --- Source/Engine/Graphics/Shaders/Cache/ShaderAssetBase.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Engine/Graphics/Shaders/Cache/ShaderAssetBase.cpp b/Source/Engine/Graphics/Shaders/Cache/ShaderAssetBase.cpp index efaed6d8f..d105cae0a 100644 --- a/Source/Engine/Graphics/Shaders/Cache/ShaderAssetBase.cpp +++ b/Source/Engine/Graphics/Shaders/Cache/ShaderAssetBase.cpp @@ -113,6 +113,11 @@ bool ShaderAssetBase::Save() bool IsValidShaderCache(DataContainer& shaderCache, Array& includes) { + if (shaderCache.Length() == 0) + { + return false; + } + MemoryReadStream stream(shaderCache.Get(), shaderCache.Length()); // Read cache format version From 4f38a87eedf9e2b14a4075b53dbefca99ed8671c Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sat, 19 Nov 2022 16:33:09 -0600 Subject: [PATCH 16/22] Changed using screen coords to using window points. --- Source/Editor/GUI/Input/ValueBox.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Editor/GUI/Input/ValueBox.cs b/Source/Editor/GUI/Input/ValueBox.cs index 5038dab20..7f4fb51e0 100644 --- a/Source/Editor/GUI/Input/ValueBox.cs +++ b/Source/Editor/GUI/Input/ValueBox.cs @@ -248,7 +248,7 @@ namespace FlaxEditor.GUI.Input // Hide cursor and cache location Cursor = CursorType.Hidden; - _mouseClickedPosition = location; + _mouseClickedPosition = PointToWindow(location); _cursorChanged = true; SlidingStart?.Invoke(); @@ -293,7 +293,7 @@ namespace FlaxEditor.GUI.Input if (button == MouseButton.Left && _isSliding) { // End sliding and return mouse to original location - Root.MousePosition = ScreenPos + _mouseClickedPosition; + RootWindow.MousePosition = _mouseClickedPosition; EndSliding(); return true; } From c5d1897acf8d9847b04af6dba84cc917691ef144 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 21 Nov 2022 16:10:53 +0100 Subject: [PATCH 17/22] Rename `CanScrollMultilineText` to `IsMultilineScrollable` to match the other properties naming #818 --- Source/Engine/UI/GUI/Common/TextBoxBase.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Engine/UI/GUI/Common/TextBoxBase.cs b/Source/Engine/UI/GUI/Common/TextBoxBase.cs index 50b5b0945..340459c8f 100644 --- a/Source/Engine/UI/GUI/Common/TextBoxBase.cs +++ b/Source/Engine/UI/GUI/Common/TextBoxBase.cs @@ -230,9 +230,9 @@ namespace FlaxEngine.GUI public bool ClipText { get; set; } = true; /// - /// Gets or sets a value indicating whether you can scroll the text in the text box + /// Gets or sets a value indicating whether you can scroll the text in the text box (eg. with a mouse wheel). /// - public bool CanScrollMultilineText { get; set; } = true; + public bool IsMultilineScrollable { get; set; } = true; /// /// Gets or sets textbox background color when the control is selected (has focus). @@ -1162,7 +1162,7 @@ namespace FlaxEngine.GUI return true; // Multiline scroll - if (IsMultiline && _text.Length != 0 && CanScrollMultilineText) + if (IsMultiline && _text.Length != 0 && IsMultilineScrollable) { TargetViewOffset = Float2.Clamp(_targetViewOffset - new Float2(0, delta * 10.0f), Float2.Zero, new Float2(_targetViewOffset.X, _textSize.Y)); return true; From c514aad9a3b6ff13527e55fec7571a5374b93cf2 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 21 Nov 2022 16:11:35 +0100 Subject: [PATCH 18/22] Code style fix #818 --- Source/Editor/Utilities/Utils.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Editor/Utilities/Utils.cs b/Source/Editor/Utilities/Utils.cs index 269ce07d0..74ffb721b 100644 --- a/Source/Editor/Utilities/Utils.cs +++ b/Source/Editor/Utilities/Utils.cs @@ -754,7 +754,7 @@ namespace FlaxEditor.Utilities Parent = dialog.GUI, }; copyButton.Clicked += () => Clipboard.Text = source; - + var backPanel = new Panel { AnchorPreset = AnchorPresets.StretchAll, @@ -763,18 +763,18 @@ namespace FlaxEditor.Utilities IsScrollable = true, Parent = dialog.GUI, }; - + var sourceTextBox = new TextBox(true, 0, 0, 0); sourceTextBox.Parent = backPanel; sourceTextBox.AnchorPreset = AnchorPresets.HorizontalStretchTop; sourceTextBox.Text = source; sourceTextBox.Height = sourceTextBox.TextSize.Y; sourceTextBox.IsReadOnly = true; - sourceTextBox.CanScrollMultilineText = false; + sourceTextBox.IsMultilineScrollable = false; sourceTextBox.IsScrollable = true; backPanel.SizeChanged += control => { sourceTextBox.Width = (control.Size.X >= sourceTextBox.TextSize.X) ? control.Width : sourceTextBox.TextSize.X + 30; }; - + dialog.Show(); dialog.Focus(); } From 5a6f6d97a74b80dd78d8f86a9df072ae58383dca Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 21 Nov 2022 18:55:33 +0100 Subject: [PATCH 19/22] Minor code adjustments #810 --- .../CachedTypesCollection.cs | 2 +- .../Windows/Assets/PrefabWindow.Hierarchy.cs | 22 +++++---- .../Windows/ContentWindow.ContextMenu.cs | 47 +++++++++++-------- .../Windows/SceneTreeWindow.ContextMenu.cs | 21 +++++---- 4 files changed, 52 insertions(+), 40 deletions(-) diff --git a/Source/Editor/Modules/SourceCodeEditing/CachedTypesCollection.cs b/Source/Editor/Modules/SourceCodeEditing/CachedTypesCollection.cs index 32e0fe17f..cacaa1db4 100644 --- a/Source/Editor/Modules/SourceCodeEditing/CachedTypesCollection.cs +++ b/Source/Editor/Modules/SourceCodeEditing/CachedTypesCollection.cs @@ -57,7 +57,7 @@ namespace FlaxEditor.Modules.SourceCodeEditing _list.Clear(); _hasValidData = true; - Editor.Log("Searching for valid " + _type); + Editor.Log("Searching for valid " + (_type != ScriptType.Null ? _type.ToString() : "types")); Profiler.BeginEvent("Search " + _type); var start = DateTime.Now; diff --git a/Source/Editor/Windows/Assets/PrefabWindow.Hierarchy.cs b/Source/Editor/Windows/Assets/PrefabWindow.Hierarchy.cs index 2a096680a..986c2ba60 100644 --- a/Source/Editor/Windows/Assets/PrefabWindow.Hierarchy.cs +++ b/Source/Editor/Windows/Assets/PrefabWindow.Hierarchy.cs @@ -263,21 +263,22 @@ namespace FlaxEditor.Windows.Assets } if (attribute == null) continue; - var splitPath = attribute.Path.Split('/'); + var parts = attribute.Path.Split('/'); ContextMenuChildMenu childCM = null; bool mainCM = true; - for (int i = 0; i < splitPath?.Length; i++) + for (int i = 0; i < parts.Length; i++) { - if (i == splitPath.Length - 1) + var part = parts[i].Trim(); + if (i == parts.Length - 1) { if (mainCM) { - contextMenu.AddButton(splitPath[i].Trim(), () => Spawn(actorType.Type)); + contextMenu.AddButton(part, () => Spawn(actorType.Type)); mainCM = false; } - else + else if (childCM != null) { - childCM?.ContextMenu.AddButton(splitPath[i].Trim(), () => Spawn(actorType.Type)); + childCM.ContextMenu.AddButton(part, () => Spawn(actorType.Type)); childCM.ContextMenu.AutoSort = true; } } @@ -285,14 +286,15 @@ namespace FlaxEditor.Windows.Assets { if (mainCM) { - childCM = contextMenu.GetOrAddChildMenu(splitPath[i].Trim()); + childCM = contextMenu.GetOrAddChildMenu(part); + childCM.ContextMenu.AutoSort = true; mainCM = false; } - else + else if (childCM != null) { - childCM = childCM?.ContextMenu.GetOrAddChildMenu(splitPath[i].Trim()); + childCM = childCM.ContextMenu.GetOrAddChildMenu(part); + childCM.ContextMenu.AutoSort = true; } - childCM.ContextMenu.AutoSort = true; } } } diff --git a/Source/Editor/Windows/ContentWindow.ContextMenu.cs b/Source/Editor/Windows/ContentWindow.ContextMenu.cs index 56cba9b9e..89f13d6a3 100644 --- a/Source/Editor/Windows/ContentWindow.ContextMenu.cs +++ b/Source/Editor/Windows/ContentWindow.ContextMenu.cs @@ -3,6 +3,7 @@ using System; using FlaxEditor.Content; using FlaxEditor.GUI.ContextMenu; +using FlaxEditor.Scripting; using FlaxEngine; using FlaxEngine.Assertions; using FlaxEngine.Json; @@ -148,13 +149,18 @@ namespace FlaxEditor.Windows { cm.AddButton("New folder", NewFolder); } - - // loop through each proxy and user defined json type and add them to the context menu + + // Loop through each proxy and user defined json type and add them to the context menu + var actorType = new ScriptType(typeof(Actor)); + var scriptType = new ScriptType(typeof(Script)); foreach (var type in Editor.CodeEditing.All.Get()) { - if (type.IsAbstract || !type.HasAttribute(typeof(ContentContextMenuAttribute), true) || Editor.CodeEditing.Actors.Get().Contains(type) || Editor.CodeEditing.Scripts.Get().Contains(type)) + if (type.IsAbstract) + continue; + if (actorType.IsAssignableFrom(type) || scriptType.IsAssignableFrom(type)) continue; + // Get attribute ContentContextMenuAttribute attribute = null; foreach (var typeAttribute in type.GetAttributes(true)) { @@ -164,41 +170,43 @@ namespace FlaxEditor.Windows break; } } + if (attribute == null) + continue; + // Get context proxy ContentProxy p; if (type.Type.IsSubclassOf(typeof(ContentProxy))) { - p = Editor.ContentDatabase.Proxy.Find(T => T.GetType() == type.Type); + p = Editor.ContentDatabase.Proxy.Find(x => x.GetType() == type.Type); } else { - // user can use attribute to put their own assets into the content context menu + // User can use attribute to put their own assets into the content context menu var generic = typeof(SpawnableJsonAssetProxy<>).MakeGenericType(type.Type); var instance = Activator.CreateInstance(generic); p = instance as AssetProxy; } - if (p == null) continue; - - // create menus + if (p.CanCreate(folder)) { - var splitPath = attribute.Path.Split('/'); + var parts = attribute.Path.Split('/'); ContextMenuChildMenu childCM = null; bool mainCM = true; - for (int i = 0; i < splitPath?.Length; i++) + for (int i = 0; i < parts?.Length; i++) { - if (i == splitPath.Length - 1) + var part = parts[i].Trim(); + if (i == parts.Length - 1) { if (mainCM) { - cm.AddButton(splitPath[i].Trim(), () => NewItem(p)); + cm.AddButton(part, () => NewItem(p)); mainCM = false; } - else + else if (childCM != null) { - childCM?.ContextMenu.AddButton(splitPath[i].Trim(), () => NewItem(p)); + childCM.ContextMenu.AddButton(part, () => NewItem(p)); childCM.ContextMenu.AutoSort = true; } } @@ -206,19 +214,20 @@ namespace FlaxEditor.Windows { if (mainCM) { - childCM = cm.GetOrAddChildMenu(splitPath[i].Trim()); + childCM = cm.GetOrAddChildMenu(part); + childCM.ContextMenu.AutoSort = true; mainCM = false; } - else + else if (childCM != null) { - childCM = childCM?.ContextMenu.GetOrAddChildMenu(splitPath[i].Trim()); + childCM = childCM.ContextMenu.GetOrAddChildMenu(part); + childCM.ContextMenu.AutoSort = true; } - childCM.ContextMenu.AutoSort = true; } } } } - + if (folder.CanHaveAssets) { cm.AddButton("Import file", () => diff --git a/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs b/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs index a9c946c46..1378ace9c 100644 --- a/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs +++ b/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs @@ -65,7 +65,6 @@ namespace FlaxEditor.Windows { if (actorType.IsAbstract) continue; - ActorContextMenuAttribute attribute = null; foreach (var e in actorType.GetAttributes(true)) { @@ -77,40 +76,42 @@ namespace FlaxEditor.Windows } if (attribute == null) continue; - var splitPath = attribute?.Path.Split('/'); + var parts = attribute.Path.Split('/'); ContextMenuChildMenu childCM = convertMenu; bool mainCM = true; - for (int i = 0; i < splitPath?.Length; i++) + for (int i = 0; i < parts.Length; i++) { - if (i == splitPath.Length - 1) + var part = parts[i].Trim(); + if (i == parts.Length - 1) { if (mainCM) { - convertMenu.ContextMenu.AddButton(splitPath[i].Trim(), () => Editor.SceneEditing.Convert(actorType.Type)); + convertMenu.ContextMenu.AddButton(part, () => Editor.SceneEditing.Convert(actorType.Type)); mainCM = false; } else { - childCM?.ContextMenu.AddButton(splitPath[i].Trim(), () => Editor.SceneEditing.Convert(actorType.Type)); + childCM.ContextMenu.AddButton(part, () => Editor.SceneEditing.Convert(actorType.Type)); childCM.ContextMenu.AutoSort = true; } } else { // Remove new path for converting menu - if (splitPath[i] == "New") + if (parts[i] == "New") continue; if (mainCM) { - childCM = convertMenu.ContextMenu.GetOrAddChildMenu(splitPath[i].Trim()); + childCM = convertMenu.ContextMenu.GetOrAddChildMenu(part); + childCM.ContextMenu.AutoSort = true; mainCM = false; } else { - childCM = childCM?.ContextMenu.GetOrAddChildMenu(splitPath[i].Trim()); + childCM = childCM.ContextMenu.GetOrAddChildMenu(part); + childCM.ContextMenu.AutoSort = true; } - childCM.ContextMenu.AutoSort = true; } } } From 99c296ff3a69e6d686570e9a195e21fde1bbff8b Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 21 Nov 2022 23:35:03 +0100 Subject: [PATCH 20/22] Merge source files --- .../MaterialGenerator.Texture.cpp | 166 ------------------ .../MaterialGenerator.Textures.cpp | 159 +++++++++++++++++ 2 files changed, 159 insertions(+), 166 deletions(-) delete mode 100644 Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Texture.cpp diff --git a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Texture.cpp b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Texture.cpp deleted file mode 100644 index 87ce827fb..000000000 --- a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Texture.cpp +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved. - -#if COMPILE_WITH_MATERIAL_GRAPH - -#include "MaterialGenerator.h" - -MaterialValue* MaterialGenerator::sampleTextureRaw(Node* caller, Value& value, Box* box, SerializedMaterialParam* texture) -{ - ASSERT(texture && box); - - // Cache data - const auto parent = box->GetParent>(); - const bool isCubemap = texture->Type == MaterialParameterType::CubeTexture; - const bool isArray = texture->Type == MaterialParameterType::GPUTextureArray; - const bool isVolume = texture->Type == MaterialParameterType::GPUTextureVolume; - const bool isNormalMap = texture->Type == MaterialParameterType::NormalMap; - const bool canUseSample = CanUseSample(_treeType); - MaterialGraphBox* valueBox = parent->GetBox(1); - - // Check if has variable assigned - if (texture->Type != MaterialParameterType::Texture - && texture->Type != MaterialParameterType::NormalMap - && texture->Type != MaterialParameterType::SceneTexture - && texture->Type != MaterialParameterType::GPUTexture - && texture->Type != MaterialParameterType::GPUTextureVolume - && texture->Type != MaterialParameterType::GPUTextureCube - && texture->Type != MaterialParameterType::GPUTextureArray - && texture->Type != MaterialParameterType::CubeTexture) - { - OnError(caller, box, TEXT("No parameter for texture sample node.")); - return nullptr; - } - - // Check if it's 'Object' box that is using only texture object without sampling - if (box->ID == 6) - { - // Return texture object - value.Value = texture->ShaderName; - value.Type = VariantType::Object; - return nullptr; - } - - // Check if hasn't been sampled during that tree eating - if (valueBox->Cache.IsInvalid()) - { - // Check if use custom UVs - String uv; - MaterialGraphBox* uvBox = parent->GetBox(0); - bool useCustomUVs = uvBox->HasConnection(); - bool use3dUVs = isCubemap || isArray || isVolume; - if (useCustomUVs) - { - // Get custom UVs - auto textureParamId = texture->ID; - ASSERT(textureParamId.IsValid()); - MaterialValue v = tryGetValue(uvBox, getUVs); - uv = MaterialValue::Cast(v, use3dUVs ? VariantType::Float3 : VariantType::Float2).Value; - - // Restore texture (during tryGetValue pointer could go invalid) - texture = findParam(textureParamId); - ASSERT(texture); - } - else - { - // Use default UVs - uv = use3dUVs ? TEXT("float3(input.TexCoord.xy, 0)") : TEXT("input.TexCoord.xy"); - } - - // Select sampler - // TODO: add option for texture groups and per texture options like wrap mode etc. - // TODO: changing texture sampler option - const Char* sampler = TEXT("SamplerLinearWrap"); - - // Sample texture - if (isNormalMap) - { - const Char* format = canUseSample ? TEXT("{0}.Sample({1}, {2}).xyz") : TEXT("{0}.SampleLevel({1}, {2}, 0).xyz"); - - // Sample encoded normal map - const String sampledValue = String::Format(format, texture->ShaderName, sampler, uv); - const auto normalVector = writeLocal(VariantType::Float3, sampledValue, parent); - - // Decode normal vector - _writer.Write(TEXT("\t{0}.xy = {0}.xy * 2.0 - 1.0;\n"), normalVector.Value); - _writer.Write(TEXT("\t{0}.z = sqrt(saturate(1.0 - dot({0}.xy, {0}.xy)));\n"), normalVector.Value); - valueBox->Cache = normalVector; - } - else - { - // Select format string based on texture type - const Char* format; - /*if (isCubemap) - { - MISSING_CODE("sampling cube maps and 3d texture in material generator"); - //format = TEXT("SAMPLE_CUBEMAP({0}, {1})"); - } - else*/ - { - /*if (useCustomUVs) - { - createGradients(writer, parent); - format = TEXT("SAMPLE_TEXTURE_GRAD({0}, {1}, {2}, {3})"); - } - else*/ - { - format = canUseSample ? TEXT("{0}.Sample({1}, {2})") : TEXT("{0}.SampleLevel({1}, {2}, 0)"); - } - } - - // Sample texture - String sampledValue = String::Format(format, texture->ShaderName, sampler, uv, _ddx.Value, _ddy.Value); - valueBox->Cache = writeLocal(VariantType::Float4, sampledValue, parent); - } - } - - return &valueBox->Cache; -} - -void MaterialGenerator::sampleTexture(Node* caller, Value& value, Box* box, SerializedMaterialParam* texture) -{ - const auto sample = sampleTextureRaw(caller, value, box, texture); - if (sample == nullptr) - return; - - // Set result values based on box ID - switch (box->ID) - { - case 1: - value = *sample; - break; - case 2: - value.Value = sample->Value + _subs[0]; - break; - case 3: - value.Value = sample->Value + _subs[1]; - break; - case 4: - value.Value = sample->Value + _subs[2]; - break; - case 5: - value.Value = sample->Value + _subs[3]; - break; - default: CRASH; - break; - } - value.Type = box->Type.Type; -} - -void MaterialGenerator::sampleSceneDepth(Node* caller, Value& value, Box* box) -{ - // Sample depth buffer - auto param = findOrAddSceneTexture(MaterialSceneTextures::SceneDepth); - const auto depthSample = sampleTextureRaw(caller, value, box, ¶m); - if (depthSample == nullptr) - return; - - // Linearize raw device depth - linearizeSceneDepth(caller, *depthSample, value); -} - -void MaterialGenerator::linearizeSceneDepth(Node* caller, const Value& depth, Value& value) -{ - value = writeLocal(VariantType::Float, String::Format(TEXT("ViewInfo.w / ({0}.x - ViewInfo.z)"), depth.Value), caller); -} - -#endif diff --git a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Textures.cpp b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Textures.cpp index 0c71dc1ba..cc5130d44 100644 --- a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Textures.cpp +++ b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Textures.cpp @@ -4,6 +4,165 @@ #include "MaterialGenerator.h" +MaterialValue* MaterialGenerator::sampleTextureRaw(Node* caller, Value& value, Box* box, SerializedMaterialParam* texture) +{ + ASSERT(texture && box); + + // Cache data + const auto parent = box->GetParent>(); + const bool isCubemap = texture->Type == MaterialParameterType::CubeTexture; + const bool isArray = texture->Type == MaterialParameterType::GPUTextureArray; + const bool isVolume = texture->Type == MaterialParameterType::GPUTextureVolume; + const bool isNormalMap = texture->Type == MaterialParameterType::NormalMap; + const bool canUseSample = CanUseSample(_treeType); + MaterialGraphBox* valueBox = parent->GetBox(1); + + // Check if has variable assigned + if (texture->Type != MaterialParameterType::Texture + && texture->Type != MaterialParameterType::NormalMap + && texture->Type != MaterialParameterType::SceneTexture + && texture->Type != MaterialParameterType::GPUTexture + && texture->Type != MaterialParameterType::GPUTextureVolume + && texture->Type != MaterialParameterType::GPUTextureCube + && texture->Type != MaterialParameterType::GPUTextureArray + && texture->Type != MaterialParameterType::CubeTexture) + { + OnError(caller, box, TEXT("No parameter for texture sample node.")); + return nullptr; + } + + // Check if it's 'Object' box that is using only texture object without sampling + if (box->ID == 6) + { + // Return texture object + value.Value = texture->ShaderName; + value.Type = VariantType::Object; + return nullptr; + } + + // Check if hasn't been sampled during that tree eating + if (valueBox->Cache.IsInvalid()) + { + // Check if use custom UVs + String uv; + MaterialGraphBox* uvBox = parent->GetBox(0); + bool useCustomUVs = uvBox->HasConnection(); + bool use3dUVs = isCubemap || isArray || isVolume; + if (useCustomUVs) + { + // Get custom UVs + auto textureParamId = texture->ID; + ASSERT(textureParamId.IsValid()); + MaterialValue v = tryGetValue(uvBox, getUVs); + uv = MaterialValue::Cast(v, use3dUVs ? VariantType::Float3 : VariantType::Float2).Value; + + // Restore texture (during tryGetValue pointer could go invalid) + texture = findParam(textureParamId); + ASSERT(texture); + } + else + { + // Use default UVs + uv = use3dUVs ? TEXT("float3(input.TexCoord.xy, 0)") : TEXT("input.TexCoord.xy"); + } + + // Select sampler + // TODO: add option for texture groups and per texture options like wrap mode etc. + // TODO: changing texture sampler option + const Char* sampler = TEXT("SamplerLinearWrap"); + + // Sample texture + if (isNormalMap) + { + const Char* format = canUseSample ? TEXT("{0}.Sample({1}, {2}).xyz") : TEXT("{0}.SampleLevel({1}, {2}, 0).xyz"); + + // Sample encoded normal map + const String sampledValue = String::Format(format, texture->ShaderName, sampler, uv); + const auto normalVector = writeLocal(VariantType::Float3, sampledValue, parent); + + // Decode normal vector + _writer.Write(TEXT("\t{0}.xy = {0}.xy * 2.0 - 1.0;\n"), normalVector.Value); + _writer.Write(TEXT("\t{0}.z = sqrt(saturate(1.0 - dot({0}.xy, {0}.xy)));\n"), normalVector.Value); + valueBox->Cache = normalVector; + } + else + { + // Select format string based on texture type + const Char* format; + /*if (isCubemap) + { + MISSING_CODE("sampling cube maps and 3d texture in material generator"); + //format = TEXT("SAMPLE_CUBEMAP({0}, {1})"); + } + else*/ + { + /*if (useCustomUVs) + { + createGradients(writer, parent); + format = TEXT("SAMPLE_TEXTURE_GRAD({0}, {1}, {2}, {3})"); + } + else*/ + { + format = canUseSample ? TEXT("{0}.Sample({1}, {2})") : TEXT("{0}.SampleLevel({1}, {2}, 0)"); + } + } + + // Sample texture + String sampledValue = String::Format(format, texture->ShaderName, sampler, uv, _ddx.Value, _ddy.Value); + valueBox->Cache = writeLocal(VariantType::Float4, sampledValue, parent); + } + } + + return &valueBox->Cache; +} + +void MaterialGenerator::sampleTexture(Node* caller, Value& value, Box* box, SerializedMaterialParam* texture) +{ + const auto sample = sampleTextureRaw(caller, value, box, texture); + if (sample == nullptr) + return; + + // Set result values based on box ID + switch (box->ID) + { + case 1: + value = *sample; + break; + case 2: + value.Value = sample->Value + _subs[0]; + break; + case 3: + value.Value = sample->Value + _subs[1]; + break; + case 4: + value.Value = sample->Value + _subs[2]; + break; + case 5: + value.Value = sample->Value + _subs[3]; + break; + default: CRASH; + break; + } + value.Type = box->Type.Type; +} + +void MaterialGenerator::sampleSceneDepth(Node* caller, Value& value, Box* box) +{ + // Sample depth buffer + auto param = findOrAddSceneTexture(MaterialSceneTextures::SceneDepth); + const auto depthSample = sampleTextureRaw(caller, value, box, ¶m); + if (depthSample == nullptr) + return; + + // Linearize raw device depth + linearizeSceneDepth(caller, *depthSample, value); +} + +void MaterialGenerator::linearizeSceneDepth(Node* caller, const Value& depth, Value& value) +{ + value = writeLocal(VariantType::Float, String::Format(TEXT("ViewInfo.w / ({0}.x - ViewInfo.z)"), depth.Value), caller); +} + void MaterialGenerator::ProcessGroupTextures(Box* box, Node* node, Value& value) { switch (node->TypeID) From c55d38534df521ba80235f0bcf9d9282a4f43a35 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 21 Nov 2022 23:45:13 +0100 Subject: [PATCH 21/22] Add `WorldPosition` to postfx material scene textures for world-space position sampling at uv --- .../Editor/MaterialTemplates/PostProcess.shader | 9 +++++++++ Source/Engine/Graphics/Materials/MaterialInfo.h | 5 +++++ .../Graphics/Materials/MaterialParams.cpp | 1 + .../Engine/Graphics/Materials/MaterialShader.h | 2 +- .../Graphics/Materials/PostFxMaterialShader.cpp | 2 ++ .../GPU/ParticleEmitterGraph.GPU.Textures.cpp | 3 +++ .../MaterialGenerator.Textures.cpp | 17 +++++++++++++++++ 7 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Content/Editor/MaterialTemplates/PostProcess.shader b/Content/Editor/MaterialTemplates/PostProcess.shader index f20bdc610..927d63c8c 100644 --- a/Content/Editor/MaterialTemplates/PostProcess.shader +++ b/Content/Editor/MaterialTemplates/PostProcess.shader @@ -18,6 +18,7 @@ float TimeParam; float4 ViewInfo; float4 ScreenSize; float4 TemporalAAJitter; +float4x4 InverseViewProjectionMatrix; @1META_CB_END // Shader resources @@ -62,6 +63,14 @@ MaterialInput GetMaterialInput(PixelInput input) return result; } +// Gets world space position at given pixel coordinate with given device depth +float3 GetWorldPos(float2 uv, float deviceDepth) +{ + float4 clipPos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), deviceDepth, 1.0); + float4 wsPos = mul(clipPos, InverseViewProjectionMatrix); + return wsPos.xyz / wsPos.w; +} + // Transforms a vector from tangent space to world space float3 TransformTangentVectorToWorld(MaterialInput input, float3 tangentVector) { diff --git a/Source/Engine/Graphics/Materials/MaterialInfo.h b/Source/Engine/Graphics/Materials/MaterialInfo.h index 876246e0c..dfdcdc9be 100644 --- a/Source/Engine/Graphics/Materials/MaterialInfo.h +++ b/Source/Engine/Graphics/Materials/MaterialInfo.h @@ -435,6 +435,11 @@ API_ENUM() enum class MaterialSceneTextures /// The material shading mode. /// ShadingModel = 10, + + /// + /// The scene world-space position (relative to the render view origin). + /// + WorldPosition = 11, }; /// diff --git a/Source/Engine/Graphics/Materials/MaterialParams.cpp b/Source/Engine/Graphics/Materials/MaterialParams.cpp index 7c3e9d2d0..50ac1f8bb 100644 --- a/Source/Engine/Graphics/Materials/MaterialParams.cpp +++ b/Source/Engine/Graphics/Materials/MaterialParams.cpp @@ -439,6 +439,7 @@ void MaterialParameter::Bind(BindMeta& meta) const switch (type) { case MaterialSceneTextures::SceneDepth: + case MaterialSceneTextures::WorldPosition: view = meta.CanSampleDepth ? meta.Buffers->DepthBuffer->GetDescription().Flags & GPUTextureFlags::ReadOnlyDepthView ? meta.Buffers->DepthBuffer->ViewReadOnlyDepth() diff --git a/Source/Engine/Graphics/Materials/MaterialShader.h b/Source/Engine/Graphics/Materials/MaterialShader.h index 3c8bf37bf..c7249b2ab 100644 --- a/Source/Engine/Graphics/Materials/MaterialShader.h +++ b/Source/Engine/Graphics/Materials/MaterialShader.h @@ -10,7 +10,7 @@ /// /// Current materials shader version. /// -#define MATERIAL_GRAPH_VERSION 156 +#define MATERIAL_GRAPH_VERSION 157 class Material; class GPUShader; diff --git a/Source/Engine/Graphics/Materials/PostFxMaterialShader.cpp b/Source/Engine/Graphics/Materials/PostFxMaterialShader.cpp index 4c2caec84..ff1ff3fb6 100644 --- a/Source/Engine/Graphics/Materials/PostFxMaterialShader.cpp +++ b/Source/Engine/Graphics/Materials/PostFxMaterialShader.cpp @@ -18,6 +18,7 @@ PACK_STRUCT(struct PostFxMaterialShaderData { Float4 ViewInfo; Float4 ScreenSize; Float4 TemporalAAJitter; + Matrix InverseViewProjectionMatrix; }); void PostFxMaterialShader::Bind(BindParameters& params) @@ -44,6 +45,7 @@ void PostFxMaterialShader::Bind(BindParameters& params) // Setup material constants { Matrix::Transpose(view.View, materialData->ViewMatrix); + Matrix::Transpose(view.IVP, materialData->InverseViewProjectionMatrix); materialData->ViewPos = view.Position; materialData->ViewFar = view.Far; materialData->ViewDir = view.Direction; diff --git a/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.Textures.cpp b/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.Textures.cpp index 823ddbccd..05059f05e 100644 --- a/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.Textures.cpp +++ b/Source/Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.Textures.cpp @@ -245,6 +245,9 @@ void ParticleEmitterGPUGenerator::ProcessGroupTextures(Box* box, Node* node, Val value = writeLocal(VariantType::Int, String::Format(TEXT("(int)({0}.a * 3.999)"), gBuffer1Sample.Value), node); break; } + case MaterialSceneTextures::WorldPosition: + value = Value::Zero; // Not implemented + break; default: { // Sample single texture diff --git a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Textures.cpp b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Textures.cpp index cc5130d44..d6ae2719f 100644 --- a/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Textures.cpp +++ b/Source/Engine/Tools/MaterialGenerator/MaterialGenerator.Textures.cpp @@ -416,6 +416,23 @@ void MaterialGenerator::ProcessGroupTextures(Box* box, Node* node, Value& value) value = writeLocal(VariantType::Int, String::Format(TEXT("(int)({0}.a * 3.999)"), gBuffer1Sample->Value), node); break; } + case MaterialSceneTextures::WorldPosition: + { + auto depthParam = findOrAddSceneTexture(MaterialSceneTextures::SceneDepth); + auto depthSample = sampleTextureRaw(node, value, box, &depthParam); + if (depthSample == nullptr) + break; + const auto parent = box->GetParent>(); + MaterialGraphBox* uvBox = parent->GetBox(0); + bool useCustomUVs = uvBox->HasConnection(); + String uv; + if (useCustomUVs) + uv = MaterialValue::Cast(tryGetValue(uvBox, getUVs), VariantType::Float2).Value; + else + uv = TEXT("input.TexCoord.xy"); + value = writeLocal(VariantType::Float3, String::Format(TEXT("GetWorldPos({1}, {0}.rgb)"), depthSample->Value, uv), node); + break; + } default: { // Sample single texture From 2e46ebea7a1a226bbb076cb75729a5dd5b00442d Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 21 Nov 2022 23:46:27 +0100 Subject: [PATCH 22/22] Update engine assets --- Content/Editor/Camera/M_Camera.flax | 4 ++-- Content/Editor/CubeTexturePreviewMaterial.flax | 4 ++-- Content/Editor/DebugMaterials/DDGIDebugProbes.flax | 4 ++-- Content/Editor/DebugMaterials/SingleColor/Decal.flax | 2 +- Content/Editor/DebugMaterials/SingleColor/Particle.flax | 2 +- Content/Editor/DebugMaterials/SingleColor/Surface.flax | 4 ++-- .../Editor/DebugMaterials/SingleColor/SurfaceAdditive.flax | 2 +- Content/Editor/DebugMaterials/SingleColor/Terrain.flax | 4 ++-- Content/Editor/DefaultFontMaterial.flax | 4 ++-- Content/Editor/Gizmo/FoliageBrushMaterial.flax | 2 +- Content/Editor/Gizmo/Material.flax | 2 +- Content/Editor/Gizmo/MaterialWire.flax | 2 +- Content/Editor/Gizmo/SelectionOutlineMaterial.flax | 4 ++-- Content/Editor/Gizmo/VertexColorsPreviewMaterial.flax | 4 ++-- Content/Editor/Highlight Material.flax | 2 +- Content/Editor/Icons/IconsMaterial.flax | 2 +- Content/Editor/IesProfilePreviewMaterial.flax | 2 +- Content/Editor/Particles/Particle Material Color.flax | 2 +- Content/Editor/Particles/Smoke Material.flax | 2 +- Content/Editor/SpriteMaterial.flax | 4 ++-- Content/Editor/Terrain/Circle Brush Material.flax | 4 ++-- Content/Editor/Terrain/Highlight Terrain Material.flax | 4 ++-- Content/Editor/TexturePreviewMaterial.flax | 2 +- Content/Editor/Wires Debug Material.flax | 2 +- Content/Engine/DefaultDeformableMaterial.flax | 4 ++-- Content/Engine/DefaultMaterial.flax | 4 ++-- Content/Engine/DefaultTerrainMaterial.flax | 4 ++-- Content/Engine/SingleColorMaterial.flax | 4 ++-- Content/Engine/SkyboxMaterial.flax | 4 ++-- 29 files changed, 45 insertions(+), 45 deletions(-) diff --git a/Content/Editor/Camera/M_Camera.flax b/Content/Editor/Camera/M_Camera.flax index 5cb19b49a..05cc0dbd2 100644 --- a/Content/Editor/Camera/M_Camera.flax +++ b/Content/Editor/Camera/M_Camera.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:779ad273864abe5f7419aed9fb40c498294ae52dfa07672652c7d646117114de -size 29815 +oid sha256:5e2a5920fd602a0c1d516d20c899cbd9e5da8a564aa3ec3a9c303d426544a784 +size 29681 diff --git a/Content/Editor/CubeTexturePreviewMaterial.flax b/Content/Editor/CubeTexturePreviewMaterial.flax index cccb82acd..131b59778 100644 --- a/Content/Editor/CubeTexturePreviewMaterial.flax +++ b/Content/Editor/CubeTexturePreviewMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fdc2f990575222224bb5fb906ab6cc0615e204c26a8dd4dd1eac082fa6686ebd -size 31368 +oid sha256:ca8bb95da51600f316ed4a8115a85709d5457fb5b9034d03f09ab3ab440add6b +size 31234 diff --git a/Content/Editor/DebugMaterials/DDGIDebugProbes.flax b/Content/Editor/DebugMaterials/DDGIDebugProbes.flax index 5a4308fad..48bb4bf1f 100644 --- a/Content/Editor/DebugMaterials/DDGIDebugProbes.flax +++ b/Content/Editor/DebugMaterials/DDGIDebugProbes.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d5b1a9c73f41a5098c8c2e5b11f23bbe4d4923a60bd751269fc74e64262691dc -size 41138 +oid sha256:823b26dbf7493558f1517622ee2b852a3666a75d2cac3806d951e93b61f9555c +size 41004 diff --git a/Content/Editor/DebugMaterials/SingleColor/Decal.flax b/Content/Editor/DebugMaterials/SingleColor/Decal.flax index 1030013a4..61ad6963d 100644 --- a/Content/Editor/DebugMaterials/SingleColor/Decal.flax +++ b/Content/Editor/DebugMaterials/SingleColor/Decal.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5a618aff3323bdfe36cf49faa88b2213a8763439dd59f52dceb630bea326658e +oid sha256:d07223bb9812d08ee0e5b5590c40fe7a2aefd9fb10bb59a982da6ee7e3f8d219 size 7822 diff --git a/Content/Editor/DebugMaterials/SingleColor/Particle.flax b/Content/Editor/DebugMaterials/SingleColor/Particle.flax index b9f9e80c8..fe1e0b709 100644 --- a/Content/Editor/DebugMaterials/SingleColor/Particle.flax +++ b/Content/Editor/DebugMaterials/SingleColor/Particle.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d255026e179b0ab3887d0af0d4e4cc4944775aa94e3e7d6e1cf286eae7373035 +oid sha256:45e5b1fdd6c59b30e0363fc4b9cd420b491b235fd4189fe49af193af6398e900 size 31872 diff --git a/Content/Editor/DebugMaterials/SingleColor/Surface.flax b/Content/Editor/DebugMaterials/SingleColor/Surface.flax index 5daa66ee3..c2c62b9a3 100644 --- a/Content/Editor/DebugMaterials/SingleColor/Surface.flax +++ b/Content/Editor/DebugMaterials/SingleColor/Surface.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0392ccc8462c905527576fd9cca2971d1f69b6414acf1d5cd308016d8941f7ad -size 29711 +oid sha256:5b57bf45fb5a0fc3ac595a653837680d3cdbef017377acc378c4c1d9f162f6a5 +size 29577 diff --git a/Content/Editor/DebugMaterials/SingleColor/SurfaceAdditive.flax b/Content/Editor/DebugMaterials/SingleColor/SurfaceAdditive.flax index 50d52e29d..441e62a04 100644 --- a/Content/Editor/DebugMaterials/SingleColor/SurfaceAdditive.flax +++ b/Content/Editor/DebugMaterials/SingleColor/SurfaceAdditive.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:71f7df169fec40d4d96933b26f765a6e0184a413ea7a62df6f6ef6fcbf48dc95 +oid sha256:8b6b531e057a650139df92f14bce17e20515624d6307126cbaa92f6ad8097223 size 31462 diff --git a/Content/Editor/DebugMaterials/SingleColor/Terrain.flax b/Content/Editor/DebugMaterials/SingleColor/Terrain.flax index 46ec95ca0..0c11ddff8 100644 --- a/Content/Editor/DebugMaterials/SingleColor/Terrain.flax +++ b/Content/Editor/DebugMaterials/SingleColor/Terrain.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:289fdc59f5892e4224472f24eef99a067627aeeee8bdaff99ad774f06254d145 -size 21498 +oid sha256:43456dab4cfc391e67e53d96a431cf6d4e8dc3ce7e03bb08481ef9534a6ad211 +size 21364 diff --git a/Content/Editor/DefaultFontMaterial.flax b/Content/Editor/DefaultFontMaterial.flax index edda03515..87fac308c 100644 --- a/Content/Editor/DefaultFontMaterial.flax +++ b/Content/Editor/DefaultFontMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:14ef6cf999ecdc62391babd3667b76a057c0e7a8499c1a8e06fd32da216443ad -size 29890 +oid sha256:8618a7208dbd04de01cb92e7d6981e3902887365ac160790f34b3ea54c769464 +size 29756 diff --git a/Content/Editor/Gizmo/FoliageBrushMaterial.flax b/Content/Editor/Gizmo/FoliageBrushMaterial.flax index d0598ae6e..7f6217a37 100644 --- a/Content/Editor/Gizmo/FoliageBrushMaterial.flax +++ b/Content/Editor/Gizmo/FoliageBrushMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e6a36b76d5b75d47160130855e3e40b734b95b0bc69dc8080e7423ae8d5baf1 +oid sha256:736a4ae1453d87e843aeca5f7213672cd780c638706c46c24eb3a63504a25a7f size 35480 diff --git a/Content/Editor/Gizmo/Material.flax b/Content/Editor/Gizmo/Material.flax index 12aa9270f..c65305315 100644 --- a/Content/Editor/Gizmo/Material.flax +++ b/Content/Editor/Gizmo/Material.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8b1627fe63dc9348917a7af9d475be69901f375a2f9bb9f9ba31c78a547596ed +oid sha256:917baec5b3faa290c7b9ece4a9a60ebd029daccf344d3a019fa4b00959ce9be0 size 32000 diff --git a/Content/Editor/Gizmo/MaterialWire.flax b/Content/Editor/Gizmo/MaterialWire.flax index 0423737f7..580e59198 100644 --- a/Content/Editor/Gizmo/MaterialWire.flax +++ b/Content/Editor/Gizmo/MaterialWire.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8c300e4fa99ac6179c603ab06a20d71e9a777c5cd2b5eab9c07c5405645b9067 +oid sha256:907900eb23cfadc5cfe37da84fa246db9ac4f6519e66d402465c79bb32af99eb size 31213 diff --git a/Content/Editor/Gizmo/SelectionOutlineMaterial.flax b/Content/Editor/Gizmo/SelectionOutlineMaterial.flax index d4f1d6ba3..248a5e968 100644 --- a/Content/Editor/Gizmo/SelectionOutlineMaterial.flax +++ b/Content/Editor/Gizmo/SelectionOutlineMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e929de6e8c3bc25d52a230e31008225f6f5c9b81071b5e91e88d606ad78e3f6f -size 16005 +oid sha256:5c336d599fea3b79ec22fdb065746752ddc8994f5fb6ac64d8247ee0465c523b +size 16361 diff --git a/Content/Editor/Gizmo/VertexColorsPreviewMaterial.flax b/Content/Editor/Gizmo/VertexColorsPreviewMaterial.flax index ea9bf717f..4e9d9494d 100644 --- a/Content/Editor/Gizmo/VertexColorsPreviewMaterial.flax +++ b/Content/Editor/Gizmo/VertexColorsPreviewMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ade96ecf781d6e5e41c47b47822af104d2f0be1da63ec608e6cad199fa31f9ee -size 30824 +oid sha256:ded89f59798d4afa831a5d64ed8d25e75aec3760fbd06348d2e2839bfcca1201 +size 30690 diff --git a/Content/Editor/Highlight Material.flax b/Content/Editor/Highlight Material.flax index c8f587c32..be1e7d020 100644 --- a/Content/Editor/Highlight Material.flax +++ b/Content/Editor/Highlight Material.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:75323e9b39baa50c54a28dec398d00135093da95b2e33771808389dfc493189e +oid sha256:4cd4ba79645c55e592b032bbad4db92df9955c2b4d770b07fa2648c1787c5b5b size 29812 diff --git a/Content/Editor/Icons/IconsMaterial.flax b/Content/Editor/Icons/IconsMaterial.flax index c25530d63..89c91027c 100644 --- a/Content/Editor/Icons/IconsMaterial.flax +++ b/Content/Editor/Icons/IconsMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bd40528e33d69694de902fb672780280c8c3d215b4cb4d9801f3c88b076b9a1f +oid sha256:fc4ab1a7cd7a2b9c139d712427037f40e2e3a9876198fe188e0a55fcd8f0cf1c size 29740 diff --git a/Content/Editor/IesProfilePreviewMaterial.flax b/Content/Editor/IesProfilePreviewMaterial.flax index 7d4ba87e2..17393c585 100644 --- a/Content/Editor/IesProfilePreviewMaterial.flax +++ b/Content/Editor/IesProfilePreviewMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2b488a633959d83617f75bb39622f15749d3674cf982aeccd5c8a9a134a1e048 +oid sha256:da93241671811dede91e27744fad6e83c8e1c506f6444db44965f4aa5d1130b1 size 18217 diff --git a/Content/Editor/Particles/Particle Material Color.flax b/Content/Editor/Particles/Particle Material Color.flax index a2b7c0a7f..8e33d86da 100644 --- a/Content/Editor/Particles/Particle Material Color.flax +++ b/Content/Editor/Particles/Particle Material Color.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d7c810537d88f905efb36028e7d6c6efde05a5d2fff66560f897936f2fb36cb0 +oid sha256:2f20512fe65132a76f8a413c7174b129278d48bc528a434874562dd034f80b6a size 30064 diff --git a/Content/Editor/Particles/Smoke Material.flax b/Content/Editor/Particles/Smoke Material.flax index 9336b653d..5795c93f3 100644 --- a/Content/Editor/Particles/Smoke Material.flax +++ b/Content/Editor/Particles/Smoke Material.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eb5c3f05f811d4861dac85b557c1aa5b2967b3a4ae84f46899462bf4dd47f308 +oid sha256:ddc802c1965ae52228472f7b9363a11da9387db8b871a8802870b30d413c04cc size 37252 diff --git a/Content/Editor/SpriteMaterial.flax b/Content/Editor/SpriteMaterial.flax index c806060e9..3c7eb25c0 100644 --- a/Content/Editor/SpriteMaterial.flax +++ b/Content/Editor/SpriteMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ae7cbdfefc315ce61d581e192760e94a4a675cb0ecd4ebd1b955f0a5ac6c3b79 -size 30903 +oid sha256:aec60f86441dd63f5d72435a3e583383fef7d18c91dcefd10ce5cb70e33e7c28 +size 30769 diff --git a/Content/Editor/Terrain/Circle Brush Material.flax b/Content/Editor/Terrain/Circle Brush Material.flax index 4d37386e2..746db4656 100644 --- a/Content/Editor/Terrain/Circle Brush Material.flax +++ b/Content/Editor/Terrain/Circle Brush Material.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:589eccbded96e667055d7ffde42073be4c0565f646bb36ddb85c03de9e9212d4 -size 27879 +oid sha256:3fd04c29071ba60232e91245f6a9e4980080ec73f2da6756441075c8e59686f9 +size 27745 diff --git a/Content/Editor/Terrain/Highlight Terrain Material.flax b/Content/Editor/Terrain/Highlight Terrain Material.flax index db94baf0f..82f88c8dd 100644 --- a/Content/Editor/Terrain/Highlight Terrain Material.flax +++ b/Content/Editor/Terrain/Highlight Terrain Material.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1ccef4b4c5a1a4274be0a262fe5311caa2ad195a04c31e8312a0346406f9151d -size 21551 +oid sha256:4a11a280c26a6e34b2fe6077f345168a62ebbdd7f29b818f6869ad1aef3cc6fc +size 21417 diff --git a/Content/Editor/TexturePreviewMaterial.flax b/Content/Editor/TexturePreviewMaterial.flax index 471db7b26..a009679cf 100644 --- a/Content/Editor/TexturePreviewMaterial.flax +++ b/Content/Editor/TexturePreviewMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e925a7c389ba5a2e220ccd81b791c4308eecaa9e886944a7abf036af4eaae8e7 +oid sha256:68eef240b7779e82f27384c2f4104fe61aada5501153768b3b4b99a5a4314da7 size 10413 diff --git a/Content/Editor/Wires Debug Material.flax b/Content/Editor/Wires Debug Material.flax index 7e46f5f20..ddd886368 100644 --- a/Content/Editor/Wires Debug Material.flax +++ b/Content/Editor/Wires Debug Material.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1f41b1eceff5c51e0c30415a8f9a9802a776764f55adc33187adf407cf8272b8 +oid sha256:bc1ecd7385fd6b6bfb21013518351a774b83bc8667fcb29b9078ca2dfab2f8c9 size 29812 diff --git a/Content/Engine/DefaultDeformableMaterial.flax b/Content/Engine/DefaultDeformableMaterial.flax index 97e75dab9..098a2638c 100644 --- a/Content/Engine/DefaultDeformableMaterial.flax +++ b/Content/Engine/DefaultDeformableMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:268714db469e6738f66d29303a734f08dd1697ac2212323cca4f7a319862a12a -size 19148 +oid sha256:0900059780ab36acd67b0485bddb73f69f525d48988210781e8c7eb94a1b55d5 +size 19066 diff --git a/Content/Engine/DefaultMaterial.flax b/Content/Engine/DefaultMaterial.flax index ecc2640ea..af40d145d 100644 --- a/Content/Engine/DefaultMaterial.flax +++ b/Content/Engine/DefaultMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f3a3b5e618a767b1c809a91905fe6e7e2c691b7f7f0a705ba2466a62613436e7 -size 31742 +oid sha256:29149bc88f7151e43c0f8d507310c0790e39cfb16447f05dd2ec63c3f0e1bffb +size 31608 diff --git a/Content/Engine/DefaultTerrainMaterial.flax b/Content/Engine/DefaultTerrainMaterial.flax index 2de790a14..4707008fb 100644 --- a/Content/Engine/DefaultTerrainMaterial.flax +++ b/Content/Engine/DefaultTerrainMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f045edab9e16d7e911f44e981aab8100c338d6bd80943feec15e6516c3ae5cc8 -size 23641 +oid sha256:a04b093bd663e850d5e45b55e3fc07dd7099622790c2bdc02a8c1f3036eda646 +size 23507 diff --git a/Content/Engine/SingleColorMaterial.flax b/Content/Engine/SingleColorMaterial.flax index 55487fb0b..01434ca67 100644 --- a/Content/Engine/SingleColorMaterial.flax +++ b/Content/Engine/SingleColorMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f8ac98b2141c680b1351d9f565052b4a0675c6983bbde2d50ea8be09b433d85e -size 29912 +oid sha256:a17e6ae451724b2c4b098c503040a2604179c1a56211c3e8a0f2ff345df754b9 +size 29778 diff --git a/Content/Engine/SkyboxMaterial.flax b/Content/Engine/SkyboxMaterial.flax index 21dccfd58..5578b13eb 100644 --- a/Content/Engine/SkyboxMaterial.flax +++ b/Content/Engine/SkyboxMaterial.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:65cfd196acc25c9f483a5e392dee43ae92e151fe3f105a245c00c147890660b6 -size 31110 +oid sha256:25b3d3a40a2b132c79d124a33b518f661ff9a2b3b3126ef6e9b4eda3466326af +size 30976