JetBrains / UnrealLink

Apache License 2.0
128 stars 24 forks source link

RiderLink shows references from UDataAssets but doesn't support opening them. #234

Closed MT-Dev closed 1 year ago

MT-Dev commented 1 year ago

Rider will show references of UPROPERTIES from UDataAsset objects, but when selecting the reference from the Rider context menu, it won't open the UDataAsset in the Unreal Editor.

Replacing the call to

FKismetEditorUtilities::BringKismetToFocusAttentionOnObject(Blueprint);

with

GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->OpenEditorForAsset(Object);

will allow it to work for both UBlueprint and UDataAsset objects.

DecoyRS commented 1 year ago

Thank you for the feedback! I think we've tried to use OpenEditorGorAsset in the first place, but it couldn't focus on the node that was referenced by the uproperty eg if you were to find a place where a field is being set up. Not opening a UDataAsset is an issue for sure, but do you know if there's an API that would focus on a specific field of the UDataAsset?

MT-Dev commented 1 year ago

I don't believe there is a concept of selecting a field in a UDataAsset. The default asset editor for UDataAssets is just a property inspector for the UDataAsset itself. If a particular type of UDataAsset child class has a custom asset editor, then it would be up to that editor's implementation.

As far as not jumping to a Blueprint node when using OpenEditorForAsset. I think something like the following could work.

if(bIsValidGuid && Blueprint != nullptr)
{
    Object = FBlueprintEditorUtils::GetNodeByGUID(Blueprint, AssetGuid);
    FKismetEditorUtilities::BringKismetToFocusAttentionOnObject(Object);
}
else if(Object != nullptr)
{
    GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->OpenEditorForAsset(Object);
}
DecoyRS commented 1 year ago

Whelp, I've fixed it and forgot to cherry pick the fix >< The next bugfix build of Rider (eg 2023.1.1) will have this fixed