engine
 
载入中...
搜索中...
未找到
类 | Public 成员函数 | 静态 Public 成员函数 | Public 属性 | Protected 属性 | 所有成员列表
UStaticMesh类 参考

A StaticMesh is a piece of geometry that consists of a static set of polygons. 更多...

#include <StaticMesh.h>

继承自 UStreamableRenderAsset, IInterface_CollisionDataProvider , 以及 IInterface_AssetUserData .

类

struct  FBuildMeshDescriptionsParams
 Structure that defines parameters passed into the build mesh description function 更多...
 

Public 成员函数

ENGINE_API FName AddMaterial (UMaterialInterface *Material)
 Adds a new material and return its slot name
 
ENGINE_API void AddSocket (UStaticMeshSocket *Socket)
 Add a socket object in this StaticMesh.
 
virtual ENGINE_API void BeginDestroy () override
 Called before destroying the object. 更多...
 
ENGINE_API void Build (bool bInSilent=false, TArray< FText > *OutErrors=nullptr)
 Rebuilds renderable data for this static mesh. 更多...
 
void BuildFromMeshDescription (const FMeshDescription &MeshDescription, FStaticMeshLODResources &LODResources)
 Builds a LOD resource from a MeshDescription
 
ENGINE_API bool BuildFromMeshDescriptions (const TArray< const FMeshDescription * > &MeshDescriptions, const FBuildMeshDescriptionsParams &Params=FBuildMeshDescriptionsParams())
 Builds static mesh render buffers from a list of MeshDescriptions, one per LOD.
 
ENGINE_API void BuildFromStaticMeshDescriptions (const TArray< UStaticMeshDescription * > &StaticMeshDescriptions, bool bBuildSimpleCollision=false)
 Builds static mesh LODs from the array of StaticMeshDescriptions passed in
 
ENGINE_API void CalculateExtendedBounds ()
 Calculates the extended bounds
 
virtual ENGINE_API bool CanBeClusterRoot () const override
 Called after load to determine if the object can be a cluster root 更多...
 
ENGINE_API void CreateBodySetup ()
 Create BodySetup for this staticmesh if it doesn't have one
 
ENGINE_API void CreateNavCollision (const bool bIsUpdate=false)
 Calculates navigation collision for caching
 
ENGINE_API void EnforceLightmapRestrictions (bool bUseRenderData=true)
 Make sure the Lightmap UV point on a valid UVChannel
 
ENGINE_API class UStaticMeshSocket * FindSocket (FName InSocketName) const
 Find a socket object in this StaticMesh by name. 更多...
 
virtual ENGINE_API void GetAssetRegistryTags (TArray< FAssetRegistryTag > &OutTags) const override
 Gathers a list of asset registry searchable tags which are name/value pairs with some type information This only needs to be implemented for asset objects 更多...
 
ENGINE_API FBox GetBoundingBox () const
 Returns the bounding box, in local space including bounds extension(s), of the StaticMesh asset
 
ENGINE_API FBoxSphereBounds GetBounds () const
 Returns the number of bounds of the mesh. 更多...
 
virtual ENGINE_API FString GetDesc () override
 Return a one line description of an object for viewing in the thumbnail view of the generic browser
 
ENGINE_API const FStaticMeshLODResources & GetLODForExport (int32 LODIndex) const
 Returns the render data to use for exporting the specified LOD. 更多...
 
ENGINE_API UMaterialInterface * GetMaterial (int32 MaterialIndex) const
 Gets a Material given a Material Index and an LOD number 更多...
 
ENGINE_API FBox GetMaterialBox (int32 MaterialIndex, const FTransform &Transform) const
 Returns the material bounding box. 更多...
 
ENGINE_API int32 GetMaterialIndex (FName MaterialSlotName) const
 Gets a Material index given a slot name 更多...
 
ENGINE_API int32 GetNumLODs () const
 Returns the number of LODs used by the mesh.
 
