Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Listen existing command event in an editor plugin?

I am working on an editor plugin with a custom EdMode.

I would like to do something when the user performs an action (in my case: select the translate tool, with the UI button or the keyboard shortcut).

How can I access the command (for example the SelectTranslateTool command)?

How can I react to event triggered by this command?

Product Version: UE 4.11
more ▼

asked May 24 '16 at 10:36 AM in C++ Programming

avatar image

Arthur Masson
319 37 45 61

avatar image Arthur Masson May 24 '16 at 10:46 AM

ok, it seems the line 228 of SEditorViewport.cpp will help me:

     FExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::SetWidgetMode, FWidget::WM_Translate ),
     FCanExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::CanSetWidgetMode, FWidget::WM_Translate ),
     FIsActionChecked::CreateSP( this, &SEditorViewport::IsWidgetModeActive, FWidget::WM_Translate ) 
avatar image Arthur Masson May 24 '16 at 11:13 AM

I don't know how to access the EditorViewport :-(

avatar image Arthur Masson May 24 '16 at 12:41 PM

It took me 2 hours to make this code:

 FLevelEditorModule& LevelEditor = FModuleManager::GetModuleChecked<FLevelEditorModule>( TEXT("LevelEditor") );
 TWeakPtr<SLevelEditor> LevelEditorInstance = LevelEditor.GetLevelEditorInstance();
     TSharedPtr<SLevelEditor> LevelEditorInstancePtr = LevelEditorInstance.Pin();
     TSharedPtr<FUICommandList> LevelEditorCommands = LevelEditorInstancePtr->GetLevelEditorActions();
     const FEditorViewportCommands& Commands = FEditorViewportCommands::Get();
     LevelEditorCommands->MapAction(Commands.TranslateMode, FExecuteAction::CreateUObject( APB::Instance, &APB::SetWidgetMode, 0 ));
     LevelEditorCommands->MapAction(Commands.RotateMode, FExecuteAction::CreateUObject( APB::Instance, &APB::SetWidgetMode, 1 ));
     LevelEditorCommands->MapAction(Commands.ScaleMode, FExecuteAction::CreateUObject( APB::Instance, &APB::SetWidgetMode, 2 ));

and it does not work, it overrides the commands instead of extending them.

It's so hard to find documentation and help in UE.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question