12#include <imgui_internal.h>
18 Scene(Scene), OnObjectSelect(OnObjectSelect) {}
22 if (Scene ==
nullptr)
return;
24 ImGui::Begin(
"Scene Hierarchy");
25 ImGuiTreeNodeFlags node_flags = ImGuiTreeNodeFlags_OpenOnArrow
26 | ImGuiTreeNodeFlags_OpenOnDoubleClick
27 | ImGuiTreeNodeFlags_SpanAvailWidth;
28 for (
auto &&[entity, tag] : Scene->Registry.view<
name_component>().each())
30 if (ImGui::Selectable(tag.Name.c_str(), entity == SelectedObject, ImGuiSelectableFlags_None,
31 { entity == SelectedObject ? ImGui::GetWindowWidth() * 0.6f - 10 : 0, 20 }))
34 OnObjectSelect(SelectedObject);
37 if (entity == SelectedObject)
39 ImGui::SameLine(ImGui::GetWindowWidth() * 0.6f + 5);
40 if (ImGui::Button(
"Delete##delete_object", { ImGui::GetWindowWidth() * 0.4f - 10, 0 }))
45 ImGui::SetNextItemWidth(ImGui::GetWindowWidth() * 0.6f - 5);
46 ImGui::InputText(
"##adding_object_name", ObjectCreationNameTextBuffer, 128);
47 ImGui::SameLine(ImGui::GetWindowWidth() * 0.6f + 5);
48 if (ImGui::Button(
"Add new object", { ImGui::GetWindowWidth() * 0.4f - 10, 0 }))
49 Scene->
CreateObject(std::string(ObjectCreationNameTextBuffer)), memset(ObjectCreationNameTextBuffer, 0, 128);
scene_hierarchy_window(scene *Scene, const std::function< void(scene_object)> &OnObjectSelect)
scene_object CreateObject(const std::string &Name="")
void RemoveObject(scene_object &Object)
Application scene objects system components include module.
Sculpto library prehompiled header. Defines common definitions, includes commonly used modules.