本文整理匯總了C++中FUIAction函數的典型用法代碼示例。如果您正苦於以下問題:C++ FUIAction函數的具體用法?C++ FUIAction怎麽用?C++ FUIAction使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了FUIAction函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: LOCTEXT
void FIntroTutorials::AddSummonBlueprintTutorialsMenuExtension(FMenuBuilder& MenuBuilder, UObject* PrimaryObject)
{
MenuBuilder.BeginSection("Tutorials", LOCTEXT("TutorialsLabel", "Tutorials"));
MenuBuilder.AddMenuEntry(
LOCTEXT("BlueprintMenuEntryTitle", "Blueprint Overview"),
LOCTEXT("BlueprintMenuEntryToolTip", "Opens up an introductory overview of Blueprints."),
FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.Tutorials"),
FUIAction(FExecuteAction::CreateRaw(this, &FIntroTutorials::SummonBlueprintTutorialHome, PrimaryObject, true)));
if(PrimaryObject != nullptr)
{
UBlueprint* BP = Cast<UBlueprint>(PrimaryObject);
if(BP != nullptr)
{
UEnum* Enum = FindObject<UEnum>(ANY_PACKAGE, TEXT("EBlueprintType"), true);
check(Enum);
MenuBuilder.AddMenuEntry(
FText::Format(LOCTEXT("BlueprintTutorialsMenuEntryTitle", "{0} Tutorial"), Enum->GetEnumText(BP->BlueprintType)),
LOCTEXT("BlueprintTutorialsMenuEntryToolTip", "Opens up an introductory tutorial covering this particular part of the Blueprint editor."),
FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.Tutorials"),
FUIAction(FExecuteAction::CreateRaw(this, &FIntroTutorials::SummonBlueprintTutorialHome, PrimaryObject, false)));
}
}
MenuBuilder.EndSection();
}
示例2: LOCTEXT
void FThumbnailSection::BuildSectionContextMenu(FMenuBuilder& MenuBuilder, const FGuid& ObjectBinding)
{
MenuBuilder.BeginSection(NAME_None, LOCTEXT("ViewMenuText", "View"));
{
MenuBuilder.AddSubMenu(
LOCTEXT("ThumbnailsMenu", "Thumbnails"),
FText(),
FNewMenuDelegate::CreateLambda([=](FMenuBuilder& InMenuBuilder){
TSharedPtr<ISequencer> Sequencer = SequencerPtr.Pin();
FText CurrentTime = FText::FromString(Sequencer->GetZeroPadNumericTypeInterface()->ToString(Sequencer->GetGlobalTime()));
InMenuBuilder.BeginSection(NAME_None, LOCTEXT("ThisSectionText", "This Section"));
{
InMenuBuilder.AddMenuEntry(
LOCTEXT("RefreshText", "Refresh"),
LOCTEXT("RefreshTooltip", "Refresh this section's thumbnails"),
FSlateIcon(),
FUIAction(FExecuteAction::CreateRaw(this, &FThumbnailSection::RedrawThumbnails))
);
InMenuBuilder.AddMenuEntry(
FText::Format(LOCTEXT("SetSingleTime", "Set Thumbnail Time To {0}"), CurrentTime),
LOCTEXT("SetSingleTimeTooltip", "Defines the time at which this section should draw its single thumbnail to the current cursor position"),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateLambda([=]{
SetSingleTime(Sequencer->GetGlobalTime());
GetMutableDefault<UMovieSceneUserThumbnailSettings>()->bDrawSingleThumbnails = true;
GetMutableDefault<UMovieSceneUserThumbnailSettings>()->SaveConfig();
})
)
);
}
InMenuBuilder.EndSection();
InMenuBuilder.BeginSection(NAME_None, LOCTEXT("GlobalSettingsText", "Global Settings"));
{
InMenuBuilder.AddMenuEntry(
LOCTEXT("RefreshAllText", "Refresh All"),
LOCTEXT("RefreshAllTooltip", "Refresh all sections' thumbnails"),
FSlateIcon(),
FUIAction(FExecuteAction::CreateLambda([]{
GetDefault<UMovieSceneUserThumbnailSettings>()->BroadcastRedrawThumbnails();
}))
);
FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
FDetailsViewArgs Args(false, false, false, FDetailsViewArgs::HideNameArea);
TSharedRef<IDetailsView> DetailView = PropertyModule.CreateDetailView(Args);
DetailView->SetObject(GetMutableDefault<UMovieSceneUserThumbnailSettings>());
InMenuBuilder.AddWidget(DetailView, FText(), true);
}
InMenuBuilder.EndSection();
})
);
}
MenuBuilder.EndSection();
}
示例3: LOCTEXT
void FAssetTypeActions_SoundCue::GetActions( const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder )
{
auto SoundCues = GetTypedWeakObjectPtrs<USoundCue>(InObjects);
MenuBuilder.AddMenuEntry(
LOCTEXT("SoundCue_Edit", "Edit"),
LOCTEXT("SoundCue_EditTooltip", "Opens the selected sound cues in the sound cue editor."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_SoundCue::ExecuteEdit, SoundCues ),
FCanExecuteAction()
)
);
FAssetTypeActions_SoundBase::GetActions(InObjects, MenuBuilder);
MenuBuilder.AddMenuEntry(
LOCTEXT("SoundCue_ConsolidateAttenuation", "Consolidate Attenuation"),
LOCTEXT("SoundCue_ConsolidateAttenuationTooltip", "Creates shared attenuation packages for sound cues with identical override attenuation settings."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_SoundCue::ExecuteConsolidateAttenuation, SoundCues ),
FCanExecuteAction::CreateSP( this, &FAssetTypeActions_SoundCue::CanExecuteConsolidateCommand, SoundCues )
)
);
}
示例4: NSLOCTEXT
void FAssetTypeActions_StaticMesh::GetActions( const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder )
{
auto Meshes = GetTypedWeakObjectPtrs<UStaticMesh>(InObjects);
MenuBuilder.AddMenuEntry(
NSLOCTEXT("AssetTypeActions_StaticMesh", "StaticMesh_Edit", "Edit"),
NSLOCTEXT("AssetTypeActions_StaticMesh", "StaticMesh_EditTooltip", "Opens the selected meshes in the static mesh editor."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_StaticMesh::ExecuteEdit, Meshes ),
FCanExecuteAction()
)
);
MenuBuilder.AddMenuEntry(
NSLOCTEXT("AssetTypeActions_StaticMesh", "StaticMesh_Reimport", "Reimport"),
NSLOCTEXT("AssetTypeActions_StaticMesh", "StaticMesh_ReimportTooltip", "Reimports the selected meshes from file."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_StaticMesh::ExecuteReimport, Meshes ),
FCanExecuteAction()
)
);
MenuBuilder.AddSubMenu(
NSLOCTEXT("AssetTypeActions_StaticMesh", "StaticMesh_ImportLOD", "ImportLOD"),
NSLOCTEXT("AssetTypeActions_StaticMesh", "StaticMesh_ImportLODtooltip", "Imports meshes into the LODs"),
FNewMenuDelegate::CreateSP( this, &FAssetTypeActions_StaticMesh::GetImportLODMenu, Meshes )
);
MenuBuilder.AddMenuEntry(
NSLOCTEXT("AssetTypeActions_StaticMesh", "StaticMesh_FindInExplorer", "Find Source"),
NSLOCTEXT("AssetTypeActions_StaticMesh", "StaticMesh_FindInExplorerTooltip", "Opens explorer at the location of this asset."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_StaticMesh::ExecuteFindInExplorer, Meshes ),
FCanExecuteAction::CreateSP( this, &FAssetTypeActions_StaticMesh::CanExecuteSourceCommands, Meshes )
)
);
MenuBuilder.AddMenuEntry(
NSLOCTEXT("AssetTypeActions_StaticMesh", "StaticMesh_OpenInExternalEditor", "Open Source"),
NSLOCTEXT("AssetTypeActions_StaticMesh", "StaticMesh_OpenInExternalEditorTooltip", "Opens the selected asset in an external editor."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_StaticMesh::ExecuteOpenInExternalEditor, Meshes ),
FCanExecuteAction::CreateSP( this, &FAssetTypeActions_StaticMesh::CanExecuteSourceCommands, Meshes )
)
);
MenuBuilder.AddMenuEntry(
NSLOCTEXT("AssetTypeActions_StaticMesh", "ObjectContext_CreateDestructibleMesh", "Create Destructible Mesh"),
NSLOCTEXT("AssetTypeActions_StaticMesh", "ObjectContext_CreateDestructibleMeshTooltip", "Creates a DestructibleMesh from the StaticMesh and opens it in the DestructibleMesh editor."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_StaticMesh::ExecuteCreateDestructibleMesh, Meshes ),
FCanExecuteAction()
)
);
}
示例5: NSLOCTEXT
void FAssetTypeActions_StaticMesh::GetActions( const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder )
{
auto Meshes = GetTypedWeakObjectPtrs<UStaticMesh>(InObjects);
if (CVarEnableSaveGeneratedLODsInPackage.GetValueOnGameThread() != 0)
{
MenuBuilder.AddMenuEntry(
NSLOCTEXT("AssetTypeActions_StaticMesh", "ObjectContext_SaveGeneratedLODsInPackage", "Save Generated LODs"),
NSLOCTEXT("AssetTypeActions_StaticMesh", "ObjectContext_SaveGeneratedLODsInPackageTooltip", "Run the mesh reduce and save the generated LODs as part of the package."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP(this, &FAssetTypeActions_StaticMesh::ExecuteSaveGeneratedLODsInPackage, Meshes),
FCanExecuteAction()
)
);
}
MenuBuilder.AddMenuEntry(
NSLOCTEXT("AssetTypeActions_StaticMesh", "ObjectContext_CreateDestructibleMesh", "Create Destructible Mesh"),
NSLOCTEXT("AssetTypeActions_StaticMesh", "ObjectContext_CreateDestructibleMeshTooltip", "Creates a DestructibleMesh from the StaticMesh and opens it in the DestructibleMesh editor."),
FSlateIcon(FEditorStyle::GetStyleSetName(), "ClassIcon.DestructibleComponent"),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_StaticMesh::ExecuteCreateDestructibleMesh, Meshes ),
FCanExecuteAction()
)
);
MenuBuilder.AddSubMenu(
NSLOCTEXT("AssetTypeActions_StaticMesh", "StaticMesh_ImportLOD", "Import LOD"),
NSLOCTEXT("AssetTypeActions_StaticMesh", "StaticMesh_ImportLODtooltip", "Imports meshes into the LODs"),
FNewMenuDelegate::CreateSP( this, &FAssetTypeActions_StaticMesh::GetImportLODMenu, Meshes )
);
}
示例6: MenuBuilder
void SScrubWidget::CreateContextMenu(float CurrentFrameTime)
{
if ((OnCropAnimSequence.IsBound() || OnReZeroAnimSequence.IsBound()) && (SequenceLength.Get() >= MINIMUM_ANIMATION_LENGTH))
{
const bool CloseAfterSelection = true;
FMenuBuilder MenuBuilder( CloseAfterSelection, NULL );
MenuBuilder.BeginSection("SequenceEditingContext", LOCTEXT("SequenceEditing", "Sequence Editing") );
{
float CurrentFrameFraction = CurrentFrameTime / SequenceLength.Get();
uint32 CurrentFrameNumber = CurrentFrameFraction * NumOfKeys.Get();
FUIAction Action;
FText Label;
if (OnCropAnimSequence.IsBound())
{
//Menu - "Remove Before"
//Only show this option if the selected frame is greater than frame 1 (first frame)
if (CurrentFrameNumber > 0)
{
CurrentFrameFraction = float(CurrentFrameNumber) / (float)NumOfKeys.Get();
//Corrected frame time based on selected frame number
float CorrectedFrameTime = CurrentFrameFraction * SequenceLength.Get();
Action = FUIAction(FExecuteAction::CreateSP(this, &SScrubWidget::OnSequenceCropped, true, CorrectedFrameTime));
Label = FText::Format(LOCTEXT("RemoveTillFrame", "Remove frame 0 to frame {0}"), FText::AsNumber(CurrentFrameNumber));
MenuBuilder.AddMenuEntry(Label, LOCTEXT("RemoveBefore_ToolTip", "Remove sequence before current position"), FSlateIcon(), Action);
}
uint32 NextFrameNumber = CurrentFrameNumber + 1;
//Menu - "Remove After"
//Only show this option if next frame (CurrentFrameNumber + 1) is valid
if (NextFrameNumber < NumOfKeys.Get())
{
float NextFrameFraction = float(NextFrameNumber) / (float)NumOfKeys.Get();
float NextFrameTime = NextFrameFraction * SequenceLength.Get();
Action = FUIAction(FExecuteAction::CreateSP(this, &SScrubWidget::OnSequenceCropped, false, NextFrameTime));
Label = FText::Format(LOCTEXT("RemoveFromFrame", "Remove from frame {0} to frame {1}"), FText::AsNumber(NextFrameNumber), FText::AsNumber(NumOfKeys.Get()));
MenuBuilder.AddMenuEntry(Label, LOCTEXT("RemoveAfter_ToolTip", "Remove sequence after current position"), FSlateIcon(), Action);
}
}
if (OnReZeroAnimSequence.IsBound())
{
//Menu - "ReZero"
Action = FUIAction(FExecuteAction::CreateSP(this, &SScrubWidget::OnReZero));
Label = FText::Format(LOCTEXT("ReZeroAtFrame", "ReZero at frame {0}"), FText::AsNumber(CurrentFrameNumber));
MenuBuilder.AddMenuEntry(Label, LOCTEXT("ReZeroAtFrame_ToolTip", "Resets the root track of the frame to (0, 0, 0), and apply the difference to all root transform of the sequence. It moves whole sequence to the amount of current root transform. "), FSlateIcon(), Action);
}
}
MenuBuilder.EndSection();
FSlateApplication::Get().PushMenu( SharedThis( this ), MenuBuilder.MakeWidget(), FSlateApplication::Get().GetCursorPos(), FPopupTransitionEffect( FPopupTransitionEffect::ContextMenu ) );
}
}
示例7: LOCTEXT
void FCinematicShotSection::BuildSectionContextMenu(FMenuBuilder& MenuBuilder, const FGuid& ObjectBinding)
{
FThumbnailSection::BuildSectionContextMenu(MenuBuilder, ObjectBinding);
MenuBuilder.BeginSection(NAME_None, LOCTEXT("ShotMenuText", "Shot"));
{
if (SequenceInstance.IsValid())
{
MenuBuilder.AddSubMenu(
LOCTEXT("TakesMenu", "Takes"),
LOCTEXT("TakesMenuTooltip", "Shot takes"),
FNewMenuDelegate::CreateLambda([=](FMenuBuilder& InMenuBuilder){ AddTakesMenu(InMenuBuilder); }));
MenuBuilder.AddMenuEntry(
LOCTEXT("NewTake", "New Take"),
FText::Format(LOCTEXT("NewTakeTooltip", "Create a new take for {0}"), SectionObject.GetShotDisplayName()),
FSlateIcon(),
FUIAction(FExecuteAction::CreateSP(CinematicShotTrackEditor.Pin().ToSharedRef(), &FCinematicShotTrackEditor::NewTake, &SectionObject))
);
}
MenuBuilder.AddMenuEntry(
LOCTEXT("InsertNewShot", "Insert Shot"),
FText::Format(LOCTEXT("InsertNewShotTooltip", "Insert a new shot after {0}"), SectionObject.GetShotDisplayName()),
FSlateIcon(),
FUIAction(FExecuteAction::CreateSP(CinematicShotTrackEditor.Pin().ToSharedRef(), &FCinematicShotTrackEditor::InsertShot, &SectionObject))
);
if (SequenceInstance.IsValid())
{
MenuBuilder.AddMenuEntry(
LOCTEXT("DuplicateShot", "Duplicate Shot"),
FText::Format(LOCTEXT("DuplicateShotTooltip", "Duplicate {0} to create a new shot"), SectionObject.GetShotDisplayName()),
FSlateIcon(),
FUIAction(FExecuteAction::CreateSP(CinematicShotTrackEditor.Pin().ToSharedRef(), &FCinematicShotTrackEditor::DuplicateShot, &SectionObject))
);
MenuBuilder.AddMenuEntry(
LOCTEXT("RenderShot", "Render Shot"),
FText::Format(LOCTEXT("RenderShotTooltip", "Render shot movie"), SectionObject.GetShotDisplayName()),
FSlateIcon(),
FUIAction(FExecuteAction::CreateSP(CinematicShotTrackEditor.Pin().ToSharedRef(), &FCinematicShotTrackEditor::RenderShot, &SectionObject))
);
/*
//@todo
MenuBuilder.AddMenuEntry(
LOCTEXT("RenameShot", "Rename Shot"),
FText::Format(LOCTEXT("RenameShotTooltip", "Rename {0}"), SectionObject.GetShotDisplayName()),
FSlateIcon(),
FUIAction(FExecuteAction::CreateSP(CinematicShotTrackEditor.Pin().ToSharedRef(), &FCinematicShotTrackEditor::RenameShot, &SectionObject))
);
*/
}
}
MenuBuilder.EndSection();
}
示例8: LOCTEXT
void FAssetTypeActions_SoundWave::GetActions( const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder )
{
FAssetTypeActions_SoundBase::GetActions(InObjects, MenuBuilder);
auto SoundNodes = GetTypedWeakObjectPtrs<USoundWave>(InObjects);
/*MenuBuilder.AddMenuEntry(
LOCTEXT("SoundWave_CompressionPreview", "Compression Preview"),
LOCTEXT("SoundWave_CompressionPreviewTooltip", "Opens the selected sound node waves in the compression preview window."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_SoundWave::ExecuteCompressionPreview, SoundNodes ),
FCanExecuteAction()
)
);*/
MenuBuilder.AddMenuEntry(
LOCTEXT("SoundWave_Reimport", "Reimport"),
LOCTEXT("SoundWave_ReimportTooltip", "Reimports the selected waves from file."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_SoundWave::ExecuteReimport, SoundNodes ),
FCanExecuteAction()
)
);
MenuBuilder.AddMenuEntry(
LOCTEXT("SoundWave_FindInExplorer", "Find Source"),
LOCTEXT("SoundWave_FindInExplorerTooltip", "Opens explorer at the location of this asset."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_SoundWave::ExecuteFindInExplorer, SoundNodes ),
FCanExecuteAction::CreateSP( this, &FAssetTypeActions_SoundWave::CanExecuteSourceCommands, SoundNodes )
)
);
MenuBuilder.AddMenuEntry(
LOCTEXT("SoundWave_OpenInExternalEditor", "Open Source"),
LOCTEXT("SoundWave_OpenInExternalEditorTooltip", "Opens the selected asset in an external editor."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_SoundWave::ExecuteOpenInExternalEditor, SoundNodes ),
FCanExecuteAction::CreateSP( this, &FAssetTypeActions_SoundWave::CanExecuteSourceCommands, SoundNodes )
)
);
MenuBuilder.AddMenuEntry(
LOCTEXT("SoundWave_CreateCue", "Create Cue"),
LOCTEXT("SoundWave_CreateCueTooltip", "Creates a sound cue ."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_SoundWave::ExecuteCreateSoundCue, SoundNodes ),
FCanExecuteAction()
)
);
}
示例9: GetPinInformation
void UAnimGraphNode_BlendListByEnum::GetContextMenuActions(const FGraphNodeContextMenuBuilder& Context) const
{
if (!Context.bIsDebugging && (BoundEnum != NULL))
{
if ((Context.Pin != NULL) && (Context.Pin->Direction == EGPD_Input))
{
int32 RawArrayIndex = 0;
bool bIsPosePin = false;
bool bIsTimePin = false;
GetPinInformation(Context.Pin->PinName, /*out*/ RawArrayIndex, /*out*/ bIsPosePin, /*out*/ bIsTimePin);
if (bIsPosePin || bIsTimePin)
{
const int32 ExposedEnumIndex = RawArrayIndex - 1;
if (ExposedEnumIndex != INDEX_NONE)
{
// Offer to remove this specific pin
FUIAction Action = FUIAction( FExecuteAction::CreateUObject( this, &UAnimGraphNode_BlendListByEnum::RemovePinFromBlendList, const_cast<UEdGraphPin*>(Context.Pin)) );
Context.MenuBuilder->AddMenuEntry( LOCTEXT("RemovePose", "Remove Pose"), FText::GetEmpty(), FSlateIcon(), Action );
}
}
}
// Offer to add any not-currently-visible pins
bool bAddedHeader = false;
const int32 MaxIndex = BoundEnum->NumEnums() - 1; // we don't want to show _MAX enum
for (int32 Index = 0; Index < MaxIndex; ++Index)
{
FName ElementName = BoundEnum->GetEnum(Index);
if (!VisibleEnumEntries.Contains(ElementName))
{
FText PrettyElementName = BoundEnum->GetEnumText(Index);
// Offer to add this entry
if (!bAddedHeader)
{
bAddedHeader = true;
Context.MenuBuilder->BeginSection("AnimGraphNodeAddElementPin", LOCTEXT("ExposeHeader", "Add pin for element"));
{
FUIAction Action = FUIAction( FExecuteAction::CreateUObject( this, &UAnimGraphNode_BlendListByEnum::ExposeEnumElementAsPin, ElementName) );
Context.MenuBuilder->AddMenuEntry(PrettyElementName, PrettyElementName, FSlateIcon(), Action);
}
Context.MenuBuilder->EndSection();
}
else
{
FUIAction Action = FUIAction( FExecuteAction::CreateUObject( this, &UAnimGraphNode_BlendListByEnum::ExposeEnumElementAsPin, ElementName) );
Context.MenuBuilder->AddMenuEntry(PrettyElementName, PrettyElementName, FSlateIcon(), Action);
}
}
}
}
}
示例10: LOCTEXT
void FCollectionContextMenu::MakeSetColorSubMenu(FMenuBuilder& MenuBuilder)
{
// New Color
MenuBuilder.AddMenuEntry(
LOCTEXT("NewColor", "New Color"),
LOCTEXT("NewCollectionColorTooltip", "Changes the color this collection should appear as."),
FSlateIcon(),
FUIAction( FExecuteAction::CreateSP( this, &FCollectionContextMenu::ExecutePickColor ) )
);
// Clear Color (only required if any of the selection has one)
if ( SelectedHasCustomColors() )
{
MenuBuilder.AddMenuEntry(
LOCTEXT("ClearColor", "Clear Color"),
LOCTEXT("ClearCollectionColorTooltip", "Resets the color this collection appears as."),
FSlateIcon(),
FUIAction( FExecuteAction::CreateSP( this, &FCollectionContextMenu::ExecuteResetColor ) )
);
}
// Add all the custom colors the user has chosen so far
TArray< FLinearColor > CustomColors;
if ( CollectionViewUtils::HasCustomColors( &CustomColors ) )
{
MenuBuilder.BeginSection("PathContextCustomColors", LOCTEXT("CustomColorsExistingColors", "Existing Colors") );
{
for ( int32 ColorIndex = 0; ColorIndex < CustomColors.Num(); ColorIndex++ )
{
const FLinearColor& Color = CustomColors[ ColorIndex ];
MenuBuilder.AddWidget(
SNew(SHorizontalBox)
+SHorizontalBox::Slot()
.AutoWidth()
.Padding(2, 0, 0, 0)
[
SNew(SButton)
.ButtonStyle( FEditorStyle::Get(), "Menu.Button" )
.OnClicked( this, &FCollectionContextMenu::OnColorClicked, Color )
[
SNew(SColorBlock)
.Color( Color )
.Size( FVector2D(77,16) )
]
],
LOCTEXT("CustomColor", ""),
/*bNoIndent=*/true
);
}
}
MenuBuilder.EndSection();
}
}
示例11: FUIAction
void FAssetContextMenu::BindCommands(TSharedPtr< FUICommandList > InCommandList)
{
InCommandList->MapAction( FGenericCommands::Get().Rename, FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteRename ),
FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteRename )
));
InCommandList->MapAction( FGenericCommands::Get().Delete, FUIAction(
FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteDelete ),
FCanExecuteAction::CreateSP( this, &FAssetContextMenu::CanExecuteDelete )
));
}
示例12: LOCTEXT
void FMediaPlayerActions::GetActions( const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder )
{
FAssetTypeActions_Base::GetActions(InObjects, MenuBuilder);
auto MediaPlayers = GetTypedWeakObjectPtrs<UMediaPlayer>(InObjects);
MenuBuilder.AddMenuEntry(
LOCTEXT("MediaPlayer_PlayMovie", "Play Movie"),
LOCTEXT("MediaPlayer_PlayMovieToolTip", "Starts playback of the media."),
FSlateIcon( FEditorStyle::GetStyleSetName(), "MediaAsset.AssetActions.Play" ),
FUIAction(
FExecuteAction::CreateSP(this, &FMediaPlayerActions::HandlePlayMovieActionExecute, MediaPlayers),
FCanExecuteAction()
)
);
MenuBuilder.AddMenuEntry(
LOCTEXT("MediaPlayer_PauseMovie", "Pause Movie"),
LOCTEXT("MediaPlayer_PauseMovieToolTip", "Pauses playback of the media."),
FSlateIcon( FEditorStyle::GetStyleSetName(), "MediaAsset.AssetActions.Pause" ),
FUIAction(
FExecuteAction::CreateSP(this, &FMediaPlayerActions::HandlePauseMovieActionExecute, MediaPlayers),
FCanExecuteAction()
)
);
MenuBuilder.AddMenuSeparator();
MenuBuilder.AddMenuEntry(
LOCTEXT("MediaPlayer_CreateMediaSoundWave", "Create Media Sound Wave"),
LOCTEXT("MediaPlayer_CreateMediaSoundWaveTooltip", "Creates a new MediaSoundWave using this MediaPlayer asset."),
FSlateIcon( FEditorStyle::GetStyleSetName(), "ClassIcon.MediaSoundWave" ),
FUIAction(
FExecuteAction::CreateSP(this, &FMediaPlayerActions::ExecuteCreateMediaSoundWave, MediaPlayers),
FCanExecuteAction()
)
);
MenuBuilder.AddMenuEntry(
LOCTEXT("MediaPlayer_CreateMediaTexture", "Create Media Texture"),
LOCTEXT("MediaPlayer_CreateMediaTextureTooltip", "Creates a new MediaTexture using this MediaPlayer asset."),
FSlateIcon( FEditorStyle::GetStyleSetName(), "ClassIcon.MediaTexture" ),
FUIAction(
FExecuteAction::CreateSP(this, &FMediaPlayerActions::ExecuteCreateMediaTexture, MediaPlayers),
FCanExecuteAction()
)
);
FAssetTypeActions_Base::GetActions(InObjects, MenuBuilder);
}
示例13: MenuBuilder
FReply STutorialButton::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
if (MouseEvent.GetEffectingButton() == EKeys::RightMouseButton)
{
const bool bInShouldCloseWindowAfterMenuSelection = true;
FMenuBuilder MenuBuilder(bInShouldCloseWindowAfterMenuSelection, nullptr);
if(ShouldShowAlert())
{
MenuBuilder.AddMenuEntry(
LOCTEXT("DismissReminder", "Don't Remind Me Again"),
LOCTEXT("DismissReminderTooltip", "Selecting this option will prevent the tutorial blip from being displayed again, even if you choose not to complete the tutorial."),
FSlateIcon(),
FUIAction(FExecuteAction::CreateSP(this, &STutorialButton::DismissAlert))
);
MenuBuilder.AddMenuEntry(
LOCTEXT("DismissAllReminders", "Dismiss All Tutorial Reminders"),
LOCTEXT("DismissAllRemindersTooltip", "Selecting this option will prevent all tutorial blips from being displayed."),
FSlateIcon(),
FUIAction(FExecuteAction::CreateSP(this, &STutorialButton::DismissAllAlerts))
);
MenuBuilder.AddMenuSeparator();
}
if(bTutorialAvailable)
{
MenuBuilder.AddMenuEntry(
FText::Format(LOCTEXT("LaunchTutorialPattern", "Start Tutorial: {0}"), TutorialTitle),
FText::Format(LOCTEXT("TutorialLaunchToolTip", "Click to begin the '{0}' tutorial"), TutorialTitle),
FSlateIcon(),
FUIAction(FExecuteAction::CreateSP(this, &STutorialButton::LaunchTutorial))
);
}
MenuBuilder.AddMenuEntry(
LOCTEXT("LaunchBrowser", "Show Available Tutorials"),
LOCTEXT("LaunchBrowserTooltip", "Display the tutorials browser"),
FSlateIcon(),
FUIAction(FExecuteAction::CreateSP(this, &STutorialButton::LaunchBrowser))
);
FWidgetPath WidgetPath = MouseEvent.GetEventPath() != nullptr ? *MouseEvent.GetEventPath() : FWidgetPath();
FSlateApplication::Get().PushMenu(SharedThis(this), WidgetPath, MenuBuilder.MakeWidget(), FSlateApplication::Get().GetCursorPos(), FPopupTransitionEffect::ContextMenu);
}
return FReply::Handled();
}
示例14: LOCTEXT
void FAssetTypeActions_CurveTable::GetActions( const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder )
{
auto Tables = GetTypedWeakObjectPtrs<UObject>(InObjects);
TArray<FString> ImportPaths;
for (auto TableIter = Tables.CreateConstIterator(); TableIter; ++TableIter)
{
const UCurveTable* CurTable = Cast<UCurveTable>((*TableIter).Get());
if (CurTable)
{
ImportPaths.Add(FReimportManager::ResolveImportFilename(CurTable->ImportPath, CurTable));
}
}
MenuBuilder.AddMenuEntry(
LOCTEXT("CurveTable_ExportAsCSV", "Export as CSV"),
LOCTEXT("CurveTable_ExportAsCSVTooltip", "Export the curve table as a file containing CSV data."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_CurveTable::ExecuteExportAsCSV, Tables ),
FCanExecuteAction()
)
);
MenuBuilder.AddMenuEntry(
LOCTEXT("CurveTable_ExportAsJSON", "Export as JSON"),
LOCTEXT("CurveTable_ExportAsJSONTooltip", "Export the curve table as a file containing JSON data."),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_CurveTable::ExecuteExportAsJSON, Tables ),
FCanExecuteAction()
)
);
TArray<FString> PotentialFileExtensions;
PotentialFileExtensions.Add(TEXT(".xls"));
PotentialFileExtensions.Add(TEXT(".xlsm"));
PotentialFileExtensions.Add(TEXT(".csv"));
PotentialFileExtensions.Add(TEXT(".json"));
MenuBuilder.AddMenuEntry(
LOCTEXT("CurveTable_OpenSourceData", "Open Source Data"),
LOCTEXT("CurveTable_OpenSourceDataTooltip", "Opens the curve table's source data file in an external editor. It will search using the following extensions: .xls/.xlsm/.csv/.json"),
FSlateIcon(),
FUIAction(
FExecuteAction::CreateSP( this, &FAssetTypeActions_CurveTable::ExecuteFindSourceFileInExplorer, ImportPaths, PotentialFileExtensions ),
FCanExecuteAction::CreateSP(this, &FAssetTypeActions_CurveTable::CanExecuteFindSourceFileInExplorer, ImportPaths, PotentialFileExtensions)
)
);
}
示例15: FUIAction
void FCollectionContextMenu::BindCommands(TSharedPtr< FUICommandList > InCommandList)
{
InCommandList->MapAction( FGenericCommands::Get().Rename, FUIAction(
FExecuteAction::CreateSP( this, &FCollectionContextMenu::ExecuteRenameCollection ),
FCanExecuteAction::CreateSP( this, &FCollectionContextMenu::CanExecuteRenameCollection )
));
}