Added the `HierarchyEditor` and `LocalToWorldEditor` classes to implement custom component editing functionality. Added the `Vector3Field` control for 3D vector manipulation and its corresponding XAML definition. Added the `ComponentDataView` and `ComponentObject` classes to manage component data display and access. Added the `CustomEditorAttribute` to mark classes as custom editors for specific components. Changed the `IInspectable` interface to use properties for `Icon`, `HeaderContent`, and `InspectorContent`. Changed the `PropertyField` class to enhance UI control binding capabilities. Changed the `EditorWorldManager` to improve world data loading and deserialization processes. Changed the `EntityNode` and `WorldNode` classes to update entity construction and component querying. Changed the `StaticResource` class to include new binding flags for component properties. Changed the `InspectorService` to remove old contract references and adopt new interfaces. Changed the `QueryEnumerable` and related files to update generic constraints for improved type safety. Changed the `QueryItem` class to reflect new generic constraints and enhance deconstruction. Changed the `World.Query` methods to utilize the updated generic constraints. Updated the `SerializationTest` to align with new entity creation and management practices.
86 lines
2.1 KiB
C#
86 lines
2.1 KiB
C#
using Ghost.Editor.Controls.Internal;
|
|
using Ghost.Editor.Core.Inspector;
|
|
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)
|
|
};
|
|
}
|
|
} |