From 197a06c423355497e3b7f74d84153cc093c53099 Mon Sep 17 00:00:00 2001 From: Faye Li Date: Fri, 17 Mar 2017 16:17:21 -0700 Subject: [PATCH] changes in TWO entityList.js to register the export event --- scripts/system/html/js/entityList.js | 4 ++++ scripts/system/libraries/entityList.js | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/scripts/system/html/js/entityList.js b/scripts/system/html/js/entityList.js index dd8e8199b4..a371b3bdc9 100644 --- a/scripts/system/html/js/entityList.js +++ b/scripts/system/html/js/entityList.js @@ -40,6 +40,7 @@ function loaded() { elInView = document.getElementById("in-view") elRadius = document.getElementById("radius"); elTeleport = document.getElementById("teleport"); + elExport = document.getElementById("export"); elPal = document.getElementById("pal"); elEntityTable = document.getElementById("entity-table"); elInfoToggle = document.getElementById("info-toggle"); @@ -276,6 +277,9 @@ function loaded() { elTeleport.onclick = function () { EventBridge.emitWebEvent(JSON.stringify({ type: 'teleport' })); } + elExport.onclick = function() { + EventBridge.emitWebEvent(JSON.stringify({ type: 'export'})); + } elPal.onclick = function () { EventBridge.emitWebEvent(JSON.stringify({ type: 'pal' })); } diff --git a/scripts/system/libraries/entityList.js b/scripts/system/libraries/entityList.js index 63ac33a1dd..3488733289 100644 --- a/scripts/system/libraries/entityList.js +++ b/scripts/system/libraries/entityList.js @@ -128,6 +128,18 @@ EntityListTool = function(opts) { if (selectionManager.hasSelection()) { MyAvatar.position = selectionManager.worldPosition; } + } else if (data.type == "export") { + if (!selectionManager.hasSelection()) { + Window.notifyEditError("No entities have been selected."); + } else { + var filename = Window.save("Select Where to Save", "", "*.json"); + if (filename) { + var success = Clipboard.exportEntities(filename, selectionManager.selections); + if (!success) { + Window.notifyEditError("Export failed."); + } + } + } } else if (data.type == "pal") { var sessionIds = {}; // Collect the sessionsIds of all selected entitities, w/o duplicates. selectionManager.selections.forEach(function (id) {