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¶
Same as AddSimpleCollisionsWithNotification but changes are automatically applied.
- Parameters
static_mesh (StaticMesh) –
shape_type (ScriptingCollisionShapeType) –
- Returns
- Return type
int32
- classmethod add_simple_collisions_with_notification(static_mesh, shape_type, apply_changes) → 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
static_mesh (StaticMesh) – Mesh to generate simple collision for.
shape_type (ScriptingCollisionShapeType) – Options on which simple collision to add to the mesh.
apply_changes (bool) – Indicates if changes must be apply or not.
- 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
- classmethod bulk_set_convex_decomposition_collisions(static_meshes, hull_count, max_hull_verts, hull_precision) → bool¶
Same as SetConvexDecompositionCollisionsWithNotification but changes are automatically applied.
- Parameters
static_meshes (Array(StaticMesh)) –
hull_count (int32) –
max_hull_verts (int32) –
hull_precision (int32) –
- Returns
- Return type
- classmethod bulk_set_convex_decomposition_collisions_with_notification(static_meshes, hull_count, max_hull_verts, hull_precision, apply_changes) → bool¶
Compute convex collisions for a set of static meshes. Any existing collisions will be removed from the static meshes. This method replicates what is done when invoking menu entry “Collision > Auto Convex Collision” in the Mesh Editor.
- Parameters
static_meshes (Array(StaticMesh)) – Set of 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.
apply_changes (bool) – Indicates if changes must be apply or not.
- Returns
A boolean indicating if the addition was successful or not.
- Return type
- 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
- 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
- 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
- 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
- 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_build_settings(static_mesh, lod_index) → MeshBuildSettings¶
Copy the build options with the specified LOD build settings.
- Parameters
static_mesh (StaticMesh) – Mesh to process.
lod_index (int32) – The LOD we get the reduction settings.
- Returns
out_build_options (MeshBuildSettings): The build settings where we copy the build options.
- Return type
- 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_material_slot(static_mesh, lod_index, section_index) → int32¶
Gets the material slot used for a specific LOD section.
- Parameters
static_mesh (StaticMesh) – Static mesh to get the material index from.
lod_index (int32) – Index of the StaticMesh LOD.
section_index (int32) – Index of the StaticMesh Section.
- Returns
MaterialSlotIndex Index of the material slot used by the section or INDEX_NONE in case of error.
- Return type
int32
- classmethod get_lod_reduction_settings(static_mesh, lod_index) → MeshReductionSettings¶
Copy the reduction options with the specified LOD reduction settings.
- Parameters
static_mesh (StaticMesh) – Mesh to process.
lod_index (int32) – The LOD we get the reduction settings.
- Returns
out_reduction_options (MeshReductionSettings): The reduction settings where we copy the reduction options.
- Return type
- classmethod get_lod_screen_sizes(static_mesh)¶
Get an array of LOD screen sizes for evaluation.
- Parameters
static_mesh (StaticMesh) – Mesh to process.
- Returns
array of LOD screen sizes.
- Return type
- 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_materials(static_mesh) → int32¶
Get number of StaticMesh verts for an LOD
- Parameters
static_mesh (StaticMesh) –
- Returns
- 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
- classmethod has_vertex_colors(static_mesh) → bool¶
Check whether a static mesh has vertex colors
- Parameters
static_mesh (StaticMesh) –
- Returns
- Return type
- classmethod import_lod(base_static_mesh, lod_index, source_filename) → int32¶
Import or re-import a LOD into the specified base mesh. If the LOD do not exist it will import it and add it to the base static mesh. If the LOD already exist it will re-import the specified LOD.
- Parameters
base_static_mesh (StaticMesh) –
lod_index (int32) –
source_filename (str) –
- Returns
the index of the LOD that was imported or re-imported. Will return INDEX_NONE if anything goes bad.
- Return type
int32
- 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
- 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
- classmethod reimport_all_custom_lo_ds(static_mesh) → bool¶
Re-import all the custom LODs present in the specified static mesh.
- Parameters
static_mesh (StaticMesh) –
- Returns
true if re-import all LODs works, false otherwise see log for explanation.
- Return type
- classmethod remove_collisions(static_mesh) → bool¶
Same as RemoveCollisionsWithNotification but changes are applied.
- Parameters
static_mesh (StaticMesh) –
- Returns
- Return type
- classmethod remove_collisions_with_notification(static_mesh, apply_changes) → 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.
apply_changes (bool) – Indicates if changes must be apply or not.
- Returns
A boolean indicating if the removal was successful or not.
- Return type
- 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
- 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
- classmethod set_allow_cpu_access(static_mesh, allow_cpu_access) → None¶
Sets StaticMeshFlag bAllowCPUAccess
- Parameters
static_mesh (StaticMesh) –
allow_cpu_access (bool) –
- classmethod set_convex_decomposition_collisions(static_mesh, hull_count, max_hull_verts, hull_precision) → bool¶
Same as SetConvexDecompositionCollisionsWithNotification but changes are automatically applied.
- Parameters
static_mesh (StaticMesh) –
hull_count (int32) –
max_hull_verts (int32) –
hull_precision (int32) –
- Returns
- Return type
- classmethod set_convex_decomposition_collisions_with_notification(static_mesh, hull_count, max_hull_verts, hull_precision, apply_changes) → 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.
apply_changes (bool) – Indicates if changes must be apply or not.
- Returns
A boolean indicating if the addition was successful or not.
- Return type
- classmethod set_generate_lightmap_uv(static_mesh, generate_lightmap_u_vs) → bool¶
Set Generate Lightmap UVs for StaticMesh
- Parameters
static_mesh (StaticMesh) –
generate_lightmap_u_vs (bool) –
- Returns
- Return type
- classmethod set_lod_build_settings(static_mesh, lod_index, build_options) → None¶
Set the LOD build options for the specified LOD index.
- Parameters
static_mesh (StaticMesh) – Mesh to process.
lod_index (int32) – The LOD we will apply the build settings.
build_options (MeshBuildSettings) – The build settings we want to apply to the LOD.
- 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_lod_material_slot(static_mesh, material_slot_index, lod_index, section_index) → None¶
Sets the material slot for a specific LOD.
- Parameters
static_mesh (StaticMesh) – Static mesh to Enables/disables shadow casting from.
material_slot_index (int32) – Index of the material slot to use.
lod_index (int32) – Index of the StaticMesh LOD.
section_index (int32) – Index of the StaticMesh Section.
- classmethod set_lod_reduction_settings(static_mesh, lod_index, reduction_options) → None¶
Set the LOD reduction for the specified LOD index.
- Parameters
static_mesh (StaticMesh) – Mesh to process.
lod_index (int32) – The LOD we will apply the reduction settings.
reduction_options (MeshReductionSettings) – The reduction settings we want to apply to the LOD.
- classmethod set_lods(static_mesh, reduction_options) → int32¶
Same as SetLodsWithNotification but changes are applied.
- Parameters
static_mesh (StaticMesh) –
reduction_options (EditorScriptingMeshReductionOptions) –
- Returns
- Return type
int32
- classmethod set_lods_with_notification(static_mesh, reduction_options, apply_changes) → 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
static_mesh (StaticMesh) – Mesh to process.
reduction_options (EditorScriptingMeshReductionOptions) – Options on how to generate LODs on the mesh.
apply_changes (bool) – Indicates if change must be notified.
- 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