Bootstrap Chameleon Logo

PythonMeshLib

Function Name Description
get_static_mesh_materials Get all Static Materials of static mesh.
set_static_mesh_materials Get all Static Materials of static mesh.
get_imported_original_mat_names Get the names from Mesh's ImportMaterialOriginalNameData of StaticMesh's ImportData
get_original_lod_data_count Get number of LODs from ImportMeshData. It's may not equal to the number of actual mesh asset, which can generate lods in editor.
get_original_lod_mat_names Get the Section Original Material Names from specified LOD of mesh.
is_this_lod_generated_by_mesh_reduction Is Specified LOD is generated in editor.
set_lod_section_material_slot_index Set Material Slot Index of Specified mesh LOD.
get_section_cast_shadow Is specified section of LOD cast shadow.
get_overlapping_box_count Get the number of instances that overlap a given box
get_overlapping_sphere_count Get the number of instances that overlap a given sphere
get_static_mesh_sockets Get the static mesh sockets of the mesh object
set_static_mesh_sockets Set the static mesh sockets of the mesh object
set_static_mesh_socket_name Set the name of static mesh socket.
convert_procedural_mesh_to_static_mesh UStaticMesh* StaticMeshvert the procedural mesh to static mesh asset
apply_nanite Set and Apply the Enable Nanite of static mesh asset. UE5 Only.

get_static_mesh_materials

Get all Static Materials of static mesh.

unreal.PythonMeshLib.get_static_mesh_materials(mesh) -> Array[StaticMaterial]
    Get all Static Materials of static mesh.

    Args:
        mesh (StaticMesh): The Static Mesh owned the Materials.

    Returns:
        Array[StaticMaterial]:

        out_materials (Array[StaticMaterial]): The Static Materials of the mesh in list.

set_static_mesh_materials

Get all Static Materials of static mesh.

unreal.PythonMeshLib.set_static_mesh_materials(mesh, materials, slot_names) -> None
    Get all Static Materials of static mesh.

    Args:
        mesh (StaticMesh): The target static mesh.
        materials (Array[StaticMaterial]): The material list you want to set to the mesh.
        slot_names (Array[Name]): The new material slot names of the mesh.

get_imported_original_mat_names

Get the names from Mesh's ImportMaterialOriginalNameData of StaticMesh's ImportData

unreal.PythonMeshLib.get_imported_original_mat_names(mesh) -> Array[str] or None
    Get the names from Mesh's ImportMaterialOriginalNameData of StaticMesh's ImportData

    Args:
        mesh (StaticMesh): The target static mesh.

    Returns:
        Array[str] or None:

        out_material_names (Array[str]): The names in material original name data.

get_original_lod_data_count

Get number of LODs from ImportMeshData. It's may not equal to the number of actual mesh asset, which can generate lods in editor.

unreal.PythonMeshLib.get_original_lod_data_count(mesh) -> int32
    Get number of LODs from ImportMeshData. It's may not equal to the number of actual mesh asset, which can generate lods in editor.

    Args:
        mesh (StaticMesh): The target static mesh.

    Returns:
        int32: The number of LOD.

get_original_lod_mat_names

Get the Section Original Material Names from specified LOD of mesh.

unreal.PythonMeshLib.get_original_lod_mat_names(mesh, lod_level) -> Array[str] or None
    Get the Section Original Material Names from specified LOD of mesh.

    Args:
        mesh (StaticMesh): The target static mesh.
        lod_level (int32): Specified LOD level.

    Returns:
        Array[str] or None:

        out_material_names (Array[str]): The Material's names.

is_this_lod_generated_by_mesh_reduction

Is Specified LOD is generated in editor.

unreal.PythonMeshLib.is_this_lod_generated_by_mesh_reduction(mesh, lod_level) -> bool
    Is Specified LOD is generated in editor.
    result: Whether this LOD's mesh is generated in editor or not.

    Args:
        mesh (StaticMesh): The target static mesh.
        lod_level (int32): Specified LOD level.

    Returns:
        bool:

set_lod_section_material_slot_index

Set Material Slot Index of Specified mesh LOD.

unreal.PythonMeshLib.set_lod_section_material_slot_index(static_mesh, lod_index, section_index, new_material_slot_index, new_material_slot_name) -> None
    Set Material Slot Index of Specified mesh LOD.

    Args:
        static_mesh (StaticMesh):
        lod_index (int32):
        section_index (int32): The section index of LOD.
        new_material_slot_index (int32): The new material slot index for the section.
        new_material_slot_name (Name): The name for material slot.

