UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ClothingAsset.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "ClothingAssetBase.h"
5#include "ClothConfigBase.h"
6#include "ClothLODData.h"
10#include "Algo/AnyOf.h"
11#include "ClothingAsset.generated.h"
12
13#define UE_API CLOTHINGSYSTEMRUNTIMECOMMON_API
14
15class UPhysicsAsset;
16struct FSkelMeshSection;
17
94
98class UE_DEPRECATED(5.0, "Redundant class.") UClothingAssetCustomData;
99UCLASS(Abstract, MinimalAPI)
104
109{
110 None = 0,
111 InverseMasses = 1 << 0,
112 NumInfluences = 1 << 1,
113 SelfCollisionData = 1 << 2,
114 Tethers = 1 << 3,
115 All = 0xFF
116};
118
127UCLASS(hidecategories = Object, BlueprintType, MinimalAPI)
129{
131public:
132
134
135#if WITH_EDITOR
136
142
149
155
162
169
170 //~ Begin UObject interface
174 UE_API virtual void PreEditUndo() override;
175
179 UE_API virtual void PostEditUndo() override;
180 //~ End UObject interface
181#endif // WITH_EDITOR
182
187 UE_API virtual void RefreshBoneMapping(USkeletalMesh* InSkelMesh) override;
188
190 UE_API void CalculateReferenceBoneIndex();
191
193 UE_API virtual bool IsValidLod(int32 InLodIndex) const override;
194
196 UE_API virtual int32 GetNumLods() const override;
197
198#if WITH_EDITORONLY_DATA
204
210#endif // WITH_EDITORONLY_DATA
211
212#if WITH_EDITOR
214 UE_API virtual int32 AddNewLod() override;
215
216 /* Called after changes in any of the asset properties. */
218#endif // WITH_EDITOR
219
223 {
224 auto const* const ClothConfig = ClothConfigs.Find(ClothConfigType::StaticClass()->GetFName());
226 }
227
231 {
232 auto const* const ClothConfig = ClothConfigs.Find(ClothConfigType::StaticClass()->GetFName());
234 }
235
237 UE_API virtual void PostLoad() override;
238#if WITH_EDITORONLY_DATA
240#endif
241
243 UE_API virtual void Serialize(FArchive& Ar) override;
244
246 UE_API virtual void PostUpdateAllAssets() override;
247
248 // The physics asset to extract collisions from when building a simulation.
249 UPROPERTY(EditAnywhere, Category = "Skeletal Mesh Clothing")
251
252 // Simulation specific cloth parameters.
253 // Use GetClothConfig() to retrieve the correct parameters/config type for the desired cloth simulation system.
254 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, EditFixedSize, Instanced, Category = "Skeletal Mesh Clothing")
256
257#if WITH_EDITORONLY_DATA
258 // Shared by all cloth instances in a skeletal mesh
259 // Only supported with Chaos Cloth for now
260 // This may not be editable on unused cloth assets
261 UPROPERTY()
263
264 // Parameters for how the NVcloth behaves.
265 // These will have no effect on Chaos cloth
266 UPROPERTY()
268
269 // Parameters for how Chaos cloth behaves
270 // These will not affect NVcloth
271 // For now, we have two configuration parameters so that we can switch between chaos and
272 // non chaos at will without losing the original NVcloth data
273 UPROPERTY()
275
276 // Deprecated. Use LodData instead
277 UPROPERTY()
279#endif
280
281 // The actual asset data, listed by LOD.
282 UPROPERTY()
284
285 // Tracks which clothing LOD each skel mesh LOD corresponds to (LodMap[SkelLod]=ClothingLod).
286 UPROPERTY()
287 TArray<int32> LodMap;
288
289 // List of bones this asset uses inside its parent mesh.
290 UPROPERTY()
291 TArray<FName> UsedBoneNames;
292
293 // List of the indices for the bones in UsedBoneNames, used for remapping.
294 UPROPERTY()
295 TArray<int32> UsedBoneIndices;
296
297 // Bone to treat as the root of the simulation space.
298 UPROPERTY()
299 int32 ReferenceBoneIndex;
300
301#if WITH_EDITORONLY_DATA
306 UPROPERTY()
308#endif
309
310private:
311
312 // Add or replace a new cloth config of the specified type.
314 void SetClothConfig(ClothConfigType* ClothConfig)
315 {
317 ClothConfigs.Add(ClothConfig->GetClass()->GetFName(), static_cast<UClothConfigBase*>(ClothConfig));
318 }
319
320 // Create and add any missing cloth configs.
321 // If a config from a different factory exists already, the newly
322 // created config will attempt to initialize its parameters from it.
323 // Return true when at least one config has been added, false otherwise.
324 bool AddClothConfigs();
325
326 // Propagate the shared simulation configs between assets.
327 // Also migrate all deprecated shared parameters which have been moved to the per cloth configs if required.
328 // Called after a cloth asset is created or loaded.
329 void PropagateSharedConfigs(bool bMigrateSharedConfigToConfig=false);
330
331 // Return true when any one of the cloth configs fullfill the predicate.
332 // Used to select which type of data to cache.
333 template<typename PredicateType>
334 bool AnyOfClothConfigs(PredicateType Predicate) const
335 {
336 return Algo::AnyOf(ClothConfigs, [&Predicate](const TPair<FName, TObjectPtr<UClothConfigBase>>& ClothConfig)
337 {
338 return Predicate(*ClothConfig.Value);
339 });
340 }
341
342#if WITH_EDITOR
343 // Add extra cloth deformer mappings to cope with a different raytracing LOD than the one currently rendered.
345
346 // Helper functions used in PostPropertyChangeCb
349#endif // WITH_EDITOR
350};
351
352#undef UE_API
#define check(expr)
Definition AssertionMacros.h:314
#define UE_API
Definition ClothingAsset.h:13
EClothingCachedDataFlagsCommon
Definition ClothingAsset.h:109
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UE_API
Definition SColorGradingComponentViewer.h:12
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Archive.h:1208
Definition NameTypes.h:617
Definition UObjectGlobals.h:1292
Definition Array.h:670
Definition AndroidPlatformMisc.h:14
Definition UnrealString.h.inl:34
Definition Class.h:3793
Definition ClothConfigBase.h:19
Definition ClothLODData_Legacy.h:59
Definition ClothingAssetBase.h:21
Definition ClothingAsset.h:129
const ClothConfigType * GetClothConfig() const
Definition ClothingAsset.h:222
ClothConfigType * GetClothConfig()
Definition ClothingAsset.h:230
Definition ClothingAsset.h:101
Definition ClothingSimulationInteractor.h:65
Definition Object.h:95
Definition PhysicsAsset.h:172
Definition SkeletalMesh.h:440
UE_REWRITE bool AnyOf(const RangeType &Range)
Definition AnyOf.h:20
Definition ClothingAsset.h:19
int32 SectionIndex
Definition ClothingAsset.h:29
UClothingAssetBase * Asset
Definition ClothingAsset.h:27
int32 LODIndex
Definition ClothingAsset.h:28
int32 AssetInternalLodIndex
Definition ClothingAsset.h:30
Definition ClothConfig_Legacy.h:67
Definition ClothLODData.h:11
Definition UnrealType.h:7001
Definition ObjectPtr.h:488
Definition Tuple.h:652