Description
The VertexSelection
property is a public instance property of the BaseMeshTool
class within the Editor.MeshEditor
namespace. It provides access to a collection of selected mesh vertices, represented as a HashSet<MeshVertex>
. This property is used to manage and manipulate the vertices that are currently selected in the mesh editor tool.
Usage
Use the VertexSelection
property to access or modify the set of vertices that are currently selected in the mesh editor. This property is particularly useful when implementing custom mesh editing tools that need to interact with vertex selections.
To add a vertex to the selection, simply add it to the HashSet
returned by this property. To remove a vertex, remove it from the HashSet
. You can also clear the selection by calling Clear()
on the HashSet
.
Example
// Example of using the VertexSelection property
// Assume 'tool' is an instance of a class derived from BaseMeshTool
var selectedVertices = tool.VertexSelection;
// Add a vertex to the selection
MeshVertex vertex = new MeshVertex(); // Assume this is a valid vertex
selectedVertices.Add(vertex);
// Remove a vertex from the selection
selectedVertices.Remove(vertex);
// Clear the selection
selectedVertices.Clear();