void SAnimMontageSectionsPanel::Update()
{
	int32 ColorIdx=0;
	FLinearColor Colors[] = { FLinearColor(0.9f, 0.9f, 0.9f, 0.9f), FLinearColor(0.5f, 0.5f, 0.5f) };
	FLinearColor NodeColor = FLinearColor(0.f, 0.5f, 0.0f, 0.5f);
	FLinearColor SelectedColor = FLinearColor(1.0f,0.65,0.0f);
	FLinearColor LoopColor = FLinearColor(0.0f, 0.25f, 0.25f, 0.5f);

	
	if ( Montage != NULL )
	{
		TSharedPtr<STrack> Track;
		TSharedPtr<SVerticalBox> MontageSlots;
		PanelArea->SetContent(
			SAssignNew( MontageSlots, SVerticalBox )
			);

		SectionMap.Empty();
		TopSelectionSet.Empty();
		SelectionSet.Empty();
		MontageSlots->ClearChildren();

		SMontageEditor * Editor = MontageEditor.Pin().Get();
		
		TArray<bool>	Used;
		Used.AddZeroed(Montage->CompositeSections.Num());

		int RowIdx=0;

		/** Create Buttons for reseting/creating default section ordering */
		MontageSlots->AddSlot()
			.AutoHeight()
			.VAlign(VAlign_Center)
			.Padding( FMargin(0.5f, 0.5f) )
			[
				SNew(SHorizontalBox)
				+ SHorizontalBox::Slot()
				.AutoWidth()
				.VAlign(VAlign_Center)
				[				
					SNew(SButton)
					.Visibility( EVisibility::Visible )
					.Text( LOCTEXT("CreateDefault", "Create Default") )
					.ToolTipText( LOCTEXT("CreateDefaultToolTip", "Reconstructs section ordering based on start time") )
					.OnClicked(this, &SAnimMontageSectionsPanel::MakeDefaultSequence)
					.HAlign(HAlign_Center)
					.VAlign(VAlign_Center)
				]

				+ SHorizontalBox::Slot()
				.AutoWidth()
				.VAlign(VAlign_Center)
				[				
					SNew(SButton)
					.Visibility( EVisibility::Visible )
					.Text( LOCTEXT("Clear", "Clear") )
					.ToolTipText( LOCTEXT("ClearToolTip", "Resets section orderings") )
					.OnClicked(this, &SAnimMontageSectionsPanel::ClearSequence)
					.HAlign(HAlign_Center)
					.VAlign(VAlign_Center)
				]
			];


		/** Create top track of section nodes */
		MontageSlots->AddSlot()
			.AutoHeight()
			.VAlign(VAlign_Center)
			.Padding( FMargin(0.5f, 20.0f) )
			[
				SAssignNew(Track, STrack)
				.ViewInputMin(0)
				.ViewInputMax(100)
				.TrackColor( FLinearColor(0.0f, 0.0f, 0.0f, 0.0f))
				.TrackMaxValue(100)
				
			];

		for(int32 SectionIdx=0; SectionIdx < Montage->CompositeSections.Num(); SectionIdx++)
		{
			const float NodeLength = 100.f / static_cast<float>(Montage->CompositeSections.Num()+1);
			const float NodeSpacing = 100.f / static_cast<float>(Montage->CompositeSections.Num());

			Track->AddTrackNode(
				SNew(STrackNode)
				.ViewInputMax(100)
				.ViewInputMin(0)
				.NodeColor(NodeColor)
				.SelectedNodeColor(SelectedColor)
				.DataLength(NodeLength)
				.DataStartPos(NodeSpacing * SectionIdx)
				.NodeName(Montage->CompositeSections[SectionIdx].SectionName.ToString())
				.NodeSelectionSet(&TopSelectionSet)
				.OnTrackNodeClicked( this, &SAnimMontageSectionsPanel::TopSectionClicked, SectionIdx)
				.AllowDrag(false)
				);
		}

		MontageSlots->AddSlot()
			.AutoHeight()
			.VAlign(VAlign_Center)
			.Padding( FMargin(0.5f, 0.0f) )
			[
				SNew(SHorizontalBox)
				+ SHorizontalBox::Slot()
				.AutoWidth()
				.VAlign(VAlign_Center)
				[				
					SNew(SButton)
					.Visibility( EVisibility::Visible )
					.Text( LOCTEXT("PreviewAll", "Preview All Sections") )
					.ToolTipText( LOCTEXT("PreviewAllToolTip", "Preview all sections in order they are") )
					.OnClicked(this, &SAnimMontageSectionsPanel::PreviewAllSectionsClicked)
					.HAlign(HAlign_Center)
					.VAlign(VAlign_Center)
				]
			];

		/** Create as many tracks as necessary to show each section at least once
		  * -Each track represents one chain of sections (section->next->next)
		  */

		while(true)
		{
			int32 SectionIdx = 0;
			TArray<bool>	UsedInThisRow;
			UsedInThisRow.AddZeroed(Montage->CompositeSections.Num());
			
			/** Find first section we haven't shown yet */
			for(;SectionIdx < Montage->CompositeSections.Num(); SectionIdx++)
			{
				if(!Used[SectionIdx])
					break;
			}

			if(SectionIdx >= Montage->CompositeSections.Num())
			{
				// Ran out of stuff to show - done
				break;
			}

			/** Create new track */
			SectionMap.Add( TArray<int32>() );
			MontageSlots->AddSlot()
				.AutoHeight()
				.VAlign(VAlign_Center)
				.Padding( FMargin(0.5f, 0.5f) )
				[
					SNew(SHorizontalBox)
					+ SHorizontalBox::Slot()
					.AutoWidth()
					.VAlign(VAlign_Center)
					[				
						SNew(SButton)
						.Visibility( EVisibility::Visible )
						.Text( LOCTEXT("Preview", "Preview") )
						.ToolTipText( LOCTEXT("PreviewToolTip", "Preview this track") )
						.OnClicked(this, &SAnimMontageSectionsPanel::PreviewSectionClicked, SectionIdx)
						.HAlign(HAlign_Center)
						.VAlign(VAlign_Center)
					]

					+ SHorizontalBox::Slot()
					.FillWidth(1.0f)
					.VAlign(VAlign_Center)
					[
						SAssignNew(Track, STrack)
						.ViewInputMin(0)
						.ViewInputMax(100)
						.TrackColor( Colors[ColorIdx++ & 1])
						.TrackMaxValue(100)
					]
				];
			
			/** Add each track in this chain to the track we just created */
			int count =0;
			float TrackPos = 0;
			const float BarLength = 8;
			const float XLength = 1;
			while(true)
			{
				/** Add section if it hasn't already been used in this row (if its used in another row, thats ok) */
				if(Montage->IsValidSectionIndex(SectionIdx) && UsedInThisRow[SectionIdx]==false)
				{
					UsedInThisRow[SectionIdx] = true;
					Used[SectionIdx] = true;

					SectionMap[RowIdx].Add(SectionIdx);
				
					Track->AddTrackNode(
						SNew(STrackNode)
						.ViewInputMax(100)
						.ViewInputMin(0)
						.NodeColor( IsLoop(SectionIdx) ? LoopColor : NodeColor)
						.SelectedNodeColor(SelectedColor)
						.DataLength(BarLength)
						.DataStartPos(TrackPos)
						.NodeName(Montage->CompositeSections[SectionIdx].SectionName.ToString())
						.OnTrackNodeDragged( this, &SAnimMontageSectionsPanel::SetSectionPos, SectionIdx, RowIdx)
						.OnTrackNodeDropped( this, &SAnimMontageSectionsPanel::OnSectionDrop)
						.OnTrackNodeClicked( this, &SAnimMontageSectionsPanel::SectionClicked, SectionIdx)
						.NodeSelectionSet(&SelectionSet)
						.AllowDrag(false)
					);
					TrackPos += BarLength + 0.25f;

					/** If this has a next section, create an X to delete that link */
					if(Montage->CompositeSections[SectionIdx].NextSectionName != NAME_None)
					{
						Track->AddTrackNode(
							SNew(STrackNode)
							.ViewInputMax(100)
							.ViewInputMin(0)
							.NodeColor(IsLoop(SectionIdx) ? LoopColor : NodeColor)
							.SelectedNodeColor(SelectedColor)
							.DataStartPos(TrackPos)
							.NodeName(TEXT("x"))
							.OnTrackNodeDropped( this, &SAnimMontageSectionsPanel::OnSectionDrop)
							.OnTrackNodeClicked( this, &SAnimMontageSectionsPanel::RemoveLink, SectionIdx)
							.NodeSelectionSet(&SelectionSet)
							.AllowDrag(false)
							);

						TrackPos += XLength + 0.25;
					}

					count++;
					SectionIdx = Montage->GetSectionIndex( Montage->CompositeSections[SectionIdx].NextSectionName );

					continue;
				} else
				{
					break;
				}
			}

		}

		RowIdx++;

	}
	SelectedCompositeSection = INDEX_NONE;
}
    /** Constructs this widget with InArgs */
    void Construct(const FArguments& InArgs)
    {
        bOkClicked = false;
        ParentClass = UGameplayAbility::StaticClass();

        ChildSlot
        [
            SNew(SBorder)
            .Visibility(EVisibility::Visible)
            .BorderImage(FEditorStyle::GetBrush("Menu.Background"))
            [
                SNew(SBox)
                .Visibility(EVisibility::Visible)
                .WidthOverride(500.0f)
                [
                    SNew(SVerticalBox)
                    + SVerticalBox::Slot()
                    .FillHeight(1)
                    [
                        SNew(SBorder)
                        .BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
                        .Content()
                        [
                            SAssignNew(ParentClassContainer, SVerticalBox)
                        ]
                    ]

                    // Ok/Cancel buttons
                    + SVerticalBox::Slot()
                    .AutoHeight()
                    .HAlign(HAlign_Right)
                    .VAlign(VAlign_Bottom)
                    .Padding(8)
                    [
                        SNew(SUniformGridPanel)
                        .SlotPadding(FEditorStyle::GetMargin("StandardDialog.SlotPadding"))
                        .MinDesiredSlotWidth(FEditorStyle::GetFloat("StandardDialog.MinDesiredSlotWidth"))
                        .MinDesiredSlotHeight(FEditorStyle::GetFloat("StandardDialog.MinDesiredSlotHeight"))
                        + SUniformGridPanel::Slot(0, 0)
                        [
                            SNew(SButton)
                            .HAlign(HAlign_Center)
                            .ContentPadding(FEditorStyle::GetMargin("StandardDialog.ContentPadding"))
                            .OnClicked(this, &SGameplayAbilityBlueprintCreateDialog::OkClicked)
                            .Text(LOCTEXT("CreateGameplayAbilityBlueprintOk", "OK"))
                        ]
                        + SUniformGridPanel::Slot(1, 0)
                        [
                            SNew(SButton)
                            .HAlign(HAlign_Center)
                            .ContentPadding(FEditorStyle::GetMargin("StandardDialog.ContentPadding"))
                            .OnClicked(this, &SGameplayAbilityBlueprintCreateDialog::CancelClicked)
                            .Text(LOCTEXT("CreateGameplayAbilityBlueprintCancel", "Cancel"))
                        ]
                    ]
                ]
            ]
        ];

        MakeParentClassPicker();
    }
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
void SLandscapeEditor::Construct(const FArguments& InArgs, TSharedRef<FLandscapeToolKit> InParentToolkit)
{
	TSharedRef<FUICommandList> CommandList = InParentToolkit->GetToolkitCommands();

	// Modes:
	FToolBarBuilder ModeSwitchButtons(CommandList, FMultiBoxCustomization::None);
	{
		ModeSwitchButtons.AddToolBarButton(FLandscapeEditorCommands::Get().ManageMode, NAME_None, LOCTEXT("Mode.Manage", "Manage"), LOCTEXT("Mode.Manage.Tooltip", "Contains tools to add a new landscape, import/export landscape, add/remove components and manage streaming"));
		ModeSwitchButtons.AddToolBarButton(FLandscapeEditorCommands::Get().SculptMode, NAME_None, LOCTEXT("Mode.Sculpt", "Sculpt"), LOCTEXT("Mode.Sculpt.Tooltip", "Contains tools that modify the shape of a landscape"));
		ModeSwitchButtons.AddToolBarButton(FLandscapeEditorCommands::Get().PaintMode,  NAME_None, LOCTEXT("Mode.Paint",  "Paint"),  LOCTEXT("Mode.Paint.Tooltip",  "Contains tools that paint materials on to a landscape"));
	}

	FPropertyEditorModule& PropertyEditorModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
	FDetailsViewArgs DetailsViewArgs(false, false, false,FDetailsViewArgs::HideNameArea);

	DetailsPanel = PropertyEditorModule.CreateDetailView(DetailsViewArgs);
	DetailsPanel->SetIsPropertyVisibleDelegate(FIsPropertyVisible::CreateSP(this, &SLandscapeEditor::GetIsPropertyVisible));

	FEdModeLandscape* LandscapeEdMode = GetEditorMode();
	if (LandscapeEdMode)
	{
		DetailsPanel->SetObject(LandscapeEdMode->UISettings);
	}

	IIntroTutorials& IntroTutorials = FModuleManager::LoadModuleChecked<IIntroTutorials>(TEXT("IntroTutorials"));

	ChildSlot
	[
		SNew(SVerticalBox)
		+ SVerticalBox::Slot()
		.AutoHeight()
		.Padding(0, 0, 0, 5)
		[
			SAssignNew(Error, SErrorText)
		]
		+ SVerticalBox::Slot()
		.Padding(0)
		[
			SNew(SVerticalBox)
			.IsEnabled(this, &SLandscapeEditor::GetLandscapeEditorIsEnabled)

			+ SVerticalBox::Slot()
			.AutoHeight()
			.Padding(4, 0, 4, 5)
			[
				SNew(SOverlay)
				+ SOverlay::Slot()
				[
					SNew(SBorder)
					.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
					.HAlign(HAlign_Center)
					[

						ModeSwitchButtons.MakeWidget()
					]
				]

				// Tutorial link
				+ SOverlay::Slot()
				.HAlign(HAlign_Right)
				.VAlign(VAlign_Bottom)
				.Padding(4)
				[
					IntroTutorials.CreateTutorialsWidget(TEXT("LandscapeMode"))
				]
			]
			+ SVerticalBox::Slot()
			.Padding(0)
			[
				DetailsPanel.ToSharedRef()
			]
		]
	];
}
/**
 * Invoked when the drag and drop operation has ended.
 * 
 * @param bDropWasHandled   true when the drop was handled by some widget; false otherwise
 */
