M3: Hierarchy panel — click a GameObject to select it
HierarchyPanel walks IWorld.Roots/GameObject.Children recursively as ImGui tree nodes, clicking one sets EditorState.Selected — the shared selection the not-yet-built Inspector panel will read from the same instance. PushID(go.GetHashCode()) scopes each node's ID by object identity rather than name, since nothing stops two sibling GameObjects sharing a Name and ImGui's default label-based IDs would otherwise merge their open/selected state. Also gives samples/WindowDemo/scene.json a child GameObject (offset, half-scale, parented under Quad) — the existing scene only had one root, nothing to show a tree with. Verified by screenshot: both quads render at their correct composed WorldMatrix (the child visibly smaller and offset, confirming parent/child composition is still correct through this change), and Hierarchy lists "Quad" as a collapsible node. Full suite still green: 65 tests. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N1qPfzq8TDCUMFMV3UwV5N
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
using Engine.Kernel.World;
|
||||
|
||||
namespace Engine.Editor;
|
||||
|
||||
/// <summary>
|
||||
/// Shared, per-session editor state — currently just which GameObject the
|
||||
/// Hierarchy panel last clicked, so the Inspector panel (built against this
|
||||
/// same instance) knows what to show. One instance per EditorPlugin, not
|
||||
/// static: reloading engine.editor should start with nothing selected, not
|
||||
/// hold a reference to a GameObject that may not even exist anymore.
|
||||
/// </summary>
|
||||
internal sealed class EditorState
|
||||
{
|
||||
public GameObject? Selected { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user