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
this get was deprecated. Use getLayer() instead.

The render layer for selected objects.

public set
this set was deprecated. Use setLayer() instead.

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

Returns the current render layer for selected objects.

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

setLayer(value: Number)

Sets the render layer for selected 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 exclusive: Boolean source

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

public get layer: Number source

this get was deprecated. Use getLayer() instead.

The render layer for selected objects.

public set layer: Number source

this set was deprecated. Use setLayer() instead.

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

Returns the current 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!

Return:

Number

The layer

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

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.