mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 02:16:51 +02:00
Update editEntities import/export
This commit is contained in:
parent
03c03a20f9
commit
a2617b2c96
2 changed files with 31 additions and 12 deletions
|
@ -420,8 +420,6 @@ var toolBar = (function () {
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
|
||||||
var exportMenu = null;
|
|
||||||
|
|
||||||
function isLocked(properties) {
|
function isLocked(properties) {
|
||||||
// special case to lock the ground plane model in hq.
|
// special case to lock the ground plane model in hq.
|
||||||
if (location.hostname == "hq.highfidelity.io" &&
|
if (location.hostname == "hq.highfidelity.io" &&
|
||||||
|
@ -749,9 +747,6 @@ Script.scriptEnding.connect(function() {
|
||||||
tooltip.cleanup();
|
tooltip.cleanup();
|
||||||
modelImporter.cleanup();
|
modelImporter.cleanup();
|
||||||
selectionDisplay.cleanup();
|
selectionDisplay.cleanup();
|
||||||
if (exportMenu) {
|
|
||||||
exportMenu.close();
|
|
||||||
}
|
|
||||||
Entities.setLightsArePickable(originalLightsArePickable);
|
Entities.setLightsArePickable(originalLightsArePickable);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -796,15 +791,40 @@ function handeMenuEvent(menuItem) {
|
||||||
} else if (menuItem == "Paste Models") {
|
} else if (menuItem == "Paste Models") {
|
||||||
modelImporter.paste();
|
modelImporter.paste();
|
||||||
} else if (menuItem == "Export Models") {
|
} else if (menuItem == "Export Models") {
|
||||||
if (!exportMenu) {
|
if (!selectionManager.hasSelection()) {
|
||||||
exportMenu = new ExportMenu({
|
Window.alert("No entities have been selected.");
|
||||||
onClose: function () {
|
} else {
|
||||||
exportMenu = null;
|
var filename = "models__" + Window.location.hostname + "__.svo";
|
||||||
|
filename = Window.save("Select where to save", filename, "*.svo")
|
||||||
|
if (filename) {
|
||||||
|
var success = Clipboard.exportEntities(filename, selectionManager.selections);
|
||||||
|
if (!success) {
|
||||||
|
Window.alert("Export failed.");
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
} else if (menuItem == "Import Models") {
|
} else if (menuItem == "Import Models") {
|
||||||
modelImporter.doImport();
|
var filename = Window.browse("Select models to import", "", "*.svo")
|
||||||
|
if (filename) {
|
||||||
|
var success = Clipboard.importEntities(filename);
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
var distance = cameraManager.enabled ? cameraManager.zoomDistance : DEFAULT_ENTITY_DRAG_DROP_DISTANCE;
|
||||||
|
var direction = Quat.getFront(Camera.orientation);
|
||||||
|
var offset = Vec3.multiply(distance, direction);
|
||||||
|
var position = Vec3.sum(Camera.position, offset);
|
||||||
|
|
||||||
|
position.x = Math.max(0, position.x);
|
||||||
|
position.y = Math.max(0, position.y);
|
||||||
|
position.z = Math.max(0, position.z);
|
||||||
|
|
||||||
|
var pastedEntityIDs = Clipboard.pasteEntities(position);
|
||||||
|
|
||||||
|
selectionManager.setSelections(pastedEntityIDs);
|
||||||
|
} else {
|
||||||
|
Window.alert("There was an error importing the entity file.");
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (menuItem == "Entity List...") {
|
} else if (menuItem == "Entity List...") {
|
||||||
entityListTool.toggleVisible();
|
entityListTool.toggleVisible();
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,6 +219,5 @@ ExportMenu = function (opts) {
|
||||||
Overlays.deleteOverlay(scaleView);
|
Overlays.deleteOverlay(scaleView);
|
||||||
};
|
};
|
||||||
|
|
||||||
print("CONNECTING!");
|
|
||||||
Controller.mouseReleaseEvent.connect(this.mouseReleaseEvent);
|
Controller.mouseReleaseEvent.connect(this.mouseReleaseEvent);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue