| 464 | } |
| 465 | |
| 466 | void SFindInFlow::InitiateSearch() |
| 467 | { |
| 468 | FFlowEditorModule* FlowEditorModule = &FModuleManager::LoadModuleChecked<FFlowEditorModule>("FlowEditor"); |
| 469 | if (ensure(FlowEditorModule)) |
| 470 | { |
| 471 | FlowEditorModule->RegisterForAssetChanges(); |
| 472 | } |
| 473 | |
| 474 | SearchResults.Reset(); |
| 475 | |
| 476 | HighlightText = FText::FromString(SearchValue); |
| 477 | TreeView->RequestTreeRefresh(); |
| 478 | |
| 479 | if (SearchValue.IsEmpty()) |
| 480 | { |
| 481 | return; |
| 482 | } |
| 483 | |
| 484 | TArray<FString> Tokens; |
| 485 | SearchValue.ParseIntoArray(Tokens, TEXT(" "), true); |
| 486 | for (FString& Token : Tokens) |
| 487 | { |
| 488 | Token = Token.ToUpper(); |
| 489 | } |
| 490 | |
| 491 | TSharedPtr<FFlowAssetEditor> Editor = FlowAssetEditorPtr.Pin(); |
| 492 | if (!Editor.IsValid()) |
| 493 | { |
| 494 | return; |
| 495 | } |
| 496 | |
| 497 | UFlowAsset* CurrentAsset = Editor->GetFlowAsset(); |
| 498 | if (!CurrentAsset || !CurrentAsset->GetGraph()) |
| 499 | { |
| 500 | return; |
| 501 | } |
| 502 | |
| 503 | constexpr int32 Depth = 0; |
| 504 | switch (SearchScope) |
| 505 | { |
| 506 | case EFlowSearchScope::ThisAssetOnly: |
| 507 | { |
| 508 | FSearchResult AssetRoot = MakeShareable(new FFindInFlowResult(CurrentAsset->GetName(), CurrentAsset)); |
| 509 | ProcessAsset(CurrentAsset, AssetRoot, Tokens, Depth); |
| 510 | |
| 511 | if (AssetRoot->Children.Num() > 0) |
| 512 | { |
| 513 | SearchResults.ItemsFound.Add(AssetRoot); |
| 514 | |
| 515 | // Auto-expand the current asset's results |
| 516 | TreeView->SetItemExpansion(AssetRoot, true); |
| 517 | } |
| 518 | } |
| 519 | break; |
| 520 | |
| 521 | case EFlowSearchScope::AllOfThisType: |
| 522 | case EFlowSearchScope::AllFlowAssets: |
| 523 | { |
nothing calls this directly
no test coverage detected