FaceSelection Values

A FaceSelection represents a set of faces for a scene mesh node as a virtual array. As such, you can access a face by index, iterate over the faces, and apply mapped functions to the faces. See also Editable_Mesh. The FaceSelection array is dynamic, i.e., its contents will change as the faces or selected faces of the mesh node change. FaceSelection values are mappable.

Constructors

.selectedFaces

The currently selected faces of the mesh object

.Faces

All of the faces of the mesh object, read-only

Properties

.count : Integer, read-only

Returns the number of faces in the FaceSelection array.

.selSetNames : Array of names, read-only

Returns an array of names of the current face-level named selection sets for the object the FaceSelection is associated with.

The following property is present for singleton selections (of the form $foo.faces[n]):

.index : Integer, read-only

Returns the index of the selected element in the mesh,

For example

$foo.selectedFaces[2].index

returns the face index of the 2nd face in the current selection.

Note

that iterating over a selection yields singleton selections in the loop body:

sf = for i in $foo.selectedFaces collect i.index

--sf contains selected faces as array

Operators

.selectedFaces = ( | )

Selects the specified faces.

[]

Retrieves the indexed face as a singleton FaceSelection. Index starts at 1.

[] =

Sets the vertices of the indexed face to the vertex indices specified in the point3 value.

[( | )]

Retrieves the indexed faces as a FaceSelection. Index starts at 1.

[(<#name> | )]

Retrieves the face-level named selection set, where the name of the named selection set can be specified as a name or string value.

[(<#name> | )] = ( | | )

Sets the face-level named selection set to the specified faces. The name of the named selection set can be specified as a name or string value, and the faces can be specified as an array, bitArray, or a FaceSelection from the same object.

Methods

move

Moves the faces in the FaceSelection.

select

Selects the faces in the FaceSelection.

deselect

Deselects the faces in the FaceSelection.

delete

Deletes the faces in the FaceSelection.

append ( | )

Appends the face(s) to the FaceSelection.

findItem (<>] | )

Returns the selection index of the matching item or 0 if not found. The item is selection index or singleton FaceSelection.

Examples

-- move faces in 'mouth' named selection set

move $foo.faces[#mouth] [0,0,10]

-- select faces in 'front faces' set

select $baz.faces["front faces"]

-- set 'baz' named selection set to given faces

$foo.faces[#baz] = #(1,3,4,5,10)

-- set 'cursel' set to current selection

$baz.faces[#cursel] = $baz.selectedFaces

-- all the names of the face-level named selection sets for object $foo

$foo.faces.selSetNames

-- print out all face-level named selection sets

for n in $.faces.selSetNames do print $.faces[n]