Changed the project structure to reflect a shift from `Ghost.App` to `Ghost.Editor`, updating namespaces and class names throughout. Changed the application class in `App.xaml` and `App.xaml.cs` from `GhostApplication` to `EditorApplication`. Changed several service interfaces to reside under `Ghost.Editor.Services.Contracts`, including `IInspectorService`, `INotificationService`, and `IProgressService`. Added `InspectorView` and `InspectorViewModel` classes to manage inspector functionality. Added `NavigationTabView` and `NavigationTabPage` classes to facilitate navigation within the editor. Enhanced `WorldNode` and `EntityNode` classes to support scene graph functionality, including serialization and entity management. Updated the project file `Ghost.Editor.csproj` to reflect the new structure and removed old references. Modified the solution file `GhostEngine.sln` to remove references to `Ghost.App` and include `Ghost.Editor`. Updated unit tests to align with the new namespaces and project structure.
86 lines
2.1 KiB
C#
86 lines
2.1 KiB
C#
using Ghost.Editor.Contracts;
|
|
using Ghost.Editor.Controls.Internal;
|
|
using Ghost.Editor.Core.SceneGraph;
|
|
using Ghost.Editor.Services.Contracts;
|
|
using Ghost.Editor.ViewModels.Pages.EngineEditor;
|
|
using Microsoft.UI.Xaml;
|
|
using Microsoft.UI.Xaml.Controls;
|
|
|
|
namespace Ghost.Editor.View.Pages.EngineEditor;
|
|
|
|
internal sealed partial class HierarchyPage : NavigationTabPage
|
|
{
|
|
private readonly IInspectorService _inspectorService;
|
|
|
|
public HierarchyViewModel ViewModel
|
|
{
|
|
get;
|
|
}
|
|
|
|
public HierarchyPage()
|
|
{
|
|
_inspectorService = EditorApplication.GetService<IInspectorService>();
|
|
ViewModel = EditorApplication.GetService<HierarchyViewModel>();
|
|
|
|
InitializeComponent();
|
|
|
|
Header = "Hierarchy";
|
|
IconSource = new FontIconSource
|
|
{
|
|
Glyph = "\uE8A4"
|
|
};
|
|
}
|
|
|
|
public override void OnNavigatedTo(object? parameter)
|
|
{
|
|
ViewModel.OnNavigatedTo(parameter);
|
|
}
|
|
|
|
public override void OnNavigatedFrom()
|
|
{
|
|
ViewModel.OnNavigatedFrom();
|
|
}
|
|
|
|
private void TreeView_SelectionChanged(TreeView sender, TreeViewSelectionChangedEventArgs args)
|
|
{
|
|
if (args.AddedItems.Count > 0 && args.AddedItems[0] is IInspectable inspectable)
|
|
{
|
|
_inspectorService.SelectedInspectable = inspectable;
|
|
}
|
|
else
|
|
{
|
|
_inspectorService.SelectedInspectable = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
internal partial class HierarchyTemplateSector : DataTemplateSelector
|
|
{
|
|
public DataTemplate? WorldTemplate
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public DataTemplate? EntityTemplate
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
protected override DataTemplate SelectTemplateCore(object item)
|
|
{
|
|
if (WorldTemplate == null || EntityTemplate == null)
|
|
{
|
|
return base.SelectTemplateCore(item);
|
|
}
|
|
|
|
var node = (SceneGraphNode)item;
|
|
return node.NodeType switch
|
|
{
|
|
SceneGraphNodeType.Scene => WorldTemplate,
|
|
SceneGraphNodeType.Entity => EntityTemplate,
|
|
_ => base.SelectTemplateCore(item)
|
|
};
|
|
}
|
|
} |