Header <Components/StaticMeshComponent.h>

#include "Components/StaticMeshComponent.h"
Module: Engine Source: Engine/Source/Runtime/Engine/Classes/Components/StaticMeshComponent.h

Includes 17

<CoreMinimal.h>
<RHIResources.h>
<UObject/ObjectMacros.h>
<UObject/Object.h>
<Misc/Guid.h>
<UObject/Class.h>
<Engine/EngineTypes.h>
<Engine/TextureStreamingTypes.h>
<Components/MeshComponent.h>
<Components/ActorStaticMeshComponentInterface.h>
<PackedNormal.h>
<Templates/UniquePtr.h>
<Runtime/Launch/Resources/Version.h>
<UObject/RenderingObjectVersion.h>
<SceneTypes.h>
<DrawDebugHelpers.h>
<StateStream/StaticMeshStateStreamHandle.h>

Contents

UStaticMeshComponent
StaticMeshComponent is used to create an instance of a UStaticMesh. A static mesh is a piece of geometry that consists of a static set of polygons.
(uclass class : UMeshComponent)

class UStaticMeshComponent

class UStaticMeshComponent : public UMeshComponentUCLASSBlueprintableClassGroup=(Rendering, Common)hidecategories=(Object,Activation,Components|Activation)ShowCategories=(Mobility)editinlinenewMinimalAPI
StaticMeshComponent is used to create an instance of a UStaticMesh. A static mesh is a piece of geometry that consists of a static set of polygons.

Constructors 1

~UStaticMeshComponent

Member functions 132

