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

Widget that can visualize and animate sprite flipbooks. More...

#include <VisualImage.h>

Inheritance diagram for UVisualImage:
UVisualImageBase IInfoAssignable UBackgroundVisualImage

Public Member Functions

 UVisualImage (const FObjectInitializer &ObjectInitializer)
 
 DECLARE_DYNAMIC_DELEGATE_RetVal (UPaperFlipbook *, FGetPaperFlipbook)
 
virtual void ReleaseSlateResources (bool bReleaseChildren) override
 Releases memory allocated for slate widgets.
 
virtual void AssignVisualImageInfo (const FVisualImageInfo &InInfo) override
 Applies received information to this image.
 
void SetAnimate (bool IsAnimated)
 Setter for UVisualController::bAnimate.
 
void SetFrameIndex (int Index)
 Setter for UVisualImage::FrameIndex.
 
void SetFlipbook (UPaperFlipbook *InFlipbook)
 Synchronous setter for flipbook.
 
void SetFlipbookAsync (TSoftObjectPtr< UPaperFlipbook > InFlipbook)
 Asynchronous setter for flipbook.
 
void CancelAsyncLoad ()
 Releases streamed flipbook.
 
bool IsFlipbookLoading () const
 
bool IsFlipbookLoaded () const
 
void SetColorAndOpacity (const FLinearColor &InColorAndOpacity)
 Setter for UVisualImage::ColorAndOpacity.
 
void SetDesiredScale (const FVector2D &InDesiredScale)
 Setter for UVisualImage::DesiredScale.
 
void SetMirrorScale (const FVector2D &InMirrorScale)
 Setter for UVisualImage::MirrorScale.
 
FORCEINLINE UPaperFlipbook * GetFlipbook () const
 
FORCEINLINE bool IsAnimated () const
 
FORCEINLINE int32 GetFrameIndex () const
 
FORCEINLINE FLinearColor GetColorAndOpacity () const
 
FORCEINLINE FVector2D GetDesiredScale () const
 
FORCEINLINE FVector2D GetMirrorScale () const
 
UPaperSprite * GetCurrentSprite () const
 

Protected Member Functions

virtual void SynchronizeProperties () override
 Keeps C++ and derived blueprint classes synced in the widget designer.
 
virtual TSharedRef< SWidget > RebuildWidget () override
 
TSharedPtr< FStreamableHandle > AsyncLoadFlipbook (TSoftObjectPtr< UPaperFlipbook > FlipbookToLoad, FStreamableDelegate AfterLoadDelegate, TAsyncLoadPriority Priority)
 Asynchronously stream soft flipbook in the memory.
 
const UPaperFlipbook * ToFlipbook (TAttribute< UPaperFlipbook * > InFlipbook) const
 Converts flipbook attribute to the flipbook pointer.
 
 PROPERTY_BINDING_IMPLEMENTATION (FSlateColor, ColorAndOpacity)
 
- Protected Member Functions inherited from UVisualImageBase
 UVisualImageBase (const FObjectInitializer &ObjectInitializer)
 Abstract, cannot be instantiated.
 

Protected Attributes

TObjectPtr< UPaperFlipbook > Flipbook
 Paper flipbook to visualize.
 
FGetPaperFlipbook FlipbookDelegate
 Delegate for property binding of the flipbook.
 
FLinearColor ColorAndOpacity
 Color and opacity of the flipbook.
 
FGetLinearColor ColorAndOpacityDelegate
 Delegate for property binding of the color and opacity.
 
FVector2D DesiredScale
 Scale of the flipbook.
 
FVector2D MirrorScale
 Determines the orientation of the sprite on both axes.
 
bool bAnimate
 Decides whether or not flipbook's animation sequence should be played.
 
int32 FrameIndex
 Index of the flipbook's frame that must be rendered.
 
TSharedPtr< FStreamableHandle > FlipbookHandle
 Handle to the streamable flipbook.
 
TSharedPtr< SVisualImageVisualImageSlate
 Underlying slate visual image.
 

Detailed Description

Widget that can visualize and animate sprite flipbooks.

Visual image operates on UPaperFlipbook class which is provided by Paper2D built-in plugin. Supports asynchronous loading of soft flipbooks.

Member Function Documentation

◆ AssignVisualImageInfo()

void UVisualImage::AssignVisualImageInfo ( const FVisualImageInfo & InInfo)
overridevirtual

Applies received information to this image.

Parameters
InInfoinformation for this visual image

◆ AsyncLoadFlipbook()

TSharedPtr< FStreamableHandle > UVisualImage::AsyncLoadFlipbook ( TSoftObjectPtr< UPaperFlipbook > FlipbookToLoad,
FStreamableDelegate AfterLoadDelegate,
TAsyncLoadPriority Priority )
protected

Asynchronously stream soft flipbook in the memory.

Will trigger assertion for invalid soft flipbook.

Parameters
FlipbookToLoadsoft flipbook to stream in memory
AfterLoadDelegatedelegate to execute after loading is complete
Priorityhow urgent is loading of the soft flipbook
Returns
handle to the loaded flipbook

◆ CancelAsyncLoad()

