Merge pull request #9953 from fayeli/edit-export-entities

Adding Export Entities Functionality in Tablet Edit
This commit is contained in:
Seth Alves 2017-03-20 11:35:18 -08:00 committed by GitHub
commit 8988110c3b
3 changed files with 16 additions and 4 deletions

View file

@ -24,7 +24,7 @@
<input type="button" id="locked" class="glyph" value="&#xe006;" />
<input type="button" id="visible" class="glyph" value="&#xe007;" />
</div>
<input type="button" id="teleport" value="Jump To Selection" />
<input type="button" id="export" value="Export Selection" />
<input type="button" id="pal" class="glyph" value="&#xe00c;" />
<input type="button" class="red" id="delete" value="Delete" />
</div>

View file

@ -39,7 +39,7 @@ function loaded() {
elFilter = document.getElementById("filter");
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");
@ -273,8 +273,8 @@ function loaded() {
elToggleVisible.onclick = function () {
EventBridge.emitWebEvent(JSON.stringify({ type: 'toggleVisible' }));
}
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' }));

View file

@ -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) {