diff --git a/.gitignore b/.gitignore index b48879ed..4412f477 100644 --- a/.gitignore +++ b/.gitignore @@ -29,11 +29,9 @@ vs-project/glfw/src/Release/glfw3.lib vs-project/bspguy.dir/Debug/vc143.idb vs-project/glfw/src/Debug/glfw3.lib vs-project/glfw/src/Release/glfw3.lib -vs-project/bspguy.dir/Debug/bsp.obj.enc -vs-project/bspguy.dir/Debug/bsprenderer.obj.enc -vs-project/bspguy.dir/Debug/renderer.obj.enc vs-project/bspguy.dir/Debug/bspguy.vcxproj.FileListAbsolute.txt vs-project/bspguy.dir/Release/bspguy.vcxproj.FileListAbsolute.txt vs-project/glfw/src/glfw.dir/Debug/glfw.vcxproj.FileListAbsolute.txt vs-project/glfw/src/glfw.dir/Release/glfw.vcxproj.FileListAbsolute.txt vs-project/Release/log.txt +*.enc diff --git a/imgui/misc/cpp/imgui_stdlib.cpp b/imgui/misc/cpp/imgui_stdlib.cpp index 3b4ca5fc..c1a3c629 100644 --- a/imgui/misc/cpp/imgui_stdlib.cpp +++ b/imgui/misc/cpp/imgui_stdlib.cpp @@ -28,6 +28,10 @@ static int InputTextCallback(ImGuiInputTextCallbackData* data) str->resize(data->BufTextLen); data->Buf = (char*)str->c_str(); } + else + { + str->clear(); + } } else if (user_data->ChainCallback) { diff --git a/src/editor/Gui.cpp b/src/editor/Gui.cpp index 673b2925..9987d31d 100644 --- a/src/editor/Gui.cpp +++ b/src/editor/Gui.cpp @@ -3914,7 +3914,7 @@ void Gui::drawImportMapWidget() { Bsp* bspModel = new Bsp(mapPath); Bsp* map = g_app->getSelectedMap(); - + int FaceCount = map->faceCount, NodeCount = map->nodeCount, ClipNodeCount = map->clipnodeCount; std::vector newPlanes; @@ -3927,7 +3927,7 @@ void Gui::drawImportMapWidget() std::vector newNodes; std::vector newClipnodes; - STRUCTREMAP * remap = new STRUCTREMAP(); + STRUCTREMAP* remap = new STRUCTREMAP(); bspModel->copy_bsp_model(0, map, *remap, newPlanes, newVerts, newEdges, newSurfedges, newTexinfo, newFaces, newLightmaps, newNodes, newClipnodes); @@ -4281,9 +4281,9 @@ void Gui::drawEntityReport() else { ImGui::BeginGroup(); - const int MAX_FILTERS = 1; - static std::string keyFilter[MAX_FILTERS]; - static std::string valueFilter[MAX_FILTERS]; + static int MAX_FILTERS = 1; + static std::vector keyFilter = std::vector(); + static std::vector valueFilter = std::vector(); static int lastSelect = -1; static std::string classFilter = "(none)"; static std::string flagsFilter = "(none)"; @@ -4299,6 +4299,10 @@ void Gui::drawEntityReport() if (filterNeeded) { visibleEnts.clear(); + while (keyFilter.size() < MAX_FILTERS) + keyFilter.push_back(std::string()); + while (valueFilter.size() < MAX_FILTERS) + valueFilter.push_back(std::string()); for (int i = 1; i < map->ents.size(); i++) { @@ -4366,7 +4370,7 @@ void Gui::drawEntityReport() } } } - else if (valueFilter[k][0] != '\0') + else if(valueFilter[k].size()) { std::string searchValue = trimSpaces(toLowerCase(valueFilter[k])); bool foundMatch = false; @@ -4578,13 +4582,17 @@ void Gui::drawEntityReport() ImGui::Dummy(ImVec2(0, 8)); ImGui::Text("Keyvalue Filter"); - ImGui::SameLine(); ImGuiStyle& style = ImGui::GetStyle(); float padding = style.WindowPadding.x * 2 + style.FramePadding.x * 2; - float inputWidth = (ImGui::GetWindowWidth() - (padding + style.ScrollbarSize)) * 0.5f; + float inputWidth = (ImGui::GetWindowWidth() - (padding + style.ScrollbarSize)) * 0.4f; inputWidth -= smallFont->CalcTextSizeA(fontSize, FLT_MAX, FLT_MAX, " = ").x; + while (keyFilter.size() < MAX_FILTERS) + keyFilter.push_back(std::string()); + while (valueFilter.size() < MAX_FILTERS) + valueFilter.push_back(std::string()); + for (int i = 0; i < MAX_FILTERS; i++) { ImGui::SetNextItemWidth(inputWidth); @@ -4592,13 +4600,35 @@ void Gui::drawEntityReport() { filterNeeded = true; } + ImGui::SameLine(); ImGui::Text(" = "); ImGui::SameLine(); ImGui::SetNextItemWidth(inputWidth); + if (ImGui::InputText(("##Value" + std::to_string(i)).c_str(), &valueFilter[i])) { filterNeeded = true; } + + if (i == 0) + { + ImGui::SameLine(); + if (ImGui::Button("Add", ImVec2(100, 0))) + { + MAX_FILTERS++; + break; + } + } + if (i == 1) + { + ImGui::SameLine(); + if (ImGui::Button("Del", ImVec2(100, 0))) + { + if (MAX_FILTERS > 1) + MAX_FILTERS--; + break; + } + } } if (ImGui::Checkbox("Partial Matching", &partialMatches))