/** Begins the fadein of this message */ void Fadein( const bool bAllowThrottleWhenFrameRateIsLow ) { // Make visible SetVisibility(EVisibility::Visible); // Play Fadein animation FadeAnimation = FCurveSequence(); FadeCurve = FadeAnimation.AddCurve(0.f, FadeInDuration.Get()); FadeAnimation.Play(); // Scale up/flash animation IntroAnimation = FCurveSequence(); ScaleCurveX = IntroAnimation.AddCurve(0.2f, 0.3f, ECurveEaseFunction::QuadOut); ScaleCurveY = IntroAnimation.AddCurve(0.f, 0.2f); GlowCurve = IntroAnimation.AddCurve(0.5f, 0.55f, ECurveEaseFunction::QuadOut); IntroAnimation.Play(); // When a fade in occurs, we need a high framerate for the animation to look good if( FadeInDuration.Get() > KINDA_SMALL_NUMBER && bAllowThrottleWhenFrameRateIsLow && !ThrottleHandle.IsValid() ) { if( !FSlateApplication::Get().IsRunningAtTargetFrameRate() ) { ThrottleHandle = FSlateThrottleManager::Get().EnterResponsiveMode(); } } }
void SViewportToolBar::Construct( const FArguments& InArgs ) { bIsHovered = false; FadeInSequence = FCurveSequence( 0.0f, ToolBarConstants::FadeTime ); FadeOutSequence = FCurveSequence( ToolBarConstants::TimeToFadeOut, ToolBarConstants::FadeTime ); FadeOutSequence.JumpToEnd(); }
void SThrobber::ConstructPieces() { ThrobberCurve.Empty(); AnimCurves = FCurveSequence(); for (int32 PieceIndex = 0; PieceIndex < NumPieces; ++PieceIndex) { ThrobberCurve.Add(AnimCurves.AddCurve(PieceIndex*0.05f, 1.5f)); } AnimCurves.Play(this->AsShared(), true); HBox->ClearChildren(); for (int32 PieceIndex = 0; PieceIndex < NumPieces; ++PieceIndex) { HBox->AddSlot() .AutoWidth() [ SNew(SBorder) .BorderImage(FStyleDefaults::GetNoBrush()) .ContentScale(this, &SThrobber::GetPieceScale, PieceIndex) .ColorAndOpacity(this, &SThrobber::GetPieceColor, PieceIndex) .HAlign(HAlign_Center) .VAlign(VAlign_Center) [ SNew(SImage) .Image(this, &SThrobber::GetPieceBrush) ] ]; } }
void Construct(const FArguments& InArgs, TSharedPtr<IPropertyHandle> AnchorsHandle, TSharedPtr<IPropertyHandle> AlignmentHandle, TSharedPtr<IPropertyHandle> OffsetsHandle, FText LabelText, FAnchors Anchors) { ResizeCurve = FCurveSequence(0, 0.40f); ChildSlot [ SNew(SButton) .ButtonStyle(FEditorStyle::Get(), "SimpleSharpButton") .ButtonColorAndOpacity(FLinearColor(FColor(40, 40, 40))) .OnClicked(this, &SAnchorPreviewWidget::OnAnchorClicked, AnchorsHandle, AlignmentHandle, OffsetsHandle, Anchors) .ContentPadding(FMargin(2.0f, 2.0f)) [ SNew(SVerticalBox) + SVerticalBox::Slot() .AutoHeight() [ SNew(SBorder) .BorderImage(FEditorStyle::GetBrush("UMGEditor.AnchorGrid")) .Padding(0) [ SNew(SBox) .WidthOverride(64) .HeightOverride(64) .HAlign(HAlign_Center) .VAlign(VAlign_Center) [ SNew(SBox) .WidthOverride(this, &SAnchorPreviewWidget::GetCurrentWidth) .HeightOverride(this, &SAnchorPreviewWidget::GetCurrentHeight) [ SNew(SBorder) //.BorderImage(FEditorStyle::GetBrush("NoBrush")) //.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder")) //.BorderBackgroundColor .Padding(1) [ SNew(SConstraintCanvas) + SConstraintCanvas::Slot() .Anchors(Anchors) .Offset(FMargin(0, 0, Anchors.IsStretchedHorizontal() ? 0 : 15, Anchors.IsStretchedVertical() ? 0 : 15)) .Alignment(FVector2D(Anchors.IsStretchedHorizontal() ? 0 : Anchors.Minimum.X, Anchors.IsStretchedVertical() ? 0 : Anchors.Minimum.Y)) [ SNew(SImage) .Image(FEditorStyle::Get().GetBrush("UMGEditor.AnchoredWidget")) ] ] ] ] ] ] ] ]; }
/** Begins the fadeout of this message */ virtual void Fadeout() override { // Start fade animation FadeAnimation = FCurveSequence(); FadeCurve = FadeAnimation.AddCurve(0.f, FadeOutDuration.Get()); FadeAnimation.PlayReverse(); }
void SPaperEditorViewport::Construct(const FArguments& InArgs, TSharedRef<FPaperEditorViewportClient> InViewportClient) { OnSelectionChanged = InArgs._OnSelectionChanged; PaperViewportClient = InViewportClient; PaperViewportClient->SetRealtime(false); SEditorViewport::Construct(SEditorViewport::FArguments()); // Indicator of current zoom level ViewportOverlay->AddSlot() .Padding(5) .VAlign(VAlign_Top) [ SNew(STextBlock) .TextStyle(FPaperStyle::Get(), "Paper2D.Common.ViewportZoomTextStyle") .Text(this, &SPaperEditorViewport::GetZoomText) .ColorAndOpacity(this, &SPaperEditorViewport::GetZoomTextColorAndOpacity) ]; // Title for the viewport ViewportOverlay->AddSlot() .VAlign(VAlign_Top) [ SNew(SBorder) .BorderImage(FPaperStyle::Get()->GetBrush("Paper2D.Common.ViewportTitleBackground")) .HAlign(HAlign_Fill) .Visibility(EVisibility::HitTestInvisible) [ SNew(SVerticalBox) // Title text/icon +SVerticalBox::Slot() .AutoHeight() [ SNew(SHorizontalBox) +SHorizontalBox::Slot() .HAlign(HAlign_Center) .FillWidth(1.f) [ SNew(STextBlock) .TextStyle(FPaperStyle::Get(), "Paper2D.Common.ViewportTitleTextStyle") .Text(this, &SPaperEditorViewport::GetTitleText) ] ] ] ]; ZoomLevel = DefaultZoomLevel; PreviousZoomLevel = DefaultZoomLevel; ViewOffset = FVector2D::ZeroVector; TotalMouseDelta = 0; bIsPanning = false; ZoomLevelFade = FCurveSequence( 0.0f, 0.75f ); ZoomLevelFade.Play(this->AsShared()); DeferredPanPosition = FVector2D::ZeroVector; bRequestDeferredPan = false; }
void SExpandableArea::OnToggleContentVisibility() { bAreaCollapsed = !bAreaCollapsed; if( !bAreaCollapsed ) { RolloutCurve = FCurveSequence( 0.0f, 0.1f, ECurveEaseFunction::CubicOut ); RolloutCurve.Play( this->AsShared() ); } else { RolloutCurve = FCurveSequence( 0.0f, 0.1f, ECurveEaseFunction::CubicIn ); RolloutCurve.PlayReverse( this->AsShared() ); } // Allow some section-specific code to be executed when the section becomes visible or collapsed OnAreaExpansionChanged.ExecuteIfBound( !bAreaCollapsed ); }
virtual void ExpireAndFadeout() override { FadeAnimation = FCurveSequence(); // Add some space for the expire time FadeAnimation.AddCurve(FadeOutDuration.Get(), ExpireDuration.Get()); // Add the actual fade curve FadeCurve = FadeAnimation.AddCurve(0.f, FadeOutDuration.Get()); FadeAnimation.PlayReverse(); }
void SSpinningImage::Construct(const FArguments& InArgs) { Image = InArgs._Image; ColorAndOpacity = InArgs._ColorAndOpacity; OnMouseButtonDownHandler = InArgs._OnMouseButtonDown; SpinAnimationSequence = FCurveSequence( 0.f, InArgs._Period ); SpinAnimationSequence.Play( this->AsShared(), true ); }
void SDisappearingBar::Construct(const FArguments& InArgs) { FadeCurve = FCurveSequence(0, 0.25f); ColorAndOpacity = TAttribute<FLinearColor>::Create(TAttribute<FLinearColor>::FGetter::CreateSP(this, &SDisappearingBar::GetFadeColorAndOpacity)); ChildSlot [ InArgs._Content.Widget ]; }
// SCircularThrobber void SCircularThrobber::Construct(const FArguments& InArgs) { Sequence = FCurveSequence(); Curve = Sequence.AddCurve(0.f, InArgs._Period); Sequence.Play(); PieceImage = InArgs._PieceImage; NumPieces = InArgs._NumPieces; Radius = InArgs._Radius; }
void SSpinningImage::Construct(const FArguments& InArgs) { Image = InArgs._Image; ColorAndOpacity = InArgs._ColorAndOpacity; OnMouseButtonDownHandler = InArgs._OnMouseButtonDown; Sequence = FCurveSequence(); Curve = Sequence.AddCurve(0.f, InArgs._Period); Sequence.Play(); }
virtual void SetCompletionState(ECompletionState State) override { CompletionState = State; if (State == CS_Success || State == CS_Fail) { CompletionStateAnimation = FCurveSequence(); GlowCurve = CompletionStateAnimation.AddCurve(0.f, 0.75f); CompletionStateAnimation.Play(); } }
FShotThumbnail::FShotThumbnail(TSharedPtr<FShotSection> InSection, TRange<float> InTimeRange) : OwningSection(InSection) , Texture(NULL) , TimeRange(InTimeRange) { ThumbnailFadeAnimation = FCurveSequence(); ThumbnailFadeCurve = ThumbnailFadeAnimation.AddCurve(0.f, 0.25f, ECurveEaseFunction::QuadOut); Texture = new FSlateTexture2DRHIRef(GetSize().X, GetSize().Y, PF_B8G8R8A8, NULL, TexCreate_Dynamic, true); BeginInitResource( Texture ); }
void SProgressBar::Construct( const FArguments& InArgs ) { check(InArgs._Style); Percent = InArgs._Percent; BackgroundImage = &InArgs._Style->BackgroundImage; FillImage = &InArgs._Style->FillImage; MarqueeImage = &InArgs._Style->MarqueeImage; FillColorAndOpacity = InArgs._FillColorAndOpacity; BorderPadding = InArgs._BorderPadding; CurveSequence = FCurveSequence(0.0f, 0.5f); CurveSequence.Play(); }
/** A fadeout has completed */ void FadeoutComplete() { // Make sure we are no longer fading FadeAnimation = FCurveSequence(); FadeCurve = FCurveHandle(); // Clear the complete state to hide all the images/throbber SetCompletionState(CS_None); // Make sure we have left responsive mode if ( ThrottleHandle.IsValid() ) { FSlateThrottleManager::Get().LeaveResponsiveMode( ThrottleHandle ); } // Clear reference if( MyList.IsValid() ) { MyList.Pin()->NotificationItemFadedOut(SharedThis(this)); } }
void SAmethystWaitDialog::Construct(const FArguments& InArgs) { const FAmethystMenuItemStyle* ItemStyle = &FAmethystStyle::Get().GetWidgetStyle<FAmethystMenuItemStyle>("DefaultAmethystMenuItemStyle"); const FButtonStyle* ButtonStyle = &FAmethystStyle::Get().GetWidgetStyle<FButtonStyle>("DefaultAmethystButtonStyle"); ChildSlot .VAlign(VAlign_Center) .HAlign(HAlign_Center) [ SNew(SVerticalBox) + SVerticalBox::Slot() .AutoHeight() .Padding(20.0f) .VAlign(VAlign_Center) .HAlign(HAlign_Center) [ SNew(SBorder) .Padding(50.0f) .VAlign(VAlign_Center) .HAlign(HAlign_Center) .BorderImage(&ItemStyle->BackgroundBrush) .BorderBackgroundColor(FLinearColor(1.0f, 1.0f, 1.0f, 1.0f)) [ SNew(STextBlock) .TextStyle(FAmethystStyle::Get(), "AmethystGame.MenuHeaderTextStyle") .ColorAndOpacity(this, &SAmethystWaitDialog::GetTextColor) .Text(InArgs._MessageText) .WrapTextAt(500.0f) ] ] ]; //Setup a curve const float StartDelay = 0.0f; const float SecondDelay = 0.0f; const float AnimDuration = 2.0f; WidgetAnimation = FCurveSequence(); TextColorCurve = WidgetAnimation.AddCurve(StartDelay + SecondDelay, AnimDuration, ECurveEaseFunction::QuadInOut); WidgetAnimation.Play(this->AsShared(), true); }
void SThrobber::Construct(const FArguments& InArgs) { Animate = InArgs._Animate; AnimCurves = FCurveSequence(); { for (int32 PieceIndex=0; PieceIndex < InArgs._NumPieces; ++PieceIndex) { ThrobberCurve.Add( AnimCurves.AddCurve(PieceIndex*0.05f,1.5f) ); } AnimCurves.Play(); } TSharedRef<SHorizontalBox> HBox = SNew(SHorizontalBox); for (int32 PieceIndex=0; PieceIndex < InArgs._NumPieces; ++PieceIndex) { HBox->AddSlot() .AutoWidth() [ SNew(SBorder) .BorderImage( FStyleDefaults::GetNoBrush() ) .ContentScale( this, &SThrobber::GetPieceScale, PieceIndex ) .ColorAndOpacity( this, &SThrobber::GetPieceColor, PieceIndex ) .HAlign(HAlign_Center) .VAlign(VAlign_Center) [ SNew(SImage) .Image( InArgs._PieceImage ) ] ]; } this->ChildSlot [ HBox ]; }
void SErrorText::Construct(const FArguments& InArgs) { ExpandAnimation = FCurveSequence(0.0f, 0.15f); CustomVisibility = Visibility; Visibility = TAttribute<EVisibility>( SharedThis(this), &SErrorText::MyVisibility ); SBorder::Construct( SBorder::FArguments() .BorderBackgroundColor( InArgs._BackgroundColor ) .BorderImage( FCoreStyle::Get().GetBrush("ErrorReporting.Box") ) .ContentScale( this, &SErrorText::GetDesiredSizeScale ) .HAlign(HAlign_Center) .VAlign(VAlign_Center) .Padding( FMargin(3,0) ) [ SAssignNew( TextBlock, STextBlock ) .ColorAndOpacity( FCoreStyle::Get().GetColor("ErrorReporting.ForegroundColor") ) .Font(InArgs._Font) .AutoWrapText(InArgs._AutoWrapText) ] ); SetError( InArgs._ErrorText ); }
/** Constructs this widget with InArgs */ void Construct( const FArguments& InArgs ) { Style = InArgs._Style; HighlightedText = InArgs._HighlightedText; Label = InArgs._Label; HintColorAndOpacity = InArgs._HintColorAndOpacity; AllowHintText = InArgs._AllowHintText; ShowClassBackground = InArgs._ShowClassBackground; AssetThumbnail = InArgs._AssetThumbnail; bHasRenderedThumbnail = false; WidthLastFrame = 0; GenericThumbnailBorderPadding = 2.f; AssetThumbnail->OnAssetDataChanged().AddSP(this, &SAssetThumbnail::OnAssetDataChanged); const FAssetData& AssetData = AssetThumbnail->GetAssetData(); UClass* Class = FindObject<UClass>(ANY_PACKAGE, *AssetData.AssetClass.ToString()); FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked<FAssetToolsModule>(TEXT("AssetTools")); TWeakPtr<IAssetTypeActions> AssetTypeActions; if ( Class != NULL ) { AssetTypeActions = AssetToolsModule.Get().GetAssetTypeActionsForClass(Class); } AssetColor = FLinearColor::White; if ( AssetTypeActions.IsValid() ) { AssetColor = AssetTypeActions.Pin()->GetTypeColor(); } TSharedRef<SOverlay> OverlayWidget = SNew(SOverlay); FName Substyle; if ( Class == UClass::StaticClass() ) { Substyle = FName(".ClassBackground"); ClassAssetClass = FindObject<UClass>(ANY_PACKAGE, *AssetData.AssetName.ToString()); } else if(AssetTypeActions.IsValid()) { Substyle = FName(".AssetBackground"); } const FName BackgroundBrushName( *(Style.ToString() + Substyle.ToString()) ); ClassThumbnailBrushOverride = InArgs._ClassThumbnailBrushOverride; OverlayWidget->AddSlot() [ SNew(SBorder) .BorderImage( this, &SAssetThumbnail::GetBackgroundBrush ) .BorderBackgroundColor( this, &SAssetThumbnail::GetAssetColor ) .Padding( GenericThumbnailBorderPadding ) .VAlign(VAlign_Center) .HAlign(HAlign_Center) .Visibility(this, &SAssetThumbnail::GetClassThumbnailVisibility) [ SNew( SImage ) .Image( this, &SAssetThumbnail::GetClassThumbnailBrush ) ] ]; // The generic representation of the thumbnail, for use before the rendered version, if it exists OverlayWidget->AddSlot() [ SNew(SBorder) .BorderImage( this, &SAssetThumbnail::GetBackgroundBrush ) .BorderBackgroundColor( this, &SAssetThumbnail::GetAssetColor ) .Padding( GenericThumbnailBorderPadding ) .VAlign(VAlign_Center) .HAlign(HAlign_Center) .Visibility(this, &SAssetThumbnail::GetGenericThumbnailVisibility) [ SAssignNew(LabelTextBlock, STextBlock) .Text( GetLabelText() ) .Font( GetTextFont() ) .ColorAndOpacity( FEditorStyle::GetColor(Style, ".ColorAndOpacity") ) .ShadowOffset( FEditorStyle::GetVector(Style, ".ShadowOffset") ) .ShadowColorAndOpacity( FEditorStyle::GetColor(Style, ".ShadowColorAndOpacity") ) .WrapTextAt(this, &SAssetThumbnail::GetTextWrapWidth) .HighlightText( HighlightedText ) ] ]; if ( InArgs._ThumbnailPool.IsValid() && !InArgs._ForceGenericThumbnail && Class != UClass::StaticClass() ) { ViewportFadeAnimation = FCurveSequence(); ViewportFadeCurve = ViewportFadeAnimation.AddCurve(0.f, 0.25f, ECurveEaseFunction::QuadOut); TSharedPtr<SViewport> Viewport = SNew( SViewport ) .EnableGammaCorrection(false); Viewport->SetViewportInterface( AssetThumbnail.ToSharedRef() ); AssetThumbnail->GetViewportRenderTargetTexture(); // Access the render texture to push it on the stack if it isnt already rendered InArgs._ThumbnailPool->OnThumbnailRendered().AddSP(this, &SAssetThumbnail::OnThumbnailRendered); InArgs._ThumbnailPool->OnThumbnailRenderFailed().AddSP(this, &SAssetThumbnail::OnThumbnailRenderFailed); if ( ShouldRender() && (!InArgs._AllowFadeIn || InArgs._ThumbnailPool->IsRendered(AssetThumbnail)) ) { bHasRenderedThumbnail = true; ViewportFadeAnimation.JumpToEnd(); } // The viewport for the rendered thumbnail, if it exists OverlayWidget->AddSlot() [ SNew(SBorder) .Padding(0) .BorderImage(FEditorStyle::GetBrush("NoBrush")) .ColorAndOpacity(this, &SAssetThumbnail::GetViewportColorAndOpacity) .Visibility(this, &SAssetThumbnail::GetViewportVisibility) [ Viewport.ToSharedRef() ] ]; } OverlayWidget->AddSlot() .HAlign( HAlign_Center ) .VAlign( VAlign_Top ) .Padding(FMargin(2,2,2,2)) [ SNew(SBorder) .BorderImage( FEditorStyle::GetBrush( Style, ".HintBackground" ) ) .BorderBackgroundColor( this, &SAssetThumbnail::GetHintBackgroundColor) //Adjust the opacity of the border itself .ColorAndOpacity( HintColorAndOpacity ) //adjusts the opacity of the contents of the border .Visibility( this, &SAssetThumbnail::GetHintTextVisibility ) .Padding(0) [ SAssignNew( HintTextBlock, STextBlock ) .Text( GetLabelText() ) .Font( GetHintTextFont() ) .ColorAndOpacity( FEditorStyle::GetColor( Style, ".HintColorAndOpacity" ) ) .ShadowOffset( FEditorStyle::GetVector( Style, ".HintShadowOffset" ) ) .ShadowColorAndOpacity( FEditorStyle::GetColor( Style, ".HintShadowColorAndOpacity" ) ) .WrapTextAt(this, &SAssetThumbnail::GetTextWrapWidth) .HighlightText( HighlightedText ) ] ]; // The asset color strip, only visible when the rendered viewport is OverlayWidget->AddSlot() .HAlign(HAlign_Fill) .VAlign(VAlign_Bottom) [ SNew(SBorder) .BorderImage(FEditorStyle::GetBrush("WhiteBrush")) .BorderBackgroundColor(AssetColor) .Visibility(this, &SAssetThumbnail::GetViewportVisibility) .Padding(this, &SAssetThumbnail::GetAssetColorStripPadding) ]; ChildSlot [ OverlayWidget ]; }
void SAssetDiscoveryIndicator::Construct( const FArguments& InArgs ) { FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry")); AssetRegistryModule.Get().OnFileLoadProgressUpdated().AddRaw( this, &SAssetDiscoveryIndicator::OnAssetRegistryFileLoadProgress ); ScaleMode = InArgs._ScaleMode; FadeAnimation = FCurveSequence(); FadeAnimation.AddCurve(0.f, 4.f); // Add some space at the beginning to delay before fading in ScaleCurve = FadeAnimation.AddCurve(4.f, 0.75f); FadeCurve = FadeAnimation.AddCurve(4.75f, 0.75f); FadeAnimation.AddCurve(5.5f, 1.f); // Add some space at the end to cause a short delay before fading out if ( AssetRegistryModule.Get().IsLoadingAssets() ) { // Loading assets, show the progress Progress = 0.f; if ( InArgs._FadeIn ) { FadeAnimation.Play(); } else { FadeAnimation.JumpToEnd(); } } else { // Already done loading assets, set to complete and don't play the complete animation Progress = 1.f; } ChildSlot [ SNew(SBorder) .BorderImage( FEditorStyle::GetBrush("Menu.Background") ) .BorderBackgroundColor(this, &SAssetDiscoveryIndicator::GetBorderBackgroundColor) .ColorAndOpacity(this, &SAssetDiscoveryIndicator::GetIndicatorColorAndOpacity) .DesiredSizeScale(this, &SAssetDiscoveryIndicator::GetIndicatorDesiredSizeScale) .Visibility(this, &SAssetDiscoveryIndicator::GetIndicatorVisibility) .Padding(InArgs._Padding) .HAlign(HAlign_Center) .VAlign(VAlign_Center) [ SNew(SVerticalBox) // Text +SVerticalBox::Slot() .AutoHeight() .Padding(0, 4) [ SNew(STextBlock) .Font( FEditorStyle::GetFontStyle("AssetDiscoveryIndicator.DiscovertingAssetsFont") ) .Text( NSLOCTEXT("AssetDiscoveryIndicator", "DiscoveringAssets", "Discovering Assets").ToString() ) ] // Progress bar +SVerticalBox::Slot() .AutoHeight() .Padding(0, 4) [ SNew(SProgressBar) .Percent( this, &SAssetDiscoveryIndicator::GetProgress ) ] ] ]; }
void SAssetDiscoveryIndicator::Construct( const FArguments& InArgs ) { FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry")); AssetRegistryModule.Get().OnFileLoadProgressUpdated().AddSP( this, &SAssetDiscoveryIndicator::OnAssetRegistryFileLoadProgress ); AssetRegistryModule.Get().OnFilesLoaded().AddSP( this, &SAssetDiscoveryIndicator::OnAssetRegistryFilesLoaded ); ScaleMode = InArgs._ScaleMode; FadeAnimation = FCurveSequence(); FadeAnimation.AddCurve(0.f, 4.f); // Add some space at the beginning to delay before fading in ScaleCurve = FadeAnimation.AddCurve(4.f, 0.75f); FadeCurve = FadeAnimation.AddCurve(4.75f, 0.75f); FadeAnimation.AddCurve(5.5f, 1.f); // Add some space at the end to cause a short delay before fading out MainStatusText = LOCTEXT("InitializingAssetDiscovery", "Initializing Asset Discovery"); StatusTextWrapWidth = 0.0f; if ( AssetRegistryModule.Get().IsLoadingAssets() ) { // Loading assets, marquee while discovering package files Progress = TOptional<float>(); if ( InArgs._FadeIn ) { FadeAnimation.Play( this->AsShared() ); } else { FadeAnimation.JumpToEnd(); } } else { // Already done loading assets, set to complete and don't play the complete animation Progress = 1.f; } ChildSlot [ SNew(SVerticalBox) +SVerticalBox::Slot() .Padding(InArgs._Padding) .HAlign(HAlign_Center) [ SNew(SBorder) .BorderImage(FEditorStyle::GetBrush("Menu.Background")) .BorderBackgroundColor(this, &SAssetDiscoveryIndicator::GetBorderBackgroundColor) .ColorAndOpacity(this, &SAssetDiscoveryIndicator::GetIndicatorColorAndOpacity) .DesiredSizeScale(this, &SAssetDiscoveryIndicator::GetIndicatorDesiredSizeScale) .Visibility(this, &SAssetDiscoveryIndicator::GetIndicatorVisibility) .VAlign(VAlign_Center) [ SNew(SVerticalBox) // Text +SVerticalBox::Slot() .AutoHeight() .Padding(AssetDiscoveryIndicatorConstants::Padding) [ SNew(SVerticalBox) +SVerticalBox::Slot() .AutoHeight() [ SNew(STextBlock) .Font(FEditorStyle::GetFontStyle("AssetDiscoveryIndicator.MainStatusFont")) .Text(this, &SAssetDiscoveryIndicator::GetMainStatusText) .WrapTextAt(this, &SAssetDiscoveryIndicator::GetStatusTextWrapWidth) .Justification(ETextJustify::Center) ] +SVerticalBox::Slot() .AutoHeight() [ SNew(SBox) .Padding(AssetDiscoveryIndicatorConstants::SubStatusTextPadding) .Visibility(this, &SAssetDiscoveryIndicator::GetSubStatusTextVisibility) [ SNew(STextBlock) .Font(FEditorStyle::GetFontStyle("AssetDiscoveryIndicator.SubStatusFont")) .Text(this, &SAssetDiscoveryIndicator::GetSubStatusText) .WrapTextAt(this, &SAssetDiscoveryIndicator::GetStatusTextWrapWidth) .Justification(ETextJustify::Center) ] ] ] // Progress bar +SVerticalBox::Slot() .AutoHeight() .Padding(AssetDiscoveryIndicatorConstants::Padding) [ SNew(SProgressBar) .Percent(this, &SAssetDiscoveryIndicator::GetProgress) ] ] ] ]; }
void SExpandableArea::Construct( const FArguments& InArgs ) { check(InArgs._Style); bAreaCollapsed = InArgs._InitiallyCollapsed; MaxHeight = InArgs._MaxHeight; OnAreaExpansionChanged = InArgs._OnAreaExpansionChanged; CollapsedImage = &InArgs._Style->CollapsedImage; ExpandedImage = &InArgs._Style->ExpandedImage; // If it should be initially visible, show it now RolloutCurve = FCurveSequence(0.0f, 0.1f, ECurveEaseFunction::QuadOut); if (!bAreaCollapsed) { RolloutCurve.JumpToEnd(); } TSharedRef<SWidget> HeaderContent = InArgs._HeaderContent.Widget; if( HeaderContent == SNullWidget::NullWidget ) { HeaderContent = SNew(STextBlock) .Text(InArgs._AreaTitle) .Font(InArgs._AreaTitleFont) .ShadowOffset(FVector2D(1.0f, 1.0f)); } ChildSlot [ SNew( SBorder ) .BorderImage( InArgs._BorderImage ) .BorderBackgroundColor( InArgs._BorderBackgroundColor ) .Padding(0.0f) [ SNew(SVerticalBox) + SVerticalBox::Slot() .AutoHeight() [ SNew( SButton ) .ButtonStyle(FCoreStyle::Get(), "NoBorder") .ContentPadding(InArgs._HeaderPadding) .ForegroundColor(FSlateColor::UseForeground()) .OnClicked( this, &SExpandableArea::OnHeaderClicked ) [ ConstructHeaderWidget( InArgs, HeaderContent ) ] ] + SVerticalBox::Slot() .FillHeight(1.0f) [ SNew(SBorder) .Visibility(this, &SExpandableArea::OnGetContentVisibility) .BorderImage(FStyleDefaults::GetNoBrush()) .Padding(InArgs._Padding) .DesiredSizeScale(this, &SExpandableArea::GetSectionScale) [ InArgs._BodyContent.Widget ] ] ] ]; }
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION void SJavascriptConsole::Construct( const FArguments& InArgs, const EJavascriptConsoleStyle::Type InStyle, FJavascriptConsoleModule* JavascriptConsoleModule, const FJavascriptConsoleDelegates* JavascriptConsoleDelegates ) { CurrentStyle = InStyle; TSharedPtr<SJavascriptConsoleInputBox> ConsoleInputBox; check( JavascriptConsoleModule != NULL ); ChildSlot [ SNew( SVerticalBox ) +SVerticalBox::Slot() .AutoHeight() [ SNew( SVerticalBox ) .Visibility( this, &SJavascriptConsole::MakeVisibleIfLogIsShown ) +SVerticalBox::Slot() .AutoHeight() .Padding( 10.0f ) [ SNew(SBox) .HeightOverride( 200.0f ) [ SNew( SBorder ) .BorderImage( FEditorStyle::GetBrush( "ToolPanel.GroupBorder" ) ) .ColorAndOpacity( this, &SJavascriptConsole::GetAnimatedColorAndOpacity ) .BorderBackgroundColor( this, &SJavascriptConsole::GetAnimatedSlateColor ) [ SNew( SSpacer ) ] ] ] ] +SVerticalBox::Slot() .AutoHeight() .Padding( 10.0f ) [ SNew(SBox) .HeightOverride( 26.0f ) .HAlign( HAlign_Left ) [ SNew( SBorder ) .Padding( FMargin(2) ) .BorderImage( FEditorStyle::GetBrush( "JavascriptConsole.Background" ) ) .ColorAndOpacity( this, &SJavascriptConsole::GetAnimatedColorAndOpacity ) .BorderBackgroundColor( this, &SJavascriptConsole::GetAnimatedSlateColor ) [ SNew(SHorizontalBox) + SHorizontalBox::Slot() .AutoWidth() .Padding(3.0f) .VAlign(VAlign_Center) [ SNew(STextBlock) .Text(NSLOCTEXT("Console", "ConsoleLabel", "Console")) ] + SHorizontalBox::Slot() .Padding(5.0f, 2.0f) .VAlign(VAlign_Center) .MaxWidth(400.0f) [ SAssignNew(ConsoleInputBox, SJavascriptConsoleInputBox) .OnConsoleCommandExecuted(JavascriptConsoleDelegates->OnConsoleCommandExecuted) ] ] ] ] ]; EditableTextBox = ConsoleInputBox->GetEditableTextBox(); // Kick off intro animation AnimCurveSequence = FCurveSequence(); AnimCurve = AnimCurveSequence.AddCurve( 0.0f, JavascriptConsoleDefs::IntroAnimationDuration, ECurveEaseFunction::QuadOut ); FlashCurve = AnimCurveSequence.AddCurve( JavascriptConsoleDefs::IntroAnimationDuration, .15f, ECurveEaseFunction::QuadInOut ); AnimCurveSequence.Play(this->AsShared()); }
void FadeIn(float Time) { OpacityCurve = FCurveSequence(0.f, Time, ECurveEaseFunction::QuadOut); OpacityCurve.Play(AsShared()); }
/** Constructs this widget with InArgs */ void Construct( const FArguments& InArgs ) { Style = InArgs._Style; HighlightedText = InArgs._HighlightedText; Label = InArgs._Label; HintColorAndOpacity = InArgs._HintColorAndOpacity; bAllowHintText = InArgs._AllowHintText; AssetThumbnail = InArgs._AssetThumbnail; bHasRenderedThumbnail = false; WidthLastFrame = 0; GenericThumbnailBorderPadding = 2.f; AssetThumbnail->OnAssetDataChanged().AddSP(this, &SAssetThumbnail::OnAssetDataChanged); const FAssetData& AssetData = AssetThumbnail->GetAssetData(); UClass* Class = FindObject<UClass>(ANY_PACKAGE, *AssetData.AssetClass.ToString()); FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked<FAssetToolsModule>(TEXT("AssetTools")); TSharedPtr<IAssetTypeActions> AssetTypeActions; if ( Class != NULL ) { AssetTypeActions = AssetToolsModule.Get().GetAssetTypeActionsForClass(Class).Pin(); } AssetColor = FLinearColor::White; if( InArgs._AssetTypeColorOverride.IsSet() ) { AssetColor = InArgs._AssetTypeColorOverride.GetValue(); } else if ( AssetTypeActions.IsValid() ) { AssetColor = AssetTypeActions->GetTypeColor(); } TSharedRef<SOverlay> OverlayWidget = SNew(SOverlay); UpdateThumbnailClass(AssetData.AssetName, Class); ClassThumbnailBrushOverride = InArgs._ClassThumbnailBrushOverride; // The generic representation of the thumbnail, for use before the rendered version, if it exists OverlayWidget->AddSlot() [ SNew(SBorder) .BorderImage(GetAssetBackgroundBrush()) .BorderBackgroundColor(AssetColor.CopyWithNewOpacity(0.3f)) .Padding(GenericThumbnailBorderPadding) .VAlign(VAlign_Center) .HAlign(HAlign_Center) .Visibility(this, &SAssetThumbnail::GetGenericThumbnailVisibility) [ SNew(SOverlay) +SOverlay::Slot() [ SAssignNew(GenericLabelTextBlock, STextBlock) .Text(GetLabelText()) .Font(GetTextFont()) .Justification(ETextJustify::Center) .ColorAndOpacity(FEditorStyle::GetColor(Style, ".ColorAndOpacity")) .ShadowOffset(FEditorStyle::GetVector(Style, ".ShadowOffset")) .ShadowColorAndOpacity( FEditorStyle::GetColor(Style, ".ShadowColorAndOpacity")) .HighlightText(HighlightedText) ] +SOverlay::Slot() [ SAssignNew(GenericThumbnailImage, SImage) .Image(this, &SAssetThumbnail::GetClassThumbnailBrush) ] ] ]; if ( InArgs._ThumbnailPool.IsValid() && !InArgs._ForceGenericThumbnail ) { ViewportFadeAnimation = FCurveSequence(); ViewportFadeCurve = ViewportFadeAnimation.AddCurve(0.f, 0.25f, ECurveEaseFunction::QuadOut); TSharedPtr<SViewport> Viewport = SNew( SViewport ) .EnableGammaCorrection(false); Viewport->SetViewportInterface( AssetThumbnail.ToSharedRef() ); AssetThumbnail->GetViewportRenderTargetTexture(); // Access the render texture to push it on the stack if it isnt already rendered InArgs._ThumbnailPool->OnThumbnailRendered().AddSP(this, &SAssetThumbnail::OnThumbnailRendered); InArgs._ThumbnailPool->OnThumbnailRenderFailed().AddSP(this, &SAssetThumbnail::OnThumbnailRenderFailed); if ( ShouldRender() && (!InArgs._AllowFadeIn || InArgs._ThumbnailPool->IsRendered(AssetThumbnail)) ) { bHasRenderedThumbnail = true; ViewportFadeAnimation.JumpToEnd(); } // The viewport for the rendered thumbnail, if it exists OverlayWidget->AddSlot() [ SAssignNew(RenderedThumbnailWidget, SBorder) .Padding(0) .BorderImage(FEditorStyle::GetBrush("NoBrush")) .ColorAndOpacity(this, &SAssetThumbnail::GetViewportColorAndOpacity) [ Viewport.ToSharedRef() ] ]; } if( ThumbnailClass.Get() && bIsClassType ) { OverlayWidget->AddSlot() .VAlign(VAlign_Bottom) .HAlign(HAlign_Right) .Padding(TAttribute<FMargin>(this, &SAssetThumbnail::GetClassIconPadding)) [ SAssignNew(ClassIconWidget, SBorder) .BorderImage(FEditorStyle::GetNoBrush()) [ SNew(SImage) .Image(this, &SAssetThumbnail::GetClassIconBrush) ] ]; } if( bAllowHintText ) { OverlayWidget->AddSlot() .HAlign(HAlign_Center) .VAlign(VAlign_Top) .Padding(FMargin(2, 2, 2, 2)) [ SNew(SBorder) .BorderImage(FEditorStyle::GetBrush(Style, ".HintBackground")) .BorderBackgroundColor(this, &SAssetThumbnail::GetHintBackgroundColor) //Adjust the opacity of the border itself .ColorAndOpacity(HintColorAndOpacity) //adjusts the opacity of the contents of the border .Visibility(this, &SAssetThumbnail::GetHintTextVisibility) .Padding(0) [ SAssignNew(HintTextBlock, STextBlock) .Text(GetLabelText()) .Font(GetHintTextFont()) .ColorAndOpacity(FEditorStyle::GetColor(Style, ".HintColorAndOpacity")) .ShadowOffset(FEditorStyle::GetVector(Style, ".HintShadowOffset")) .ShadowColorAndOpacity(FEditorStyle::GetColor(Style, ".HintShadowColorAndOpacity")) .HighlightText(HighlightedText) ] ]; } // The asset color strip OverlayWidget->AddSlot() .HAlign(HAlign_Fill) .VAlign(VAlign_Bottom) [ SAssignNew(AssetColorStripWidget, SBorder) .BorderImage(FEditorStyle::GetBrush("WhiteBrush")) .BorderBackgroundColor(AssetColor) .Padding(this, &SAssetThumbnail::GetAssetColorStripPadding) ]; if( InArgs._AllowAssetSpecificThumbnailOverlay && AssetTypeActions.IsValid() ) { // Does the asset provide an additional thumbnail overlay? TSharedPtr<SWidget> AssetSpecificThumbnailOverlay = AssetTypeActions->GetThumbnailOverlay(AssetData); if( AssetSpecificThumbnailOverlay.IsValid() ) { OverlayWidget->AddSlot() [ AssetSpecificThumbnailOverlay.ToSharedRef() ]; } } ChildSlot [ OverlayWidget ]; UpdateThumbnailVisibilities(); }
void FSequencer::InitSequencer( const FSequencerInitParams& InitParams, const TArray<FOnCreateTrackEditor>& TrackEditorDelegates ) { if( IsSequencerEnabled() ) { bIsEditingWithinLevelEditor = InitParams.bEditWithinLevelEditor; ToolkitHost = InitParams.ToolkitHost; LastViewRange = InitParams.ViewParams.InitalViewRange; ScrubPosition = InitParams.ViewParams.InitialScrubPosition; ObjectChangeListener = InitParams.ObjectChangeListener; ObjectBindingManager = InitParams.ObjectBindingManager; check( ObjectChangeListener.IsValid() ); check( ObjectBindingManager.IsValid() ); UMovieScene& RootMovieScene = *InitParams.RootMovieScene; RootMovieScene.SetFlags( RF_Transactional ); // Focusing the initial movie scene needs to be done before the first time GetFocusedMovieSceneInstane or GetRootMovieSceneInstance is used RootMovieSceneInstance = MakeShareable( new FMovieSceneInstance( RootMovieScene ) ); MovieSceneStack.Add( RootMovieSceneInstance.ToSharedRef() ); // Make internal widgets SequencerWidget = SNew( SSequencer, SharedThis( this ) ) .ViewRange( this, &FSequencer::OnGetViewRange ) .ScrubPosition( this, &FSequencer::OnGetScrubPosition ) .OnScrubPositionChanged( this, &FSequencer::OnScrubPositionChanged ) .OnViewRangeChanged( this, &FSequencer::OnViewRangeChanged, false ); // When undo occurs, get a notification so we can make sure our view is up to date GEditor->RegisterForUndo(this); if( bIsEditingWithinLevelEditor ) { // @todo remove when world-centric mode is added // Hook into the editor's mechanism for checking whether we need live capture of PIE/SIE actor state GEditor->GetActorRecordingState().AddSP(this, &FSequencer::GetActorRecordingState); } // Create tools and bind them to this sequencer for( int32 DelegateIndex = 0; DelegateIndex < TrackEditorDelegates.Num(); ++DelegateIndex ) { check( TrackEditorDelegates[DelegateIndex].IsBound() ); // Tools may exist in other modules, call a delegate that will create one for us TSharedRef<FMovieSceneTrackEditor> TrackEditor = TrackEditorDelegates[DelegateIndex].Execute( SharedThis( this ) ); // Keep track of certain editors if ( TrackEditor->SupportsType( UMovieSceneDirectorTrack::StaticClass() ) ) { DirectorTrackEditor = TrackEditor; } else if ( TrackEditor->SupportsType( UMovieSceneAnimationTrack::StaticClass() ) ) { AnimationTrackEditor = TrackEditor; } TrackEditors.Add( TrackEditor ); } ZoomAnimation = FCurveSequence(); ZoomCurve = ZoomAnimation.AddCurve(0.f, 0.35f, ECurveEaseFunction::QuadIn); OverlayAnimation = FCurveSequence(); OverlayCurve = OverlayAnimation.AddCurve(0.f, 0.35f, ECurveEaseFunction::QuadIn); // Update initial movie scene data NotifyMovieSceneDataChanged(); // NOTE: Could fill in asset editor commands here! BindSequencerCommands(); } }
void SCircularThrobber::ConstructSequence() { Sequence = FCurveSequence(); Curve = Sequence.AddCurve(0.f, Period); Sequence.Play(this->AsShared(), true); }