unreal.EditorStaticMeshLibrary

class unreal.EditorStaticMeshLibrary(outer=None, name='None')

Bases: unreal.BlueprintFunctionLibrary

Utility class to altering and analyzing a StaticMesh and use the common functionalities of the Mesh Editor. The editor should not be in play in editor mode.

C++ Source:

  • Plugin: EditorScriptingUtilities
  • Module: EditorScriptingUtilities
  • File: EditorStaticMeshLibrary.h
classmethod add_simple_collisions(static_mesh, shape_type) → int32

Add simple collisions to a static mesh. This method replicates what is done when invoking menu entries “Collision > Add […] Simplified Collision” in the Mesh Editor.

Parameters:
Returns:

An integer indicating the index of the collision newly created. A negative value indicates the addition failed.

Return type:

int32

classmethod add_uv_channel(static_mesh, lod_index) → bool

Adds an empty UV channel at the end of the existing channels on the given LOD of a StaticMesh.

Parameters:
  • static_mesh (StaticMesh) – Static mesh on which to add a UV channel.
  • lod_index (int32) – Index of the StaticMesh LOD.
Returns:

true if a UV channel was added.

Return type:

bool

classmethod enable_section_cast_shadow(static_mesh, cast_shadow, lod_index, section_index) → None

Enables/disables mesh section shadow casting for a specific LOD.

Parameters:
  • static_mesh (StaticMesh) – Static mesh to Enables/disables shadow casting from.
  • cast_shadow (bool) – If the section should cast shadow.
  • lod_index (int32) – Index of the StaticMesh LOD.
  • section_index (int32) – Index of the StaticMesh Section.
classmethod enable_section_collision(static_mesh, collision_enabled, lod_index, section_index) → None

Enables/disables mesh section collision for a specific LOD.

Parameters:
  • static_mesh (StaticMesh) – Static mesh to Enables/disables collisions from.
  • collision_enabled (bool) – If the collision is enabled or not.
  • lod_index (int32) – Index of the StaticMesh LOD.
  • section_index (int32) – Index of the StaticMesh Section.
classmethod generate_box_uv_channel(static_mesh, lod_index, uv_channel_index, position, orientation, size) → bool

Generates box UV mapping in the specified UV channel on the given LOD of a StaticMesh.

Parameters:
  • static_mesh (StaticMesh) – Static mesh on which to generate the UV mapping.
  • lod_index (int32) – Index of the StaticMesh LOD.
  • uv_channel_index (int32) – Channel where to save the UV mapping.
  • position (Vector) – Position of the center of the projection gizmo.
  • orientation (Rotator) – Rotation to apply to the projection gizmo.
  • size (Vector) – The size of the box projection gizmo.
Returns:

true if the UV mapping was generated.

Return type:

bool

classmethod generate_cylindrical_uv_channel(static_mesh, lod_index, uv_channel_index, position, orientation, tiling) → bool

Generates cylindrical UV mapping in the specified UV channel on the given LOD of a StaticMesh.

Parameters:
  • static_mesh (StaticMesh) – Static mesh on which to generate the UV mapping.
  • lod_index (int32) – Index of the StaticMesh LOD.
  • uv_channel_index (int32) – Channel where to save the UV mapping.
  • position (Vector) – Position of the center of the projection gizmo.
  • orientation (Rotator) – Rotation to apply to the projection gizmo.
  • tiling (Vector2D) – The UV tiling to use to generate the UV mapping.
Returns:

true if the UV mapping was generated.

Return type:

bool

classmethod generate_planar_uv_channel(static_mesh, lod_index, uv_channel_index, position, orientation, tiling) → bool

Generates planar UV mapping in the specified UV channel on the given LOD of a StaticMesh.

Parameters:
  • static_mesh (StaticMesh) – Static mesh on which to generate the UV mapping.
  • lod_index (int32) – Index of the StaticMesh LOD.
  • uv_channel_index (int32) – Channel where to save the UV mapping.
  • position (Vector) – Position of the center of the projection gizmo.
  • orientation (Rotator) – Rotation to apply to the projection gizmo.
  • tiling (Vector2D) – The UV tiling to use to generate the UV mapping.
Returns:

true if the UV mapping was generated.

Return type:

bool

classmethod get_collision_complexity(static_mesh) → CollisionTraceFlag

Get the Collision Trace behavior of a static mesh

Parameters:static_mesh (StaticMesh) – Mesh to query on.
Returns:the Collision Trace behavior.
Return type:CollisionTraceFlag
classmethod get_convex_collision_count(static_mesh) → int32

Get number of convex collisions present on a static mesh.

Parameters:static_mesh (StaticMesh) – Mesh to query on.
Returns:An integer representing the number of convex collisions on the input static mesh. An negative value indicates that the command could not be executed. See log for explanation.
Return type:int32
classmethod get_lod_count(static_mesh) → int32

Get number of LODs present on a static mesh.

Parameters:static_mesh (StaticMesh) – Mesh to process.
Returns:the number of LODs present on the input mesh. An negative value indicates that the command could not be executed. See log for explanation.
Return type:int32
classmethod get_lod_screen_sizes(static_mesh) -> Array(float)

Get an array of LOD screen sizes for evaluation.

Parameters:static_mesh (StaticMesh) – Mesh to process.
Returns:array of LOD screen sizes.
Return type:Array(float)
classmethod get_num_uv_channels(static_mesh, lod_index) → int32

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

Parameters:
  • static_mesh (StaticMesh) – Static mesh to query.
  • lod_index (int32) – Index of the StaticMesh LOD.