ENGINE_API int32 GetNumSections (int32 InLOD) const
 Returns number of Sections that this StaticMesh has, in the supplied LOD (LOD 0 is the highest)
 
int32 GetNumSectionsWithCollision () const
 Return the number of sections of the StaticMesh with collision enabled
 
ENGINE_API int32 GetNumUVChannels (int32 LODIndex)
 Returns the number of UV channels for the given LOD of a StaticMesh. 更多...
 
ENGINE_API int32 GetNumVertices (int32 LODIndex) const
 Returns the number of vertices for the specified LOD.
 
virtual ENGINE_API void GetResourceSizeEx (FResourceSizeEx &CumulativeResourceSize) override
 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). 更多...
 
ENGINE_API const FMeshUVChannelInfo * GetUVChannelData (int32 MaterialIndex) const
 Returns the UV channel data for a given material index. 更多...
 
ENGINE_API void GetVertexColorData (TMap< FVector, FColor > &VertexColorData)
 Returns vertex color data by position. 更多...
 
ENGINE_API bool HasValidRenderData (bool bCheckLODForVerts=true, int32 LODIndex=INDEX_NONE) const
 Returns true if the mesh has data that can be rendered.
 
virtual ENGINE_API void InitResources ()
 Initialize the static mesh's render resources.
 
virtual bool IsPostLoadThreadSafe () const override
 Called during async load to determine if PostLoad can be called on the loading thread. 更多...
 
virtual ENGINE_API bool IsReadyForFinishDestroy () override
 Called to check if the object is ready for FinishDestroy. 更多...
 
ENGINE_API void MarkAsNotHavingNavigationData ()
 Configures this SM as bHasNavigationData = false and clears stored NavCollision
 
virtual ENGINE_API void PostInitProperties () override
 Called after the C++ constructor and after the properties have been initialized, including those loaded from config. 更多...
 
virtual ENGINE_API void PostLoad () override
 Do any object-specific cleanup required immediately after loading an object. 更多...
 
virtual ENGINE_API void ReleaseResources ()
 Releases the static mesh's render resources.
 
ENGINE_API void RemoveSocket (UStaticMeshSocket *Socket)
 Remove a socket object in this StaticMesh by providing it's pointer. 更多...
 
