UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LandscapeSplinesComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
7#include "Misc/Guid.h"
8#include "LandscapeInfo.h"
11#include "LandscapeSplinesComponent.generated.h"
12
13class ALandscapeProxy;
18class UMeshComponent;
20class UStaticMesh;
21class UTexture2D;
23
24// structs for ForeignWorldSplineDataMap
25// these are editor-only, but we don't have the concept of an editor-only USTRUCT
26USTRUCT()
28{
30
31#if WITH_EDITORONLY_DATA
32 UPROPERTY()
34
35 UPROPERTY()
36 TObjectPtr<UControlPointMeshComponent> MeshComponent = nullptr;
37
38 UPROPERTY()
40
41 friend bool operator==(const FForeignControlPointData& LHS, const FForeignControlPointData& RHS)
42 {
43 return LHS.Identifier == RHS.Identifier;
44 }
45#endif
46};
47
48USTRUCT()
50{
52
53#if WITH_EDITORONLY_DATA
54 UPROPERTY()
56
57 UPROPERTY()
59
60 UPROPERTY()
62
63 friend bool operator==(const FForeignSplineSegmentData& LHS, const FForeignSplineSegmentData& RHS)
64 {
65 return LHS.Identifier == RHS.Identifier;
66 }
67#endif
68};
69
70USTRUCT()
96
98// ULandscapeSplinesComponent
100
101UCLASS(MinimalAPI)
102class ULandscapeSplinesComponent : public UPrimitiveComponent
103{
105
106#if WITH_EDITORONLY_DATA
108 UPROPERTY()
109 float SplineResolution;
110
112 UPROPERTY()
114
116 UPROPERTY()
118
120 UPROPERTY()
122
124 UPROPERTY(NonTransactional, Transient)
126#endif
127
128protected:
129 UPROPERTY(TextExportTransient)
131
132 UPROPERTY(TextExportTransient)
134
135#if WITH_EDITORONLY_DATA
136 // Serialized
137 UPROPERTY(TextExportTransient)
139
140 // Transient - rebuilt on load
143#endif
144
145 // References to components owned by landscape splines in other levels
146 // for cooked build (uncooked keeps references via ForeignWorldSplineDataMap)
147 UPROPERTY(TextExportTransient)
148 TArray<TObjectPtr<UMeshComponent>> CookedForeignMeshComponents;
149
150public:
152 UFUNCTION(BlueprintCallable, Category = LandscapeSplines)
153 TArray<USplineMeshComponent*> GetSplineMeshComponents();
154
156
157 // Run some ensures on the internal state of the data
158 LANDSCAPE_API void CheckSplinesValid();
159
160 bool ModifySplines(bool bAlwaysMarkDirty = true);
161
162 const TArray<TObjectPtr<ULandscapeSplineControlPoint>>& GetControlPoints() const { return ControlPoints; }
164
167
168#if WITH_EDITOR
170
171 bool HasAnyControlPointsOrSegments() const { return ControlPoints.Num() > 0 || Segments.Num() > 0; }
172
173 virtual void ShowSplineEditorMesh(bool bShow);
174
175 // Rebuilds all spline points and meshes for all spline control points and segments in this splines component
176 // @param bBuildCollision Building collision data is very slow, so during interactive changes pass false to improve user experience (make sure to call with true when done)
177 virtual void RebuildAllSplines(bool bBuildCollision = true);
178
179 // returns a suitable ULandscapeSplinesComponent to place streaming meshes into, given a location
180 // falls back to "this" if it can't find another suitable, so never returns nullptr
181 // @param bCreate whether to create a component if a suitable actor is found but it has no splines component yet
183
184 // returns the matching ULandscapeSplinesComponent for a given level, *can return null*
185 // @param bCreate whether to create a component if a suitable actor is found but it has no splines component yet
187
188 // gathers and returns all currently existing
190
200
203
206
208
210
212
213 bool IsUsingLayerInfo(const ULandscapeLayerInfoObject* LayerInfo) const;
214
215 // Iterates throug a copy of the ControlPoints list.
217
223 LANDSCAPE_API void CopyToSplineComponent(USplineComponent* SplineComponent);
224#endif
225
226 //~ Begin UObject Interface
227
228 virtual void Serialize(FArchive& Ar) override;
229 virtual void PostLoad() override;
230#if WITH_EDITOR
231 virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
232 virtual void PostEditUndo() override;
233#endif // WITH_EDITOR
234 //~ End UObject Interface
235
236 //~ Begin UActorComponent Interface
237#if WITH_EDITOR
238 virtual void CheckForErrors() override;
239#endif
240 virtual void OnRegister() override;
241 //~ End UActorComponent Interface
242
243 //~ Begin UPrimitiveComponent Interface.
244#if WITH_EDITOR
245 virtual FPrimitiveSceneProxy* CreateSceneProxy() override;
246#endif
247 virtual FBoxSphereBounds CalcBounds(const FTransform& LocalToWorld) const override;
248 //~ End UPrimitiveComponent Interface.
249
250 // many friends
251 friend class FLandscapeToolSplines;
252 friend class FLandscapeSplinesSceneProxy;
255 friend class ULandscapeInfo;
256};
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:1208
Definition PrimitiveSceneProxy.h:296
Definition ILandscapeSplineInterface.h:20
Definition Array.h:670
Definition AssetRegistryState.h:50
Definition UnrealString.h.inl:34
Definition ControlPointMeshComponent.h:12
Definition LandscapeInfo.h:109
Definition LandscapeLayerInfoObject.h:60
Definition LandscapeSplineControlPoint.h:51
Definition LandscapeSplineSegment.h:195
Definition LandscapeSplinesComponent.h:103
TArray< TObjectPtr< ULandscapeSplineSegment > > & GetSegments()
Definition LandscapeSplinesComponent.h:166
TArray< TObjectPtr< ULandscapeSplineControlPoint > > & GetControlPoints()
Definition LandscapeSplinesComponent.h:163
const TArray< TObjectPtr< ULandscapeSplineSegment > > & GetSegments() const
Definition LandscapeSplinesComponent.h:165
Definition Level.h:423
Definition MeshComponent.h:25
Definition Object.h:95
Definition StaticMesh.h:593
Definition Texture2D.h:26
Definition World.h:918
ENGINE_API FBox CalcBounds(const FVector &P0, const FVector &P1, const FVector &P2, const FVector &P3)
Definition BezierUtilities.cpp:26
Definition Color.h:486
Definition LandscapeSplinesComponent.h:28
Definition LandscapeSplinesComponent.h:50
Definition LandscapeSplinesComponent.h:72
Definition Guid.h:109
Definition UnrealType.h:6865
Definition LazyObjectPtr.h:230
Definition ObjectPtr.h:488
Definition BoxSphereBounds.h:25