mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-21 20:08:40 +03:00
upgraded imgui - Better scene hierarchy UI
This commit is contained in:
@@ -1644,21 +1644,21 @@ namespace Nuake {
|
||||
|
||||
// Draw a tree of entities.
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(26.f / 255.0f, 26.f / 255.0f, 26.f / 255.0f, 1));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, { 4, 4 });
|
||||
if (ImGui::BeginChild("Scene tree", ImGui::GetContentRegionAvail(), false))
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 8, 4 });
|
||||
if (ImGui::BeginTable("entity_table", 3, ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_NoPadInnerX | ImGuiTableFlags_NoPadOuterX))
|
||||
if (ImGui::BeginTable("entity_table", 3, ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_SizingStretchProp))
|
||||
{
|
||||
ImGui::TableSetupColumn("Label", ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_WidthStretch);
|
||||
ImGui::TableSetupColumn(" Label", ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_WidthStretch);
|
||||
ImGui::TableSetupColumn("Type", ImGuiTableColumnFlags_IndentDisable | ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Visibility", ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_IndentDisable | ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableSetupColumn("Visibility ", ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_IndentDisable | ImGuiTableColumnFlags_WidthFixed);
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2(0, 0));
|
||||
std::vector<Entity> entities = scene->GetAllEntities();
|
||||
for (Entity e : entities)
|
||||
{
|
||||
ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanAvailWidth;
|
||||
ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanFullWidth;
|
||||
std::string name = e.GetComponent<NameComponent>().Name;
|
||||
// If selected add selected flag.
|
||||
if (Selection.Type == EditorSelectionType::Entity && Selection.Entity == e)
|
||||
@@ -1684,12 +1684,11 @@ namespace Nuake {
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
ImGui::EndTable();
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
if (ImGui::BeginDragDropTarget()) // Drag n drop new prefab file into scene tree
|
||||
{
|
||||
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Prefab"))
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include <src/Scene/Entities/Entity.h>
|
||||
|
||||
#include "src/Vendors/imgui/imgui.h"
|
||||
|
||||
#include <src/Vendors/imgui/ImGuizmo.h>
|
||||
#include "src/Core/FileSystem.h"
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace Nuake
|
||||
ImU32 rectColor = IM_COL32(255, 255, 255, 16);
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(prevScreenPos + ImVec2(0, 100) - startOffset, prevScreenPos + ImVec2(100, 150) + offsetEnd, rectColor, 1.0f);
|
||||
std::string visibleName = directory->Name;
|
||||
const uint32_t MAX_CHAR_NAME = 35;
|
||||
const uint32_t MAX_CHAR_NAME = 34;
|
||||
if (directory->Name.size() > MAX_CHAR_NAME)
|
||||
{
|
||||
visibleName = std::string(directory->Name.begin(), directory->Name.begin() + MAX_CHAR_NAME - 3) + "...";
|
||||
@@ -857,13 +857,13 @@ namespace Nuake
|
||||
if (ImGui::BeginTable("ssss", amount))
|
||||
{
|
||||
// Button to go up a level.
|
||||
if (m_CurrentDirectory && m_CurrentDirectory != FileSystem::RootDirectory && m_CurrentDirectory->Parent)
|
||||
{
|
||||
ImGui::TableNextColumn();
|
||||
if (ImGui::Button("..", buttonSize))
|
||||
m_CurrentDirectory = m_CurrentDirectory->Parent;
|
||||
i++;
|
||||
}
|
||||
//if (m_CurrentDirectory && m_CurrentDirectory != FileSystem::RootDirectory && m_CurrentDirectory->Parent)
|
||||
//{
|
||||
// ImGui::TableNextColumn();
|
||||
// if (ImGui::Button("..", buttonSize))
|
||||
// m_CurrentDirectory = m_CurrentDirectory->Parent;
|
||||
// i++;
|
||||
//}
|
||||
|
||||
if (m_CurrentDirectory && m_CurrentDirectory->Directories.size() > 0)
|
||||
{
|
||||
@@ -875,7 +875,7 @@ namespace Nuake
|
||||
ImGui::TableNextColumn();
|
||||
else
|
||||
ImGui::TableNextRow();
|
||||
|
||||
|
||||
DrawDirectory(d, i);
|
||||
i++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user