本文整理汇总了C++中FMenuBuilder::PushCommandList方法的典型用法代码示例。如果您正苦于以下问题:C++ FMenuBuilder::PushCommandList方法的具体用法?C++ FMenuBuilder::PushCommandList怎么用?C++ FMenuBuilder::PushCommandList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FMenuBuilder
的用法示例。
在下文中一共展示了FMenuBuilder::PushCommandList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Apply
void FExtender::Apply( FName ExtensionHook, EExtensionHook::Position HookPosition, FMenuBuilder& MenuBuilder ) const
{
for( auto ExtensionIt( Extensions.CreateConstIterator() ); ExtensionIt; ++ExtensionIt )
{
const auto& Extension = *ExtensionIt;
if( Extension->GetType() == EExtensionType::Menu && Extension->Hook == ExtensionHook && Extension->HookPosition == HookPosition )
{
const auto& MenuExtension = StaticCastSharedPtr< const FMenuExtension >( Extension );
if ( Extension->CommandList.IsValid() )
{
// Push the command list needed for this extension's menu items
MenuBuilder.PushCommandList( Extension->CommandList.ToSharedRef() );
}
// Extend the menu!
MenuExtension->MenuExtensionDelegate.ExecuteIfBound( MenuBuilder );
if ( Extension->CommandList.IsValid() )
{
// Restore the original command list
MenuBuilder.PopCommandList();
}
}
}
}
示例2: CreateMenuEntry
void FToolBarButtonBlock::CreateMenuEntry(FMenuBuilder& MenuBuilder) const
{
TSharedPtr<const FUICommandInfo> MenuEntryAction = GetAction();
TSharedPtr<const FUICommandList> MenuEntryActionList = GetActionList();
if (MenuEntryAction.IsValid() && MenuEntryActionList.IsValid())
{
MenuBuilder.PushCommandList(MenuEntryActionList.ToSharedRef());
MenuBuilder.AddMenuEntry(MenuEntryAction);
MenuBuilder.PopCommandList();
}
else if ( LabelOverride.IsSet() )
{
const FUIAction& DirectAction = GetDirectActions();
MenuBuilder.AddMenuEntry( LabelOverride.Get(), ToolTipOverride.Get(), IconOverride.Get(), DirectAction );
}
}
示例3: FillMenu
void FLevelEditorContextMenu::FillMenu( FMenuBuilder& MenuBuilder, TWeakPtr<SLevelEditor> LevelEditor, LevelEditorMenuContext ContextType, TSharedPtr<FExtender> Extender )
{
// Generate information about our selection
TArray<AActor*> SelectedActors;
GEditor->GetSelectedActors()->GetSelectedObjects<AActor>( SelectedActors );
FSelectedActorInfo& SelectionInfo = FLevelEditorContextMenuImpl::SelectionInfo;
SelectionInfo = AssetSelectionUtils::BuildSelectedActorInfo( SelectedActors );
// Get all menu extenders for this context menu from the level editor module
FLevelEditorModule& LevelEditorModule = FModuleManager::GetModuleChecked<FLevelEditorModule>( TEXT("LevelEditor") );
TArray<FLevelEditorModule::FLevelViewportMenuExtender_SelectedActors> MenuExtenderDelegates = LevelEditorModule.GetAllLevelViewportContextMenuExtenders();
TArray<TSharedPtr<FExtender>> Extenders;
if(Extender.IsValid())
{
Extenders.Add(Extender);
}
auto LevelEditorActions = LevelEditor.Pin()->GetLevelEditorActions().ToSharedRef();
for (int32 i = 0; i < MenuExtenderDelegates.Num(); ++i)
{
if (MenuExtenderDelegates[i].IsBound())
{
Extenders.Add(MenuExtenderDelegates[i].Execute(LevelEditorActions, SelectedActors));
}
}
MenuBuilder.PushCommandList(LevelEditorActions);
MenuBuilder.PushExtender(FExtender::Combine(Extenders).ToSharedRef());
TArray<TWeakObjectPtr<UObject>> LabelObjects;
for ( FSelectionIterator SelItor(*GEditor->GetSelectedActors()) ; SelItor ; ++SelItor )
{
LabelObjects.Add(*SelItor);
}
// Check if current selection has any assets that can be browsed to
TArray< UObject* > ReferencedAssets;
GEditor->GetReferencedAssetsForEditorSelection( ReferencedAssets );
const bool bCanSyncToContentBrowser = GEditor->CanSyncToContentBrowser();
if( bCanSyncToContentBrowser || ReferencedAssets.Num() > 0 )
{
MenuBuilder.BeginSection("ActorAsset", LOCTEXT("AssetHeading", "Asset") );
{
if( bCanSyncToContentBrowser )
{
MenuBuilder.AddMenuEntry( FGlobalEditorCommonCommands::Get().FindInContentBrowser );
}
if( ReferencedAssets.Num() == 1 )
{
auto Asset = ReferencedAssets[0];
MenuBuilder.AddMenuEntry(
FLevelEditorCommands::Get().EditAsset,
NAME_None,
FText::Format( LOCTEXT("EditAssociatedAsset", "Edit {0}"), FText::FromString( Asset->GetName() ) ),
TAttribute<FText>(),
FSlateIcon( FEditorStyle::GetStyleSetName(), FClassIconFinder::FindIconNameForClass( Asset->GetClass() ) )
);
}
else if ( ReferencedAssets.Num() > 1 )
{
MenuBuilder.AddMenuEntry(
FLevelEditorCommands::Get().EditAssetNoConfirmMultiple,
NAME_None,
LOCTEXT("EditAssociatedAssetsMultiple", "Edit Multiple Assets"),
TAttribute<FText>(),
FSlateIcon( FEditorStyle::GetStyleSetName(), "ClassIcon.Default" )
);
}
MenuBuilder.AddMenuEntry( FGlobalEditorCommonCommands::Get().ViewReferences );
}
MenuBuilder.EndSection();
}
MenuBuilder.BeginSection( "ActorControl", LOCTEXT("ActorHeading", "Actor") );
{
MenuBuilder.AddMenuEntry( FEditorViewportCommands::Get().FocusViewportToSelection );
MenuBuilder.AddMenuEntry( FLevelEditorCommands::Get().SnapCameraToActor );
}
MenuBuilder.EndSection();
// Go to C++ Code
if( SelectionInfo.SelectionClass != NULL )
{
if ( FSourceCodeNavigation::IsCompilerAvailable())
{
FString ClassHeaderPath;
if( FSourceCodeNavigation::FindClassHeaderPath( SelectionInfo.SelectionClass, ClassHeaderPath ) && IFileManager::Get().FileSize( *ClassHeaderPath ) != INDEX_NONE )
{
const FString CodeFileName = FPaths::GetCleanFilename( *ClassHeaderPath );
//.........这里部分代码省略.........