Clipboard

Description

The Clipboard API enables you to export and import entities to and from JSON files.

Supported Script Types: Interface Scripts • Client Entity Scripts • Avatar Scripts

Methods

Name Return Value Summary
exportEntities boolean Export the entities specified to a JSON file.
exportEntities boolean Export the entities with centers within a cube to a JSON file.
getClipboardContentsLargestDimension number Compute the largest dimension of the extents of the contents held in the clipboard.
getContentsDimensions Vec3 Compute the extents of the contents held in the clipboard.
importEntities boolean Import entities from a JSON file containing entity data into the clipboard. You can generate a JSON file using Clipboard.exportEntities.
pasteEntities Array.<Uuid> Paste the contents of the clipboard into the world.

Method Details

(static) exportEntities( filename, entityIDs ) → {boolean}
Returns: true if the export was successful, otherwise false.

Export the entities specified to a JSON file.

Parameters

Name Type Description
filename string Path and name of the file to export the entities to. Should have the extension ".json".
entityIDs Array.<Uuid> Array of IDs of the entities to export.
(static) exportEntities( filename, x, y, z, scale ) → {boolean}
Returns: true if the export was successful, otherwise false.

Export the entities with centers within a cube to a JSON file.

Parameters

Name Type Description
filename string Path and name of the file to export the entities to. Should have the extension ".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.
(static) getClipboardContentsLargestDimension( ) → {number}
Returns: The largest dimension computed.

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

(static) getContentsDimensions( ) → {Vec3}
Returns: The extents of the contents held in the clipboard.

Compute the extents of the contents held in the clipboard.

(static) importEntities( filename, does, optional ) → {boolean}
Returns: true if the import was successful, otherwise false.

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 Path and name of file to import.
does boolean the ResourceRequestObserver observe this request?
optional number internal id of object causing this import.
(static) pasteEntities( position ) → {Array.<Uuid>}
Returns: Array of entity IDs for the new entities that were created as a result of the paste operation.

Paste the contents of the clipboard into the world.

Parameters

Name Type Description
position Vec3 Position to paste the clipboard contents at.