void UVisualImage::CancelAsyncLoad ( )

Releases streamed flipbook.

Note
does not affect already loaded flipbook

◆ GetColorAndOpacity()

FORCEINLINE FLinearColor UVisualImage::GetColorAndOpacity ( ) const
inline
Returns
color and opacity of the flipbook

◆ GetCurrentSprite()

UPaperSprite * UVisualImage::GetCurrentSprite ( ) const
Returns
sprite of the flipbook that is currently visualized by this widget

◆ GetDesiredScale()

FORCEINLINE FVector2D UVisualImage::GetDesiredScale ( ) const
inline
Returns
desired scale of the flipbook

◆ GetFlipbook()

FORCEINLINE UPaperFlipbook * UVisualImage::GetFlipbook ( ) const
inline
Returns
current flipbook

◆ GetFrameIndex()

FORCEINLINE int32 UVisualImage::GetFrameIndex ( ) const
inline
Returns
Index of the flipbook frame that should be displayed. Meaningless when flipbook is animated.

◆ GetMirrorScale()

FORCEINLINE FVector2D UVisualImage::GetMirrorScale ( ) const
inline
Returns
mirror scale of the flipbook

◆ IsAnimated()

FORCEINLINE bool UVisualImage::IsAnimated ( ) const
inline
Returns
animation state of the flipbook

◆ IsFlipbookLoaded()

bool UVisualImage::IsFlipbookLoaded ( ) const
Returns
true when streaming has finished.

◆ IsFlipbookLoading()

bool UVisualImage::IsFlipbookLoading ( ) const
Returns
true when streaming is still in progress.

◆ RebuildWidget()

TSharedRef< SWidget > UVisualImage::RebuildWidget ( )
overrideprotectedvirtual
Returns
underlying slate widget

Reimplemented in UBackgroundVisualImage.

◆ ReleaseSlateResources()

void UVisualImage::ReleaseSlateResources ( bool bReleaseChildren)
overridevirtual

Releases memory allocated for slate widgets.

Parameters
bReleaseChildrenshould memory of child widgets be released

Reimplemented in UBackgroundVisualImage.

◆ SetAnimate()

void UVisualImage::SetAnimate ( bool IsAnimated)

Setter for UVisualController::bAnimate.

Parameters
IsAnimatednew flipbook animation state

◆ SetColorAndOpacity()

void UVisualImage::SetColorAndOpacity ( const FLinearColor & InColorAndOpacity)

Setter for UVisualImage::ColorAndOpacity.

Parameters
InColorAndOpacitynew color and opacity of the flipbook

◆ SetDesiredScale()

void UVisualImage::SetDesiredScale ( const FVector2D & InDesiredScale)

Setter for UVisualImage::DesiredScale.

Parameters
InDesiredScalenew desired scale of the flipbook

◆ SetFlipbook()

void UVisualImage::SetFlipbook ( UPaperFlipbook * InFlipbook)

Synchronous setter for flipbook.

Parameters
InFlipbooknew flipbook to display

◆ SetFlipbookAsync()

void UVisualImage::SetFlipbookAsync ( TSoftObjectPtr< UPaperFlipbook > InFlipbook)

Asynchronous setter for flipbook.

Parameters
InFlipbooknew soft flipbook to display

◆ SetFrameIndex()

void UVisualImage::SetFrameIndex ( int Index)

Setter for UVisualImage::FrameIndex.

Parameters
Indexindex of frame to display

◆ SetMirrorScale()

void UVisualImage::SetMirrorScale ( const FVector2D & InMirrorScale)

Setter for UVisualImage::MirrorScale.

Parameters
InMirrorScalenew mirror scale of the flipbook

◆ ToFlipbook()

const UPaperFlipbook * UVisualImage::ToFlipbook ( TAttribute< UPaperFlipbook * > InFlipbook) const
protected

Converts flipbook attribute to the flipbook pointer.

Used to implement property binding of the flipbook.

Parameters
InFlipbookflipbook attribute to convert
Returns
retrieved flipbook

Member Data Documentation

◆ ColorAndOpacity

FLinearColor UVisualImage::ColorAndOpacity
protected

Color and opacity of the flipbook.

Note
has no effect on widget appearance for invalid flipbook

◆ DesiredScale

FVector2D UVisualImage::DesiredScale
protected

Scale of the flipbook.

Must be larger than zero on both axes.

◆ FlipbookDelegate

FGetPaperFlipbook UVisualImage::FlipbookDelegate
protected

Delegate for property binding of the flipbook.

See also
UVisualImage::ToFlipbook()

◆ FrameIndex

int32 UVisualImage::FrameIndex
protected

Index of the flipbook's frame that must be rendered.

Ignored when UVisualImage::bAnimate is true.

◆ MirrorScale

FVector2D UVisualImage::MirrorScale
protected

Determines the orientation of the sprite on both axes.

Only -1 or 1 values are valid.

Note
mirror scale does not affect the desired size of the widget

◆ VisualImageSlate

TSharedPtr<SVisualImage> UVisualImage::VisualImageSlate
protected

Underlying slate visual image.

See also
UVisualImage::RebuildWidget()

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