overte icon indicating copy to clipboard operation
overte copied to clipboard

API function to export all loaded world entities as-is

Open ada-tv opened this issue 7 months ago • 2 comments

Adds export options to Clipboard.exportEntities for global positioning, excluding non-domain entities, and pathnames for serverless JSONs.

Example script that binds Ctrl+S to open a save dialog

Closes #1411

ada-tv avatar Jun 11 '25 06:06 ada-tv

I gave this a test and noticed two things: The example script doesn't do anything on my system. I ran:

const file = Window.save("Export world JSON", "", "*.json");

and then

if (file) {
		Clipboard.exportEntities(file, 0, 0, 0, 3e38, {
			domainOnly: true,
			globalPositions: true,
			paths: {
				"/": {position: MyAvatar.position, orientation: MyAvatar.orientation}
			}
		});

instead.

Rotations appear wrong in the JSON. Every entity has the following rotation in the resulting JSON file, regardless of their real rotation.

"w": 1,
"x": -1.52587890625e-05,
"y": -1.52587890625e-05,
"z": -1.52587890625e-05

Though in practice it still works (left is the original, right is the export loaded as serverless): Auswahl_056

JulianGro avatar Aug 13 '25 09:08 JulianGro

There's now Clipboard.ExportOptions and Clipboard.ExportPlaces in the docs, and domainOnly has been removed. The selected entities mode can already include what entities it wants, and allowing avatar entities and local entities in the box selection doesn't really make sense as it'll always be full of HUD elements and other users' wearables.

ada-tv avatar Nov 16 '25 22:11 ada-tv