コード例 #1
0
ファイル: UserWidget.cpp プロジェクト: kidaa/UnrealEngineVR
FMargin UUserWidget::GetFullScreenOffset() const
{
	// If the size is zero, and we're not stretched, then use the desired size.
	FVector2D FinalSize = FVector2D(ViewportOffsets.Right, ViewportOffsets.Bottom);
	if ( FinalSize.IsZero() && !ViewportAnchors.IsStretchedVertical() && !ViewportAnchors.IsStretchedHorizontal() )
	{
		TSharedPtr<SWidget> CachedWidget = GetCachedWidget();
		if ( CachedWidget.IsValid() )
		{
			FinalSize = CachedWidget->GetDesiredSize();
		}
	}

	return FMargin(ViewportOffsets.Left, ViewportOffsets.Top, FinalSize.X, FinalSize.Y);
}
コード例 #2
0
ファイル: UserWidget.cpp プロジェクト: ErwinT6/T6Engine
void UUserWidget::TickActionsAndAnimation(const FGeometry& MyGeometry, float InDeltaTime)
{
	if ( IsDesignTime() )
	{
		return;
	}

	// Update active movie scenes
	for ( UUMGSequencePlayer* Player : ActiveSequencePlayers )
	{
		Player->Tick(InDeltaTime);
	}

	const bool bWasPlayingAnimation = IsPlayingAnimation();

	// The process of ticking the players above can stop them so we remove them after all players have ticked
	for ( UUMGSequencePlayer* StoppedPlayer : StoppedSequencePlayers )
	{
		ActiveSequencePlayers.RemoveSwap(StoppedPlayer);
	}

	StoppedSequencePlayers.Empty();

	// If we're no longer playing animations invalidate layout so that we recache the volatility of the widget.
	if ( bWasPlayingAnimation && IsPlayingAnimation() == false )
	{
		TSharedPtr<SWidget> CachedWidget = GetCachedWidget();
		if ( CachedWidget.IsValid() )
		{
			CachedWidget->Invalidate(EInvalidateWidget::LayoutAndVolatility);
		}
	}

	UWorld* World = GetWorld();
	if ( World )
	{
		// Update any latent actions we have for this actor
		FLatentActionManager& LatentActionManager = World->GetLatentActionManager();
		LatentActionManager.ProcessLatentActions(this, InDeltaTime);
	}
}
コード例 #3
0
ファイル: UserWidget.cpp プロジェクト: ErwinT6/T6Engine
void UUserWidget::PlayAnimation( const UWidgetAnimation* InAnimation, float StartAtTime, int32 NumberOfLoops, EUMGSequencePlayMode::Type PlayMode)
{
	if( InAnimation )
	{
		// @todo UMG sequencer - Restart animations which have had Play called on them?
		UUMGSequencePlayer** FoundPlayer = ActiveSequencePlayers.FindByPredicate(
			[&](const UUMGSequencePlayer* Player)
			{
				return Player->GetAnimation() == InAnimation;
			});

		if( !FoundPlayer )
		{
			UUMGSequencePlayer* NewPlayer = NewObject<UUMGSequencePlayer>(this);
			ActiveSequencePlayers.Add( NewPlayer );

			NewPlayer->OnSequenceFinishedPlaying().AddUObject( this, &UUserWidget::OnAnimationFinishedPlaying );

			NewPlayer->InitSequencePlayer( *InAnimation, *this );

			NewPlayer->Play( StartAtTime, NumberOfLoops, PlayMode );
		}
		else
		{
			( *FoundPlayer )->Play( StartAtTime, NumberOfLoops, PlayMode );
		}

		TSharedPtr<SWidget> CachedWidget = GetCachedWidget();
		if ( CachedWidget.IsValid() )
		{
			CachedWidget->Invalidate(EInvalidateWidget::LayoutAndVolatility);
		}

		OnAnimationStarted( InAnimation );
	}
}