unreal.GeometryScript_MeshDecomposition

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

Bases: BlueprintFunctionLibrary

Geometry Script Library Mesh Decomposition Functions

C++ Source:

  • Plugin: GeometryScripting

  • Module: GeometryScriptingCore

  • File: MeshDecompositionFunctions.h

classmethod copy_mesh_selection_to_mesh(target_mesh, store_to_submesh, selection, append_to_existing=False, preserve_group_i_ds=False, debug=None) -> (DynamicMesh, store_to_submesh=DynamicMesh, store_to_submesh_out=DynamicMesh)

Extract the triangles identified by Selection from TargetMesh and copy/add them to StoreToSubmesh

Parameters:
  • target_mesh (DynamicMesh)

  • store_to_submesh (DynamicMesh)

  • selection (GeometryScriptMeshSelection)

  • append_to_existing (bool) – if false (default), StoreToSubmesh is cleared, otherwise selected triangles are appended

  • preserve_group_i_ds (bool) – if true, GroupIDs of triangles on TargetMesh are preserved in StoreToSubmesh. Otherwise new GroupIDs are allocated.

  • debug (GeometryScriptDebug)

Returns:

store_to_submesh (DynamicMesh):

store_to_submesh_out (DynamicMesh):

Return type:

tuple

classmethod copy_mesh_to_mesh(copy_from_mesh, copy_to_mesh, debug=None) -> (DynamicMesh, copy_to_mesh=DynamicMesh, copy_to_mesh_out=DynamicMesh)

Set CopyToMesh to be the same mesh as CopyFromMesh

Parameters:
Returns:

copy_to_mesh (DynamicMesh):

copy_to_mesh_out (DynamicMesh):

Return type:

tuple

classmethod get_sub_mesh_from_mesh(target_mesh, store_to_submesh, triangle_list, debug=None) -> (DynamicMesh, store_to_submesh=DynamicMesh, store_to_submesh_out=DynamicMesh)

CopyMeshSelectionToMesh should be used instead of this function

Parameters:
Returns:

store_to_submesh (DynamicMesh):

store_to_submesh_out (DynamicMesh):

Return type:

tuple

classmethod sort_meshes_by_area(meshes, stable_sort=False, sort_order=ArraySortOrder.ASCENDING) Array[DynamicMesh]

Sort meshes by their surface area

Parameters:
  • meshes (Array[DynamicMesh]) – The meshes to sort

  • stable_sort (bool) – Whether to preserve ordering for meshes with the same surface area

  • sort_order (ArraySortOrder) – Whether to sort in order of increasing or decreasing surface area

Returns:

meshes (Array[DynamicMesh]): The meshes to sort

Return type:

Array[DynamicMesh]

classmethod sort_meshes_by_bounds_volume(meshes, stable_sort=False, sort_order=ArraySortOrder.ASCENDING) Array[DynamicMesh]

Sort meshes by their axis-aligned bounding box volume

Parameters:
  • meshes (Array[DynamicMesh]) – The meshes to sort

  • stable_sort (bool) – Whether to preserve ordering for meshes with the same bounds volume

  • sort_order (ArraySortOrder) – Whether to sort in order of increasing or decreasing bounds volume

Returns:

meshes (Array[DynamicMesh]): The meshes to sort

Return type:

Array[DynamicMesh]

classmethod sort_meshes_by_custom_values(meshes, values_to_sort_by, stable_sort=False, sort_order=ArraySortOrder.ASCENDING) Array[DynamicMesh]

Sort meshes according to the values in a second array, which must have the same length as the Meshes array For example, if the values array is [3, 2, 1], with Ascending Sort Order, the Meshes array would be reversed

Parameters:
  • meshes (Array[DynamicMesh]) – The meshes to sort

  • values_to_sort_by (Array[float]) – The values to reference for sort ordering, which must be one-to-one with the meshes

  • stable_sort (bool) – Whether to preserve ordering for meshes with the same corresponding value

  • sort_order (ArraySortOrder) – Whether to sort in order of increasing or decreasing value

Returns:

meshes (Array[DynamicMesh]): The meshes to sort

Return type:

Array[DynamicMesh]

classmethod sort_meshes_by_volume(meshes, stable_sort=False, sort_order=ArraySortOrder.ASCENDING) Array[DynamicMesh]

Sort meshes by their volume

Note: For meshes with open boundary, volume is computed with respect to the average vertex position.

Parameters:
  • meshes (Array[DynamicMesh]) – The meshes to sort

  • stable_sort (bool) – Whether to preserve ordering for meshes with the same volume

  • sort_order (ArraySortOrder) – Whether to sort in order of increasing or decreasing volume

Returns:

meshes (Array[DynamicMesh]): The meshes to sort

Return type:

Array[DynamicMesh]

classmethod split_mesh_by_components(target_mesh, mesh_pool, debug=None) -> (DynamicMesh, component_meshes=Array[DynamicMesh])

Create a new Mesh for each Connected Island (Component) of TargetMesh. New meshes are drawn from MeshPool if it is provided, otherwise new UDynamicMesh instances are allocated

Parameters:
Returns:

component_meshes (Array[DynamicMesh]): New List of meshes is returned here

Return type:

Array[DynamicMesh]

classmethod split_mesh_by_material_i_ds(target_mesh, mesh_pool, debug=None) -> (DynamicMesh, component_meshes=Array[DynamicMesh], component_material_i_ds=Array[int32])

Create a new Mesh for each MaterialID of TargetMesh. New meshes are drawn from MeshPool if it is provided, otherwise new UDynamicMesh instances are allocated

Parameters:
Returns:

component_meshes (Array[DynamicMesh]): New List of meshes is returned here

component_material_i_ds (Array[int32]): MaterialID for each Mesh in ComponentMeshes is returned here

Return type:

tuple

classmethod split_mesh_by_polygroups(target_mesh, group_layer, mesh_pool, debug=None) -> (DynamicMesh, component_meshes=Array[DynamicMesh], component_polygroups=Array[int32])

Create a new Mesh for each Polygroup of TargetMesh. Note that this may be a large number of meshes! New meshes are drawn from MeshPool if it is provided, otherwise new UDynamicMesh instances are allocated

Parameters:
Returns:

component_meshes (Array[DynamicMesh]): New List of meshes is returned here

component_polygroups (Array[int32]): Original Polygroup for each Mesh in ComponentMeshes is returned here

Return type:

tuple

classmethod split_mesh_by_vertex_overlap(target_mesh, mesh_pool, connect_vertices_threshold=0.001000, debug=None) -> (DynamicMesh, component_meshes=Array[DynamicMesh])

Create a new Mesh for each vertex-connected or vertex-overlapping part of TargetMesh. New meshes are drawn from MeshPool if it is provided, otherwise new UDynamicMesh instances are allocated

Parameters:
  • target_mesh (DynamicMesh)

  • mesh_pool (DynamicMeshPool) – New meshes in ComponentMeshes output list are allocated from this pool if it is provided (highly recommended!!)

  • connect_vertices_threshold (double) – Vertices closer than this distance will be classified as part of the same component, even if they aren’t connected by the mesh triangulation

  • debug (GeometryScriptDebug)

Returns:

component_meshes (Array[DynamicMesh]): New List of meshes is returned here

Return type:

Array[DynamicMesh]