void FDockingDragOperation::OnDrop( bool bDropWasHandled, const FPointerEvent& MouseEvent )
{
	check(CursorDecoratorWindow.IsValid());

	const FVector2D WindowSize = CursorDecoratorWindow->GetSizeInScreen();
	// Destroy the CursorDecoratorWindow by calling the base class implementation because we are relocating the content into a more permanent home.
	FDragDropOperation::OnDrop(bDropWasHandled, MouseEvent);

	TabBeingDragged->SetDraggedOverDockArea( NULL );

	if (!bDropWasHandled)
	{
		// If we dropped the tab into an existing DockNode then it would have handled the DropEvent.
		// We are here because that didn't happen, so make a new window with a new DockNode and drop the tab into that.

		const FVector2D PositionToDrop = MouseEvent.GetScreenSpacePosition() - GetDecoratorOffsetFromCursor();

		TSharedRef<FTabManager> MyTabManager = TabBeingDragged->GetTabManager();
		
		TSharedPtr<SWindow> NewWindowParent = MyTabManager->GetPrivateApi().GetParentWindow();

		
		TSharedRef<SWindow> NewWindow = SNew(SWindow)
			.Title( FGlobalTabmanager::Get()->GetApplicationTitle() )
			.AutoCenter(EAutoCenter::None)
			.ScreenPosition( PositionToDrop )
			// Make room for the title bar; otherwise windows will get progressive smaller whenver you float them.
			.ClientSize( SWindow::ComputeWindowSizeForContent( WindowSize ) )
			.CreateTitleBar(false);

		TSharedPtr<SDockingTabStack> NewDockNode;

		if ( TabBeingDragged->GetTabRole() == ETabRole::NomadTab )
		{
			TabBeingDragged->SetTabManager(FGlobalTabmanager::Get());
		}

		// Create a new dockarea
		TSharedRef<SDockingArea> NewDockArea = 
			SNew(SDockingArea, TabBeingDragged->GetTabManager(), FTabManager::NewPrimaryArea())
			. ParentWindow( NewWindow )
			. InitialContent
			(
				SAssignNew(NewDockNode, SDockingTabStack, FTabManager::NewStack())
			);

		if (TabBeingDragged->GetTabRole() == ETabRole::MajorTab || TabBeingDragged->GetTabRole() == ETabRole::NomadTab)
		{
			TSharedPtr<SWindow> RootWindow = FGlobalTabmanager::Get()->GetRootWindow();
			if ( RootWindow.IsValid() )
			{
				// We have a root window, so all MajorTabs are nested under it.
				FSlateApplication::Get().AddWindowAsNativeChild( NewWindow, RootWindow.ToSharedRef() )->SetContent(NewDockArea);
			}
			else
			{
				// App tabs get put in top-level windows. They show up on the taskbar.
				FSlateApplication::Get().AddWindow( NewWindow )->SetContent(NewDockArea);
			}
		}
		else
		{
			// Other tab types are placed in child windows. Their life is controlled by the top-level windows.
			// They do not show up on the taskbar.

			if ( NewWindowParent.IsValid() )
			{
				FSlateApplication::Get().AddWindowAsNativeChild( NewWindow, NewWindowParent.ToSharedRef() )->SetContent(NewDockArea);
			}
			else
			{
				FSlateApplication::Get().AddWindow( NewWindow )->SetContent(NewDockArea);
			}
		}

		// Do this after the window parenting so that the window title is set correctly
		NewDockNode->OpenTab(TabBeingDragged.ToSharedRef());

		// Let every widget under this tab manager know that this tab has found a new home.
		TabOwnerAreaOfOrigin->GetTabManager()->GetPrivateApi().OnTabRelocated( TabBeingDragged.ToSharedRef(), NewWindow );
	}
	else
	{
		// The event was handled, so we HAVE to have some window that we dropped onto.
		TSharedRef<SWindow> WindowDroppedInto = MouseEvent.GetWindow();

		// Let every widget under this tab manager know that this tab has found a new home.
		TSharedPtr<SWindow> NewWindow = ( TabOwnerAreaOfOrigin->GetParentWindow() == WindowDroppedInto )
			// Tab dropped into same window as before, meaning there is no NewWindow.
			? TSharedPtr<SWindow>()
			// Tab was dropped into a different window, so the tab manager needs to know in order to re-parent child windows.
			: WindowDroppedInto;

		TabOwnerAreaOfOrigin->GetTabManager()->GetPrivateApi().OnTabRelocated( TabBeingDragged.ToSharedRef(), WindowDroppedInto );
	}
}
void SBlueprintProfilerView::UpdateActiveProfilerWidget()
{
		FMenuBuilder ViewComboContent(true, NULL);
		ViewComboContent.AddMenuEntry(	LOCTEXT("OverviewViewType", "Profiler Overview"), 
										LOCTEXT("OverviewViewTypeDesc", "Displays High Level Profiling Information"), 
										FSlateIcon(), 
										FExecuteAction::CreateSP(this, &SBlueprintProfilerView::OnViewSelectionChanged, EBlueprintPerfViewType::Overview),
										NAME_None, 
										EUserInterfaceActionType::Button);
		ViewComboContent.AddMenuEntry(	LOCTEXT("ExecutionGraphViewType", "Execution Graph"), 
										LOCTEXT("ExecutionGraphViewTypeDesc", "Displays the Execution Graph with Statistics"), 
										FSlateIcon(), 
										FExecuteAction::CreateSP(this, &SBlueprintProfilerView::OnViewSelectionChanged, EBlueprintPerfViewType::ExecutionGraph),
										NAME_None, 
										EUserInterfaceActionType::Button);
		ViewComboContent.AddMenuEntry(	LOCTEXT("LeastPerformantViewType", "Least Performant List"), 
										LOCTEXT("LeastPerformantViewTypeDesc", "Displays a list of Least Performant Areas of the Blueprint"), 
										FSlateIcon(), 
										FExecuteAction::CreateSP(this, &SBlueprintProfilerView::OnViewSelectionChanged, EBlueprintPerfViewType::LeastPerformant),
										NAME_None, 
										EUserInterfaceActionType::Button);

		ChildSlot
		[
			SNew(SVerticalBox)
			+SVerticalBox::Slot()
			.AutoHeight()
			.Padding(0)
			[
				SNew(SBorder)
				.BorderImage(FEditorStyle::GetBrush("BlueprintProfiler.ViewToolBar"))
				.Padding(0)
				.VAlign(VAlign_Top)
				.HAlign(HAlign_Right)
				[
					SNew(SHorizontalBox)
					+SHorizontalBox::Slot()
					.AutoWidth()
					.Padding(FMargin(5,0))
					[
						SAssignNew(ViewComboButton, SComboButton)
						.ForegroundColor(this, &SBlueprintProfilerView::GetViewButtonForegroundColor)
						.ToolTipText(LOCTEXT("BlueprintProfilerViewType", "View Type"))
						.ButtonStyle(FEditorStyle::Get(), "ToggleButton")
						.ContentPadding(2)
						.MenuContent()
						[
							ViewComboContent.MakeWidget()
						]
						.ButtonContent()
						[
							CreateViewButton()
						]
					]
				]
			]
			+SVerticalBox::Slot()
			[
				SNew(SBorder)
				.Padding(FMargin(0,2,0,0))
				.BorderImage(FEditorStyle::GetBrush("NoBorder"))
				[
					CreateActiveStatisticWidget()
				]
			]
		];
	}
	/**
	 * Constructs this widget
	 *
	 * @param InArgs    Declaration from which to construct the widget
	 */
	void Construct(const FArguments& InArgs, const TSharedPtr<FString> &_Name, SLiveEditorConfigWindow *_Owner)
	{
		Name = _Name;
		Owner = _Owner;
		bIsActive = (Name.Get())? FLiveEditorManager::Get().CheckActive( *Name.Get() ) : false;

		Blueprint = LoadObject<UBlueprint>( NULL, *(*Name.Get()), NULL, 0, NULL );
		check(	Blueprint != NULL
				&& Blueprint->GeneratedClass != NULL
				&& Blueprint->GeneratedClass->IsChildOf( ULiveEditorBlueprint::StaticClass() ) );

		ChildSlot
		[
			SNew(SHorizontalBox)
			+SHorizontalBox::Slot()
			.AutoWidth()
			.Padding(2.0f)
			[
				SNew( SButton )
				.Text( this, &SLiveEditorBlueprint::GetBindButtonText )
				.ToolTipText( FString(TEXT("Bind your MIDI hardware to this Blueprint")) )
				.HAlign( HAlign_Center )
				.VAlign( VAlign_Center )
				.OnClicked( this, &SLiveEditorBlueprint::BindBlueprint )
			]
			+SHorizontalBox::Slot()
			.AutoWidth()
			.Padding(2.0f)
			[
				SNew( SButton )
				.Text( FString(TEXT("Activate")) )
				.ToolTipText( FString(TEXT("Make this Blueprint active in the LiveEditor context")) )
				.HAlign( HAlign_Center )
				.VAlign( VAlign_Center )
				.Visibility( this, &SLiveEditorBlueprint::CanActivate )
				.OnClicked( this, &SLiveEditorBlueprint::ActivateBlueprint )
			]
			+SHorizontalBox::Slot()
			.AutoWidth()
			.Padding(2.0f)
			[
				SNew( SButton )
				.Text( FString(TEXT("DeActivate")) )
				.ToolTipText( FString(TEXT("Stop this Blueprint running in the LiveEditor context")) )
				.HAlign( HAlign_Center )
				.VAlign( VAlign_Center )
				.Visibility( this, &SLiveEditorBlueprint::CanDeActivate )
				.OnClicked( this, &SLiveEditorBlueprint::DeActivateBlueprint )
			]
			+SHorizontalBox::Slot()
			.AutoWidth()
			.Padding(2.0f)
			[
				SNew( SButton )
				.Text( FString(TEXT("Remove")) )
				.ToolTipText( FString(TEXT("Remove this Blueprint from the LiveEditor context")) )
				.HAlign( HAlign_Center )
				.VAlign( VAlign_Center )
				.OnClicked( this, &SLiveEditorBlueprint::RemoveBlueprint )
			]
			+SHorizontalBox::Slot()
			.AutoWidth()
			.VAlign( VAlign_Center )
			.Padding(2.0f)
			[
				SAssignNew( NameView, STextBlock )
				.Text( *Name.Get() )
				.ColorAndOpacity( GetFontColor() )
			]
		];
	}
