/** * Helper method to close a specified blueprint (if it is open in the blueprint-editor). * * @param BlueprintObj The blueprint you want the editor closed for. */ static void CloseBlueprint(UBlueprint* const BlueprintObj) { IAssetEditorInstance* EditorInst = FAssetEditorManager::Get().FindEditorForAsset(BlueprintObj, /*bool bFocusIfOpen =*/false); if (EditorInst != nullptr) { UE_LOG(LogBlueprintAutomationTests, Log, TEXT("Closing '%s' so we don't invalidate the open version when unloading it."), *BlueprintObj->GetName()); EditorInst->CloseWindow(); } }
void FAssetEditorManager::CloseOtherEditors( UObject* Asset, IAssetEditorInstance* OnlyEditor) { TArray<UObject*> AllAssets; for (TMultiMap<UObject*, IAssetEditorInstance*>::TIterator It(OpenedAssets); It; ++It) { IAssetEditorInstance* Editor = It.Value(); if(Asset == It.Key() && Editor != OnlyEditor) { Editor->CloseWindow(); } } }
bool FAssetEditorManager::CloseAllAssetEditors() { bool bAllEditorsClosed = true; for (TMultiMap<IAssetEditorInstance*, UObject*>::TIterator It(OpenedEditors); It; ++It) { IAssetEditorInstance* Editor = It.Key(); if (Editor != NULL) { if ( !Editor->CloseWindow() ) { bAllEditorsClosed = false; } } } return bAllEditorsClosed; }