UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
StaticMesh.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Async/AsyncWork.h"
6#include "CoreMinimal.h"
9#include "UObject/Object.h"
11#include "Misc/Guid.h"
14#include "Engine/EngineTypes.h"
17#include "RenderCommandFence.h"
20#include "MeshUVChannelInfo.h"
22#include "Tasks/Task.h"
23#include "Templates/UniquePtr.h"
26#include "MeshTypes.h"
28
29#include "StaticMesh.generated.h"
30
31class FSpeedTreeWind;
33class UAssetUserData;
36class UStaticMeshComponent;
39class UPackage;
40struct FMeshDescription;
44
45/*-----------------------------------------------------------------------------
46 Async Static Mesh Compilation
47-----------------------------------------------------------------------------*/
48
50{
51 None = 0,
52 RenderData = 1 << 0,
53 //OccluderData = 1 << 1,
54 SourceModels = 1 << 2,
55 SectionInfoMap = 1 << 3,
57 NavCollision = 1 << 5,
58 LightmapUVVersion = 1 << 6,
59 BodySetup = 1 << 7,
60 LightingGuid = 1 << 8,
61 ExtendedBounds = 1 << 9,
64 StaticMaterials = 1 << 12,
65 LightmapUVDensity = 1 << 13,
66 IsBuiltAtRuntime = 1 << 14,
67 MinLOD = 1 << 15,
69 LightMapResolution = 1 << 17,
70 HiResSourceModel = 1 << 18,
72
74};
75
76inline const TCHAR* ToString(EStaticMeshAsyncProperties Value)
77{
78 switch (Value)
79 {
81 return TEXT("None");
83 return TEXT("RenderData");
85 return TEXT("SourceModels");
87 return TEXT("SectionInfoMap");
89 return TEXT("OriginalSectionInfoMap");
91 return TEXT("NavCollision");
93 return TEXT("LightmapUVVersion");
95 return TEXT("BodySetup");
97 return TEXT("LightingGuid");
99 return TEXT("ExtendedBounds");
101 return TEXT("NegativeBoundsExtension");
103 return TEXT("PositiveBoundsExtension");
105 return TEXT("StaticMaterials");
107 return TEXT("LightmapUVDensity");
109 return TEXT("IsBuiltAtRuntime");
111 return TEXT("MinLOD");
113 return TEXT("LightMapCoordinateIndex");
115 return TEXT("LightMapResolution");
117 return TEXT("HiResSourceModel");
119 return TEXT("UseLegacyTangentScaling");
121 default:
122 check(false);
123 return TEXT("Unknown");
124 }
125}
126
128
131
132#if WITH_EDITOR
133
134// Any thread implicated in the static mesh build must have a valid scope to be granted access to protected properties without causing any stalls.
136{
137public:
139 {
142 }
143
145 {
148 }
149
151 {
153 }
154
155private:
156 const UStaticMesh* PreviousScope = nullptr;
157 // Only the thread(s) compiling this static mesh will have full access to protected properties without causing any stalls.
158 static thread_local const UStaticMesh* StaticMeshBeingAsyncCompiled;
159};
160
164class FStaticMeshAsyncBuildWorker : public FNonAbandonableTask
165{
166public:
170
172 FStaticMeshAsyncBuildWorker(
176 , PostLoadContext(nullptr)
178 {
179 }
180
182 FStaticMeshAsyncBuildWorker(
187 , BuildContext(nullptr)
188 {
189 }
190
191 void MarkAsCanceled();
192
193 inline TStatId GetStatId() const
194 {
196 }
197
198 void DoWork();
199};
200
201struct FStaticMeshAsyncBuildTask : public FAsyncTask<FStaticMeshAsyncBuildWorker>
202{
206 : FAsyncTask<FStaticMeshAsyncBuildWorker>(InStaticMesh, MoveTemp(InPostLoadContext))
208 {
209 }
210
214 : FAsyncTask<FStaticMeshAsyncBuildWorker>(InStaticMesh, MoveTemp(InBuildContext))
216 {
217 }
218
219 const UStaticMesh* StaticMesh;
220};
221#endif // #if WITH_EDITOR
222
223/*-----------------------------------------------------------------------------
224 Legacy mesh optimization settings.
225-----------------------------------------------------------------------------*/
226
228UENUM()
238
239UENUM()
251
253UENUM()
260
262USTRUCT()
264{
266
267
268 UPROPERTY()
270
272 UPROPERTY()
273 float NumOfTrianglesPercentage;
274
276 UPROPERTY()
277 float MaxDeviationPercentage;
278
280 UPROPERTY()
281 float WeldingThreshold;
282
284 UPROPERTY()
285 bool bRecalcNormals;
286
289 UPROPERTY()
290 float NormalsThreshold;
291
293 UPROPERTY()
294 uint8 SilhouetteImportance;
295
297 UPROPERTY()
298 uint8 TextureImportance;
299
301 UPROPERTY()
302 uint8 ShadingImportance;
303
304
306 : ReductionMethod( OT_MaxDeviation )
307 , NumOfTrianglesPercentage( 1.0f )
308 , MaxDeviationPercentage( 0.0f )
309 , WeldingThreshold( 0.1f )
310 , bRecalcNormals( true )
311 , NormalsThreshold( 60.0f )
312 , SilhouetteImportance( IL_Normal )
313 , TextureImportance( IL_Normal )
314 , ShadingImportance( IL_Normal )
315 {
316 }
317
320 {
321 Ar << Settings.ReductionMethod;
322 Ar << Settings.MaxDeviationPercentage;
323 Ar << Settings.NumOfTrianglesPercentage;
324 Ar << Settings.SilhouetteImportance;
325 Ar << Settings.TextureImportance;
326 Ar << Settings.ShadingImportance;
327 Ar << Settings.bRecalcNormals;
328 Ar << Settings.NormalsThreshold;
329 Ar << Settings.WeldingThreshold;
330
331 return Ar;
332 }
333
334};
335
336/*-----------------------------------------------------------------------------
337 UStaticMesh
338-----------------------------------------------------------------------------*/
339
343USTRUCT()
345{
347
348
349 UPROPERTY()
350 int32 MaterialIndex;
351
353 UPROPERTY()
354 bool bEnableCollision;
355
357 UPROPERTY()
358 bool bCastShadow;
359
361 UPROPERTY()
362 bool bVisibleInRayTracing;
363
365 UPROPERTY()
366 bool bAffectDistanceFieldLighting;
367
369 UPROPERTY()
370 bool bForceOpaque;
371
374 : MaterialIndex(0)
375 , bEnableCollision(true)
376 , bCastShadow(true)
377 , bVisibleInRayTracing(true)
378 , bAffectDistanceFieldLighting(true)
379 , bForceOpaque(false)
380 {
381 }
382
385 : MaterialIndex(InMaterialIndex)
386 , bEnableCollision(true)
387 , bCastShadow(true)
388 , bVisibleInRayTracing(true)
389 , bAffectDistanceFieldLighting(true)
390 , bForceOpaque(false)
391 {
392 }
393
395 friend bool operator==(const FMeshSectionInfo& A, const FMeshSectionInfo& B);
396 friend bool operator!=(const FMeshSectionInfo& A, const FMeshSectionInfo& B);
397};
398
402USTRUCT()
404{
406
407
408 UPROPERTY()
410
413
416
418 ENGINE_API int32 GetSectionNumber(int32 LODIndex) const;
419
421 ENGINE_API bool IsValidSection(int32 LODIndex, int32 SectionIndex) const;
422
424 ENGINE_API FMeshSectionInfo Get(int32 LODIndex, int32 SectionIndex) const;
425
427 ENGINE_API void Set(int32 LODIndex, int32 SectionIndex, FMeshSectionInfo Info);
428
430 ENGINE_API void Remove(int32 LODIndex, int32 SectionIndex);
431
433 ENGINE_API void CopyFrom(const FMeshSectionInfoMap& Other);
434
436 bool AnySectionHasCollision(int32 LodIndex) const;
437};
438
439USTRUCT()
441{
443
445 : bIsSet(false)
446 , CamOrbitPoint(ForceInitToZero)
447 , CamOrbitZoom(ForceInitToZero)
448 , CamOrbitRotation(ForceInitToZero)
449 {
450 }
451
453 : bIsSet(true)
454 , CamOrbitPoint(InCamOrbitPoint)
455 , CamOrbitZoom(InCamOrbitZoom)
456 , CamOrbitRotation(InCamOrbitRotation)
457 {
458 }
459
461 UPROPERTY()
462 bool bIsSet;
463
465 UPROPERTY()
466 FVector CamOrbitPoint;
467
469 UPROPERTY()
470 FVector CamOrbitZoom;
471
473 UPROPERTY()
474 FRotator CamOrbitRotation;
475};
476
477#if WITH_EDITOR
482#endif
483
484//~ Begin Material Interface for UStaticMesh - contains a material and other stuff
485USTRUCT(BlueprintType)
487{
489
491
496#endif
498 );
499
501
502 ENGINE_API friend bool operator==(const FStaticMaterial& LHS, const FStaticMaterial& RHS);
503 ENGINE_API friend bool operator==(const FStaticMaterial& LHS, const UMaterialInterface& RHS);
504 ENGINE_API friend bool operator==(const UMaterialInterface& LHS, const FStaticMaterial& RHS);
505
506 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = StaticMesh)
507 TObjectPtr<class UMaterialInterface> MaterialInterface;
508
509 /*This name should be use by the gameplay to avoid error if the skeletal mesh Materials array topology change*/
510 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = StaticMesh)
511 FName MaterialSlotName;
512
513 /*This name should be use when we re-import a skeletal mesh so we can order the Materials array like it should be*/
514 UPROPERTY(VisibleAnywhere, Category = StaticMesh)
515 FName ImportedMaterialSlotName;
516
518 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = StaticMesh)
519 FMeshUVChannelInfo UVChannelData;
520
521 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = StaticMesh)
522 TObjectPtr<class UMaterialInterface> OverlayMaterialInterface;
523};
524
525USTRUCT()
537
539{
540 // Before any version changes were made
542 // Remove the material re-order workflow
547
548USTRUCT()
550{
552
554 {
555 ImportVersionKey = 0;
556 }
557
559 : ImportVersionKey(VersionKey)
560 , MaterialRemap(RemapArray)
561 {
562 }
563
564 UPROPERTY()
565 uint32 ImportVersionKey;
566
567 UPROPERTY()
568 TArray<int32> MaterialRemap;
569};
570
571UENUM(BlueprintType)
573{
575 Default,
577 Enabled,
579 Disabled,
580};
581
582
591UCLASS(hidecategories=Object, customconstructor, MinimalAPI, BlueprintType, config=Engine)
593{
595
596#if WITH_EDITOR
599
602#endif
603public:
605
606private:
607
608#if WITH_EDITOR
610 std::atomic<uint32> LockedProperties;
611
614 ENGINE_API void WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties AsyncProperties) const;
615#else
618 inline void WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties AsyncProperties) const {}
619#endif
620
622 UE_DEPRECATED(5.0, "This must be protected for async build, always use the accessors even internally.")
624
625public:
626#if WITH_EDITOR
627 bool IsCompiling() const override { return AsyncTask != nullptr || LockedProperties.load(std::memory_order_relaxed) != 0; }
628 ENGINE_API bool HasAnyDependenciesCompiling() const;
629#else
630 inline bool IsCompiling() const { return false; }
631 bool HasAnyDependenciesCompiling() const { return false; }
632#endif
633
634 ENGINE_API FStaticMeshRenderData* GetRenderData();
635 ENGINE_API const FStaticMeshRenderData* GetRenderData() const;
637
638 void RequestUpdateCachedRenderState() const;
639
640#if WITH_EDITORONLY_DATA
641 static const float MinimumAutoLODPixelError;
642
643private:
645 UE_DEPRECATED(5.0, "This must be protected for async build, always use the accessors even internally.")
646 UPROPERTY(Setter = None, Getter = None)
648
650 UE_DEPRECATED(5.0, "This must be protected for async build, always use the accessors even internally.")
651 UPROPERTY(Setter = None, Getter = None)
653
655 {
656 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::LightmapUVVersion);
660 }
661
663 UE_DEPRECATED(5.0, "This must be protected for async build, always use the accessors even internally.")
664 UPROPERTY()
666
675 UE_DEPRECATED(5.0, "This must be protected for async build, always use the accessors even internally.")
676 UPROPERTY()
678
679public:
681 {
685 }
686
688 UE_DEPRECATED(5.7, "Please do not access this member directly, it will become private soon; use UStaticMesh::Get/SetLODGroup() or, if absolutely needed, UStaticMesh::SetLODGroup_Unsafe() which bypasses the conditional processing in SetLODGroup(). The Unsafe version is likely to be removed in the near future.")
689 UPROPERTY(EditAnywhere, AssetRegistrySearchable, Category=LodSettings)
690 FName LODGroup;
691
696 UE_DEPRECATED(5.7, "Please do not access this member directly, it will become private soon; use UStaticMesh::GetNumStreamedLODs().")
697 UPROPERTY()
699
700 /* The last import version */
701 UE_DEPRECATED(5.7, "Please do not access this member directly, it will become private soon; use UStaticMesh::GetImportVersion() or UStaticMesh::SetImportVersion().")
702 UPROPERTY()
704
705 UE_DEPRECATED(5.7, "Please do not access this member directly, it will become private soon; use UStaticMesh::GetMaterialRemapIndexPerImportVersion()")
706 UPROPERTY()
708
710 UE_DEPRECATED(5.7, "Please do not access this member directly, it will become private soon; use UStaticMesh::GetAutoComputeLODScreenSize() or UStaticMesh::SetAutoComputeLODScreenSize().")
711 UPROPERTY()
713
720
726 uint8 bRequiresLODScreenSizeConversion : 1;
727
729 UE_DEPRECATED(5.7, "Do not access this member. It is not meant to be used outside of UStaticMesh.")
730 UPROPERTY()
732
734 UE_DEPRECATED(5.7, "Please do not access this member directly, it will become private soon; use the various NaniteSettings accessor functions.")
735 UPROPERTY(EditAnywhere, Category = NaniteSettings)
736 FMeshNaniteSettings NaniteSettings;
737
738
739private:
740 /* The lightmap UV generation version used during the last derived data build */
741 UE_DEPRECATED(5.0, "This must be protected for async build, always use the accessors even internally.")
742 UPROPERTY()
744public:
745
747 {
748 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::LightmapUVVersion);
750 return LightmapUVVersion;
752 }
753
754
756 FName GetLODGroup() const
757 {
758 return LODGroup;
759 }
760
762 {
763 LODGroup = InLODGroup;
764 }
765
767 {
768 return GET_MEMBER_NAME_CHECKED(UStaticMesh, LODGroup);
769 }
770
772 {
773 return NumStreamedLODs;
774 }
775
777 {
778 return NumStreamedLODs;
779 }
780
782 {
783 return ImportVersion;
784 }
785
786 void SetImportVersion(int32 Version)
787 {
789 }
790
792 {
794 }
795
797 {
799 }
800
801 bool GetAutoComputeLODScreenSize() const
802 {
804 }
805
807 {
809 }
810
812 {
814 }
815
817 {
819 }
820
821 void SetRequiresLODDistanceConversion(bool bRequiresConversion)
822 {
823 bRequiresLODDistanceConversion = bRequiresConversion;
824 }
825
827 {
828 return bRequiresLODScreenSizeConversion;
829 }
830
831 void SetRequiresLODScreenSizeConversion(bool bRequiresConversion)
832 {
833 bRequiresLODScreenSizeConversion = bRequiresConversion;
834 }
835
837 {
838 return NaniteSettings;
839 }
841 {
842 return NaniteSettings;
843 }
844
845 void SetNaniteSettings(const FMeshNaniteSettings& Settings)
846 {
847 NaniteSettings = Settings;
848 }
849
851 {
852 return GET_MEMBER_NAME_CHECKED(UStaticMesh, NaniteSettings);
853 }
854
856 {
857 FProperty* ChangedProperty = FindFProperty<FProperty>(UStaticMesh::StaticClass(), GET_MEMBER_NAME_CHECKED(UStaticMesh, NaniteSettings));
859 PostEditChangeProperty(Event);
860 }
862
863#endif // #if WITH_EDITORONLY_DATA
864
865#if WITH_EDITOR
866 UFUNCTION(BlueprintCallable, Category = StaticMesh)
867 bool IsLODScreenSizeAutoComputed() const
868 {
872 }
873#endif
874
876 bool IsMinLodQualityLevelEnable() const;
877
878 UPROPERTY()
879 /*PerQuality override. Note: Enable PerQuality override in the Project Settings/ General Settings/ UseStaticMeshMinLODPerQualityLevels*/
880 /* Allow more flexibility to set various values driven by the Scalability or Device Profile.*/
881 FPerQualityLevelInt MinQualityLevelLOD;
882
883 static FName GetQualityLevelMinLODMemberName()
884 {
885 return GET_MEMBER_NAME_CHECKED(UStaticMesh, MinQualityLevelLOD);
886 }
887
889 {
890 return MinQualityLevelLOD;
891 }
892
894 {
895 MinQualityLevelLOD = MoveTemp(InMinLOD);
896 }
897
898 UFUNCTION(BlueprintPure, Category = StaticMesh)
899 void GetMinimumLODForQualityLevels(TMap<FName, int32>& QualityLevelMinimumLODs) const
900 {
901#if WITH_EDITORONLY_DATA
902 for (const TPair<int32, int32>& Pair : GetQualityLevelMinLOD().PerQuality)
903 {
904 QualityLevelMinimumLODs.Add(QualityLevelProperty::QualityLevelToFName(Pair.Key), Pair.Value);
905 }
906#endif
907 }
908
909 UFUNCTION(BlueprintPure, Category = StaticMesh)
910 int32 GetMinimumLODForQualityLevel(const FName& QualityLevel) const
911 {
912#if WITH_EDITORONLY_DATA
914 if (const int32* Result = GetQualityLevelMinLOD().PerQuality.Find(QualityLevelKey))
915 {
916 return *Result;
917 }
918#endif
919 return INDEX_NONE;
920 }
921
922 UFUNCTION(BlueprintCallable, Category = StaticMesh, Meta = (ToolTip = "Allow to override min lod quality levels on a staticMesh and it Default value (-1 value for Default dont override its value)."))
924 {
925#if WITH_EDITORONLY_DATA
926 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::MinLOD);
927 MinQualityLevelLOD.PerQuality = QualityLevelProperty::ConvertQualityLevelData(QualityLevelMinimumLODs);
928 MinQualityLevelLOD.Default = Default >= 0 ? Default : MinQualityLevelLOD.Default;
929#endif
930 }
931
932 UFUNCTION(BlueprintPure, Category = StaticMesh)
933 void GetMinLODForQualityLevels(TMap<EPerQualityLevels, int32>& QualityLevelMinimumLODs, int32& Default) const
934 {
935#if WITH_EDITORONLY_DATA
936 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::MinLOD);
937 QualityLevelMinimumLODs = QualityLevelProperty::ConvertQualityLevelData(MinQualityLevelLOD.PerQuality);
938 Default = MinQualityLevelLOD.Default;
939#endif
940 }
941
942 /*Choose either PerPlatform or PerQuality override. Note: Enable PerQuality override in the Project Settings/ General Settings/ UseStaticMeshMinLODPerQualityLevels*/
944 ENGINE_API int32 GetDefaultMinLOD() const;
945 ENGINE_API void SetMinLODIdx(int32 InMinLOD);
946
948 ENGINE_API static float ComputeLODScreenSize(int32 LODIndex, float PreviousLODScreenSize = -1.0f);
949
950 ENGINE_API static void OnLodStrippingQualityLevelChanged(IConsoleVariable* Variable);
951
953 UE_DEPRECATED(4.27, "Please do not access this member directly; use UStaticMesh::GetMinLOD() or UStaticMesh::SetMinLOD().")
954 UPROPERTY()
956
957 const FPerPlatformInt& GetMinLOD() const
958 {
959 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::MinLOD);
961 return MinLOD;
963 }
964
972
973 UFUNCTION(BlueprintPure, Category=StaticMesh)
974 void GetMinimumLODForPlatforms(TMap<FName, int32>& PlatformMinimumLODs) const
975 {
976#if WITH_EDITORONLY_DATA
977 PlatformMinimumLODs = GetMinLOD().PerPlatform;
978#endif
979 }
980
981 UFUNCTION(BlueprintPure, Category=StaticMesh)
982 int32 GetMinimumLODForPlatform(const FName& PlatformName) const
983 {
984#if WITH_EDITORONLY_DATA
985 if (const int32* Result = GetMinLOD().PerPlatform.Find(PlatformName))
986 {
987 return *Result;
988 }
989#endif
990 return INDEX_NONE;
991 }
992
993 UFUNCTION(BlueprintCallable, Category=StaticMesh)
994 void SetMinimumLODForPlatforms(const TMap<FName, int32>& PlatformMinimumLODs)
995 {
996#if WITH_EDITORONLY_DATA
997 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::MinLOD);
999 MinLOD.PerPlatform = PlatformMinimumLODs;
1001#endif
1002 }
1003
1004 UFUNCTION(BlueprintCallable, Category=StaticMesh)
1005 void SetMinimumLODForPlatform(const FName& PlatformName, int32 InMinLOD)
1006 {
1007#if WITH_EDITORONLY_DATA
1008 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::MinLOD);
1010 MinLOD.PerPlatform.Add(PlatformName, InMinLOD);
1012#endif
1013 }
1014
1015protected:
1020 UPROPERTY(meta = (DisplayAfter = "ExtendedBounds"))
1021 int32 ElementToIgnoreForTexFactor;
1022
1023public:
1024
1025#if WITH_EDITORONLY_DATA
1030 ENGINE_API bool IsNaniteEnabled() const;
1031
1036 ENGINE_API bool IsNaniteForceEnabled() const;
1037
1042 ENGINE_API bool IsNaniteAssembly() const;
1043
1048
1054
1061
1066#endif
1067
1068 // TODO: Temp/deprecated hack - Do not call
1069 inline bool IsNaniteLandscape() const
1070 {
1071 return GetName().StartsWith(TEXT("LandscapeNaniteMesh"));
1072 }
1073
1074private:
1075 UE_DEPRECATED(5.0, "This must be protected for async build, always use the accessors even internally.")
1076 UPROPERTY(BlueprintGetter = GetStaticMaterials, BlueprintSetter = SetStaticMaterials, Category = StaticMesh)
1078
1079 TArray<FStaticMaterialMinimalInfo> StaticMaterialsInfoCache;
1080 mutable FCriticalSection MaterialsInfoCriticalSection;
1081 ENGINE_API void UpdateStaticMaterialsInfoCache(const TArray<FStaticMaterial>& InMaterials);
1082 ENGINE_API const FString ExportStaticMaterialsInfo() const;
1083
1084#if WITH_EDITORONLY_DATA
1087#endif
1088#if WITH_EDITOR
1090#endif
1091
1092public:
1099
1101 {
1102 FScopeLock Lock(&MaterialsInfoCriticalSection);
1103 return StaticMaterialsInfoCache;
1104 }
1105
1106 ENGINE_API static const TArray<FStaticMaterialMinimalInfo> ImportStaticMaterialsInfo(const FString& InData);
1107
1115
1116 UFUNCTION(BlueprintGetter)
1117 const TArray<FStaticMaterial>& GetStaticMaterials() const
1118 {
1119 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::StaticMaterials);
1121 return StaticMaterials;
1123 }
1124
1125 UFUNCTION(BlueprintSetter)
1126 void SetStaticMaterials(const TArray<FStaticMaterial>& InStaticMaterials)
1127 {
1128 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::StaticMaterials);
1131 UpdateStaticMaterialsInfoCache(StaticMaterials);
1133 }
1134
1135private:
1136 UE_DEPRECATED(5.0, "This must be protected for async build, always use the accessors even internally.")
1137 UPROPERTY()
1138 float LightmapUVDensity;
1139public:
1147
1155
1156 UE_DEPRECATED(4.27, "Please do not access this member directly; use UStaticMesh::GetLightMapResolution() or UStaticMesh::SetLightMapResolution().")
1157 UPROPERTY(EditAnywhere, Category=StaticMesh, meta=(ClampMax = 4096, ToolTip="The light map resolution", FixedIncrement="4.0"))
1159
1160 int32 GetLightMapResolution() const
1161 {
1162 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::LightMapResolution);
1164 return LightMapResolution;
1166 }
1167
1175
1182
1184 UE_DEPRECATED(4.27, "Please do not access this member directly; use UStaticMesh::GetLightMapCoordinateIndex() or UStaticMesh::SetLightMapCoordinateIndex().")
1185 UPROPERTY(EditAnywhere, AdvancedDisplay, Category=StaticMesh, meta=(ToolTip="The light map coordinate index", UIMin = "0", UIMax = "3"))
1187
1188 int32 GetLightMapCoordinateIndex() const
1189 {
1190 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::LightMapCoordinateIndex);
1194 }
1195
1203
1210
1212 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = StaticMesh, meta = (DisplayName = "Support Texture Color Mesh Painting"))
1213 EStaticMeshPaintSupport StaticMeshPaintSupport;
1214
1216 ENGINE_API bool CanMeshPaintTextureColors() const;
1217
1219 UPROPERTY(EditAnywhere, AdvancedDisplay, Category = StaticMesh, meta = (UIMin = "0", UIMax = "3"))
1220 int32 MeshPaintTextureCoordinateIndex;
1221
1227 UPROPERTY(EditAnywhere, AdvancedDisplay, Category = StaticMesh, meta = (UIMin = "0", UIMax = "4096", ClampMax = "4096"))
1228 int32 MeshPaintTextureResolution;
1229
1231 UPROPERTY(EditAnywhere, AdvancedDisplay, Category = StaticMesh)
1232 float DistanceFieldSelfShadowBias;
1233
1234private:
1235 // Physics data.
1236 UE_DEPRECATED(5.0, "This must be protected for async build, always use the accessors even internally.")
1237 UPROPERTY(EditAnywhere, transient, duplicatetransient, Instanced, Category = StaticMesh)
1239public:
1240 UBodySetup* GetBodySetup() const
1241 {
1242 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::BodySetup);
1244 return BodySetup;
1246 }
1247
1255
1262
1268 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = StaticMesh, meta=(DisplayName="LOD For Collision"))
1269 int32 LODForCollision;
1270
1275 UPROPERTY(EditAnywhere, Category=StaticMesh)
1276 uint8 bGenerateMeshDistanceField : 1;
1277
1280 UPROPERTY()
1281 uint8 bStripComplexCollisionForConsole_DEPRECATED:1;
1282
1285 UPROPERTY(EditAnywhere, Category=Navigation)
1286 uint8 bHasNavigationData:1;
1287
1293 UPROPERTY(EditAnywhere, AdvancedDisplay, Category = StaticMesh)
1294 uint8 bSupportUniformlyDistributedSampling : 1;
1295
1301 UPROPERTY(EditAnywhere, AdvancedDisplay, Category = StaticMesh)
1302 uint8 bSupportPhysicalMaterialMasks : 1;
1303
1304#if WITH_EDITORONLY_DATA
1305private:
1306 // If true, will incorrectly scale tangents when applying a non-uniform BuildScale to match what legacy code did. Only use for consistency on old assets.
1307 UE_DEPRECATED(5.4, "Please do not access this member directly; use UStaticMesh::GetLegacyTangentScaling() or UStaticMesh::SetLegacyTangentScaling().")
1308 UPROPERTY(EditAnywhere, AdvancedDisplay, Category = StaticMesh)
1310public:
1311
1312 bool GetLegacyTangentScaling() const
1313 {
1314 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::UseLegacyTangentScaling);
1318 }
1319
1321 {
1322 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::UseLegacyTangentScaling);
1326 }
1327
1329 UE_DEPRECATED(5.7, "Please do not access this member directly, it will become private soon; use the various RayTracingProxySettings accessors.")
1330 UPROPERTY(EditAnywhere, Category = RayTracingProxySettings)
1332
1335 {
1337 }
1339 {
1341 }
1343 {
1344 RayTracingProxySettings = Settings;
1345 }
1346
1348 {
1350 }
1351
1353 {
1354 FProperty* ChangedProperty = FindFProperty<FProperty>(UStaticMesh::StaticClass(), UStaticMesh::GetRayTracingProxySettingsMemberName());
1356 PostEditChangeProperty(Event);
1357 }
1359
1360
1361#endif // WITH_EDITORONLY_DATA
1362
1366 UPROPERTY(EditAnywhere, Category = RayTracing)
1368
1369 static FName GetSupportRayTracingMemberName()
1370 {
1372 }
1373
1374 UPROPERTY()
1375 uint8 bDoFastBuild : 1;
1376
1377private:
1378
1379 UPROPERTY()
1380 uint8 bIsBuiltAtRuntime_DEPRECATED : 1;
1381
1382public:
1383
1384 UE_DEPRECATED(5.0, "IsBuiltAtRuntime() is no longer used.")
1385 bool IsBuiltAtRuntime() const
1386 {
1387 return false;
1388 }
1389
1390 UE_DEPRECATED(5.0, "SetIsBuiltAtRuntime() is no longer used.")
1391 void SetIsBuiltAtRuntime(bool InIsBuiltAtRuntime)
1392 {
1393 }
1394protected:
1397
1398public:
1403 UPROPERTY(EditAnywhere, AdvancedDisplay, Category = StaticMesh)
1404 uint8 bAllowCPUAccess:1;
1405
1410 UPROPERTY(EditAnywhere, AdvancedDisplay, Category = StaticMesh)
1411 uint8 bSupportGpuUniformlyDistributedSampling : 1;
1412
1414 FRenderCommandFence ReleaseResourcesFence;
1415
1416#if WITH_EDITORONLY_DATA
1418 UE_DEPRECATED(5.7, "Please do not access this member directly, it will become private soon; use UStaticMesh::GetAssetImportData() or UStaticMesh::SetAssetImportData().")
1419 UPROPERTY(EditAnywhere, Instanced, Category=ImportSettings)
1421
1423 UE_DEPRECATED(5.7, "Do not access this member. It is not meant to be used outside of UStaticMesh.")
1424 UPROPERTY()
1426
1428 UE_DEPRECATED(5.7, "Do not access this member. It is not meant to be used outside of UStaticMesh.")
1429 UPROPERTY()
1431
1433 UE_DEPRECATED(5.7, "Please do not access this member directly, it will become private soon; use UStaticMesh::GetThumbnailInfo() or UStaticMesh::SetThumbnailInfo().")
1434 UPROPERTY(VisibleAnywhere, Instanced, AdvancedDisplay, Category=StaticMesh)
1436
1438 UE_DEPRECATED(5.7, "Please do not access this member directly, it will become private soon; use UStaticMesh::GetEditorCameraPosition() or UStaticMesh::SetEditorCameraPosition().")
1439 UPROPERTY()
1441
1443 UE_DEPRECATED(5.7, "Please do not access this member directly, it will become private soon; use UStaticMesh::GetCustomizedCollision() or UStaticMesh::SetCustomizedCollision().")
1444 UPROPERTY(EditAnywhere, Category = Collision)
1446#endif // WITH_EDITORONLY_DATA
1447
1448private:
1450 UE_DEPRECATED(5.0, "This must be protected for async build, always use the accessors even internally.")
1452public:
1453
1454 const FGuid& GetLightingGuid() const
1455 {
1456#if WITH_EDITORONLY_DATA
1457 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::LightingGuid);
1459 return LightingGuid;
1461#else
1462 static const FGuid NullGuid( 0, 0, 0, 0 );
1463 return NullGuid;
1464#endif // WITH_EDITORONLY_DATA
1465 }
1466
1468 {
1469#if WITH_EDITORONLY_DATA
1470 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::LightingGuid);
1474#endif // WITH_EDITORONLY_DATA
1475 }
1476
1481 UPROPERTY()
1483
1485 TSharedPtr<class FSpeedTreeWind> SpeedTreeWind;
1486
1488 UE_DEPRECATED(4.27, "Please do not access this member directly; use UStaticMesh::GetPositiveBoundsExtension() or UStaticMesh::SetPositiveBoundsExtension.")
1489 UPROPERTY(EditDefaultsOnly, AdvancedDisplay, Category = StaticMesh)
1491
1492 const FVector& GetPositiveBoundsExtension() const
1493 {
1494 // No need for WaitUntilAsyncPropertyReleased here as this is only read during async Build/Postload
1498 }
1499
1507
1514
1516 UE_DEPRECATED(4.27, "Please do not access this member directly; use UStaticMesh::GetNegativeBoundsExtension() or UStaticMesh::SetNegativeBoundsExtension.")
1517 UPROPERTY(EditDefaultsOnly, AdvancedDisplay, Category = StaticMesh)
1519
1520 const FVector& GetNegativeBoundsExtension() const
1521 {
1522 // No need for WaitUntilAsyncPropertyReleased here as this is not modified during async Build/Postload
1526 }
1527
1535
1542
1544 UE_DEPRECATED(5.0, "This must be protected for async build, always use the accessors even internally.")
1545 UPROPERTY()
1547public:
1548
1549 const FBoxSphereBounds& GetExtendedBounds() const
1550 {
1551 WaitUntilAsyncPropertyReleased(EStaticMeshAsyncProperties::ExtendedBounds);
1553 return ExtendedBounds;
1555 }
1556
1568
1569#if WITH_EDITOR
1571 FOnMeshChanged OnMeshChanged;
1572
1575#endif
1576
1577protected:
1578
1580 UPROPERTY(EditAnywhere, AdvancedDisplay, Instanced, Category = StaticMesh)
1582
1583 friend class FStaticMeshCompilingManager;
1584 friend class FStaticMeshAsyncBuildWorker;
1587
1588public:
1589#if WITH_EDITORONLY_DATA
1590 UPROPERTY(Instanced)
1592
1593 UPROPERTY(EditAnywhere, Category = Collision)
1595#endif
1596
1600 UE_DEPRECATED(4.24, "Please use FStaticMeshAttributes::Register to do this.")
1601 ENGINE_API static void RegisterMeshAttributes( FMeshDescription& MeshDescription );
1602
1603#if WITH_EDITORONLY_DATA
1604 /*
1605 * Return the MeshDescription associate to the LODIndex. The mesh description can be created on the fly if it was null
1606 * and there is a FRawMesh data for this LODIndex.
1607 */
1608 ENGINE_API FMeshDescription* GetMeshDescription(int32 LodIndex) const;
1609
1610 /*
1611 * Clone the MeshDescription associated to the LODIndex.
1612 *
1613 * This will make a copy of any pending mesh description that hasn't been committed or will deserialize
1614 * from the bulkdata or rawmesh directly if no current working copy exists.
1615 */
1617
1618 ENGINE_API bool IsMeshDescriptionValid(int32 LodIndex) const;
1621
1624 {
1626 : bMarkPackageDirty(true)
1627 , bUseHashAsGuid(false)
1628 {}
1629
1634 bool bMarkPackageDirty;
1635
1639 bool bUseHashAsGuid;
1640 };
1641
1648 ENGINE_API void CommitMeshDescription(int32 LodIndex, const FCommitMeshDescriptionParams& Params = FCommitMeshDescriptionParams());
1649
1654 ENGINE_API void ClearMeshDescription(int32 LodIndex);
1655
1660
1669
1673 ENGINE_API bool ModifyMeshDescription(int32 LodIndex, bool bAlwaysMarkDirty = true);
1674
1679
1684
1685
1690 class UAssetImportData* GetAssetImportData() const
1691 {
1692 return AssetImportData;
1693 }
1694
1699 {
1701 }
1702
1704 {
1706 }
1707
1711 class UThumbnailInfo* GetThumbnailInfo() const
1712 {
1713 return ThumbnailInfo;
1714 }
1715
1720 {
1722 }
1723
1725 {
1727 }
1728
1730 {
1731 return EditorCameraPosition;
1732 }
1733
1735 {
1737 }
1738
1740 {
1741 return bCustomizedCollision;
1742 }
1743
1745 {
1747 }
1749
1755 ENGINE_API bool AddUVChannel(int32 LODIndex);
1756
1763 ENGINE_API bool InsertUVChannel(int32 LODIndex, int32 UVChannelIndex);
1764
1771 ENGINE_API bool RemoveUVChannel(int32 LODIndex, int32 UVChannelIndex);
1772
1780 ENGINE_API bool SetUVChannel(int32 LODIndex, int32 UVChannelIndex, const TMap<FVertexInstanceID, FVector2D>& TexCoords);
1781
1789 ENGINE_API bool SetUVChannel(int32 LODIndex, int32 UVChannelIndex, const TMap<FVertexInstanceID, FVector2f>& TexCoords);
1790
1791#endif
1792
1794 UFUNCTION(BlueprintCallable, Category="StaticMesh")
1795 static ENGINE_API UStaticMeshDescription* CreateStaticMeshDescription(UObject* Outer = nullptr);
1796
1798 UFUNCTION(BlueprintCallable, Category="StaticMesh")
1799 ENGINE_API void BuildFromStaticMeshDescriptions(const TArray<UStaticMeshDescription*>& StaticMeshDescriptions, bool bBuildSimpleCollision = false, bool bFastBuild = true);
1800
1802 UFUNCTION(BlueprintCallable, Category="StaticMesh")
1803 ENGINE_API UStaticMeshDescription* GetStaticMeshDescription(int32 LODIndex);
1804
1806 {
1810 bool bUseHighPrecisionTangentBasis = false;
1811
1815 bool bUseFullPrecisionUVs = false;
1816 };
1817
1820 {
1822 : bMarkPackageDirty(true)
1823 , bUseHashAsGuid(false)
1824 , bBuildSimpleCollision(false)
1825 , bCommitMeshDescription(true)
1826 , bFastBuild(false)
1827 , bAllowCpuAccess(false)
1828 {}
1829
1835
1841
1846
1851
1857
1862
1867 };
1868
1873
1875 ENGINE_API void BuildFromMeshDescription(const FMeshDescription& MeshDescription, FStaticMeshLODResources& LODResources);
1876
1879
1886
1888private:
1889 UE_DEPRECATED(5.0, "This must be protected for async build, always use the accessors even internally.")
1890 UPROPERTY(VisibleAnywhere, transient, duplicatetransient, Instanced, Category = Navigation, meta = (EditCondition = "bHasNavigationData"))
1892
1893public:
1894 ENGINE_API void SetNavCollision(UNavCollisionBase*);
1895 ENGINE_API UNavCollisionBase* GetNavCollision() const;
1896 ENGINE_API FBox GetNavigationBounds(const FTransform& LocalToWorld) const;
1897 ENGINE_API bool IsNavigationRelevant() const;
1898
1903
1904 //~ Begin UObject Interface.
1905#if WITH_EDITOR
1907 ENGINE_API virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
1908 ENGINE_API virtual void PostEditUndo() override;
1909 ENGINE_API virtual EDataValidationResult IsDataValid(class FDataValidationContext& Context) const override;
1911
1912 ENGINE_API virtual void WillNeverCacheCookedPlatformDataAgain() override;
1913 ENGINE_API virtual void ClearCachedCookedPlatformData(const ITargetPlatform* TargetPlatform) override;
1914 ENGINE_API virtual void ClearAllCachedCookedPlatformData() override;
1915 ENGINE_API virtual void BeginCacheForCookedPlatformData(const ITargetPlatform* TargetPlatform) override;
1916 ENGINE_API virtual bool IsCachedCookedPlatformDataLoaded(const ITargetPlatform* TargetPlatform) override;
1917 ENGINE_API void SetLODGroup(FName NewGroup, bool bRebuildImmediately = true, bool bAllowModify = true);
1919
1921 FOnMeshChanged& GetOnMeshChanged() { return OnMeshChanged; }
1922
1923 /*
1924 * Add or change the LOD data specified by LodIndex with the content of the sourceStaticMesh.
1925 *
1926 * @Param SourceStaticMesh - The data we want to use to add or modify the specified lod
1927 * @Param LodIndex - The lod index we want to add or modify.
1928 * @Param SourceDataFilename - The source filename thta need to set into the LOD to allow re-import.
1929 */
1930 ENGINE_API bool SetCustomLOD(const UStaticMesh* SourceStaticMesh, int32 LodIndex, const FString& SourceDataFilename);
1931
1932 /*
1933 * Static function that remove any trailing unused material.
1934 *
1935 * @Param StaticMesh - The static mesh we want to remove the trailing materials.
1936 */
1938
1939 //SourceModels API
1940 ENGINE_API FStaticMeshSourceModel& AddSourceModel();
1941
1942 UFUNCTION(BlueprintCallable, Category="StaticMesh")
1943 ENGINE_API void SetNumSourceModels(int32 Num);
1944
1945 ENGINE_API void RemoveSourceModel(int32 Index);
1948 ENGINE_API const FStaticMeshSourceModel& GetSourceModel(int32 Index) const;
1949 ENGINE_API int32 GetNumSourceModels() const;
1950 ENGINE_API bool IsSourceModelValid(int32 Index) const;
1953
1958
1963
1964 ENGINE_API bool IsAsyncTaskComplete() const;
1965
1970
1972#endif // WITH_EDITOR
1973
1974 ENGINE_API virtual void Serialize(FArchive& Ar) override;
1975 ENGINE_API virtual void PostInitProperties() override;
1976 ENGINE_API virtual void PostLoad() override;
1977#if WITH_EDITORONLY_DATA
1980#endif
1981 ENGINE_API virtual bool IsPostLoadThreadSafe() const override;
1982 ENGINE_API virtual void BeginDestroy() override;
1983 ENGINE_API virtual bool IsReadyForFinishDestroy() override;
1984 ENGINE_API virtual void GetAssetRegistryTags(FAssetRegistryTagsContext Context) const override;
1985 UE_DEPRECATED(5.4, "Implement the version that takes FAssetRegistryTagsContext instead.")
1986 ENGINE_API virtual void GetAssetRegistryTags(TArray<FAssetRegistryTag>& OutTags) const override;
1987 ENGINE_API virtual FString GetDesc() override;
1989 ENGINE_API virtual bool CanBeClusterRoot() const override;
1990 //~ End UObject Interface.
1991
1992 //~ Begin UStreamableRenderAsset Interface
1993 ENGINE_API virtual int32 CalcCumulativeLODSize(int32 NumLODs) const final override;
1994 ENGINE_API virtual FIoFilenameHash GetMipIoFilenameHash(const int32 MipIndex) const final override;
1995 ENGINE_API virtual bool DoesMipDataExist(const int32 MipIndex) const final override;
1996 ENGINE_API virtual bool HasPendingRenderResourceInitialization() const final override;
1997 ENGINE_API virtual bool StreamOut(int32 NewMipCount) final override;
1998 ENGINE_API virtual bool StreamIn(int32 NewMipCount, bool bHighPrio) final override;
1999 ENGINE_API virtual EStreamableRenderAssetType GetRenderAssetType() const final override;
2000 //~ End UStreamableRenderAsset Interface
2001
2006 ENGINE_API static void CancelAllPendingStreamingActions();
2007
2012 {
2013 // Required to work around a Clang bug
2014#if PLATFORM_COMPILER_CLANG
2016 : bInSilent(false)
2017 , OutErrors(nullptr)
2018 , bInRebuildUVChannelData(false)
2019 , bInEnforceLightmapRestrictions(false)
2020 {
2022 bIgnoreBoundsDiff = false;
2024 }
2025#else
2026 FBuildParameters() = default;
2027#endif
2028
2030 {
2031 bInSilent = Other.bInSilent;
2032 OutErrors = Other.OutErrors;
2033 bInRebuildUVChannelData = Other.bInRebuildUVChannelData;
2034 bInEnforceLightmapRestrictions = Other.bInEnforceLightmapRestrictions;
2035
2037 bIgnoreBoundsDiff = Other.bIgnoreBoundsDiff;
2039 }
2040
2041 // If true will not popup a progress dialog.
2042 bool bInSilent = false;
2043
2044 // If provided, will contain the errors that occurred during this process.This will prevent async static mesh compilation because OutErrors could get out of scope.
2045 TArray<FText>* OutErrors = nullptr;
2046
2047 // Whether to completely rebuild the UV Channel data after the render data has been computed.
2048 bool bInRebuildUVChannelData = false;
2049
2050 // Whether to call EnforceLightmapRestrictions as part of the build process.
2051 bool bInEnforceLightmapRestrictions = false;
2052
2053 // Whether to avoid outputting a warning if the render data and MeshDescription bounds differ too much.
2054 UE_DEPRECATED(5.7, "This option no longer has any effect and will be removed in a future release.")
2055 bool bIgnoreBoundsDiff = false;
2056 };
2057
2063 ENGINE_API void Build(bool bInSilent, TArray<FText>* OutErrors = nullptr);
2064
2072 ENGINE_API static void BatchBuild(const TArray<UStaticMesh*>& InStaticMeshes, bool bInSilent, TFunction<bool(UStaticMesh*)> InProgressCallback = nullptr, TArray<FText>* OutErrors = nullptr);
2073
2078 ENGINE_API void Build(const FBuildParameters& BuildParameters = FBuildParameters());
2079
2086 ENGINE_API static void BatchBuild(const TArray<UStaticMesh*>& InStaticMeshes, const FBuildParameters& BuildParameters = FBuildParameters(), TFunction<bool(UStaticMesh*)> InProgressCallback = nullptr);
2087
2091 ENGINE_API virtual void InitResources();
2092
2096 ENGINE_API virtual void ReleaseResources();
2097
2103 ENGINE_API void UpdateUVChannelData(bool bRebuildAll);
2104
2113 ENGINE_API FBox GetMaterialBox(int32 MaterialIndex, const FTransform& Transform) const;
2114
2122 ENGINE_API const FMeshUVChannelInfo* GetUVChannelData(int32 MaterialIndex) const;
2123
2127 UFUNCTION(BlueprintPure, Category = StaticMesh)
2128 ENGINE_API int32 GetNumVertices(int32 LODIndex) const;
2129
2133 UFUNCTION(BlueprintPure, Category = StaticMesh)
2134 ENGINE_API int32 GetNumTriangles(int32 LODIndex) const;
2135
2139 ENGINE_API int32 GetNumTexCoords(int32 LODIndex) const;
2140
2144 ENGINE_API int32 GetNumNaniteVertices() const;
2145
2149 ENGINE_API int32 GetNumNaniteTriangles() const;
2150
2154 UFUNCTION(BlueprintPure, Category = "StaticMesh", meta=(ScriptName="GetNumLods"))
2155 ENGINE_API int32 GetNumLODs() const;
2156
2160 ENGINE_API bool HasValidRenderData(bool bCheckLODForVerts = true, int32 LODIndex = INDEX_NONE) const;
2161
2165 ENGINE_API bool HasValidNaniteData() const;
2166
2170 ENGINE_API bool HasNaniteFallbackMesh(EShaderPlatform ShaderPlatform) const;
2171
2177 UFUNCTION( BlueprintPure, Category="StaticMesh" )
2178 ENGINE_API FBoxSphereBounds GetBounds() const;
2179
2181 UFUNCTION(BlueprintPure, Category="StaticMesh")
2182 ENGINE_API FBox GetBoundingBox() const;
2183
2185 UFUNCTION(BlueprintPure, Category = "StaticMesh")
2186 ENGINE_API int32 GetNumSections(int32 InLOD) const;
2187
2193 UFUNCTION(BlueprintPure, Category = "StaticMesh")
2194 ENGINE_API UMaterialInterface* GetMaterial(int32 MaterialIndex) const;
2195
2199 UFUNCTION(BlueprintCallable, Category = "StaticMesh")
2201
2207 UFUNCTION(BlueprintPure, Category = "StaticMesh")
2208 ENGINE_API int32 GetMaterialIndex(FName MaterialSlotName) const;
2209
2210 ENGINE_API int32 GetMaterialIndexFromImportedMaterialSlotName(FName ImportedMaterialSlotName) const;
2211
2212
2213 ENGINE_API void GetUsedMaterials(TArray<UMaterialInterface*>& OutMaterials, TFunctionRef<UMaterialInterface*(int32)> OverrideMaterial) const;
2214
2219 ENGINE_API const FStaticMeshLODResources& GetLODForExport(int32 LODIndex) const;
2220
2231
2232 //~ Begin Interface_CollisionDataProvider Interface
2233 ENGINE_API virtual bool GetPhysicsTriMeshData(struct FTriMeshCollisionData* CollisionData, bool InUseAllTriData) override;
2234 ENGINE_API virtual bool ContainsPhysicsTriMeshData(bool InUseAllTriData) const override;
2235 ENGINE_API virtual bool PollAsyncPhysicsTriMeshData(bool InUseAllTriData) const override;
2237
2238private:
2239 bool GetPhysicsTriMeshDataCheckComplex(struct FTriMeshCollisionData* CollisionData, bool bInUseAllTriData, bool bInCheckComplexCollisionMesh);
2240 bool PollAsyncPhysicsTriMeshDataCheckComplex(bool InUseAllTriData, bool bInCheckComplexCollisionMesh) const;
2241 bool ContainsPhysicsTriMeshDataCheckComplex(bool InUseAllTriData, bool bInCheckComplexCollisionMesh) const;
2242 bool SectionHasCollisionEnabled(const FStaticMeshSection& Section, int32 LODIndex, int32 SectionIndex) const;
2243
2244public:
2245
2246 virtual bool WantsNegXTriMesh() override
2247 {
2248 return true;
2249 }
2250 ENGINE_API virtual void GetMeshId(FString& OutMeshId) override;
2251 //~ End Interface_CollisionDataProvider Interface
2252
2254 int32 GetNumSectionsWithCollision() const;
2255
2256 //~ Begin IInterface_AssetUserData Interface
2257 ENGINE_API virtual void AddAssetUserData(UAssetUserData* InUserData) override;
2258 ENGINE_API virtual void RemoveUserDataOfClass(TSubclassOf<UAssetUserData> InUserDataClass) override;
2259 ENGINE_API virtual UAssetUserData* GetAssetUserDataOfClass(TSubclassOf<UAssetUserData> InUserDataClass) override;
2260 ENGINE_API virtual const TArray<UAssetUserData*>* GetAssetUserDataArray() const override;
2261 //~ End IInterface_AssetUserData Interface
2262
2263
2267 ENGINE_API void CreateBodySetup();
2268
2272 ENGINE_API void CreateNavCollision(const bool bIsUpdate = false);
2273
2277 ENGINE_API void RecreateNavCollision();
2278
2280 ENGINE_API void MarkAsNotHavingNavigationData();
2281
2282
2286 UFUNCTION(BlueprintCallable, Category = "StaticMesh")
2287 ENGINE_API void AddSocket(UStaticMeshSocket* Socket);
2288
2293 UFUNCTION(BlueprintPure, Category = "StaticMesh")
2294 ENGINE_API class UStaticMeshSocket* FindSocket(FName InSocketName) const;
2295
2299 UFUNCTION(BlueprintCallable, Category = "StaticMesh")
2300 ENGINE_API void RemoveSocket(UStaticMeshSocket* Socket);
2301
2305 UFUNCTION(BlueprintPure, Category = "StaticMesh")
2306 ENGINE_API TArray<UStaticMeshSocket*> GetSocketsByTag(const FString& InSocketTag) const;
2307
2314 ENGINE_API void GetVertexColorData(TMap<FVector3f, FColor>& VertexColorData);
2315
2323 ENGINE_API void SetVertexColorData(const TMap<FVector3f, FColor>& VertexColorData);
2324
2326 ENGINE_API void RemoveVertexColors();
2327
2329 ENGINE_API void EnforceLightmapRestrictions(bool bUseRenderData = true);
2330
2332 ENGINE_API void CalculateExtendedBounds();
2333
2334 inline bool AreRenderingResourcesInitialized() const { return bRenderingResourcesInitialized; }
2335
2337 static FName GetLODPathName(const UStaticMesh* Mesh, int32 LODIndex);
2338
2339#if WITH_EDITOR
2340
2344 UFUNCTION(BlueprintCallable, Category = "StaticMesh")
2345 ENGINE_API void SetMaterial(int32 MaterialIndex, UMaterialInterface* NewMaterial);
2346
2351
2356
2361
2363
2364 ENGINE_API virtual void PostDuplicate(bool bDuplicateForPIE) override;
2365
2368
2371
2372
2373 /* Return true if the reduction settings are setup to reduce a LOD*/
2374 ENGINE_API bool IsReductionActive(int32 LODIndex) const;
2375
2376 /* Get a copy of the reduction settings for a specified LOD index. */
2377 ENGINE_API struct FMeshReductionSettings GetReductionSettings(int32 LODIndex) const;
2378
2380 bool GetEnableLODStreaming(const class ITargetPlatform* TargetPlatform) const;
2381
2382 /* Get a static mesh render data for requested platform. */
2384
2385private:
2390
2395
2400
2405
2409 bool CanBuild() const;
2410
2415
2419 bool ExecuteBuildInternal(const FBuildParameters& BuildParameters);
2420
2424 void FinishBuildInternal(const TArray<IStaticMeshComponent*>& InAffectedComponents, bool bHasRenderDataChanged, bool bShouldComputeExtendedBounds = true);
2425
2426#if WITH_EDITORONLY_DATA
2431#endif
2432
2433public:
2437 ENGINE_API void CacheDerivedData();
2438
2443
2448
2449private:
2450 // Filled at CommitDescription time and reused during build
2452
2453 // Notification about missing Nanite required shader models.
2455
2458
2461
2466
2470 bool bIsInPostEditChange = false;
2471#endif // #if WITH_EDITOR
2472
2476 void BeginPostLoadInternal(FStaticMeshPostLoadContext& Context);
2477
2481 void ExecutePostLoadInternal(FStaticMeshPostLoadContext& Context);
2482
2486 void FinishPostLoadInternal(FStaticMeshPostLoadContext& Context);
2487};
2488
2504
2512
2524
2537
2539{
2540#if WITH_EDITOR
2541 ENGINE_API FString BuildStaticMeshDerivedDataKey(const ITargetPlatform* TargetPlatform, UStaticMesh* Mesh, const FStaticMeshLODGroup& LODGroup);
2542#endif
2543}
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define check(expr)
Definition AssertionMacros.h:314
#define GET_MEMBER_NAME_CHECKED(ClassName, MemberName)
Definition AssertionMacros.h:493
void AsyncTask(ENamedThreads::Type Thread, TUniqueFunction< void()> Function)
Definition Async.cpp:54
virtual bool IsPostLoadThreadSafe() const override
uint32 FIoFilenameHash
Definition BulkData.h:68
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define WITH_EDITORONLY_DATA
Definition CoreMiscDefines.h:24
@ ForceInitToZero
Definition CoreMiscDefines.h:156
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define RETURN_QUICK_DECLARE_CYCLE_STAT(StatId, GroupId)
Definition Stats.h:655
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE::FPlatformRecursiveMutex FCriticalSection
Definition CriticalSection.h:53
#define DECLARE_MULTICAST_DELEGATE(DelegateName)
Definition DelegateCombinations.h:23
#define DECLARE_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type)
Definition DelegateCombinations.h:49
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
FArchive & operator<<(FArchive &Ar, FEnvQueryDebugProfileData::FStep &Data)
Definition EnvQueryTypes.cpp:489
return true
Definition ExternalRpcRegistry.cpp:601
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
@ Num
Definition MetalRHIPrivate.h:234
const bool
Definition NetworkReplayStreaming.h:178
#define MAX_uint32
Definition NumericLimits.h:21
#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 UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
EPerQualityLevels
Definition PerQualityLevelProperties.h:26
EShaderPlatform
Definition RHIShaderPlatform.h:11
EImportanceLevel
Definition StaticMesh.h:241
@ IL_Normal
Definition StaticMesh.h:245
@ TEMP_BROKEN2
Definition StaticMesh.h:248
@ EImportanceLevel_MAX
Definition StaticMesh.h:249
@ IL_High
Definition StaticMesh.h:246
@ IL_Low
Definition StaticMesh.h:244
@ IL_Highest
Definition StaticMesh.h:247
@ IL_Off
Definition StaticMesh.h:242
@ IL_Lowest
Definition StaticMesh.h:243
EStaticMeshPaintSupport
Definition StaticMesh.h:573
EStaticMeshAsyncProperties
Definition StaticMesh.h:50
ENormalMode
Definition StaticMesh.h:230
@ NM_RecalculateNormalsSmooth
Definition StaticMesh.h:233
@ ENormalMode_MAX
Definition StaticMesh.h:236
@ NM_RecalculateNormalsHard
Definition StaticMesh.h:234
@ TEMP_BROKEN
Definition StaticMesh.h:235
@ NM_PreserveSmoothingGroups
Definition StaticMesh.h:231
@ NM_RecalculateNormals
Definition StaticMesh.h:232
EOptimizationType
Definition StaticMesh.h:255
@ OT_MAX
Definition StaticMesh.h:258
@ OT_NumOfTriangles
Definition StaticMesh.h:256
@ OT_MaxDeviation
Definition StaticMesh.h:257
EImportStaticMeshVersion
Definition StaticMesh.h:539
@ RemoveStaticMeshSkinxxWorkflow
Definition StaticMesh.h:543
@ BeforeImportStaticMeshVersionWasAdded
Definition StaticMesh.h:541
@ StaticMeshVersionPlusOne
Definition StaticMesh.h:544
@ LastVersion
Definition StaticMesh.h:545
EStreamableRenderAssetType
Definition StreamableRenderAsset.h:26
EDataValidationResult
Definition UObjectGlobals.h:4225
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
FRWLock Lock
Definition UnversionedPropertySerialization.cpp:921
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Engine.Build.cs:7
Definition Archive.h:1208
Definition AssetRegistryTagsContext.h:98
Definition AsyncWork.h:585
Definition DataValidation.h:40
Definition NameTypes.h:617
Definition AsyncWork.h:663
Definition UObjectGlobals.h:1292
Definition UnrealType.h:174
Definition RenderCommandFence.h:15
Definition ScopeLock.h:141
Definition SpeedTreeWind.h:29
Definition StaticMesh.h:2514
UStaticMesh::FBuildParameters BuildParameters
Definition StaticMesh.h:2521
FStaticMeshBuildContext(const UStaticMesh::FBuildParameters &InBuildParameters)
Definition StaticMesh.h:2516
bool bHasRenderDataChanged
Definition StaticMesh.h:2522
Definition StaticMesh.h:2490
bool bShouldComputeExtendedBounds
Definition StaticMesh.h:2500
FStaticMeshCompilationContext(const FStaticMeshCompilationContext &)=delete
FStaticMeshCompilationContext()
Definition StaticMesh.cpp:10633
bool bIsEditorLoadingPackage
Definition StaticMesh.h:2501
FStaticMeshCompilationContext(FStaticMeshCompilationContext &&)=delete
FStaticMeshCompilationContext & operator=(const FStaticMeshCompilationContext &)=delete
FStaticMeshCompilationContext & operator=(FStaticMeshCompilationContext &&)=delete
UE::Tasks::FCancellationToken CancellationToken
Definition StaticMesh.h:2502
Definition StaticMeshResources.h:67
Definition StaticMesh.h:2506
bool bIsCookedForEditor
Definition StaticMesh.h:2510
bool bNeedsMaterialFixup
Definition StaticMesh.h:2509
bool bNeedsMeshUVDensityFix
Definition StaticMesh.h:2508
Definition StaticMeshResources.h:774
Definition StaticMeshUpdate.h:54
Definition Text.h:385
Definition IConsoleManager.h:558
Definition Interface_AssetUserData.h:20
Definition Interface_AsyncCompilation.h:21
Definition Interface_CollisionDataProvider.h:23
Definition ComponentInterfaces.h:115
Definition Sockets.Build.cs:6
Definition Array.h:670
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
Definition EnumAsByte.h:22
Definition AssetRegistryState.h:50
Definition AndroidPlatformMisc.h:14
Definition UnrealString.h.inl:34
Definition SharedPointer.h:692
Definition SubclassOf.h:30
Definition UniquePtr.h:107
Definition SharedPointer.h:1295
Definition AssetImportData.h:72
Definition AssetUserData.h:18
Definition BodySetup.h:128
Definition Class.h:3793
Definition Task.h:570
int32 Find(CharRangeType &&SubStr, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase, ESearchDir::Type SearchDir=ESearchDir::FromStart, int32 StartPosition=INDEX_NONE) const
Definition UnrealString.h.inl:1116
Definition MaterialInterface.h:296
Definition NavCollisionBase.h:23
Definition Object.h:95
Definition Package.h:216
Definition StaticMeshDescription.h:28
Definition StaticMeshSocket.h:16
Definition StaticMesh.h:593
float GetLightmapUVDensity() const
Definition StaticMesh.h:1148
void SetQualityLevelMinLOD(FPerQualityLevelInt InMinLOD)
Definition StaticMesh.h:893
static FName GetBodySetupName()
Definition StaticMesh.h:1256
static FName GetLightMapResolutionName()
Definition StaticMesh.h:1176
void SetBodySetup(UBodySetup *InBodySetup)
Definition StaticMesh.h:1248
static FName GetNegativeBoundsExtensionName()
Definition StaticMesh.h:1536
void SetLightMapCoordinateIndex(int32 InLightMapCoordinateIndex)
Definition StaticMesh.h:1196
uint8 bRenderingResourcesInitialized
Definition StaticMesh.h:1396
void SetLightingGuid(const FGuid &InLightingGuid=FGuid::NewGuid())
Definition StaticMesh.h:1467
const TArray< FStaticMaterialMinimalInfo > GetCopyOfStaticMaterialsInfo() const
Definition StaticMesh.h:1100
static FName GetStaticMaterialsName()
Definition StaticMesh.h:1093
UE_DEPRECATED(4.27, "Please do not access this member directly; use UStaticMesh::GetMinLOD() or UStaticMesh::SetMinLOD().") FPerPlatformInt MinLOD
bool IsNaniteLandscape() const
Definition StaticMesh.h:1069
void SetExtendedBounds(const FBoxSphereBounds &InExtendedBounds)
Definition StaticMesh.h:1557
static FName GetPositiveBoundsExtensionName()
Definition StaticMesh.h:1508
UE_DEPRECATED(4.27, "Please do not access this member directly; use UStaticMesh::GetLightMapResolution() or UStaticMesh::SetLightMapResolution().") int32 LightMapResolution
const FPerQualityLevelInt & GetQualityLevelMinLOD() const
Definition StaticMesh.h:888
static ENGINE_API float ComputeLODScreenSize(int32 LODIndex, float PreviousLODScreenSize=-1.0f)
UE_DEPRECATED(4.27, "Please do not access this member directly; use UStaticMesh::GetLightMapCoordinateIndex() or UStaticMesh::SetLightMapCoordinateIndex().") int32 LightMapCoordinateIndex
TArray< FStaticMaterial > & GetStaticMaterials()
Definition StaticMesh.h:1108
void SetPositiveBoundsExtension(FVector InPositiveBoundsExtension)
Definition StaticMesh.h:1500
void SetNegativeBoundsExtension(FVector InNegativeBoundsExtension)
Definition StaticMesh.h:1528
ENGINE_API int32 GetNumUVChannels(int32 LODIndex) const
static FName GetLightMapCoordinateIndexName()
Definition StaticMesh.h:1204
void SetLightMapResolution(int32 InLightMapResolution)
Definition StaticMesh.h:1168
bool HasAnyDependenciesCompiling() const
Definition StaticMesh.h:631
UFUNCTION(BlueprintCallable, Category=StaticMesh, Meta=(ToolTip="Allow to override min lod quality levels on a staticMesh and it Default value (-1 value for Default dont override its value).")) void SetMinLODForQualityLevels(const TMap< EPerQualityLevels
bool IsCompiling() const
Definition StaticMesh.h:630
void SetMinLOD(FPerPlatformInt InMinLOD)
Definition StaticMesh.h:965
Definition StreamableRenderAsset.h:37
Definition ThumbnailInfo.h:16
FName QualityLevelToFName(int32 QL)
Definition PerQualityLevelProperties.cpp:47
TMap< int32, _ValueType > ConvertQualityLevelData(const TMap< EPerQualityLevels, _ValueType > &Data)
Definition PerQualityLevelProperties.cpp:22
int32 FNameToQualityLevel(FName QL)
Definition PerQualityLevelProperties.cpp:59
Definition SceneManagement.h:73
Version
Definition NNEModelData.cpp:15
Definition StaticMesh.h:2539
@ false
Definition radaudio_common.h:23
U16 Index
Definition radfft.cpp:71
Definition DetourTileCache.cpp:72
Definition StaticMesh.h:441
FAssetEditorOrbitCameraPosition(const FVector &InCamOrbitPoint, const FVector &InCamOrbitZoom, const FRotator &InCamOrbitRotation)
Definition StaticMesh.h:452
Definition Color.h:486
Definition Guid.h:109
static CORE_API FGuid NewGuid()
Definition Guid.cpp:236
Definition StaticMesh.h:550
FMaterialRemapIndex(uint32 VersionKey, TArray< int32 > RemapArray)
Definition StaticMesh.h:558
Definition MeshDescription.h:94
Definition EngineTypes.h:3040
Definition EngineTypes.h:3294
Definition MeshReductionSettings.h:35
Definition StaticMesh.h:404
Definition StaticMesh.h:345
friend bool operator!=(const FMeshSectionInfo &A, const FMeshSectionInfo &B)
friend bool operator==(const FMeshSectionInfo &A, const FMeshSectionInfo &B)
FMeshSectionInfo(int32 InMaterialIndex)
Definition StaticMesh.h:384
Definition MeshUVChannelInfo.h:13
Definition PerPlatformProperties.h:211
Definition PerQualityLevelProperties.h:233
Definition UnrealType.h:6865
Definition ResourceArray.h:31
Definition ResourceSize.h:31
Definition StaticMesh.h:527
FName MaterialSlotName
Definition StaticMesh.h:534
FString MaterialObjectPath
Definition StaticMesh.h:535
Definition StaticMesh.h:487
Definition StaticMesh.h:2526
const ITargetPlatform * TargetPlatform
Definition StaticMesh.h:2534
FStaticMeshBuildParameters(UStaticMesh *InStaticMesh, const ITargetPlatform *InTargetPlatform, const FStaticMeshLODGroup &InLODGroup)
Definition StaticMesh.h:2527
const FStaticMeshLODGroup & LODGroup
Definition StaticMesh.h:2535
UStaticMesh * StaticMesh
Definition StaticMesh.h:2533
Definition StaticMeshResources.h:426
Definition StaticMesh.h:264
bool bRecalcNormals
Definition StaticMesh.h:285
uint8 TextureImportance
Definition StaticMesh.h:298
TEnumAsByte< enum EOptimizationType > ReductionMethod
Definition StaticMesh.h:269
uint8 SilhouetteImportance
Definition StaticMesh.h:294
float MaxDeviationPercentage
Definition StaticMesh.h:277
uint8 ShadingImportance
Definition StaticMesh.h:302
float WeldingThreshold
Definition StaticMesh.h:281
float NumOfTrianglesPercentage
Definition StaticMesh.h:273
float NormalsThreshold
Definition StaticMesh.h:290
friend FArchive & operator<<(FArchive &Ar, FStaticMeshOptimizationSettings &Settings)
Definition StaticMesh.h:319
Definition StaticMeshResources.h:202
Definition StaticMeshSourceData.h:37
Definition StaticMeshUpdate.h:22
Definition Interface_CollisionDataProviderCore.h:68
Definition Interface_CollisionDataProviderCore.h:28
Definition ObjectPtr.h:488
Definition Optional.h:131
Definition LightweightStats.h:416
Definition Tuple.h:652
Definition BoxSphereBounds.h:25
Definition StaticMesh.h:1820
bool bCommitMeshDescription
Definition StaticMesh.h:1850
TArray< FBuildMeshDescriptionsLODParams > PerLODOverrides
Definition StaticMesh.h:1866
FBuildMeshDescriptionsParams()
Definition StaticMesh.h:1821
bool bBuildSimpleCollision
Definition StaticMesh.h:1845
bool bMarkPackageDirty
Definition StaticMesh.h:1834
bool bAllowCpuAccess
Definition StaticMesh.h:1861
bool bUseHashAsGuid
Definition StaticMesh.h:1840
bool bFastBuild
Definition StaticMesh.h:1856
Definition StaticMesh.h:2012
FBuildParameters(const FBuildParameters &Other)
Definition StaticMesh.h:2029