From 047d90d66bca22ca6020f15e0cc7cfe3bf172561 Mon Sep 17 00:00:00 2001 From: Steve Streeting Date: Mon, 25 Jul 2022 16:48:59 +0100 Subject: [PATCH] Default to using the lowest LOD for mesh vis --- .../StevesUEHelpers/Private/StevesEditorVisComponent.cpp | 2 +- Source/StevesUEHelpers/Public/StevesEditorVisComponent.h | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/StevesUEHelpers/Private/StevesEditorVisComponent.cpp b/Source/StevesUEHelpers/Private/StevesEditorVisComponent.cpp index b7db72f..167a162 100644 --- a/Source/StevesUEHelpers/Private/StevesEditorVisComponent.cpp +++ b/Source/StevesUEHelpers/Private/StevesEditorVisComponent.cpp @@ -111,7 +111,7 @@ FPrimitiveSceneProxy* UStevesEditorVisComponent::CreateSceneProxy() if (IsValid(Mesh.Mesh)) { const FTransform CombinedXForm = FTransform(Mesh.Rotation, Mesh.Location, Mesh.Scale) * XForm; - const FStaticMeshLODResources& Lod = Mesh.Mesh->GetLODForExport(0); + const FStaticMeshLODResources& Lod = Mesh.Mesh->GetLODForExport(Mesh.bUseLowestLOD ? Mesh.Mesh->GetNumLODs() - 1 : 0); TArray Vertices; TArray Indices; diff --git a/Source/StevesUEHelpers/Public/StevesEditorVisComponent.h b/Source/StevesUEHelpers/Public/StevesEditorVisComponent.h index 92430bb..9a64b5a 100644 --- a/Source/StevesUEHelpers/Public/StevesEditorVisComponent.h +++ b/Source/StevesUEHelpers/Public/StevesEditorVisComponent.h @@ -263,17 +263,22 @@ struct STEVESUEHELPERS_API FStevesEditorVisMesh /// The colour of the line render UPROPERTY(EditAnywhere, BlueprintReadWrite) FColor Colour; + /// Whether to use the lowest detail LOD for vis + UPROPERTY(EditAnywhere, BlueprintReadWrite) + bool bUseLowestLOD = true; FStevesEditorVisMesh(UStaticMesh* InMesh, const FVector& InLocation, const FVector& InScale, const FRotator& InRot, - const FColor& InColour) : + const FColor& InColour, + bool InUseLowestLOD = true) : Mesh(InMesh), Location(InLocation), Scale(InScale), Rotation(InRot), - Colour(InColour) + Colour(InColour), + bUseLowestLOD(InUseLowestLOD) { }