diff options
Diffstat (limited to 'editor/editor.cpp')
| -rw-r--r-- | editor/editor.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp index 5016070..db97802 100644 --- a/editor/editor.cpp +++ b/editor/editor.cpp @@ -696,6 +696,23 @@ void RecordImGuiUBO() { ImGui::End(); } +bool RecordImGui_CallbackSelectModal(long &selectedIndex) { + bool returnValue = false; + if (ImGui::BeginPopupModal("CallbackSelect", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { + long count = 0; + auto *signatures = PkePlugin_GetSortedSignatures(count); + for (long i = 0; i < count; ++i) { + const CallbackSignature &sig = signatures[i]; + if (ImGui::Selectable(sig, selectedIndex == i)) { + returnValue = true; + selectedIndex = i; + } + } + ImGui::EndPopup(); + } + return returnValue; +} + void RecordImGuiModalCreateEntityType() { if (ImGui::BeginPopupModal("CreateEntityType", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) { static char modelsDir[64]; @@ -835,6 +852,24 @@ void RecordImGui_CompGrBinds(bool readonly, CompGrBinds *component) { ImGui::InputScalar("InstanceBufferMaxCount", ImGuiDataType_U32, &component->instanceBufferMaxCount, nullptr, nullptr, nullptr, ImGuiInputTextFlags_ReadOnly); ImGui::InputScalar("Instance Count", ImGuiDataType_U32, &component->instanceCounter, nullptr, nullptr, nullptr, ImGuiInputTextFlags_ReadOnly); + static long index = -1; + if (ImGui::Button("Clear")) { + index = -1; + component->collisionCallback.name[0] = '\0'; + } + ImGui::SameLine(); + if (ImGui::Button("Change")) { + index = -1; + ImGui::OpenPopup("CallbackSelect"); + } + ImGui::SameLine(); + ImGui::Text("Collision Callback: '%s'", component->collisionCallback.name); + if (RecordImGui_CallbackSelectModal(index)) { + long x = 0; + memcpy(component->collisionCallback.name, PkePlugin_GetSortedSignatures(x)[index], 16); + PkePlugin_SetSignatureFunc(&component->collisionCallback); + } + ImGui::Spacing(); } @@ -868,6 +903,24 @@ void RecordImGui_CompInstPos(bool readonly, CompInstance *component) { changed = ImGui::InputScalar("Phys - Collision Layer", ImGuiDataType_U16, &component->physicsLayer, nullptr, nullptr, nullptr, inputTextFlags) || changed; changed = ImGui::InputScalar("Phys - Collision Mask", ImGuiDataType_U16, &component->physicsMask, nullptr, nullptr, nullptr, inputTextFlags) || changed; + static long index = -1; + if (ImGui::Button("Clear")) { + index = -1; + component->collisionCallback.name[0] = '\0'; + } + ImGui::SameLine(); + if (ImGui::Button("Change")) { + index = -1; + ImGui::OpenPopup("CallbackSelect"); + } + ImGui::SameLine(); + ImGui::Text("Collision Callback: '%s'", component->collisionCallback.name); + if (RecordImGui_CallbackSelectModal(index)) { + long x = 0; + memcpy(component->collisionCallback.name, PkePlugin_GetSortedSignatures(x)[index], 16); + PkePlugin_SetSignatureFunc(&component->collisionCallback); + } + ImGui::InputScalar("Phys - Rigid Body", ImGuiDataType_U64, &component->bt.rigidBody, nullptr, nullptr, "0x%016lX", ImGuiInputTextFlags_ReadOnly); ImGui::InputScalar("Phys - Motion State", ImGuiDataType_U64, &component->bt.motionState, nullptr, nullptr, "0x%016lX", ImGuiInputTextFlags_ReadOnly); |
