Editor.Model.LayerSet
ClassRepresents an immutable set of scene layers, supporting set operations like union, intersection, and difference.
Index
Properties
Methods
Example
const allSet = Editor.Model.LayerSet.All;
const noneSet = Editor.Model.LayerSet.None;
console.log(`All set is empty: ${allSet.isEmpty()}`);
console.log(`None set is empty: ${noneSet.isEmpty()}`);
console.log(`All set mask: ${allSet.mask}`);
const setA = Editor.Model.LayerSet.fromId(Editor.Model.LayerId.Default);
const setB = Editor.Model.LayerSet.fromId(Editor.Model.LayerId.Ortho);
const union = setA.union(setB);
const intersection = setA.intersect(setB);
const difference = setA.except(setB);
console.log(`setA contains Default: ${setA.contains(Editor.Model.LayerSet.fromId(Editor.Model.LayerId.Default))}`);
console.log(`Union mask: ${union.mask}`);
console.log(`Intersection is empty: ${intersection.isEmpty()}`);
console.log(`Difference mask: ${difference.mask}`);
// Reconstruct a LayerSet from a raw bitmask
const fromMask = Editor.Model.LayerSet.fromMask(union.mask);
console.log(`fromMask equals union: ${fromMask.mask === union.mask}`);
const predefined = Editor.Model.LayerSet.PredefinedIds();
console.log(`Predefined ids mask: ${predefined.mask}`);
Properties
All
staticAll:LayerSet
A LayerSet containing all available layers.
mask
readonlymask:number
The underlying bitmask representing the set of active layers.
None
staticNone:LayerSet
An empty LayerSet containing no layers.
Methods
contains()
contains(
other):boolean
Returns true if this set contains all layers in the given LayerSet.
Parameters
| Parameter | Type |
|---|---|
other | LayerSet |
Returns
boolean
except()
except(
other):LayerSet
Returns a new LayerSet with all layers from the given set removed.
Parameters
| Parameter | Type |
|---|---|
other | LayerSet |
Returns
LayerSet
fromBit()
staticfromBit(bit):LayerSet
Creates a LayerSet from a single bit index.
Parameters
| Parameter | Type |
|---|---|
bit | number |
Returns
LayerSet
fromId()
staticfromId(layerId):LayerSet
Creates a LayerSet from a single LayerId.
Parameters
| Parameter | Type |
|---|---|
layerId | LayerId |
Returns
LayerSet
fromMask()
staticfromMask(mask):LayerSet
Creates a LayerSet from a raw bitmask value.
Parameters
| Parameter | Type |
|---|---|
mask | number |
Returns
LayerSet
intersect()
intersect(
other):LayerSet
Returns a new LayerSet containing only layers present in both sets.
Parameters
| Parameter | Type |
|---|---|
other | LayerSet |
Returns
LayerSet
isEmpty()
isEmpty():
boolean
Returns true if this set contains no layers.
Returns
boolean
PredefinedIds()
staticPredefinedIds():LayerSet
Returns the collection of predefined layer identifiers.
Returns
LayerSet
toArray()
toArray():
LayerId[]
Returns an array of all LayerId values in this set.
Returns
LayerId[]
union()
union(
other):LayerSet
Returns a new LayerSet combining all layers from both sets.
Parameters
| Parameter | Type |
|---|---|
other | LayerSet |
Returns
LayerSet