Returns:

the number of UV channels.

Return type:

int32

classmethod get_number_verts(static_mesh, lod_index) → int32

Get number of StaticMesh verts for an LOD

Parameters:
  • static_mesh (StaticMesh) –
  • lod_index (int32) –
Returns:

Return type:

int32

classmethod get_simple_collision_count(static_mesh) → int32

Get number of simple collisions present on a static mesh.

Parameters:static_mesh (StaticMesh) – Mesh to query on.
Returns:An integer representing the number of simple collisions on the input static mesh. An negative value indicates that the command could not be executed. See log for explanation.
Return type:int32
classmethod has_instance_vertex_colors(static_mesh_component) → bool

Check whether a static mesh component has vertex colors

Parameters:static_mesh_component (StaticMeshComponent) –
Returns:
Return type:bool
classmethod has_vertex_colors(static_mesh) → bool

Check whether a static mesh has vertex colors

Parameters:static_mesh (StaticMesh) –
Returns:
Return type:bool
classmethod insert_uv_channel(static_mesh, lod_index, uv_channel_index) → bool

Inserts an empty UV channel at the specified channel index on the given LOD of a StaticMesh.

Parameters:
  • static_mesh (StaticMesh) – Static mesh on which to insert a UV channel.
  • lod_index (int32) – Index of the StaticMesh LOD.
  • uv_channel_index (int32) – Index where to insert the UV channel.
Returns:

true if a UV channel was added.

Return type:

bool

classmethod is_section_collision_enabled(static_mesh, lod_index, section_index) → bool

Checks if a specific LOD mesh section has collision.

Parameters:
  • static_mesh (StaticMesh) – Static mesh to remove collisions from.
  • lod_index (int32) – Index of the StaticMesh LOD.
  • section_index (int32) – Index of the StaticMesh Section.
Returns:

True is the collision is enabled for the specified LOD of the StaticMesh section.

Return type:

bool

classmethod remove_collisions(static_mesh) → bool

Remove collisions from a static mesh. This method replicates what is done when invoking menu entries “Collision > Remove Collision” in the Mesh Editor.

Parameters:static_mesh (StaticMesh) – Static mesh to remove collisions from.
Returns:A boolean indicating if the removal was successful or not.
Return type:bool
classmethod remove_lods(static_mesh) → bool

Remove LODs on a static mesh except LOD 0.

Parameters:static_mesh (StaticMesh) – Mesh to remove LOD from.
Returns:A boolean indicating if the removal was successful, true, or not.
Return type:bool
classmethod remove_uv_channel(static_mesh, lod_index, uv_channel_index) → bool

Removes the UV channel at the specified channel index on the given LOD of a StaticMesh.

Parameters:
  • static_mesh (StaticMesh) – Static mesh on which to remove the UV channel.
  • lod_index (int32) – Index of the StaticMesh LOD.
  • uv_channel_index (int32) – Index where to remove the UV channel.
Returns:

true if the UV channel was removed.

Return type:

bool

classmethod set_allow_cpu_access(static_mesh, allow_cpu_access) → None

Sets StaticMeshFlag bAllowCPUAccess

Parameters:
classmethod set_convex_decomposition_collisions(static_mesh, hull_count, max_hull_verts, hull_precision) → bool

Add a convex collision to a static mesh. Any existing collisions will be removed from the static mesh. This method replicates what is done when invoking menu entry “Collision > Auto Convex Collision” in the Mesh Editor.

Parameters:
  • static_mesh (StaticMesh) – Static mesh to add convex collision on.
  • hull_count (int32) – Maximum number of convex pieces that will be created. Must be positive.
  • max_hull_verts (int32) – Maximum number of vertices allowed for any generated convex hull.
  • hull_precision (int32) – Number of voxels to use when generating collision. Must be positive.
Returns:

A boolean indicating if the addition was successful or not.

Return type:

bool

classmethod set_generate_lightmap_uv(static_mesh, generate_lightmap_u_vs) → bool

Set Generate Lightmap UVs for StaticMesh

Parameters:
Returns:

Return type:

bool

classmethod set_lod_from_static_mesh(destination_static_mesh, destination_lod_index, source_static_mesh, source_lod_index, reuse_existing_material_slots) → int32

Adds or create a LOD at DestinationLodIndex using the geometry from SourceStaticMesh SourceLodIndex

Parameters:
  • destination_static_mesh (StaticMesh) – The static mesh to set the LOD in.
  • destination_lod_index (int32) – The index of the LOD to set.
  • source_static_mesh (StaticMesh) – The static mesh to get the LOD from.
  • source_lod_index (int32) – The index of the LOD to get.
  • reuse_existing_material_slots (bool) – If true, sections from SourceStaticMesh will be remapped to match the material slots of DestinationStaticMesh when they have the same material assigned. If false, all material slots of SourceStaticMesh will be appended in DestinationStaticMesh.
Returns:

The index of the LOD that was set. It can be different than DestinationLodIndex if it wasn’t a valid index. A negative value indicates that the LOD was not set. See log for explanation.

Return type:

int32

classmethod set_lods(static_mesh, reduction_options) → int32

Remove then add LODs on a static mesh. The static mesh must have at least LOD 0. The LOD 0 of the static mesh is kept after removal. The build settings of LOD 0 will be applied to all subsequent LODs.

Parameters:
Returns:

the number of LODs generated on the input mesh. An negative value indicates that the reduction could not be performed. See log for explanation. No action will be performed if ReductionOptions.ReductionSettings is empty

Return type:

int32