unreal.GeometryScript_PolyGroups

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

Bases: BlueprintFunctionLibrary

Geometry Script Library Mesh Polygroup Functions

C++ Source:

  • Plugin: GeometryScripting

  • Module: GeometryScriptingCore

  • File: MeshPolygroupFunctions.h

classmethod add_named_polygroup_layer(target_mesh, layer_name, debug=None) -> (DynamicMesh, group_layer=GeometryScriptGroupLayer, already_existed=bool)

Add an extended polygroup layer with the given name. If a layer with that name is already on the mesh, that existing layer will be returned and no new layer will be added.

Parameters:
Returns:

group_layer (GeometryScriptGroupLayer): PolyGroup layer with the requested name

already_existed (bool): If true, the layer already existed and did not need to be added (and the output GroupLayer will refer to that existing layer)

Return type:

tuple

classmethod clear_polygroups(target_mesh, group_layer, clear_value=0, debug=None) DynamicMesh

Resets the triangle PolyGroup assignments within a PolyGroup Layer to the given Clear Value (or 0 if no Clear Value is specified). Note, this will have no effect if PolyGroups have not been enabled on the mesh, or if the requested Group Layer does not exist.

Parameters:
Return type:

DynamicMesh

classmethod compute_polygroups_from_angle_threshold(target_mesh, group_layer, crease_angle=15.000000, min_group_size=2, debug=None) DynamicMesh

Sets PolyGroups by partitioning the mesh based on an edge crease/opening-angle. Note, this will have no effect if the Group Layer does not exist.

Parameters:
  • target_mesh (DynamicMesh)

  • group_layer (GeometryScriptGroupLayer) – indicates the PolyGroup Layer that will be populated.

  • crease_angle (float) – measured in degrees and used when comparing adjacent faces.

  • min_group_size (int32) – the minimum number of triangles in each PolyGroup.

  • debug (GeometryScriptDebug)

Return type:

DynamicMesh

classmethod compute_polygroups_from_polygon_detection(target_mesh, group_layer, respect_uv_seams=True, respect_hard_normals=False, quad_adjacency_weight=1.000000, quad_metric_clamp=1.000000, max_search_rounds=1, debug=None) DynamicMesh

Sets PolyGroups by identifying adjacent triangles that form reasonable quads. Note any triangles that do not neatly pair to form quads will receive their own PolyGroup.

Parameters:
Return type:

DynamicMesh

classmethod convert_components_to_polygroups(target_mesh, group_layer, debug=None) DynamicMesh

Creates and assigns a new PolyGroup for each disconnected island (component) of a Mesh. Regions of a mesh are disconnected they do not have a triangle in common. Note, this will have no effect if the Group Layer does not exist.

Parameters:
Return type:

DynamicMesh

classmethod convert_uv_islands_to_polygroups(target_mesh, group_layer, uv_layer=0, debug=None) DynamicMesh

Creates and assigns a new PolyGroup for each disconnected UV island of a Mesh. Note, this will have no effect if either the requested UV Layer or Group Layer does not exist.

Parameters:
Return type:

DynamicMesh

classmethod copy_polygroups_layer(target_mesh, from_group_layer, to_group_layer, debug=None) DynamicMesh

Copies the triangle PolyGroup assignments from one layer on the Target Mesh to another. Note, this will have no effect if PolyGroups have not been enabled on the mesh, or if one of the requested Group Layers does not exist.

Parameters:
Return type:

DynamicMesh

classmethod delete_triangles_in_polygroup(target_mesh, group_layer, polygroup_id, defer_change_notifications=False, debug=None) -> (DynamicMesh, num_deleted=int32)

Deletes all triangles from the Target Mesh that have a particular PolyGroup ID, in the specific Group Layer.

Parameters:
Returns:

num_deleted (int32): on return will contain the number of triangles deleted from the Target Mesh.

Return type:

int32

classmethod enable_polygroups(target_mesh, debug=None) DynamicMesh

Enables the standard PolyGroup Layer on the Target Mesh.

Parameters:
Return type:

DynamicMesh

classmethod find_extended_polygroup_layer_by_name(target_mesh, layer_name, debug=None) -> (DynamicMesh, group_layer=GeometryScriptGroupLayer, outcome=GeometryScriptSearchOutcomePins)

Find an extended PolyGroup layer by its name. If there are multiple layers with the same name, returns the first such layer.

Parameters:
Returns:

group_layer (GeometryScriptGroupLayer): PolyGroup layer with the requested name (if Outcome is Success)

outcome (GeometryScriptSearchOutcomePins): Whether the requested layer was found

Return type:

tuple

classmethod get_all_triangle_polygroup_i_ds(target_mesh, group_layer, polygroup_i_ds_out) -> (DynamicMesh, polygroup_i_ds_out=GeometryScriptIndexList)

