Files
UnrealEngineUWP/Engine/Source/Editor/MainFrame/Private/Menus/MainMenu.cpp
Max Chen d27d646cb7 Copying //UE4/Dev-Sequencer to Dev-Main (//UE4/Dev-Main)
#lockdown nick.penwarden

==========================
MAJOR FEATURES + CHANGES
==========================

Change 2719576 on 2015/10/07 by Chris.Wood

	Added check for stale BP classes in FKismetCompilerUtilities::IsTypeCompatibleWithProperty() to stop compiler errors during reinstancing.
	[UE-19795] - UMG Compiler error when adding variable to nested Widget

Change 2721474 on 2015/10/08 by Andrew.Rodham

	Sequencer: Movie render operations now successfully capture UMG UI

Change 2724958 on 2015/10/12 by Chris.Wood

	Added missing resource cleanup code to UMG widgets
	[UE-21874] - UWIdget classes with missing ReleaseSlateResources() overrides

	Added ReleaseSlateResources() to ListView, TileView and Slider widgets to reset shared pointers to slate widgets.

Change 2733562 on 2015/10/19 by Andrew.Rodham

	Sequencer: Fixed spawnables not working in sub-sequences

	 - The issue here was that sequence track instance updates had no knowledge of which sub-sequence they were being evaluated within. We now pass the active sequence instance into the relevant track instance functions.
	 - Also addressed some issues to do with save/restore state not getting called correctly on master tracks of sequence instances
	 - Tidied up spawn track editor

Change 2735264 on 2015/10/20 by Chris.Wood

	Improved Engine analytics handling for Editor and games
	[UE-21892] - Improve how Engine analytics are handled for Editor and games

	Changes:
	Added Privacy section to Editor settings
	Exposed editor analytics flag in Privacy options
	Added Details Customization to make this type of bool property clearer with extra info and hyperlink
	Changed AreEditorAnalyticsEnable() to use new flag
	Prevented analytics init when disabled by user
	Sending event and shutting down analytics when user opts out
	Add in-game project setting for anonymous game usage data
	Renamed and moved bHardwareSurveyEnabled
	Added message about exposing in-game setting to end users
	Added anonymous GUID id for in-game analytics
	Moved end user settings to global config (defaultengine.ini)
	Placeholder loc text on new options for now, pending legal wording sign-off

Change 2735866 on 2015/10/20 by Max.Preussner

	Async: Added ability to register an optional callback function that is executed when a Future completes

Change 2739793 on 2015/10/23 by Andrew.Rodham

	Sequencer: Refined movie scene capturing to ensure frame accuracies are maintained

	 - Aborting an in-progress capture now gracefully terminates the process (through a remote session command) to ensure it still creates a valid video
	 - Level sequece movie capture will now pick up a corresponding level sequence in the world, and use that to capture with. A new actor will be spawned at runtime with the correct asset, should one not already exist.
	 - Made -nomovie actually work
	 - Refined how active movie captures are managed
	 - Added option to 'stage' a sequence before starting the capture. This feature will set the sequence on its first frame for the preroll, to ensure that PPP effects are allowed time to stabilize

Change 2744402 on 2015/10/28 by Max.Preussner

	Sequencer: Separated track display names from track identifier names; code cleanup

Change 2745953 on 2015/10/29 by Max.Chen

	Sequencer: Attach to socket. Relative attachments.

	#jira UETOOL-463

Change 2747028 on 2015/10/29 by Max.Preussner

	Sequencer: Another overhaul of track display name handling; code and documentation cleanup pass.

Change 2758888 on 2015/11/09 by Chris.Wood

	Integrating changes -  4.10 to Dev-Sequencer

	From 4.10 branch fixes:
	Added check for debugger present when reporting abnormal termination to analytics. [UE-22844] CL 2750764
	Added FSystemWideCriticalSection for desktop platforms. Used by analytics to lock access to editor instances list in the OS. [UE-22844] CL 2753661
	Updating wording in privacy settings text. [UE-21892] CL 2753709
	Mac and Linux CIS fix [UE-22844] CL 2755381

Change 2761287 on 2015/11/10 by Max.Chen

	Sequencer: Add null check when updating the UMG preview if the sequencer doesn't exist/has been closed.

	#jira UE-5206

