UMeshPaintingSubsystem

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

MeshPaintingToolset

Header

/Engine/Plugins/MeshPainting/Source/MeshPaintingToolset/Public/MeshPaintHelpers.h

Include

#include "MeshPaintHelpers.h"

Syntax

UCLASS()
class UMeshPaintingSubsystem : public UEngineSubsystem

Variables

Name Description

Public variable

bool

 

bNeedsRecache

Protected variable

bool

 

bSelectionHasMaterialValidForTexturePaint

Constructors

Name Description

Public function

UMeshPaintingSubsystem()

Functions

Name Description

Public function

void

 

AddPaintableMeshComponent

(
    UMeshComponent* InComponent
)

Public function

void

 

AddSelectedMeshComponents

(
    const TArray< UMeshComponent* ...
)

Public function

void

 

AddToComponentToAdapterMap

(
    const UMeshComponent* InCompon...,
    const TSharedPtr< IMeshPaintCompone...
)

Public function

void

 

ApplyBrushToVertex

(
    const FVector& VertexPosition,
    const FMatrix& InverseBrushMatrix,
    const float BrushRadius,
    const float BrushFalloffAmount,
    const float BrushStrength,
    const T& PaintValue,
    T& InOutValue
)

Public function

void

 

ApplyFillWithMask

(
    FColor& InOutColor,
    const FColor& MaskColor,
    const FColor& FillColor
)

Public function

bool

 

ApplyPerTrianglePaintAction

(
    IMeshPaintComponentAdapter* Ad...,
    const FVector& CameraPosition,
    const FVector& HitPosition,
    const UBrushBaseProperties* Se...,
    FPerTrianglePaintAction Action,
    bool bOnlyFrontFacingTriangles
)

Given the adapter, settings and view-information retrieves influences triangles and applies Action to them

Public function

bool

 

ApplyPerVertexPaintAction

(
    FPerVertexPaintActionArgs& InArgs,
    FPerVertexPaintAction Action
)

Given arguments for an action, and an action - retrieves influences vertices and applies Action to them

Public function

void

 

ApplyVertexColorPaint

(
    const FMeshPaintParameters& InPara...,
    const FLinearColor& OldColor,
    FLinearColor& NewColor,
    const float PaintAmount
)

Applies Vertex Color Painting according to the given parameters

Public function

void

 

ApplyVertexColorsToAllLODs

(
    IMeshPaintComponentAdapter& Geomet...,
    USkeletalMeshComponent* Skelet...
)

Applies the vertex colors found in LOD level 0 to all contained LOD levels in the SkeletalMeshComponent

Public function

void

 

ApplyVertexColorsToAllLODs

(
    IMeshPaintComponentAdapter& Geomet...,
    UStaticMeshComponent* StaticMe...
)

Applies the vertex colors found in LOD level 0 to all contained LOD levels in the StaticMeshComponent

Public function

void

 

ApplyVertexColorsToAllLODs

(
    IMeshPaintComponentAdapter& Geomet...,
    UMeshComponent* InMeshComponen...
)

Applies vertex color painting found on LOD 0 to all lower LODs.

Public function

void

 

ApplyVertexWeightPaint

(
    const FMeshPaintParameters& InPara...,
    const FLinearColor& OldColor,
    FLinearColor& NewColor,
    const float PaintAmount
)

Applies Vertex Blend Weight Painting according to the given parameters

Public function

void

 

CacheSelectionData

(
    const int32 PaintLODIndex,
    const int32 UVChannel
)

Public function

void

 

ClearMeshTextureOverrides

(
    const IMeshPaintComponentAdapter& ...,
    UMeshComponent* InMeshComponen...
)

Clears all texture overrides for this component.

Public function

void

 

ClearPaintableMeshComponents()

Public function

void

 

ClearSelectedMeshComponents()

Public function

void

 

ClearSelectionLODColors()

Public function

float

 

ComputePaintMultiplier

(
    float SquaredDistanceToVertex2D,
    float BrushStrength,
    float BrushInnerRadius,
    float BrushRadialFalloff,
    float BrushInnerDepth,
    float BrushDepthFallof,
    float VertexDepthToBrush
)

Computes the Paint power multiplier value

Public function

bool

 

DoesMeshComponentContainPerLODColors

(
    const UMeshComponent* MeshComp...
)

Checks whether or not the mesh components contains per lod colors (for all LODs)

Public function

void

 

FillSkeletalMeshVertexColors

(
    USkeletalMeshComponent* MeshCo...,
    int32 LODIndex,
    const FColor FillColor,
    const FColor MaskColor
)

Public function

void

 

FillStaticMeshVertexColors

(
    UStaticMeshComponent* MeshComp...,
    int32 LODIndex,
    const FColor FillColor,
    const FColor MaskColor
)

Fills all vertex colors for all LODs found in the given mesh component with Fill Color

Public function

bool

 

FindHitResult

(
    const FRay Ray,
    FHitResult& BestTraceResult
)

Public function

void

 

ForceRenderMeshLOD

(
    UMeshComponent* Component,
    int32 LODIndex
)

Forces the component to render LOD level at LODIndex instead of the view-based LOD level ( X = 0 means do not force the LOD, X > 0 means force the lod to X - 1 )

Public function

FLinearColor

 

GenerateColorForTextureWeight

(
    const int32 NumWeights,
    const int32 WeightIndex
)

Generate texture weight color for given number of weights and the to-paint index