Create list of per-triangle PolyGroup IDs for the PolyGroup in the Mesh warning: if the mesh is not Triangle-Compact (eg GetHasTriangleIDGaps == false) then the returned list will also have the same gaps

Parameters:
Returns:

polygroup_i_ds_out (GeometryScriptIndexList):

Return type:

GeometryScriptIndexList

classmethod get_poly_group_bounding_box(target_mesh, group_layer, group_id) -> (DynamicMesh, bounds=Box)

Compute the bounds of a PolyGroup

Parameters:
Returns:

bounds (Box): The bounds of the PolyGroups’s triangles. Can be invalid if the PolyGroup was not found.

Return type:

Box

classmethod get_poly_group_uv_bounding_box(target_mesh, group_layer, group_id, uv_channel) -> (DynamicMesh, uv_bounds=Box2D)

Compute the UV bounds of a PolyGroup

Parameters:
  • target_mesh (DynamicMesh)

  • group_layer (GeometryScriptGroupLayer) – The PolyGroup layer to query

  • group_id (int32) – The PolyGroup to query

  • uv_channel (int32) – The UV channel to query

Returns:

uv_bounds (Box2D): The bounds of the PolyGroups’s UV triangles. Can be invalid if the PolyGroup was not found or did not have UVs in the requested channel.

Return type:

Box2D

classmethod get_poly_group_uv_centroid(target_mesh, group_layer, group_id, uv_channel) -> (DynamicMesh, centroid=Vector2D, is_valid=bool)

Compute the UV centroid of a PolyGroup

Parameters:
  • target_mesh (DynamicMesh)

  • group_layer (GeometryScriptGroupLayer) – The PolyGroup layer to query

  • group_id (int32) – The PolyGroup to query

  • uv_channel (int32) – The UV channel to query

Returns:

centroid (Vector2D): The centroid of the polygroup’s UV triangles

is_valid (bool): True if a valid centroid was found, false otherwise. Can be false if the PolyGroup was not found or did not have UVs in the requested channel.

Return type:

tuple

classmethod get_polygroup_i_ds_in_mesh(target_mesh, group_layer, polygroup_i_ds_out) -> (DynamicMesh, polygroup_i_ds_out=GeometryScriptIndexList)

Create list of all unique PolyGroup IDs that exist in the PolyGroup Layer in the Mesh

Parameters:
Returns:

polygroup_i_ds_out (GeometryScriptIndexList):

Return type:

GeometryScriptIndexList

classmethod get_triangle_polygroup_id(target_mesh, group_layer, triangle_id) -> (int32, is_valid_triangle=bool)

Gets the PolyGroup ID associated with the specified Triangle ID and stored in the Group Layer. If the Group Layer or the Triangle does not exist, the value 0 will be returned and bIsValidTriangle set to false.

Parameters:
  • target_mesh (DynamicMesh)

  • group_layer (GeometryScriptGroupLayer) – indicates the layer on the Target Mesh to query.

  • triangle_id (int32) – identifies a triangle in the Target Mesh.

Returns:

is_valid_triangle (bool): will be populated on return with false if either the Group Layer or the Triangle does not exist.

Return type:

bool

classmethod get_triangles_in_polygroup(target_mesh, group_layer, polygroup_id, triangle_i_ds_out) -> (DynamicMesh, triangle_i_ds_out=GeometryScriptIndexList)

Create list of all triangles with the given PolyGroup ID in the given GroupLayer (not necessarily a single connected-component / island)

Parameters:
Returns:

triangle_i_ds_out (GeometryScriptIndexList):

Return type:

GeometryScriptIndexList

classmethod set_num_extended_polygroup_layers(target_mesh, num_layers, debug=None) DynamicMesh

Sets the number of extended PolyGroup Layers on a Mesh.

Parameters:
Return type:

DynamicMesh

classmethod set_polygroup_for_mesh_selection(target_mesh, group_layer, selection, set_polygroup_id=0, generate_new_polygroup=False, defer_change_notifications=False) -> (DynamicMesh, set_polygroup_id_out=int32)

Set a new PolyGroup on all the triangles of the given Selection, for the given GroupLayer.

Parameters:
  • target_mesh (DynamicMesh)

  • group_layer (GeometryScriptGroupLayer)

  • selection (GeometryScriptMeshSelection)

  • set_polygroup_id (int32) – explicit new PolyGroupID to set

  • generate_new_polygroup (bool) – if true, SetPolyGroupID is ignored and a new unique PolyGroupID is generated

  • defer_change_notifications (bool) – if true, the UDynamicMesh does not emit a change event/signal for this modification

Returns:

set_polygroup_id_out (int32): the PolyGroupID that was set on the triangles is returned here (whether explicit or auto-generated)

Return type:

int32