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

Slate widget that displays sprite flipbooks. More...

#include <SVisualImage.h>

Inheritance diagram for SVisualImage:
SVisualImageBase< SVisualImage > SBackgroundVisualImage

Public Member Functions

 SLATE_BEGIN_ARGS (SVisualImage)
 
void Construct (const FArguments &Args)
 Constructor call for slate declarative syntax.
 
void UpdateSequence ()
 Resets SVisualImage::CurveSequence.
 
void SetAnimate (bool IsAnimated)
 Setter for SVisualImage::bAnimate.
 
void SetSpriteIndex (int32 Index)
 Setter for SVisualImage::SpriteIndex.
 
void SetFlipbook (UPaperFlipbook *InFlipbook)
 Setter for SVisualImage::Flipbook.
 
void SetFlipbook (TAttribute< const UPaperFlipbook * > InFlipbook)
 Attribute version.
 
void SetColorAndOpacity (const FLinearColor &InLinearColor)
 Setter for SVisualImage::ColorAndOpacity.
 
void SetColorAndOpacity (TAttribute< FSlateColor > InColorAttribute)
 Attribute version.
 
void SetColorAndOpacity (const FSlateColor &InSlateColor)
 Slate color version.
 
void SetDesiredScale (const FVector2D &InDesiredScale)
 Setter for SVisualImage::CustomDesiredScale.
 
void SetDesiredScale (TAttribute< TOptional< FVector2D > > InDesiredScale)
 Attribute version.
 
void SetDesiredScale (TOptional< FVector2D > InDesiredScale)
 TOptional version.
 
void SetMirrorScale (const FVector2D &InMirrorScale)
 Setter for SVisualImage::MirrorScale.
 
void SetMirrorScale (TAttribute< FVector2D > InMirrorScale)
 Attribute version.
 
void SetMirrorScale (const FScale2D &InMirrorScale)
 Scale 2D version.
 
UPaperSprite * GetCurrentSprite () const
 
virtual bool IsResourceValid () const
 Declared as virtual so subclasses can override them, but these methods are statically dispatched in the base class and all must be implemented.
 
virtual UObject * GetFinalResource () const
 
virtual const FVector2D GetImageSize () const
 
virtual const FLinearColor GetFinalColorAndOpacity (const FWidgetStyle &InWidgetStyle) const
 Applies SVisualImage::ColorAndOpacity to the final color of the flipbook.
 
virtual void PreSlateDrawElementExtension () const
 No extension.
 
virtual FGeometry MakeCustomGeometry (const FGeometry &AllotedGeometry) const
 Applies SVisualImage::MirrorScale to the brush geometry when it is valid.
 
virtual void PostSlateDrawElementExtension () const
 No extension.
 

Protected Member Functions

virtual FVector2D ComputeDesiredSize (float) const override
 Calculates desire size.
 
virtual bool ComputeVolatility () const override
 
FORCEINLINE FCurveSequence * GetCurveSequence ()
 
FORCEINLINE TSlateAttributeRef< const UPaperFlipbook * > GetFlipbook () const
 
FORCEINLINE TSlateAttributeRef< FSlateColor > GetColorAndOpacity () const
 
FORCEINLINE TSlateAttributeRef< TOptional< FVector2D > > GetDesiredScale () const
 
FORCEINLINE TSlateAttributeRef< FVector2D > GetMirrorScale () const
 
FORCEINLINE bool GetAnimate () const
 
FORCEINLINE int32 GetSpriteIndex () const
 
virtual void AddReferencedObjects (FReferenceCollector &Collector) override
 Provides references to members for Garbage Collector.
 
virtual FString GetReferencerName () const override
 
- Protected Member Functions inherited from SVisualImageBase< SVisualImage >
virtual FSlateBrush ConvertToBrush () const final
 Handles conversion of the render resource to the slate brush.
 
virtual int32 OnPaint (const FPaintArgs &Args, const FGeometry &AllottedGeometry, const FSlateRect &MyCullingRect, FSlateWindowElementList &OutDrawElements, int32 LayerId, const FWidgetStyle &InWidgetStyle, bool bParentEnabled) const override final
 Paints render resource as a brush after applying all modifiers.
 
bool IsResourceValid () const
 Used during resource-to-brush conversion to stop it early when resource is invalid.
 
UObject * GetFinalResource () const
 Resource to be displayed by the widget.
 
const FVector2D GetImageSize () const
 
const FLinearColor GetFinalColorAndOpacity (const FWidgetStyle &InWidgetStyle) const
 
void PreSlateDrawElementExtension () const
 Optional extension to the SVisualImageBase::OnPaint template.
 
