unreal.StaticMesh

class unreal.StaticMesh(outer: Object | None = None, name: Name | str = 'None')

Bases: StreamableRenderAsset

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. see: https://docs.unrealengine.com/latest/INT/Engine/Content/Types/StaticMeshes/ see: AStaticMeshActor, UStaticMeshComponent

C++ Source:

  • Module: Engine

  • File: StaticMesh.h

Editor Properties: (see get_editor_property/set_editor_property)

  • allow_cpu_access (bool): [Read-Write] 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)

  • asset_import_data (AssetImportData): [Read-Write] Importing data and options used for this mesh

  • asset_user_data (Array[AssetUserData]): [Read-Write] Array of user data stored with the asset

  • body_setup (BodySetup): [Read-Write]

  • complex_collision_mesh (StaticMesh): [Read-Write]

  • customized_collision (bool): [Read-Write] If the user has modified collision in any way or has custom collision imported. Used for determining if to auto generate collision on import

  • distance_field_self_shadow_bias (float): [Read-Write] Useful for reducing self shadowing from distance field methods when using world position offset to animate the mesh’s vertices.

  • generate_mesh_distance_field (bool): [Read-Write] Whether to generate a distance field for this mesh, which can be used by DistanceField Indirect Shadows. This is ignored if the project’s ‘Generate Mesh Distance Fields’ setting is enabled.

  • global_force_mip_levels_to_be_resident (bool): [Read-Write] Global and serialized version of ForceMiplevelsToBeResident.

  • has_navigation_data (bool): [Read-Write] If true, mesh will have NavCollision property with additional data for navmesh generation and usage.

    Set to false for distant meshes (always outside navigation bounds) to save memory on collision data.

  • light_map_coordinate_index (int32): [Read-Write] The light map coordinate index

  • light_map_resolution (int32): [Read-Write] The light map resolution

  • lod_for_collision (int32): [Read-Write] Specifies which mesh LOD to use for complex (per-poly) collision. Sometimes it can be desirable to use a lower poly representation for collision to reduce memory usage, improve performance and behaviour. Collision representation does not change based on distance to camera.

  • lod_group (Name): [Read-Write] The LOD group to which this mesh belongs.

  • nanite_settings (MeshNaniteSettings): [Read-Write] Settings related to building Nanite data.

  • nav_collision (NavCollisionBase): [Read-Only]

  • negative_bounds_extension (Vector): [Read-Write]

  • never_stream (bool): [Read-Write]

  • num_cinematic_mip_levels (int32): [Read-Write] Number of mip-levels to use for cinematic quality.

  • positive_bounds_extension (Vector): [Read-Write]

  • static_materials (Array[StaticMaterial]): [Read-Write]

  • support_gpu_uniformly_distributed_sampling (bool): [Read-Write] 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.

  • support_physical_material_masks (bool): [Read-Write] If true, complex collision data will store UVs and face remap table for use when performing PhysicalMaterialMask lookups in cooked builds. Note the increased memory cost for this functionality.

  • support_ray_tracing (bool): [Read-Write] If true, a ray tracing acceleration structure will be built for this mesh and it may be used in ray tracing effects

  • support_uniformly_distributed_sampling (bool): [Read-Write] Mesh supports uniformly distributed sampling in constant time. Memory cost is 8 bytes per triangle. Example usage is uniform spawning of particles.

  • thumbnail_info (ThumbnailInfo): [Read-Only] Information for thumbnail rendering

add_material(material) Name

Adds a new material and return its slot name

Parameters:

material (MaterialInterface) –

Return type:

Name

add_socket(socket) None

Add a socket object in this StaticMesh.

Parameters:

socket (StaticMeshSocket) –

build_from_static_mesh_descriptions(static_mesh_descriptions, build_simple_collision=False, fast_build=True) None

Builds static mesh LODs from the array of StaticMeshDescriptions passed in

Parameters:
classmethod create_static_mesh_description(outer=None) StaticMeshDescription

Create an empty StaticMeshDescription object, to describe a static mesh at runtime

Parameters:

outer (Object) –

Return type:

