Object editing through EditorUtilityToolMenuEntry

Hey,

I am currently setting up a custom button (EditorUtilityToolMenuEntry - Blueprint) to perform actions on the Curves assets.

To be in the correct context of the curves editor I add my button at this location: AssetEditor.CurveAssetEditor.ToolBar

Everything works fine but I am unable to recover the curve asset that is currently being edited.

Is this possible in blueprint? Python? C++?

Best regards,

Duchesne Jeremy

Hello [mention removed]​

Thank you for reaching out.

While using BPs, there’s a bit of a hacky way to get the name of the asset: you can call Get Selected Assets, and it will return the assets you have selected in the ContentBrowser.

This is brittle because it will give you the wrong name if you change the selection on the ContentBrowser or select multiple assets, but depending on your particular use case, it could also be enough:

[Image Removed]

[Image Removed]

AssetEditorSubsystem only exposes OpenEditorForAssets and CloseAllEditorsForAsset, so you would know them from the start:

[Image Removed]

[Image Removed]

Looking at the source, you would need to expose some C++ functionality to get the asset.

As an example, check \UnrealEngine\Engine\Plugins\Editor\EngineAssetDefinitions\Source\Private\Animation\AssetDefinition_AnimationAsset.cpp

L90: AllEditedAssets = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->GetAllEditedAssets();

Might also be useful - L109: AssetEditors = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>()->FindEditorsForAsset(CompatibleEditedAsset);

Let me know if this is useful to you.

All the best,

[mention removed]​

Thank you for your quick response.

I thought to get the current selected asset but, It is not 100% reliable.

I was wondering if the “Context” output of the node “Execute” can be useful to get the editing asset.

We will look at C++ code to see what is possible.

Thank you :grinning_face:,

Best regards,

Duchesne Jeremy

Hello [mention removed]​

I was able to fetch the name of the editing object using C++, like so:

`void UMyBlueprintFunctionLibrary::PrintEditingObjectNameFromContext(const FToolMenuContext& InContext)
{
if (const UAssetEditorToolkitMenuContext* MenuContext = InContext.FindContext())
{
for (UObject* EditingObject : MenuContext->GetEditingObjects())
{
UE_LOG(LogTemp, Log, TEXT(“EditingObject: %s”), *EditingObject->GetName());

}
}
}`In the Editor Utility Tool Menu Entry:

[Image Removed]Output:

[Image Removed]This worked independently of the asset selected in the ContentBrowser.

Let me know if this is what you are looking for.

All the best,

[mention removed]​

Woow, this is exactly what I needed !

I will work with the full blueprint version which works well.

[Image Removed]

Thank you very much it’s perfect!

Best regards,

Duchesne Jeremy

Hello [mention removed]​

Thank you for tagging my response as Best Answer.

I’m glad I could help you.

Also, thank you for sharing a BP solution! I’ve missed that one.

I’ll close the case, but feel free to reply if you have any follow-up questions.

All the best,

[mention removed]​