diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2024-01-12 10:02:44 -0500 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2024-01-12 10:02:44 -0500 |
| commit | 4e0af4246f1b4139f4f6b3318564dea727917645 (patch) | |
| tree | fccccff30096b861c9135a1d56480ec6537fda5e /editor | |
| parent | 843a55e01a444b51e5f9c57e67b76e14028b22fa (diff) | |
editor list EntityTypes
Diffstat (limited to 'editor')
| -rw-r--r-- | editor/editor.cpp | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp index 33f1c49..a081fb0 100644 --- a/editor/editor.cpp +++ b/editor/editor.cpp @@ -274,7 +274,6 @@ void PkeEditor_Tick(double delta) { } while (entityInstancesToCreate.Count() > 0) { EntityType *et = entityInstancesToCreate.Pop(); - // TODO needs to be more elegant if (et->createInstanceCallback.func) { reinterpret_cast<void(*)()>(et->createInstanceCallback.func)(); } else { @@ -623,6 +622,59 @@ void RecordImGuiEditorWrapper() { ImGui::EndMainMenuBar(); } +void RecordImGuiEntityTypes() { + if (!ImGui::Begin("EntityTypes")) { + ImGui::End(); + return; + } + + static ImGuiTableFlags tableFlags{ + ImGuiTableFlags_Borders | + ImGuiTableFlags_RowBg + }; + if (ImGui::BeginTable("EntityTypes", 5, tableFlags)) { + ImGui::TableSetupColumn("EntityHandle"); + ImGui::TableSetupColumn("ModelAssetKey"); + ImGui::TableSetupColumn("EntityTypeCode"); + ImGui::TableSetupColumn("Details"); + ImGui::TableSetupColumn("Instances"); + ImGui::TableHeadersRow(); + + PkeHandleBucketIndex_T cameraBucketCount = EntityType_GetBucketCount(); + for (PkeHandleBucketIndex_T b = 0; b < cameraBucketCount; ++b) { + PkeHandleItemIndex_T count; + auto *entityTypes = EntityType_GetEntityTypes(b, count); + ImGui::PushID(b); + for (PkeHandleItemIndex_T i = 0; i < count; ++i) { + const auto &et = entityTypes[i]; + if (et.handle == EntityHandle_MAX) + continue; + ImGui::PushID(i); + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(0); + ImGui::Text("0x%016lX", et.handle.hash); + ImGui::TableSetColumnIndex(1); + ImGui::Text("%*.*s", 0, (int)AssetKeyLength, et.modelAssetKey); + ImGui::TableSetColumnIndex(2); + ImGui::Text("%s", et.entityTypeCode); + ImGui::TableSetColumnIndex(3); + ImGui::Text("count: %li", et.detailsCount); + ImGui::TableSetColumnIndex(4); + if (ImGui::Button("Add")) { + entityInstancesToCreate.Push(const_cast<EntityType *>(&et)); + } + ImGui::SameLine(); + ImGui::Text("count: %u", et.details[0].grBinds->instanceCounter); + ImGui::PopID(); + } + ImGui::PopID(); + } + ImGui::EndTable(); + + } + ImGui::End(); +} + void RecordImGuiCameras() { if (!ImGui::Begin("Cameras")) { ImGui::End(); @@ -999,6 +1051,7 @@ void RecordImGui_CompInstPos(bool readonly, CompInstance *component) { rot.getEulerZYX(eul.z, eul.y, eul.x); eul = glm::degrees(eul); + ImGui::Text("InstanceHandle: 0x%016lX", component->instanceHandle.hash); changed = ImGui::InputScalar("Instance Index", ImGuiDataType_U64, &component->index, nullptr, nullptr, nullptr, ImGuiInputTextFlags_ReadOnly) || changed; changed = ImGui::InputScalarN("pos", ImGuiDataType_Float, &pos, 3, nullptr, nullptr, nullptr, inputTextFlags) || changed; changed = ImGui::InputScalarN("rot (eul)", ImGuiDataType_Float, &eul, 3, nullptr, nullptr, nullptr, inputTextFlags) || changed; @@ -1223,6 +1276,7 @@ void PkeEditor_RecordImGui() { RecordImGuiUBO(); RecordImGuiCameras(); RecordImGuiLevels(); + RecordImGuiEntityTypes(); Game_RecordImGui(); } } |
