| 321 | |
| 322 | bool FGraphActionMenu::Draw(CEdNodeGraph* Graph) |
| 323 | { |
| 324 | if (Graph == nullptr) |
| 325 | { |
| 326 | return false; |
| 327 | } |
| 328 | |
| 329 | if (bActionsDirty) |
| 330 | { |
| 331 | RebuildActions(Graph); |
| 332 | Rescore(); |
| 333 | } |
| 334 | |
| 335 | constexpr ImVec2 PopupSize(360, 460); |
| 336 | constexpr ImVec2 SearchBarPadding(10, 8); |
| 337 | constexpr float ItemHeight = 26.0f; |
| 338 | constexpr float HeaderAreaHeight = 48.0f; |
| 339 | constexpr float FooterAreaHeight = 26.0f; |
| 340 | |
| 341 | const ImVec4 AccentColor(0.92f, 0.55f, 0.23f, 1.0f); |
| 342 | const ImVec4 MatchColor (1.0f, 0.85f, 0.35f, 1.0f); |
| 343 | const ImVec4 CategoryColor(0.55f, 0.55f, 0.58f, 1.0f); |
| 344 | const ImVec4 SelectedBg (AccentColor.x * 0.35f, AccentColor.y * 0.35f, AccentColor.z * 0.35f, 0.75f); |
| 345 | |
| 346 | ImGui::SetNextWindowSize(PopupSize, ImGuiCond_Always); |
| 347 | |
| 348 | ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0)); |
| 349 | ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 1)); |
| 350 | |
| 351 | ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, SearchBarPadding); |
| 352 | ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.12f, 0.12f, 0.14f, 1.0f)); |
| 353 | ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.14f, 0.14f, 0.16f, 1.0f)); |
| 354 | ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(0.16f, 0.16f, 0.18f, 1.0f)); |
| 355 | |
| 356 | ImGui::SetCursorPos(ImVec2(10, 10)); |
| 357 | ImGui::PushItemWidth(PopupSize.x - 20); |
| 358 | |
| 359 | if (bFocusInput) |
| 360 | { |
| 361 | ImGui::SetKeyboardFocusHere(); |
| 362 | bFocusInput = false; |
| 363 | } |
| 364 | |
| 365 | const bool bEnterCommitted = ImGui::InputTextWithHint( |
| 366 | "##GraphActionSearch", |
| 367 | "Search nodes...", |
| 368 | QueryBuffer, |
| 369 | IM_ARRAYSIZE(QueryBuffer), |
| 370 | ImGuiInputTextFlags_EnterReturnsTrue); |
| 371 | |
| 372 | const bool bQueryChanged = CachedQueryForScore != FString(QueryBuffer); |
| 373 | |
| 374 | ImGui::PopItemWidth(); |
| 375 | ImGui::PopStyleColor(3); |
| 376 | ImGui::PopStyleVar(); |
| 377 | |
| 378 | if (bQueryChanged) |
| 379 | { |
| 380 | Rescore(); |
no test coverage detected