Пример #7
0
void SComboButton::Construct( const FArguments& InArgs )
{
	check(InArgs._ComboButtonStyle);

	// Work out which values we should use based on whether we were given an override, or should use the style's version
	const FButtonStyle* const OurButtonStyle = InArgs._ButtonStyle ? InArgs._ButtonStyle : &InArgs._ComboButtonStyle->ButtonStyle;

	MenuBorderBrush = &InArgs._ComboButtonStyle->MenuBorderBrush;
	MenuBorderPadding = InArgs._ComboButtonStyle->MenuBorderPadding;
	
	OnComboBoxOpened = InArgs._OnComboBoxOpened;
	ContentWidgetPtr = InArgs._MenuContent.Widget;
	bIsFocusable = InArgs._IsFocusable;

	TSharedPtr<SHorizontalBox> HBox;

	SMenuAnchor::Construct( SMenuAnchor::FArguments()
		.Placement(InArgs._MenuPlacement)
		.Method(InArgs._Method)
		.OnMenuOpenChanged(InArgs._OnMenuOpenChanged)
		.OnGetMenuContent(InArgs._OnGetMenuContent)
		[
			SNew( SButton )
			.ButtonStyle( OurButtonStyle )
			.ClickMethod( EButtonClickMethod::MouseDown )
			.OnClicked( this, &SComboButton::OnButtonClicked )
			.ContentPadding( InArgs._ContentPadding )
			.ForegroundColor( InArgs._ForegroundColor )
			.ButtonColorAndOpacity( InArgs._ButtonColorAndOpacity )
			.IsFocusable( InArgs._IsFocusable )
			[
				// Button and down arrow on the right
				// +-------------------+---+
				// | Button Content    | v |
				// +-------------------+---+
				SAssignNew( HBox, SHorizontalBox )
				+ SHorizontalBox::Slot()
				.Expose( ButtonContentSlot )
				.FillWidth( 1 )
				.HAlign( InArgs._HAlign )
				.VAlign( InArgs._VAlign )
				[
					InArgs._ButtonContent.Widget
				]
				+ SHorizontalBox::Slot()
				.AutoWidth()
				.HAlign( HAlign_Center )
				.VAlign( VAlign_Center )
				.Padding( InArgs._HasDownArrow ? 2 : 0 )
				[
					SNew( SImage )
					.Visibility( InArgs._HasDownArrow ? EVisibility::Visible : EVisibility::Collapsed )
					.Image( &InArgs._ComboButtonStyle->DownArrowImage )
					// Inherit tinting from parent
					. ColorAndOpacity( FSlateColor::UseForeground() )
				]
			]
		]
	);

	
	// The menu that pops up when we press the button.
	// We keep this content around, and then put it into a new window when we need to pop
	// it up.
	SetMenuContent( InArgs._MenuContent.Widget );
}
void SRealtimeProfilerLineGraph::Construct(const FArguments& InArgs)
{
	MaxValue = InArgs._MaxValue;
	MaxFrames = InArgs._MaxFrames;
	OnGeometryChanged = InArgs._OnGeometryChanged;
	Zoom = 1.0f;
	Offset = 0.0f;
	bIsProfiling = false;
	Visualizer = InArgs._Visualizer;
	bDisplayFPSChart = false;

	ChildSlot
	.HAlign(HAlign_Left)
	.VAlign(VAlign_Top)
	[
		SNew(SHorizontalBox)

		//START
		+SHorizontalBox::Slot()
		.AutoWidth()
		[
			SAssignNew(StartButton,SButton)
			.ToolTipText(NSLOCTEXT("RealtimeProfileLineGraph", "StartProfilingButton", "Start"))
			.OnClicked(this, &SRealtimeProfilerLineGraph::OnStartButtonDown)
			.ContentPadding(1)
			.Visibility(this, &SRealtimeProfilerLineGraph::GetStartButtonVisibility)
			[
				SNew(SImage) 
				.Image( FEditorStyle::GetBrush("Profiler.Start") ) 
			]
		]

		//PAUSE
		+SHorizontalBox::Slot()
		.AutoWidth()
		[
			SAssignNew(PauseButton,SButton)
			.ToolTipText(NSLOCTEXT("RealtimeProfileLineGraph", "PauseProfilingButton", "Pause"))
			.OnClicked(this, &SRealtimeProfilerLineGraph::OnPauseButtonDown)
			.ContentPadding(1)
			.Visibility(this, &SRealtimeProfilerLineGraph::GetPauseButtonVisibility)
			[
				SNew(SImage) 
				.Image( FEditorStyle::GetBrush("Profiler.Pause") ) 
			]
		]

		//STOP
		+SHorizontalBox::Slot()
		.AutoWidth()
		[
			SNew(SButton)
			.ToolTipText(NSLOCTEXT("RealtimeProfileLineGraph", "StopProfilingButton", "Stop"))
			.OnClicked(this, &SRealtimeProfilerLineGraph::OnStopButtonDown)
			.ContentPadding(1)
			[
				SNew(SImage) 
				.Image( FEditorStyle::GetBrush("Profiler.Stop") ) 
			]
		]

		//SWITCH GRAPH VIEW
		+SHorizontalBox::Slot()
		.AutoWidth()
		[
			SNew(SButton)
			.ToolTipText(NSLOCTEXT("RealtimeProfileLineGraph", "SwitchProfilingViewButton", "Switch View"))
			.OnClicked(this, &SRealtimeProfilerLineGraph::OnSwitchViewButtonDown)
			.ContentPadding(1)
			[
				SNew(SImage) 
				.Image( FEditorStyle::GetBrush("Profiler.SwitchView") ) 
			]
		]

	];

	
}
void SSessionLauncherDeployRepositorySettings::Construct( const FArguments& InArgs, const FSessionLauncherModelRef& InModel )
{
	Model = InModel;

	ChildSlot
	[
		SNew(SVerticalBox)


		+ SVerticalBox::Slot()
		.FillHeight(1.0)
		[
			SNew(SBorder)
			.Padding(8.0)
			.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
			[
				SNew(SVerticalBox)

				+ SVerticalBox::Slot()
				.AutoHeight()
				[
					SNew(STextBlock)
					.Text(LOCTEXT("RepositoryPathLabel", "Repository Path:").ToString())
				]

				+ SVerticalBox::Slot()
					.AutoHeight()
					.Padding(0.0, 4.0, 0.0, 0.0)
					[
						SNew(SHorizontalBox)

						+ SHorizontalBox::Slot()
						.FillWidth(1.0)
						.Padding(0.0, 0.0, 0.0, 3.0)
						[
							// repository path text box
							SAssignNew(RepositoryPathTextBox, SEditableTextBox)
							.OnTextCommitted(this, &SSessionLauncherDeployRepositorySettings::OnTextCommitted)
							.OnTextChanged(this, &SSessionLauncherDeployRepositorySettings::OnTextChanged)
						]

						+ SHorizontalBox::Slot()
							.AutoWidth()
							.HAlign(HAlign_Right)
							.Padding(4.0, 0.0, 0.0, 0.0)
							[
								// browse button
								SNew(SButton)
								.ContentPadding(FMargin(6.0, 2.0))
								.IsEnabled(true)
								.Text(LOCTEXT("BrowseButtonText", "Browse...").ToString())
								.ToolTipText(LOCTEXT("BrowseButtonToolTip", "Browse for the repository").ToString())
								.OnClicked(this, &SSessionLauncherDeployRepositorySettings::HandleBrowseButtonClicked)
							]
					]
			]
		]

		+ SVerticalBox::Slot()
			.AutoHeight()
			[
				SNew(SBorder)
					.Padding(8.0f)
					.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
					[
						// deploy targets area
						SNew(SSessionLauncherDeployTargets, InModel)
					]
			]
	];
}
void FSlateFontInfoStructCustomization::CustomizeHeader(TSharedRef<IPropertyHandle> InStructPropertyHandle, FDetailWidgetRow& InHeaderRow, IPropertyTypeCustomizationUtils& InStructCustomizationUtils)
{
	static const FName FontObjectPropertyName = GET_MEMBER_NAME_CHECKED(FSlateFontInfo, FontObject);
	static const FName TypefaceFontNamePropertyName = GET_MEMBER_NAME_CHECKED(FSlateFontInfo, TypefaceFontName);
	static const FName SizePropertyName = GET_MEMBER_NAME_CHECKED(FSlateFontInfo, Size);

	StructPropertyHandle = InStructPropertyHandle;

	FontObjectProperty = InStructPropertyHandle->GetChildHandle(FontObjectPropertyName);
	check(FontObjectProperty.IsValid());

	TypefaceFontNameProperty = InStructPropertyHandle->GetChildHandle(TypefaceFontNamePropertyName);
	check(TypefaceFontNameProperty.IsValid());

	FontSizeProperty = InStructPropertyHandle->GetChildHandle(SizePropertyName);
	check(FontSizeProperty.IsValid());

	InHeaderRow
	.NameContent()
	[
		InStructPropertyHandle->CreatePropertyNameWidget()
	]
	.ValueContent()
	.MinDesiredWidth(250.0f)
	.MaxDesiredWidth(0.0f)
	.HAlign(HAlign_Fill)
	.VAlign(VAlign_Center)
	[
		SNew(SHorizontalBox)

		+SHorizontalBox::Slot()
		.FillWidth(2)
		[
			SNew(SObjectPropertyEntryBox)
			.PropertyHandle(FontObjectProperty)
			.AllowedClass(UFont::StaticClass())
			.OnShouldFilterAsset(FOnShouldFilterAsset::CreateStatic(&FSlateFontInfoStructCustomization::OnFilterFontAsset))
			.OnObjectChanged(this, &FSlateFontInfoStructCustomization::OnFontChanged)
			.DisplayUseSelected(false)
			.DisplayBrowse(false)
		]

		+SHorizontalBox::Slot()
		.FillWidth(2)
		.VAlign(VAlign_Center)
		[
			SAssignNew(FontEntryCombo, SComboBox<TSharedPtr<FName>>)
			.OptionsSource(&FontEntryComboData)
			.IsEnabled(this, &FSlateFontInfoStructCustomization::IsFontEntryComboEnabled)
			.OnComboBoxOpening(this, &FSlateFontInfoStructCustomization::OnFontEntryComboOpening)
			.OnSelectionChanged(this, &FSlateFontInfoStructCustomization::OnFontEntrySelectionChanged)
			.OnGenerateWidget(this, &FSlateFontInfoStructCustomization::MakeFontEntryWidget)
			[
				SNew(STextBlock)
				.Text(this, &FSlateFontInfoStructCustomization::GetFontEntryComboText)
				.Font(FEditorStyle::GetFontStyle(TEXT("PropertyWindow.NormalFont")))
			]
		]

		+SHorizontalBox::Slot()
		.FillWidth(1)
		.VAlign(VAlign_Center)
		.Padding(FMargin(4.0f, 0.0f, 0.0f, 0.0f))
		[
			SNew(SProperty, FontSizeProperty)
			.ShouldDisplayName(false)
		]
	];
}
Пример #11
0
TSharedRef<SHorizontalBox> SDistributionCurveEditor::BuildToolBar()
{
	SelectedTab = TabNames[0];

	FToolBarBuilder ToolbarBuilder( UICommandList, FMultiBoxCustomization::None );
	ToolbarBuilder.BeginSection("CurveEditorFit");
	{
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().FitHorizontally);
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().FitVertically);
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().FitToAll);
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().FitToSelected);
	}
	ToolbarBuilder.EndSection();

	ToolbarBuilder.BeginSection("CurveEditorMode");
	{
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().PanMode);
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().ZoomMode);
	}
	ToolbarBuilder.EndSection();

	ToolbarBuilder.BeginSection("CurveEditorTangentTypes");
	{
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().CurveAuto);
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().CurveAutoClamped);
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().CurveUser);
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().CurveBreak);
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().Linear);
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().Constant);
	}
	ToolbarBuilder.EndSection();

	ToolbarBuilder.BeginSection("CurveEditorTangentOptions");
	{
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().FlattenTangents);
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().StraightenTangents);
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().ShowAllTangents);
	}
	ToolbarBuilder.EndSection();

	ToolbarBuilder.BeginSection("CurveEditorTabs");
	{
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().CreateTab);
		ToolbarBuilder.AddToolBarButton(FCurveEditorCommands::Get().DeleteTab);
		ToolbarBuilder.AddWidget(
			SNew(SBox)
			.WidthOverride(175)
			[
				SNew(SVerticalBox)
				+SVerticalBox::Slot()
				.Padding(4)
				[
					SNew(STextBlock)
					.Text(LOCTEXT("CurrentTab", "Current Tab: "))
					.Visibility( this, &SDistributionCurveEditor::GetLargeIconVisibility )
				]
				+SVerticalBox::Slot()
				.AutoHeight()
				.Padding(4,0)
				[
					SAssignNew(TabNamesComboBox, STextComboBox)
					.OptionsSource(&TabNames)
					.OnSelectionChanged(this, &SDistributionCurveEditor::TabSelectionChanged)
					.InitiallySelectedItem(SelectedTab)
				]
			]
		);
	}
	ToolbarBuilder.EndSection();

	return
	SNew(SHorizontalBox)
	+SHorizontalBox::Slot()
	.Padding(4,0)
	[
		SNew(SBorder)
		.Padding(0)
		.BorderImage(FEditorStyle::GetBrush("NoBorder"))
		.IsEnabled(FSlateApplication::Get().GetNormalExecutionAttribute())
		[
			ToolbarBuilder.MakeWidget()
		]
	];
}
void SScrubControlPanel::Construct( const SScrubControlPanel::FArguments& InArgs )
{
	ScrubWidget = NULL;

	IsRealtimeStreamingMode = InArgs._IsRealtimeStreamingMode;
	
	FEditorWidgetsModule& EditorWidgetsModule = FModuleManager::Get().LoadModuleChecked<FEditorWidgetsModule>( "EditorWidgets" );
	
	FTransportControlArgs TransportControlArgs;
	TransportControlArgs.OnForwardPlay = InArgs._OnClickedForwardPlay;
	TransportControlArgs.OnRecord = InArgs._OnClickedRecord;
	TransportControlArgs.OnBackwardPlay = InArgs._OnClickedBackwardPlay;
	TransportControlArgs.OnForwardStep = InArgs._OnClickedForwardStep;
	TransportControlArgs.OnBackwardStep = InArgs._OnClickedBackwardStep;
	TransportControlArgs.OnForwardEnd = InArgs._OnClickedForwardEnd;
	TransportControlArgs.OnBackwardEnd = InArgs._OnClickedBackwardEnd;
	TransportControlArgs.OnToggleLooping = InArgs._OnClickedToggleLoop;
	TransportControlArgs.OnGetLooping = InArgs._OnGetLooping;
	TransportControlArgs.OnGetPlaybackMode = InArgs._OnGetPlaybackMode;
	
	FTransportControlArgs TransportControlArgsForRealtimeStreamingMode;
	TransportControlArgsForRealtimeStreamingMode.OnForwardPlay = TransportControlArgs.OnForwardPlay;
	TransportControlArgsForRealtimeStreamingMode.OnForwardStep = TransportControlArgs.OnForwardStep;
	TransportControlArgsForRealtimeStreamingMode.OnGetPlaybackMode = TransportControlArgs.OnGetPlaybackMode;

	this->ChildSlot
	.Padding( FMargin( 0.0f, 1.0f) )
	[
		SNew(SHorizontalBox)
		+SHorizontalBox::Slot()
		.HAlign(HAlign_Fill) 
		.VAlign(VAlign_Center)
		.FillWidth(1)
		.Padding( FMargin( 0.0f, 0.0f) )
		[
			SNew( SBorder )
			[
				SAssignNew(ScrubWidget, SScrubWidget)
				.Value(InArgs._Value)
				.NumOfKeys(InArgs._NumOfKeys)
				.SequenceLength(InArgs._SequenceLength)
				.OnValueChanged(InArgs._OnValueChanged)
				.OnBeginSliderMovement(InArgs._OnBeginSliderMovement)
				.OnEndSliderMovement(InArgs._OnEndSliderMovement)
				.ViewInputMin(InArgs._ViewInputMin)
				.ViewInputMax(InArgs._ViewInputMax)
				.OnSetInputViewRange(InArgs._OnSetInputViewRange)
				.OnCropAnimSequence(InArgs._OnCropAnimSequence)
				.OnReZeroAnimSequence(InArgs._OnReZeroAnimSequence)
				.bAllowZoom(InArgs._bAllowZoom)
				/** Optional, additional values to draw on the timeline **/
				.DraggableBars(InArgs._DraggableBars)
				.OnBarDrag(InArgs._OnBarDrag)
			]
		]

		// Padding
		+SHorizontalBox::Slot()
		.AutoWidth()
		[
			// Padding to make controls line up with the track label widths.
			// note: a more robust way to accomplish this would be nice.
			SNew(SSpacer)
			.Size(FVector2D(16.0f, 16.0f))
		]

		+SHorizontalBox::Slot()
		.AutoWidth()
		[
			SNew(SBorder)
			.Padding(0)
			.BorderImage(FEditorStyle::GetBrush("NoBorder"))
			.Visibility(this, &SScrubControlPanel::GetRealtimeControlVisibility, false)
			[
				EditorWidgetsModule.CreateTransportControl(TransportControlArgs)
			]
		]

		+SHorizontalBox::Slot()
		.AutoWidth()
		[
			SNew(SBorder)
			.Padding(0)
			.BorderImage(FEditorStyle::GetBrush("NoBorder"))
			.Visibility(this, &SScrubControlPanel::GetRealtimeControlVisibility, true)
			[
				EditorWidgetsModule.CreateTransportControl(TransportControlArgsForRealtimeStreamingMode)
			]
		]
	];
}
Пример #13
0
void SLevelEditorActiveToolkit::Construct( const FArguments&, const TSharedPtr< IToolkit >& InitToolkit, const FEdMode* InitEditorMode )
{
	Toolkit = InitToolkit;
	EditorMode = InitEditorMode;

	ActiveToolkitType = Toolkit.IsValid() ? ELevelEditorActiveToolkit::Toolkit : ELevelEditorActiveToolkit::LegacyEditorMode;
	check( ( ActiveToolkitType == ELevelEditorActiveToolkit::Toolkit && Toolkit.IsValid() ) ||
		   ( ActiveToolkitType == ELevelEditorActiveToolkit::LegacyEditorMode && EditorMode != NULL ) );

	const bool bIsAssetEditorToolkit = ActiveToolkitType == ELevelEditorActiveToolkit::Toolkit && InitToolkit->IsAssetEditor();

	// @todo toolkit major: Improve look of this:
	//		- draw icon for asset editor (e.g. blueprint icon)
	//				- Probably should appear in standalone version too!
	//		- make text more pronounced!  maybe use two lines (put editor name on second line, smaller text?)
	//		- combo drop-down looks horrible...
	//
	//		- highlight all related tabs on mouse over
	//		- maybe change to task bar styling?
	//		- icon to "tear out and edit standalone"?  Or drag tear?
	//		- what about asset type or path?
	//		- animation transitions when mode is opened and killed?
	//		- animation when focusing tabs?
	//
	//		- new toolkit doc area tabs should animate in (like they do when closing!) (see CreateNewTabStackBySplitting)
	//		- need visual cue when there are no toolkits around (currently just empty expando)
	//		- color distinction between modes and asset editors?

	TSharedPtr< SHorizontalBox > ContentBox;

	ChildSlot
		[
			SNew( SBorder )
				.Padding( 3.0f )
				[
					SNew( SOverlay )
						+SOverlay::Slot()
						[
							SNew(SImage)
								// Don't allow color overlay to absorb mouse clicks
								.Visibility( EVisibility::HitTestInvisible )
								.Image( FEditorStyle::GetBrush( "ToolkitDisplay.ColorOverlay" ) )
								.ColorAndOpacity( this, &SLevelEditorActiveToolkit::GetToolkitBackgroundOverlayColor )
						]
	
						+SOverlay::Slot()
						[
							SAssignNew( ContentBox, SHorizontalBox )
								+SHorizontalBox::Slot()
									.FillWidth( 1.0f )
									[
										SNew( SHorizontalBox )
											+SHorizontalBox::Slot()
												.AutoWidth()
												.Padding( 4.0f, 7.0f, 3.0f, 3.0f )
												[
													// @todo toolkit major: Separate asset name from editor name (and draw unsaved change state next to asset part)
													SNew( SHyperlink )
														.Text( this, &SLevelEditorActiveToolkit::GetToolkitTextLabel )
														.OnNavigate( this, &SLevelEditorActiveToolkit::OnNavigateToToolkit )
												]

											// Asset modified state
											+SHorizontalBox::Slot()
											.AutoWidth()
											.Padding( 0.0f, 0.0f, 3.0f, 0.0f )
											[
												SNew( SImage )
												.Visibility( this, &SLevelEditorActiveToolkit::GetVisibilityForUnsavedChangeIcon )
												.Image( FEditorStyle::GetBrush( "ToolkitDisplay.UnsavedChangeIcon" ) )
												.ToolTipText( LOCTEXT("UnsavedChangeToolTip", "This asset has unsaved changes").ToString() )
											]
									]
						]
				]
		];


	if( bIsAssetEditorToolkit )
	{
		TSharedRef< FAssetEditorToolkit > AssetEditorToolkit = StaticCastSharedPtr< FAssetEditorToolkit >( Toolkit ).ToSharedRef();
		// We want the window to be closed after the user chooses an option from the drop-down
		const bool bIsPopup = true;

		ContentBox->AddSlot()
			.AutoWidth()
			.VAlign(VAlign_Center)
			.HAlign( HAlign_Right )
			[
				SNew( SComboButton )
					.ComboButtonStyle(FEditorStyle::Get(), "ToolkitDisplay.ComboButton")
					.ButtonContent()
					[
						SNew(SImage)
							.Image( FEditorStyle::GetBrush( "ToolkitDisplay.MenuDropdown" ) )
					]
					.MenuContent()
					[
						SNew( SAssetEditorCommon, AssetEditorToolkit, bIsPopup )
					]
			];
	}


	ContentBox->AddSlot()
		.AutoWidth()
		.HAlign( HAlign_Right )	// @todo toolkit major: Needs hover cue, visual polish, margins (probably should be consistent with tab close button)
		.Padding( 2.0f )
		[
			SNew( SButton )
				.OnClicked( this, &SLevelEditorActiveToolkit::OnToolkitCloseButtonClicked )
				.ToolTipText( LOCTEXT("CloseToolkitButton", "Close").ToString() )
				.ButtonStyle( FEditorStyle::Get(), "NoBorder" )
				.ContentPadding(0)
				.HAlign(HAlign_Center)
				.VAlign(VAlign_Center)
				.ForegroundColor( FSlateColor::UseForeground() )
				[
					SNew(SImage)
						.Image( FEditorStyle::GetBrush( "Symbols.X" ) )
						.ColorAndOpacity( FSlateColor::UseForeground() )
				]
		];
}
TSharedRef< SWidget > SAnimCurveListRow::GenerateWidgetForColumn( const FName& ColumnName )
{
	if ( ColumnName == ColumnId_AnimCurveNameLabel )
	{
		TSharedPtr<SAnimCurveViewer> AnimCurveViewer = AnimCurveViewerPtr.Pin();
		if (AnimCurveViewer.IsValid())
		{
			return
				SNew(SVerticalBox)

				+ SVerticalBox::Slot()
				.AutoHeight()
				.Padding(4)
				.VAlign(VAlign_Center)
				[
					SAssignNew(Item->EditableText, SInlineEditableTextBlock)
					.OnTextCommitted(AnimCurveViewer.Get(), &SAnimCurveViewer::OnNameCommitted, Item)
					.ColorAndOpacity(this, &SAnimCurveListRow::GetItemTextColor)
					.IsSelected(this, &SAnimCurveListRow::IsSelected)
					.Text(this, &SAnimCurveListRow::GetItemName)
					.HighlightText(this, &SAnimCurveListRow::GetFilterText)
				];
		}
		else
		{
			return SNullWidget::NullWidget;
		}
	}
	else if (ColumnName == ColumnID_AnimCurveTypeLabel)
	{
		TSharedPtr<SAnimCurveViewer> AnimCurveViewer = AnimCurveViewerPtr.Pin();
		if (AnimCurveViewer.IsValid())
		{
			return
				SNew(SVerticalBox)

				+ SVerticalBox::Slot()
				.AutoHeight()
				.Padding(4)
				.VAlign(VAlign_Center)
				[
					GetCurveTypeWidget()
				];
		}
		else
		{
			return SNullWidget::NullWidget;
		}
	}
	else if ( ColumnName == ColumnID_AnimCurveWeightLabel )
	{
		// Encase the SSpinbox in an SVertical box so we can apply padding. Setting ItemHeight on the containing SListView has no effect :-(
		return
			SNew( SVerticalBox )

			+ SVerticalBox::Slot()
			.AutoHeight()
			.Padding( 0.0f, 1.0f )
			.VAlign( VAlign_Center )
			[
				SNew( SSpinBox<float> )
				.MinSliderValue(-1.f)
				.MaxSliderValue(1.f)
				.MinValue(-MaxMorphWeight)
				.MaxValue(MaxMorphWeight)
				.Value( this, &SAnimCurveListRow::GetWeight )
				.OnValueChanged( this, &SAnimCurveListRow::OnAnimCurveWeightChanged )
				.OnValueCommitted( this, &SAnimCurveListRow::OnAnimCurveWeightValueCommitted )
			];
	}
	else 
	{
		return
			SNew(SVerticalBox)

			+ SVerticalBox::Slot()
			.AutoHeight()
			.Padding(0.0f, 1.0f)
			.VAlign(VAlign_Center)
			.HAlign(HAlign_Center)
			[
				SNew(SCheckBox)
				.OnCheckStateChanged(this, &SAnimCurveListRow::OnAnimCurveAutoFillChecked)
				.IsChecked(this, &SAnimCurveListRow::IsAnimCurveAutoFillChangedChecked)
			];
	}
}
void SARCharacterSheetWidget::Construct(const FArguments& InArgs)
{
	OwnerHUD = InArgs._OwnerHUD;
	MyPC = InArgs._MyPC;
	Character = InArgs._Character;
	Equipment = InArgs._Equipment;
	SyncLeftHandWeapons();
	SyncRightHandWeapons();
	SyncEquipmentWeapons();
	ChildSlot
		[
			SNew(SGridPanel)
			+ SGridPanel::Slot(1, 1)
			.ColumnSpan(6)
			[
				SNew(SBorder) //add visibility check
				.BorderBackgroundColor(FSlateColor(FLinearColor(1, 0, 0, 1)))
				[
					SNew(SOverlay)
					+ SOverlay::Slot()
					[
						SNew(SBox)
						.HeightOverride(52)
						.WidthOverride(400)
						[
							SAssignNew(LeftWeapon, STileView<TSharedPtr<FARDragDropInfo>>)
							.ListItemsSource(&LeftHandWeapons)
							.OnGenerateTile(this, &SARCharacterSheetWidget::MakeLeftHandWeaponWidget)
							.ItemHeight(50)
							.ItemWidth(50)
						]
					]
				]
			]
			+ SGridPanel::Slot(1, 2)
			.ColumnSpan(6)
			[
				SNew(SBorder) //add visibility check
				.BorderBackgroundColor(FSlateColor(FLinearColor(1, 0, 0, 1)))
				[
					SNew(SOverlay)
					+ SOverlay::Slot()
					[
						SNew(SBox)
						.HeightOverride(52)
						.WidthOverride(400)
						[
							SAssignNew(RightWeapon, STileView<TSharedPtr<FARDragDropInfo>>)
							.ListItemsSource(&RightHandWeapons)
							.OnGenerateTile(this, &SARCharacterSheetWidget::MakeRightHandWeaponWidget)
							.ItemHeight(50)
							.ItemWidth(50)
						]
					]
				]
			]
			+ SGridPanel::Slot(1, 3)
			.ColumnSpan(6)
			[
				SNew(SBorder) //add visibility check
				.BorderBackgroundColor(FSlateColor(FLinearColor(1, 0, 0, 1)))
				[
					SNew(SOverlay)
					+ SOverlay::Slot()
					[
						SNew(SBox)
						.HeightOverride(52)
						.WidthOverride(400)
						[
							SAssignNew(EquipmentSlot, STileView<TSharedPtr<FARDragDropInfo>>)
							.ListItemsSource(&EquipmentSlots)
							.OnGenerateTile(this, &SARCharacterSheetWidget::MakeEquipmentSlotsWeaponWidget)
							.ItemHeight(50)
							.ItemWidth(50)
						]
					]
				]
			]

		];
}
	/**
	 * Construct this widget
	 *
	 * @param	InArgs	The declaration data for this widget
	 */
	void Construct( const FArguments& InArgs )
	{
		FName ButtonStyle = FEditorStyle::Join(InArgs._Style.Get(), ".Button");
		FName CheckboxStyle = FEditorStyle::Join(InArgs._Style.Get(), ".ToggleButton");
	
		const FSlateIcon& Icon = InArgs._Icon.Get();

		ParentToolBar = InArgs._ParentToolBar;
	
		TSharedPtr<SCheckBox> ToggleControl;
		{
			ToggleControl = SNew(SCheckBox)
			.Cursor( EMouseCursor::Default )
			.Padding(FMargin( 4.0f ))
			.Style(FEditorStyle::Get(), EMultiBlockLocation::ToName(CheckboxStyle, EMultiBlockLocation::Start))
			.OnCheckStateChanged(InArgs._OnCheckStateChanged)
			.ToolTipText(InArgs._ToggleButtonToolTip)
			.IsChecked(InArgs._IsChecked)
			.Content()
			[
				SNew( SBox )
				.WidthOverride( TransformViewportToolbarDefs::ToggleImageScale )
				.HeightOverride( TransformViewportToolbarDefs::ToggleImageScale )
				.HAlign(HAlign_Center)
				.VAlign(VAlign_Center)
				[
					SNew(SImage)
					.Image(Icon.GetIcon())
				]
			];
		}

		{
			SAssignNew( MenuAnchor, SMenuAnchor )
			.Placement( MenuPlacement_BelowAnchor )
			[
				SNew(SButton)
				.ButtonStyle( FEditorStyle::Get(), EMultiBlockLocation::ToName(ButtonStyle,EMultiBlockLocation::End) )
				.ContentPadding( FMargin( 5.0f, 0.0f ) )
				.ToolTipText(InArgs._MenuButtonToolTip)
				.OnClicked(this, &SGridSnapSetting::OnMenuClicked)
				[
					SNew(SVerticalBox)
					+SVerticalBox::Slot()
					.AutoHeight()
					.HAlign(HAlign_Center)
					.VAlign(VAlign_Top)
					[
						SNew(STextBlock)
						.Font( FEditorStyle::GetFontStyle( InArgs._Style.Get(), ".Label.Font" ) )
						.Text(InArgs._Label)
					]
					+SVerticalBox::Slot()
					.AutoHeight()
					.VAlign(VAlign_Bottom)
					[
						SNew(SHorizontalBox)
						+SHorizontalBox::Slot()
						.FillWidth(1.0f)

						+SHorizontalBox::Slot()
						.AutoWidth()
						[
							SNew( SBox )
							.WidthOverride( TransformViewportToolbarDefs::DownArrowSize )
							.HeightOverride( TransformViewportToolbarDefs::DownArrowSize )
							[
								SNew(SImage)
								.Image(FEditorStyle::GetBrush("ComboButton.Arrow"))
								.ColorAndOpacity(FLinearColor::Black)
							]
						]

						+SHorizontalBox::Slot()
							.FillWidth(1.0f)
					]
				]
			]
			.OnGetMenuContent( InArgs._OnGetMenuContent );
		}


		ChildSlot
		[
			SNew(SHorizontalBox)

			//Checkbox concept
			+SHorizontalBox::Slot()
			.AutoWidth()
			[
				ToggleControl->AsShared()
			]

			// Black Seperator line
			+SHorizontalBox::Slot()
			.AutoWidth()
			[
				SNew( SBox )
				.WidthOverride( 1 )
				[
					SNew(SImage)
					.Image(FEditorStyle::GetBrush(EMultiBlockLocation::ToName(ButtonStyle,EMultiBlockLocation::Middle)))
					.ColorAndOpacity(FLinearColor::Black)
				]
			]

			// Menu dropdown concept
			+SHorizontalBox::Slot()
			.AutoWidth()
			[
				MenuAnchor->AsShared()
			]
		];
	}