FGeometry MakeCustomGeometry (const FGeometry &AllotedGeometry) const
 
void PostSlateDrawElementExtension () const
 Optional extension to the SVisualImageBase::OnPaint template.
 

Private Attributes

FCurveSequence CurveSequence
 Drives animation of the flipbook.
 
TSlateAttribute< const UPaperFlipbook * > Flipbook
 Resource that is rendered by this widget.
 
TSlateAttribute< FSlateColor > ColorAndOpacity
 Color and opacity of the flipbook.
 
TSlateAttribute< TOptional< FVector2D > > CustomDesiredScale
 Optional custom scale for the flipbook.
 
TSlateAttribute< FVector2D > MirrorScale
 Orientational scale of the flipbook.
 
bool bAnimate
 Animation state of the flipbook.
 
int32 SpriteIndex
 Index of specific sprite of the flipbook to display.
 

Detailed Description

Slate widget that displays sprite flipbooks.

See also
UVisualImage

Member Function Documentation

◆ AddReferencedObjects()

void SVisualImage::AddReferencedObjects ( FReferenceCollector & Collector)
overrideprotectedvirtual

Provides references to members for Garbage Collector.

Parameters
Collectorgathers references to members

Reimplemented in SBackgroundVisualImage.

◆ ComputeDesiredSize()

FVector2D SVisualImage::ComputeDesiredSize ( float ) const
overrideprotectedvirtual

Calculates desire size.

Considers size of the currently rendered sprite and SVisualImage::CustomDesiredScale.

Returns
computed desired size of this widget

◆ ComputeVolatility()

bool SVisualImage::ComputeVolatility ( ) const
overrideprotectedvirtual
Returns
true when this widget is volatile (slate-wise)

◆ Construct()

void SVisualImage::Construct ( const FArguments & Args)

Constructor call for slate declarative syntax.

Parameters
Argsslate arguments

◆ GetAnimate()

FORCEINLINE bool SVisualImage::GetAnimate ( ) const
inlineprotected

◆ GetColorAndOpacity()

FORCEINLINE TSlateAttributeRef< FSlateColor > SVisualImage::GetColorAndOpacity ( ) const
inlineprotected

◆ GetCurrentSprite()

UPaperSprite * SVisualImage::GetCurrentSprite ( ) const
Returns
sprite that is rendered at this time

◆ GetCurveSequence()

FORCEINLINE FCurveSequence * SVisualImage::GetCurveSequence ( )
inlineprotected

◆ GetDesiredScale()

FORCEINLINE TSlateAttributeRef< TOptional< FVector2D > > SVisualImage::GetDesiredScale ( ) const
inlineprotected

◆ GetFinalColorAndOpacity()

const FLinearColor SVisualImage::GetFinalColorAndOpacity ( const FWidgetStyle & InWidgetStyle) const
virtual

Applies SVisualImage::ColorAndOpacity to the final color of the flipbook.

See also
SVisualImageBase::GetFinalColorAndOpacity()
Parameters
InWidgetStylebase widget style
Returns
modified color and opacity

◆ GetFinalResource()

UObject * SVisualImage::GetFinalResource ( ) const
virtual
See also
SVisualImageBase::GetFinalResource()
Returns
valid flipbook

Reimplemented in SBackgroundVisualImage.

◆ GetFlipbook()

FORCEINLINE TSlateAttributeRef< const UPaperFlipbook * > SVisualImage::GetFlipbook ( ) const
inlineprotected

◆ GetImageSize()

const FVector2D SVisualImage::GetImageSize ( ) const
virtual
See also
SVisualImageBase::GetImageSize()
Returns
slate size of the flipbook

◆ GetMirrorScale()

FORCEINLINE TSlateAttributeRef< FVector2D > SVisualImage::GetMirrorScale ( ) const
inlineprotected

◆ GetReferencerName()

FString SVisualImage::GetReferencerName ( ) const
overrideprotectedvirtual
Returns
Name of the owner of references

Reimplemented in SBackgroundVisualImage.

◆ GetSpriteIndex()

FORCEINLINE int32 SVisualImage::GetSpriteIndex ( ) const
inlineprotected

◆ IsResourceValid()

bool SVisualImage::IsResourceValid ( ) const
virtual

Declared as virtual so subclasses can override them, but these methods are statically dispatched in the base class and all must be implemented.

See also
SVisualImageBase::IsResourceValid()
Returns
true when flipbook is valid

◆ MakeCustomGeometry()

FGeometry SVisualImage::MakeCustomGeometry ( const FGeometry & AllotedGeometry) const
virtual

Applies SVisualImage::MirrorScale to the brush geometry when it is valid.

