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

Controls whether objects that are added to this selection should be removed from all other layers.

public get

The render layer for selected objects.

public set

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
this method was deprecated. Use layer instead.

Returns the current render layer for selected objects.

public

indexOf(object: Object3D): Number

this method was deprecated. Added for backward-compatibility.

An alias for has.

public
this method was deprecated. Use exclusive instead.

Indicates whether objects that are added to this selection will be removed from all other layers.

public

set(objects: Iterable<Object3D>): Selection

Clears this selection and adds the given objects.

public
this method was deprecated. Use exclusive instead.

Controls whether objects that are added to this selection should be removed from all other layers.

public

setLayer(value: Number)

this method was deprecated. Use layer instead.

Sets the render layer for selected objects.

public

Sets the visibility of all selected objects.

public

toggle(object: Object3D): Boolean

Removes an existing object from the selection.

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 exclusive: Boolean source

Controls whether objects that are added to this selection should be removed from all other layers.

public get layer: Number source

The render layer for selected objects.

public set layer source

Public Methods

public add(object: Object3D): Selection source

Adds an object to this selection.

If exclusive is set to true, the object will also be removed from all other layers.

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 getLayer(): Number source

this method was deprecated. Use layer instead.

Returns the current render layer for selected objects.

The default layer is 10. If this collides with your own custom layers, please change it before rendering!

Return:

Number

The layer.

public indexOf(object: Object3D): Number source

this method was deprecated. Added for backward-compatibility.

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 isExclusive(): Number source

this method was deprecated. Use exclusive instead.

Indicates whether objects that are added to this selection will be removed from all other layers.

Return:

Number

Whether this selection is exclusive. Default is false.

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.

Return:

Selection

This selection.

public setExclusive(value: Number) source

this method was deprecated. Use exclusive instead.

Controls whether objects that are added to this selection should be removed from all other layers.

Params:

NameTypeAttributeDescription
value Number

Whether this selection should be exclusive.

public setLayer(value: Number) source

this method was deprecated. Use layer instead.

Sets the render layer for selected objects.

The current selection will be updated accordingly.

Params:

NameTypeAttributeDescription
value Number

The layer. Range is [0, 31].

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.

public toggle(object: Object3D): Boolean source

Removes an existing object from the selection. If the object doesn't exist it's added instead.

Params:

NameTypeAttributeDescription
object Object3D

The object.

Return:

Boolean

Returns true if the object is added, false otherwise.