Hi!
I was trying to use UserDefinedActions as a way to do particular user events in an Editor Mode Tool. I found that the Event On Execute User Defined Action was not bound to.
![image](https://user-images.githubusercontent.com/3629598/111231354-5a3dd880-85a6-11eb-8f87-69a76eb97175.png)
I found that if on ReloadTool and UnloadTool I could register the OnExecuteUserDefinedAction to get around this, but then was wondering if I was just using these used defined actions wrong. Perhaps I should just be checking for particular inputs in the editor mode instead? I could do that in the receive tick and check the currently down keys, but that felt wrong to me: but I realized I might be missing something more obvious.
BluEdMode.cpp::ReloadTool()
ToolBlueprint->OnRegisterDone();
if (GEditor)
{
GEditor->OnBlueprintReinstanced().AddSP(this, &FBluEdMode::HandleAnyBlueprintReinstanced);
//Addition: Bind to execute user defined action.
UEditorEventsSubsystem* EditorEventsSubsystem = GEditor->GetEditorSubsystem<UEditorEventsSubsystem>();
if (EditorEventsSubsystem)
{
EditorEventsSubsystem->OnExecuteUserDefinedAction.AddDynamic(ActiveToolWeakPtr.Get(false), &UEditorModeToolInstance::OnExecuteUserDefinedAction);
}
}
void FBluEdMode::UnloadTool(bool bRefreshSlateWidget /*= true*/)
{
if (GEditor)
{
GEditor->OnBlueprintReinstanced().RemoveAll(this);
//Addition: Unbind to execute user defined action.
UEditorEventsSubsystem* EditorEventsSubsystem = GEditor->GetEditorSubsystem<UEditorEventsSubsystem>();
if (EditorEventsSubsystem)
{
if (ActiveToolWeakPtr.IsValid(true))
{
EditorEventsSubsystem->OnExecuteUserDefinedAction.RemoveAll(ActiveToolWeakPtr.Get(true));
}
}
}
(Again, I can't say how much I am absurdly impressed with this plugin. Really fantastic. π π π )