#pragma once #include #include #include #include #include "../editor_context.hpp" class SceneHierarchyPanel : public sophia::Panel { public: // `cubeMesh` is what "+ Cube" gives new entities. SceneHierarchyPanel(EditorContext& context, sophia::MeshHandle cubeMesh) : Panel{{.name = "Scene Hierarchy", .locked = true}}, context{context}, cubeMesh{cubeMesh} {} void onUpdate(const sophia::FrameInfo& frameInfo) override; private: // Switches between open scenes, renames the active one, and creates new // ones. void drawSceneSelector(); // Replaces the selector with a text field editing the active scene's name. void drawSceneRename(); EditorContext& context; sophia::MeshHandle cubeMesh; // For naming new scenes "Untitled 1", "Untitled 2", ... int untitledSceneCount = 0; // Set while the scene selector is a text field for renaming. bool renamingScene = false; // Frames the text field has left to become active after renaming starts; // focus can take a frame to land. If it never does, renaming ends. int renameFocusFrames = 0; std::array renameBuffer{}; };