StaticMeshDescription

find_socket(socket_name) StaticMeshSocket

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.

Parameters:

socket_name (Name) –

Return type:

StaticMeshSocket

get_bounding_box() Box

Returns the bounding box, in local space including bounds extension(s), of the StaticMesh asset

Return type:

Box

get_bounds() BoxSphereBounds

Returns the number of bounds of the mesh.

Returns:

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

Return type:

BoxSphereBounds

get_material(material_index) MaterialInterface

Gets a Material given a Material Index and an LOD number

Parameters:

material_index (int32) –

Returns:

Requested material

Return type:

MaterialInterface

get_material_index(material_slot_name) int32

Gets a Material index given a slot name

Parameters:

material_slot_name (Name) –

Returns:

Requested material

Return type:

int32

get_min_lod_for_quality_levels() -> (quality_level_minimum_lo_ds=Map[PerQualityLevels, int32], default=int32)

Get Min LODFor Quality Levels

Returns:

quality_level_minimum_lo_ds (Map[PerQualityLevels, int32]):

default (int32):

Return type:

tuple

get_minimum_lod_for_platform(platform_name) int32

Get Minimum LODFor Platform

Parameters:

platform_name (Name) –

Return type:

int32

get_minimum_lod_for_platforms() Map[Name, int32]

Get Minimum LODFor Platforms

Returns:

platform_minimum_lo_ds (Map[Name, int32]):

Return type:

Map[Name, int32]

get_minimum_lod_for_quality_level(quality_level) int32

Get Minimum LODFor Quality Level

Parameters:

quality_level (Name) –

Return type:

int32

get_minimum_lod_for_quality_levels() Map[Name, int32]

Get Minimum LODFor Quality Levels

Returns:

quality_level_minimum_lo_ds (Map[Name, int32]):

Return type:

Map[Name, int32]

get_num_lods() int32

Returns the number of LODs used by the mesh.

Return type:

int32

get_num_sections(lod) int32

Returns number of Sections that this StaticMesh has, in the supplied LOD (LOD 0 is the highest)

Parameters:

lod (int32) –

Return type:

int32

get_num_triangles(lod_index) int32

Returns the number of triangles in the render data for the specified LOD.

Parameters:

lod_index (int32) –

Return type:

int32

get_sockets_by_tag(socket_tag) Array[StaticMeshSocket]

Returns a list of sockets with the provided tag.

Parameters:

socket_tag (str) –

Return type:

Array[StaticMeshSocket]

get_static_mesh_description(lod_index) StaticMeshDescription

Return a new StaticMeshDescription referencing the MeshDescription of the given LOD

Parameters:

lod_index (int32) –

Return type:

StaticMeshDescription

is_lod_screen_size_auto_computed() bool

Is LODScreen Size Auto Computed

Return type:

bool

property lod_for_collision: int

[Read-Write] Specifies which mesh LOD to use for complex (per-poly) collision. Sometimes it can be desirable to use a lower poly representation for collision to reduce memory usage, improve performance and behaviour. Collision representation does not change based on distance to camera.

Type:

(int32)

remove_socket(socket) None

Remove a socket object in this StaticMesh by providing it’s pointer. Use FindSocket() if needed.

Parameters:

socket (StaticMeshSocket) –

set_material(material_index, new_material) None

Sets a Material given a Material Index

Parameters:
set_min_lod_for_quality_levels(quality_level_minimum_lo_ds, default=-1) None

Allow to override min lod quality levels on a staticMesh and it Default value (-1 value for Default dont override its value).

Parameters:
set_minimum_lod_for_platform(platform_name, min_lod) None

Set Minimum LODFor Platform

Parameters:
  • platform_name (Name) –

  • min_lod (int32) –

set_minimum_lod_for_platforms(platform_minimum_lo_ds) None

Set Minimum LODFor Platforms

Parameters:

platform_minimum_lo_ds (Map[Name, int32]) –

set_num_source_models(num) None

Set Num Source Models

Parameters:

num (int32) –

property static_materials: None

[Read-Write]

Type:

(Array[StaticMaterial])