Public function Const

TSharedPtr< ...

 

GetAdapterForComponent

(
    const UMeshComponent* InCompon...
)

Map of geometry adapters for each selected mesh component

Public function

TArray< FCol...

 

GetColorDataForLOD

(
    const UStaticMesh* StaticMesh,
    int32 LODIndex
)

Retrieves the vertex colors from the given LOD level in the Mesh

Public function Const

TArray< FPer...

 

GetCopiedColorsByComponent()

Public function

TArray< FCol...

 

GetInstanceColorDataForLOD

(
    const UStaticMeshComponent* Me...,
    int32 LODIndex
)

Retrieves the per-instance vertex colors from the given LOD level in the StaticMeshComponent

Public function

void

 

GetInstanceColorDataInfo

(
    const UStaticMeshComponent* St...,
    int32 LODIndex,
    int32& OutTotalInstanceVertexColor...
)

Retrieves the number of bytes used to store the per-instance LOD vertex color data from the mesh component

Public function Const

int32

 

GetMaxUVIndexToPaint()

Public function

int32

 

GetNumberOfLODs

(
    const UMeshComponent* MeshComp...
)

Returns the number of Mesh LODs for the given MeshComponent

Public function

int32

 

GetNumberOfUVs

(
    const UMeshComponent* MeshComp...,
    int32 LODIndex
)

Returns the number of Texture Coordinates for the given MeshComponent

Public function Const

TArray< UMes...

 

GetPaintableMeshComponents()

Public function

bool

 

GetPerVertexPaintInfluencedVertices

(
    FPerVertexPaintActionArgs& InArgs,
    TSet< int32 >& InfluencedVertices
)

Public function Const

TArray< UMes...

 

GetSelectedMeshComponents()

Public function

uint32

 

GetVertexColorBufferSize

(
    UMeshComponent* MeshComponent,
    int32 LODIndex,
    bool bInstance
)

Retrieves the Vertex Color buffer size for the given LOD level in the Mesh

Public function

TArray< FVec...

 

GetVerticesForLOD

(
    const UStaticMesh* StaticMesh,
    int32 LODIndex
)

Retrieves the vertex positions from the given LOD level in the Mesh

Public function

bool

 

HasPaintableMesh

(
    UActorComponent* Component
)

Public function

bool

 

IsPointInfluencedByBrush

(
    const FVector& InPosition,
    const FMeshPaintParameters& InPara...,
    float& OutSquaredDistanceToVertex2...,
    float& OutVertexDepthToBrush
)

Checks whether or not a point is influenced by the painting brush according to the given parameters

Public function

bool

 

IsPointInfluencedByBrush

(
    const FVector2D& BrushSpacePositio...,
    const float BrushRadiusSquared,
    float& OutInRangeValue
)

Public function

bool

 

PaintVertex

(
    const FVector& InVertexPosition,
    const FMeshPaintParameters& InPara...,
    FColor& InOutVertexColor
)

Applies vertex painting to InOutvertexColor according to the given parameters

Public function

FColor

 

PickVertexColorFromTextureData

(
    const uint8* MipData,
    const FVector2D& UVCoordinate,
    const UTexture2D* Texture,
    const FColor ColorMask
)

Helper function to retrieve vertex color from a UTexture given a UVCoordinate

Public function

bool

 

PropagateColorsToRawMesh

(
    UStaticMesh* StaticMesh,
    int32 LODIndex,
    FStaticMeshComponentLODInfo& Compo...
)

Propagates per-instance vertex colors to the underlying Mesh for the given LOD Index

Public function

void

 

Refresh()

Public function

void

 

RemoveComponentInstanceVertexColors

(
    UStaticMeshComponent* StaticMe...
)

Removes vertex colors associated with the mesh component

Public function

void

 

RemoveInstanceVertexColors

(
    UObject* Obj
)

Removes vertex colors associated with the object

Public function

void

 

ResetState()

Public function Const

bool

 

SelectionContainsPerLODColors()

Public function Const

bool

 

SelectionContainsValidAdapters()

Public function

bool

 

SelectionHasMaterialValidForTexturePaint()

Public function

void

 

SetColorDataForLOD

(
    USkeletalMesh* SkeletalMesh,
    int32 LODIndex,
    const FColor FillColor,
    const FColor MaskColor
)

Sets all vertex colors for a specific LOD level in the SkeletalMesh to FillColor

Public function

void

 

SetCopiedColorsByComponent

Public function

void

 

SetInstanceColorDataForLOD

(
    UStaticMeshComponent* MeshComp...,
    int32 LODIndex,
    const TArray< FColor >& Colors
)

Sets the specific (LOD Index) per-instance vertex colors for the given StaticMeshComponent to the supplied Color array

Public function

void

 

SetInstanceColorDataForLOD

(
    UStaticMeshComponent* MeshComp...,
    int32 LODIndex,
    const FColor FillColor,
    const FColor MaskColor
)

Sets the specific (LOD Index) per-instance vertex colors for the given StaticMeshComponent to a single Color value

Public function

void

 

SetSelectionHasMaterialValidForTexturePaint

(
    const bool InValidity
)

Public function

bool

 

TryGetNumberOfLODs

(
    const UMeshComponent* MeshComp...,
    int32& OutNumLODs
)

OutNumLODs is set to number of Mesh LODs for the given MeshComponent and returns true, or returns false of given mesh component has no valid LODs