OnRep_StaticMesh
void OnRep_StaticMesh(class UStaticMesh *OldStaticMesh);UFUNCTION
SetStaticMesh
virtual bool SetStaticMesh(class UStaticMesh* NewMesh);UFUNCTIONBlueprintCallableCategory=Components|StaticMesh
Change the StaticMesh used by this instance.
GetStaticMesh
TObjectPtr<UStaticMesh> GetStaticMesh() const;
Get the StaticMesh used by this instance.
GetNaniteResources
virtual const Nanite::FResources* GetNaniteResources() const;
HasValidNaniteData
virtual bool HasValidNaniteData() const;
Returns true if the component has valid Nanite render data.
UseNaniteOverrideMaterials
virtual bool UseNaniteOverrideMaterials() const override;
Determines if we use the nanite overrides from any materials
SetForcedLodModel
void SetForcedLodModel(int32 NewForcedLodModel);UFUNCTIONBlueprintCallableCategory=Rendering|LOD
SetDistanceFieldSelfShadowBias
void SetDistanceFieldSelfShadowBias(float NewValue);UFUNCTIONBlueprintCallableCategory=Rendering|Lighting
Sets the component's DistanceFieldSelfShadowBias. bOverrideDistanceFieldSelfShadowBias must be enabled for this to have an effect.
SetEvaluateWorldPositionOffsetInRayTracing
void SetEvaluateWorldPositionOffsetInRayTracing(bool NewValue);UFUNCTIONBlueprintCallableCategory=RayTracing
SetEvaluateWorldPositionOffset
void SetEvaluateWorldPositionOffset(bool NewValue);UFUNCTIONBlueprintCallableCategory=Rendering|LOD
SetWorldPositionOffsetDisableDistance
void SetWorldPositionOffsetDisableDistance(int32 NewValue);UFUNCTIONBlueprintCallableCategory=Rendering|LOD
GetInitialEvaluateWorldPositionOffset
bool GetInitialEvaluateWorldPositionOffset();UFUNCTIONBlueprintCallableCategory=Rendering|LOD
Get the initial value of bEvaluateWorldPositionOffset. This is the value when BeginPlay() was last called, or if UpdateInitialEvaluateWorldPositionOffset is called.
UpdateInitialEvaluateWorldPositionOffset
void UpdateInitialEvaluateWorldPositionOffset();UFUNCTIONBlueprintCallableCategory=Rendering|LOD
This manually updates the initial value of bEvaluateWorldPositionOffset to be the current value. This is useful if the default value of bEvaluateWorldPositionOffset is changed after constructing the component.
GetLocalBounds
void GetLocalBounds(FVector& Min, FVector& Max) const;UFUNCTIONBlueprintCallableCategory=Components|StaticMesh
Get Local bounds
SetReverseCulling
void SetReverseCulling(bool ReverseCulling);UFUNCTIONBlueprintCallableCategory=Rendering|Lighting
Set forced reverse culling
SetForceDisableNanite
void SetForceDisableNanite(bool bInForceDisableNanite);UFUNCTIONBlueprintCallableCategory=Rendering
Force disabling of Nanite rendering. When true, Will swap to the the fallback mesh instead.
SetCollisionProfileName
virtual void SetCollisionProfileName(FName InCollisionProfileName, bool bUpdateOverlaps=true) override;
BeginDestroy
virtual void BeginDestroy() override;
ExportCustomProperties
virtual void ExportCustomProperties(FOutputDevice& Out, uint32 Indent) override;
ImportCustomProperties
virtual void ImportCustomProperties(const TCHAR* SourceText, FFeedbackContext* Warn) override;
Serialize
virtual void Serialize(FArchive& Ar) override;
PostInitProperties
virtual void PostInitProperties() override;
PostReinitProperties
virtual void PostReinitProperties() override;
PostApplyToComponent
virtual void PostApplyToComponent() override;
PostLoad
virtual void PostLoad() override;
IsPostLoadThreadSafe
virtual bool IsPostLoadThreadSafe() const override;
AreNativePropertiesIdenticalTo
virtual bool AreNativePropertiesIdenticalTo(UObject* Other) const override;
GetDetailedInfoInternal
virtual FString GetDetailedInfoInternal() const override;
CalcBounds
virtual FBoxSphereBounds CalcBounds(const FTransform& LocalToWorld) const override;
HasAnySockets
virtual bool HasAnySockets() const override;
QuerySupportedSockets
virtual void QuerySupportedSockets(TArray<FComponentSocketDescription>& OutSockets) const override;
GetSocketTransform
virtual FTransform GetSocketTransform(FName InSocketName, ERelativeTransformSpace TransformSpace = RTS_World) const override;
DoesSocketExist
virtual bool DoesSocketExist(FName InSocketName) const override;
ShouldCollideWhenPlacing
virtual bool ShouldCollideWhenPlacing() const override;
OnUnregister
virtual void OnUnregister() override;
BeginPlay
virtual void BeginPlay() override;
RequiresGameThreadEndOfFrameRecreate
virtual bool RequiresGameThreadEndOfFrameRecreate() const override;
CreateRenderState_Concurrent
virtual void CreateRenderState_Concurrent(FRegisterComponentContext* Context) override;
OnCreatePhysicsState
virtual void OnCreatePhysicsState() override;
OnDestroyPhysicsState
virtual void OnDestroyPhysicsState() override;
OnAsyncDestroyPhysicsStateEnd_GameThread
virtual void OnAsyncDestroyPhysicsStateEnd_GameThread() override;
ShouldCreatePhysicsState
virtual bool ShouldCreatePhysicsState() const override;
ShouldCreateRenderState
virtual bool ShouldCreateRenderState() const override;
ShouldIncrementalPreRegister
virtual bool ShouldIncrementalPreRegister(UWorld* WorldContext) const override;
GetDefaultMaterialSlotsOverlayMaterial
virtual void GetDefaultMaterialSlotsOverlayMaterial(TArray<TObjectPtr<UMaterialInterface>>& OutMaterialSlotOverlayMaterials) const override;
Get all default LOD sections overlay materials used by a mesh.
AllowsAsyncPhysicsStateCreation
virtual bool AllowsAsyncPhysicsStateCreation() const override;
AllowsAsyncPhysicsStateDestruction
virtual bool AllowsAsyncPhysicsStateDestruction() const override;
PrecachePSOs
virtual void PrecachePSOs() override;
InvalidateLightingCacheDetailed
virtual void InvalidateLightingCacheDetailed(bool bInvalidateBuildEnqueuedLighting, bool bTranslationOnly) override;
AdditionalStatObject
virtual UObject const* AdditionalStatObject() const override;
GetComponentInstanceData
virtual TStructOnScope<FActorComponentInstanceData> GetComponentInstanceData() const override;
IsHLODRelevant
virtual bool IsHLODRelevant() const override;
GetNumMaterials
virtual int32 GetNumMaterials() const override;
GetEmissiveBoost
virtual float GetEmissiveBoost(int32 ElementIndex) const override;
GetDiffuseBoost
virtual float GetDiffuseBoost(int32 ElementIndex) const override;
GetShadowIndirectOnly
virtual bool GetShadowIndirectOnly() const override;
GetStaticLightingType
virtual ELightMapInteractionType GetStaticLightingType() const override;
IsPrecomputedLightingValid
virtual bool IsPrecomputedLightingValid() const override;
GetTextureStreamingTransformScale
virtual float GetTextureStreamingTransformScale() const;
Get the scale comming form the component, when computing StreamingTexture data. Used to support instanced meshes.
GetMaterialStreamingData
virtual bool GetMaterialStreamingData(int32 MaterialIndex, FPrimitiveMaterialInfo& MaterialData) const override;
Get material, UV density and bounds for a given material index.
BuildTextureStreamingDataImpl
virtual bool BuildTextureStreamingDataImpl(ETextureStreamingBuildType BuildType, EMaterialQualityLevel::Type QualityLevel, ERHIFeatureLevel::Type FeatureLevel, TSet<FGuid>& DependentResources, bool& bOutSupportsBuildTextureStreamingData) override;
Build the data to compute accuracte StreaminTexture data.
GetStreamingRenderAssetInfo
virtual void GetStreamingRenderAssetInfo(FStreamingTextureLevelContext& LevelContext, TArray<FStreamingRenderAssetPrimitiveInfo>& OutStreamingRenderAssets) const override;
Get the StreaminTexture data.
GetUsedTextures
virtual void GetUsedTextures(TArray<UTexture*>& OutTextures, EMaterialQualityLevel::Type QualityLevel) override;
GetBodySetup
virtual class UBodySetup* GetBodySetup() override;
CanEditSimulatePhysics
virtual bool CanEditSimulatePhysics() override;
CreateSceneProxy
virtual FPrimitiveSceneProxy* CreateSceneProxy() override;
ShouldRecreateProxyOnUpdateTransform
virtual bool ShouldRecreateProxyOnUpdateTransform() const override;
UsesOnlyUnlitMaterials
virtual bool UsesOnlyUnlitMaterials() const override;
GetLightMapResolution
virtual bool GetLightMapResolution(int32& Width, int32& Height) const override;
GetStaticLightMapResolution
virtual int32 GetStaticLightMapResolution() const override;
HasValidSettingsForStaticLighting
virtual bool HasValidSettingsForStaticLighting(bool bOverlookInvalidComponents) const override;
Returns true if the component is static AND has the right static mesh setup to support lightmaps.
GetLightAndShadowMapMemoryUsage
virtual void GetLightAndShadowMapMemoryUsage(int32& LightMapMemoryUsage, int32& ShadowMapMemoryUsage) const override;
GetUsedMaterials
virtual void GetUsedMaterials(TArray<UMaterialInterface*>& OutMaterials, bool bGetDebugMaterials = false) const final;
GetMaterial
virtual UMaterialInterface* GetMaterial(int32 MaterialIndex) const final;
GetMaterialIndex
virtual int32 GetMaterialIndex(FName MaterialSlotName) const override;
GetMaterialFromCollisionFaceIndex
virtual UMaterialInterface* GetMaterialFromCollisionFaceIndex(int32 FaceIndex, int32& SectionIndex) const override;
GetMaterialSlotNames
virtual TArray<FName> GetMaterialSlotNames() const override;
IsMaterialSlotNameValid
virtual bool IsMaterialSlotNameValid(FName MaterialSlotName) const override;
DoCustomNavigableGeometryExport
virtual bool DoCustomNavigableGeometryExport(FNavigableGeometryExport& GeomExport) const override;
IsShown
virtual bool IsShown(const FEngineShowFlags& ShowFlags) const override;
GetStreamingScale
virtual float GetStreamingScale() const override;
SupportsWorldPositionOffsetVelocity
virtual bool SupportsWorldPositionOffsetVelocity() const override;
GetPrimitiveStats
virtual void GetPrimitiveStats(FPrimitiveStats& PrimitiveStats) const override;
RegisterLODStreamingCallback
virtual void RegisterLODStreamingCallback(FLODStreamingCallback&& Callback, int32 LODIdx, float TimeoutSecs, bool bOnStreamIn) override;
virtual void RegisterLODStreamingCallback(FLODStreamingCallback&& CallbackStreamingStart, FLODStreamingCallback&& CallbackStreamingDone, float TimeoutStartSecs, float TimeoutDoneSecs) override;
PrestreamMeshLODs
virtual bool PrestreamMeshLODs(float Seconds) override;
GetMeshPaintTexture
virtual UTexture* GetMeshPaintTexture() const override;
SetMeshPaintTexture
virtual void SetMeshPaintTexture(UTexture* Texture) override;
SetMeshPaintTextureOverride
virtual void SetMeshPaintTextureOverride(UTexture* OverrideTexture) override;
GetMeshPaintTextureCoordinateIndex
virtual int32 GetMeshPaintTextureCoordinateIndex() const override;
IsNavigationRelevant
virtual bool IsNavigationRelevant() const override;
GetNavigationBounds
virtual FBox GetNavigationBounds() const override;
GetNavigationData
virtual void GetNavigationData(FNavigationRelevantData& Data) const override;
UsesTextureLightmaps
virtual bool UsesTextureLightmaps(int32 InWidth, int32 InHeight) const;
Returns true if the component uses texture lightmaps
HasLightmapTextureCoordinates
virtual bool HasLightmapTextureCoordinates() const;
Returns true if the static mesh the component uses has valid lightmap texture coordinates
GetTextureLightAndShadowMapMemoryUsage
virtual void GetTextureLightAndShadowMapMemoryUsage(int32 InWidth, int32 InHeight, int32& OutLightMapMemoryUsage, int32& OutShadowMapMemoryUsage) const;
Get the memory used for texture-based light and shadow maps of the given width and height
GetEstimatedLightMapResolution
virtual void GetEstimatedLightMapResolution(int32& Width, int32& Height) const;
Returns the lightmap resolution used for this primitive instance in the case of it supporting texture light/ shadow maps. This will return the value assuming the primitive will be automatically switched to use…
GetEstimatedLightAndShadowMapMemoryUsage
virtual bool GetEstimatedLightAndShadowMapMemoryUsage(int32& TextureLightMapMemoryUsage, int32& TextureShadowMapMemoryUsage, int32& VertexLightMapMemoryUsage, int32& VertexShadowMapMemoryUsage, int32& StaticLightingResolution, bool& bIsUsingTextureMapping, bool& bHasLightmapTexCoords) const;
Returns the light and shadow map memory for this primite in its out variables.
RemoveInstanceVertexColorsFromLOD
void RemoveInstanceVertexColorsFromLOD(int32 LODToRemoveColorsFrom);
Removes instance vertex colors from the specified LOD
UpdateCollisionFromStaticMesh
void UpdateCollisionFromStaticMesh();
Sets the BodyInstance to use the mesh's body setup for external collision information
SupportsDefaultCollision
virtual bool SupportsDefaultCollision();
Whether or not the component supports default collision from its static mesh asset
SupportsDitheredLODTransitions
virtual bool SupportsDitheredLODTransitions(ERHIFeatureLevel::Type FeatureLevel);
Whether we can support dithered LOD transitions (default behavior checks all materials). Used for HISMC LOD.
GetNaniteAuditMaterial
UMaterialInterface* GetNaniteAuditMaterial(int32 MaterialIndex) const;
CanMeshPaintVertexColors
bool CanMeshPaintVertexColors() const;
Returns true if mesh vertex color painting is supported on this component.
CanMeshPaintTextureColors
bool CanMeshPaintTextureColors() const;
Returns true if mesh texture color painting is supported on this component.
GetMeshPaintTextureResolution
int32 GetMeshPaintTextureResolution() const;
Returns the size to use when creating a mesh paint texture on this component.
IsReverseCulling
bool IsReverseCulling() const;
IsDisallowNanite
bool IsDisallowNanite() const;
IsForceDisableNanite
bool IsForceDisableNanite() const;
IsForceNaniteForMasked
bool IsForceNaniteForMasked() const;
GetForcedLodModel
int32 GetForcedLodModel() const;
GetOverrideMinLOD
bool GetOverrideMinLOD() const;
GetMinLOD
int32 GetMinLOD() const;
GetForceNaniteForMasked
bool GetForceNaniteForMasked() const;
CollectPSOPrecacheData
virtual void CollectPSOPrecacheData(const FPSOPrecacheParams& BasePrecachePSOParams, FMaterialInterfacePSOPrecacheParamsList& OutParams) override;protected
Collect all the PSO precache data used by the static mesh component
CollectPSOPrecacheDataImpl
void CollectPSOPrecacheDataImpl(const FVertexFactoryType* VFType, const FPSOPrecacheParams& BasePrecachePSOParams, GetPSOVertexElementsFn GetVertexElements, FMaterialInterfacePSOPrecacheParamsList& OutParams) const;protected
SupportsStaticLighting
virtual bool SupportsStaticLighting() const override;protected
Whether the component type supports static lighting.
ShouldCreateNaniteProxy
bool ShouldCreateNaniteProxy(Nanite::FMaterialAudit* OutNaniteMaterials = nullptr) const;protected
CreateStaticMeshSceneProxy
virtual FPrimitiveSceneProxy* CreateStaticMeshSceneProxy(Nanite::FMaterialAudit& NaniteMaterials, bool bCreateNanite);protected
Overload this in child implementations that wish to extend Static Mesh or Nanite scene proxy implementations
ShouldExportAsObstacle
bool ShouldExportAsObstacle(const UNavCollisionBase& InNavCollision) const;protected
ReleaseResources
void ReleaseResources();
AllocateStaticLightingMesh
virtual FStaticMeshStaticLightingMesh* AllocateStaticLightingMesh(int32 LODIndex, const TArray<ULightComponent*>& InRelevantLights);
Allocates an implementation of FStaticLightingMesh that will handle static lighting for this component
SetLODDataCount
bool SetLODDataCount(const uint32 MinSize, const uint32 MaxSize);
Add or remove elements to have the size in the specified range. Reconstructs elements if MaxSize<MinSize. Returns true if an element was added or removed.
SetStaticLightingMapping
virtual bool SetStaticLightingMapping(bool bTextureMapping, int32 ResolutionToUse);
Switches the static mesh component to use either Texture or Vertex static lighting.
GetSocketByName
class UStaticMeshSocket const* GetSocketByName(FName InSocketName) const;
Returns the named socket on the static mesh component.
GetWireframeColor
FColor GetWireframeColor() const;
Returns the wireframe color to use for this component.
GetBlueprintCreatedComponentIndex
int32 GetBlueprintCreatedComponentIndex() const;
Get this components index in its parents blueprint created components array (used for matching instance data)
ApplyComponentInstanceData
void ApplyComponentInstanceData(struct FStaticMeshComponentInstanceData* ComponentInstanceData);
PropagateLightingScenarioChange
virtual void PropagateLightingScenarioChange() override;
GetMeshMapBuildData
const FMeshMapBuildData* GetMeshMapBuildData(const FStaticMeshComponentLODInfo& LODInfo, bool bCheckForResourceCluster = true) const;
UpdateMapBuildDataId
void UpdateMapBuildDataId();
UpdateStaticLightingData
void UpdateStaticLightingData();
OnGetNaniteResources
virtual FOnGetNaniteResources& OnGetNaniteResources();
virtual const FOnGetNaniteResources& OnGetNaniteResources() const;

Static functions 2

GetMemberNameChecked_StaticMesh
static const FName GetMemberNameChecked_StaticMesh();
Helper function to get the FName of the private static mesh member
AddReferencedObjects
static void AddReferencedObjects(UObject* InThis, FReferenceCollector& Collector);