ENGINE_API void RemoveVertexColors ()
 Removes all vertex colors from this mesh and rebuilds it (Editor only
 
virtual ENGINE_API void Serialize (FArchive &Ar) override
 Handles reading, writing, and reference collecting using FArchive. 更多...
 
ENGINE_API void SetVertexColorData (const TMap< FVector, FColor > &VertexColorData)
 Sets vertex color data by position. 更多...
 
ENGINE_API void UpdateUVChannelData (bool bRebuildAll)
 Update missing material UV channel data used for texture streaming. 更多...
 
ENGINE_API UStaticMesh (const FObjectInitializer &ObjectInitializer=FObjectInitializer::Get())
 Default constructor
 

静态 Public 成员函数

static ENGINE_API void BatchBuild (const TArray< UStaticMesh * > &InStaticMeshes, bool bInSilent=false, TFunction< bool(UStaticMesh *)> InProgressCallback=nullptr, TArray< FText > *OutErrors=nullptr)
 Rebuilds renderable data for a batch of static meshes. 更多...
 
static ENGINE_API void CancelAllPendingStreamingActions ()
 Cancels any pending static mesh streaming actions if possible. 更多...
 
static ENGINE_API void CheckLightMapUVs (UStaticMesh *InStaticMesh, TArray< FString > &InOutAssetsWithMissingUVSets, TArray< FString > &InOutAssetsWithBadUVSets, TArray< FString > &InOutAssetsWithValidUVSets, bool bInVerbose=true)
 Static: Processes the specified static mesh for light map UV problems 更多...
 
static ENGINE_API UStaticMeshDescription * CreateStaticMeshDescription (UObject *Outer=nullptr)
 Create an empty StaticMeshDescription object, to describe a static mesh at runtime
 
static ENGINE_API void RegisterMeshAttributes (FMeshDescription &MeshDescription)
 Registers the mesh attributes required by the mesh description for a static mesh.
 

Public 属性

uint8 bAllowCPUAccess:1
 If true, will keep geometry data CPU-accessible in cooked builds, rather than uploading to GPU memory and releasing it from CPU memory. 更多...
 
uint8 bSupportGpuUniformlyDistributedSampling: 1
 If true, a GPU buffer containing required data for uniform mesh surface sampling will be created at load time. 更多...
 
class UObject * EditableMesh
 The editable mesh representation of this static mesh
 
FBoxSphereBounds ExtendedBounds
 Original mesh bounds extended with Positive/NegativeBoundsExtension
 
FGuid LightingGuid
 Unique ID for tracking/caching this mesh during distributed lighting
 
UNavCollisionBase * NavCollision
 Pre-build navigation collision
 
FVector NegativeBoundsExtension
 Bound extension values in the negative direction of XYZ, positive value increases bound size
 
FVector PositiveBoundsExtension
 Bound extension values in the positive direction of XYZ, positive value increases bound size
 
FRenderCommandFence ReleaseResourcesFence
 A fence which is used to keep track of the rendering thread releasing the static mesh resources.
 
TArray< class UStaticMeshSocket * > Sockets
 Array of named socket locations, set up in editor and used as a shortcut instead of specifying everything explicitly to AttachComponent in the StaticMeshComponent.
 
TSharedPtr< class FSpeedTreeWind > SpeedTreeWind
 Data that is only available if this static mesh is an imported SpeedTree
 

Protected 属性

TArray< UAssetUserData * > AssetUserData
 Array of user data stored with the asset
 
uint8 bRenderingResourcesInitialized:1
 Tracks whether InitResources has been called, and rendering resources are initialized.
 
int32 ElementToIgnoreForTexFactor
 Index of an element to ignore while gathering streaming texture factors. 更多...
 

详细描述

A StaticMesh is a piece of geometry that consists of a static set of polygons.

Static Meshes can be translated, rotated, and scaled, but they cannot have their vertices animated in any way. As such, they are more efficient to render than other types of geometry such as USkeletalMesh, and they are often the basic building block of levels created in the engine.

参见
https://docs.unrealengine.com/latest/INT/Engine/Content/Types/StaticMeshes/
AStaticMeshActor, UStaticMeshComponent

成员函数说明

◆ BatchBuild()

static ENGINE_API void UStaticMesh::BatchBuild ( const TArray< UStaticMesh * > &  InStaticMeshes,
bool  bInSilent = false,
TFunction< bool(UStaticMesh *)>  InProgressCallback = nullptr,
TArray< FText > *  OutErrors = nullptr 
)
static

Rebuilds renderable data for a batch of static meshes.

参数
InStaticMeshesThe list of all static meshes to build.
bInSilentIf true will not popup a progress dialog.
InProgressCallbackIf provided, will be used to abort task and report progress to higher level functions (should return true to continue, false to abort).
[out]OutErrorsIf provided, will contain the errors that occurred during this process.

◆ BeginDestroy()

virtual ENGINE_API void UStaticMesh::BeginDestroy ( )
overridevirtual

Called before destroying the object.

This is called immediately upon deciding to destroy the object, to allow the object to begin an asynchronous cleanup process.

重载 UObject .

◆ Build()

ENGINE_API void UStaticMesh::Build ( bool  bInSilent = false,
TArray< FText > *  OutErrors = nullptr 
)

Rebuilds renderable data for this static mesh.

参数
bInSilentIf true will not popup a progress dialog.
[out]OutErrorsIf provided, will contain the errors that occurred during this process.

◆ CanBeClusterRoot()

virtual ENGINE_API bool UStaticMesh::CanBeClusterRoot ( ) const
overridevirtual

Called after load to determine if the object can be a cluster root

返回
true if this object can be a cluster root

重载 UObjectBaseUtility .

◆ CancelAllPendingStreamingActions()

static ENGINE_API void UStaticMesh::CancelAllPendingStreamingActions ( )
static

Cancels any pending static mesh streaming actions if possible.

Returns when no more async loading requests are in flight.

◆ CheckLightMapUVs()

static ENGINE_API void UStaticMesh::CheckLightMapUVs ( UStaticMesh *  InStaticMesh,
TArray< FString > &  InOutAssetsWithMissingUVSets,
TArray< FString > &  InOutAssetsWithBadUVSets,
TArray< FString > &  InOutAssetsWithValidUVSets,
bool  bInVerbose = true 
)
static

Static: Processes the specified static mesh for light map UV problems

参数
InStaticMeshStatic mesh to process
InOutAssetsWithMissingUVSetsArray of assets that we found with missing UV sets
InOutAssetsWithBadUVSetsArray of assets that we found with bad UV sets
InOutAssetsWithValidUVSetsArray of assets that we found with valid UV sets
bInVerboseIf true, log the items as they are found

◆ FindSocket()

ENGINE_API class UStaticMeshSocket * UStaticMesh::FindSocket ( FName  InSocketName) const

Find a socket object in this StaticMesh by name.

Entering NAME_None will return NULL. If there are multiple sockets with the same name, will return the first one.

◆ GetAssetRegistryTags()

virtual ENGINE_API void UStaticMesh::GetAssetRegistryTags ( TArray< FAssetRegistryTag > &  OutTags) const
overridevirtual

Gathers a list of asset registry searchable tags which are name/value pairs with some type information This only needs to be implemented for asset objects

参数
OutTagsA list of key-value pairs associated with this object and their types

重载 UObject .

◆ GetBounds()

ENGINE_API FBoxSphereBounds UStaticMesh::GetBounds ( ) const

Returns the number of bounds of the mesh.

返回
The bounding box represented as box origin with extents and also a sphere that encapsulates that box

◆ GetLODForExport()

ENGINE_API const FStaticMeshLODResources & UStaticMesh::GetLODForExport ( int32  LODIndex) const

Returns the render data to use for exporting the specified LOD.

This method should always be called when exporting a static mesh.

◆ GetMaterial()

ENGINE_API UMaterialInterface * UStaticMesh::GetMaterial ( int32  MaterialIndex) const

Gets a Material given a Material Index and an LOD number

返回
Requested material

◆ GetMaterialBox()

ENGINE_API FBox UStaticMesh::GetMaterialBox ( int32  MaterialIndex,
const FTransform &  Transform 
) const

Returns the material bounding box.

Computed from all lod-section using the material index.

参数
MaterialIndexMaterial Index to look at
TransformMatrixMatrix to be applied to the position before computing the bounds
返回
false if some parameters are invalid

◆ GetMaterialIndex()

ENGINE_API int32 UStaticMesh::GetMaterialIndex ( FName  MaterialSlotName) const

Gets a Material index given a slot name

返回
Requested material

◆ GetNumUVChannels()

ENGINE_API int32 UStaticMesh::GetNumUVChannels ( int32  LODIndex)

Returns the number of UV channels for the given LOD of a StaticMesh.

参数
LODIndexIndex of the StaticMesh LOD.
返回
the number of UV channels.

◆ GetResourceSizeEx()

virtual ENGINE_API void UStaticMesh::GetResourceSizeEx ( FResourceSizeEx &  CumulativeResourceSize)
overridevirtual

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).

