void BluePrintProvider::OpenBlueprint()

in src/cpp/RiderLink/Source/RiderBlueprint/Private/BlueprintProvider.cpp [42:83]


void BluePrintProvider::OpenBlueprint(JetBrains::EditorPlugin::BlueprintReference const& BlueprintReference, TSharedPtr<FMessageEndpoint, ESPMode::ThreadSafe> const& messageEndpoint) {
    // Just to create asset manager if it wasn't created already
    const FString AssetPathName = BlueprintReference.get_pathName();
    FGuid AssetGuid;
    bool bIsValidGuid = FGuid::Parse(BlueprintReference.get_guid(), AssetGuid);
#if ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION <= 23
    FAssetEditorManager::Get();
    messageEndpoint->Publish(new FAssetEditorRequestOpenAsset(AssetPathName), EMessageScope::Process);
#else
    AsyncTask(ENamedThreads::GameThread, [AssetPathName, AssetGuid, bIsValidGuid]()
    {
        // An asset needs loading
        UPackage* Package = LoadPackage(nullptr, *AssetPathName, LOAD_NoRedirects);

        if (Package)
        {
            Package->FullyLoad();

            const FString AssetName = FPaths::GetBaseFilename(AssetPathName);
            UObject* Object = FindObject<UObject>(Package, *AssetName);
            const UBlueprint* Blueprint = Cast<UBlueprint>(Object);

            if(bIsValidGuid && Blueprint != nullptr)
            {
                UEdGraphNode* EdGraphNode = FBlueprintEditorUtils::GetNodeByGUID(Blueprint, AssetGuid);
                if(EdGraphNode != nullptr)
                {
                    FKismetEditorUtilities::BringKismetToFocusAttentionOnObject(EdGraphNode); 
                }
                else
                {
                    FKismetEditorUtilities::BringKismetToFocusAttentionOnObject(Blueprint);
                }
            }
            else if(Object != nullptr)
            {      
                GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->OpenEditorForAsset(Object);         
            }
        }
    });
#endif
}