Editor.Size
ClassUsed with Editor.Assets.RenderTarget.
Index
Example
// Editor.Size is an integer (x, y) pair used to express a pixel dimension.
// Its most common consumer is RenderTarget.resolution — set this Size to
// control the render-target output dimensions when `useScreenResolution`
// is false.
const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const captureTarget = model.project.scene.captureTarget;
captureTarget.useScreenResolution = false;
captureTarget.resolution = new Editor.Size(1080, 1920);
console.log(
`captureTarget size: ${captureTarget.resolution.x} x ${captureTarget.resolution.y}`
);
Constructors
Constructor
new Size(
x,y):Size
Constructs a Size with the given width and height values.
Parameters
| Parameter | Type |
|---|---|
x | number |
y | number |
Returns
Size
Properties
x
x:
number
Horizontal component of the size.
y
y:
number
Vertical component of the size.
Methods
equal()
equal(
value):boolean
Checks whether this size equals the given size.
Parameters
| Parameter | Type |
|---|---|
value | Size |
Returns
boolean
fromVec2()
staticfromVec2(value):Size
Creates a Size from a vec2 value.
Parameters
| Parameter | Type |
|---|---|
value | vec2 |
Returns
Size
isEmpty()
isEmpty():
boolean
Returns true if both x and y are zero.
Returns
boolean
toVec2()
toVec2():
vec2
Converts this size to a vec2.