Class ElementSelection
Provides helper functions for working with selected faces, edges, and vertices.
Inherited Members
Namespace: UnityEngine.ProBuilder.MeshOperations
Syntax
public static class ElementSelection
Methods
FloodSelection(ProBuilderMesh, IList<Face>, Single)
Recursively adds all faces touching any of the selected faces to the selection.
This corresponds to the Grow Selection action.
Declaration
public static HashSet<Face> FloodSelection(ProBuilderMesh mesh, IList<Face> faces, float maxAngleDiff)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
IList<Face> | faces | The selected faces. |
Single | maxAngleDiff | Specify the maximum difference (in degrees) between the normals on the selected face and those on the perimeter face. |
Returns
Type | Description |
---|---|
HashSet<Face> | The original faces selection, plus any new faces added as a result of the grow operation. |
GetFaceLoop(ProBuilderMesh, Face[], Boolean)
Finds and returns a face loop.
This is the equivalent of the Select Face Loop and Select Face Ring actions.
Declaration
public static HashSet<Face> GetFaceLoop(ProBuilderMesh mesh, Face[] faces, bool ring = false)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
Face[] | faces | The faces to scan for loops. |
Boolean | ring | Toggles between loop and ring. Ring and loop are arbritary with faces, so this parameter just toggles between which gets scanned first. |
Returns
Type | Description |
---|---|
HashSet<Face> | A collection of faces gathered by extending a ring or loop, |
GetFaceRingAndLoop(ProBuilderMesh, Face[])
Finds and returns both a face ring and loop from the selected faces. This is the equivalent of the Select Face Loop and Select Face Ring actions.
Declaration
public static HashSet<Face> GetFaceRingAndLoop(ProBuilderMesh mesh, Face[] faces)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
Face[] | faces | The faces to scan for ring and loops. |
Returns
Type | Description |
---|---|
HashSet<Face> | A collection of faces gathered by extending in a ring and loop. |
GetNeighborFaces(ProBuilderMesh, Edge, List<Face>)
Creates a list of Face objects where each face is connected to a specific Edge in the ProBuilderMesh.
Declaration
public static void GetNeighborFaces(ProBuilderMesh mesh, Edge edge, List<Face> neighborFaces)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The ProBuilder mesh containing the edge. |
Edge | edge | The edge to evaluate. |
List<Face> | neighborFaces | Specify an empty list of faces for the method to fill. |
GetPerimeterEdges(ProBuilderMesh, IEnumerable<Face>)
Returns all the edges that are on the perimeter of this set of selected faces.
Declaration
public static IEnumerable<Edge> GetPerimeterEdges(this ProBuilderMesh mesh, IEnumerable<Face> faces)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh containing the faces. |
System.Collections.Generic.IEnumerable<Face> | faces | The faces to search for perimeter edge paths. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Edge> | A list of the edges on the perimeter of each group of adjacent faces. |
GrowSelection(ProBuilderMesh, IEnumerable<Face>, Single)
Expand the selected faces to include any face touching the perimeter edges. This corresponds to the Grow Selection action.
Declaration
public static HashSet<Face> GrowSelection(ProBuilderMesh mesh, IEnumerable<Face> faces, float maxAngleDiff = -1F)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
System.Collections.Generic.IEnumerable<Face> | faces | The faces to grow out from. |
Single | maxAngleDiff | Specify the maximum difference (in degrees) between the normals on the selected face and those on the perimeter face. |
Returns
Type | Description |
---|---|
HashSet<Face> | The original faces selection, plus any new faces added as a result of the grow operation. |