Clipboard

Available in: Interface Scripts Client Entity Scripts

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

Methods

exportEntities(filename, x, y, z, scale) → {boolean}
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.
Returns:
true if the export was successful, otherwise false.
Type: boolean
exportEntities(filename, entityIDs) → {boolean}
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.
Returns:
true if the export was successful, otherwise false.
Type: boolean
getClipboardContentsLargestDimension() → {number}
Compute the largest dimension of the extents of the contents held in the clipboard.
Returns:
The largest dimension computed.
Type: number
getContentsDimensions() → {Vec3}
Compute the extents of the contents held in the clipboard.
Returns:
The extents of the contents held in the clipboard.
Type: Vec3
importEntities(filename, does, optional) → {boolean}
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.
Returns:
true if the import was successful, otherwise false.
Type: boolean
pasteEntities(position) → {Array.<Uuid>}
Paste the contents of the clipboard into the world.
Parameters:
Name Type Description
position Vec3 Position to paste the clipboard contents at.
Returns:
Array of entity IDs for the new entities that were created as a result of the paste operation.
Type: Array.< Uuid>