Can I Auto-generate BP graph nodes from editor extension button

I’ve been banging my head against a problem for a while and need some help.

I have written an editor plugin which creates a button inside the AnimationBlueprint editor window.

When I click the button I want to be able to generate nodes in the AnimGraph of the currently edited AnimationBlueprint. However this is where I get stuck. I can’t seem to access the actual graph from the tool button.

I think I need to call Invoke on the UBlueprintNodeSpawner class to do the actual generation:

UBlueprintNodeSpawner::Invoke(UEdGraph* ParentGraph, FBindingSet const& Bindings, FVector2D const Location)

However, in order to do that I will need access to the UEdGraph pointer. I can’t find out where to get it though.

My button makes use of the ToolbarExtender for the AnimationBlueprintEditor like this:

FLevelEditorModule& AnimBPEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("AnimationBlueprintEditor");

TSharedPtr<FExtender> ToolbarExtender = MakeShareable(new FExtender);
ToolbarExtender->AddToolBarExtension("Settings", EExtensionHook::After, PluginCommands, FToolBarExtensionDelegate::CreateRaw(this, &FMyEditorModule::AddToolbarExtension));

FMyEditorModule::AddToolbarExtension simply adds a button which all works fine. However I can’t figure out how to access the actual graph widget from this button. It seems like there is no link between the toolbar and the graph.

If anyone can offer some help on how I might be able to do this, it’d be very much appreciated.



Did you ever figure this out Mike?