adding and integrating ImGuizmo
This commit is contained in:
@@ -1,20 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include <sophia/entity.hpp>
|
||||
#include <array>
|
||||
#include <sophia/frame_info.hpp>
|
||||
#include <sophia/scene.hpp>
|
||||
#include <sophia/handles.hpp>
|
||||
#include <sophia/ui/panel.hpp>
|
||||
|
||||
#include "../editor_context.hpp"
|
||||
|
||||
class SceneHierarchyPanel : public sophia::Panel {
|
||||
public:
|
||||
SceneHierarchyPanel(sophia::Scene& scene, sophia::Entity& selected)
|
||||
// `cubeMesh` is what "+ Cube" gives new entities.
|
||||
SceneHierarchyPanel(EditorContext& context, sophia::MeshHandle cubeMesh)
|
||||
: Panel{{.name = "Scene Hierarchy", .locked = true}},
|
||||
scene{scene},
|
||||
selected{selected} {}
|
||||
context{context},
|
||||
cubeMesh{cubeMesh} {}
|
||||
|
||||
void onUpdate(const sophia::FrameInfo& frameInfo) override;
|
||||
|
||||
private:
|
||||
sophia::Scene& scene;
|
||||
sophia::Entity& selected;
|
||||
// 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<char, 128> renameBuffer{};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user