void SGraphNodeK2Var::UpdateGraphNode()
{
	InputPins.Empty();
	OutputPins.Empty();

	// Reset variables that are going to be exposed, in case we are refreshing an already setup node.
	RightNodeBox.Reset();
	LeftNodeBox.Reset();

	FText TitleText;
	bool bPadTitle = false;
	float HorizontalTitleMargin = 0.0f;
	float VerticalTitleMargin = 8.0f;
	FMargin TitleMargin = FMargin(0.0f, 8.0f);
	FMargin ContentAreaMargin = FMargin(0.0f, 4.0f);
	EHorizontalAlignment TitleHAlign = HAlign_Center;
	TSharedPtr<SWidget> TitleWidget;

	if (GraphNode->IsA(UK2Node_VariableSet::StaticClass()))
	{
		UK2Node_VariableSet *SetNode = Cast<UK2Node_VariableSet>(GraphNode);
		if(SetNode->HasLocalRepNotify())
		{
			TitleText = NSLOCTEXT("GraphEditor", "VariableSetWithNotify", "SET w/ Notify");
		}
		else
		{
			TitleText = NSLOCTEXT("GraphEditor", "VariableSet", "SET");
		}
	}
	else if (UK2Node_StructOperation* StructOp = Cast<UK2Node_StructOperation>(GraphNode))
	{
		FFormatNamedArguments Args;
		Args.Add(TEXT("VariableName"), StructOp->GetVarNameText());
		if (GraphNode->IsA(UK2Node_StructMemberGet::StaticClass()))
		{
			TitleText = FText::Format(NSLOCTEXT("GraphEditor", "StructMemberGet", "Get in {VariableName}"), Args);
		}
		else if (GraphNode->IsA(UK2Node_StructMemberSet::StaticClass()))
		{
			TitleText = FText::Format(NSLOCTEXT("GraphEditor", "StructMemberSet", "Set in {VariableName}"), Args);
		}
		else if (GraphNode->IsA(UK2Node_MakeStruct::StaticClass()))
		{
			TitleText = FText::Format(NSLOCTEXT("GraphEditor", "MakeStruct", "Make {VariableName}"), Args);
		}
		else
		{
			check(false);
		}
		bPadTitle = true;
		HorizontalTitleMargin = 12.0f;
		TitleMargin = FMargin(12.0f, VerticalTitleMargin);
	}
	else if (UK2Node_Literal* LiteralRef = Cast<UK2Node_Literal>(GraphNode))
	{
		FText SubTitleText;

		// Get the name of the level the object is in.
		if(AActor* Actor = Cast<AActor>(LiteralRef->GetObjectRef()))
		{
			FText LevelName;

			if(ULevel* Level = Actor->GetLevel())
			{
				if ( Level->IsPersistentLevel() )
				{
					LevelName = NSLOCTEXT("GraphEditor", "PersistentTag", "Persistent Level");
				}
				else
				{
					LevelName = FText::FromString(FPaths::GetCleanFilename(Actor->GetOutermost()->GetName()));
				}
			}
			SubTitleText = FText::Format(NSLOCTEXT("GraphEditor", "ActorRef", "from {0}"), LevelName);
		}

		TitleText = GraphNode->GetNodeTitle(ENodeTitleType::FullTitle);

		TitleHAlign = HAlign_Left;
		TitleMargin = FMargin(12.0f, VerticalTitleMargin, 32.0f, 2.0f);

		TitleWidget = 
			SNew(SHorizontalBox)
			+SHorizontalBox::Slot()
				.HAlign(HAlign_Left)
				.VAlign(VAlign_Top)
				.AutoWidth()
			[
				SNew(SImage)
				.Image(FSlateIconFinder::FindIconBrushForClass(LiteralRef->GetObjectRef() ? LiteralRef->GetObjectRef()->GetClass() : NULL))
			]

			+SHorizontalBox::Slot()
				.Padding(2.0f, 0.0f, 0.0f, 0.0f)
				.HAlign(HAlign_Left)
				.VAlign(VAlign_Top)
				.AutoWidth()
			[
				SNew(SVerticalBox)
				+SVerticalBox::Slot()
					.VAlign(VAlign_Top)
					.AutoHeight()
				[
					SNew(STextBlock)
						.WrapTextAt(128.0f)
						.TextStyle( FEditorStyle::Get(), "Graph.Node.NodeTitle" )
						.Text(TitleText)
				]

				+SVerticalBox::Slot()
					.VAlign(VAlign_Top)
					.AutoHeight()
				[
					SNew(STextBlock)
						.Visibility(TitleText.IsEmpty()? EVisibility::Collapsed : EVisibility::Visible)
						.WrapTextAt(128.0f)
						.TextStyle( FEditorStyle::Get(), "Graph.Node.NodeTitleExtraLines" )
						.Text(SubTitleText)
				]
			];
	}
	else if (UK2Node_VariableGet* VariableGet = Cast<UK2Node_VariableGet>(GraphNode))
	{
		if (!VariableGet->IsNodePure())
		{
			TitleText = NSLOCTEXT("GraphEditor", "VariableGet", "GET");
			ContentAreaMargin.Top += 16;
		}
	}
	
	if (TitleText.IsEmpty())
	{
		TitleWidget = SNullWidget::NullWidget;
	}

	if(!TitleWidget.IsValid())
	{
		TitleWidget = SNew(STextBlock)
						.TextStyle( FEditorStyle::Get(), "Graph.Node.NodeTitle" )
						.Text(TitleText);
	}

	SetupErrorReporting();

	// Setup a meta tag for this node
	FGraphNodeMetaData TagMeta(TEXT("Graphnode"));
	PopulateMetaTag(&TagMeta);

	//             ________________
	//            | (>) L |  R (>) |
	//            | (>) E |  I (>) |
	//            | (>) F |  G (>) |
	//            | (>) T |  H (>) |
	//            |       |  T (>) |
	//            |_______|________|
	//
	this->ContentScale.Bind( this, &SGraphNode::GetContentScale );
	this->GetOrAddSlot( ENodeZone::Center )
	.HAlign(HAlign_Center)
	.VAlign(VAlign_Center)
	[
		SNew(SVerticalBox)
		+SVerticalBox::Slot()
		[
			SNew(SOverlay)
			.AddMetaData<FGraphNodeMetaData>(TagMeta)
			+ SOverlay::Slot()
			[
				SNew(SImage)
				.Image( FEditorStyle::GetBrush("Graph.VarNode.Body") )
			]
			+ SOverlay::Slot()
			.VAlign(VAlign_Top)
			[
				SNew(SImage)
				.Image( FEditorStyle::GetBrush("Graph.VarNode.ColorSpill") )
				.ColorAndOpacity( this, &SGraphNodeK2Var::GetVariableColor )
			]
			+ SOverlay::Slot()
			[
				SNew(SImage)
				.Image( FEditorStyle::GetBrush("Graph.VarNode.Gloss") )
			]
			+SOverlay::Slot()
			.VAlign(VAlign_Top)
			.HAlign(TitleHAlign)
			.Padding( TitleMargin )
			[
				TitleWidget.ToSharedRef()
			]
			+ SOverlay::Slot()
			.Padding( ContentAreaMargin )
			[
				// NODE CONTENT AREA
				SNew(SHorizontalBox)
				+SHorizontalBox::Slot()
				.HAlign(HAlign_Left)
				.FillWidth(1.0f)
				.Padding( FMargin(2,0) )
				[
					// LEFT
					SAssignNew(LeftNodeBox, SVerticalBox)
				]
				+ SHorizontalBox::Slot()
				.AutoWidth()
				.HAlign(HAlign_Right)
				.Padding( FMargin(2,0) )
				[
					// RIGHT
					SAssignNew(RightNodeBox, SVerticalBox)
				]
			]
		]
		+SVerticalBox::Slot()
		.VAlign(VAlign_Top)
		.AutoHeight() 
		.Padding( FMargin(5.0f, 1.0f) )
		[
			ErrorReporting->AsWidget()
		]
	];

	float VerticalPaddingAmount = 0.0f;

	// Add padding widgets at the top of the pin boxes if it's a struct operation with a long title
	if (bPadTitle)
	{
		VerticalPaddingAmount += 16.0f;
	}

	// Add padding to offset the exec pin so that it will align with other nodes
	if (UK2Node* K2Node = Cast<UK2Node>(GraphNode))
	{
		if (!K2Node->IsNodePure())
		{
			VerticalPaddingAmount += 7.0f;
		}
	}

	if (VerticalPaddingAmount > 0.0f)
	{
		LeftNodeBox->AddSlot()
			.AutoHeight()
			.HAlign(HAlign_Left)
			.VAlign(VAlign_Center)
			[
				SNew(SSpacer).Size(FVector2D(0.0f, VerticalPaddingAmount))
			];
		RightNodeBox->AddSlot()
			.AutoHeight()
			.HAlign(HAlign_Left)
			.VAlign(VAlign_Center)
			[
				SNew(SSpacer).Size(FVector2D(0.0f, VerticalPaddingAmount))
			];
	}
	// Create comment bubble
	TSharedPtr<SCommentBubble> CommentBubble;
	const FSlateColor CommentColor = GetDefault<UGraphEditorSettings>()->DefaultCommentNodeTitleColor;

	SAssignNew( CommentBubble, SCommentBubble )
	.GraphNode( GraphNode )
	.Text( this, &SGraphNode::GetNodeComment )
	.OnTextCommitted( this, &SGraphNode::OnCommentTextCommitted )
	.ColorAndOpacity( CommentColor )
	.AllowPinning( true )
	.EnableTitleBarBubble( true )
	.EnableBubbleCtrls( true )
	.GraphLOD( this, &SGraphNode::GetCurrentLOD )
	.IsGraphNodeHovered( this, &SGraphNode::IsHovered );

	GetOrAddSlot( ENodeZone::TopCenter )
	.SlotOffset( TAttribute<FVector2D>( CommentBubble.Get(), &SCommentBubble::GetOffset ))
	.SlotSize( TAttribute<FVector2D>( CommentBubble.Get(), &SCommentBubble::GetSize ))
	.AllowScaling( TAttribute<bool>( CommentBubble.Get(), &SCommentBubble::IsScalingAllowed ))
	.VAlign( VAlign_Top )
	[
		CommentBubble.ToSharedRef()
	];

	// Create widgets for each of the real pins
	CreatePinWidgets();
}
Пример #18
0
/** Generate a widget for the specified column name */
TSharedRef<SWidget> FPListNodeBoolean::GenerateWidgetForColumn(const FName& ColumnName, int32 Depth, ITableRow* RowPtr)
{
	if(ColumnName == "PListKeyColumn")
	{
		return
		SNew(SBorder)
		.BorderImage_Static(&IPListNode::GetOverlayBrushDelegate, AsShared())
		[
			SNew(SHorizontalBox)

			// Space before item representing expansion
			+ SHorizontalBox::Slot()
			[
				SNew(SSpacer)
				.Size(FVector2D(20 * Depth, 0))
			]

			// Editable key value
			+ SHorizontalBox::Slot()
			.FillWidth(1.0f)
			[
				SAssignNew(KeyStringTextBox, SEditableTextBox)
				.BackgroundColor(this, &FPListNodeBoolean::GetKeyBackgroundColor)
				.ForegroundColor(this, &FPListNodeBoolean::GetKeyForegroundColor)
				.Text(bArrayMember ? FText::FromString(FString::FromInt(ArrayIndex)) : FText::FromString(KeyString))
				.OnTextChanged(this, &FPListNodeBoolean::OnKeyStringChanged)
				.IsReadOnly(bArrayMember)
			]
			
			// Space before type column
			+ SHorizontalBox::Slot()
			[
				SNew(SSpacer)
				.Size(FVector2D(30, 0))
			]
		];
	}

	else if(ColumnName == "PListValueTypeColumn")
	{
		return
		SNew(SBorder)
		.BorderImage_Static(&IPListNode::GetOverlayBrushDelegate, AsShared())
		[
			SNew(STextBlock)
			.Text(NSLOCTEXT("PListEditor", "booleanValueTypeLabel", "boolean"))
		];
	}

	else if(ColumnName == "PListValueColumn")
	{
		return
		SNew(SBorder)
		.BorderImage_Static(&IPListNode::GetOverlayBrushDelegate, AsShared())
		[
			SNew(SHorizontalBox)

			// Editable "value" value
			+ SHorizontalBox::Slot()
			.FillWidth(1.0f)
			[
				SAssignNew(ValueCheckBox, SCheckBox)
				.IsChecked(bValue ? ESlateCheckBoxState::Checked : ESlateCheckBoxState::Unchecked)
				.OnCheckStateChanged(this, &FPListNodeBoolean::OnValueChanged)
			]
		];
	}

	// Invalid column name
	else
	{
		return SNew(STextBlock) .Text(NSLOCTEXT("PListEditor", "UnknownColumn", "Unknown Column"));
	}
}
Пример #19
0
void SDockingArea::Construct( const FArguments& InArgs, const TSharedRef<FTabManager>& InTabManager, const TSharedRef<FTabManager::FArea>& PersistentNode )
{
	MyTabManager = InTabManager;
	InTabManager->GetPrivateApi().OnDockAreaCreated( SharedThis(this) );

	bManageParentWindow = InArgs._ShouldManageParentWindow;
	bIsOverlayVisible = false;

	bIsCenterTargetVisible = false;

	const TAttribute<EVisibility> TargetCrossVisibility = TAttribute<EVisibility>(SharedThis(this), &SDockingArea::TargetCrossVisibility);
	const TAttribute<EVisibility> TargetCrossCenterVisibility = TAttribute<EVisibility>(SharedThis(this), &SDockingArea::TargetCrossCenterVisibility);

	// In DockSplitter mode we just act as a thin shell around a Splitter widget
	this->ChildSlot
	[
		SNew(SOverlay)
		.Visibility( EVisibility::SelfHitTestInvisible )
		+SOverlay::Slot()
		[
			SAssignNew(Splitter, SSplitter)
			. Orientation( PersistentNode->GetOrientation() )
		]
		
		+ SOverlay::Slot()
		// Houses the minimize, maximize, restore, and icon
		.Expose(WindowControlsArea)
		.HAlign(HAlign_Fill)
		.VAlign(VAlign_Top)
		
		+SOverlay::Slot()
		.HAlign(HAlign_Left)
		.VAlign(VAlign_Fill)
		[
			SNew(SDockingTarget)
			.Visibility(TargetCrossVisibility)
			.OwnerNode( SharedThis(this) )
			.DockDirection( SDockingNode::LeftOf )
		]
		+SOverlay::Slot()
		.HAlign(HAlign_Right)
		.VAlign(VAlign_Fill)
		[
			SNew(SDockingTarget)
			.Visibility(TargetCrossVisibility)
			.OwnerNode( SharedThis(this) )
			.DockDirection( SDockingNode::RightOf )
		]
		+SOverlay::Slot()
		.HAlign(HAlign_Fill)
		.VAlign(VAlign_Top)
		[
			SNew(SDockingTarget)
			.Visibility(TargetCrossVisibility)
			.OwnerNode( SharedThis(this) )
			.DockDirection( SDockingNode::Above )
		]
		+SOverlay::Slot()
		.HAlign(HAlign_Fill)
		.VAlign(VAlign_Bottom)
		[
			SNew(SDockingTarget)
			.Visibility(TargetCrossVisibility)
			.OwnerNode( SharedThis(this) )
			.DockDirection( SDockingNode::Below )
		]
		+SOverlay::Slot()
		[
			SNew(SDockingTarget)
			.Visibility(TargetCrossCenterVisibility)
			.OwnerNode( SharedThis(this) )
			.DockDirection( SDockingNode::Center )
		]
	];



	bCleanUpUponTabRelocation = false;

	// If the owner window is set and bManageParentWindow is true, this docknode will close the window when its last tab is removed.
	if (InArgs._ParentWindow.IsValid())
	{
		SetParentWindow(InArgs._ParentWindow.ToSharedRef());
	}
	
		
	// Add initial content if it was provided
	if ( InArgs._InitialContent.IsValid() )
	{
		AddChildNode( InArgs._InitialContent.ToSharedRef() );
	}
}
Пример #20
0
void SComponentClassCombo::Construct(const FArguments& InArgs)
{
	PrevSelectedIndex = INDEX_NONE;
	OnComponentClassSelected = InArgs._OnComponentClassSelected;

	FComponentTypeRegistry::Get().SubscribeToComponentList(ComponentClassList).AddRaw(this, &SComponentClassCombo::UpdateComponentClassList);

	UpdateComponentClassList();

	SAssignNew(ComponentClassListView, SListView<FComponentClassComboEntryPtr>)
		.ListItemsSource(&FilteredComponentClassList)
		.OnSelectionChanged( this, &SComponentClassCombo::OnAddComponentSelectionChanged )
		.OnGenerateRow( this, &SComponentClassCombo::GenerateAddComponentRow )
		.SelectionMode(ESelectionMode::Single);

	SAssignNew(SearchBox, SSearchBox)
		.HintText( LOCTEXT( "BlueprintAddComponentSearchBoxHint", "Search Components" ) )
		.OnTextChanged( this, &SComponentClassCombo::OnSearchBoxTextChanged )
		.OnTextCommitted( this, &SComponentClassCombo::OnSearchBoxTextCommitted );

	// Create the Construct arguments for the parent class (SComboButton)
	SComboButton::FArguments Args;
	Args.ButtonContent()
	[
		SNew(SHorizontalBox)
		+SHorizontalBox::Slot()
		.VAlign(VAlign_Center)
		.AutoWidth()
		.Padding(1.f,1.f)
		[
			SNew(STextBlock)
			.TextStyle(FEditorStyle::Get(), "ContentBrowser.TopBar.Font")
			.Font(FEditorStyle::Get().GetFontStyle("FontAwesome.10"))
			.Text(FString(TEXT("\xf067")) /*fa-plus*/)
		]
		+ SHorizontalBox::Slot()
		.VAlign(VAlign_Center)
		.Padding(1.f)
		[
			SNew(STextBlock)
			.Text(LOCTEXT("AddComponentButtonLabel", "Add Component"))
			.TextStyle(FEditorStyle::Get(), "ContentBrowser.TopBar.Font")
			.Visibility(InArgs._IncludeText.Get() ? EVisibility::Visible : EVisibility::Collapsed)
		]
	]
	.MenuContent()
	[

		SNew(SListViewSelectorDropdownMenu<FComponentClassComboEntryPtr>, SearchBox, ComponentClassListView)
		[
			SNew(SBorder)
			.BorderImage(FEditorStyle::GetBrush("Menu.Background"))
			.Padding(2)
			[
				SNew(SBox)
				.WidthOverride(250)
				[				
					SNew(SVerticalBox)
					+SVerticalBox::Slot()
					.Padding(1.f)
					.AutoHeight()
					[
						SearchBox.ToSharedRef()
					]
					+SVerticalBox::Slot()
					.MaxHeight(400)
					[
						ComponentClassListView.ToSharedRef()
					]
				]
			]
		]
	]
	.IsFocusable(true)
	.ContentPadding(FMargin(5, 0))
	.ComboButtonStyle(FEditorStyle::Get(), "ToolbarComboButton")
	.ButtonStyle(FEditorStyle::Get(), "FlatButton.Success")
	.ForegroundColor(FLinearColor::White)
	.OnComboBoxOpened(this, &SComponentClassCombo::ClearSelection);

	SComboButton::Construct(Args);

	ComponentClassListView->EnableToolTipForceField( true );
	// The base class can automatically handle setting focus to a specified control when the combo button is opened
	SetMenuContentWidgetToFocus( SearchBox );
}
Пример #21
0
//------------------------------------------------------------------------------
void SBlueprintContextTargetMenu::Construct(const FArguments& InArgs, const FBlueprintActionContext& MenuContext)
{
	TargetProfile = FContextMenuTargetProfile(MenuContext);
	OnTargetMaskChanged = InArgs._OnTargetMaskChanged;

	FSlateFontInfo HeaderFontStyle = FEditorStyle::GetFontStyle("BlueprintEditor.ActionMenu.ContextDescriptionFont");
	HeaderFontStyle.Size -= 2.f;
	FText const HeaderText = ContextMenuTargetProfileImpl::GetProfileDescription(MenuContext);

	FText const MenuToolTip = LOCTEXT("MenuToolTip", "Select whose functions/variables you want to see.\nNOTE: Unchecking everything is akin to 'SHOW EVERYTHING' (you're choosing to have NO target context and to not limit the scope)");

	TSharedPtr<SHorizontalBox> MenuBody;
	SBorder::Construct(SBorder::FArguments()
		.BorderImage(FEditorStyle::GetBrush("Menu.Background"))
		.Padding(5.f)
		.ToolTipText(MenuToolTip)
		[
			SNew(SBox)
				.MinDesiredWidth(200)
				.ToolTipText(MenuToolTip)
				.Padding(FMargin(0.f, 0.f, 0.f, 18.f))
			[
				SNew(SVerticalBox)
				+SVerticalBox::Slot()
				.AutoHeight()
				[
					SNew(SBorder)
						.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
						.ForegroundColor(FEditorStyle::GetSlateColor("DefaultForeground"))
					[
						SNew(STextBlock)
							.Text(HeaderText)
							.Font(HeaderFontStyle)
					]
				]

				+SVerticalBox::Slot()
					.VAlign(VAlign_Fill)
					.HAlign(HAlign_Fill)
				[
					SAssignNew(MenuBody, SHorizontalBox)
						.ToolTipText(MenuToolTip)
				]
			]
		]
	);

	const uint32 ColumnCount = 2;
	TSharedPtr<SVerticalBox> Columns[ColumnCount];

	for (int32 Col = 0; Col < ColumnCount; ++Col)
	{
		MenuBody->AddSlot()
			.AutoWidth()
		[
			SAssignNew(Columns[Col], SVerticalBox)
				.ToolTipText(MenuToolTip)
		];
	}

	UEnum* const TargetEnum = FindObject<UEnum>(ANY_PACKAGE, TEXT("EContextTargetFlags"));
	uint32 const GreatestFlag = (EContextTargetFlags::ContextTargetFlagsEnd & ~1);

	int32  ColIndex = 0;
	uint32 TargetFlag = (1<<0);
	while (TargetFlag <= GreatestFlag)
	{
		EContextTargetFlags::Type ContextTarget = (EContextTargetFlags::Type)TargetFlag;
		TargetFlag <<= 1;

		if (TargetEnum && TargetEnum->HasMetaData(TEXT("Hidden"), ContextTarget))
		{
			continue;
		}
		
		FText const MenuName = BlueprintContextTargetMenuImpl::GetContextTargetDisplayName(TargetEnum, ContextTarget);
		const FContextMenuTargetProfile& ProfileRef = TargetProfile;

		Columns[ColIndex]->AddSlot()
			.AutoHeight()
			.VAlign(VAlign_Top)
			.Padding(3.f, 2.5f)
		[
			SNew(SCheckBox)
				.IsEnabled_Raw(&TargetProfile, &FContextMenuTargetProfile::IsTargetEnabled, ContextTarget)
				.IsChecked(this, &SBlueprintContextTargetMenu::GetTargetCheckedState, ContextTarget)
				.OnCheckStateChanged(this, &SBlueprintContextTargetMenu::OnTargetCheckStateChanged, ContextTarget)
				.ToolTipText_Lambda([TargetEnum, ContextTarget, &ProfileRef]()->FText
				{
					if (!ProfileRef.IsTargetEnabled(ContextTarget))
					{
						return LOCTEXT("DisabledTargetTooltip", "This target is invalid or redundent for this context.");
					}
					else if (TargetEnum != nullptr)
					{
						return TargetEnum->GetToolTipText(ContextTarget);
					}
					return LOCTEXT("GenericTargetTooltip", "Include variables/functions that belong to this target.");
				})
			[
				SNew(STextBlock).Text(MenuName)
			]
		];
		
		
		ColIndex = (ColIndex + 1) % ColumnCount;
	}
}
Пример #22
0
void SCollectionListItem::Construct( const FArguments& InArgs )
{
	ParentWidget = InArgs._ParentWidget;
	CollectionItem = InArgs._CollectionItem;
	OnBeginNameChange = InArgs._OnBeginNameChange;
	OnNameChangeCommit = InArgs._OnNameChangeCommit;
	OnVerifyRenameCommit = InArgs._OnVerifyRenameCommit;
	OnAssetsDragDropped = InArgs._OnAssetsDragDropped;
	bDraggedOver = false;

	FString CollectionTypeImage;
	FString CollectionTypeTooltip;
	switch (InArgs._CollectionItem->CollectionType)
	{
	case ECollectionShareType::CST_Shared:
		CollectionTypeImage = TEXT("ContentBrowser.Shared");
		CollectionTypeTooltip = LOCTEXT("SharedCollectionTooltip", "Shared. This collection is visible to everyone.").ToString();
		break;

	case ECollectionShareType::CST_Private:
		CollectionTypeImage = TEXT("ContentBrowser.Private");
		CollectionTypeTooltip = LOCTEXT("PrivateCollectionTooltip", "Private. This collection is only visible to you.").ToString();
		break;

	case ECollectionShareType::CST_Local:
		CollectionTypeImage = TEXT("ContentBrowser.Local");
		CollectionTypeTooltip = LOCTEXT("LocalCollectionTooltip", "Local. This collection is only visible to you and is not in source control.").ToString();
		break;

	default:
		CollectionTypeImage = TEXT("");
		CollectionTypeTooltip = TEXT("");
		break;
	}

	ChildSlot
	[
		SNew(SBorder)
		.BorderImage(this, &SCollectionListItem::GetBorderImage)
		.Padding(0)
		[
			SNew(SHorizontalBox)
			.ToolTip( SNew(SToolTip).Text(CollectionTypeTooltip) )

			+SHorizontalBox::Slot()
			.AutoWidth()
			.VAlign(VAlign_Center)
			.Padding(0, 0, 4, 0)
			[
				// Type Icon
				SNew(SImage)
				.Image( FEditorStyle::GetBrush(*CollectionTypeImage) )
				.ColorAndOpacity( this, &SCollectionListItem::GetCollectionColor )
			]

			+SHorizontalBox::Slot()
			.AutoWidth()
			.VAlign(VAlign_Center)
			[
				SAssignNew(InlineRenameWidget, SInlineEditableTextBlock)
					.Text( this, &SCollectionListItem::GetNameText )
					.Font( FEditorStyle::GetFontStyle("ContentBrowser.SourceListItemFont") )
					.OnBeginTextEdit(this, &SCollectionListItem::HandleBeginNameChange)
					.OnTextCommitted(this, &SCollectionListItem::HandleNameCommitted)
					.OnVerifyTextChanged(this, &SCollectionListItem::HandleVerifyNameChanged)
					.IsSelected( InArgs._IsSelected )
					.IsReadOnly( InArgs._IsReadOnly )
			]
		]
	];

	if(InlineRenameWidget.IsValid())
	{
		// This is broadcast when the context menu / input binding requests a rename
		CollectionItem.Pin()->OnRenamedRequestEvent.AddSP(InlineRenameWidget.Get(), &SInlineEditableTextBlock::EnterEditingMode);
	}
}
void SPropertyEditorAsset::Construct( const FArguments& InArgs, const TSharedPtr<FPropertyEditor>& InPropertyEditor )
{
	PropertyEditor = InPropertyEditor;
	PropertyHandle = InArgs._PropertyHandle;
	OnSetObject = InArgs._OnSetObject;

	UObject* Object = NULL;
	if(PropertyEditor.IsValid())
	{
		UProperty* NodeProperty = PropertyEditor->GetPropertyNode()->GetProperty();
		UObjectPropertyBase* ObjectProperty = Cast<UObjectPropertyBase>( NodeProperty );
		check(ObjectProperty);

		bAllowClear = !(NodeProperty->PropertyFlags & CPF_NoClear);
		PropertyEditor->GetPropertyHandle()->GetValue( Object );
		ObjectClass = ObjectProperty->PropertyClass;
		bIsActor = ObjectProperty->PropertyClass->IsChildOf( AActor::StaticClass() );
	}
	else
	{
		bAllowClear = InArgs._AllowClear;
		ObjectPath = InArgs._ObjectPath;
		ObjectClass = InArgs._Class;
		bIsActor = ObjectClass->IsChildOf( AActor::StaticClass() );
	}
	OnShouldFilterAsset = InArgs._OnShouldFilterAsset;
	
	TSharedPtr<SHorizontalBox> HorizontalBox = NULL;
	ChildSlot
	[
		SNew( SAssetDropTarget )
		.OnIsAssetAcceptableForDrop( this, &SPropertyEditorAsset::OnAssetDraggedOver )
		.OnAssetDropped( this, &SPropertyEditorAsset::OnAssetDropped )
		[
			SAssignNew( HorizontalBox, SHorizontalBox )			
		]
	];

	if(ShouldDisplayThumbnail(InArgs))
	{
		FObjectOrAssetData Value; 
		GetValue( Value );

		AssetThumbnail = MakeShareable( new FAssetThumbnail( Value.AssetData, InArgs._ThumbnailSize.X, InArgs._ThumbnailSize.Y, InArgs._ThumbnailPool ) );
		
		if( AssetThumbnail.IsValid()  )
		{
			HorizontalBox->AddSlot()
				.Padding( 0.0f, 0.0f, 2.0f, 0.0f )
				.AutoWidth()
				[
					SNew(SBorder)
					.Padding(2.0f)
					.BorderImage( FEditorStyle::GetBrush("PropertyEditor.AssetThumbnailShadow") )
					.OnMouseDoubleClick( this, &SPropertyEditorAsset::OnAssetThumbnailDoubleClick )
					[
						SNew( SBox )
						.ToolTipText( this, &SPropertyEditorAsset::OnGetToolTip )
						.WidthOverride( InArgs._ThumbnailSize.X ) 
						.HeightOverride( InArgs._ThumbnailSize.Y )
						[
							AssetThumbnail->MakeThumbnailWidget()
						]
					]
				];
		}
	}

	TSharedPtr<SHorizontalBox> ButtonBox;
	
	HorizontalBox->AddSlot()
	.FillWidth(1.0f)
	.Padding( 0.0f, 4.0f, 4.0f, 4.0f )
	.VAlign(VAlign_Center)
	[
		SNew(SVerticalBox)
		+SVerticalBox::Slot()
		.VAlign( VAlign_Center )
		[
			SAssignNew( ButtonBox, SHorizontalBox )
			.IsEnabled( this, &SPropertyEditorAsset::CanEdit )
			+ SHorizontalBox::Slot()
			[
				SAssignNew(AssetComboButton, SComboButton)
				.ToolTipText( this, &SPropertyEditorAsset::OnGetToolTip )
				.ButtonStyle( FEditorStyle::Get(), "PropertyEditor.AssetComboStyle" )
				.ForegroundColor(FEditorStyle::GetColor("PropertyEditor.AssetName.ColorAndOpacity"))
				.OnGetMenuContent( this, &SPropertyEditorAsset::OnGetMenuContent )
				.ContentPadding(2.0f)
				.ButtonContent()
				[
					// Show the name of the asset or actor
					SNew(STextBlock)
					.TextStyle( FEditorStyle::Get(), "PropertyEditor.AssetClass" )
					.Font( FEditorStyle::GetFontStyle( PropertyEditorConstants::PropertyFontStyle ) )
					.Text(this,&SPropertyEditorAsset::OnGetAssetName)
				]
			]
		]
		+SVerticalBox::Slot()
		.AutoHeight()
		.Padding( InArgs._CustomContentSlot.Widget == SNullWidget::NullWidget ? FMargin( 0.0f, 0.0f ) : FMargin( 0.0f, 2.0f ) )
		[
			InArgs._CustomContentSlot.Widget
		]
	];

	if(!bIsActor)
	{
		ButtonBox->AddSlot()
		.VAlign(VAlign_Center)
		.Padding( 2.0f, 0.0f )
		.AutoWidth()
		[
			PropertyCustomizationHelpers::MakeUseSelectedButton( FSimpleDelegate::CreateSP( this, &SPropertyEditorAsset::OnUse ) )
		];
	}

	ButtonBox->AddSlot()
	.AutoWidth()
	.Padding( 2.0f, 0.0f )
	.VAlign(VAlign_Center)
	[
		PropertyCustomizationHelpers::MakeBrowseButton(
			FSimpleDelegate::CreateSP( this, &SPropertyEditorAsset::OnBrowse ),
			TAttribute<FText>( this, &SPropertyEditorAsset::GetOnBrowseToolTip )
			)
	];

	if(bIsActor)
	{
		ButtonBox->AddSlot()
		.AutoWidth()
		.Padding( 2.0f, 0.0f )
		.VAlign(VAlign_Center)
		[
			PropertyCustomizationHelpers::MakeInteractiveActorPicker( FOnGetAllowedClasses::CreateSP(this, &SPropertyEditorAsset::OnGetAllowedClasses), FOnActorSelected::CreateSP( this, &SPropertyEditorAsset::OnActorSelected ) )
		];
	}

	if( InArgs._ResetToDefaultSlot.Widget != SNullWidget::NullWidget )
	{
		ButtonBox->AddSlot()
		.AutoWidth()
		.Padding( 2.0f, 0.0f )
		.VAlign(VAlign_Center)
		[
			InArgs._ResetToDefaultSlot.Widget
		];
	}
}
Пример #24
0
	void Construct(const FArguments& InArgs, const TSharedRef<FFriendsViewModel>& InViewModel)
	{
		FriendStyle = *InArgs._FriendStyle;
		ViewModel = InViewModel;
		// Set up titles
		const FText SearchStringLabel = LOCTEXT( "FriendList_SearchLabel", "[Enter Display Name]" );

		SUserWidget::Construct(SUserWidget::FArguments()
		[
			SNew(SVerticalBox)
			+ SVerticalBox::Slot()
			.AutoHeight()
			.VAlign(VAlign_Top)
			[
				SNew(STextBlock)
				.Font(FriendStyle.FriendsNormalFontStyle.FriendsFontNormal)
				.Text(LOCTEXT("SendFriendRequest", "Send friend request to:"))
			]
			+ SVerticalBox::Slot()
			.AutoHeight()
			.VAlign(VAlign_Top)
			[
				SAssignNew(FriendNameTextBox, SEditableTextBox)
				.Font(FriendStyle.FriendsNormalFontStyle.FriendsFontNormal)
				.OnTextCommitted(this, &SFriendRequestImpl::HandleFriendEntered)
				.BackgroundColor(FLinearColor::Black)
				.ForegroundColor(FLinearColor::White)
				.HintText(SearchStringLabel)
			]
			+ SVerticalBox::Slot()
			.AutoHeight()
			.VAlign(VAlign_Top)
			.HAlign(HAlign_Left)
			[
				SNew(SUniformGridPanel)
				.SlotPadding(FMargin(5,0))
				.MinDesiredSlotWidth(80)
				+ SUniformGridPanel::Slot(0, 0)
				[
					SNew(SButton)
					.HAlign(HAlign_Center)
					.ButtonStyle(&FriendStyle.FriendsListStyle.FriendGeneralButtonStyle)
					.OnClicked(this, &SFriendRequestImpl::HandleActionButtonClicked, true)
					[
						SNew(STextBlock)
						.ColorAndOpacity(FriendStyle.FriendsNormalFontStyle.DefaultFontColor)
						.Font(FriendStyle.FriendsNormalFontStyle.FriendsFontNormal)
						.Text(FText::FromString("Send"))
					]
				]
				+ SUniformGridPanel::Slot(1, 0)
				[
					SNew(SButton)
					.HAlign(HAlign_Center)
					.ButtonStyle(&FriendStyle.FriendsListStyle.FriendGeneralButtonStyle)
					.OnClicked(this, &SFriendRequestImpl::HandleActionButtonClicked, false)
					[
						SNew(STextBlock)
						.ColorAndOpacity(FriendStyle.FriendsNormalFontStyle.DefaultFontColor)
						.Font(FriendStyle.FriendsNormalFontStyle.FriendsFontNormal)
						.Text(FText::FromString("Cancel"))
					]
				]
			]
		]);
	}