参数
CumulativeResourceSizeStruct used to count up the cumulative size of the resource as to be displayed to artists/LDs in the Editor.

重载 UObject .

◆ GetUVChannelData()

ENGINE_API const FMeshUVChannelInfo * UStaticMesh::GetUVChannelData ( int32  MaterialIndex) const

Returns the UV channel data for a given material index.

Used by the texture streamer. This data applies to all lod-section using the same material.

参数
MaterialIndexthe material index for which to get the data for.
返回
the data, or null if none exists.

◆ GetVertexColorData()

ENGINE_API void UStaticMesh::GetVertexColorData ( TMap< FVector, FColor > &  VertexColorData)

Returns vertex color data by position.

For matching to reimported meshes that may have changed or copying vertex paint data from mesh to mesh.

参数
VertexColorData(out)A map of vertex position data and its color. The method fills this map.

◆ IsPostLoadThreadSafe()

virtual bool UStaticMesh::IsPostLoadThreadSafe ( ) const
overridevirtual

Called during async load to determine if PostLoad can be called on the loading thread.

返回
true if this object's PostLoad is thread safe

重载 UObject .

◆ IsReadyForFinishDestroy()

virtual ENGINE_API bool UStaticMesh::IsReadyForFinishDestroy ( )
overridevirtual

