Navigation
API > API/Plugins > API/Plugins/Paper2D
Sprite Asset
Stores the data necessary to render a single 2D sprite (from a region of a texture) Can also contain collision shapes for the sprite.
| Name | UPaperSprite |
| Type | class |
| Header File | /Engine/Plugins/2D/Paper2D/Source/Paper2D/Classes/PaperSprite.h |
| Include Path | #include "PaperSprite.h" |
Syntax
UCLASS (MinimalAPI, BlueprintType, Meta=(DisplayThumbnail="true"))
class UPaperSprite :
public UObject ,
public IInterface_CollisionDataProvider ,
public ISlateTextureAtlasInterface
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UPaperSprite
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UPaperSprite
(
const FObjectInitializer& ObjectInitializer |
PaperSprite.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| AlternateMaterialSplitIndex | int32 | The point at which the alternate material takes over in the baked render data (or INDEX_NONE) | PaperSprite.h | |
| BakedRenderData | TArray< FVector4 > | Baked render data (triangle vertices, stored as XY UV tuples) XY is the XZ position in world space, relative to the pivot UV is normalized (0..1) There should always be a multiple of three elements in this array | PaperSprite.h | |
| BodySetup | TObjectPtr< class UBodySetup > | Baked physics data. | PaperSprite.h |
|
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void BuildGeometryFromContours
(
FSpriteGeometryCollection& GeomOwner |
PaperSprite.h | ||
virtual bool ContainsPhysicsTriMeshData
(
bool InUseAllTriData |
PaperSprite.h | ||
FVector2D ConvertPivotSpaceToTextureSpace
(
FVector2D Input |
PaperSprite.h | ||
FVector ConvertPivotSpaceToTextureSpace
(
FVector Input |
PaperSprite.h | ||
FVector2D ConvertTextureSpaceToPivotSpace
(
FVector2D Input |
PaperSprite.h | ||
FVector ConvertTextureSpaceToPivotSpace
(
FVector Input |
PaperSprite.h | ||
FVector ConvertTextureSpaceToWorldSpace
(
const FVector2D& SourcePoint |
World space WRT the sprite editor only | PaperSprite.h | |
FVector2D ConvertWorldSpaceDeltaToTextureSpace
(
const FVector& WorldDelta, |
PaperSprite.h | ||
FVector2D ConvertWorldSpaceToTextureSpace
(
const FVector& WorldPoint |
PaperSprite.h | ||
void CreatePolygonFromBoundingBox
(
FSpriteGeometryCollection& GeomOwner, |
PaperSprite.h | ||
void ExtractSourceRegionFromTexturePoint
(
const FVector2D& Point |
PaperSprite.h | ||
FPaperSpriteSocket * FindSocket
(
FName SocketName |
Search for a socket (note: do not cache this pointer; it's unsafe if the Socket array is edited) | PaperSprite.h | |
void FindTextureBoundingBox
(
float AlphaThreshold, |
Evaluates the SourceUV/SourceDimensons rectangle, finding the tightest bounds that still include all pixels with alpha above AlphaThreshold. | PaperSprite.h | |
UMaterialInterface * GetAlternateMaterial() |
Return the alternate material for this sprite. | PaperSprite.h | |
const UPaperSpriteAtlas * GetAtlasGroup() |
PaperSprite.h | ||
void GetBakedAdditionalSourceTextures
(
FAdditionalSpriteTextureArray& OutTextureList |
Returns the list of additional source textures this should be rendered with. | PaperSprite.h | |
UTexture2D * GetBakedTexture() |
Returns the texture this should be rendered with. | PaperSprite.h | |
float GetCollisionThickness() |
Returns the extrusion thickness of collision geometry when using a 3D collision domain. | PaperSprite.h | |
UMaterialInterface * GetDefaultMaterial() |
Return the default material for this sprite. | PaperSprite.h | |
UMaterialInterface * GetMaterial
(
int32 MaterialIndex |
Returns either the default material (index 0) or alternate material (index 1) | PaperSprite.h | |
int32 GetNumMaterials() |
Returns the number of materials (1 or 2, depending on if there is alternate geometry) | PaperSprite.h | |
FVector2D GetOriginInSourceImageBeforeTrimming() |
Returns the Origin within SourceImage, prior to atlasing. | PaperSprite.h | |
virtual bool GetPhysicsTriMeshData
(
FTriMeshCollisionData* CollisionData, |
PaperSprite.h | ||
ESpritePivotMode::Type GetPivotMode
(
FVector2D& OutCustomTextureSpacePivot |
PaperSprite.h | ||
FVector2D GetPivotPosition() |
Returns the current pivot position in texture space. | PaperSprite.h | |
FTransform GetPivotToWorld() |
PaperSprite.h | ||
float GetPixelsPerUnrealUnit() |
Return the scaling factor between pixels and Unreal units (cm) | PaperSprite.h | |
FVector2D GetRawPivotPosition() |
Returns the raw pivot position (ignoring pixel snapping) | PaperSprite.h | |
FBoxSphereBounds GetRenderBounds() |
Returns the render bounds of this sprite. | PaperSprite.h | |
FVector2D GetSourceImageDimensionBeforeTrimming() |
Returns the Dimensions of SourceImage prior to trimming. | PaperSprite.h | |
FVector2D GetSourceSize() |
PaperSprite.h | ||
UTexture2D * GetSourceTexture() |
PaperSprite.h | ||
FVector2D GetSourceUV() |
PaperSprite.h | ||
ESpriteCollisionMode::Type GetSpriteCollisionDomain() |
Returns the collision domain (no collision, 2D, or 3D) | PaperSprite.h | |
float GetUnrealUnitsPerPixel() |
Return the scaling factor between Unreal units (cm) and pixels. | PaperSprite.h | |
bool HasAnySockets() |
Returns true if the sprite has any sockets. | PaperSprite.h | |
void InitializeSprite
(
const FSpriteAssetInitParameters& InitParams, |
Reinitializes this sprite (NOTE: Does not register existing components in the world) | PaperSprite.h | |
bool IsRotatedInSourceImage() |
This texture is rotated in the atlas. | PaperSprite.h | |
bool IsTrimmedInSourceImage() |
Returns true if this sprite is trimmed from the original texture, meaning that the source image dimensions and origin in the source image may not be the same as the final results for the sprite (empty alpha=0 pixels were trimmed from the exterior region) | PaperSprite.h | |
bool NeedRescaleSpriteData() |
PaperSprite.h | ||
void OnObjectReimported
(
UTexture2D* InObject |
Called when an object is re-imported in the editor. | PaperSprite.h | |
void QuerySupportedSockets
(
TArray< FComponentSocketDescription >& OutSockets |
Returns a list of all of the sockets. | PaperSprite.h | |
void RebuildCollisionData() |
PaperSprite.h | ||
void RebuildData() |
This is a generic "rebuild all" function that calls RebuildCollisionData() and then RebuildRenderData(). | PaperSprite.h | |
void RebuildRenderData() |
PaperSprite.h | ||
void RemoveSocket
(
FName SocketName |
Removes the specified socket. | PaperSprite.h | |
void RescaleSpriteData
(
UTexture2D* Texture |
Rescale properties to handle source texture size change. | PaperSprite.h | |
void SetPivotMode
(
ESpritePivotMode::Type PivotMode, |
PaperSprite.h | ||
void SetRotated
(
bool bRotated, |
PaperSprite.h | ||
void SetTrim
(
bool bTrimmed, |
PaperSprite.h | ||
void ValidateSocketNames() |
Make sure all socket names are valid All duplicate / empty names will be made unique | PaperSprite.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void GetAssetRegistryTags
(
FAssetRegistryTagsContext Context |
PaperSprite.h | ||
virtual void GetAssetRegistryTags
(
TArray< FAssetRegistryTag >& OutTags |
PaperSprite.h | ||
virtual void PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
PaperSprite.h | ||
virtual void PostLoad() |
PaperSprite.h | ||
virtual void Serialize
(
FArchive& Ar |
PaperSprite.h |
Overridden from ISlateTextureAtlasInterface
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FSlateAtlasData GetSlateAtlasData() |
PaperSprite.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void RefreshBakedData() |
PaperSprite.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static void ExtractRectsFromTexture
(
UTexture2D* Texture, |
PaperSprite.h | ||
static void FindContours
(
const FIntPoint& ScanPos, |
PaperSprite.h | ||
static FName GetSourceTextureMemberName() |
PaperSprite.h |