VisualU 1.2.1
Plugin for Unreal Engine 5 that brings core functionality for a widget-based visual novel game
 
Loading...
Searching...
No Matches
UVisualRenderer Class Reference

Responsible for visualizing data from described by FScenario. More...

#include <VisualRenderer.h>

Inheritance diagram for UVisualRenderer:

Public Member Functions

 UVisualRenderer (const FObjectInitializer &ObjectInitializer=FObjectInitializer::Get())
 
virtual void DrawScene (const FScenario *Scene)
 Assembles widgets for the scene.
 
bool IsTransitionInProgress () const
 
bool TryDrawTransition (const FScenario *From, const FScenario *To)
 Tries to start and visualize transition material with backgrounds from specified scenes.
 
void ForceStopTransition ()
 Unconditionally stops ongoing transition.
 

Protected Member Functions

virtual TSharedRef< SWidget > RebuildWidget () override
 Constructs underlying slate widget and widgets needed for drawing scenes.
 
virtual void NativeOnInitialized () override
 Initializes renderer properties and transition animation.
 
virtual void OnAnimationFinished_Implementation (const UWidgetAnimation *Animation) override
 Finishes transition.
 
void ForEachSprite (TFunction< void(UVisualSprite *Sprite)> Action)
 Iterates over each UVisualSprite in the canvas panel.
 

Private Attributes

TObjectPtr< UWidgetAnimation > Transition
 Widget animation used to drive transition between scenes.
 
const FScenarioFinalScene
 Scene that will be displayed after transition ends.
 
TObjectPtr< UBackgroundVisualImageBackground
 Persistent widget that displays scene background.
 
TObjectPtr< UCanvasPanel > Canvas
 Persistent widget that holds background and all sprites of the scene.
 

Detailed Description

Responsible for visualizing data from described by FScenario.

Renderer supports custom transitions between scene backgrounds that are defined by FBackground::TransitionMaterial. Transition is driven by widget animation and can be configured in UVisualUSettings class.

Note
not blueprintable

Member Function Documentation

◆ DrawScene()

void UVisualRenderer::DrawScene ( const FScenario * Scene)
virtual

Assembles widgets for the scene.

Parameters
Scenescene to render

◆ ForEachSprite()

void UVisualRenderer::ForEachSprite ( TFunction< void(UVisualSprite *Sprite)> Action)
protected

Iterates over each UVisualSprite in the canvas panel.

Parameters
Actioncallable that will be executed for each sprite

◆ IsTransitionInProgress()

bool UVisualRenderer::IsTransitionInProgress ( ) const
Returns
true for ongoing visual transition between secenes
See also
UVisualRenderer::TryDrawTransition()

◆ OnAnimationFinished_Implementation()

void UVisualRenderer::OnAnimationFinished_Implementation ( const UWidgetAnimation * Animation)
overrideprotectedvirtual

Finishes transition.

Parameters
Animationfinished transition animation

◆ RebuildWidget()

TSharedRef< SWidget > UVisualRenderer::RebuildWidget ( )
overrideprotectedvirtual

Constructs underlying slate widget and widgets needed for drawing scenes.

Renderer always has a canvas panel to which visual sprites are added, and one persistent visual image for scene background.

Returns
underlying slate widget
See also
UVisualRenderer::Background UVisualRenderer::Canvas

◆ TryDrawTransition()

bool UVisualRenderer::TryDrawTransition ( const FScenario * From,
const FScenario * To )

Tries to start and visualize transition material with backgrounds from specified scenes.

Logical transition between scenes is handled by UVisualController.

Parameters
Fromscene which is drawn currently
Toscene that will be drawn after transition ends
Returns
true for started transition
See also
UVisualRenderer::Transition

Member Data Documentation

◆ FinalScene

const FScenario* UVisualRenderer::FinalScene
private

Scene that will be displayed after transition ends.

It temporarily used during transition process. It is invalid when transition does not occur.

◆ Transition

TObjectPtr<UWidgetAnimation> UVisualRenderer::Transition
private

Widget animation used to drive transition between scenes.

It can be configured in UVisualUSettings.

Note
Transient. It will not be serialized.

The documentation for this class was generated from the following files: