void FAssetTypeActions_AnimationAsset::GetActions( const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder ) { auto AnimAssets = GetTypedWeakObjectPtrs<UAnimationAsset>(InObjects); MenuBuilder.AddMenuEntry( LOCTEXT("AnimSequenceBase_FindSkeleton", "Find Skeleton"), LOCTEXT("AnimSequenceBase_FindSkeletonTooltip", "Finds the skeleton for the selected assets in the content browser."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_AnimationAsset::ExecuteFindSkeleton, AnimAssets ), FCanExecuteAction() ) ); MenuBuilder.AddSubMenu( LOCTEXT("RetargetAnimSubmenu", "Retarget Anim Assets"), LOCTEXT("RetargetAnimSubmenu_ToolTip", "Opens the retarget anim assets menu"), FNewMenuDelegate::CreateSP( this, &FAssetTypeActions_AnimationAsset::FillRetargetMenu, InObjects ) ); }
void SVisualLoggerFilters::CreateFiltersMenuCategoryForGraph(FMenuBuilder& MenuBuilder, FName GraphName) const { for (auto Iter(CachedDatasPerGraph[GraphName].CreateConstIterator()); Iter; ++Iter) { const FName& DataName = *Iter; const FText& LabelText = FText::FromString(DataName.ToString()); MenuBuilder.AddMenuEntry( LabelText, FText::Format(LOCTEXT("FilterByTooltipPrefix", "Filter by {0}"), LabelText), FSlateIcon(), FUIAction( FExecuteAction::CreateSP(this, &SVisualLoggerFilters::FilterByTypeClicked, GraphName, DataName), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SVisualLoggerFilters::IsAssetTypeActionsInUse, GraphName, DataName), FIsActionButtonVisible::CreateLambda([this, LabelText]()->bool{return this->GraphsSearchString.Len() == 0 || LabelText.ToString().Find(this->GraphsSearchString) != INDEX_NONE; })), NAME_None, EUserInterfaceActionType::ToggleButton ); } }
void ModoMaterialImporterModule::StartupModule() { ModoMaterialImporterCommands::Register(); ModoMaterialImporterStyle::Initialize(); _PluginCommands = MakeShareable(new FUICommandList); _PluginCommands->MapAction( ModoMaterialImporterCommands::Get().Button, FExecuteAction::CreateRaw(this, &ModoMaterialImporterModule::ButtonClicked), FCanExecuteAction()); _ToolbarExtender = MakeShareable(new FExtender); _ToolbarExtension = _ToolbarExtender->AddToolBarExtension("Content", EExtensionHook::Before, _PluginCommands, FToolBarExtensionDelegate::CreateRaw(this, &ModoMaterialImporterModule::AddToolbarExtension)); FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor"); LevelEditorModule.GetToolBarExtensibilityManager()->AddExtender(_ToolbarExtender); _ExtensionManager = LevelEditorModule.GetToolBarExtensibilityManager(); }
void FSpriteGeometryEditMode::BindCommands(TSharedPtr<FUICommandList> CommandList) { const FSpriteGeometryEditCommands& Commands = FSpriteGeometryEditCommands::Get(); // Show toggles CommandList->MapAction( Commands.SetShowNormals, FExecuteAction::CreateRaw(&SpriteGeometryHelper, &FSpriteGeometryEditingHelper::ToggleShowNormals), FCanExecuteAction(), FIsActionChecked::CreateRaw(&SpriteGeometryHelper, &FSpriteGeometryEditingHelper::IsShowNormalsEnabled)); // Geometry editing commands CommandList->MapAction( Commands.DeleteSelection, FExecuteAction::CreateRaw(&SpriteGeometryHelper, &FSpriteGeometryEditingHelper::DeleteSelectedItems), FCanExecuteAction::CreateRaw(&SpriteGeometryHelper, &FSpriteGeometryEditingHelper::CanDeleteSelection)); CommandList->MapAction( Commands.AddBoxShape, FExecuteAction::CreateSP(this, &FSpriteGeometryEditMode::AddBoxShape), FCanExecuteAction::CreateRaw(&SpriteGeometryHelper, &FSpriteGeometryEditingHelper::CanAddBoxShape), FIsActionChecked(), FIsActionButtonVisible::CreateRaw(&SpriteGeometryHelper, &FSpriteGeometryEditingHelper::CanAddBoxShape)); CommandList->MapAction( Commands.ToggleAddPolygonMode, FExecuteAction::CreateRaw(&SpriteGeometryHelper, &FSpriteGeometryEditingHelper::ToggleAddPolygonMode), FCanExecuteAction::CreateRaw(&SpriteGeometryHelper, &FSpriteGeometryEditingHelper::CanAddPolygon), FIsActionChecked::CreateRaw(&SpriteGeometryHelper, &FSpriteGeometryEditingHelper::IsAddingPolygon), FIsActionButtonVisible::CreateRaw(&SpriteGeometryHelper, &FSpriteGeometryEditingHelper::CanAddPolygon)); CommandList->MapAction( Commands.AddCircleShape, FExecuteAction::CreateSP(this, &FSpriteGeometryEditMode::AddCircleShape), FCanExecuteAction::CreateRaw(&SpriteGeometryHelper, &FSpriteGeometryEditingHelper::CanAddCircleShape), FIsActionChecked(), FIsActionButtonVisible::CreateRaw(&SpriteGeometryHelper, &FSpriteGeometryEditingHelper::CanAddCircleShape)); CommandList->MapAction( Commands.SnapAllVertices, FExecuteAction::CreateRaw(&SpriteGeometryHelper, &FSpriteGeometryEditingHelper::SnapAllVerticesToPixelGrid), FCanExecuteAction::CreateRaw(&SpriteGeometryHelper, &FSpriteGeometryEditingHelper::CanSnapVerticesToPixelGrid), FIsActionChecked(), FIsActionButtonVisible::CreateRaw(&SpriteGeometryHelper, &FSpriteGeometryEditingHelper::CanSnapVerticesToPixelGrid)); }
void SVisualLoggerFilters::CreateFiltersMenuCategoryForGraph(FMenuBuilder& MenuBuilder, FName MenuCategory) const { auto FiltersFromGraph = GraphFilters[MenuCategory]; for (auto Iter = FiltersFromGraph.CreateIterator(); Iter; ++Iter) { FName Name = **Iter; const FText& LabelText = FText::FromString(Name.ToString()); MenuBuilder.AddMenuEntry( LabelText, FText::Format(LOCTEXT("FilterByTooltipPrefix", "Filter by {0}"), LabelText), FSlateIcon(), FUIAction( FExecuteAction::CreateSP(this, &SVisualLoggerFilters::FilterByTypeClicked, MenuCategory, Name), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SVisualLoggerFilters::IsAssetTypeActionsInUse, MenuCategory, Name), FIsActionButtonVisible::CreateLambda([this, LabelText]()->bool{return this->GraphsFilter.Len() == 0 || LabelText.ToString().Find(this->GraphsFilter) != INDEX_NONE; })), NAME_None, EUserInterfaceActionType::ToggleButton ); } }
void FAssetTypeActions_SoundWave::GetActions( const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder ) { FAssetTypeActions_SoundBase::GetActions(InObjects, MenuBuilder); auto SoundNodes = GetTypedWeakObjectPtrs<USoundWave>(InObjects); MenuBuilder.AddMenuEntry( LOCTEXT("SoundWave_CreateCue", "Create Cue"), LOCTEXT("SoundWave_CreateCueTooltip", "Creates a sound cue using this sound wave."), FSlateIcon(FEditorStyle::GetStyleSetName(), "ClassIcon.SoundCue"), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_SoundWave::ExecuteCreateSoundCue, SoundNodes ), FCanExecuteAction() ) ); MenuBuilder.AddSubMenu( LOCTEXT("SoundWave_CreateDialogue", "Create Dialogue"), LOCTEXT("SoundWave_CreateDialogueTooltip", "Creates a dialogue wave using this sound wave."), FNewMenuDelegate::CreateSP(this, &FAssetTypeActions_SoundWave::FillVoiceMenu, SoundNodes)); }
void FMediaTextureActions::GetActions( const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder ) { FAssetTypeActions_Base::GetActions(InObjects, MenuBuilder); auto Textures = GetTypedWeakObjectPtrs<UTexture>(InObjects); MenuBuilder.AddMenuEntry( LOCTEXT("MediaTexture_CreateMaterial", "Create Material"), LOCTEXT("MediaTexture_CreateMaterialTooltip", "Creates a new material using this texture."), FSlateIcon( FEditorStyle::GetStyleSetName(), "ClassIcon.Material" ), FUIAction( FExecuteAction::CreateSP(this, &FMediaTextureActions::ExecuteCreateMaterial, Textures), FCanExecuteAction() ) ); /* MenuBuilder.AddMenuEntry( LOCTEXT("MediaTexture_CreateSlateBrush", "Create Slate Brush"), LOCTEXT("MediaTexture_CreateSlateBrushToolTip", "Creates a new slate brush using this texture."), FSlateIcon( FEditorStyle::GetStyleSetName(), "ClassIcon.SlateBrushAsset" ), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_MediaTexture::ExecuteCreateSlateBrush, Textures ), FCanExecuteAction() ) );*/ /* @todo AssetTypeActions Implement FindMaterials using the asset registry. if ( InObjects.Num() == 1 ) { MenuBuilder.AddMenuEntry( LOCTEXT("Texture_FindMaterials", "Find Materials Using This"), LOCTEXT("Texture_FindMaterialsTooltip", "Finds all materials that use this material in the content browser."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_Texture::ExecuteFindMaterials, Textures(0) ), FCanExecuteAction() ) ); }*/ }
virtual bool Visit( const TCHAR* FilenameOrDirectory, bool bIsDirectory ) override { if (bIsDirectory) { FString PlatformName = FPaths::GetBaseFilename(FilenameOrDirectory); MenuBuilder.AddMenuEntry( FText::FromString(PlatformName), FText::FromString(PlatformName), FSlateIcon(), FUIAction( FExecuteAction::CreateRaw(&CookerStatsPage, &FCookerStatsPage::HandleFilterMenuEntryExecute, PlatformName), FCanExecuteAction(), FIsActionChecked::CreateRaw(&CookerStatsPage, &FCookerStatsPage::HandleFilterMenuEntryIsChecked, PlatformName) ), NAME_None, EUserInterfaceActionType::RadioButton ); } return true; }
void FAssetTypeActions_DataTable::GetActions( const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder ) { auto Tables = GetTypedWeakObjectPtrs<UObject>(InObjects); TArray<FString> ImportPaths; for (auto TableIter = Tables.CreateConstIterator(); TableIter; ++TableIter) { const UDataTable* CurTable = Cast<UDataTable>((*TableIter).Get()); if (CurTable) { ImportPaths.Add(FReimportManager::ResolveImportFilename(CurTable->ImportPath, CurTable)); } } MenuBuilder.AddMenuEntry( LOCTEXT("DataTable_JSON", "JSON"), LOCTEXT("DataTable_JSONTooltip", "Creates a JSON version of the data table in the lock."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_DataTable::ExecuteJSON, Tables ), FCanExecuteAction() ) ); TArray<FString> XLSExtensions; XLSExtensions.Add(TEXT(".xls")); XLSExtensions.Add(TEXT(".xlsm")); MenuBuilder.AddMenuEntry( LOCTEXT("DataTable_OpenSourceXLS", "Open Source (.xls/.xlsm)"), LOCTEXT("DataTable_OpenSourceXLSTooltip", "Opens the data table's source XLS/XLSM file in an external editor."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_DataTable::ExecuteFindExcelFileInExplorer, ImportPaths, XLSExtensions ), FCanExecuteAction::CreateSP(this, &FAssetTypeActions_DataTable::CanExecuteFindExcelFileInExplorer, ImportPaths, XLSExtensions) ) ); }
void FAssetTypeActions_SoundBase::GetActions( const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder ) { auto Sounds = GetTypedWeakObjectPtrs<USoundBase>(InObjects); MenuBuilder.AddMenuEntry( LOCTEXT("Sound_PlaySound", "Play"), LOCTEXT("Sound_PlaySoundTooltip", "Plays the selected sound."), FSlateIcon(FEditorStyle::GetStyleSetName(), "MediaAsset.AssetActions.Play"), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_SoundBase::ExecutePlaySound, Sounds ), FCanExecuteAction::CreateSP( this, &FAssetTypeActions_SoundBase::CanExecutePlayCommand, Sounds ) ) ); MenuBuilder.AddMenuEntry( LOCTEXT("Sound_StopSound", "Stop"), LOCTEXT("Sound_StopSoundTooltip", "Stops the selected sounds."), FSlateIcon(FEditorStyle::GetStyleSetName(), "MediaAsset.AssetActions.Stop"), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_SoundBase::ExecuteStopSound, Sounds ), FCanExecuteAction() ) ); }
void FAssetTypeActions_Curve::GetActions( const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder ) { auto Curves = GetTypedWeakObjectPtrs<UCurveBase>(InObjects); MenuBuilder.AddMenuEntry( LOCTEXT("Curve_Edit", "Edit"), LOCTEXT("Curve_EditTooltip", "Opens the selected curves in the curve editor."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_Curve::ExecuteEdit, Curves ), FCanExecuteAction() ) ); MenuBuilder.AddMenuEntry( LOCTEXT("Curve_Reimport", "Reimport"), LOCTEXT("Curve_ReimportTooltip", "Reimports the selected Curve from file."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_Curve::ExecuteReimport, Curves ), FCanExecuteAction::CreateSP(this, &FAssetTypeActions_Curve::CanReimportCurves, Curves) //if it was from a file? ) ); }
void FSkookumScriptEditor::StartupModule() { // Get pointer to runtime module m_runtime_p = FModuleManager::Get().GetModule("SkookumScriptRuntime"); // Tell runtime that editor is present (needed even in commandlet mode as we might have to demand-load blueprints) get_runtime()->set_editor_interface(this); // Clear contents of scripts folder for a fresh start // Won't work here if project has several maps using different blueprints //FString directory_to_delete(m_scripts_path / TEXT("Object")); //IFileManager::Get().DeleteDirectory(*directory_to_delete, false, true); // Reset super classes m_used_classes.Empty(); // Label used to extract package path from Sk class meta file m_package_name_key = TEXT("// UE4 Package Name: \""); m_package_path_key = TEXT("// UE4 Package Path: \""); // String to insert into/remove from Sk project ini file m_editable_ini_settings_p = TEXT("Editable=false\r\nCanMakeEditable=true\r\n"); if (IsRunningCommandlet()) { // Tell runtime to start skookum now get_runtime()->startup_skookum(); } else { // Hook up delegates m_on_asset_loaded_handle = FCoreUObjectDelegates::OnAssetLoaded.AddRaw(this, &FSkookumScriptEditor::on_asset_loaded); m_on_object_modified_handle = FCoreUObjectDelegates::OnObjectModified.AddRaw(this, &FSkookumScriptEditor::on_object_modified); m_on_map_opened_handle = FEditorDelegates::OnMapOpened.AddRaw(this, &FSkookumScriptEditor::on_map_opened); m_on_new_asset_created_handle = FEditorDelegates::OnNewAssetCreated.AddRaw(this, &FSkookumScriptEditor::on_new_asset_created); m_on_assets_deleted_handle = FEditorDelegates::OnAssetsDeleted.AddRaw(this, &FSkookumScriptEditor::on_assets_deleted); m_on_asset_post_import_handle = FEditorDelegates::OnAssetPostImport.AddRaw(this, &FSkookumScriptEditor::on_asset_post_import); FAssetRegistryModule & asset_registry = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(AssetRegistryConstants::ModuleName); m_on_asset_added_handle = asset_registry.Get().OnAssetAdded().AddRaw(this, &FSkookumScriptEditor::on_asset_added); m_on_asset_renamed_handle = asset_registry.Get().OnAssetRenamed().AddRaw(this, &FSkookumScriptEditor::on_asset_renamed); m_on_in_memory_asset_created_handle = asset_registry.Get().OnInMemoryAssetCreated().AddRaw(this, &FSkookumScriptEditor::on_in_memory_asset_created); m_on_in_memory_asset_deleted_handle = asset_registry.Get().OnInMemoryAssetDeleted().AddRaw(this, &FSkookumScriptEditor::on_in_memory_asset_deleted); //--------------------------------------------------------------------------------------- // UI extension // Register commands and styles FSkookumScriptEditorCommands::Register(); FSlateStyleRegistry::UnRegisterSlateStyle(FSkookumStyles::GetStyleSetName()); // Hot reload hack FSkookumStyles::Initialize(); // Button commands m_button_commands = MakeShareable(new FUICommandList); m_button_commands->MapAction( FSkookumScriptEditorCommands::Get().m_skookum_button, FExecuteAction::CreateRaw(this, &FSkookumScriptEditor::on_skookum_button_clicked), FCanExecuteAction()); // Add to level tool bar m_level_tool_bar_extender = MakeShareable(new FExtender); m_level_tool_bar_extension = m_level_tool_bar_extender->AddToolBarExtension("Compile", EExtensionHook::After, m_button_commands, FToolBarExtensionDelegate::CreateRaw(this, &FSkookumScriptEditor::add_skookum_button_to_level_tool_bar)); FLevelEditorModule & level_editor_module = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor"); m_level_extension_manager = level_editor_module.GetToolBarExtensibilityManager(); m_level_extension_manager->AddExtender(m_level_tool_bar_extender); // Add to blueprint tool bar m_blueprint_tool_bar_extender = MakeShareable(new FExtender); m_blueprint_tool_bar_extension = m_blueprint_tool_bar_extender->AddToolBarExtension("Asset", EExtensionHook::After, m_button_commands, FToolBarExtensionDelegate::CreateRaw(this, &FSkookumScriptEditor::add_skookum_button_to_blueprint_tool_bar)); FBlueprintEditorModule & blueprint_editor_module = FModuleManager::LoadModuleChecked<FBlueprintEditorModule>("Kismet"); m_blueprint_extension_manager = blueprint_editor_module.GetMenuExtensibilityManager(); m_blueprint_extension_manager->AddExtender(m_blueprint_tool_bar_extender); } }
void FStreamingLevelCollectionModel::BindCommands() { FLevelCollectionModel::BindCommands(); const FLevelCollectionCommands& Commands = FLevelCollectionCommands::Get(); FUICommandList& ActionList = *CommandList; //invalid selected levels ActionList.MapAction( Commands.FixUpInvalidReference, FExecuteAction::CreateSP( this, &FStreamingLevelCollectionModel::FixupInvalidReference_Executed ) ); ActionList.MapAction( Commands.RemoveInvalidReference, FExecuteAction::CreateSP( this, &FStreamingLevelCollectionModel::RemoveInvalidSelectedLevels_Executed )); //levels ActionList.MapAction( Commands.World_CreateEmptyLevel, FExecuteAction::CreateSP( this, &FStreamingLevelCollectionModel::CreateEmptyLevel_Executed ) ); ActionList.MapAction( Commands.World_AddExistingLevel, FExecuteAction::CreateSP( this, &FStreamingLevelCollectionModel::AddExistingLevel_Executed ) ); ActionList.MapAction( Commands.World_AddSelectedActorsToNewLevel, FExecuteAction::CreateSP( this, &FStreamingLevelCollectionModel::AddSelectedActorsToNewLevel_Executed ), FCanExecuteAction::CreateSP( this, &FLevelCollectionModel::AreActorsSelected ) ); ActionList.MapAction( Commands.World_RemoveSelectedLevels, FExecuteAction::CreateSP( this, &FStreamingLevelCollectionModel::UnloadSelectedLevels_Executed ), FCanExecuteAction::CreateSP( this, &FLevelCollectionModel::AreAllSelectedLevelsEditable ) ); ActionList.MapAction( Commands.World_MergeSelectedLevels, FExecuteAction::CreateSP( this, &FStreamingLevelCollectionModel::MergeSelectedLevels_Executed ), FCanExecuteAction::CreateSP( this, &FStreamingLevelCollectionModel::AreAllSelectedLevelsEditableAndNotPersistent ) ); // new level streaming method ActionList.MapAction( Commands.SetAddStreamingMethod_Blueprint, FExecuteAction::CreateSP( this, &FStreamingLevelCollectionModel::SetAddedLevelStreamingClass_Executed, ULevelStreamingKismet::StaticClass() ), FCanExecuteAction(), FIsActionChecked::CreateSP( this, &FStreamingLevelCollectionModel::IsNewStreamingMethodChecked, ULevelStreamingKismet::StaticClass())); ActionList.MapAction( Commands.SetAddStreamingMethod_AlwaysLoaded, FExecuteAction::CreateSP( this, &FStreamingLevelCollectionModel::SetAddedLevelStreamingClass_Executed, ULevelStreamingAlwaysLoaded::StaticClass() ), FCanExecuteAction(), FIsActionChecked::CreateSP( this, &FStreamingLevelCollectionModel::IsNewStreamingMethodChecked, ULevelStreamingAlwaysLoaded::StaticClass())); // change streaming method ActionList.MapAction( Commands.SetStreamingMethod_Blueprint, FExecuteAction::CreateSP( this, &FStreamingLevelCollectionModel::SetStreamingLevelsClass_Executed, ULevelStreamingKismet::StaticClass() ), FCanExecuteAction::CreateSP( this, &FStreamingLevelCollectionModel::AreAllSelectedLevelsEditable ), FIsActionChecked::CreateSP( this, &FStreamingLevelCollectionModel::IsStreamingMethodChecked, ULevelStreamingKismet::StaticClass())); ActionList.MapAction( Commands.SetStreamingMethod_AlwaysLoaded, FExecuteAction::CreateSP( this, &FStreamingLevelCollectionModel::SetStreamingLevelsClass_Executed, ULevelStreamingAlwaysLoaded::StaticClass() ), FCanExecuteAction::CreateSP( this, &FStreamingLevelCollectionModel::AreAllSelectedLevelsEditable ), FIsActionChecked::CreateSP( this, &FStreamingLevelCollectionModel::IsStreamingMethodChecked, ULevelStreamingAlwaysLoaded::StaticClass())); //streaming volume ActionList.MapAction( Commands.SelectStreamingVolumes, FExecuteAction::CreateSP( this, &FStreamingLevelCollectionModel::SelectStreamingVolumes_Executed ), FCanExecuteAction::CreateSP( this, &FLevelCollectionModel::AreAllSelectedLevelsEditable)); }
void SEditorViewport::BindCommands() { FUICommandList& CommandListRef = *CommandList; const FEditorViewportCommands& Commands = FEditorViewportCommands::Get(); TSharedRef<FEditorViewportClient> ClientRef = Client.ToSharedRef(); CommandListRef.MapAction( Commands.ToggleRealTime, FExecuteAction::CreateSP( this, &SEditorViewport::OnToggleRealtime ), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SEditorViewport::IsRealtime)); CommandListRef.MapAction( Commands.ToggleStats, FExecuteAction::CreateSP( this, &SEditorViewport::OnToggleStats ), FCanExecuteAction(), FIsActionChecked::CreateSP(ClientRef, &FEditorViewportClient::ShouldShowStats)); CommandListRef.MapAction( Commands.ToggleFPS, FExecuteAction::CreateSP(this, &SEditorViewport::ToggleStatCommand, FString("FPS")), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SEditorViewport::IsStatCommandVisible, FString("FPS"))); CommandListRef.MapAction( Commands.IncrementPositionGridSize, FExecuteAction::CreateSP( this, &SEditorViewport::OnIncrementPositionGridSize ) ); CommandListRef.MapAction( Commands.DecrementPositionGridSize, FExecuteAction::CreateSP( this, &SEditorViewport::OnDecrementPositionGridSize ) ); CommandListRef.MapAction( Commands.IncrementRotationGridSize, FExecuteAction::CreateSP( this, &SEditorViewport::OnIncrementRotationGridSize ) ); CommandListRef.MapAction( Commands.DecrementRotationGridSize, FExecuteAction::CreateSP( this, &SEditorViewport::OnDecrementRotationGridSize ) ); CommandListRef.MapAction( Commands.Perspective, FExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::SetViewportType, LVT_Perspective ), FCanExecuteAction(), FIsActionChecked::CreateSP(ClientRef, &FEditorViewportClient::IsActiveViewportType, LVT_Perspective)); CommandListRef.MapAction( Commands.Front, FExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::SetViewportType, LVT_OrthoXZ ), FCanExecuteAction(), FIsActionChecked::CreateSP(ClientRef, &FEditorViewportClient::IsActiveViewportType, LVT_OrthoXZ)); CommandListRef.MapAction( Commands.Side, FExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::SetViewportType, LVT_OrthoYZ ), FCanExecuteAction(), FIsActionChecked::CreateSP(ClientRef, &FEditorViewportClient::IsActiveViewportType, LVT_OrthoYZ)); CommandListRef.MapAction( Commands.Top, FExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::SetViewportType, LVT_OrthoXY ), FCanExecuteAction(), FIsActionChecked::CreateSP(ClientRef, &FEditorViewportClient::IsActiveViewportType, LVT_OrthoXY)); CommandListRef.MapAction( Commands.ScreenCapture, FExecuteAction::CreateSP( this, &SEditorViewport::OnScreenCapture ), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SEditorViewport::DoesAllowScreenCapture) ); CommandListRef.MapAction( Commands.ScreenCaptureForProjectThumbnail, FExecuteAction::CreateSP( this, &SEditorViewport::OnScreenCaptureForProjectThumbnail ), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SEditorViewport::DoesAllowScreenCapture) ); CommandListRef.MapAction( Commands.TranslateMode, FExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::SetWidgetMode, FWidget::WM_Translate ), FCanExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::CanSetWidgetMode, FWidget::WM_Translate ), FIsActionChecked::CreateSP( this, &SEditorViewport::IsWidgetModeActive, FWidget::WM_Translate ) ); CommandListRef.MapAction( Commands.RotateMode, FExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::SetWidgetMode, FWidget::WM_Rotate ), FCanExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::CanSetWidgetMode, FWidget::WM_Rotate ), FIsActionChecked::CreateSP( this, &SEditorViewport::IsWidgetModeActive, FWidget::WM_Rotate ) ); CommandListRef.MapAction( Commands.ScaleMode, FExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::SetWidgetMode, FWidget::WM_Scale ), FCanExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::CanSetWidgetMode, FWidget::WM_Scale ), FIsActionChecked::CreateSP( this, &SEditorViewport::IsWidgetModeActive, FWidget::WM_Scale ) ); CommandListRef.MapAction( Commands.TranslateRotateMode, FExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::SetWidgetMode, FWidget::WM_TranslateRotateZ ), FCanExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::CanSetWidgetMode, FWidget::WM_TranslateRotateZ ), FIsActionChecked::CreateSP( this, &SEditorViewport::IsWidgetModeActive, FWidget::WM_TranslateRotateZ ), FIsActionButtonVisible::CreateSP( this, &SEditorViewport::IsTranslateRotateModeVisible ) ); CommandListRef.MapAction( Commands.ShrinkTransformWidget, FExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::AdjustTransformWidgetSize, -1 ) ); CommandListRef.MapAction( Commands.ExpandTransformWidget, FExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::AdjustTransformWidgetSize, 1 ) ); CommandListRef.MapAction( Commands.RelativeCoordinateSystem_World, FExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::SetWidgetCoordSystemSpace, COORD_World ), FCanExecuteAction(), FIsActionChecked::CreateSP( this, &SEditorViewport::IsCoordSystemActive, COORD_World ) ); CommandListRef.MapAction( Commands.RelativeCoordinateSystem_Local, FExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::SetWidgetCoordSystemSpace, COORD_Local ), FCanExecuteAction(), FIsActionChecked::CreateSP( this, &SEditorViewport::IsCoordSystemActive, COORD_Local ) ); CommandListRef.MapAction( Commands.CycleTransformGizmos, FExecuteAction::CreateSP( this, &SEditorViewport::OnCycleWidgetMode ), FCanExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::CanCycleWidgetMode ) ); CommandListRef.MapAction( Commands.CycleTransformGizmoCoordSystem, FExecuteAction::CreateSP( this, &SEditorViewport::OnCycleCoordinateSystem ) ); CommandListRef.MapAction( Commands.FocusViewportToSelection, FExecuteAction::CreateSP( this, &SEditorViewport::OnFocusViewportToSelection ) //FExecuteAction::CreateStatic( &FLevelEditorActionCallbacks::ExecuteExecCommand, FString( TEXT("CAMERA ALIGN ACTIVEVIEWPORTONLY") ) ) ); CommandListRef.MapAction( Commands.SurfaceSnapping, FExecuteAction::CreateStatic( &SEditorViewport::OnToggleSurfaceSnap ), FCanExecuteAction(), FIsActionChecked::CreateStatic( &SEditorViewport::OnIsSurfaceSnapEnabled ) ); // Simple macro for binding many Exposure Setting commands #define MAP_EXPOSURE_ACTION( Command, ID ) \ CommandListRef.MapAction( \ Command, \ FExecuteAction::CreateSP( this, &SEditorViewport::ChangeExposureSetting, ID ), \ FCanExecuteAction(), \ FIsActionChecked::CreateSP( this, &SEditorViewport::IsExposureSettingSelected, ID ) ) MAP_EXPOSURE_ACTION( Commands.ToggleAutoExposure, FEditorViewportCommands::AutoExposureRadioID ); MAP_EXPOSURE_ACTION( Commands.FixedExposure4m, -4); MAP_EXPOSURE_ACTION( Commands.FixedExposure3m, -3); MAP_EXPOSURE_ACTION( Commands.FixedExposure2m, -2); MAP_EXPOSURE_ACTION( Commands.FixedExposure1m, -1); MAP_EXPOSURE_ACTION( Commands.FixedExposure0, 0); MAP_EXPOSURE_ACTION( Commands.FixedExposure1p, 1); MAP_EXPOSURE_ACTION( Commands.FixedExposure2p, 2); MAP_EXPOSURE_ACTION( Commands.FixedExposure3p, 3); MAP_EXPOSURE_ACTION( Commands.FixedExposure4p, 4); // Simple macro for binding many view mode UI commands #define MAP_VIEWMODE_ACTION( ViewModeCommand, ViewModeID ) \ CommandListRef.MapAction( \ ViewModeCommand, \ FExecuteAction::CreateSP( ClientRef, &FEditorViewportClient::SetViewMode, ViewModeID ), \ FCanExecuteAction(), \ FIsActionChecked::CreateSP( ClientRef, &FEditorViewportClient::IsViewModeEnabled, ViewModeID ) ) // Map each view mode MAP_VIEWMODE_ACTION( Commands.WireframeMode, VMI_BrushWireframe ); MAP_VIEWMODE_ACTION( Commands.UnlitMode, VMI_Unlit ); MAP_VIEWMODE_ACTION( Commands.LitMode, VMI_Lit ); MAP_VIEWMODE_ACTION( Commands.DetailLightingMode, VMI_Lit_DetailLighting ); MAP_VIEWMODE_ACTION( Commands.LightingOnlyMode, VMI_LightingOnly ); MAP_VIEWMODE_ACTION( Commands.LightComplexityMode, VMI_LightComplexity ); MAP_VIEWMODE_ACTION( Commands.ShaderComplexityMode, VMI_ShaderComplexity ); MAP_VIEWMODE_ACTION( Commands.StationaryLightOverlapMode, VMI_StationaryLightOverlap ); MAP_VIEWMODE_ACTION( Commands.LightmapDensityMode, VMI_LightmapDensity ); MAP_VIEWMODE_ACTION( Commands.ReflectionOverrideMode, VMI_ReflectionOverride ); MAP_VIEWMODE_ACTION( Commands.VisualizeBufferMode, VMI_VisualizeBuffer ); MAP_VIEWMODE_ACTION( Commands.CollisionPawn, VMI_CollisionPawn); MAP_VIEWMODE_ACTION( Commands.CollisionVisibility, VMI_CollisionVisibility); }
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(); }
TSharedPtr<SWidget> SBlutilityShelf::OnBlutilityGetContextMenu(const TArray<FAssetData>& SelectedAssets) { //@TODO: Perform code like in ContentBrowserUtils::LoadAssetsIfNeeded TArray<UObject*> SelectedObjects; for (auto AssetIt = SelectedAssets.CreateConstIterator(); AssetIt; ++AssetIt) { const FAssetData& AssetInfo = *AssetIt; if (UObject* Asset = AssetInfo.GetAsset()) { SelectedObjects.Add(Asset); } } FMenuBuilder MenuBuilder(/*bInShouldCloseWindowAfterMenuSelection=*/ true, NULL); // Only add something if at least one asset is selected bool bAddedAnything = false; if (SelectedObjects.Num()) { // Add any type-specific context menu options FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked<FAssetToolsModule>(TEXT("AssetTools")); bAddedAnything = AssetToolsModule.Get().GetAssetActions(SelectedObjects, MenuBuilder, /*bIncludeHeading=*/true); } MenuBuilder.BeginSection("ShelfManagement", LOCTEXT("BlutilityShelfMenuItemsHeading", "Shelf Management")); { if (bAddedAnything) { MenuBuilder.AddMenuEntry( LOCTEXT("FavoriteTool", "Show on shelf"), LOCTEXT("FavoriteTool_Tooltip", "Should this blueprint be shown as a favorite on the compact shelf"), FSlateIcon(FEditorStyle::GetStyleSetName(), "IconName"), FUIAction( FExecuteAction::CreateStatic(&SBlutilityShelf::ToggleFavoriteStatusOnSelection, SelectedAssets, true), FCanExecuteAction(), FIsActionChecked::CreateStatic(&SBlutilityShelf::GetFavoriteStatusOnSelection, SelectedAssets) ), NAME_None, EUserInterfaceActionType::Check ); } if (bInFavoritesMode) { MenuBuilder.AddMenuEntry( LOCTEXT("EditShelfButton", "Edit Shelf"), LOCTEXT("EditShelfButton_Tooltip", "Edit the shelf"), FSlateIcon(FEditorStyle::GetStyleSetName(), "IconName"), FUIAction(FExecuteAction::CreateSP(this, &SBlutilityShelf::ToggleShelfMode))); } else { MenuBuilder.AddMenuEntry( LOCTEXT("FinishEditShelfButton", "Finish Editing Shelf"), LOCTEXT("FinishEditShelfButton_Tooltip", "Switch back to the compact shelf mode"), FSlateIcon(FEditorStyle::GetStyleSetName(), "IconName"), FUIAction(FExecuteAction::CreateSP(this, &SBlutilityShelf::ToggleShelfMode))); } } MenuBuilder.EndSection(); return MenuBuilder.MakeWidget(); }
FReply FKismetVariableDragDropAction::DroppedOnPanel( const TSharedRef< SWidget >& Panel, FVector2D ScreenPosition, FVector2D GraphPosition, UEdGraph& Graph) { if (Cast<const UEdGraphSchema_K2>(Graph.GetSchema()) != NULL) { UProperty* VariableProperty = GetVariableProperty(); if (VariableProperty != nullptr && CanVariableBeDropped(VariableProperty, Graph)) { UStruct* Outer = CastChecked<UStruct>(VariableProperty->GetOuter()); FNodeConstructionParams NewNodeParams; NewNodeParams.VariableName = VariableName; NewNodeParams.Graph = &Graph; NewNodeParams.GraphPosition = GraphPosition; NewNodeParams.VariableSource= Outer; // call analytics AnalyticCallback.ExecuteIfBound(); // Take into account current state of modifier keys in case the user changed his mind auto ModifierKeys = FSlateApplication::Get().GetModifierKeys(); const bool bModifiedKeysActive = ModifierKeys.IsControlDown() || ModifierKeys.IsAltDown(); const bool bAutoCreateGetter = bModifiedKeysActive ? ModifierKeys.IsControlDown() : bControlDrag; const bool bAutoCreateSetter = bModifiedKeysActive ? ModifierKeys.IsAltDown() : bAltDrag; // Handle Getter/Setters if (bAutoCreateGetter || bAutoCreateSetter) { if (bAutoCreateGetter || !CanExecuteMakeSetter(NewNodeParams, VariableProperty)) { MakeGetter(NewNodeParams); NewNodeParams.GraphPosition.Y += 50.f; } if (bAutoCreateSetter && CanExecuteMakeSetter( NewNodeParams, VariableProperty)) { MakeSetter(NewNodeParams); } } // Show selection menu else { FMenuBuilder MenuBuilder(true, NULL); const FText VariableNameText = FText::FromName( VariableName ); MenuBuilder.BeginSection("BPVariableDroppedOn", VariableNameText ); MenuBuilder.AddMenuEntry( LOCTEXT("CreateGetVariable", "Get"), FText::Format( LOCTEXT("CreateVariableGetterToolTip", "Create Getter for variable '{0}'\n(Ctrl-drag to automatically create a getter)"), VariableNameText ), FSlateIcon(), FUIAction( FExecuteAction::CreateStatic(&FKismetVariableDragDropAction::MakeGetter, NewNodeParams), FCanExecuteAction()) ); MenuBuilder.AddMenuEntry( LOCTEXT("CreateSetVariable", "Set"), FText::Format( LOCTEXT("CreateVariableSetterToolTip", "Create Setter for variable '{0}'\n(Alt-drag to automatically create a setter)"), VariableNameText ), FSlateIcon(), FUIAction( FExecuteAction::CreateStatic(&FKismetVariableDragDropAction::MakeSetter, NewNodeParams), FCanExecuteAction::CreateStatic(&FKismetVariableDragDropAction::CanExecuteMakeSetter, NewNodeParams, VariableProperty )) ); TSharedRef< SWidget > PanelWidget = Panel; // Show dialog to choose getter vs setter FSlateApplication::Get().PushMenu( PanelWidget, FWidgetPath(), MenuBuilder.MakeWidget(), ScreenPosition, FPopupTransitionEffect( FPopupTransitionEffect::ContextMenu) ); MenuBuilder.EndSection(); } } } return FReply::Handled(); }
void FAssetTypeActions_EditorUtilityBlueprint::GetActions(const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder) { auto Blueprints = GetTypedWeakObjectPtrs<UEditorUtilityBlueprint>(InObjects); /* if (Blueprints.Num() == 1) { if (UEditorUtilityBlueprint* Blueprint = Blueprints[0].Get()) { if (Blueprint->ParentClass->IsChildOf(UGlobalEditorUtilityBase::StaticClass())) { MenuBuilder.AddMenuEntry( LOCTEXT("BlutilityExecute", "Run Blutility"), LOCTEXT("BlutilityExecute_Tooltip", "Run this blutility."), NAME_None, FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_EditorUtilityBlueprint::ExecuteGlobalBlutility, Blueprints[0] ), FCanExecuteAction() ) ); } } } */ MenuBuilder.AddMenuEntry( LOCTEXT("Blutility_Edit", "Edit Blueprint"), LOCTEXT("Blutility_EditTooltip", "Opens the selected blueprints in the full blueprint editor."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_EditorUtilityBlueprint::ExecuteEdit, Blueprints ), FCanExecuteAction() ) ); MenuBuilder.AddMenuEntry( LOCTEXT("Blutility_EditDefaults", "Edit Defaults"), LOCTEXT("Blutility_EditDefaultsTooltip", "Edits the default properties for the selected blueprints."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_EditorUtilityBlueprint::ExecuteEditDefaults, Blueprints ), FCanExecuteAction() ) ); if (Blueprints.Num() == 1) { TAttribute<FText>::FGetter DynamicTooltipGetter; DynamicTooltipGetter.BindSP(this, &FAssetTypeActions_EditorUtilityBlueprint::GetNewDerivedBlueprintTooltip, Blueprints[0]); TAttribute<FText> DynamicTooltipAttribute = TAttribute<FText>::Create(DynamicTooltipGetter); MenuBuilder.AddMenuEntry( LOCTEXT("Blutility_NewDerivedBlueprint", "Create Blueprint based on this"), DynamicTooltipAttribute, FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_EditorUtilityBlueprint::ExecuteNewDerivedBlueprint, Blueprints[0] ), FCanExecuteAction::CreateSP( this, &FAssetTypeActions_EditorUtilityBlueprint::CanExecuteNewDerivedBlueprint, Blueprints[0] ) ) ); } }
TSharedRef<SWidget> SVisualLoggerFilters::MakeGraphsFilterMenu() { FMenuBuilder MenuBuilder(true, NULL); MenuBuilder.BeginSection(TEXT("Graphs")); { TSharedRef<SSearchBox> FiltersSearchBox = SNew(SSearchBox) .InitialText(FText::FromString(GraphsSearchString)) .HintText(LOCTEXT("GraphsFilterSearchHint", "Quick find")) .OnTextChanged(this, &SVisualLoggerFilters::OnSearchChanged); MenuBuilder.AddWidget(FiltersSearchBox, LOCTEXT("FiltersSearchMenuWidget", "")); if (CachedDatasPerGraph.Num() > 0) { for (auto Iter(CachedDatasPerGraph.CreateConstIterator()); Iter; ++Iter) { if (Iter.Value().Num() == 0) { continue; } const FName GraphName = Iter.Key(); bool bHighlightName = false; const TArray<FName> SelectedOwners = FVisualLoggerDatabase::Get().GetSelectedRows(); for (FName CurrentOwner : SelectedOwners) { bHighlightName |= FVisualLoggerGraphsDatabase::Get().ContainsGraphByName(CurrentOwner, GraphName); if (bHighlightName) { break; } } const FText& LabelText = bHighlightName ? FText::FromString(FString::Printf(TEXT("* %s"), *GraphName.ToString())) : FText::FromString(FString::Printf(TEXT(" %s"), *GraphName.ToString())); MenuBuilder.AddSubMenu( LabelText, FText::Format(LOCTEXT("FilterByTooltipPrefix", "Filter by {0}"), LabelText), FNewMenuDelegate::CreateSP(this, &SVisualLoggerFilters::CreateFiltersMenuCategoryForGraph, GraphName), FUIAction( FExecuteAction::CreateSP(this, &SVisualLoggerFilters::GraphFilterCategoryClicked, GraphName), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SVisualLoggerFilters::IsGraphFilterCategoryInUse, GraphName), FIsActionButtonVisible::CreateLambda([this, GraphName]()->bool{return GraphSubmenuVisibility(GraphName); }) ), NAME_None, EUserInterfaceActionType::ToggleButton ); } } } MenuBuilder.EndSection(); FDisplayMetrics DisplayMetrics; FSlateApplication::Get().GetDisplayMetrics(DisplayMetrics); const FVector2D DisplaySize( DisplayMetrics.PrimaryDisplayWorkAreaRect.Right - DisplayMetrics.PrimaryDisplayWorkAreaRect.Left, DisplayMetrics.PrimaryDisplayWorkAreaRect.Bottom - DisplayMetrics.PrimaryDisplayWorkAreaRect.Top); return SNew(SVerticalBox) + SVerticalBox::Slot() .MaxHeight(DisplaySize.Y * 0.5) [ MenuBuilder.MakeWidget() ]; }
void SDistributionCurveEditor::BindCommands() { const FCurveEditorCommands& Commands = FCurveEditorCommands::Get(); UICommandList->MapAction( Commands.RemoveCurve, FExecuteAction::CreateSP(SharedThis(this), &SDistributionCurveEditor::OnRemoveCurve)); UICommandList->MapAction( Commands.RemoveAllCurves, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnRemoveAllCurves)); UICommandList->MapAction( Commands.SetTime, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnSetTime)); UICommandList->MapAction( Commands.SetValue, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnSetValue)); UICommandList->MapAction( Commands.SetColor, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnSetColor)); UICommandList->MapAction( Commands.DeleteKeys, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnDeleteKeys)); UICommandList->MapAction( Commands.ScaleTimes, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnScaleTimes, ECurveScaleScope::All)); UICommandList->MapAction( Commands.ScaleValues, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnScaleValues, ECurveScaleScope::All)); UICommandList->MapAction( Commands.ScaleSingleCurveTimes, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnScaleTimes, ECurveScaleScope::Current)); UICommandList->MapAction( Commands.ScaleSingleCurveValues, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnScaleValues, ECurveScaleScope::Current)); UICommandList->MapAction( Commands.ScaleSingleSubCurveValues, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnScaleValues, ECurveScaleScope::CurrentSub)); UICommandList->MapAction( Commands.FitHorizontally, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnFitHorizontally)); UICommandList->MapAction( Commands.FitVertically, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnFitVertically)); UICommandList->MapAction( Commands.FitToAll, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnFitToAll)); UICommandList->MapAction( Commands.FitToSelected, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnFitToSelected)); UICommandList->MapAction( Commands.PanMode, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnSetMode, (int32)FCurveEditorSharedData::CEM_Pan), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SDistributionCurveEditor::IsModeChecked, (int32)FCurveEditorSharedData::CEM_Pan)); UICommandList->MapAction( Commands.ZoomMode, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnSetMode, (int32)FCurveEditorSharedData::CEM_Zoom), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SDistributionCurveEditor::IsModeChecked, (int32)FCurveEditorSharedData::CEM_Zoom)); UICommandList->MapAction( Commands.CurveAuto, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnSetTangentType, (int32)CIM_CurveAuto), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SDistributionCurveEditor::IsTangentTypeChecked, (int32)CIM_CurveAuto)); UICommandList->MapAction( Commands.CurveAutoClamped, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnSetTangentType, (int32)CIM_CurveAutoClamped), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SDistributionCurveEditor::IsTangentTypeChecked, (int32)CIM_CurveAutoClamped)); UICommandList->MapAction( Commands.CurveUser, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnSetTangentType, (int32)CIM_CurveUser), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SDistributionCurveEditor::IsTangentTypeChecked, (int32)CIM_CurveUser)); UICommandList->MapAction( Commands.CurveBreak, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnSetTangentType, (int32)CIM_CurveBreak), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SDistributionCurveEditor::IsTangentTypeChecked, (int32)CIM_CurveBreak)); UICommandList->MapAction( Commands.Linear, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnSetTangentType, (int32)CIM_Linear), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SDistributionCurveEditor::IsTangentTypeChecked, (int32)CIM_Linear)); UICommandList->MapAction( Commands.Constant, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnSetTangentType, (int32)CIM_Constant), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SDistributionCurveEditor::IsTangentTypeChecked, (int32)CIM_Constant)); UICommandList->MapAction( Commands.FlattenTangents, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnFlattenTangents)); UICommandList->MapAction( Commands.StraightenTangents, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnStraightenTangents)); UICommandList->MapAction( Commands.ShowAllTangents, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnShowAllTangents), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SDistributionCurveEditor::IsShowAllTangentsChecked)); UICommandList->MapAction( Commands.CreateTab, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnCreateTab)); UICommandList->MapAction( Commands.DeleteTab, FExecuteAction::CreateSP(this, &SDistributionCurveEditor::OnDeleteTab)); }
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 ) ); } 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 { MenuBuilder.AddMenuEntry( LOCTEXT("EditorPreferencesMenuLabel", "Editor Preferences..."), LOCTEXT("EditorPreferencesMenuToolTip", "Configure the behavior and features of this Editor"), FSlateIcon(), FUIAction(FExecuteAction::CreateStatic(&FSettingsMenu::OpenSettings, FName("Editor"), FName("General"), FName("Appearance"))) ); 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("Game"), FName("General"))) ); } } MenuBuilder.EndSection(); }
void FSequencerObjectBindingNode::AddSpawnOwnershipMenu(FMenuBuilder& MenuBuilder) { FMovieSceneSpawnable* Spawnable = GetSequencer().GetFocusedMovieSceneSequence()->GetMovieScene()->FindSpawnable(ObjectBinding); if (!Spawnable) { return; } MenuBuilder.AddMenuEntry( LOCTEXT("ThisSequence_Label", "This Sequence"), LOCTEXT("ThisSequence_Tooltip", "Indicates that this sequence will own the spawned object. The object will be destroyed at the end of the sequence."), FSlateIcon(), FUIAction( FExecuteAction::CreateLambda([=]{ Spawnable->SetSpawnOwnership(ESpawnOwnership::InnerSequence); }), FCanExecuteAction(), FIsActionChecked::CreateLambda([=]{ return Spawnable->GetSpawnOwnership() == ESpawnOwnership::InnerSequence; }) ), NAME_None, EUserInterfaceActionType::ToggleButton ); MenuBuilder.AddMenuEntry( LOCTEXT("MasterSequence_Label", "Master Sequence"), LOCTEXT("MasterSequence_Tooltip", "Indicates that the outermost sequence will own the spawned object. The object will be destroyed when the outermost sequence stops playing."), FSlateIcon(), FUIAction( FExecuteAction::CreateLambda([=]{ Spawnable->SetSpawnOwnership(ESpawnOwnership::MasterSequence); }), FCanExecuteAction(), FIsActionChecked::CreateLambda([=]{ return Spawnable->GetSpawnOwnership() == ESpawnOwnership::MasterSequence; }) ), NAME_None, EUserInterfaceActionType::ToggleButton ); MenuBuilder.AddMenuEntry( LOCTEXT("External_Label", "External"), LOCTEXT("External_Tooltip", "Indicates this object's lifetime is managed externally once spawned. It will not be destroyed by sequencer."), FSlateIcon(), FUIAction( FExecuteAction::CreateLambda([=]{ Spawnable->SetSpawnOwnership(ESpawnOwnership::External); }), FCanExecuteAction(), FIsActionChecked::CreateLambda([=]{ return Spawnable->GetSpawnOwnership() == ESpawnOwnership::External; }) ), NAME_None, EUserInterfaceActionType::ToggleButton ); MenuBuilder.AddMenuSeparator(); MenuBuilder.AddMenuEntry( LOCTEXT("IgnoreOwnership_Label", "Keep Alive Outside Playback Range (In Sequencer)"), LOCTEXT("IgnoreOwnership_Tooltip", "Keeps the spawned object alive when viewing this specific sequence outside of its playback range. Does not apply to runtime evaluation."), FSlateIcon(), FUIAction( FExecuteAction::CreateLambda([=]{ Spawnable->SetIgnoreOwnershipInEditor(!Spawnable->ShouldIgnoreOwnershipInEditor()); GetSequencer().SetGlobalTimeDirectly(GetSequencer().GetGlobalTime()); }), FCanExecuteAction(), FIsActionChecked::CreateLambda([=]{ return Spawnable->ShouldIgnoreOwnershipInEditor(); }) ), NAME_None, EUserInterfaceActionType::ToggleButton ); }
/** * Called right after the module's DLL has been loaded and the module object has been created */ virtual void StartupModule() override { FLandscapeEditorCommands::Register(); // register the editor mode FEditorModeRegistry::Get().RegisterMode<FEdModeLandscape>( FBuiltinEditorModes::EM_Landscape, NSLOCTEXT("EditorModes", "LandscapeMode", "Landscape"), FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.LandscapeMode", "LevelEditor.LandscapeMode.Small"), true, 300 ); // register customizations FPropertyEditorModule& PropertyModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor"); PropertyModule.RegisterCustomClassLayout("LandscapeEditorObject", FOnGetDetailCustomizationInstance::CreateStatic(&FLandscapeEditorDetails::MakeInstance)); PropertyModule.RegisterCustomPropertyTypeLayout("GizmoImportLayer", FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FLandscapeEditorStructCustomization_FGizmoImportLayer::MakeInstance)); PropertyModule.RegisterCustomPropertyTypeLayout("LandscapeImportLayer", FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FLandscapeEditorStructCustomization_FLandscapeImportLayer::MakeInstance)); PropertyModule.RegisterCustomClassLayout("LandscapeSplineControlPoint", FOnGetDetailCustomizationInstance::CreateStatic(&FLandscapeSplineDetails::MakeInstance)); PropertyModule.RegisterCustomClassLayout("LandscapeSplineSegment", FOnGetDetailCustomizationInstance::CreateStatic(&FLandscapeSplineDetails::MakeInstance)); // add menu extension TSharedRef<FUICommandList> CommandList = MakeShareable(new FUICommandList); const FLandscapeEditorCommands& LandscapeActions = FLandscapeEditorCommands::Get(); CommandList->MapAction(LandscapeActions.ViewModeNormal, FExecuteAction::CreateStatic(&ChangeLandscapeViewMode, ELandscapeViewMode::Normal), FCanExecuteAction(), FIsActionChecked::CreateStatic(&IsLandscapeViewModeSelected, ELandscapeViewMode::Normal)); CommandList->MapAction(LandscapeActions.ViewModeLOD, FExecuteAction::CreateStatic(&ChangeLandscapeViewMode, ELandscapeViewMode::LOD), FCanExecuteAction(), FIsActionChecked::CreateStatic(&IsLandscapeViewModeSelected, ELandscapeViewMode::LOD)); CommandList->MapAction(LandscapeActions.ViewModeLayerDensity, FExecuteAction::CreateStatic(&ChangeLandscapeViewMode, ELandscapeViewMode::LayerDensity), FCanExecuteAction(), FIsActionChecked::CreateStatic(&IsLandscapeViewModeSelected, ELandscapeViewMode::LayerDensity)); CommandList->MapAction(LandscapeActions.ViewModeLayerDebug, FExecuteAction::CreateStatic(&ChangeLandscapeViewMode, ELandscapeViewMode::DebugLayer), FCanExecuteAction(), FIsActionChecked::CreateStatic(&IsLandscapeViewModeSelected, ELandscapeViewMode::DebugLayer)); CommandList->MapAction(LandscapeActions.ViewModeWireframeOnTop,FExecuteAction::CreateStatic(&ChangeLandscapeViewMode, ELandscapeViewMode::WireframeOnTop), FCanExecuteAction(), FIsActionChecked::CreateStatic(&IsLandscapeViewModeSelected, ELandscapeViewMode::WireframeOnTop)); ViewportMenuExtender = MakeShareable(new FExtender); ViewportMenuExtender->AddMenuExtension("LevelViewportLandscape", EExtensionHook::First, CommandList, FMenuExtensionDelegate::CreateStatic(&ConstructLandscapeViewportMenu)); FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor"); LevelEditorModule.GetMenuExtensibilityManager()->AddExtender(ViewportMenuExtender); // add actor factories UActorFactoryLandscape* LandscapeActorFactory = NewObject<UActorFactoryLandscape>(); LandscapeActorFactory->NewActorClass = ALandscape::StaticClass(); GEditor->ActorFactories.Add(LandscapeActorFactory); UActorFactoryLandscape* LandscapeProxyActorFactory = NewObject<UActorFactoryLandscape>(); LandscapeProxyActorFactory->NewActorClass = ALandscapeProxy::StaticClass(); GEditor->ActorFactories.Add(LandscapeProxyActorFactory); }
/** * Constructs the widget * * @param InArgs Declaration from which to construct this widget. */ void SDetailsView::Construct(const FArguments& InArgs) { DetailsViewArgs = InArgs._DetailsViewArgs; bViewingClassDefaultObject = false; PropertyUtilities = MakeShareable( new FPropertyDetailsUtilities( *this ) ); ColumnSizeData.LeftColumnWidth = TAttribute<float>( this, &SDetailsView::OnGetLeftColumnWidth ); ColumnSizeData.RightColumnWidth = TAttribute<float>( this, &SDetailsView::OnGetRightColumnWidth ); ColumnSizeData.OnWidthChanged = SSplitter::FOnSlotResized::CreateSP( this, &SDetailsView::OnSetColumnWidth ); // We want the scrollbar to always be visible when objects are selected, but not when there is no selection - however: // - We can't use AlwaysShowScrollbar for this, as this will also show the scrollbar when nothing is selected // - We can't use the Visibility construction parameter, as it gets translated into user visibility and can hide the scrollbar even when objects are selected // We instead have to explicitly set the visibility after the scrollbar has been constructed to get the exact behavior we want TSharedRef<SScrollBar> ExternalScrollbar = SNew(SScrollBar); ExternalScrollbar->SetVisibility( TAttribute<EVisibility>( this, &SDetailsView::GetScrollBarVisibility ) ); FMenuBuilder DetailViewOptions( true, nullptr); if (DetailsViewArgs.bShowModifiedPropertiesOption) { DetailViewOptions.AddMenuEntry( LOCTEXT("ShowOnlyModified", "Show Only Modified Properties"), LOCTEXT("ShowOnlyModified_ToolTip", "Displays only properties which have been changed from their default"), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &SDetailsView::OnShowOnlyModifiedClicked ), FCanExecuteAction(), FIsActionChecked::CreateSP( this, &SDetailsView::IsShowOnlyModifiedChecked ) ), NAME_None, EUserInterfaceActionType::ToggleButton ); } if( DetailsViewArgs.bShowDifferingPropertiesOption ) { DetailViewOptions.AddMenuEntry( LOCTEXT("ShowOnlyDiffering", "Show Only Differing Properties"), LOCTEXT("ShowOnlyDiffering_ToolTip", "Displays only properties in this instance which have been changed or added from the instance being compared"), FSlateIcon(), FUIAction( FExecuteAction::CreateSP(this, &SDetailsView::OnShowOnlyDifferingClicked), FCanExecuteAction(), FIsActionChecked::CreateSP(this, &SDetailsView::IsShowOnlyDifferingChecked) ), NAME_None, EUserInterfaceActionType::ToggleButton ); } DetailViewOptions.AddMenuEntry( LOCTEXT("ShowAllAdvanced", "Show All Advanced Details"), LOCTEXT("ShowAllAdvanced_ToolTip", "Shows all advanced detail sections in each category"), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &SDetailsView::OnShowAllAdvancedClicked ), FCanExecuteAction(), FIsActionChecked::CreateSP( this, &SDetailsView::IsShowAllAdvancedChecked ) ), NAME_None, EUserInterfaceActionType::ToggleButton ); DetailViewOptions.AddMenuEntry( LOCTEXT("ShowAllChildrenIfCategoryMatches", "Show Child On Category Match"), LOCTEXT("ShowAllChildrenIfCategoryMatches_ToolTip", "Shows children if their category matches the search criteria"), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &SDetailsView::OnShowAllChildrenIfCategoryMatchesClicked ), FCanExecuteAction(), FIsActionChecked::CreateSP( this, &SDetailsView::IsShowAllChildrenIfCategoryMatchesChecked ) ), NAME_None, EUserInterfaceActionType::ToggleButton ); DetailViewOptions.AddMenuEntry( LOCTEXT("CollapseAll", "Collapse All Categories"), LOCTEXT("CollapseAll_ToolTip", "Collapses all root level categories"), FSlateIcon(), FUIAction(FExecuteAction::CreateSP(this, &SDetailsView::SetRootExpansionStates, /*bExpanded=*/false, /*bRecurse=*/false ))); DetailViewOptions.AddMenuEntry( LOCTEXT("ExpandAll", "Expand All Categories"), LOCTEXT("ExpandAll_ToolTip", "Expands all root level categories"), FSlateIcon(), FUIAction(FExecuteAction::CreateSP(this, &SDetailsView::SetRootExpansionStates, /*bExpanded=*/true, /*bRecurse=*/false ))); FilterRow = SNew( SHorizontalBox ) .Visibility( this, &SDetailsView::GetFilterBoxVisibility ) +SHorizontalBox::Slot() .FillWidth( 1 ) .VAlign( VAlign_Center ) [ // Create the search box SAssignNew( SearchBox, SSearchBox ) .OnTextChanged( this, &SDetailsView::OnFilterTextChanged ) .AddMetaData<FTagMetaData>(TEXT("Details.Search")) ] +SHorizontalBox::Slot() .Padding( 4.0f, 0.0f, 0.0f, 0.0f ) .AutoWidth() [ // Create the search box SNew( SButton ) .OnClicked( this, &SDetailsView::OnOpenRawPropertyEditorClicked ) .IsEnabled( this, &SDetailsView::IsPropertyEditingEnabled ) .ToolTipText( LOCTEXT("RawPropertyEditorButtonLabel", "Open Selection in Property Matrix") ) [ SNew( SImage ) .Image( FEditorStyle::GetBrush("DetailsView.EditRawProperties") ) ] ]; if (DetailsViewArgs.bShowOptions) { FilterRow->AddSlot() .HAlign(HAlign_Right) .AutoWidth() [ SNew( SComboButton ) .ContentPadding(0) .ForegroundColor( FSlateColor::UseForeground() ) .ButtonStyle( FEditorStyle::Get(), "ToggleButton" ) .AddMetaData<FTagMetaData>(FTagMetaData(TEXT("ViewOptions"))) .MenuContent() [ DetailViewOptions.MakeWidget() ] .ButtonContent() [ SNew(SImage) .Image( FEditorStyle::GetBrush("GenericViewButton") ) ] ]; } // Create the name area which does not change when selection changes SAssignNew(NameArea, SDetailNameArea, &SelectedObjects) // the name area is only for actors .Visibility(this, &SDetailsView::GetActorNameAreaVisibility) .OnLockButtonClicked(this, &SDetailsView::OnLockButtonClicked) .IsLocked(this, &SDetailsView::IsLocked) .ShowLockButton(DetailsViewArgs.bLockable) .ShowActorLabel(DetailsViewArgs.bShowActorLabel) // only show the selection tip if we're not selecting objects .SelectionTip(!DetailsViewArgs.bHideSelectionTip); TSharedRef<SVerticalBox> VerticalBox = SNew(SVerticalBox); if( !DetailsViewArgs.bCustomNameAreaLocation ) { VerticalBox->AddSlot() .AutoHeight() .Padding(0.0f, 0.0f, 0.0f, 4.0f) [ NameArea.ToSharedRef() ]; } if( !DetailsViewArgs.bCustomFilterAreaLocation ) { VerticalBox->AddSlot() .AutoHeight() .Padding(0.0f, 0.0f, 0.0f, 2.0f) [ FilterRow.ToSharedRef() ]; } VerticalBox->AddSlot() .FillHeight(1) .Padding(0) [ SNew(SOverlay) + SOverlay::Slot() [ ConstructTreeView(ExternalScrollbar) ] + SOverlay::Slot() .HAlign(HAlign_Right) [ SNew(SBox) .WidthOverride(16.0f) [ ExternalScrollbar ] ] ]; ChildSlot [ VerticalBox ]; }
void FAssetTypeActions_AkAudioBank::GetActions( const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder ) { auto Banks = GetTypedWeakObjectPtrs<UAkAudioBank>(InObjects); if(Banks.Num() > 1) { MenuBuilder.AddMenuEntry( LOCTEXT("AkAudioBank_GenerateDefinitionFile","Generate Selected SoundBanks..."), LOCTEXT("AkAudioBank_GenerateDefinitionFileTooltip", "Generates the selected SoundBanks."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_AkAudioBank::GenerateDefinitionFile, Banks ), FCanExecuteAction() ) ); } else { MenuBuilder.AddMenuEntry( LOCTEXT("AkAudioBank_GenerateDefinitionFile","Generate Selected SoundBank..."), LOCTEXT("AkAudioBank_GenerateDefinitionFileTooltip", "Generates the selected SoundBank."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_AkAudioBank::GenerateDefinitionFile, Banks ), FCanExecuteAction() ) ); } MenuBuilder.AddMenuEntry( LOCTEXT("AkAudioBank_LoadBank","Load Bank"), LOCTEXT("AkAudioBank_LoadBankTooltip", "Loads the bank."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_AkAudioBank::LoadBank, Banks ), FCanExecuteAction() ) ); MenuBuilder.AddMenuEntry( LOCTEXT("AkAudioBank_UnloadBank","Unload Bank"), LOCTEXT("AkAudioBank_UnloadBankTooltip", "Unloads the bank."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_AkAudioBank::UnloadBank, Banks ), FCanExecuteAction() ) ); MenuBuilder.AddMenuEntry( LOCTEXT("AkAudioBank_ClearBank","Clear Banks"), LOCTEXT("AkAudioBank_ClearBankTooltip", "Unloads all banks."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_AkAudioBank::ClearBank, Banks ), FCanExecuteAction() ) ); MenuBuilder.AddMenuEntry( LOCTEXT("AkAudioBank_LoadInitBank","Load Init Bank"), LOCTEXT("AkAudioBank_LoadInitBankTooltip", "Loads the Wwise init bank."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_AkAudioBank::LoadInitBank, Banks ), FCanExecuteAction() ) ); MenuBuilder.AddMenuEntry( LOCTEXT("AkAudioBank_RefreshAllBanks","Refresh All Banks"), LOCTEXT("AkAudioBank_RefreshAllBanksTooltip", "Refresh all the selected banks."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_AkAudioBank::RefreshAllBanks, Banks ), FCanExecuteAction() ) ); }
void FAssetTypeActions_DataTable::GetActions( const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder ) { auto Tables = GetTypedWeakObjectPtrs<UObject>(InObjects); TArray<FString> ImportPaths; for (auto TableIter = Tables.CreateConstIterator(); TableIter; ++TableIter) { const UDataTable* CurTable = Cast<UDataTable>((*TableIter).Get()); if (CurTable) { ImportPaths.Add(FReimportManager::ResolveImportFilename(CurTable->ImportPath, CurTable)); } } MenuBuilder.AddMenuEntry( LOCTEXT("DataTable_Edit", "Edit"), LOCTEXT("DataTable_EditTooltip", "Opens the selected tables in the table editor."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_DataTable::ExecuteEdit, Tables ), FCanExecuteAction() ) ); MenuBuilder.AddMenuEntry( LOCTEXT("DataTable_Reimport", "Reimport"), LOCTEXT("DataTable_ReimportTooltip", "Reimports the selected Data Table from file."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_DataTable::ExecuteReimport, Tables ), FCanExecuteAction() ) ); MenuBuilder.AddMenuEntry( LOCTEXT("DataTable_FindSource", "Find Source"), LOCTEXT("DataTable_FindSourceTooltip", "Opens explorer at the location of this asset's source data."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_DataTable::ExecuteFindInExplorer, ImportPaths ), FCanExecuteAction::CreateSP(this, &FAssetTypeActions_DataTable::CanExecuteFindInExplorerSourceCommand, ImportPaths ) ) ); static const TArray<FString> EmptyArray; MenuBuilder.AddMenuEntry( LOCTEXT("DataTable_OpenSourceCSV", "Open Source (.csv)"), LOCTEXT("DataTable_OpenSourceCSVTooltip", "Opens the selected asset's source CSV data in an external editor."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_DataTable::ExecuteOpenInExternalEditor, ImportPaths, EmptyArray ), FCanExecuteAction::CreateSP(this, &FAssetTypeActions_DataTable::CanExecuteLaunchExternalSourceCommands, ImportPaths, EmptyArray ) ) ); TArray<FString> XLSExtensions; XLSExtensions.Add(TEXT(".xls")); XLSExtensions.Add(TEXT(".xlsm")); MenuBuilder.AddMenuEntry( LOCTEXT("DataTable_OpenSourceXLS", "Open Source (.xls/.xlsm)"), LOCTEXT("DataTable_OpenSourceXLSTooltip", "Opens the selected asset's source XLS/XLSM data in an external editor."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_DataTable::ExecuteOpenInExternalEditor, ImportPaths, XLSExtensions ), FCanExecuteAction::CreateSP(this, &FAssetTypeActions_DataTable::CanExecuteLaunchExternalSourceCommands, ImportPaths, XLSExtensions ) ) ); MenuBuilder.AddMenuEntry( LOCTEXT("DataTable_JSON", "JSON"), LOCTEXT("DataTable_JSONTooltip", "Creates a JSON version of the data table in the lock."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetTypeActions_DataTable::ExecuteJSON, Tables ), FCanExecuteAction() ) ); }
void FAssetTypeActions_GameplayTagAssetBase::GetActions(const TArray<UObject*>& InObjects, FMenuBuilder& MenuBuilder) { TArray<UObject*> ContainerObjectOwners; TArray<FGameplayTagContainer*> Containers; for (int32 ObjIdx = 0; ObjIdx < InObjects.Num(); ++ObjIdx) { UObject* CurObj = InObjects[ObjIdx]; if (CurObj) { UStructProperty* StructProp = FindField<UStructProperty>(CurObj->GetClass(), OwnedGameplayTagPropertyName); if(StructProp != NULL) { ContainerObjectOwners.Add(CurObj); Containers.Add(StructProp->ContainerPtrToValuePtr<FGameplayTagContainer>(CurObj)); } } } ensure(Containers.Num() == ContainerObjectOwners.Num()); if (Containers.Num() > 0 && (Containers.Num() == ContainerObjectOwners.Num())) { MenuBuilder.AddMenuEntry( LOCTEXT("GameplayTags_Edit", "Edit Gameplay Tags..."), LOCTEXT("GameplayTags_EditToolTip", "Opens the Gameplay Tag Editor."), FSlateIcon(), FUIAction(FExecuteAction::CreateSP(this, &FAssetTypeActions_GameplayTagAssetBase::OpenGameplayTagEditor, ContainerObjectOwners, Containers), FCanExecuteAction())); } }
void FComponentEditorUtils::FillComponentContextMenuOptions(FMenuBuilder& MenuBuilder, const TArray<UActorComponent*>& SelectedComponents) { // Basic commands MenuBuilder.BeginSection("EditComponent", LOCTEXT("EditComponentHeading", "Edit")); { MenuBuilder.AddMenuEntry(FGenericCommands::Get().Cut); MenuBuilder.AddMenuEntry(FGenericCommands::Get().Copy); MenuBuilder.AddMenuEntry(FGenericCommands::Get().Paste); MenuBuilder.AddMenuEntry(FGenericCommands::Get().Duplicate); MenuBuilder.AddMenuEntry(FGenericCommands::Get().Delete); MenuBuilder.AddMenuEntry(FGenericCommands::Get().Rename); } MenuBuilder.EndSection(); if (SelectedComponents.Num() == 1) { UActorComponent* Component = SelectedComponents[0]; if (Component->GetClass()->ClassGeneratedBy) { MenuBuilder.BeginSection("ComponentAsset", LOCTEXT("ComponentAssetHeading", "Asset")); { MenuBuilder.AddMenuEntry( FText::Format(LOCTEXT("GoToBlueprintForComponent", "Edit {0}"), FText::FromString(Component->GetClass()->ClassGeneratedBy->GetName())), LOCTEXT("EditBlueprintForComponent_ToolTip", "Edits the Blueprint Class that defines this component."), FSlateIcon(FEditorStyle::GetStyleSetName(), FClassIconFinder::FindIconNameForClass(Component->GetClass())), FUIAction( FExecuteAction::CreateStatic(&FComponentEditorUtils::OnEditBlueprintComponent, Component->GetClass()->ClassGeneratedBy), FCanExecuteAction())); MenuBuilder.AddMenuEntry( LOCTEXT("GoToAssetForComponent", "Find Class in Content Browser"), LOCTEXT("GoToAssetForComponent_ToolTip", "Summons the content browser and goes to the class for this component."), FSlateIcon(FEditorStyle::GetStyleSetName(), "SystemWideCommands.FindInContentBrowser"), FUIAction( FExecuteAction::CreateStatic(&FComponentEditorUtils::OnGoToComponentAssetInBrowser, Component->GetClass()->ClassGeneratedBy), FCanExecuteAction())); } MenuBuilder.EndSection(); } else { MenuBuilder.BeginSection("ComponentCode", LOCTEXT("ComponentCodeHeading", "C++")); { if (FSourceCodeNavigation::IsCompilerAvailable()) { FString ClassHeaderPath; if (FSourceCodeNavigation::FindClassHeaderPath(Component->GetClass(), ClassHeaderPath) && IFileManager::Get().FileSize(*ClassHeaderPath) != INDEX_NONE) { const FString CodeFileName = FPaths::GetCleanFilename(*ClassHeaderPath); MenuBuilder.AddMenuEntry( FText::Format(LOCTEXT("GoToCodeForComponent", "Open {0}"), FText::FromString(CodeFileName)), FText::Format(LOCTEXT("GoToCodeForComponent_ToolTip", "Opens the header file for this component ({0}) in a code editing program"), FText::FromString(CodeFileName)), FSlateIcon(), FUIAction( FExecuteAction::CreateStatic(&FComponentEditorUtils::OnOpenComponentCodeFile, ClassHeaderPath), FCanExecuteAction())); } MenuBuilder.AddMenuEntry( LOCTEXT("GoToAssetForComponent", "Find Class in Content Browser"), LOCTEXT("GoToAssetForComponent_ToolTip", "Summons the content browser and goes to the class for this component."), FSlateIcon(FEditorStyle::GetStyleSetName(), "SystemWideCommands.FindInContentBrowser"), FUIAction( FExecuteAction::CreateStatic(&FComponentEditorUtils::OnGoToComponentAssetInBrowser, (UObject*)Component->GetClass()), FCanExecuteAction())); } } MenuBuilder.EndSection(); } } }
void SStaticMeshEditorViewport::BindCommands() { SEditorViewport::BindCommands(); const FStaticMeshEditorCommands& Commands = FStaticMeshEditorCommands::Get(); TSharedRef<FStaticMeshEditorViewportClient> EditorViewportClientRef = EditorViewportClient.ToSharedRef(); CommandList->MapAction( Commands.SetShowWireframe, FExecuteAction::CreateSP( this, &SStaticMeshEditorViewport::SetViewModeWireframe ), FCanExecuteAction(), FIsActionChecked::CreateSP( this, &SStaticMeshEditorViewport::IsInViewModeWireframeChecked ) ); CommandList->MapAction( Commands.SetShowVertexColor, FExecuteAction::CreateSP( this, &SStaticMeshEditorViewport::SetViewModeVertexColor ), FCanExecuteAction(), FIsActionChecked::CreateSP( this, &SStaticMeshEditorViewport::IsInViewModeVertexColorChecked ) ); CommandList->MapAction( Commands.ResetCamera, FExecuteAction::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::ResetCamera ) ); CommandList->MapAction( Commands.SetDrawUVs, FExecuteAction::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::SetDrawUVOverlay ), FCanExecuteAction(), FIsActionChecked::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::IsSetDrawUVOverlayChecked ) ); CommandList->MapAction( Commands.SetShowGrid, FExecuteAction::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::SetShowGrid ), FCanExecuteAction(), FIsActionChecked::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::IsSetShowGridChecked ) ); CommandList->MapAction( Commands.SetShowBounds, FExecuteAction::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::ToggleShowBounds ), FCanExecuteAction(), FIsActionChecked::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::IsSetShowBoundsChecked ) ); CommandList->MapAction( Commands.SetShowCollision, FExecuteAction::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::SetShowCollision ), FCanExecuteAction(), FIsActionChecked::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::IsSetShowCollisionChecked ) ); CommandList->MapAction( Commands.SetShowSockets, FExecuteAction::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::SetShowSockets ), FCanExecuteAction(), FIsActionChecked::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::IsSetShowSocketsChecked ) ); // Menu CommandList->MapAction( Commands.SetShowNormals, FExecuteAction::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::SetShowNormals ), FCanExecuteAction(), FIsActionChecked::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::IsSetShowNormalsChecked ) ); CommandList->MapAction( Commands.SetShowTangents, FExecuteAction::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::SetShowTangents ), FCanExecuteAction(), FIsActionChecked::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::IsSetShowTangentsChecked ) ); CommandList->MapAction( Commands.SetShowBinormals, FExecuteAction::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::SetShowBinormals ), FCanExecuteAction(), FIsActionChecked::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::IsSetShowBinormalsChecked ) ); CommandList->MapAction( Commands.SetShowPivot, FExecuteAction::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::SetShowPivot ), FCanExecuteAction(), FIsActionChecked::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::IsSetShowPivotChecked ) ); CommandList->MapAction( Commands.SetDrawAdditionalData, FExecuteAction::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::SetDrawAdditionalData ), FCanExecuteAction(), FIsActionChecked::CreateSP( EditorViewportClientRef, &FStaticMeshEditorViewportClient::IsSetDrawAdditionalData ) ); }
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 ) ) ); } } else { MenuBuilder.AddMenuEntry( LOCTEXT("SCCConnectToSourceControl", "Connect To Source Control"), LOCTEXT("SCCConnectToSourceControlTooltip", "Connect to source control to allow source control operations to be performed on content and levels."), FSlateIcon(), FUIAction( FExecuteAction::CreateSP( this, &FAssetContextMenu::ExecuteEnableSourceControl ), FCanExecuteAction() ) ); } MenuBuilder.EndSection(); return true; }