Navigation
API > API/Runtime > API/Runtime/Engine > API/Runtime/Engine/Components
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UActorComponent
- USceneComponent
- UPrimitiveComponent
- UMeshComponent
- UStaticMeshComponent
- UInstancedStaticMeshComponent
- UHierarchicalInstancedStaticMeshComponent
- UHLODInstancedStaticMeshComponent
References
| Module | Engine |
| Header | /Engine/Source/Runtime/Engine/Classes/Components/InstancedStaticMeshComponent.h |
| Include | #include "Components/InstancedStaticMeshComponent.h" |
Syntax
UCLASS (ClassGroup=Rendering, Meta=(BlueprintSpawnableComponent), Blueprintable, MinimalAPI)
class UInstancedStaticMeshComponent :
public UStaticMeshComponent ,
public ISMInstanceManager
Remarks
A component that efficiently renders multiple instances of the same StaticMesh.
Variables
| Type | Name | Description | |
|---|---|---|---|
| TArray< FInstancedStaticMeshRandomSeed > | AdditionalRandomSeeds | Additional random seeds ranges. | |
| uint8: 1 | bDisableCollision | Don't create any collision when this bool is set | |
| bool | bForceShowAllInstancesDetails | Indicates that the user has purposedly chosen to show the instance list in the details panel, despite the performance warning. | |
| uint8: 1 | bInheritPerInstanceData | If true, this component will avoid serializing its per instance data / those properties will also not be editable | |
| uint8: 1 | bIsInstanceDataApplyCompleted | ||
| uint8: 1 | bSupportRemoveAtSwap | Flag for using RemoveAtSwap on instance removal. | |
| uint8: 1 | bUseGpuLodSelection | If true, this component will use GPU LOD selection. | |
| TArray< FInstancedStaticMeshMappingInfo > | CachedMappings | The mappings for all the instances of this component. | |
| EInstanceDeletionReason | DeletionState | This will be set to the appropriate state when one or more instances are in the process of being deleted. | |
| friend | FInstancedLightMap2D | ||
| friend | FInstancedShadowMap2D | ||
| friend | FStaticLightingTextureMapping_InstancedStaticMesh | ||
| TArray< FBodyInstance * > | InstanceBodies | Physics representation of the instance bodies. | |
| int32 | InstanceEndCullDistance | Distance from camera at which each instance completely fades out. | |
| TMap< int32, int32 > | InstanceIdToInstanceIndexMap | Used to cache a unique identifier for each instance. | |
| float | InstanceLODDistanceScale | Scale applied to change the computation of LOD distances when using the StaticMesh screen sizes. | |
| TArray< int32 > | InstanceReorderTable | Mapping from PerInstanceSMData order to instance render buffer order. | |
| int32 | InstanceStartCullDistance | Distance from camera at which each instance begins to fade out. | |
| int32 | InstancingRandomSeed | Value used to seed the random number stream that generates random numbers for each of this mesh's instances. | |
| FBox | NavigationBounds | Bounds are calculated and cached on component registration. | |
| int32 | NumCustomDataFloats | Defines the number of floats that will be available per instance for custom data | |
| int32 | NumPendingLightmaps | Number of pending lightmaps still to be calculated (Apply()'d). | |
| TArray< int32 > | PerInstanceIds | ||
| TArray< FMatrix > | PerInstancePrevTransform | TODO: KevinO cleanup. | |
| TArray< float > | PerInstanceSMCustomData | Array of custom data for instances. | |
| TArray< FInstancedStaticMeshInstanceData > | PerInstanceSMData | Array of instances, bulk serialized. | |
| FTransform | PreviousComponentTransform | Main transform stored to be able to send updates when component's transform changed. | |
| FPrimitiveInstanceDataManager | PrimitiveInstanceDataManager | ||
| SIZE_T | ProxySize | Tracks outstanding proxysize, as this is a bit hard to do with the fire-and-forget grass. | |
| TBitArray | SelectedInstances | One bit per instance if the instance is selected. |
Constructors
| Type | Name | Description | |
|---|---|---|---|
UInstancedStaticMeshComponent
(
const FObjectInitializer& ObjectInitializer |
|||
UInstancedStaticMeshComponent
(
FVTableHelper& Helper |
Needs implementation in InstancedStaticMesh.cpp to compile UniquePtr for forward declared class |
Destructors
| Type | Name | Description | |
|---|---|---|---|
Functions
| Type | Name | Description | |
|---|---|---|---|
| int32 | AddInstance
(
const FTransform& InstanceTransform, |
Add an instance to this component. | |
| FPrimitiveInstanceId | AddInstanceById
(
const FTransform& InstanceTransforms, |
||
| int32 | AddInstanceInternal
(
int32 InstanceIndex, |
Internal version of AddInstance | |
| TArray< int32 > | AddInstances
(
const TArray< FTransform >& InstanceTransforms, |
Add multiple instances to this component. | |
| TArray< FPrimitiveInstanceId > | AddInstancesById
(
const TArrayView< const FTransform >& InstanceTransforms, |
Preliminary ID-based interface. | |
| TArray< int32 > | AddInstancesInternal
(
TConstArrayView< FTransform > InstanceTransforms, |
Internal implementation of AddInstances | |
| int32 | AddInstanceWorldSpace
(
const FTransform& WorldTransform |
Add an instance to this component. Transform is given in world space. | |
| void | ApplyComponentInstanceData
(
FInstancedStaticMeshComponentInstanceData* ComponentInstanceData |
Applies the cached component instance data to a newly blueprint constructed component. | |
| void | ApplyLightMapping
(
FStaticLightingTextureMapping_InstancedStaticMesh* InMapping, |
||
| bool | BatchUpdateInstancesData
(
int32 StartInstanceIndex, |
||
| bool | BatchUpdateInstancesTransform
(
int32 StartInstanceIndex, |
Update the transform for a number of instances. | |
| bool | BatchUpdateInstancesTransforms
(
int32 StartInstanceIndex, |
TODO: KevinO cleanup. | |
| bool | BatchUpdateInstancesTransforms
(
int32 StartInstanceIndex, |
This is array view version of the UFUNCTION, blueprints do not support ArrayViews at the time of adding this one | |
| bool | BatchUpdateInstancesTransforms
(
int32 StartInstanceIndex, |
Update the transform for an array of instances. | |
| void | BuildComponentInstanceData
(
ERHIFeatureLevel::Type FeatureLevel, |
||
| void | BuildInstanceDataDeltaChangeSetCommon
(
FISMInstanceUpdateChangeSet& ChangeSet |
Helper to collect the base delta data from the ISM notably not transforms | |
| void | BuildLegacyRenderData
(
FStaticMeshInstanceData& OutData |
Build instance buffer for rendering from current component data. Only used for cook | |
| void | |||
| FBoxSphereBounds | CalcBoundsImpl
(
const FTransform& BoundTransform, |
Calculates bounds from all instances. | |
| void | Terminate all body instances owned by this component. | ||
| void | Clear all instances being rendered by this component. | ||
| void | Deselect all instances. | ||
| void | Creates body instances for all instances owned by this component. | ||
| void | CreateHitProxyData
(
TArray< TRefCountPtr< HHitProxy > >& HitProxies |
||
| void | FlushInstanceUpdateCommands
(
bool bFlushInstanceUpdateCmdBuffer |
||
| void | Request to navigation system to update for the bounds of the ISM. | ||
| void | GetCullDistances
(
int32& OutStartCullDistance, |
Gets the fading start and culling end distances for this component. | |
| int32 | Get the number of instances in this component. | ||
| int32 | GetInstanceIndexForId
(
FPrimitiveInstanceId InstanceId |
Fetches current instance index for a given InstanceId | |
| FBox | Returns the bounds of a single instance in local space. | ||
| bool | GetInstancePrevTransform
(
int32 InstanceIndex, |
TODO: KevinO cleanup. | |
| void | GetInstancesMinMaxScale
(
FVector& MinScale, |
||
| TArray< int32 > | GetInstancesOverlappingBox
(
const FBox& Box, |
Returns the instances with instance bounds overlapping the specified box. | |
| TArray< int32 > | GetInstancesOverlappingSphere
(
const FVector& Center, |
Returns the instances with instance bounds overlapping the specified sphere. | |
| bool | GetInstanceTransform
(
int32 InstanceIndex, |
Get the transform for the instance specified. | |
| float | Gets the current LOD scale. | ||
| void | GetNavigationPerInstanceTransforms
(
const FBox& AreaBox, |
Handles request from navigation system to gather instance transforms in a specific area box. | |
| int32 | |||
| int32 | Number of instances in the render-side instance buffer. | ||
| TSharedPtr< FISMCInstanceDataSceneProxy, ESPMode::ThreadSafe > | |||
| int32 | GetRenderIndex
(
int32 InInstanceIndex |
Returns the render instance buffer index. | |
| FVector | Get the translated space for instance transforms to be passed to the renderer. | ||
| FPrimitiveMaterialPropertyDescriptor | GetUsedMaterialPropertyDesc
(
ERHIFeatureLevel::Type FeatureLevel |
Wrapper which is public so we can implement the LIST ISM command | |
| void | InitInstanceBody
(
int32 InstanceIdx, |
Initializes the body instance for the specified instance of the static mesh. | |
| void | InitPerInstanceRenderData
(
bool InitializeFromCurrentData, |
Initialize the Per Instance Render Data | |
| void | Clears all the updated instance tracking data AND instance ID association, also forcing a full update of the instance data the next time it is flushed. | ||
| bool | IsInstanceSelected
(
int32 InInstanceIndex |
Check to see if an instance is selected. | |
| bool | IsInstanceTouchingSelectionBox
(
int32 InstanceIndex, |
||
| bool | IsInstanceTouchingSelectionFrustum
(
int32 InstanceIndex, |
||
| bool | IsValidId
(
FPrimitiveInstanceId InstanceId |
||
| bool | IsValidInstance
(
int32 InstanceIndex |
Does the given index map to a valid instance in this component? | |
| FInstanceDataFlags | MakeInstanceDataFlags
(
bool bAnyMaterialHasPerInstanceRandom, |
Helper function to construct a base-set of instance data flags that in. | |
| void | Creates rendering buffer from serialized data, if any | ||
| void | |||
| void | PartialNavigationUpdate
(
int32 InstanceIdx |
Request to navigation system to update only part of navmesh occupied by specified instance. | |
| void | PartialNavigationUpdates
(
TConstArrayView< FTransform > InstanceTransforms |
Request to navigation system to update only part of navmesh occupied specified instances transforms. | |
| void | PreAllocateInstancesMemory
(
int32 AddedInstanceCount |
Preallocated memory to include the new added instances count, to prevent reallloc during the add operation. | |
| void | PreApplyComponentInstanceData
(
FInstancedStaticMeshComponentInstanceData* ComponentInstanceData |
Handle changes that must happen before the proxy is recreated. | |
| void | Transfers ownership of instance render data to a render thread. | ||
| bool | RemoveInstance
(
int32 InstanceIndex |
Remove the instance specified. Returns True on success. | |
| void | RemoveInstanceById
(
FPrimitiveInstanceId InstanceId |
||
| bool | RemoveInstanceInternal
(
int32 InstanceIndex, |
Internal version of RemoveInstance | |
| bool | RemoveInstances
(
const TArray< int32 >& InstancesToRemove, |
Remove the instances specified. Returns True on success. | |
| bool | RemoveInstances
(
const TArray< int32 >& InstancesToRemove |
Remove the instances specified. Returns True on success. | |
| void | RemoveInstancesById
(
const TArrayView< const FPrimitiveInstanceId >& InstanceIds, |
||
| void | SelectInstance
(
bool bInSelected, |
Select/deselect an instance or group of instances. | |
| void | SerializeRenderData
(
FArchive& Ar |
Serialize instance buffer that is used for rendering. Only for cooked content | |
| void | SetBakedLightingDataChanged
(
int32 InInstanceIndex |
Mark the "shadowmap" or lightmap uv as modified for the instance since this is stored in external data. | |
| void | Mark the "shadowmap" or lightmap uv as modified for all the instances since this is stored in external data. | ||
| void | SetCullDistances
(
int32 StartCullDistance, |
Sets the fading start and culling end distances for this component. | |
| bool | SetCustomData
(
int32 InstanceIndex, |
Per Instance Custom Data | |
| void | SetCustomDataById
(
FPrimitiveInstanceId InstanceId, |
||
| void | SetCustomDataById
(
const TArrayView< const FPrimitiveInstanceId >& InstanceIds, |
||
| bool | SetCustomDataValue
(
int32 InstanceIndex, |
Update custom data for specific instance | |
| void | SetCustomDataValueById
(
FPrimitiveInstanceId InstanceId, |
||
| void | SetHasPerInstancePrevTransforms
(
bool bInHasPreviousTransforms |
||
| void | SetLODDistanceScale
(
float InLODDistanceScale |
Sets the LOD scale. | |
| void | SetNumCustomDataFloats
(
int32 InNumCustomDataFloats |
Update number of custom data entries per instance. | |
| void | SetPreviousTransformById
(
FPrimitiveInstanceId InstanceId, |
||
| void | Sets to use RemoveAtSwap on instance removal. | ||
| void | SetUseConservativeBounds
(
bool bValue |
Sets whether to use conservative bounds. | |
| bool | Does this component support partial navigation updates | ||
| bool | Returns true if RemoveAtSwap is enabled. | ||
| void | UpdateComponentTransform
(
EUpdateTransformFlags UpdateTransformFlags, |
||
| bool | UpdateInstances
(
const TArray< int32 >& UpdateInstanceIds, |
Lightweight interface to add, remove and update instances. | |
| bool | UpdateInstanceTransform
(
int32 InstanceIndex, |
Update the transform for the instance specified. | |
| void | UpdateInstanceTransformById
(
FPrimitiveInstanceId InstanceId, |
Overridden from UStaticMeshComponent
| Type | Name | Description | |
|---|---|---|---|
| FPrimitiveSceneProxy * | CreateStaticMeshSceneProxy
(
Nanite::FMaterialAudit& NaniteMaterials, |
Overload this in child implementations that wish to extend Static Mesh or Nanite scene proxy implementations. | |
| void | GetStaticLightingInfo
(
FStaticLightingPrimitiveInfo& OutPrimitiveInfo, |
||
| float | Get the scale comming form the component, when computing StreamingTexture data. |
Overridden from UMeshComponent
| Type | Name | Description | |
|---|---|---|---|
| bool | GetMaterialStreamingData
(
int32 MaterialIndex, |
Get material, UV density and bounds for a given material index. |
Overridden from UPrimitiveComponent
| Type | Name | Description | |
|---|---|---|---|
| bool | BuildTextureStreamingDataImpl
(
ETextureStreamingBuildType BuildType, |
Build the data to compute accuracte StreaminTexture data. | |
| bool | Determines whether or not the simulate physics setting can be edited interactively on this component | ||
| void | CollectPSOPrecacheData
(
const FPSOPrecacheParams& BasePrecachePSOParams, |
Precache all PSOs which can be used by the component | |
| bool | ComponentIsTouchingSelectionBox
(
const FBox& InSelBBox, |
Determines whether the supplied bounding box intersects with the component. | |
| bool | ComponentIsTouchingSelectionFrustum
(
const FConvexVolume& InFrustum, |
Determines whether the supplied frustum intersects with the component. | |
| bool | ComponentOverlapComponentImpl
(
UPrimitiveComponent* PrimComp, |
Override this method for custom behavior for ComponentOverlapComponent() | |
| bool | ComponentOverlapMultiImpl
(
TArray< struct FOverlapResult >& OutOverlaps, |
Override this method for custom behavior for ComponentOverlapMulti() | |
| FPrimitiveSceneProxy * | Creates a proxy to represent the primitive to the scene manager in the rendering thread. | ||
| FBodyInstance * | GetBodyInstance
(
FName BoneName, |
Returns BodyInstance of the component. | |
| void | GetLightAndShadowMapMemoryUsage
(
int32& LightMapMemoryUsage, |
Returns the light and shadow map memory for this primitive in its out variables. | |
| FMatrix | Returns the matrix that should be used to render this component. | ||
| void | GetStreamingRenderAssetInfo
(
FStreamingTextureLevelContext& LevelContext, |
Get the StreaminTexture data. | |
| bool | LineTraceComponent
(
FHitResult& OutHit, |
Trace a ray against just this component. | |
| bool | OverlapComponent
(
const FVector& Pos, |
||
| bool | Whether the component type supports static lighting. | ||
| bool | SweepComponent
(
FHitResult& OutHit, |
Trace a shape against just this component. |
Overridden from USceneComponent
| Type | Name | Description | |
|---|---|---|---|
| FBoxSphereBounds | CalcBounds
(
const FTransform& LocalToWorld |
Calculate the bounds of the component. Default behavior is a bounding box/sphere of zero size. | |
| void | OnUpdateTransform
(
EUpdateTransformFlags UpdateTransformFlags, |
Native callback when this component is moved | |
| void | Updates any visuals after the lighting has changed | ||
| void | UpdateBounds () |
Update the Bounds of the component. |
Overridden from UActorComponent
| Type | Name | Description | |
|---|---|---|---|
| void | GetComponentChildElements
(
TArray< FTypedElementHandle >& OutElementHandles, |
Get the logical child elements of this component, if any. | |
| TStructOnScope< FActorComponentInstanceData > | Called before we throw away components during RerunConstructionScripts, to cache any data we wish to persist across that operation | ||
| FBox | |||
| bool | Override to specify that a component is relevant to the HLOD generation. | ||
| bool | Override to specify that a component is relevant to the navigation system | ||
| void | Used to create any physics engine information for this component | ||
| void | Used to shut down and physics engine structure for this component | ||
| void | OnRegister () |
Called when a component is registered, after Scene is set, but before CreateRenderState_Concurrent or OnCreatePhysicsState are called. | |
| void | OnUnregister () |
Called when a component is unregistered. | |
| void | Called to send instance data for this component to the rendering thread | ||
| bool | Return true if CreatePhysicsState() should be called. |
Overridden from UObject
| Type | Name | Description | |
|---|---|---|---|
| void | BeginCacheForCookedPlatformData
(
const ITargetPlatform* TargetPlatform |
See: UObject::BeginCacheForCookedPlatformData | |
| void | BeginDestroy () |
Called before destroying the object. | |
| bool | CanEditChange
(
const FProperty* InProperty |
Called by the editor to query whether a property of this object is allowed to be modified. | |
| void | GetResourceSizeEx
(
FResourceSizeEx& CumulativeResourceSize |
Get the size of the object/resource for use in memory tools or to display to artists/LDs in the Editor This is the extended version which separates up the used memory into different memory regions (the actual definition of which may be platform specific). | |
| bool | IsCachedCookedPlatformDataLoaded
(
const ITargetPlatform* TargetPlatform |
See: UObject::IsCachedCookedPlatformDataLoaded | |
| void | PostEditChangeChainProperty
(
FPropertyChangedChainEvent& PropertyChangedEvent |
This alternate version of PostEditChange is called when properties inside structs are modified. | |
| void | PostEditUndo () |
Called after applying a transaction to the object. | |
| void | PostLoad () |
Do any object-specific cleanup required immediately after loading an object. | |
| void | Handles reading, writing, and reference collecting using FArchive. |
Overridden from INavRelevantInterface
| Type | Name | Description | |
|---|---|---|---|
| bool | DoCustomNavigableGeometryExport
(
FNavigableGeometryExport& GeomExport |
Collects custom navigable geometry of component. | |
| FBox | Get bounds for navigation octree | ||
| void | GetNavigationData
(
FNavigationRelevantData& Data |
Prepares navigation modifiers | |
| bool | Indicates if the area covered by the navigation bounds of the object should not be dirtied when inserting, or removing, the object in the navigation octree. |
Overridden from IPhysicsComponent
| Type | Name | Description | |
|---|---|---|---|
| TArray< Chaos::FPhysicsObject * > | |||
| Chaos::FPhysicsObject * | GetPhysicsObjectById
(
Chaos::FPhysicsObjectId Id |
Overridden from ISMInstanceManager
| Type | Name | Description | |
|---|---|---|---|
| bool | CanEditSMInstance
(
const FSMInstanceId& InstanceId |
Can the given static mesh instance be edited? | |
| bool | CanMoveSMInstance
(
const FSMInstanceId& InstanceId, |
Can the given static mesh instance be moved in the world? | |
| bool | DeleteSMInstances
(
TArrayView< const FSMInstanceId > InstanceIds |
Attempt to delete the given static mesh instances. | |
| bool | DuplicateSMInstances
(
TArrayView< const FSMInstanceId > InstanceIds, |
Attempt to duplicate the given static mesh instances, retrieving the IDs of any new instances. | |
| bool | GetSMInstanceTransform
(
const FSMInstanceId& InstanceId, |
Attempt to get the transform of the given static mesh instance. | |
| void | NotifySMInstanceMovementEnded
(
const FSMInstanceId& InstanceId |
Notify that the given static mesh instance is done being moved. | |
| void | NotifySMInstanceMovementOngoing
(
const FSMInstanceId& InstanceId |
Notify that the given static mesh instance is currently being moved. | |
| void | NotifySMInstanceMovementStarted
(
const FSMInstanceId& InstanceId |
Notify that the given static mesh instance is about to be moved. | |
| void | NotifySMInstanceSelectionChanged
(
const FSMInstanceId& InstanceId, |
Notify that the given static mesh instance selection state has changed. | |
| bool | SetSMInstanceTransform
(
const FSMInstanceId& InstanceId, |
Attempt to set the transform of the given static mesh instance. |
Enums
| Type | Name | Description | |
|---|---|---|---|
| EInstanceDeletionReason | The reason why a deletion operation is currently happening. |