Home Reference Source
import {Selection} from 'postprocessing'
public class | source

Selection

Extends:

Set → Selection

An object selection.

Object selections use render layers to facilitate quick and efficient visibility changes.

Constructor Summary

Public Constructor
public

constructor(iterable: Iterable<Object3D>, layer: Number)

Constructs a new selection.

Member Summary

Public Members
public get

A dedicated render layer for selected objects.

public set

Sets the render layer of selected objects.

Method Summary

Public Methods
public

add(object: Object3D): Selection

Adds an object to this selection.

public

Clears this selection.

public

delete(object: Object3D): Boolean

Removes an object from this selection.

public

indexOf(object: Object3D): Number

this method was deprecated. Added for backward compatibility. Use has instead.

An alias for has.

public

set(objects: Iterable<Object3D>): Selection

Clears this selection and adds the given objects.

public

Sets the visibility of all selected objects.

Public Constructors

public constructor(iterable: Iterable<Object3D>, layer: Number) source

Constructs a new selection.

Params:

NameTypeAttributeDescription
iterable Iterable<Object3D>
  • optional

A collection of objects that should be added to this selection.

layer Number
  • optional
  • default: 10

A dedicated render layer for selected objects.

Public Members

public get layer: Number source

A dedicated render layer for selected objects.

This layer is set to 10 by default. If this collides with your own custom layers, please change it to a free layer before rendering!

public set layer: Number source

Sets the render layer of selected objects.

The current selection will be updated accordingly.

Public Methods

public add(object: Object3D): Selection source

Adds an object to this selection.

Params:

NameTypeAttributeDescription
object Object3D

The object that should be selected.

Return:

Selection

This selection.

public clear(): Selection source

Clears this selection.

Return:

Selection

This selection.

public delete(object: Object3D): Boolean source

Removes an object from this selection.

Params:

NameTypeAttributeDescription
object Object3D

The object that should be deselected.

Return:

Boolean

Returns true if an object has successfully been removed from this selection; otherwise false.

public indexOf(object: Object3D): Number source

this method was deprecated. Added for backward compatibility. Use has instead.

An alias for has.

Params:

NameTypeAttributeDescription
object Object3D

An object.

Return:

Number

Returns 0 if the given object is currently selected, or -1 otherwise.

public set(objects: Iterable<Object3D>): Selection source

Clears this selection and adds the given objects.

Params:

NameTypeAttributeDescription
objects Iterable<Object3D>

The objects that should be selected. This array will be copied.

Return:

Selection

This selection.

public setVisible(visible: Boolean): Selection source

Sets the visibility of all selected objects.

This method enables or disables render layer 0 of all selected objects.

Params:

NameTypeAttributeDescription
visible Boolean

Whether the selected objects should be visible.

Return:

Selection

This selection.