See also
SVisualImageBase::MakeCustomGeometry()
Parameters
AllotedGeometrybase geometry for this widget
Returns
modified or untouched AllotedGeometry for flipbook

◆ PostSlateDrawElementExtension()

void SVisualImage::PostSlateDrawElementExtension ( ) const
virtual

◆ PreSlateDrawElementExtension()

void SVisualImage::PreSlateDrawElementExtension ( ) const
virtual

◆ SetAnimate()

void SVisualImage::SetAnimate ( bool IsAnimated)

Setter for SVisualImage::bAnimate.

Parameters
IsAnimatedtrue to animate flipbook

◆ SetColorAndOpacity() [1/3]

void SVisualImage::SetColorAndOpacity ( const FLinearColor & InLinearColor)

Setter for SVisualImage::ColorAndOpacity.

Parameters
InLinearColornew color and opacity of the flipbook

◆ SetColorAndOpacity() [2/3]

void SVisualImage::SetColorAndOpacity ( const FSlateColor & InSlateColor)

Slate color version.

See also
SVisualImage::SetColorAndOpacity(FLinearColor)
Parameters
InSlateColorslate color and opacity

◆ SetColorAndOpacity() [3/3]

void SVisualImage::SetColorAndOpacity ( TAttribute< FSlateColor > InColorAttribute)

Attribute version.

See also
SVisualImage::SetColorAndOpacity(FLinearColor)
Parameters
InColorAttributenew color and opacity attribute

◆ SetDesiredScale() [1/3]

void SVisualImage::SetDesiredScale ( const FVector2D & InDesiredScale)

Setter for SVisualImage::CustomDesiredScale.

Parameters
InDesiredScalenew desired scale of the flipbook

◆ SetDesiredScale() [2/3]

void SVisualImage::SetDesiredScale ( TAttribute< TOptional< FVector2D > > InDesiredScale)

Attribute version.

See also
SVisualImage::SetDesiredScale(const FVector2D&)
Parameters
InDesiredScalenew desired scale attribute

◆ SetDesiredScale() [3/3]

void SVisualImage::SetDesiredScale ( TOptional< FVector2D > InDesiredScale)

TOptional version.

See also
SVisualImage::SetDesiredScale(const FVector2D&)
Parameters
InDesiredScalenew optional desired scale

◆ SetFlipbook() [1/2]

void SVisualImage::SetFlipbook ( TAttribute< const UPaperFlipbook * > InFlipbook)

Attribute version.

See also
SVisualImage::Flipbook(UPaperFlipbook*)
Parameters
InFlipbooknew paper flipbook attribute

◆ SetFlipbook() [2/2]

void SVisualImage::SetFlipbook ( UPaperFlipbook * InFlipbook)

Setter for SVisualImage::Flipbook.

Parameters
InFlipbooknew render resource for this slate widget

◆ SetMirrorScale() [1/3]

void SVisualImage::SetMirrorScale ( const FScale2D & InMirrorScale)

Scale 2D version.

See also
SVisualImage::SetMirrorScale(const FVector2D&)
Parameters
InMirrorScalenew mirror scale 2D

◆ SetMirrorScale() [2/3]

void SVisualImage::SetMirrorScale ( const FVector2D & InMirrorScale)

Setter for SVisualImage::MirrorScale.

Parameters
InMirrorScalenew mirror scale of the flipbook

◆ SetMirrorScale() [3/3]

void SVisualImage::SetMirrorScale ( TAttribute< FVector2D > InMirrorScale)

Attribute version.

See also
SVisualImage::SetMirrorScale(const FVector2D&)
Parameters
InMirrorScalenew mirror scale attribute

◆ SetSpriteIndex()

void SVisualImage::SetSpriteIndex ( int32 Index)

Setter for SVisualImage::SpriteIndex.

Parameters
Indexnew sprite index

Member Data Documentation

◆ bAnimate

bool SVisualImage::bAnimate
private

Animation state of the flipbook.

When true, SVisualImage::SpriteIndex has no effect.

◆ ColorAndOpacity

TSlateAttribute<FSlateColor> SVisualImage::ColorAndOpacity
private

Color and opacity of the flipbook.

Does not override all other color and opacity modifiers.

◆ MirrorScale

TSlateAttribute<FVector2D> SVisualImage::MirrorScale
private

Orientational scale of the flipbook.

Can be mirrored along both X and Y axes.

Note
zero values are invalid.

◆ SpriteIndex

int32 SVisualImage::SpriteIndex
private

Index of specific sprite of the flipbook to display.

Must be within bounds of flipbook frames.

Note
has no effect when SVisualImage::bAnimate is true

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