A VertexSelection represents a set of vertices for a scene mesh node as a virtual array. As such, you can access a vertex by index, iterate over the vertices, and apply mapped functions to the vertices. See also Editable_Mesh. The VertexSelection array is dynamic, i.e., its contents will change as the vertices or selected vertices of the mesh node change. VertexSelection values are mappable.
Constructors
<mesh>.selectedVerts -- the currently selected vertices of the mesh object
<mesh>.verts -- all of the vertices of the mesh object, read-only
Properties
<vertexselection>.count : Integer, read-only
Returns the number of vertices in the VertexSelection array.
<vertexselection>.selSetNames : Array of names, read-only
Returns an array of names of the current vertex-level named selection sets for the object the VertexSelection is associated with.
The following properties are present for singleton selections (of the form $foo.verts[n]):
<vertexselection>.index : Integer, read-only
Returns the index of the selected element in the mesh, e.g.,
$foo.selectedVerts[2].index
returns the vertex index of the 2nd vertex in the current selection.
<vertexselection>.pos : Point3
Returns or sets the position of the selected element in the mesh, e.g.,
$foo.verts[i].pos = $baz.verts[j].pos + [10,0,0]
Note that iterating over a selection yields singleton selections in the loop body:
sv = for i in $foo.selectedVerts collect i.index
sv contains selected vertices as array
Operators
<mesh>.selectedVerts = (<array> | <bitarray>)
Selects the specified vertices.
<vertexselection>[<integer>]
Retrieves the indexed vertex as a singleton VertexSelection. Index starts at 1
<vertexselection>[<integer>] = <point3>
Sets the position of the indexed vertex.
<vertexselection>[(<integer_array> | <bitarray>)]
Retrieves the indexed vertices as a VertexSelection. Index starts at 1.
<vertexselection>[(<#name> | <string>)]
Retrieves the vertex-level named selection set, where the name of the named selection set can be specified as a name or string value.
<vertexselection>[(<#name> | <string>)] = (<vertexselection> | <integer_array> | <bitarray>)
Sets the vertex-level named selection set to the specified vertices. The name of the named selection set can be specified as a name or string value, and the vertices can be specified as an array, bitArray, or a VertexSelection from the same object.
Methods
move <vertexselection> <point3>
Moves the vertices in the VertexSelection.
Selects the vertices in the VertexSelection.
Deselects the vertices in the VertexSelection.
Deletes the vertices in the VertexSelection.
append <vertexselection> (<vertexselection> | <integer>)
Appends the vertex or vertices to the VertexSelection.
findItem <vertexselection> (<vertexselection[<integer>] | <integer>)
Returns the selection index of the matching item or 0 if not found. The item is selection index or singleton VertexSelection.
Examples
-- move vertices in 'mouth' named selection set
move $foo.verts[#mouth] [0,0,10]
-- select vertices in 'front verts' set
select $baz.verts["front verts"]
-- set 'baz' named selection set to given vertices
$foo.verts[#baz] = #(1,3,4,5,10)
-- set 'cursel' set to current selection
$baz.verts[#cursel] = $baz.selectedVerts
-- all the names of the vertex-level named selection sets for object $foo
$foo.verts.selSetNames
-- print out all vertex-level named selection sets
for n in $.verts.selSetNames do print $.verts[n]