diff --git a/Ghost.Editor.Core/AssetHandle/AssetImporterAttribute.cs b/Ghost.Editor.Core/AssetHandle/AssetImporterAttribute.cs
deleted file mode 100644
index 7b2756e..0000000
--- a/Ghost.Editor.Core/AssetHandle/AssetImporterAttribute.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace Ghost.Editor.Core.AssetHandle;
-
-[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
-internal class AssetImporterAttribute : Attribute
-{
- public string[] SupportedExtensions
- {
- get;
- }
-
- public AssetImporterAttribute(params string[] supportedExtensions)
- {
- SupportedExtensions = supportedExtensions;
- }
-}
\ No newline at end of file
diff --git a/Ghost.Editor.Core/AssetHandle/AssetOpenHandlerAttribute .cs b/Ghost.Editor.Core/AssetHandle/AssetOpenHandlerAttribute .cs
deleted file mode 100644
index 3ac4d9a..0000000
--- a/Ghost.Editor.Core/AssetHandle/AssetOpenHandlerAttribute .cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace Ghost.Editor.Core.AssetHandle;
-
-[AttributeUsage(AttributeTargets.Method)]
-public class AssetOpenHandlerAttribute : Attribute
-{
- public string[] Extensions
- {
- get;
- }
-
- public AssetOpenHandlerAttribute(params string[] extensions)
- {
- Extensions = extensions.Select(e => e.StartsWith('.') ? e.ToLowerInvariant() : '.' + e.ToLowerInvariant()).ToArray();
- }
-}
\ No newline at end of file
diff --git a/Ghost.Editor.Core/Attributes.cs b/Ghost.Editor.Core/Attributes.cs
new file mode 100644
index 0000000..f381aec
--- /dev/null
+++ b/Ghost.Editor.Core/Attributes.cs
@@ -0,0 +1,102 @@
+namespace Ghost.Editor.Core;
+
+///
+/// The base class for all attributes that can be discovered via .
+///
+public abstract class DiscoverableAttributeBase : Attribute;
+
+
+[AttributeUsage(AttributeTargets.Method)]
+public class AssetOpenHandlerAttribute : DiscoverableAttributeBase
+{
+ public string[] Extensions
+ {
+ get;
+ }
+
+ public AssetOpenHandlerAttribute(params string[] extensions)
+ {
+ Extensions = extensions.Select(e => e.StartsWith('.') ? e.ToLowerInvariant() : '.' + e.ToLowerInvariant()).ToArray();
+ }
+}
+
+[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
+internal class AssetImporterAttribute : DiscoverableAttributeBase
+{
+ public string[] SupportedExtensions
+ {
+ get;
+ }
+
+ public AssetImporterAttribute(params string[] supportedExtensions)
+ {
+ SupportedExtensions = supportedExtensions;
+ }
+}
+
+[AttributeUsage(AttributeTargets.Class)]
+public class CustomEditorAttribute : DiscoverableAttributeBase
+{
+ internal Type TargetType
+ {
+ get;
+ }
+
+ public CustomEditorAttribute(Type targetType)
+ {
+ TargetType = targetType;
+ }
+}
+
+[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
+public class EditorInjectionAttribute : DiscoverableAttributeBase
+{
+ public enum ServiceLifetime
+ {
+ Singleton,
+ Transient,
+ Scoped
+ }
+
+ public ServiceLifetime Lifetime
+ {
+ get;
+ }
+
+ public Type? ImplementationType
+ {
+ get;
+ }
+
+ public EditorInjectionAttribute(ServiceLifetime lifetime, Type? implementationType = null)
+ {
+ Lifetime = lifetime;
+ ImplementationType = implementationType;
+ }
+}
+
+[AttributeUsage(AttributeTargets.Method)]
+public sealed class ContextMenuItemAttribute : DiscoverableAttributeBase
+{
+ public string Tag
+ {
+ get;
+ }
+
+ public string Name
+ {
+ get;
+ }
+
+ public int Group
+ {
+ get;
+ }
+
+ public ContextMenuItemAttribute(string tag, string name, int group = 0)
+ {
+ Tag = tag;
+ Name = name;
+ Group = group;
+ }
+}
\ No newline at end of file
diff --git a/Ghost.Editor.Core/Controls/ControlsDictionary.xaml b/Ghost.Editor.Core/Controls/ControlsDictionary.xaml
index 6120a67..c9b0586 100644
--- a/Ghost.Editor.Core/Controls/ControlsDictionary.xaml
+++ b/Ghost.Editor.Core/Controls/ControlsDictionary.xaml
@@ -4,7 +4,6 @@
-
-
+
diff --git a/Ghost.Editor.Core/Controls/Internal/ComponentView.cs b/Ghost.Editor.Core/Controls/Internal/ComponentView.cs
index b3980af..0e7ae6b 100644
--- a/Ghost.Editor.Core/Controls/Internal/ComponentView.cs
+++ b/Ghost.Editor.Core/Controls/Internal/ComponentView.cs
@@ -7,7 +7,7 @@ using Microsoft.UI.Xaml.Controls;
using System.Reflection;
using System.Runtime.InteropServices;
-namespace Ghost.Editor.Core.Controls.Internal;
+namespace Ghost.Editor.Core.Controls;
internal sealed unsafe partial class ComponentView : Control
{
diff --git a/Ghost.Editor.Core/Controls/Internal/ComponentDataView.xaml b/Ghost.Editor.Core/Controls/Internal/ComponentView.xaml
similarity index 93%
rename from Ghost.Editor.Core/Controls/Internal/ComponentDataView.xaml
rename to Ghost.Editor.Core/Controls/Internal/ComponentView.xaml
index 2800e65..0c0ee8e 100644
--- a/Ghost.Editor.Core/Controls/Internal/ComponentDataView.xaml
+++ b/Ghost.Editor.Core/Controls/Internal/ComponentView.xaml
@@ -2,7 +2,7 @@
+ xmlns:local="using:Ghost.Editor.Core.Controls">
diff --git a/Ghost.Editor/View/Controls/ProjectBrowser.Menu.cs b/Ghost.Editor/View/Controls/ProjectBrowser.Menu.cs
new file mode 100644
index 0000000..a42ad1a
--- /dev/null
+++ b/Ghost.Editor/View/Controls/ProjectBrowser.Menu.cs
@@ -0,0 +1,23 @@
+using Ghost.Editor.Core;
+
+namespace Ghost.Editor.View.Controls;
+
+internal partial class ProjectBrowser
+{
+ [ContextMenuItem("project-browser", "Show in Explorer")]
+ private static void ShowInExplorer()
+ {
+ var path = LastFocused?.ViewModel.CurrentDirectoryPath;
+ if (!Directory.Exists(path))
+ {
+ return;
+ }
+
+ System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo()
+ {
+ FileName = path,
+ UseShellExecute = true,
+ Verb = "open"
+ });
+ }
+}
\ No newline at end of file
diff --git a/Ghost.Editor/View/Controls/ProjectBrowser.xaml b/Ghost.Editor/View/Controls/ProjectBrowser.xaml
index b4f72df..3517b90 100644
--- a/Ghost.Editor/View/Controls/ProjectBrowser.xaml
+++ b/Ghost.Editor/View/Controls/ProjectBrowser.xaml
@@ -1,12 +1,13 @@
-
+
-
+
-
+
@@ -199,11 +200,8 @@
-
-
-
-
+
diff --git a/Ghost.Editor/View/Controls/ProjectBrowser.xaml.cs b/Ghost.Editor/View/Controls/ProjectBrowser.xaml.cs
index 43cbc8b..db699ad 100644
--- a/Ghost.Editor/View/Controls/ProjectBrowser.xaml.cs
+++ b/Ghost.Editor/View/Controls/ProjectBrowser.xaml.cs
@@ -3,11 +3,18 @@ using Ghost.Editor.Models;
using Ghost.Editor.ViewModels.Controls;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Input;
-namespace Ghost.Editor.Controls;
+namespace Ghost.Editor.View.Controls;
internal sealed partial class ProjectBrowser : UserControl
{
+ public static ProjectBrowser? LastFocused
+ {
+ get;
+ private set;
+ }
+
private readonly IInspectorService _inspectorService;
private bool _isUpdatingSelection = false;
@@ -25,6 +32,18 @@ internal sealed partial class ProjectBrowser : UserControl
Loaded += ProjectBrowser_Loaded;
Unloaded += ProjectBrowser_Unloaded;
+
+ GettingFocus += ProjectBrowser_GettingFocus;
+ }
+
+ private void ProjectBrowser_GettingFocus(UIElement sender, GettingFocusEventArgs args)
+ {
+ if (_isUpdatingSelection)
+ {
+ return;
+ }
+
+ LastFocused = this;
}
private void ProjectBrowser_Loaded(object sender, RoutedEventArgs e)
diff --git a/Ghost.Editor/View/Pages/EngineEditor/HierarchyPage.xaml b/Ghost.Editor/View/Pages/EngineEditor/HierarchyPage.xaml
index 49c48b7..b7de8ef 100644
--- a/Ghost.Editor/View/Pages/EngineEditor/HierarchyPage.xaml
+++ b/Ghost.Editor/View/Pages/EngineEditor/HierarchyPage.xaml
@@ -4,7 +4,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:internal="using:Ghost.Editor.Controls.Internal"
+ xmlns:internal="using:Ghost.Editor.Controls"
xmlns:local="using:Ghost.Editor.View.Pages.EngineEditor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sg="using:Ghost.Editor.Core.SceneGraph"
diff --git a/Ghost.Editor/View/Pages/EngineEditor/HierarchyPage.xaml.cs b/Ghost.Editor/View/Pages/EngineEditor/HierarchyPage.xaml.cs
index 58ed979..e8bbf35 100644
--- a/Ghost.Editor/View/Pages/EngineEditor/HierarchyPage.xaml.cs
+++ b/Ghost.Editor/View/Pages/EngineEditor/HierarchyPage.xaml.cs
@@ -1,4 +1,4 @@
-using Ghost.Editor.Controls.Internal;
+using Ghost.Editor.Controls;
using Ghost.Editor.Core.Contracts;
using Ghost.Editor.Core.SceneGraph;
using Ghost.Editor.ViewModels.Pages.EngineEditor;
diff --git a/Ghost.Editor/View/Pages/EngineEditor/InspectorPage.xaml b/Ghost.Editor/View/Pages/EngineEditor/InspectorPage.xaml
index c8ec864..5aa89b3 100644
--- a/Ghost.Editor/View/Pages/EngineEditor/InspectorPage.xaml
+++ b/Ghost.Editor/View/Pages/EngineEditor/InspectorPage.xaml
@@ -4,7 +4,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:internal="using:Ghost.Editor.Controls.Internal"
+ xmlns:internal="using:Ghost.Editor.Controls"
xmlns:local="using:Ghost.Editor.View.Pages.EngineEditor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
diff --git a/Ghost.Editor/View/Pages/EngineEditor/InspectorPage.xaml.cs b/Ghost.Editor/View/Pages/EngineEditor/InspectorPage.xaml.cs
index 2e01e73..a78117a 100644
--- a/Ghost.Editor/View/Pages/EngineEditor/InspectorPage.xaml.cs
+++ b/Ghost.Editor/View/Pages/EngineEditor/InspectorPage.xaml.cs
@@ -1,4 +1,4 @@
-using Ghost.Editor.Controls.Internal;
+using Ghost.Editor.Controls;
using Ghost.Editor.ViewModels.Pages.EngineEditor;
namespace Ghost.Editor.View.Pages.EngineEditor;
diff --git a/Ghost.Editor/View/Pages/EngineEditor/ScenePage.xaml b/Ghost.Editor/View/Pages/EngineEditor/ScenePage.xaml
index c950e0b..2214cff 100644
--- a/Ghost.Editor/View/Pages/EngineEditor/ScenePage.xaml
+++ b/Ghost.Editor/View/Pages/EngineEditor/ScenePage.xaml
@@ -4,7 +4,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:internal="using:Ghost.Editor.Controls.Internal"
+ xmlns:internal="using:Ghost.Editor.Controls"
xmlns:local="using:Ghost.Editor.View.Pages.EngineEditor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
diff --git a/Ghost.Editor/View/Pages/EngineEditor/ScenePage.xaml.cs b/Ghost.Editor/View/Pages/EngineEditor/ScenePage.xaml.cs
index dcedd2a..66a0905 100644
--- a/Ghost.Editor/View/Pages/EngineEditor/ScenePage.xaml.cs
+++ b/Ghost.Editor/View/Pages/EngineEditor/ScenePage.xaml.cs
@@ -1,4 +1,4 @@
-using Ghost.Editor.Controls.Internal;
+using Ghost.Editor.Controls;
//using Ghost.Graphics.Contracts;
//using Microsoft.UI.Xaml;
//using Microsoft.UI.Xaml.Controls;
diff --git a/Ghost.Editor/View/Windows/EngineEditorWindow.xaml b/Ghost.Editor/View/Windows/EngineEditorWindow.xaml
index da09fca..cf318ec 100644
--- a/Ghost.Editor/View/Windows/EngineEditorWindow.xaml
+++ b/Ghost.Editor/View/Windows/EngineEditorWindow.xaml
@@ -4,12 +4,12 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:behaviors="using:CommunityToolkit.WinUI.Behaviors"
- xmlns:controls="using:CommunityToolkit.WinUI.Controls"
- xmlns:controls1="using:Ghost.Editor.Controls"
+ xmlns:controls="using:Ghost.Editor.View.Controls"
+ xmlns:ctc="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ee="using:Ghost.Editor.View.Pages.EngineEditor"
+ xmlns:ghost="using:Ghost.Editor.Controls"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
- xmlns:internal="using:Ghost.Editor.Controls.Internal"
xmlns:local="using:Ghost.Editor.View.Windows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:winex="using:WinUIEx"
@@ -43,25 +43,25 @@
Grid.Row="1"
Padding="4,0,4,4"
Background="{ThemeResource AcrylicBackgroundFillColorBaseBrush}">
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
@@ -78,52 +78,52 @@
-
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
-
-
+
+
-
-
+
+
-
+
@@ -131,8 +131,8 @@
-
-
+
+
diff --git a/Ghost.Editor/View/Windows/SplashWindow.xaml.cs b/Ghost.Editor/View/Windows/SplashWindow.xaml.cs
index 4471fca..77204be 100644
--- a/Ghost.Editor/View/Windows/SplashWindow.xaml.cs
+++ b/Ghost.Editor/View/Windows/SplashWindow.xaml.cs
@@ -1,7 +1,6 @@
using Ghost.Editor.Core;
using Microsoft.UI.Xaml;
using Windows.ApplicationModel;
-using Windows.Storage;
using WinUIEx;
namespace Ghost.Editor.View.Windows;
@@ -20,7 +19,7 @@ internal sealed partial class SplashWindow : WindowEx
IsMinimizable = false;
ExtendsContentIntoTitleBar = true;
- //this.CenterOnScreen(750, 400);
+ this.CenterOnScreen(750, 400);
}
private void MainGrid_Loaded(object sender, RoutedEventArgs e)
diff --git a/Ghost.Editor/ViewModels/Controls/ProjectBrowserViewModel.cs b/Ghost.Editor/ViewModels/Controls/ProjectBrowserViewModel.cs
index bba0aca..84a0215 100644
--- a/Ghost.Editor/ViewModels/Controls/ProjectBrowserViewModel.cs
+++ b/Ghost.Editor/ViewModels/Controls/ProjectBrowserViewModel.cs
@@ -35,6 +35,11 @@ internal partial class ProjectBrowserViewModel : ObservableObject
}
}
+ public string CurrentDirectoryPath
+ {
+ get; set;
+ } = string.Empty;
+
public ProjectBrowserViewModel(IInspectorService inspectorService)
{
_inspectorService = inspectorService;
@@ -84,6 +89,8 @@ internal partial class ProjectBrowserViewModel : ObservableObject
var fileItem = new ExplorerItem(Path.GetFileName(file), file, false);
Files.Add(fileItem);
}
+
+ CurrentDirectoryPath = path;
}
internal (ExplorerItem?, int) OpenSelected()