UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SkinnedAssetCommon.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
9#include "BoneContainer.h"
10#include "Components.h"
11#include "CoreMinimal.h"
12#include "Engine/EngineTypes.h"
16
17#include "SkinnedAssetCommon.generated.h"
18
19
21class UAnimSequence;
23struct FSkelMeshSection;
25
26
27//This is the total cloth time split up among multiple computation (updating gpu, updating sim, etc...)
30
31UENUM()
33{
34 // Auto will defer to child or global behavior based on context
35 Auto = 0,
36
37 // Mesh will not use the skin cache. However, if Support Ray Tracing is enabled on the mesh, the skin cache will still be used for Ray Tracing updates
38 Disabled = uint8(-1),
39
40 // Mesh will use the skin cache
41 Enabled = 1,
42};
43
44UENUM()
46{
47 // All skeletal meshes are excluded from the skin cache. Each must opt in individually. If Support Ray Tracing is enabled on a mesh, will force inclusive behavior on that mesh
48 Exclusive = 0,
49
50 // All skeletal meshes are included into the skin cache. Each must opt out individually
51 Inclusive = 1,
52};
53
54USTRUCT()
56{
58
59
60 UPROPERTY(EditAnywhere, Category = SectionReference)
61 int32 SectionIndex;
62
64 : SectionIndex(INDEX_NONE)
65 {
66 }
67
69 : SectionIndex(InSectionIndex)
70 {
71 }
72
74 {
75 return SectionIndex == Other.SectionIndex;
76 }
77
78#if WITH_EDITOR
80 ENGINE_API bool IsValidToEvaluate(const FSkeletalMeshLODModel& LodModel) const;
81
84#endif
85
87 {
88 Ar << SectionIndex;
89 return true;
90 }
91
93 {
94 B.Serialize(Ar);
95 return Ar;
96 }
97};
98
99USTRUCT()
101{
103
104
105 static FString GeneratedByEnginePrefix;
106
107 ENGINE_API const FString& GetSourceFilename() const;
108
109 ENGINE_API void SetSourceFilename(const FString& Filename);
110
111 ENGINE_API bool IsGeneratedByEngine() const;
112
113 ENGINE_API void SetGeneratedByEngine(bool bInGeneratedByEngine);
114
115private:
116 UPROPERTY(EditAnywhere, Category = MorphTargetInfo)
117 FString SourceFilename;
118
119
120 UPROPERTY()
121 FGuid DerivedDataHash;
122
124};
125
127USTRUCT()
129{
131
132
137 UPROPERTY(EditAnywhere, Category=SkeletalMeshLODInfo)
139
141 UPROPERTY(EditAnywhere, Category=SkeletalMeshLODInfo, meta=(DisplayName="LOD Hysteresis"))
143
148 UPROPERTY()
149 TArray<int32> LODMaterialMap;
150
151#if WITH_EDITORONLY_DATA
153 UPROPERTY()
155
157 UPROPERTY()
159#endif
160
162 UPROPERTY(EditAnywhere, Category = BuildSettings)
164
166 UPROPERTY(EditAnywhere, Category = ReductionSettings)
168
170 UPROPERTY(EditAnywhere, Category = ReductionSettings)
171 TArray<FBoneReference> BonesToRemove;
172
174 UPROPERTY(EditAnywhere, Category = ReductionSettings)
176
178 UPROPERTY(EditAnywhere, Category = ReductionSettings)
180
182 UPROPERTY(EditAnywhere, Category = ReductionSettings, meta = (UIMin = "0.0", ClampMin = "0.0"))
184
186 UPROPERTY(EditAnywhere, Category = ReductionSettings)
188
190 UPROPERTY(EditAnywhere, Category = ReductionSettings)
191 TObjectPtr<UAnimSequence> BakePoseOverride;
192
193#if WITH_EDITORONLY_DATA
195 UPROPERTY(VisibleAnywhere, Category= SkeletalMeshLODInfo, AdvancedDisplay)
196 FString SourceImportFilename;
197#endif
198
202 UPROPERTY(EditAnywhere, Category = SkeletalMeshLODInfo)
204
206 UPROPERTY(EditAnywhere, Category = SkeletalMeshLODInfo, meta = (UIMin = "0.01", ClampMin = "0.01", UIMax = "10000.0", ClampMax = "10000.0"))
207 float MorphTargetPositionErrorTolerance = 20.0f;
208
209#if WITH_EDITORONLY_DATA
210
212 UPROPERTY(VisibleAnywhere, Category = SkeletalMeshLODInfo)
214
215#endif //WITH_EDITORONLY_DATA
216
218 UPROPERTY(EditAnywhere, Category = SkeletalMeshLODInfo, AdvancedDisplay, EditFixedSize, Meta=(NoResetToDefault))
220
222 UPROPERTY()
223 uint8 bHasBeenSimplified:1;
224
225 UPROPERTY()
226 uint8 bHasPerLODVertexColors : 1;
227
229 UPROPERTY(EditAnywhere, Category = SkeletalMeshLODInfo)
230 uint8 bAllowCPUAccess : 1;
231
237 UPROPERTY(EditAnywhere, Category = SkeletalMeshLODInfo, meta=(DisplayName="Force Build Half Edge Buffers", EditCondition=bAllowMeshDeformer))
238 uint8 bBuildHalfEdgeBuffers : 1;
239
241 UPROPERTY(EditAnywhere, Category = SkeletalMeshLODInfo)
243
249 UPROPERTY(EditAnywhere, AdvancedDisplay, Category = SkeletalMeshLODInfo, meta=(EditCondition="bAllowCPUAccess"))
250 uint8 bSupportUniformlyDistributedSampling : 1;
251
252#if WITH_EDITORONLY_DATA
253 /*
254 * This boolean specify if the LOD was imported with the base mesh or not.
255 */
256 UPROPERTY()
258
259 // Protects access to the build guid.
261 {
262 private:
264 mutable UE::FMutex Mutex;
265 public:
266 FThreadSafeBuildGUID() = default;
269 {
270 }
271
273 {
275 UE::TUniqueLock Lock(Mutex);
276 BuildGuid = Other.BuildGuid;
277 }
278
280 {
281 if (&Other != this)
282 {
284 UE::TUniqueLock Lock(Mutex);
285 BuildGuid = Other.BuildGuid;
286 }
287 return *this;
288 }
289
290 bool operator==(const FGuid& Other) const
291 {
292 UE::TUniqueLock Lock(Mutex);
293 return BuildGuid == Other;
294 }
295
296 bool operator==(const FThreadSafeBuildGUID& Other) const
297 {
298 if (&Other == this)
299 {
300 return true;
301 }
302
304 UE::TUniqueLock Lock(Mutex);
305 return BuildGuid == Other.BuildGuid;
306 }
307
308 void operator=(const FGuid& Other)
309 {
310 UE::TUniqueLock Lock(Mutex);
312 }
313
314 void Invalidate()
315 {
316 UE::TUniqueLock Lock(Mutex);
317 BuildGuid.Invalidate();
318 }
319
320 operator FGuid() const
321 {
322 UE::TUniqueLock Lock(Mutex);
323 return BuildGuid;
324 }
325
326 bool IsValid() const
327 {
328 UE::TUniqueLock Lock(Mutex);
329 return BuildGuid.IsValid();
330 }
331
332 FString ToString(EGuidFormats Format = EGuidFormats::Digits) const
333 {
334 UE::TUniqueLock Lock(Mutex);
335 FString Out;
336 BuildGuid.AppendString(Out, Format);
337 return Out;
338 }
339
341 FThreadSafeBuildGUID& operator=(FThreadSafeBuildGUID&&) = delete;
342 };
343
344 //Temporary build GUID data
345 //We use this GUID to store the LOD Key so we can know if the LOD needs to be rebuilt
346 //This GUID is set when we Cache the render data (build function)
348
350#endif
351
353 : bHasBeenSimplified(false)
354 , bHasPerLODVertexColors(false)
355 , bAllowCPUAccess(false)
356 , bBuildHalfEdgeBuffers(false)
358 , bSupportUniformlyDistributedSampling(false)
361#endif
362 {
363 }
364
365};
366
367//~ Begin Material Interface for USkeletalMesh
368USTRUCT(BlueprintType)
370{
372
374 : MaterialInterface(nullptr)
375 , MaterialSlotName(NAME_None)
376#if WITH_EDITORONLY_DATA
379 , ImportedMaterialSlotName(NAME_None)
380#endif
381 , OverlayMaterialInterface(nullptr)
382 {
383
384 }
385
402
420
422#if WITH_EDITORONLY_DATA
423 static void DeclareCustomVersions(FArchive& Ar);
424#endif
425
426 ENGINE_API friend bool operator==( const FSkeletalMaterial& LHS, const FSkeletalMaterial& RHS );
427 ENGINE_API friend bool operator==( const FSkeletalMaterial& LHS, const UMaterialInterface& RHS );
428 ENGINE_API friend bool operator==( const UMaterialInterface& LHS, const FSkeletalMaterial& RHS );
429
430 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=SkeletalMesh)
431 TObjectPtr<UMaterialInterface> MaterialInterface;
432
433 /*This name should be use by the gameplay to avoid error if the skeletal mesh Materials array topology change*/
434 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = SkeletalMesh)
435 FName MaterialSlotName;
436#if WITH_EDITORONLY_DATA
437 UPROPERTY()
439 UPROPERTY()
441 /*This name should be use when we re-import a skeletal mesh so we can order the Materials array like it should be*/
442 UPROPERTY(VisibleAnywhere, Category = SkeletalMesh)
443 FName ImportedMaterialSlotName;
444#endif
445
447 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = SkeletalMesh)
448 FMeshUVChannelInfo UVChannelData;
449
450 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=SkeletalMesh)
451 TObjectPtr<UMaterialInterface> OverlayMaterialInterface;
452};
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define WITH_EDITORONLY_DATA
Definition CoreMiscDefines.h:24
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define DECLARE_CYCLE_STAT_EXTERN(CounterName, StatId, GroupId, API)
Definition Stats.h:679
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
FArchive & operator<<(FArchive &Ar, FEnvQueryDebugProfileData::FStep &Data)
Definition EnvQueryTypes.cpp:489
return true
Definition ExternalRpcRegistry.cpp:601
EGuidFormats
Definition Guid.h:33
const bool
Definition NetworkReplayStreaming.h:178
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
ESkinCacheUsage
Definition SkinnedAssetCommon.h:33
ESkinCacheDefaultBehavior
Definition SkinnedAssetCommon.h:46
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
FRWLock Lock
Definition UnversionedPropertySerialization.cpp:921
if(Failed) console_printf("Failed.\n")
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Archive.h:1208
virtual void Serialize(void *V, int64 Length)
Definition Archive.h:1689
Definition NameTypes.h:617
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition AnimSequence.h:203
Definition Mutex.h:18
Definition UniqueLock.h:20
Definition MaterialInterface.h:296
Definition BuildSettings.cpp:6
@ false
Definition radaudio_common.h:23
Definition BoneReference.h:14
Definition Guid.h:109
Definition MeshUVChannelInfo.h:13
Definition SkinnedAssetCommon.h:101
Definition PerPlatformProperties.h:304
Definition SkinnedAssetCommon.h:56
bool Serialize(FArchive &Ar)
Definition SkinnedAssetCommon.h:86
friend FArchive & operator<<(FArchive &Ar, FSectionReference &B)
Definition SkinnedAssetCommon.h:92
FSectionReference(const int32 &InSectionIndex)
Definition SkinnedAssetCommon.h:68
bool operator==(const FSectionReference &Other) const
Definition SkinnedAssetCommon.h:73
Definition SkinnedAssetCommon.h:370
FSkeletalMaterial(UMaterialInterface *InMaterialInterface, FName InMaterialSlotName, FName InImportedMaterialSlotName=NAME_None, UMaterialInterface *InOverlayMaterialInterface=nullptr)
Definition SkinnedAssetCommon.h:386
FSkeletalMaterial(UMaterialInterface *InMaterialInterface, bool bInEnableShadowCasting=true, bool bInRecomputeTangent=false, FName InMaterialSlotName=NAME_None, FName InImportedMaterialSlotName=NAME_None, UMaterialInterface *InOverlayMaterialInterface=nullptr)
Definition SkinnedAssetCommon.h:403
Definition EngineTypes.h:2862
Definition SkeletalMeshLODSettings.h:54
FSkeletalMeshOptimizationSettings ReductionSettings
Definition SkeletalMeshLODSettings.h:115
float LODHysteresis
Definition SkeletalMeshLODSettings.h:87
bool bAllowMeshDeformer
Definition SkeletalMeshLODSettings.h:119
TObjectPtr< class UAnimSequence > BakePose
Definition SkeletalMeshLODSettings.h:111
TArray< FName > BonesToPrioritize
Definition SkeletalMeshLODSettings.h:99
FPerPlatformFloat ScreenSize
Definition SkeletalMeshLODSettings.h:83
float WeightOfPrioritization
Definition SkeletalMeshLODSettings.h:107
TArray< int32 > SectionsToPrioritize
Definition SkeletalMeshLODSettings.h:103
Definition SkinnedAssetCommon.h:129
FSkeletalMeshLODInfo()
Definition SkinnedAssetCommon.h:352
Definition SkeletalMeshReductionSettings.h:59
Definition SkeletalMeshVertexAttribute.h:29
Definition ObjectPtr.h:488