Called to check if the object is ready for FinishDestroy.

This is called after BeginDestroy to check the completion of the potentially asynchronous object cleanup.

返回
True if the object's asynchronous cleanup has completed and it is ready for FinishDestroy to be called.

重载 UObject .

◆ PostInitProperties()

virtual ENGINE_API void UStaticMesh::PostInitProperties ( )
overridevirtual

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.

This is called before any serialization or other setup has happened.

重载 UObject .

◆ PostLoad()

virtual ENGINE_API void UStaticMesh::PostLoad ( )
overridevirtual

Do any object-specific cleanup required immediately after loading an object.

This is not called for newly-created objects, and by default will always execute on the game thread.

重载 UObject .

◆ RemoveSocket()

ENGINE_API void UStaticMesh::RemoveSocket ( UStaticMeshSocket *  Socket)

Remove a socket object in this StaticMesh by providing it's pointer.

Use FindSocket() if needed.

◆ Serialize()

virtual ENGINE_API void UStaticMesh::Serialize ( FArchive &  Ar)
overridevirtual

Handles reading, writing, and reference collecting using FArchive.

This implementation handles all FProperty serialization, but can be overridden for native variables.

重载 UObject .

◆ SetVertexColorData()

ENGINE_API void UStaticMesh::SetVertexColorData ( const TMap< FVector, FColor > &  VertexColorData)

Sets vertex color data by position.

Map of vertex color data by position is matched to the vertex position in the mesh and nearest matching vertex color is used.

参数
VertexColorDataA map of vertex position data and color.

◆ UpdateUVChannelData()

ENGINE_API void UStaticMesh::UpdateUVChannelData ( bool  bRebuildAll)

Update missing material UV channel data used for texture streaming.

参数
bRebuildAllIf true, rebuild everything and not only missing data.

类成员变量说明

◆ bAllowCPUAccess

uint8 UStaticMesh::bAllowCPUAccess

If true, will keep geometry data CPU-accessible in cooked builds, rather than uploading to GPU memory and releasing it from CPU memory.

This is required if you wish to access StaticMesh geometry data on the CPU at runtime in cooked builds (e.g. to convert StaticMesh to ProceduralMeshComponent)

◆ bSupportGpuUniformlyDistributedSampling

uint8 UStaticMesh::bSupportGpuUniformlyDistributedSampling

If true, a GPU buffer containing required data for uniform mesh surface sampling will be created at load time.

It is created from the cpu data so bSupportUniformlyDistributedSampling is also required to be true.

◆ ElementToIgnoreForTexFactor

int32 UStaticMesh::ElementToIgnoreForTexFactor
protected

Index of an element to ignore while gathering streaming texture factors.

This is useful to disregard automatically generated vertex data which breaks texture factor heuristics.


该类的文档由以下文件生成: