Clipboard

The Clipboard Scripting Interface powers the import and export of entities (in JSON files) in the Create menu. You can use the Clipboard API to import and export entity files (which include entities and/or entity behavior).

Methods
Clipboard.exportEntities(filename, entityIDs)
Clipboard.exportEntities(filename, x, y, z, scale)
Clipboard.getClipboardContentsLargestDimension()
Clipboard.getContentsDimensions()
Clipboard.importEntities(filename)
Clipboard.pasteEntities(position)

exportEntities(filename, entityIDs)

Exports entities to the JSON filename specified.

Parameters

Name Type Description
filename string The path and name of the file where the entities are to be exported. Must have the extention .json.
entitiyIDs Array. Entity ids in an array.

Returns

Returns Type Description
true boolean The export was successful.
false boolean The export was not successsful.

exportEntities(filename, x, y, z, scale)

Exports entities with centers within a cube to a JSOn file.

Parameters

Name Type Description
filename string The path and name of the file where the entities are to be exported. Must have the extention .json.
x number x coordinate of the cube center.
y number y coordinate of the cube center.
z number z coordinate of the cube center.
scale number Half dimension of the cube.

Returns

Returns Type Description
true boolean The export was successful.
false boolean The export was not successsful.

getClipboardContentsLargestDimension()

Computes the largest dimension of the extents of the contents held in the clipboard.

Returns

Type Description
number The largest dimension computed

getContentsDimensions()

Computes the extents of the contents held in the clipboard.

Returns

Type Description
Vec3 The extents computed

importEntities(filename)

Import entities from a JSON file containing entity data into the clipboard. You can generate a JSON file using Clipboard.exportEntities.

Parameters

Name Type Description
filename string The path and name of the file from where the entities are imported.

Returns

Returns Type Description
true boolean The import was successful.
false boolean The import was not successsful.

pasteEntities(position)

Pastes the contens of the clipboard into High Fidelity.

Parameters

Name Type Description
position Vec3 The location/position where you want to place the entities

Returns

Returns Type Description
array Array. Array of entity IDs for the new entities that were created as a result of the paste operation.