VertexPreviewSize

VertexPreviewSize

#Overview

name: VertexPreviewSize

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of VertexPreviewSize is to control the size of vertex points displayed when mesh painting is active in Unreal Engine 5. This setting is primarily used for visualization purposes in the mesh painting and cloth painting systems.

VertexPreviewSize is utilized by the following Unreal Engine subsystems and modules:

  1. MeshPaintingToolset plugin
  2. ClothPainter module
  3. MeshPaint module

The value of this variable is set in different ways:

  1. In the UMeshVertexPaintingToolProperties class, it’s initialized with a default value of 6.0f.
  2. It can be configured through the UMeshPaintSettings class, which is marked with the UPROPERTY(config) macro, indicating that it can be saved in configuration files.

This variable interacts with other painting-related variables and functions, such as brush settings, paint rays, and rendering functions for painting tools.

Developers should be aware of the following when using this variable:

  1. It affects the visual representation of vertex points during mesh painting, which can impact the user experience and precision of painting operations.
  2. The value is used across different painting tools and modules, so changing it may have a wide-ranging effect on the painting interface.

Best practices when using this variable include:

  1. Provide a way for users to adjust this value in the editor UI, allowing them to customize the vertex preview size to their preferences.
  2. Consider scaling this value based on the viewport zoom level or the size of the mesh being painted to maintain a consistent visual representation.
  3. Use this variable consistently across all mesh painting tools to ensure a uniform experience.
  4. When implementing custom painting tools, refer to this variable for consistency with built-in Unreal Engine painting tools.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:956, section: [/Script/MeshPaint.MeshPaintSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/MeshPainting/Source/MeshPaintingToolset/Private/MeshVertexPaintingTool.cpp:50

Scope (from outer to inner):

file
function     UMeshVertexPaintingToolProperties::UMeshVertexPaintingToolProperties

Source code excerpt:

	EraseColor(FLinearColor::Black),
	bEnableFlow(false),
	VertexPreviewSize(6.0f)
{
}

UMeshVertexPaintingTool::UMeshVertexPaintingTool()
{
	PropertyClass = UMeshVertexPaintingToolProperties::StaticClass();

#Loc: <Workspace>/Engine/Plugins/MeshPainting/Source/MeshPaintingToolset/Private/MeshVertexPaintingTool.cpp:113

Scope (from outer to inner):

file
function     void UMeshVertexPaintingTool::Render

Source code excerpt:

		const FLinearColor BrushCueColor = (bArePainting ? FLinearColor(1.0f, 1.0f, 0.3f) : FLinearColor(0.3f, 1.0f, 0.3f));
 		const FLinearColor InnerBrushCueColor = (bArePainting ? FLinearColor(0.5f, 0.5f, 0.1f) : FLinearColor(0.1f, 0.5f, 0.1f));
		const float PointDrawSize = VertexProperties->VertexPreviewSize;
		// Draw trace surface normal
		const FVector NormalLineEnd(LastBestHitResult.Location + LastBestHitResult.Normal * NormalLineSize);
		Draw.DrawLine(FVector(LastBestHitResult.Location), NormalLineEnd, NormalLineColor, WidgetLineThickness);

		for (UMeshComponent* CurrentComponent : MeshPaintingSubsystem->GetPaintableMeshComponents())
		{

#Loc: <Workspace>/Engine/Plugins/MeshPainting/Source/MeshPaintingToolset/Public/MeshVertexPaintingTool.h:99

Scope (from outer to inner):

file
class        class UMeshVertexPaintingToolProperties : public UBrushBaseProperties

Source code excerpt:

	/** Size of vertex points drawn when mesh painting is active. */
	UPROPERTY(EditAnywhere, Category = "VertexPainting|Visualization")
	float VertexPreviewSize;
};


UCLASS()
class MESHPAINTINGTOOLSET_API UMeshColorPaintingToolProperties : public UMeshVertexPaintingToolProperties
{

#Loc: <Workspace>/Engine/Source/Editor/ClothPainter/Private/ClothPaintTools.cpp:172

Scope (from outer to inner):

file
function     void FClothPaintTool_Gradient::Render

Source code excerpt:

	}

	const float VertexPointSize = GetDefault<UMeshPaintSettings>()->VertexPreviewSize;
	const UClothPainterSettings* PaintSettings = CastChecked<UClothPainterSettings>(SharedPainter->GetPainterSettings());
	const UPaintBrushSettings* BrushSettings = SharedPainter->GetBrushSettings();

	TArray<MeshPaintHelpers::FPaintRay> PaintRays;
	MeshPaintHelpers::RetrieveViewportPaintRays(View, Viewport, PDI, PaintRays);
	

#Loc: <Workspace>/Engine/Source/Editor/ClothPainter/Private/ClothPaintTools.cpp:671

Scope (from outer to inner):

file
function     void FClothPaintTool_Fill::Render

Source code excerpt:

	}

	const float VertexPointSize = GetDefault<UMeshPaintSettings>()->VertexPreviewSize;
	const UClothPainterSettings* PaintSettings = CastChecked<UClothPainterSettings>(SharedPainter->GetPainterSettings());
	const UPaintBrushSettings* BrushSettings = SharedPainter->GetBrushSettings();

	TArray<MeshPaintHelpers::FPaintRay> PaintRays;
	MeshPaintHelpers::RetrieveViewportPaintRays(View, Viewport, PDI, PaintRays);

#Loc: <Workspace>/Engine/Source/Editor/MeshPaint/Private/IMeshPainter.cpp:184

Scope (from outer to inner):

file
function     void IMeshPainter::RenderInteractorWidget

Source code excerpt:

		const FLinearColor BrushCueColor = (bArePainting ? FLinearColor(1.0f, 1.0f, 0.3f) : FLinearColor(0.3f, 1.0f, 0.3f));
		const FLinearColor InnerBrushCueColor = (bArePainting ? FLinearColor(0.5f, 0.5f, 0.1f) : FLinearColor(0.1f, 0.5f, 0.1f));
		const float PointDrawSize = GetDefault<UMeshPaintSettings>()->VertexPreviewSize;

		FVector BrushXAxis, BrushYAxis;
		HitResult.Normal.FindBestAxisVectors(BrushXAxis, BrushYAxis);
		const FVector BrushVisualPosition = HitResult.Location + HitResult.Normal * VisualBiasDistance;

		

#Loc: <Workspace>/Engine/Source/Editor/MeshPaint/Public/MeshPaintSettings.h:88

Scope (from outer to inner):

file
class        class UMeshPaintSettings : public UObject

Source code excerpt:

	/** Size of vertex points drawn when mesh painting is active. */
	UPROPERTY(config, EditAnywhere, Category=Visualization)
	float VertexPreviewSize;

};