void FWheeledVehicleMovementComponent4WDetails::CustomizeDetails(IDetailLayoutBuilder& DetailBuilder)
{
	DetailBuilder.GetObjectsBeingCustomized(SelectedObjects);

	//we only do fancy customization if we have one vehicle component selected
	if (SelectedObjects.Num() != 1)
	{
		return;
	}
	else if (UWheeledVehicleMovementComponent4W * VehicleComponent = Cast<UWheeledVehicleMovementComponent4W>(SelectedObjects[0].Get()))
	{
		SteeringCurveEditor = FSteeringCurveEditor(VehicleComponent);
		TorqueCurveEditor = FTorqueCurveEditor(VehicleComponent);
	}
	else
	{
		return;
	}

	//Torque curve
	{
		IDetailCategoryBuilder& MechanicalCategory = DetailBuilder.EditCategory("MechanicalSetup");
		TSharedRef<IPropertyHandle> TorqueCurveHandle = DetailBuilder.GetProperty("EngineSetup.TorqueCurve");

		MechanicalCategory.AddProperty(TorqueCurveHandle).CustomWidget()
		.NameContent()
			[
				TorqueCurveHandle->CreatePropertyNameWidget()
			]
		.ValueContent()
			.MinDesiredWidth(125.f * 3.f)
			[
				SAssignNew(TorqueCurveWidget, SCurveEditor)
				.ViewMinInput(0.f)
				.ViewMaxInput(70000.f)
				.ViewMinOutput(0.f)
				.ViewMaxOutput(1.f)
				.TimelineLength(7000.f)
				.HideUI(false)
				.DesiredSize(FVector2D(512, 128))
			];

		TorqueCurveWidget->SetCurveOwner(&TorqueCurveEditor);
	}
	
	//Steering curve
	{
		IDetailCategoryBuilder& SteeringCategory = DetailBuilder.EditCategory("SteeringSetup");
		TSharedRef<IPropertyHandle> SteeringCurveHandle = DetailBuilder.GetProperty("SteeringCurve");
		SteeringCategory.AddProperty(SteeringCurveHandle).CustomWidget()
			.NameContent()
			[
				SteeringCurveHandle->CreatePropertyNameWidget()
			]
		.ValueContent()
			.MinDesiredWidth(125.f * 3.f)
			[
				SAssignNew(SteeringCurveWidget, SCurveEditor)
				.ViewMinInput(0.f)
				.ViewMaxInput(150.f)
				.ViewMinOutput(0.f)
				.ViewMaxOutput(1.f)
				.TimelineLength(150)
				.HideUI(false)
				.ZoomToFitVertical(false)
				.ZoomToFitHorizontal(false)
				.DesiredSize(FVector2D(512, 128))
			];

		SteeringCurveWidget->SetCurveOwner(&SteeringCurveEditor);
	}
}
Пример #26
0
void FShooterMainMenu::Construct(APlayerController* _PCOwner, AShooterGame_Menu* _SGOwner)
{
	bShowingDownloadPct = false;
	PCOwner = _PCOwner;
	SGOwner = _SGOwner;

	// read user settings
	UShooterGameUserSettings* const UserSettings = CastChecked<UShooterGameUserSettings>(GEngine->GetGameUserSettings());
	bIsLanMatch = UserSettings->IsLanMatch();

	UShooterPersistentUser* PersistentUser = GetPersistentUser();	
	BotsCountOpt = 1;
	if(PersistentUser)
	{
		BotsCountOpt = PersistentUser->GetBotsCount();
	}		

	// number entries 0 up to MAX_BOX_COUNT
	TArray<FText> BotsCountList;
	for (int32 i = 0; i <= MAX_BOT_COUNT; i++)
	{
		BotsCountList.Add(FText::AsNumber(i));
	}
	
	TArray<FText> MapList;
	for (int32 i = 0; i < ARRAY_COUNT(MapNames); ++i)
	{
		MapList.Add(FText::FromString(MapNames[i]));		
	}	

	TArray<FText> OnOffList;
	OnOffList.Add( LOCTEXT("Off","OFF") );
	OnOffList.Add( LOCTEXT("On","ON") );

	ShooterOptions = MakeShareable(new FShooterOptions()); 
	ShooterOptions->Construct(PCOwner);
	ShooterOptions->TellInputAboutKeybindings();
	ShooterOptions->OnApplyChanges.BindSP(this, &FShooterMainMenu::CloseSubMenu);

	//Now that we are here, build our menu 
	MenuWidget.Reset();
	MenuWidgetContainer.Reset();

	if (GEngine && GEngine->GameViewport)
	{		
		SAssignNew(MenuWidget, SShooterMenuWidget)
			.Cursor(EMouseCursor::Default)
			.PCOwner(TWeakObjectPtr<APlayerController>(PCOwner))
			.GameModeOwner(SGOwner)
			.IsGameMenu(false);

		
		SAssignNew(MenuWidgetContainer, SWeakWidget)
			.PossiblyNullContent(MenuWidget);		

		TSharedPtr<FShooterMenuItem> RootMenuItem;

				
		SAssignNew(SplitScreenLobbyWidget, SShooterSplitScreenLobby)
			.LocalPlayer(_PCOwner)
			.OnCancelClicked(FOnClicked::CreateSP(this, &FShooterMainMenu::OnSplitScreenBackedOut))
			.OnPlayClicked(FOnClicked::CreateSP(this, &FShooterMainMenu::OnSplitScreenPlay));

		SAssignNew(SplitScreenLobbyWidgetContainer, SWeakWidget)
			.PossiblyNullContent(SplitScreenLobbyWidget);		

#if SHOOTER_CONSOLE_UI
		// PLAY menu option
		TSharedPtr<FShooterMenuItem> PlaySubMenu = MenuHelper::AddMenuItem(RootMenuItem, LOCTEXT("Play", "PLAY"));

		// submenu under "play"
		MenuHelper::AddMenuItemSP(PlaySubMenu, LOCTEXT("TDM", "TEAM DEATHMATCH"), this, &FShooterMainMenu::OnSplitScreenSelected);
			
		TSharedPtr<FShooterMenuItem> NumberOfBotsOption = MenuHelper::AddMenuOptionSP(PlaySubMenu, LOCTEXT("NumberOfBots", "NUMBER OF BOTS"), BotsCountList, this, &FShooterMainMenu::BotCountOptionChanged);
		NumberOfBotsOption->SelectedMultiChoice = BotsCountOpt;

		MapOption = MenuHelper::AddMenuOption(PlaySubMenu, LOCTEXT("SELECTED_LEVEL", "Map"), MapList);
		MapOption->SelectedMultiChoice = DefaultTDMMap;

#else
		// HOST menu option
		TSharedPtr<FShooterMenuItem> MenuItem;
		MenuItem = MenuHelper::AddMenuItem(RootMenuItem, LOCTEXT("Host", "HOST"));

		// submenu under "host"
		MenuHelper::AddMenuItemSP(MenuItem, LOCTEXT("FFA", "FREE FOR ALL"), this, &FShooterMainMenu::OnUIHostFreeForAll);
		MenuHelper::AddMenuItemSP(MenuItem, LOCTEXT("TDM", "TEAM DEATHMATCH"), this, &FShooterMainMenu::OnUIHostTeamDeathMatch);

		TSharedPtr<FShooterMenuItem> NumberOfBotsOption = MenuHelper::AddMenuOptionSP(MenuItem, LOCTEXT("NumberOfBots", "NUMBER OF BOTS"), BotsCountList, this, &FShooterMainMenu::BotCountOptionChanged);				
		NumberOfBotsOption->SelectedMultiChoice = BotsCountOpt;																

		MapOption = MenuHelper::AddMenuOption(MenuItem, LOCTEXT("SELECTED_LEVEL", "Map"), MapList);

		HostLANItem = MenuHelper::AddMenuOptionSP(MenuItem, LOCTEXT("LanMatch", "LAN"), OnOffList, this, &FShooterMainMenu::LanMatchChanged);
		HostLANItem->SelectedMultiChoice = bIsLanMatch;

		// JOIN menu option
		MenuItem = MenuHelper::AddMenuItem(RootMenuItem, LOCTEXT("Join", "JOIN"));

		// submenu under "join"
		MenuHelper::AddMenuItemSP(MenuItem, LOCTEXT("Server", "SERVER"), this, &FShooterMainMenu::OnJoinServer);
		JoinLANItem = MenuHelper::AddMenuOptionSP(MenuItem, LOCTEXT("LanMatch", "LAN"), OnOffList, this, &FShooterMainMenu::LanMatchChanged);
		JoinLANItem->SelectedMultiChoice = bIsLanMatch;

		// Server list widget that will be called up if appropriate
		MenuHelper::AddCustomMenuItem(JoinServerItem,SAssignNew(ServerListWidget,SShooterServerList).OwnerWidget(MenuWidget).PCOwner(PCOwner));
#endif

		// Leaderboards
#if !SHOOTER_CONSOLE_UI
		MenuHelper::AddMenuItemSP(RootMenuItem, LOCTEXT("Leaderboards", "LEADERBOARDS"), this, &FShooterMainMenu::OnShowLeaderboard);
		MenuHelper::AddCustomMenuItem(LeaderboardItem,SAssignNew(LeaderboardWidget,SShooterLeaderboard).OwnerWidget(MenuWidget).PCOwner(PCOwner));
#endif

		// Options
		MenuHelper::AddExistingMenuItem(RootMenuItem, ShooterOptions->OptionsItem.ToSharedRef());

		if(FSlateApplication::Get().SupportsSystemHelp())
		{
			TSharedPtr<FShooterMenuItem> HelpSubMenu = MenuHelper::AddMenuItem(RootMenuItem, LOCTEXT("Help", "HELP"));
			HelpSubMenu->OnConfirmMenuItem.BindStatic([](){ FSlateApplication::Get().ShowSystemHelp(); });
		}

		// QUIT option (for PC)
#if !SHOOTER_CONSOLE_UI
		MenuHelper::AddMenuItemSP(RootMenuItem, LOCTEXT("Quit", "QUIT"), this, &FShooterMainMenu::OnUIQuit);
#endif

		MenuWidget->CurrentMenuTitle = LOCTEXT("MainMenu","MAIN MENU");
		MenuWidget->OnGoBack.BindSP(this, &FShooterMainMenu::OnMenuGoBack);
		MenuWidget->MainMenu = MenuWidget->CurrentMenu = RootMenuItem->SubMenu;
		MenuWidget->OnMenuHidden.BindSP(this, &FShooterMainMenu::OnMenuHidden);

		
		ShooterOptions->UpdateOptions();
		MenuWidget->BuildAndShowMenu();

	}
	UpdateMenuOwner();	
}
	void STextPropertyWidget::Construct(const FArguments& InArgs, const TSharedRef<IPropertyHandle>& InPropertyHandle, const TSharedPtr<IPropertyUtilities>& InPropertyUtilities)
	{
		PropertyHandle = InPropertyHandle;
		PropertyUtilities = InPropertyUtilities;

		const auto& GetTextValue = [this]() -> FText
		{
			FText TextValue;

			TArray<const void*> RawData;
			PropertyHandle->AccessRawData(RawData);
			if (RawData.Num() == 1)
			{
				const FText* RawDatum = reinterpret_cast<const FText*>(RawData.Top());
				if (RawDatum)
				{
					TextValue = *RawDatum;
				}
			}
			else if(RawData.Num() > 1)
			{
				TextValue = MultipleValuesText;
			}
			else
			{
				TextValue = FText::GetEmpty();
			}

			return TextValue;
		};

		const auto& OnTextCommitted = [this](const FText& NewText, ETextCommit::Type CommitInfo)
		{
			TArray<void*> RawData;
			PropertyHandle->AccessRawData(RawData);

			// Don't commit the Multiple Values text if there are multiple properties being set
			if (RawData.Num() > 0 && (RawData.Num() == 1 || NewText.ToString() != MultipleValuesText.ToString()))
			{
				PropertyHandle->NotifyPreChange();

				for (void* const RawDatum : RawData)
				{
					FText& PropertyValue = *(reinterpret_cast<FText* const>(RawDatum));

					// FText::FromString on the result of FText::ToString is intentional. For now, we want to nuke any namespace/key info and let it get regenerated from scratch,
					// rather than risk adopting whatever came through some chain of calls. This will be replaced when preserving of identity is implemented.
					PropertyValue = FText::FromString(NewText.ToString());
				}

				PropertyHandle->NotifyPostChange();
				PropertyHandle->NotifyFinishedChangingProperties();
			}
		};

		TSharedPtr<SHorizontalBox> HorizontalBox;

		bool bIsPassword = PropertyHandle->GetBoolMetaData("PasswordField");
		bIsMultiLine = PropertyHandle->GetBoolMetaData("MultiLine");
		if(bIsMultiLine)
		{
			ChildSlot
				[
					SAssignNew(HorizontalBox, SHorizontalBox)
					+SHorizontalBox::Slot()
					.FillWidth(1.0f)
					[
						SNew( SBox )
						.MaxDesiredHeight(300.f)
						[
							SAssignNew(MultiLineWidget, SMultiLineEditableTextBox)
							.Text_Lambda(GetTextValue)
							.Font(InArgs._Font)
							.SelectAllTextWhenFocused(false)
							.ClearKeyboardFocusOnCommit(false)
							.OnTextCommitted_Lambda(OnTextCommitted)
							.SelectAllTextOnCommit(false)
							.IsReadOnly(this, &STextPropertyWidget::IsReadOnly)
							.AutoWrapText(true)
							.ModiferKeyForNewLine(EModifierKey::Shift)
							.IsPassword(bIsPassword)
						]
					]
				];

			PrimaryWidget = MultiLineWidget;
		}
		else
		{
			ChildSlot
				[
					SAssignNew(HorizontalBox, SHorizontalBox)
					+SHorizontalBox::Slot()
					.FillWidth(1.0f)
					[
						SAssignNew( SingleLineWidget, SEditableTextBox )
						.Text_Lambda(GetTextValue)
						.Font( InArgs._Font )
						.SelectAllTextWhenFocused( true )
						.ClearKeyboardFocusOnCommit(false)
						.OnTextCommitted_Lambda(OnTextCommitted)
						.SelectAllTextOnCommit( true )
						.IsReadOnly(this, &STextPropertyWidget::IsReadOnly)
						.IsPassword(bIsPassword)

					]
				];

			PrimaryWidget = SingleLineWidget;
		}

		SetEnabled( TAttribute<bool>( this, &STextPropertyWidget::CanEdit ) );
	}
	/**
	 * Construct the widget
	 *
	 * @param InArgs   A declaration from which to construct the widget
	 */
	void Construct( const FArguments& InArgs, const TSharedRef<STableViewBase>& InOwnerTableView, bool bIsTopNode, bool bInDisplayShowAdvancedMessage, bool bShowSplitter )
	{
		IsExpanded = InArgs._IsExpanded;

		bDisplayShowAdvancedMessage = bInDisplayShowAdvancedMessage;

		TSharedPtr<SWidget> ContentWidget;
		if( bIsTopNode )
		{
			ContentWidget =
				SNew( SBorder )
				.BorderImage( FEditorStyle::GetBrush("DetailsView.CategoryMiddle") )
				.Padding( FMargin( 0.0f, 3.0f, SDetailTableRowBase::ScrollbarPaddingSize, 0.0f ) )
				[
					SNew( SImage )
					.Image( FEditorStyle::GetBrush("DetailsView.AdvancedDropdownBorder.Open") )
				];
		}
		else if( InArgs._ShouldShowAdvancedButton )
		{
			ContentWidget = 
				SNew( SBorder )
				.BorderImage( FEditorStyle::GetBrush("DetailsView.AdvancedDropdownBorder") )
				.Padding( FMargin( 0.0f, 3.0f, SDetailTableRowBase::ScrollbarPaddingSize, 0.0f ) )
				[
					SNew( SVerticalBox )
					+SVerticalBox::Slot()
					.HAlign( HAlign_Center )
					.AutoHeight()
					[
						SNew( STextBlock )
						.Text( NSLOCTEXT("DetailsView", "NoSimpleProperties", "Click the arrow to display advanced properties") )
						.Font( IDetailLayoutBuilder::GetDetailFont() )
						.Visibility( this, &SAdvancedDropdownRow::OnGetHelpTextVisibility )
						.ColorAndOpacity(FLinearColor(1,1,1,.5))
					]
					+ SVerticalBox::Slot()
					.AutoHeight()
					[
						SAssignNew(ExpanderButton, SButton)
						.ButtonStyle(FEditorStyle::Get(), "NoBorder")
						.HAlign(HAlign_Center)
						.ContentPadding(2)
						.OnClicked(InArgs._OnClicked)
						.IsEnabled(InArgs._IsButtonEnabled)
						.ToolTipText(this, &SAdvancedDropdownRow::GetAdvancedPulldownToolTipText )
						[
							SNew(SImage)
							.Image(this, &SAdvancedDropdownRow::GetAdvancedPulldownImage)
						]
					]
				];

		}
		else
		{
			TSharedPtr<SWidget> SplitterArea;
			if( bShowSplitter )
			{
				SplitterArea = 
					SNew( SSplitter )
					.PhysicalSplitterHandleSize( 1.0f )
					.HitDetectionSplitterHandleSize( 5.0f )
					.Style( FEditorStyle::Get(), "DetailsView.Splitter" )
					+ SSplitter::Slot()
					.Value( InArgs._ColumnSizeData.LeftColumnWidth )
					.OnSlotResized( SSplitter::FOnSlotResized::CreateSP( this, &SAdvancedDropdownRow::OnLeftColumnResized ) )
					[
						SNew( SHorizontalBox )
						+ SHorizontalBox::Slot()
						.Padding( 3.0f, 0.0f )
						.HAlign( HAlign_Left )
						.VAlign( VAlign_Center )
						.AutoWidth()
						[
							SNew( SExpanderArrow, SharedThis(this) )
						]
						+ SHorizontalBox::Slot()
						.HAlign( HAlign_Left )
						.Padding( FMargin( 0.0f, 2.5f, 2.0f, 2.5f ) )
						[
							SNew( SSpacer )
						]

					]
					+ SSplitter::Slot()
					.Value( InArgs._ColumnSizeData.RightColumnWidth )
					.OnSlotResized( InArgs._ColumnSizeData.OnWidthChanged )
					[
						SNew( SSpacer )
					];
			}
			else
			{
				SplitterArea = SNew(SSpacer);
			}

			SplitterArea = SNew(SSpacer);

			ContentWidget =
				SNew( SBorder )
				.BorderImage( FEditorStyle::GetBrush("DetailsView.CategoryBottom") )
				.Padding( FMargin( 0.0f, 0.0f, SDetailTableRowBase::ScrollbarPaddingSize, 2.0f ) )
				[
					SplitterArea.ToSharedRef()	
				];
		}
		
		ChildSlot
		[
			ContentWidget.ToSharedRef()
		];

		STableRow< TSharedPtr< IDetailTreeNode > >::ConstructInternal(
			STableRow::FArguments()
				.Style(FEditorStyle::Get(), "DetailsView.TreeView.TableRow")
				.ShowSelection(false),
			InOwnerTableView
		);	
	}
