Commit 44de5429 authored by Johannes Braun's avatar Johannes Braun
Browse files

Fix search selectables in Blueprints

parent 53b80c20
......@@ -1186,11 +1186,11 @@ Node* Blueprints::drawSearchList()
if(matches(name))
{
bool selected = i == m_currentSelection;
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 1, 1, 0.5f));
bool sel = ImGui::Selectable((std::string(prefix) + " >").c_str(), &selected);
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 1, 1, 0.8f));
bool sel = ImGui::Selectable((std::string(prefix) + " > " + name).c_str(), selected);
ImGui::PopStyleColor();
ImGui::SameLine();
if(ImGui::Selectable((name).c_str(), &selected) || sel)
//ImGui::SameLine();
if(/*ImGui::Selectable((name).c_str(), selected) ||*/ sel)
{
node = createNode((*construct.constructor)());
ImGui::CloseCurrentPopup();
......@@ -1229,11 +1229,11 @@ Node* Blueprints::drawSearchList()
if(matches("Parameter"))
{
bool selected = i == m_currentSelection;
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 1, 1, 0.5f));
bool sel = ImGui::Selectable("Math >", &selected);
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1, 1, 1, 0.8f));
bool sel = ImGui::Selectable("Math > Parameter", selected);
ImGui::PopStyleColor();
ImGui::SameLine();
if(ImGui::Selectable("Parameter", &selected) || sel)
if(/*ImGui::Selectable("Parameter", selected) || */sel)
{
node = createNode(std::make_shared<Param>("Parameter", float(1)));
ImGui::CloseCurrentPopup();
......@@ -1325,59 +1325,6 @@ void Blueprints::drawMenuItems(const dino::Renderer& renderer)
"error");
}
}
// if(ImGui::MenuItem("Open"))
//{
// constexpr int response_yes = 1;
// const auto response =
// tinyfd_messageBox("Load Distance Field",
// "The currently opened distance field will be replaced by
// " "the loaded one. Do you want to open anyways?",
// "yesno",
// "question",
// 1);
// if(response == response_yes)
// {
// // open field and load into this editor.
// const char* fileEnding = "*.json";
// const char* filePath = tinyfd_openFileDialog(
// "Load", nullptr, 1, &fileEnding, "JSON-Files", false);
// if(filePath)
// {
// const std::filesystem::path path = filePath;
// std::ifstream ifs(filePath);
// nlohmann::json j;
// try
// {
// j << ifs;
// const auto bf = dino::Function::deserialize(j);
// m_links.clear();
// m_nodes.clear();
// m_nodes.reserve(512);
// shutdown();
// init();
// if(const auto op = bf->as<dino::Operator>(); op)
// {
// load(op);
// }
// else if(const auto pr = bf->as<dino::Primitive>(); pr)
// {
// load(pr);
// }
// }
// catch(const nlohmann::json::exception& e)
// {
// tinyfd_notifyPopup(
// "Load Distance Field",
// "Selected file cannot be parsed as a valid json object.",
// "error");
// }
// }
// }
//}
ImGui::Separator();
if(ImGui::MenuItem("Close"))
{
}
ImGui::EndMenu();
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment