本文整理汇总了C++中FMenuBuilder::BeginSection方法的典型用法代码示例。如果您正苦于以下问题:C++ FMenuBuilder::BeginSection方法的具体用法?C++ FMenuBuilder::BeginSection怎么用?C++ FMenuBuilder::BeginSection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FMenuBuilder
的用法示例。
在下文中一共展示了FMenuBuilder::BeginSection方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildContextMenu
void FSequencerObjectBindingNode::BuildContextMenu(FMenuBuilder& MenuBuilder)
{
ISequencerModule& SequencerModule = FModuleManager::GetModuleChecked<ISequencerModule>("Sequencer");
UObject* BoundObject = GetSequencer().FindSpawnedObjectOrTemplate(ObjectBinding);
TSharedRef<FUICommandList> CommandList(new FUICommandList);
TSharedPtr<FExtender> Extender = SequencerModule.GetObjectBindingContextMenuExtensibilityManager()->GetAllExtenders(CommandList, TArrayBuilder<UObject*>().Add(BoundObject));
if (Extender.IsValid())
{
MenuBuilder.PushExtender(Extender.ToSharedRef());
}
if (GetSequencer().IsLevelEditorSequencer())
{
UMovieScene* MovieScene = GetSequencer().GetFocusedMovieSceneSequence()->GetMovieScene();
FMovieSceneSpawnable* Spawnable = MovieScene->FindSpawnable(ObjectBinding);
if (Spawnable)
{
MenuBuilder.AddSubMenu(
LOCTEXT("OwnerLabel", "Spawned Object Owner"),
LOCTEXT("OwnerTooltip", "Specifies how the spawned object is to be owned"),
FNewMenuDelegate::CreateSP(this, &FSequencerObjectBindingNode::AddSpawnOwnershipMenu)
);
MenuBuilder.AddMenuEntry( FSequencerCommands::Get().ConvertToPossessable );
}
else
{
const UClass* ObjectClass = GetClassForObjectBinding();
if (ObjectClass->IsChildOf(AActor::StaticClass()))
{
FFormatNamedArguments Args;
MenuBuilder.AddSubMenu(
FText::Format( LOCTEXT("Assign Actor ", "Assign Actor"), Args),
FText::Format( LOCTEXT("AssignActorTooltip", "Assign an actor to this track"), Args ),
FNewMenuDelegate::CreateRaw(&GetSequencer(), &FSequencer::AssignActor, ObjectBinding));
}
MenuBuilder.AddMenuEntry( FSequencerCommands::Get().ConvertToSpawnable );
}
MenuBuilder.AddMenuEntry(
LOCTEXT("Import FBX", "Import..."),
LOCTEXT("ImportFBXTooltip", "Import FBX animation to this object"),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateLambda([=]{ GetSequencer().ImportFBX(); })
));
MenuBuilder.AddMenuEntry(
LOCTEXT("Export FBX", "Export..."),
LOCTEXT("ExportFBXTooltip", "Export FBX animation from this object"),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateLambda([=]{ GetSequencer().ExportFBX(); })
));
MenuBuilder.BeginSection("Organize", LOCTEXT("OrganizeContextMenuSectionName", "Organize"));
{
MenuBuilder.AddSubMenu(
LOCTEXT("LabelsSubMenuText", "Labels"),
LOCTEXT("LabelsSubMenuTip", "Add or remove labels on this track"),
FNewMenuDelegate::CreateSP(this, &FSequencerObjectBindingNode::HandleLabelsSubMenuCreate)
);
}
MenuBuilder.EndSection();
}
FSequencerDisplayNode::BuildContextMenu(MenuBuilder);
}
示例2: FillProjectMenuItems
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();
}
示例3: FillEditMenu
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"))
);
MenuBuilder.AddSubMenu(
LOCTEXT("ProjectSettingsSubMenuLabel", "Project Settings"),
LOCTEXT("ProjectSettingsSubMenuToolTip", "Change the settings of the currently loaded project"),
FNewMenuDelegate::CreateStatic(&FSettingsMenu::MakeMenu, FName("Project"))
);
}
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(),
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(),
FUIAction(FExecuteAction::CreateStatic(&FSettingsMenu::OpenSettings, FName("Project"), FName("Project"), FName("General")))
);
}
}
MenuBuilder.EndSection();
//.........这里部分代码省略.........
示例4: BuildHierarchyMenu
void FStreamingLevelCollectionModel::BuildHierarchyMenu(FMenuBuilder& InMenuBuilder) const
{
const FLevelCollectionCommands& Commands = FLevelCollectionCommands::Get();
// We show the "level missing" commands, when missing level is selected solely
if (IsOneLevelSelected() && InvalidSelectedLevels.Num() == 1)
{
InMenuBuilder.BeginSection("MissingLevel", LOCTEXT("ViewHeaderRemove", "Missing Level") );
{
InMenuBuilder.AddMenuEntry( Commands.FixUpInvalidReference );
InMenuBuilder.AddMenuEntry( Commands.RemoveInvalidReference );
}
InMenuBuilder.EndSection();
}
// Add common commands
InMenuBuilder.BeginSection("Levels", LOCTEXT("LevelsHeader", "Levels") );
{
// Make level current
if (IsOneLevelSelected())
{
InMenuBuilder.AddMenuEntry( Commands.World_MakeLevelCurrent );
}
// Visibility commands
InMenuBuilder.AddSubMenu(
LOCTEXT("VisibilityHeader", "Visibility"),
LOCTEXT("VisibilitySubMenu_ToolTip", "Selected Level(s) visibility commands"),
FNewMenuDelegate::CreateSP(this, &FStreamingLevelCollectionModel::FillVisibilitySubMenu ) );
// Lock commands
InMenuBuilder.AddSubMenu(
LOCTEXT("LockHeader", "Lock"),
LOCTEXT("LockSubMenu_ToolTip", "Selected Level(s) lock commands"),
FNewMenuDelegate::CreateSP(this, &FStreamingLevelCollectionModel::FillLockSubMenu ) );
// Level streaming specific commands
if (AreAnyLevelsSelected() && !(IsOneLevelSelected() && GetSelectedLevels()[0]->IsPersistent()))
{
InMenuBuilder.AddMenuEntry(Commands.World_RemoveSelectedLevels);
//
InMenuBuilder.AddSubMenu(
LOCTEXT("LevelsChangeStreamingMethod", "Change Streaming Method"),
LOCTEXT("LevelsChangeStreamingMethod_Tooltip", "Changes the streaming method for the selected levels"),
FNewMenuDelegate::CreateRaw(this, &FStreamingLevelCollectionModel::FillSetStreamingMethodSubMenu ));
}
}
InMenuBuilder.EndSection();
// Level selection commands
InMenuBuilder.BeginSection("LevelsSelection", LOCTEXT("SelectionHeader", "Selection") );
{
InMenuBuilder.AddMenuEntry( Commands.SelectAllLevels );
InMenuBuilder.AddMenuEntry( Commands.DeselectAllLevels );
InMenuBuilder.AddMenuEntry( Commands.InvertLevelSelection );
}
InMenuBuilder.EndSection();
// Level actors selection commands
InMenuBuilder.BeginSection("Actors", LOCTEXT("ActorsHeader", "Actors") );
{
InMenuBuilder.AddMenuEntry( Commands.AddsActors );
InMenuBuilder.AddMenuEntry( Commands.RemovesActors );
// Move selected actors to a selected level
if (IsOneLevelSelected())
{
InMenuBuilder.AddMenuEntry( Commands.MoveActorsToSelected );
InMenuBuilder.AddMenuEntry( Commands.MoveFoliageToSelected );
}
if (AreAnyLevelsSelected() && !(IsOneLevelSelected() && SelectedLevelsList[0]->IsPersistent()))
{
InMenuBuilder.AddMenuEntry( Commands.SelectStreamingVolumes );
}
}
InMenuBuilder.EndSection();
}
示例5: FillWindowMenu
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))
);
//@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();
{
// 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 bMessagingDebugger = GetDefault<UEditorExperimentalSettings>()->bMessagingDebugger;
bool bBlutility = GetDefault<UEditorExperimentalSettings>()->bEnableEditorUtilityBlueprints;
bool bLocalizationDashboard = GetDefault<UEditorExperimentalSettings>()->bEnableLocalizationDashboard;
bool bTranslationPicker = GetDefault<UEditorExperimentalSettings>()->bEnableTranslationPicker;
bool bMergeActors = GetDefault<UEditorExperimentalSettings>()->bActorMerging;
// Make sure at least one is enabled before creating the section
if (bMessagingDebugger || bBlutility || bLocalizationDashboard || bTranslationPicker || bMergeActors)
{
MenuBuilder.BeginSection("ExperimentalTabSpawners", LOCTEXT("ExperimentalTabSpawnersHeading", "Experimental"));
{
// Messaging Debugger
if (bMessagingDebugger)
{
MenuBuilder.AddMenuEntry(
LOCTEXT("MessagingDebuggerLabel", "Messaging Debugger"),
LOCTEXT("MessagingDebuggerToolTip", "The Messaging Debugger provides a visual utility for debugging the messaging system."),
FSlateIcon(), // Icon lives in the plugin dir for the debugger
FUIAction(FExecuteAction::CreateStatic(&FMainMenu::OpenMessagingDebugger))
);
}
// 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))
);
}
}
MenuBuilder.EndSection();
//.........这里部分代码省略.........
示例6: FillBlueprintOptions
/**
* Fills the Blueprint menu with extra options
*/
void FillBlueprintOptions(FMenuBuilder& MenuBuilder, TArray<AActor*> SelectedActors)
{
// Gather Blueprint classes for this actor
TArray< FMenuBlueprintClass > BlueprintClasses;
GatherBlueprintsForActors( SelectedActors, BlueprintClasses );
MenuBuilder.BeginSection("ActorBlueprint", LOCTEXT("BlueprintsHeading", "Blueprints") );
// Adds the "Create Blueprint..." menu option if valid.
{
int NumBlueprintableActors = 0;
bool IsBlueprintBased = BlueprintClasses.Num() > 1;
if(!BlueprintClasses.Num())
{
for(auto It(SelectedActors.CreateIterator());It;++It)
{
AActor* Actor = *It;
if( FKismetEditorUtilities::CanCreateBlueprintOfClass(Actor->GetClass()))
{
NumBlueprintableActors++;
}
}
}
const bool bCanHarvestComponentsForBlueprint = (!IsBlueprintBased && (NumBlueprintableActors > 0));
if(bCanHarvestComponentsForBlueprint)
{
AActor* ActorOverride = nullptr;
FUIAction CreateBlueprintAction( FExecuteAction::CreateStatic( &FCreateBlueprintFromActorDialog::OpenDialog, true, ActorOverride ) );
MenuBuilder.AddMenuEntry(LOCTEXT("CreateBlueprint", "Create Blueprint..."), LOCTEXT("CreateBlueprint_Tooltip", "Harvest Components from Selected Actors and create Blueprint"), FSlateIcon(FEditorStyle::GetStyleSetName(), "Kismet.HarvestBlueprintFromActors"), CreateBlueprintAction);
}
}
// Check to see if we have any classes with functions to display
if( BlueprintClasses.Num() > 0 )
{
{
UBlueprint* FirstBlueprint = Cast<UBlueprint>(BlueprintClasses[0].Blueprint.Get());
// Determine if the selected objects that have blueprints are all of the same class, and if they are all up to date
bool bAllAreSameType = true;
bool bAreAnyNotUpToDate = false;
for (int32 ClassIndex = 0; ClassIndex < BlueprintClasses.Num(); ++ClassIndex)
{
UBlueprint* CurrentBlueprint = Cast<UBlueprint>(BlueprintClasses[ClassIndex].Blueprint.Get());
bAllAreSameType = bAllAreSameType && (CurrentBlueprint == FirstBlueprint);
if (CurrentBlueprint != NULL)
{
bAreAnyNotUpToDate |= !CurrentBlueprint->IsUpToDate();
}
}
// For a single selected class, we show a top level item (saves 2 clicks); otherwise we show the full hierarchy
if (bAllAreSameType && (FirstBlueprint != NULL))
{
// Shortcut to edit the blueprint directly, saves two clicks
FUIAction UIAction;
UIAction.ExecuteAction.BindStatic(
&EditKismetCodeFor,
/*Blueprint=*/ TWeakObjectPtr<UBlueprint>(FirstBlueprint) );
const FText Label = LOCTEXT("EditBlueprint", "Edit Blueprint");
const FText Description = FText::Format( LOCTEXT("EditBlueprint_ToolTip", "Opens {0} in the Blueprint editor"), FText::FromString( FirstBlueprint->GetName() ) );
MenuBuilder.AddMenuEntry( Label, Description, FSlateIcon(), UIAction );
}
else
{
// More than one type of blueprint is selected, so add a sub-menu for "Edit Kismet Code"
MenuBuilder.AddSubMenu(
LOCTEXT("EditBlueprintSubMenu", "Edit Blueprint"),
LOCTEXT("EditBlueprintSubMenu_ToolTip", "Shows Blueprints that can be opened for editing"),
FNewMenuDelegate::CreateStatic( &FillEditCodeMenu, BlueprintClasses ) );
}
// For any that aren't up to date, we offer a compile blueprints button
if (bAreAnyNotUpToDate)
{
// Shortcut to edit the blueprint directly, saves two clicks
FUIAction UIAction;
UIAction.ExecuteAction.BindStatic(&RecompileOutOfDateKismetForSelection);
const FText Label = LOCTEXT("CompileOutOfDateBPs", "Compile Out-of-Date Blueprints");
const FText Description = LOCTEXT("CompileOutOfDateBPs_ToolTip", "Compiles out-of-date blueprints for selected actors");
MenuBuilder.AddMenuEntry( Label, Description, FSlateIcon(), UIAction );
}
}
}
MenuBuilder.EndSection();
}
示例7: MakePathViewContextMenu
void FPathContextMenu::MakePathViewContextMenu(FMenuBuilder& MenuBuilder)
{
int32 NumAssetPaths, NumClassPaths;
ContentBrowserUtils::CountPathTypes(SelectedPaths, NumAssetPaths, NumClassPaths);
// Only add something if at least one folder is selected
if ( SelectedPaths.Num() > 0 )
{
const bool bHasAssetPaths = NumAssetPaths > 0;
const bool bHasClassPaths = NumClassPaths > 0;
// Common operations section //
MenuBuilder.BeginSection("PathViewFolderOptions", LOCTEXT("PathViewOptionsMenuHeading", "Folder Options") );
{
if(bHasAssetPaths)
{
FText NewAssetToolTip;
if(SelectedPaths.Num() == 1)
{
if(CanCreateAsset())
{
NewAssetToolTip = FText::Format(LOCTEXT("NewAssetTooltip_CreateIn", "Create a new asset in {0}."), FText::FromString(SelectedPaths[0]));
}
else
{
NewAssetToolTip = FText::Format(LOCTEXT("NewAssetTooltip_InvalidPath", "Cannot create new assets in {0}."), FText::FromString(SelectedPaths[0]));
}
}
else
{
NewAssetToolTip = LOCTEXT("NewAssetTooltip_InvalidNumberOfPaths", "Can only create assets when there is a single path selected.");
}
// New Asset (submenu)
MenuBuilder.AddSubMenu(
LOCTEXT( "NewAssetLabel", "New Asset" ),
NewAssetToolTip,
FNewMenuDelegate::CreateRaw( this, &FPathContextMenu::MakeNewAssetSubMenu ),
FUIAction(
FExecuteAction(),
FCanExecuteAction::CreateRaw( this, &FPathContextMenu::CanCreateAsset )
),
NAME_None,
EUserInterfaceActionType::Button,
false,
FSlateIcon()
);
}
if(bHasClassPaths)
{
FText NewClassToolTip;
if(SelectedPaths.Num() == 1)
{
if(CanCreateClass())
{
NewClassToolTip = FText::Format(LOCTEXT("NewClassTooltip_CreateIn", "Create a new class in {0}."), FText::FromString(SelectedPaths[0]));
}
else
{
NewClassToolTip = FText::Format(LOCTEXT("NewClassTooltip_InvalidPath", "Cannot create new classes in {0}."), FText::FromString(SelectedPaths[0]));
}
}
else
{
NewClassToolTip = LOCTEXT("NewClassTooltip_InvalidNumberOfPaths", "Can only create classes when there is a single path selected.");
}
// New Class
MenuBuilder.AddMenuEntry(
LOCTEXT("NewClassLabel", "New C++ Class..."),
NewClassToolTip,
FSlateIcon(FEditorStyle::GetStyleSetName(), "MainFrame.AddCodeToProject"),
FUIAction(
FExecuteAction::CreateRaw( this, &FPathContextMenu::ExecuteCreateClass ),
FCanExecuteAction::CreateRaw( this, &FPathContextMenu::CanCreateClass )
)
);
}
// Explore
MenuBuilder.AddMenuEntry(
ContentBrowserUtils::GetExploreFolderText(),
LOCTEXT("ExploreTooltip", "Finds this folder on disk."),
FSlateIcon(),
FUIAction( FExecuteAction::CreateSP( this, &FPathContextMenu::ExecuteExplore ) )
);
MenuBuilder.AddMenuEntry(FGenericCommands::Get().Rename, NAME_None,
LOCTEXT("RenameFolder", "Rename"),
LOCTEXT("RenameFolderTooltip", "Rename the selected folder.")
);
// If any colors have already been set, display color options as a sub menu
if ( ContentBrowserUtils::HasCustomColors() )
{
// Set Color (submenu)
MenuBuilder.AddSubMenu(
LOCTEXT("SetColor", "Set Color"),
LOCTEXT("SetColorTooltip", "Sets the color this folder should appear as."),
//.........这里部分代码省略.........
示例8: AddSourceControlMenuOptions
bool FAssetContextMenu::AddSourceControlMenuOptions(FMenuBuilder& MenuBuilder)
{
MenuBuilder.BeginSection("AssetContextSourceControl", LOCTEXT("AssetSCCOptionsMenuHeading", "Source Control"));
if ( ISourceControlModule::Get().IsEnabled() )
{
if( CanExecuteSCCSync() )
{
MenuBuilder.AddMenuEntry(
LOCTEXT("SCCSync", "Sync"),
LOCTEXT("SCCSyncTooltip", "Updates the item to the latest version in source control."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCSync ),
FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCSync )
)
);
}
if ( CanExecuteSCCCheckOut() )
{
MenuBuilder.AddMenuEntry(
LOCTEXT("SCCCheckOut", "Check Out"),
LOCTEXT("SCCCheckOutTooltip", "Checks out the selected asset from source control."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCCheckOut ),
FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCCheckOut )
)
);
}
if ( CanExecuteSCCOpenForAdd() )
{
MenuBuilder.AddMenuEntry(
LOCTEXT("SCCOpenForAdd", "Mark For Add"),
LOCTEXT("SCCOpenForAddTooltip", "Adds the selected asset to source control."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCOpenForAdd ),
FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCOpenForAdd )
)
);
}
if ( CanExecuteSCCCheckIn() )
{
MenuBuilder.AddMenuEntry(
LOCTEXT("SCCCheckIn", "Check In"),
LOCTEXT("SCCCheckInTooltip", "Checks in the selected asset to source control."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCCheckIn ),
FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCCheckIn )
)
);
}
MenuBuilder.AddMenuEntry(
LOCTEXT("SCCRefresh", "Refresh"),
LOCTEXT("SCCRefreshTooltip", "Updates the source control status of the asset."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCRefresh ),
FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCRefresh )
)
);
if( CanExecuteSCCHistory() )
{
MenuBuilder.AddMenuEntry(
LOCTEXT("SCCHistory", "History"),
LOCTEXT("SCCHistoryTooltip", "Displays the source control revision history of the selected asset."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCHistory ),
FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCHistory )
)
);
MenuBuilder.AddMenuEntry(
LOCTEXT("SCCDiffAgainstDepot", "Diff Against Depot"),
LOCTEXT("SCCDiffAgainstDepotTooltip", "Look at differences between your version of the asset and that in source control."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCDiffAgainstDepot ),
FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCDiffAgainstDepot )
)
);
}
if( CanExecuteSCCRevert() )
{
MenuBuilder.AddMenuEntry(
LOCTEXT("SCCRevert", "Revert"),
LOCTEXT("SCCRevertTooltip", "Reverts the asset to the state it was before it was checked out."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSCCRevert ),
FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSCCRevert )
//.........这里部分代码省略.........
示例9: AddCommonMenuOptions
bool FAssetContextMenu::AddCommonMenuOptions(FMenuBuilder& MenuBuilder)
{
MenuBuilder.BeginSection("AssetContextActions", LOCTEXT("AssetActionsMenuHeading", "Asset Actions"));
{
MenuBuilder.AddMenuEntry(
LOCTEXT("SyncToAssetTree", "Find in Asset Tree"),
LOCTEXT("SyncToAssetTreeTooltip", "Selects the folder in the asset tree containing this asset."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteSyncToAssetTree ),
FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteSyncToAssetTree )
)
);
MenuBuilder.AddMenuEntry(
LOCTEXT("FindAssetInWorld", "Select Actors Using This Asset"),
LOCTEXT("FindAssetInWorldTooltip", "Selects all actors referencing this asset."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteFindAssetInWorld ),
FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteFindAssetInWorld )
)
);
MenuBuilder.AddMenuEntry(
LOCTEXT("Properties", "Details..."),
LOCTEXT("PropertiesTooltip", "Opens the details for the selected assets."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteProperties ),
FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteProperties )
)
);
MenuBuilder.AddMenuEntry(
LOCTEXT("PropertyMatrix", "Property Matrix..."),
LOCTEXT("PropertyMatrixTooltip", "Opens the property matrix editor for the selected assets."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecutePropertyMatrix ),
FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteProperties )
)
);
MenuBuilder.AddMenuEntry(
LOCTEXT("Duplicate", "Create Copy"),
LOCTEXT("DuplicateTooltip", "Create a copy of the selected assets."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteDuplicate ),
FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteDuplicate )
)
);
if ( SelectedAssets.Num() == 1 )
{
MenuBuilder.AddMenuEntry( FGenericCommands::Get().Rename, NAME_None,
LOCTEXT("Rename", "Rename"),
LOCTEXT("RenameTooltip", "Rename the selected asset.")
);
}
MenuBuilder.AddMenuEntry( FGenericCommands::Get().Delete, NAME_None,
LOCTEXT("Delete", "Delete"),
LOCTEXT("DeleteTooltip", "Delete the selected assets.")
);
if ( CanExecuteConsolidate() )
{
MenuBuilder.AddMenuEntry(
LOCTEXT("Consolidate", "Consolidate"),
LOCTEXT("ConsolidateTooltip", "Consolidate the selected assets into one."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteConsolidate )
)
);
}
MenuBuilder.AddMenuEntry(
LOCTEXT("Export", "Export..."),
LOCTEXT("ExportTooltip", "Export the selected assets to file."),
FSlateIcon(),
FUIAction( FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteExport ) )
);
if (SelectedAssets.Num() > 1)
{
MenuBuilder.AddMenuEntry(
LOCTEXT("BulkExport", "Bulk Export..."),
LOCTEXT("BulkExportTooltip", "Export the selected assets to file in the selected directory"),
FSlateIcon(),
FUIAction( FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteBulkExport ) )
);
}
MenuBuilder.AddMenuEntry(
LOCTEXT("MigrateAsset", "Migrate..."),
LOCTEXT("MigrateAssetTooltip", "Copies all selected assets and their dependencies to another game"),
FSlateIcon(),
//.........这里部分代码省略.........
示例10: MakeLightingResolutionMenu
/** Generates a lighting resolution sub-menu */
static void MakeLightingResolutionMenu( FMenuBuilder& InMenuBuilder )
{
InMenuBuilder.BeginSection("LevelEditorBuildLightingResolution1", LOCTEXT( "LightingResolutionHeading1", "Primitive Types" ) );
{
TSharedRef<SWidget> Meshes = SNew(SHorizontalBox)
+SHorizontalBox::Slot()
.AutoWidth()
[
SNew( SCheckBox )
.Style( FEditorStyle::Get(), "Menu.CheckBox" )
.ToolTipText(LOCTEXT( "StaticMeshesToolTip", "Static Meshes will be adjusted if checked." ))
.IsChecked_Static(&FLevelEditorActionCallbacks::IsLightingResolutionStaticMeshesChecked)
.OnCheckStateChanged_Static(&FLevelEditorActionCallbacks::SetLightingResolutionStaticMeshes)
.Content()
[
SNew( STextBlock )
.Text( LOCTEXT("StaticMeshes", "Static Meshes") )
]
]
+SHorizontalBox::Slot()
.AutoWidth()
.Padding( FMargin( 4.0f, 0.0f, 11.0f, 0.0f ) )
[
SNew(SSpinBox<float>)
.MinValue(4.f)
.MaxValue(4096.f)
.ToolTipText(LOCTEXT( "LightingResolutionStaticMeshesMinToolTip", "The minimum lightmap resolution for static mesh adjustments. Anything outside of Min/Max range will not be touched when adjusting." ))
.Value(FLevelEditorActionCallbacks::GetLightingResolutionMinSMs())
.OnValueChanged_Static(&FLevelEditorActionCallbacks::SetLightingResolutionMinSMs)
]
+SHorizontalBox::Slot()
.AutoWidth()
[
SNew(SSpinBox<float>)
.MinValue(4.f)
.MaxValue(4096.f)
.ToolTipText(LOCTEXT( "LightingResolutionStaticMeshesMaxToolTip", "The maximum lightmap resolution for static mesh adjustments. Anything outside of Min/Max range will not be touched when adjusting." ))
.Value(FLevelEditorActionCallbacks::GetLightingResolutionMaxSMs())
.OnValueChanged_Static(&FLevelEditorActionCallbacks::SetLightingResolutionMaxSMs)
];
InMenuBuilder.AddWidget(Meshes, FText::GetEmpty(), true);
TSharedRef<SWidget> BSPs = SNew(SHorizontalBox)
+SHorizontalBox::Slot()
.AutoWidth()
[
SNew( SCheckBox )
.Style(FEditorStyle::Get(), "Menu.CheckBox")
.ToolTipText(LOCTEXT( "BSPSurfacesToolTip", "BSP Surfaces will be adjusted if checked." ))
.IsChecked_Static(&FLevelEditorActionCallbacks::IsLightingResolutionBSPSurfacesChecked)
.OnCheckStateChanged_Static(&FLevelEditorActionCallbacks::SetLightingResolutionBSPSurfaces)
.Content()
[
SNew( STextBlock )
.Text( LOCTEXT("BSPSurfaces", "BSP Surfaces") )
]
]
+SHorizontalBox::Slot()
.AutoWidth()
.Padding( FMargin( 6.0f, 0.0f, 4.0f, 0.0f ) )
[
SNew(SSpinBox<float>)
.MinValue(1.f)
.MaxValue(63556.f)
.ToolTipText(LOCTEXT( "LightingResolutionBSPsMinToolTip", "The minimum lightmap resolution of a BSP surface to adjust. When outside of the Min/Max range, the BSP surface will no be altered." ))
.Value(FLevelEditorActionCallbacks::GetLightingResolutionMinBSPs())
.OnValueChanged_Static(&FLevelEditorActionCallbacks::SetLightingResolutionMinBSPs)
]
+SHorizontalBox::Slot()
.AutoWidth()
[
SNew(SSpinBox<float>)
.MinValue(1.f)
.MaxValue(63556.f)
.ToolTipText(LOCTEXT( "LightingResolutionBSPsMaxToolTip", "The maximum lightmap resolution of a BSP surface to adjust. When outside of the Min/Max range, the BSP surface will no be altered." ))
.Value(FLevelEditorActionCallbacks::GetLightingResolutionMaxBSPs())
.OnValueChanged_Static(&FLevelEditorActionCallbacks::SetLightingResolutionMaxBSPs)
];
InMenuBuilder.AddWidget(BSPs, FText::GetEmpty(), true);
}
InMenuBuilder.EndSection(); //LevelEditorBuildLightingResolution1
InMenuBuilder.BeginSection("LevelEditorBuildLightingResolution2", LOCTEXT( "LightingResolutionHeading2", "Select Options" ) );
{
InMenuBuilder.AddMenuEntry( FLevelEditorCommands::Get().LightingResolution_CurrentLevel );
InMenuBuilder.AddMenuEntry( FLevelEditorCommands::Get().LightingResolution_SelectedLevels );
InMenuBuilder.AddMenuEntry( FLevelEditorCommands::Get().LightingResolution_AllLoadedLevels );
InMenuBuilder.AddMenuEntry( FLevelEditorCommands::Get().LightingResolution_SelectedObjectsOnly );
}
InMenuBuilder.EndSection();
InMenuBuilder.BeginSection("LevelEditorBuildLightingResolution3", LOCTEXT( "LightingResolutionHeading3", "Ratio" ) );
{
TSharedRef<SWidget> Ratio = SNew(SSpinBox<int32>)
.MinValue(0)
.MaxValue(400)
.ToolTipText(LOCTEXT( "LightingResolutionRatioToolTip", "Ratio to apply (New Resolution = Ratio / 100.0f * CurrentResolution)." ))
.Value(FLevelEditorActionCallbacks::GetLightingResolutionRatio())
.OnEndSliderMovement_Static(&FLevelEditorActionCallbacks::SetLightingResolutionRatio)
//.........这里部分代码省略.........