Пример #29
0
void SMaterialPalette::Construct(const FArguments& InArgs, TWeakPtr<FMaterialEditor> InMaterialEditorPtr)
{
	MaterialEditorPtr = InMaterialEditorPtr;

	// Create the asset discovery indicator
	FEditorWidgetsModule& EditorWidgetsModule = FModuleManager::LoadModuleChecked<FEditorWidgetsModule>("EditorWidgets");
	TSharedRef<SWidget> AssetDiscoveryIndicator = EditorWidgetsModule.CreateAssetDiscoveryIndicator(EAssetDiscoveryIndicatorScaleMode::Scale_Vertical);

	CategoryNames.Add(MakeShareable(new FString(TEXT("All"))));
	CategoryNames.Add(MakeShareable(new FString(TEXT("Expressions"))));
	CategoryNames.Add(MakeShareable(new FString(TEXT("Functions"))));

	this->ChildSlot
	[
		SNew(SBorder)
		.Padding(2.0f)
		.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
		[
			SNew(SVerticalBox)

			// Filter UI
			+SVerticalBox::Slot()
			.AutoHeight()
			[
				SNew(SHorizontalBox)

				// Comment
				+SHorizontalBox::Slot()
				.VAlign(VAlign_Center)
				.AutoWidth()
				[
					SNew(STextBlock)
					.Text(LOCTEXT("Category", "Category: "))
				]

				// Combo button to select a class
				+SHorizontalBox::Slot()
					.VAlign(VAlign_Center)
					[
						SAssignNew(CategoryComboBox, STextComboBox)
						.OptionsSource(&CategoryNames)
						.OnSelectionChanged(this, &SMaterialPalette::CategorySelectionChanged)
						.InitiallySelectedItem(CategoryNames[0])
					]
			]

			// Content list
			+SVerticalBox::Slot()
				[
					SNew(SOverlay)

					+SOverlay::Slot()
					.HAlign(HAlign_Fill)
					.VAlign(VAlign_Fill)
					[
						// Old Expression and Function lists were auto expanded so do the same here for now
						SAssignNew(GraphActionMenu, SGraphActionMenu)
						.OnActionDragged(this, &SMaterialPalette::OnActionDragged)
						.OnCreateWidgetForAction(this, &SMaterialPalette::OnCreateWidgetForAction)
						.OnCollectAllActions(this, &SMaterialPalette::CollectAllActions)
						.AutoExpandActionMenu(true)
					]

					+SOverlay::Slot()
						.HAlign(HAlign_Fill)
						.VAlign(VAlign_Bottom)
						.Padding(FMargin(24, 0, 24, 0))
						[
							// Asset discovery indicator
							AssetDiscoveryIndicator
						]
				]

		]
	];

	// Register with the Asset Registry to be informed when it is done loading up files.
	FAssetRegistryModule& AssetRegistryModule = FModuleManager::GetModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
	AssetRegistryModule.Get().OnAssetAdded().AddSP(this, &SMaterialPalette::AddAssetFromAssetRegistry);
	AssetRegistryModule.Get().OnAssetRemoved().AddSP(this, &SMaterialPalette::RemoveAssetFromRegistry);
	AssetRegistryModule.Get().OnAssetRenamed().AddSP(this, &SMaterialPalette::RenameAssetFromRegistry);
}
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
void SProjectLauncherPackagingSettings::Construct( const FArguments& InArgs, const FProjectLauncherModelRef& InModel )
{
	Model = InModel;

	ChildSlot
	[
		SNew(SVerticalBox)

		+ SVerticalBox::Slot()
			.FillHeight(1.0)
			[
				SNew(SBorder)
					.Padding(8.0)
					.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
					[
						SNew(SVerticalBox)

						+ SVerticalBox::Slot()
							.AutoHeight()
							[
								SNew(STextBlock)
									.Text(LOCTEXT("RepositoryPathLabel", "Repository Path:"))
							]

						+ SVerticalBox::Slot()
							.AutoHeight()
							.Padding(0.0, 4.0, 0.0, 0.0)
							[
								SNew(SHorizontalBox)

								+ SHorizontalBox::Slot()
									.FillWidth(1.0)
									.Padding(0.0, 0.0, 0.0, 3.0)
									[
										// repository path text box
										SAssignNew(RepositoryPathTextBox, SEditableTextBox)
									]

								+ SHorizontalBox::Slot()
									.AutoWidth()
									.HAlign(HAlign_Right)
									.Padding(4.0, 0.0, 0.0, 0.0)
									[
										// browse button
										SNew(SButton)
											.ContentPadding(FMargin(6.0, 2.0))
											.IsEnabled(false)
											.Text(LOCTEXT("BrowseButtonText", "Browse..."))
											.ToolTipText(LOCTEXT("BrowseButtonToolTip", "Browse for the repository"))
											//.OnClicked(this, &SProjectLauncherPackagePage::HandleBrowseButtonClicked)
									]
							]

						+ SVerticalBox::Slot()
							.AutoHeight()
							.Padding(0.0, 8.0, 0.0, 0.0)
							[
								SNew(STextBlock)
									.Text(LOCTEXT("DescriptionTextBoxLabel", "Description:"))
							]

						+ SVerticalBox::Slot()
							.FillHeight(1.0)
							.Padding(0.0, 4.0, 0.0, 0.0)
							[
								SNew(SEditableTextBox)
							]
					]
			]

		+ SVerticalBox::Slot()
			.AutoHeight()
			.Padding(0.0, 8.0, 0.0, 0.0)
			[
				SNew(SExpandableArea)
					.AreaTitle(LOCTEXT("IncrementalPackagingAreaTitle", "Incremental Packaging"))
					.InitiallyCollapsed(true)
					.Padding(8.0)
					.BodyContent()
					[
						SNew(SVerticalBox)

						+ SVerticalBox::Slot()
							.AutoHeight()
							[
								// incremental packaging check box
								SNew(SCheckBox)
									//.IsChecked(this, &SProjectLauncherLaunchPage::HandleIncrementalCheckBoxIsChecked)
									//.OnCheckStateChanged(this, &SProjectLauncherLaunchPage::HandleIncrementalCheckBoxCheckStateChanged)
									.Content()
									[
										SNew(STextBlock)
											.Text(LOCTEXT("IncrementalCheckBoxText", "This is an incremental build"))
									]
							]

						+ SVerticalBox::Slot()
							.FillHeight(1.0)
							.Padding(18.0, 12.0, 0.0, 0.0)
							[
								SNew(SVerticalBox)
							]
					]
			]
	];

	Model->OnProfileSelected().AddSP(this, &SProjectLauncherPackagingSettings::HandleProfileManagerProfileSelected);
}