Change 2764945 on 2015/11/12 by Max.Preussner

	Core: Templatized TypeContainer implementation to allow for thread-safe objects; updated unit test

	Also fixes UE-13850

Change 2765036 on 2015/11/12 by Max.Preussner

	UdpMessaging: Fixed message serialization unit test (UE-22571)

	#jira: UE-22571

Change 2766149 on 2015/11/13 by Max.Preussner

	Media: Implemented event that gets triggered when playback reached the end of media

	Also fixes looping.

Change 2768157 on 2015/11/16 by Max.Preussner

	Media: Added .m4a to supported WMF file extensions

Change 2769200 on 2015/11/16 by Max.Chen

	Editor: Add broadcast messages when snapping objects.

	#jira UE-22680

Change 2773066 on 2015/11/19 by Chris.Wood

	Upload crashes from CRC to Data Router
	[UECORE-249] - Integrate Crash Report Client with the Data Router

	Upload to Receiver still active as we are running both in parallel for now.
2015-12-11 13:52:32 -05:00

518 lines
19 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "MainFramePrivatePCH.h"
#include "../../WorkspaceMenuStructure/Public/WorkspaceMenuStructureModule.h"
#include "GlobalEditorCommonCommands.h"
#include "Editor/UnrealEd/Public/Features/EditorFeatures.h"
#include "Runtime/Core/Public/Features/IModularFeatures.h"
#include "SourceCodeNavigation.h"
#include "Toolkits/AssetEditorToolkit.h"
#include "TranslationEditorMenu.h"
#include "Editor/DeviceProfileEditor/Public/DeviceProfileEditorModule.h"
#include "UndoHistoryModule.h"
#include "GenericCommands.h"
#include "ToolboxModule.h"
#define LOCTEXT_NAMESPACE "MainFileMenu"
void FMainMenu::FillFileMenu( FMenuBuilder& MenuBuilder, const TSharedRef<FExtender> Extender )
{
MenuBuilder.BeginSection("FileLoadAndSave", LOCTEXT("LoadSandSaveHeading", "Load and Save"));
{
// Open Asset...
MenuBuilder.AddMenuEntry( FGlobalEditorCommonCommands::Get().SummonOpenAssetDialog );
// Save All
MenuBuilder.AddMenuEntry(FMainFrameCommands::Get().SaveAll, "SaveAll");
// Choose specific files to save
MenuBuilder.AddMenuEntry(FMainFrameCommands::Get().ChooseFilesToSave, "ChooseFilesToSave");
if (ISourceControlModule::Get().IsEnabled() && ISourceControlModule::Get().GetProvider().IsAvailable())
{
// Choose specific files to submit
MenuBuilder.AddMenuEntry(FMainFrameCommands::Get().ChooseFilesToCheckIn, "ChooseFilesToCheckIn");
}
else
{
MenuBuilder.AddMenuEntry(FMainFrameCommands::Get().ConnectToSourceControl, "ConnectToSourceControl");
}
}
MenuBuilder.EndSection();
}
#undef LOCTEXT_NAMESPACE
#define LOCTEXT_NAMESPACE "MainEditMenu"
void FMainMenu::FillEditMenu( FMenuBuilder& MenuBuilder, const TSharedRef< FExtender > Extender, const TSharedPtr<FTabManager> TabManager )
{
MenuBuilder.BeginSection("EditHistory", LOCTEXT("HistoryHeading", "History"));
{
struct Local
{
/** @return Returns a dynamic text string for Undo that contains the name of the action */
static FText GetUndoLabelText()
{
return FText::Format(LOCTEXT("DynamicUndoLabel", "Undo {0}"), GUnrealEd->Trans->GetUndoContext().Title);
}
/** @return Returns a dynamic text string for Redo that contains the name of the action */
static FText GetRedoLabelText()
{
return FText::Format(LOCTEXT("DynamicRedoLabel", "Redo {0}"), GUnrealEd->Trans->GetRedoContext().Title);
}
};
// Undo
TAttribute<FText> DynamicUndoLabel;
DynamicUndoLabel.BindStatic(&Local::GetUndoLabelText);
MenuBuilder.AddMenuEntry( FGenericCommands::Get().Undo, "Undo", DynamicUndoLabel); // TAttribute< FString >::Create( &Local::GetUndoLabelText ) );
// Redo
TAttribute< FText > DynamicRedoLabel;
DynamicRedoLabel.BindStatic( &Local::GetRedoLabelText );
MenuBuilder.AddMenuEntry(FGenericCommands::Get().Redo, "Redo", DynamicRedoLabel); // TAttribute< FString >::Create( &Local::GetRedoLabelText ) );
// Show undo history
MenuBuilder.AddMenuEntry(
LOCTEXT("UndoHistoryTabTitle", "Undo History"),
LOCTEXT("UndoHistoryTooltipText", "View the entire undo history."),
FSlateIcon(FEditorStyle::GetStyleSetName(), "UndoHistory.TabIcon"),
FUIAction(FExecuteAction::CreateStatic(&FUndoHistoryModule::ExecuteOpenUndoHistory))
);
}
MenuBuilder.EndSection();
MenuBuilder.BeginSection("EditLocalTabSpawners", LOCTEXT("ConfigurationHeading", "Configuration"));
{
if (GetDefault<UEditorExperimentalSettings>()->bToolbarCustomization)
{
FUIAction ToggleMultiBoxEditMode(
FExecuteAction::CreateStatic(&FMultiBoxSettings::ToggleToolbarEditing),
FCanExecuteAction(),
FIsActionChecked::CreateStatic(&FMultiBoxSettings::IsInToolbarEditMode)
);
MenuBuilder.AddMenuEntry(
LOCTEXT("EditToolbarsLabel", "Edit Toolbars"),
LOCTEXT("EditToolbarsToolTip", "Allows customization of each toolbar"),
FSlateIcon(),
ToggleMultiBoxEditMode,
NAME_None,
EUserInterfaceActionType::ToggleButton
);
// Automatically populate tab spawners from TabManager
if (TabManager.IsValid())
{
const IWorkspaceMenuStructure& MenuStructure = WorkspaceMenu::GetMenuStructure();
TabManager->PopulateTabSpawnerMenu(MenuBuilder, MenuStructure.GetEditOptions());
}
}
if (GetDefault<UEditorStyleSettings>()->bExpandConfigurationMenus)
{
MenuBuilder.AddSubMenu(
LOCTEXT("EditorPreferencesSubMenuLabel", "Editor Preferences"),
LOCTEXT("EditorPreferencesSubMenuToolTip", "Configure the behavior and features of this Editor"),
FNewMenuDelegate::CreateStatic(&FSettingsMenu::MakeMenu, FName("Editor")),
false,
FSlateIcon(FEditorStyle::GetStyleSetName(), "EditorPreferences.TabIcon")
);
MenuBuilder.AddSubMenu(
LOCTEXT("ProjectSettingsSubMenuLabel", "Project Settings"),
LOCTEXT("ProjectSettingsSubMenuToolTip", "Change the settings of the currently loaded project"),
FNewMenuDelegate::CreateStatic(&FSettingsMenu::MakeMenu, FName("Project")),
false,
FSlateIcon(FEditorStyle::GetStyleSetName(), "ProjectSettings.TabIcon")
);
}
else
{
#if !PLATFORM_MAC // Handled by app's menu in menu bar
MenuBuilder.AddMenuEntry(
LOCTEXT("EditorPreferencesMenuLabel", "Editor Preferences..."),
LOCTEXT("EditorPreferencesMenuToolTip", "Configure the behavior and features of the Unreal Editor."),
FSlateIcon(FEditorStyle::GetStyleSetName(), "EditorPreferences.TabIcon"),
FUIAction(FExecuteAction::CreateStatic(&FSettingsMenu::OpenSettings, FName("Editor"), FName("General"), FName("Appearance")))
);
#endif
MenuBuilder.AddMenuEntry(
LOCTEXT("ProjectSettingsMenuLabel", "Project Settings..."),
LOCTEXT("ProjectSettingsMenuToolTip", "Change the settings of the currently loaded project."),
FSlateIcon(FEditorStyle::GetStyleSetName(), "ProjectSettings.TabIcon"),
FUIAction(FExecuteAction::CreateStatic(&FSettingsMenu::OpenSettings, FName("Project"), FName("Project"), FName("General")))
);
//@todo The tab system needs to be able to be extendable by plugins [9/3/2013 Justin.Sargent]
if (IModularFeatures::Get().IsModularFeatureAvailable(EditorFeatures::PluginsEditor))
{
FGlobalTabmanager::Get()->PopulateTabSpawnerMenu(MenuBuilder, "PluginsEditor");
}
}
}
MenuBuilder.EndSection();
}
#undef LOCTEXT_NAMESPACE
#define LOCTEXT_NAMESPACE "MainWindowMenu"
void FMainMenu::FillWindowMenu( FMenuBuilder& MenuBuilder, const TSharedRef< FExtender > Extender, const TSharedPtr<FTabManager> TabManager )
{
// Automatically populate tab spawners from TabManager
if (TabManager.IsValid())
{
// Local editor tabs
TabManager->PopulateLocalTabSpawnerMenu(MenuBuilder);
// General tabs
const IWorkspaceMenuStructure& MenuStructure = WorkspaceMenu::GetMenuStructure();
TabManager->PopulateTabSpawnerMenu(MenuBuilder, MenuStructure.GetStructureRoot());
}
MenuBuilder.BeginSection("WindowGlobalTabSpawners");
{
MenuBuilder.AddMenuEntry(
LOCTEXT("ProjectLauncherLabel", "Project Launcher"),
LOCTEXT("ProjectLauncherToolTip", "The Project Launcher provides advanced workflows for packaging, deploying and launching your projects."),
FSlateIcon(FEditorStyle::GetStyleSetName(), "Launcher.TabIcon"),
FUIAction(FExecuteAction::CreateStatic(&FMainMenu::OpenProjectLauncher))
);
}
MenuBuilder.EndSection();
{
// This is a temporary home for the spawners of experimental features that must be explicitly enabled.
// When the feature becomes permanent and need not check a flag, register a nomad spawner for it in the proper WorkspaceMenu category
bool bBlutility = GetDefault<UEditorExperimentalSettings>()->bEnableEditorUtilityBlueprints;
bool bLocalizationDashboard = GetDefault<UEditorExperimentalSettings>()->bEnableLocalizationDashboard;
bool bTranslationPicker = GetDefault<UEditorExperimentalSettings>()->bEnableTranslationPicker;
bool bMergeActors = GetDefault<UEditorExperimentalSettings>()->bActorMerging;
bool bDeviceOutputLog = GetDefault<UEditorExperimentalSettings>()->bDeviceOutputLog;
// Make sure at least one is enabled before creating the section
if (bBlutility || bLocalizationDashboard || bTranslationPicker || bMergeActors || bDeviceOutputLog)
{
MenuBuilder.BeginSection("ExperimentalTabSpawners", LOCTEXT("ExperimentalTabSpawnersHeading", "Experimental"));
{
// Blutility
if (bBlutility)
{
MenuBuilder.AddMenuEntry(
LOCTEXT("BlutilityShelfLabel", "Blutility Shelf"),
LOCTEXT("BlutilityShelfToolTip", "Open the blutility shelf."),
FSlateIcon(),
FUIAction(FExecuteAction::CreateStatic(&FMainMenu::OpenBlutilityShelf))
);
}
// Localization Dashboard
if (bLocalizationDashboard)
{
MenuBuilder.AddMenuEntry(
LOCTEXT("LocalizationDashboardLabel", "Localization Dashboard"),
LOCTEXT("BlutilityShelfToolTip", "Open the Localization Dashboard for this Project."),
FSlateIcon(),
FUIAction(FExecuteAction::CreateStatic(&FMainMenu::OpenLocalizationDashboard))
);
}
// Translation Picker
if (bTranslationPicker)
{
MenuBuilder.AddMenuEntry(
LOCTEXT("TranslationPickerMenuItem", "Translation Picker"),
LOCTEXT("TranslationPickerMenuItemToolTip", "Launch the Translation Picker to Modify Editor Translations"),
FSlateIcon(),
FUIAction(FExecuteAction::CreateStatic(&FMainFrameTranslationEditorMenu::HandleOpenTranslationPicker))
);
}
// Actor merging
if (bMergeActors)
{
MenuBuilder.AddMenuEntry(
LOCTEXT("MergeActorsMenuLabel", "Merge Actors"),
LOCTEXT("MergeActorsToolTip", "The Merge Actors tab provides tools for merging multiple actor meshes into a single mesh."),
FSlateIcon(),
FUIAction(FExecuteAction::CreateStatic(&FMainMenu::OpenMergeActors))
);
}
// Device output log
if (bDeviceOutputLog)
{
MenuBuilder.AddMenuEntry(
LOCTEXT("DeviceOutputLogMenuLabel", "Device Output Log"),
LOCTEXT("DeviceOutputLogToolTip", "Open the Device Output Log tab."),
FSlateIcon(FEditorStyle::GetStyleSetName(), "Log.TabIcon"),
FUIAction(FExecuteAction::CreateStatic(&FMainMenu::OpenDeviceOutputLog))
);
}
}
MenuBuilder.EndSection();
}
}
MenuBuilder.BeginSection("WindowLayout", NSLOCTEXT("MainAppMenu", "LayoutManagementHeader", "Layout"));
{
MenuBuilder.AddMenuEntry(FMainFrameCommands::Get().ResetLayout);
MenuBuilder.AddMenuEntry(FMainFrameCommands::Get().SaveLayout);
MenuBuilder.AddMenuEntry(FMainFrameCommands::Get().ToggleFullscreen);
}
MenuBuilder.EndSection();
}
#undef LOCTEXT_NAMESPACE
void FMainMenu::FillHelpMenu( FMenuBuilder& MenuBuilder, const TSharedRef< FExtender > Extender )
{
MenuBuilder.BeginSection("HelpOnline", NSLOCTEXT("MainHelpMenu", "Online", "Online"));
{
MenuBuilder.AddMenuEntry(FMainFrameCommands::Get().VisitForums);
MenuBuilder.AddMenuEntry(FMainFrameCommands::Get().VisitSearchForAnswersPage);
MenuBuilder.AddMenuEntry(FMainFrameCommands::Get().VisitWiki);
const FText SupportWebSiteLabel = NSLOCTEXT("MainHelpMenu", "VisitUnrealEngineSupportWebSite", "Unreal Engine Support Web Site...");
MenuBuilder.AddMenuSeparator("EpicGamesHelp");
MenuBuilder.AddMenuEntry(FMainFrameCommands::Get().VisitEpicGamesDotCom, "VisitEpicGamesDotCom");
MenuBuilder.AddMenuSeparator("Credits");
MenuBuilder.AddMenuEntry(FMainFrameCommands::Get().CreditsUnrealEd);
}
MenuBuilder.EndSection();
#if !PLATFORM_MAC // Handled by app's menu in menu bar
MenuBuilder.BeginSection("HelpApplication", NSLOCTEXT("MainHelpMenu", "Application", "Application"));
{
const FText AboutWindowTitle = NSLOCTEXT("MainHelpMenu", "AboutUnrealEditor", "About Unreal Editor...");
MenuBuilder.AddMenuEntry(FMainFrameCommands::Get().AboutUnrealEd, "AboutUnrealEd", AboutWindowTitle);
}
MenuBuilder.EndSection();
#endif
}
TSharedRef<SWidget> FMainMenu::MakeMainMenu(const TSharedPtr<FTabManager>& TabManager, const TSharedRef< FExtender > Extender)
{
#define LOCTEXT_NAMESPACE "MainMenu"
// Put the toolbox into our menus
{
const IWorkspaceMenuStructure& MenuStructure = WorkspaceMenu::GetMenuStructure();
IToolboxModule& ToolboxModule = FModuleManager::LoadModuleChecked<IToolboxModule>("Toolbox");
ToolboxModule.RegisterSpawners(MenuStructure.GetDeveloperToolsDebugCategory(), MenuStructure.GetDeveloperToolsMiscCategory());
}
// Cache all project names once
FMainFrameActionCallbacks::CacheProjectNames();
FMenuBarBuilder MenuBuilder(FMainFrameCommands::ActionList, Extender);
{
// File
MenuBuilder.AddPullDownMenu(
LOCTEXT("FileMenu", "File"),
LOCTEXT("FileMenu_ToolTip", "Open the file menu"),
FNewMenuDelegate::CreateStatic(&FMainMenu::FillFileMenu, Extender),
"File",
FName(TEXT("FileMenu"))
);
// Edit
MenuBuilder.AddPullDownMenu(
LOCTEXT("EditMenu", "Edit"),
LOCTEXT("EditMenu_ToolTip", "Open the edit menu"),
FNewMenuDelegate::CreateStatic(&FMainMenu::FillEditMenu, Extender, TabManager),
"Edit"
,
FName(TEXT("EditMenu"))
);
// Window
MenuBuilder.AddPullDownMenu(
LOCTEXT("WindowMenu", "Window"),
LOCTEXT("WindowMenu_ToolTip", "Open new windows or tabs."),
FNewMenuDelegate::CreateStatic(&FMainMenu::FillWindowMenu, Extender, TabManager),
"Window"
);
// Help
MenuBuilder.AddPullDownMenu(
LOCTEXT("HelpMenu", "Help"),
LOCTEXT("HelpMenu_ToolTip", "Open the help menu"),
FNewMenuDelegate::CreateStatic(&FMainMenu::FillHelpMenu, Extender),
"Help"
);
}
// Create the menu bar!
TSharedRef<SWidget> MenuBarWidget = MenuBuilder.MakeWidget();
// Tell tab-manager about the multi-box for platforms with a global menu bar
TabManager->SetMenuMultiBox(MenuBuilder.GetMultiBox());
return MenuBarWidget;
}
#undef LOCTEXT_NAMESPACE
#define LOCTEXT_NAMESPACE "MainTabMenu"
TSharedRef< SWidget > FMainMenu::MakeMainTabMenu( const TSharedPtr<FTabManager>& TabManager, const TSharedRef< FExtender > UserExtender )
{ struct Local
{
static void FillProjectMenuItems( FMenuBuilder& MenuBuilder )
{
MenuBuilder.BeginSection( "FileProject", LOCTEXT("ProjectHeading", "Project") );
{
MenuBuilder.AddMenuEntry( FMainFrameCommands::Get().NewProject );
MenuBuilder.AddMenuEntry( FMainFrameCommands::Get().OpenProject );
const bool bUseShortIDEName = true;
FText ShortIDEName = FSourceCodeNavigation::GetSuggestedSourceCodeIDE(bUseShortIDEName);
MenuBuilder.AddMenuEntry( FMainFrameCommands::Get().AddCodeToProject,
NAME_None,
TAttribute<FText>(),
FText::Format(LOCTEXT("AddCodeToProjectTooltip", "Adds C++ code to the project. The code can only be compiled if you have {0} installed."), ShortIDEName)
);
MenuBuilder.AddSubMenu(
LOCTEXT("PackageProjectSubMenuLabel", "Package Project"),
LOCTEXT("PackageProjectSubMenuToolTip", "Compile, cook and package your project and its content for distribution."),
FNewMenuDelegate::CreateStatic( &FPackageProjectMenu::MakeMenu ), false, FSlateIcon(FEditorStyle::GetStyleSetName(), "MainFrame.PackageProject")
);
/*
MenuBuilder.AddMenuEntry( FMainFrameCommands::Get().LocalizeProject,
NAME_None,
TAttribute<FText>(),
LOCTEXT("LocalizeProjectToolTip", "Gather text from your project and import/export translations.")
);
*/
/*
MenuBuilder.AddSubMenu(
LOCTEXT("CookProjectSubMenuLabel", "Cook Project"),
LOCTEXT("CookProjectSubMenuToolTip", "Cook your project content for debugging"),
FNewMenuDelegate::CreateStatic( &FCookContentMenu::MakeMenu ), false, FSlateIcon()
);
*/
FString SolutionPath;
if(FDesktopPlatformModule::Get()->GetSolutionPath(SolutionPath))
{
MenuBuilder.AddMenuEntry( FMainFrameCommands::Get().RefreshCodeProject,
NAME_None,
FText::Format(LOCTEXT("RefreshCodeProjectLabel", "Refresh {0} Project"), ShortIDEName),
FText::Format(LOCTEXT("RefreshCodeProjectTooltip", "Refreshes your C++ code project in {0}."), ShortIDEName)
);
MenuBuilder.AddMenuEntry( FMainFrameCommands::Get().OpenIDE,
NAME_None,
FText::Format(LOCTEXT("OpenIDELabel", "Open {0}"), ShortIDEName),
FText::Format(LOCTEXT("OpenIDETooltip", "Opens your C++ code in {0}."), ShortIDEName)
);
}
else
{
MenuBuilder.AddMenuEntry( FMainFrameCommands::Get().RefreshCodeProject,
NAME_None,
FText::Format(LOCTEXT("GenerateCodeProjectLabel", "Generate {0} Project"), ShortIDEName),
FText::Format(LOCTEXT("GenerateCodeProjectTooltip", "Generates your C++ code project in {0}."), ShortIDEName)
);
}
// @hack GDC: this should be moved somewhere else and be less hacky
ITargetPlatform* RunningTargetPlatform = GetTargetPlatformManager()->GetRunningTargetPlatform();
if (RunningTargetPlatform != nullptr)
{
const FName CookedPlatformName = *(RunningTargetPlatform->PlatformName() + TEXT("NoEditor"));
const FText CookedPlatformText = FText::FromString(RunningTargetPlatform->PlatformName());
FUIAction Action(
FExecuteAction::CreateStatic(&FMainFrameActionCallbacks::CookContent, CookedPlatformName),
FCanExecuteAction::CreateStatic(&FMainFrameActionCallbacks::CookContentCanExecute, CookedPlatformName)
);
MenuBuilder.AddMenuEntry(
FText::Format(LOCTEXT("CookContentForPlatform", "Cook Content for {0}"), CookedPlatformText),
FText::Format(LOCTEXT("CookContentForPlatformTooltip", "Cook your game content for debugging on the {0} platform"), CookedPlatformText),
FSlateIcon(),
Action
);
}
}
MenuBuilder.EndSection();
}
static void FillRecentFileAndExitMenuItems( FMenuBuilder& MenuBuilder )
{
MenuBuilder.BeginSection("FileRecentFiles");
{
if (GetDefault<UEditorStyleSettings>()->bShowProjectMenus && FMainFrameActionCallbacks::ProjectNames.Num() > 0)
{
MenuBuilder.AddSubMenu(
LOCTEXT("SwitchProjectSubMenu", "Recent Projects"),
LOCTEXT("SwitchProjectSubMenu_ToolTip", "Select a project to switch to"),
FNewMenuDelegate::CreateStatic(&FRecentProjectsMenu::MakeMenu), false, FSlateIcon(FEditorStyle::GetStyleSetName(), "MainFrame.RecentProjects")
);
}
}
MenuBuilder.EndSection();
#if !PLATFORM_MAC // Handled by app's menu in menu bar
MenuBuilder.AddMenuSeparator();
MenuBuilder.AddMenuEntry( FMainFrameCommands::Get().Exit, "Exit" );
#endif
}
};
FExtensibilityManager ExtensibilityManager;
ExtensibilityManager.AddExtender( UserExtender );
{
TSharedRef< FExtender > Extender( new FExtender() );
IMainFrameModule& MainFrameModule = FModuleManager::GetModuleChecked<IMainFrameModule>("MainFrame");
if (GetDefault<UEditorStyleSettings>()->bShowProjectMenus)
{
Extender->AddMenuExtension(
"FileLoadAndSave",
EExtensionHook::After,
MainFrameModule.GetMainFrameCommandBindings(),
FMenuExtensionDelegate::CreateStatic(&Local::FillProjectMenuItems));
}
Extender->AddMenuExtension(
"FileLoadAndSave",
EExtensionHook::After,
MainFrameModule.GetMainFrameCommandBindings(),
FMenuExtensionDelegate::CreateStatic( &Local::FillRecentFileAndExitMenuItems ) );
ExtensibilityManager.AddExtender( Extender );
}
TSharedRef< SWidget > MenuBarWidget = FMainMenu::MakeMainMenu( TabManager, ExtensibilityManager.GetAllExtenders().ToSharedRef() );
return MenuBarWidget;
}
#undef LOCTEXT_NAMESPACE