diff --git a/Source/Editor/Content/Items/JsonAssetItem.cs b/Source/Editor/Content/Items/JsonAssetItem.cs index 1fcada72a..1c9232c9c 100644 --- a/Source/Editor/Content/Items/JsonAssetItem.cs +++ b/Source/Editor/Content/Items/JsonAssetItem.cs @@ -11,6 +11,8 @@ namespace FlaxEditor.Content /// public class JsonAssetItem : AssetItem { + private readonly SpriteHandle _thumbnail; + /// /// Initializes a new instance of the class. /// @@ -20,13 +22,27 @@ namespace FlaxEditor.Content public JsonAssetItem(string path, Guid id, string typeName) : base(path, typeName, ref id) { + _thumbnail = Editor.Instance.Icons.Document128; + } + + /// + /// Initializes a new instance of the class. + /// + /// The path. + /// The identifier. + /// Name of the resource type. + /// Asset icon. + public JsonAssetItem(string path, Guid id, string typeName, SpriteHandle thumbnail) + : base(path, typeName, ref id) + { + _thumbnail = thumbnail; } /// public override ContentItemSearchFilter SearchFilter => ContentItemSearchFilter.Json; /// - public override SpriteHandle DefaultThumbnail => Editor.Instance.Icons.Document128; + public override SpriteHandle DefaultThumbnail => _thumbnail; /// protected override bool DrawShadow => false; diff --git a/Source/Editor/Content/Items/SettingsItem/AndroidPlatformSettingsItem.cs b/Source/Editor/Content/Items/SettingsItem/AndroidPlatformSettingsItem.cs deleted file mode 100644 index 9a487ac2c..000000000 --- a/Source/Editor/Content/Items/SettingsItem/AndroidPlatformSettingsItem.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. - -using System; -using FlaxEngine; - -namespace FlaxEditor.Content -{ - /// - /// Content item that contains data. - /// - /// - public sealed class AndroidPlatformSettingsItem : JsonAssetItem - { - /// - /// Initializes a new instance of the class. - /// - /// The asset path. - /// The asset identifier. - /// The Name of the resource type. - public AndroidPlatformSettingsItem(string path, Guid id, string typeName) - : base(path, id, typeName) - { - } - - /// - public override SpriteHandle DefaultThumbnail => Editor.Instance.Icons.AndroidSettings128; - } -} diff --git a/Source/Editor/Content/Items/SettingsItem/AudioSettingsItem.cs b/Source/Editor/Content/Items/SettingsItem/AudioSettingsItem.cs deleted file mode 100644 index 464f8a870..000000000 --- a/Source/Editor/Content/Items/SettingsItem/AudioSettingsItem.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. - -using System; -using FlaxEngine; - -namespace FlaxEditor.Content -{ - /// - /// Content item that contains data. - /// - /// - public sealed class AudioSettingsItem : JsonAssetItem - { - /// - /// Initializes a new instance of the class. - /// - /// The asset path. - /// The asset identifier. - /// The Name of the resource type. - public AudioSettingsItem(string path, Guid id, string typeName) - : base(path, id, typeName) - { - } - - /// - public override SpriteHandle DefaultThumbnail => Editor.Instance.Icons.AudioSettings128; - } -} diff --git a/Source/Editor/Content/Items/SettingsItem/BuildSettingsItem.cs b/Source/Editor/Content/Items/SettingsItem/BuildSettingsItem.cs deleted file mode 100644 index 4e3264226..000000000 --- a/Source/Editor/Content/Items/SettingsItem/BuildSettingsItem.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. - -using System; -using FlaxEngine; - -namespace FlaxEditor.Content -{ - /// - /// Content item that contains data. - /// - /// - public sealed class BuildSettingsItem : JsonAssetItem - { - /// - /// Initializes a new instance of the class. - /// - /// The asset path. - /// The asset identifier. - /// The Name of the resource type. - public BuildSettingsItem(string path, Guid id, string typeName) - : base(path, id, typeName) - { - } - - /// - public override SpriteHandle DefaultThumbnail => Editor.Instance.Icons.BuildSettings128; - } -} diff --git a/Source/Editor/Content/Items/SettingsItem/GameSettingsItem.cs b/Source/Editor/Content/Items/SettingsItem/GameSettingsItem.cs deleted file mode 100644 index f3933a55a..000000000 --- a/Source/Editor/Content/Items/SettingsItem/GameSettingsItem.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. - -using System; -using FlaxEngine; - -namespace FlaxEditor.Content -{ - /// - /// Content item that contains data. - /// - /// - public sealed class GameSettingsItem : JsonAssetItem - { - /// - /// Initializes a new instance of the class. - /// - /// The asset path. - /// The asset identifier. - /// The Name of the resource type. - public GameSettingsItem(string path, Guid id, string typeName) - : base(path, id, typeName) - { - } - - /// - public override SpriteHandle DefaultThumbnail => Editor.Instance.Icons.GameSettings128; - } -} diff --git a/Source/Editor/Content/Items/SettingsItem/GraphicsSettingsItem.cs b/Source/Editor/Content/Items/SettingsItem/GraphicsSettingsItem.cs deleted file mode 100644 index 19c74be3b..000000000 --- a/Source/Editor/Content/Items/SettingsItem/GraphicsSettingsItem.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. - -using System; -using FlaxEngine; - -namespace FlaxEditor.Content -{ - /// - /// Content item that contains data. - /// - /// - public sealed class GraphicsSettingsItem : JsonAssetItem - { - /// - /// Initializes a new instance of the class. - /// - /// The asset path. - /// The asset identifier. - /// The Name of the resource type. - public GraphicsSettingsItem(string path, Guid id, string typeName) - : base(path, id, typeName) - { - } - - /// - public override SpriteHandle DefaultThumbnail => Editor.Instance.Icons.GraphicsSettings128; - } -} diff --git a/Source/Editor/Content/Items/SettingsItem/InputSettingsItem.cs b/Source/Editor/Content/Items/SettingsItem/InputSettingsItem.cs deleted file mode 100644 index 5626a0401..000000000 --- a/Source/Editor/Content/Items/SettingsItem/InputSettingsItem.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. - -using System; -using FlaxEngine; - -namespace FlaxEditor.Content -{ - /// - /// Content item that contains data. - /// - /// - public sealed class InputSettingsItem : JsonAssetItem - { - /// - /// Initializes a new instance of the class. - /// - /// The asset path. - /// The asset identifier. - /// The Name of the resource type. - public InputSettingsItem(string path, Guid id, string typeName) - : base(path, id, typeName) - { - } - - /// - public override SpriteHandle DefaultThumbnail => Editor.Instance.Icons.InputSettings128; - } -} diff --git a/Source/Editor/Content/Items/SettingsItem/LayersAndTagsSettingsItem.cs b/Source/Editor/Content/Items/SettingsItem/LayersAndTagsSettingsItem.cs deleted file mode 100644 index 904d563c2..000000000 --- a/Source/Editor/Content/Items/SettingsItem/LayersAndTagsSettingsItem.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. - -using System; -using FlaxEngine; - -namespace FlaxEditor.Content -{ - /// - /// Content item that contains data. - /// - /// - public sealed class LayersAndTagsSettingsItem : JsonAssetItem - { - /// - /// Initializes a new instance of the class. - /// - /// The asset path. - /// The asset identifier. - /// The Name of the resource type. - public LayersAndTagsSettingsItem(string path, Guid id, string typeName) - : base(path, id, typeName) - { - } - - /// - public override SpriteHandle DefaultThumbnail => Editor.Instance.Icons.LayersTagsSettings128; - } -} diff --git a/Source/Editor/Content/Items/SettingsItem/LinuxPlatformSettingsItem.cs b/Source/Editor/Content/Items/SettingsItem/LinuxPlatformSettingsItem.cs deleted file mode 100644 index 36d323c29..000000000 --- a/Source/Editor/Content/Items/SettingsItem/LinuxPlatformSettingsItem.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. - -using System; -using FlaxEngine; - -namespace FlaxEditor.Content -{ - /// - /// Content item that contains data. - /// - /// - public sealed class LinuxPlatformSettingsItem : JsonAssetItem - { - /// - /// Initializes a new instance of the class. - /// - /// The asset path. - /// The asset identifier. - /// The Name of the resource type. - public LinuxPlatformSettingsItem(string path, Guid id, string typeName) - : base(path, id, typeName) - { - } - - /// - public override SpriteHandle DefaultThumbnail => Editor.Instance.Icons.LinuxSettings128; - } -} diff --git a/Source/Editor/Content/Items/SettingsItem/NavigationSettingsItem.cs b/Source/Editor/Content/Items/SettingsItem/NavigationSettingsItem.cs deleted file mode 100644 index 8f6c778a0..000000000 --- a/Source/Editor/Content/Items/SettingsItem/NavigationSettingsItem.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. - -using System; -using FlaxEngine; - -namespace FlaxEditor.Content -{ - /// - /// Content item that contains data. - /// - /// - public sealed class NavigationSettingsItem : JsonAssetItem - { - /// - /// Initializes a new instance of the class. - /// - /// The asset path. - /// The asset identifier. - /// The Name of the resource type. - public NavigationSettingsItem(string path, Guid id, string typeName) - : base(path, id, typeName) - { - } - - /// - public override SpriteHandle DefaultThumbnail => Editor.Instance.Icons.NavigationSettings128; - } -} diff --git a/Source/Editor/Content/Items/SettingsItem/PhysicsSettingsItem.cs b/Source/Editor/Content/Items/SettingsItem/PhysicsSettingsItem.cs deleted file mode 100644 index 675df7104..000000000 --- a/Source/Editor/Content/Items/SettingsItem/PhysicsSettingsItem.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. - -using System; -using FlaxEngine; - -namespace FlaxEditor.Content -{ - /// - /// Content item that contains data. - /// - /// - public sealed class PhysicsSettingsItem : JsonAssetItem - { - /// - /// Initializes a new instance of the class. - /// - /// The asset path. - /// The asset identifier. - /// The Name of the resource type. - public PhysicsSettingsItem(string path, Guid id, string typeName) - : base(path, id, typeName) - { - } - - /// - public override SpriteHandle DefaultThumbnail => Editor.Instance.Icons.PhysicsSettings128; - } -} diff --git a/Source/Editor/Content/Items/SettingsItem/TimeSettingsItem.cs b/Source/Editor/Content/Items/SettingsItem/TimeSettingsItem.cs deleted file mode 100644 index 5ce4de057..000000000 --- a/Source/Editor/Content/Items/SettingsItem/TimeSettingsItem.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. - -using System; -using FlaxEngine; - -namespace FlaxEditor.Content -{ - /// - /// Content item that contains data. - /// - /// - public sealed class TimeSettingsItem : JsonAssetItem - { - /// - /// Initializes a new instance of the class. - /// - /// The asset path. - /// The asset identifier. - /// The Name of the resource type. - public TimeSettingsItem(string path, Guid id, string typeName) - : base(path, id, typeName) - { - } - - /// - public override SpriteHandle DefaultThumbnail => Editor.Instance.Icons.TimeSettings128; - } -} diff --git a/Source/Editor/Content/Items/SettingsItem/UWPPlatformSettingsItem.cs b/Source/Editor/Content/Items/SettingsItem/UWPPlatformSettingsItem.cs deleted file mode 100644 index 55e125089..000000000 --- a/Source/Editor/Content/Items/SettingsItem/UWPPlatformSettingsItem.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. - -using System; -using FlaxEngine; - -namespace FlaxEditor.Content -{ - /// - /// Content item that contains data. - /// - /// - public sealed class UWPPlatformSettingsItem : JsonAssetItem - { - /// - /// Initializes a new instance of the class. - /// - /// The asset path. - /// The asset identifier. - /// The Name of the resource type. - public UWPPlatformSettingsItem(string path, Guid id, string typeName) - : base(path, id, typeName) - { - } - - /// - public override SpriteHandle DefaultThumbnail => Editor.Instance.Icons.UWPSettings128; - } -} diff --git a/Source/Editor/Content/Items/SettingsItem/WindowsPlatformSettingsItem.cs b/Source/Editor/Content/Items/SettingsItem/WindowsPlatformSettingsItem.cs deleted file mode 100644 index 045269688..000000000 --- a/Source/Editor/Content/Items/SettingsItem/WindowsPlatformSettingsItem.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. - -using System; -using FlaxEngine; - -namespace FlaxEditor.Content -{ - /// - /// Content item that contains data. - /// - /// - public sealed class WindowsPlatformSettingsItem : JsonAssetItem - { - /// - /// Initializes a new instance of the class. - /// - /// The asset path. - /// The asset identifier. - /// The Name of the resource type. - public WindowsPlatformSettingsItem(string path, Guid id, string typeName) - : base(path, id, typeName) - { - } - - /// - public override SpriteHandle DefaultThumbnail => Editor.Instance.Icons.WindowsSettings128; - } -} diff --git a/Source/Editor/Content/Proxy/SettingsProxy.cs b/Source/Editor/Content/Proxy/SettingsProxy.cs index df24f6b6f..2bebc3254 100644 --- a/Source/Editor/Content/Proxy/SettingsProxy.cs +++ b/Source/Editor/Content/Proxy/SettingsProxy.cs @@ -3,6 +3,7 @@ using System; using FlaxEditor.Content.Create; using FlaxEditor.Content.Settings; +using FlaxEngine; namespace FlaxEditor.Content { @@ -13,15 +14,18 @@ namespace FlaxEditor.Content public sealed class SettingsProxy : JsonAssetProxy { private readonly Type _type; + private readonly SpriteHandle _thumbnail; /// /// Initializes a new instance of the class. /// /// The settings asset type (must be subclass of SettingsBase type). - public SettingsProxy(Type type) + /// Asset icon. + public SettingsProxy(Type type, SpriteHandle thumbnail) { _type = type; TypeName = type.FullName; + _thumbnail = thumbnail; } /// @@ -47,23 +51,7 @@ namespace FlaxEditor.Content /// public override AssetItem ConstructItem(string path, string typeName, ref Guid id) { - switch (typeName.Substring(typeName.LastIndexOf('.')+1)) - { - case "GameSettings": return new GameSettingsItem(path, id, typeName); - case "AndroidPlatformSettings": return new AndroidPlatformSettingsItem(path, id, typeName); - case "AudioSettings": return new AudioSettingsItem(path, id, typeName); - case "BuildSettings": return new BuildSettingsItem(path, id, typeName); - case "GraphicsSettings": return new GraphicsSettingsItem(path, id, typeName); - case "InputSettings": return new InputSettingsItem(path, id, typeName); - case "LayersAndTagsSettings": return new LayersAndTagsSettingsItem(path, id, typeName); - case "LinuxPlatformSettings": return new LinuxPlatformSettingsItem(path, id, typeName); - case "NavigationSettings": return new NavigationSettingsItem(path, id, typeName); - case "PhysicsSettings": return new PhysicsSettingsItem(path, id, typeName); - case "TimeSettings": return new TimeSettingsItem(path, id, typeName); - case "UWPPlatformSettings": return new UWPPlatformSettingsItem(path, id, typeName); - case "WindowsPlatformSettings": return new WindowsPlatformSettingsItem(path, id, typeName); - } - return base.ConstructItem(path, typeName, ref id); + return new JsonAssetItem(path, id, typeName, _thumbnail); } /// diff --git a/Source/Editor/Modules/ContentDatabaseModule.cs b/Source/Editor/Modules/ContentDatabaseModule.cs index 0ed73e987..ec71b8564 100644 --- a/Source/Editor/Modules/ContentDatabaseModule.cs +++ b/Source/Editor/Modules/ContentDatabaseModule.cs @@ -930,29 +930,29 @@ namespace FlaxEditor.Modules Proxy.Add(new SpawnableJsonAssetProxy()); // Settings - Proxy.Add(new SettingsProxy(typeof(GameSettings))); - Proxy.Add(new SettingsProxy(typeof(TimeSettings))); - Proxy.Add(new SettingsProxy(typeof(LayersAndTagsSettings))); - Proxy.Add(new SettingsProxy(typeof(PhysicsSettings))); - Proxy.Add(new SettingsProxy(typeof(GraphicsSettings))); - Proxy.Add(new SettingsProxy(typeof(NavigationSettings))); - Proxy.Add(new SettingsProxy(typeof(LocalizationSettings))); - Proxy.Add(new SettingsProxy(typeof(BuildSettings))); - Proxy.Add(new SettingsProxy(typeof(InputSettings))); - Proxy.Add(new SettingsProxy(typeof(WindowsPlatformSettings))); - Proxy.Add(new SettingsProxy(typeof(UWPPlatformSettings))); - Proxy.Add(new SettingsProxy(typeof(LinuxPlatformSettings))); + Proxy.Add(new SettingsProxy(typeof(GameSettings), Editor.Instance.Icons.GameSettings128)); + Proxy.Add(new SettingsProxy(typeof(TimeSettings), Editor.Instance.Icons.TimeSettings128)); + Proxy.Add(new SettingsProxy(typeof(LayersAndTagsSettings), Editor.Instance.Icons.LayersTagsSettings128)); + Proxy.Add(new SettingsProxy(typeof(PhysicsSettings), Editor.Instance.Icons.PhysicsSettings128)); + Proxy.Add(new SettingsProxy(typeof(GraphicsSettings), Editor.Instance.Icons.GraphicsSettings128)); + Proxy.Add(new SettingsProxy(typeof(NavigationSettings), Editor.Instance.Icons.NavigationSettings128)); + Proxy.Add(new SettingsProxy(typeof(LocalizationSettings), Editor.Instance.Icons.Document128)); + Proxy.Add(new SettingsProxy(typeof(BuildSettings), Editor.Instance.Icons.BuildSettings128)); + Proxy.Add(new SettingsProxy(typeof(InputSettings), Editor.Instance.Icons.InputSettings128)); + Proxy.Add(new SettingsProxy(typeof(WindowsPlatformSettings), Editor.Instance.Icons.WindowsSettings128)); + Proxy.Add(new SettingsProxy(typeof(UWPPlatformSettings), Editor.Instance.Icons.UWPSettings128)); + Proxy.Add(new SettingsProxy(typeof(LinuxPlatformSettings), Editor.Instance.Icons.LinuxSettings128)); var typePS4PlatformSettings = TypeUtils.GetManagedType(GameSettings.PS4PlatformSettingsTypename); if (typePS4PlatformSettings != null) - Proxy.Add(new SettingsProxy(typePS4PlatformSettings)); + Proxy.Add(new SettingsProxy(typePS4PlatformSettings, Editor.Instance.Icons.PlaystationSettings128)); var typeXboxScarlettPlatformSettings = TypeUtils.GetManagedType(GameSettings.XboxScarlettPlatformSettingsTypename); if (typeXboxScarlettPlatformSettings != null) - Proxy.Add(new SettingsProxy(typeXboxScarlettPlatformSettings)); - Proxy.Add(new SettingsProxy(typeof(AndroidPlatformSettings))); + Proxy.Add(new SettingsProxy(typeXboxScarlettPlatformSettings, Editor.Instance.Icons.XBoxScarletIcon128)); + Proxy.Add(new SettingsProxy(typeof(AndroidPlatformSettings), Editor.Instance.Icons.AndroidSettings128)); var typeSwitchPlatformSettings = TypeUtils.GetManagedType(GameSettings.SwitchPlatformSettingsTypename); if (typeSwitchPlatformSettings != null) - Proxy.Add(new SettingsProxy(typeSwitchPlatformSettings)); - Proxy.Add(new SettingsProxy(typeof(AudioSettings))); + Proxy.Add(new SettingsProxy(typeSwitchPlatformSettings, Editor.Instance.Icons.Document128)); + Proxy.Add(new SettingsProxy(typeof(AudioSettings), Editor.Instance.Icons.AudioSettings128)); // Last add generic json (won't override other json proxies) Proxy.Add(new GenericJsonAssetProxy());