get_section_cast_shadow

Is specified section of LOD cast shadow.

unreal.PythonMeshLib.get_section_cast_shadow(static_mesh, lod_level, section_id) -> bool
    Is specified section of LOD cast shadow.
    result: Whether this section of mesh cast shadow.

    Args:
        static_mesh (StaticMesh):
        lod_level (int32): Specified LOD level.
        section_id (int32): Specified section id of LOD.

    Returns:
        bool:

get_overlapping_box_count

Get the number of instances that overlap a given box

unreal.PythonMeshLib.get_overlapping_box_count(hism, box) -> int32
    Get the number of instances that overlap a given box
    result: The overlapped number of instances.

    Args:
        hism (HierarchicalInstancedStaticMeshComponent): The target HierarchicalInstancedStaticMeshComponent.
        box (Box): Box for overlapping test.

    Returns:
        int32:

get_overlapping_sphere_count

Get the number of instances that overlap a given sphere

unreal.PythonMeshLib.get_overlapping_sphere_count(hism, sphere_center, sphere_radius) -> int32
    Get the number of instances that overlap a given sphere
    result: The overlapped number of instances.

    Args:
        hism (HierarchicalInstancedStaticMeshComponent): The target HierarchicalInstancedStaticMeshComponent.
        sphere_center (Vector): The center position of Sphere for overlapping test.
        sphere_radius (float): The radius of Sphere.

    Returns:
        int32:

get_static_mesh_sockets

Get the static mesh sockets of the mesh object

unreal.PythonMeshLib.get_static_mesh_sockets(obj) -> Array[StaticMeshSocket]
    Get the static mesh sockets of the mesh object
    result: The static mesh sockets of the mesh.

    Args:
        obj (Object): The target mesh.

    Returns:
        Array[StaticMeshSocket]:

set_static_mesh_sockets

Set the static mesh sockets of the mesh object

unreal.PythonMeshLib.set_static_mesh_sockets(obj, sockets) -> bool
    Set the static mesh sockets of the mesh object
    result: Succeed or not.

    Args:
        obj (Object): The target mesh.
        sockets (Array[StaticMeshSocket]): The sockets for mesh.

    Returns:
        bool:

set_static_mesh_socket_name

Set the name of static mesh socket.

unreal.PythonMeshLib.set_static_mesh_socket_name(socket, socket_name) -> StaticMeshSocket
    Set the name of static mesh socket.
    deprecated: SetStaticMeshSocketName is deprecated, use set_editor_property('socket_name', new_socket_name) instead
    result: The mesh socket.

    Args:
        socket (StaticMeshSocket): The target Socket.
        socket_name (Name): The new name of socket.

    Returns:
        StaticMeshSocket:

convert_procedural_mesh_to_static_mesh

UStaticMesh* StaticMeshvert the procedural mesh to static mesh asset

unreal.PythonMeshLib.convert_procedural_mesh_to_static_mesh(proc_mesh_comp, package_path, recompute_normals=False, recompute_tangents=False, remove_degenerates=False, use_high_precision_tangent_basis=False, use_full_precision_u_vs=False, generate_lightmap_u_vs=True) -> StaticMesh
    UStaticMesh* StaticMeshvert the procedural mesh to static mesh asset

    Args:
        proc_mesh_comp (ProceduralMeshComponent): The ProcMeshComp mesh Component
        package_path (str): The StaticMesh Asset package path
        recompute_normals (bool): Recompute mesh normal or not, default = false
        recompute_tangents (bool): Recompute mesh tangents or not, default = false
        remove_degenerates (bool): Remove Degenerates triangles or not, default = false
        use_high_precision_tangent_basis (bool): Use high precision tangent basis or not, default = false
        use_full_precision_u_vs (bool): Stored UVs with full floating point precision or not, default = false
        generate_lightmap_u_vs (bool): Generate Lightmap UVs or not, default = true

    Returns:
        StaticMesh: return the converted static mesh

apply_nanite

Set and Apply the Enable Nanite of static mesh asset. UE5 Only.

unreal.PythonMeshLib.apply_nanite(static_mesh, enable_nanite) -> None
    Set and Apply the Enable Nanite of static mesh asset. UE5 Only.
    note: This function will trigger Nanite mesh rebuild, which will cost several seconds or more.

    Args:
        static_mesh (StaticMesh): The target static mesh asset.
        enable_nanite (bool): Enable Nanite or not.

Other Editor Python Libs: