#jira UE-85615

Avoid creating 300 empty keyboard bindings without description.

Thanks matt for the initial CL!

#rb none
[FYI] Chris.Gagnon, Matt.Kuhlenschmidt

#ROBOMERGE-SOURCE: CL 11583691 in //UE4/Release-4.25/... via CL 11583692
#ROBOMERGE-BOT: RELEASE (Release-4.25Plus -> Main) (v654-11333218)

[CL 11585524 by gines hidalgo in Main branch]
This commit is contained in:
gines hidalgo
2020-02-22 18:18:22 -05:00
parent 55ec87e4da
commit 31f726516b
3 changed files with 313 additions and 325 deletions
@@ -195,7 +195,22 @@ void FMainFrameCommands::RegisterCommands()
ActionList->MapAction( CreditsUnrealEd, FExecuteAction::CreateStatic(&FMainFrameActionCallbacks::CreditsUnrealEd_Execute) );
// Layout commands
RegisterLayoutCommands();
UI_COMMAND(ImportLayout, "Import Layout...", "Import a custom layout (or set of layouts) from a different directory and load it into your current instance of the Unreal Editor UI", EUserInterfaceActionType::Button, FInputChord());
ActionList->MapAction(ImportLayout, FExecuteAction::CreateStatic(&FLayoutsMenuLoad::ImportLayout));
UI_COMMAND(SaveLayoutAs, "Save Layout As...", "Save the current layout customization on disk so it can be loaded later", EUserInterfaceActionType::Button, FInputChord());
ActionList->MapAction(SaveLayoutAs, FExecuteAction::CreateStatic(&FLayoutsMenuSave::SaveLayoutAs));
UI_COMMAND(ExportLayout, "Export Layout...", "Export the custom layout customization to a different directory", EUserInterfaceActionType::Button, FInputChord());
ActionList->MapAction(ExportLayout, FExecuteAction::CreateStatic(&FLayoutsMenuSave::ExportLayout));
UI_COMMAND(RemoveUserLayouts, "Remove All User Layouts...", "Remove all the layout customizations created by the user", EUserInterfaceActionType::Button, FInputChord());
ActionList->MapAction(
RemoveUserLayouts,
FExecuteAction::CreateStatic(&FLayoutsMenuRemove::RemoveUserLayouts),
FCanExecuteAction::CreateStatic(&FLayoutsMenuBase::IsThereUserLayouts)
);
#if !PLATFORM_MAC && !PLATFORM_LINUX // Fullscreen mode in the editor is currently unsupported on Mac and Linux
UI_COMMAND( ToggleFullscreen, "Enable Fullscreen", "Enables fullscreen mode for the application, expanding across the entire monitor", EUserInterfaceActionType::ToggleButton, FInputChord(EModifierKey::Shift, EKeys::F11) );
@@ -212,96 +227,6 @@ void FMainFrameCommands::RegisterCommands()
FGlobalEditorCommonCommands::MapActions(ActionList);
}
TSharedRef<FUICommandInfo> CreateFUICommandInfoInternal(const TSharedRef<FBindingContext>& InThisAsShared, const FName& InCommandName)
{
// Default FUICommandInfoDecl command
return FUICommandInfoDecl(
InThisAsShared,
InCommandName,
FText::FromString("InLabel"),
FText::FromString("InDesc"))
.UserInterfaceType(EUserInterfaceActionType::Check)
.DefaultChord(FInputChord());
}
void FMainFrameCommands::RegisterLayoutCommands()
{
// Load layout commands
UI_COMMAND(MainFrameLayoutCommands.ImportLayout, "Import Layout...", "Import a custom layout (or set of layouts) from a different directory and load it into your current instance of the Unreal Editor UI", EUserInterfaceActionType::Button, FInputChord());
ActionList->MapAction(MainFrameLayoutCommands.ImportLayout, FExecuteAction::CreateStatic(&FLayoutsMenuLoad::ImportLayout));
// Save layout commands
UI_COMMAND(MainFrameLayoutCommands.SaveLayoutAs, "Save Layout As...", "Save the current layout customization on disk so it can be loaded later", EUserInterfaceActionType::Button, FInputChord());
ActionList->MapAction(MainFrameLayoutCommands.SaveLayoutAs, FExecuteAction::CreateStatic(&FLayoutsMenuSave::SaveLayoutAs));
UI_COMMAND(MainFrameLayoutCommands.ExportLayout, "Export Layout...", "Export the custom layout customization to a different directory", EUserInterfaceActionType::Button, FInputChord());
ActionList->MapAction(MainFrameLayoutCommands.ExportLayout, FExecuteAction::CreateStatic(&FLayoutsMenuSave::ExportLayout));
// Remove layout commands
UI_COMMAND(MainFrameLayoutCommands.RemoveUserLayouts, "Remove All User Layouts...", "Remove all the layout customizations created by the user", EUserInterfaceActionType::Button, FInputChord());
ActionList->MapAction(
MainFrameLayoutCommands.RemoveUserLayouts,
FExecuteAction::CreateStatic(&FLayoutsMenuRemove::RemoveUserLayouts),
FCanExecuteAction::CreateStatic(&FLayoutsMenuBase::IsThereUserLayouts)
);
// Load/Override/Remove layout commands
const int32 MaxLayouts = 50;
for (int32 CurrentLayoutIndex = 0; CurrentLayoutIndex < MaxLayouts; ++CurrentLayoutIndex)
{
// NOTE: The actual label and tool-tip will be overridden at runtime when the command is bound to a menu item, however
// we still need to set one here so that the key bindings UI can function properly
// Thus, we remove any (NS)LOCTEXT from here to avoid unnecessary translations.
// Load Layout
{
// Default Layouts
TSharedRef<FUICommandInfo> LoadLayout = CreateFUICommandInfoInternal(this->AsShared(), FName(*FString::Printf(TEXT("LoadLayout%i"), CurrentLayoutIndex)));
MainFrameLayoutCommands.LoadLayoutCommands.Add(LoadLayout);
ActionList->MapAction(MainFrameLayoutCommands.LoadLayoutCommands[CurrentLayoutIndex], FExecuteAction::CreateStatic(&FLayoutsMenuLoad::LoadLayout, CurrentLayoutIndex),
FCanExecuteAction::CreateStatic(&FLayoutsMenuLoad::CanLoadChooseLayout, CurrentLayoutIndex),
FIsActionChecked::CreateStatic(&FLayoutsMenuBase::IsLayoutChecked, CurrentLayoutIndex));
// User Layouts
TSharedRef<FUICommandInfo> LoadUserLayout = CreateFUICommandInfoInternal(this->AsShared(), FName(*FString::Printf(TEXT("LoadUserLayout%i"), CurrentLayoutIndex)));
MainFrameLayoutCommands.LoadUserLayoutCommands.Add(LoadUserLayout);
ActionList->MapAction(MainFrameLayoutCommands.LoadUserLayoutCommands[CurrentLayoutIndex], FExecuteAction::CreateStatic(&FLayoutsMenuLoad::LoadUserLayout, CurrentLayoutIndex),
FCanExecuteAction::CreateStatic(&FLayoutsMenuLoad::CanLoadChooseUserLayout, CurrentLayoutIndex),
FIsActionChecked::CreateStatic(&FLayoutsMenuBase::IsUserLayoutChecked, CurrentLayoutIndex));
}
// Override Layout
{
// Default Layouts
TSharedRef<FUICommandInfo> OverrideLayout = CreateFUICommandInfoInternal(this->AsShared(), FName(*FString::Printf(TEXT("OverrideLayout%i"), CurrentLayoutIndex)));
MainFrameLayoutCommands.OverrideLayoutCommands.Add(OverrideLayout);
ActionList->MapAction(MainFrameLayoutCommands.OverrideLayoutCommands[CurrentLayoutIndex], FExecuteAction::CreateStatic(&FLayoutsMenuSave::OverrideLayout, CurrentLayoutIndex),
FCanExecuteAction::CreateStatic(&FLayoutsMenuSave::CanSaveChooseLayout, CurrentLayoutIndex),
FIsActionChecked::CreateStatic(&FLayoutsMenuBase::IsLayoutChecked, CurrentLayoutIndex));
// User Layouts
TSharedRef<FUICommandInfo> OverrideUserLayout = CreateFUICommandInfoInternal(this->AsShared(), FName(*FString::Printf(TEXT("OverrideUserLayout%i"), CurrentLayoutIndex)));
MainFrameLayoutCommands.OverrideUserLayoutCommands.Add(OverrideUserLayout);
ActionList->MapAction(MainFrameLayoutCommands.OverrideUserLayoutCommands[CurrentLayoutIndex], FExecuteAction::CreateStatic(&FLayoutsMenuSave::OverrideUserLayout, CurrentLayoutIndex),
FCanExecuteAction::CreateStatic(&FLayoutsMenuSave::CanSaveChooseUserLayout, CurrentLayoutIndex),
FIsActionChecked::CreateStatic(&FLayoutsMenuBase::IsUserLayoutChecked, CurrentLayoutIndex));
}
// Remove Layout
{
// Default Layouts
TSharedRef<FUICommandInfo> RemoveLayout = CreateFUICommandInfoInternal(this->AsShared(), FName(*FString::Printf(TEXT("RemoveLayout%i"), CurrentLayoutIndex)));
MainFrameLayoutCommands.RemoveLayoutCommands.Add(RemoveLayout);
ActionList->MapAction(MainFrameLayoutCommands.RemoveLayoutCommands[CurrentLayoutIndex], FExecuteAction::CreateStatic(&FLayoutsMenuRemove::RemoveLayout, CurrentLayoutIndex),
FCanExecuteAction::CreateStatic(&FLayoutsMenuRemove::CanRemoveChooseLayout, CurrentLayoutIndex),
FIsActionChecked::CreateStatic(&FLayoutsMenuBase::IsLayoutChecked, CurrentLayoutIndex));
// User Layouts
TSharedRef<FUICommandInfo> RemoveUserLayout = CreateFUICommandInfoInternal(this->AsShared(), FName(*FString::Printf(TEXT("RemoveUserLayout%i"), CurrentLayoutIndex)));
MainFrameLayoutCommands.RemoveUserLayoutCommands.Add(RemoveUserLayout);
ActionList->MapAction(MainFrameLayoutCommands.RemoveUserLayoutCommands[CurrentLayoutIndex], FExecuteAction::CreateStatic(&FLayoutsMenuRemove::RemoveUserLayout, CurrentLayoutIndex),
FCanExecuteAction::CreateStatic(&FLayoutsMenuRemove::CanRemoveChooseUserLayout, CurrentLayoutIndex),
FIsActionChecked::CreateStatic(&FLayoutsMenuBase::IsUserLayoutChecked, CurrentLayoutIndex));
}
}
}
FReply FMainFrameActionCallbacks::OnUnhandledKeyDownEvent(const FKeyEvent& InKeyEvent)
{
if(!GIsSlowTask)
@@ -11,26 +11,6 @@
class FUICommandList;
/**
* Unreal editor main frame actions related to the Layout section
*/
class FMainFrameLayoutCommands
{
public:
// Load-based commands
TArray<TSharedPtr<FUICommandInfo>> LoadLayoutCommands;
TArray<TSharedPtr<FUICommandInfo>> LoadUserLayoutCommands;
TSharedPtr< FUICommandInfo > ImportLayout;
// Save-based commands
TArray<TSharedPtr<FUICommandInfo>> OverrideLayoutCommands;
TArray<TSharedPtr<FUICommandInfo>> OverrideUserLayoutCommands;
TSharedPtr< FUICommandInfo > SaveLayoutAs;
TSharedPtr< FUICommandInfo > ExportLayout;
// Remove-based commands
TArray<TSharedPtr<FUICommandInfo>> RemoveLayoutCommands;
TArray<TSharedPtr<FUICommandInfo>> RemoveUserLayoutCommands;
TSharedPtr< FUICommandInfo > RemoveUserLayouts;
};
/**
* Unreal editor main frame actions
@@ -83,7 +63,10 @@ public:
TSharedPtr< FUICommandInfo > CreditsUnrealEd;
// Layout
FMainFrameLayoutCommands MainFrameLayoutCommands;
TSharedPtr< FUICommandInfo > ImportLayout;
TSharedPtr< FUICommandInfo > SaveLayoutAs;
TSharedPtr< FUICommandInfo > ExportLayout;
TSharedPtr< FUICommandInfo > RemoveUserLayouts;
TSharedPtr< FUICommandInfo > ToggleFullscreen;
File diff suppressed because it is too large Load Diff