Skip to main content

Editor.Size

Class

Used 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

ParameterType
xnumber
ynumber

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

ParameterType
valueSize

Returns

boolean


fromVec2()

static fromVec2(value): Size

Creates a Size from a vec2 value.

Parameters

ParameterType
valuevec2

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.

Returns

vec2