mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 11:37:58 +02:00
Update and add localModels overlay to editModels.js import/export
This commit is contained in:
parent
43f61b4718
commit
06e6505584
1 changed files with 18 additions and 5 deletions
|
@ -153,7 +153,7 @@ var ExportMenu = function(opts) {
|
||||||
width: cancelWidth,
|
width: cancelWidth,
|
||||||
height: height,
|
height: height,
|
||||||
color: { red: 255, green: 255, blue: 255 },
|
color: { red: 255, green: 255, blue: 255 },
|
||||||
text: "Cancel"
|
text: "Close"
|
||||||
});
|
});
|
||||||
|
|
||||||
var voxelPreview = Overlays.addOverlay("cube", {
|
var voxelPreview = Overlays.addOverlay("cube", {
|
||||||
|
@ -291,6 +291,12 @@ var ModelImporter = function(opts) {
|
||||||
var fullWidth = titleWidth + cancelWidth + (2 * margin);
|
var fullWidth = titleWidth + cancelWidth + (2 * margin);
|
||||||
|
|
||||||
// TODO: Show import preview
|
// TODO: Show import preview
|
||||||
|
var localModels = Overlays.addOverlay("localmodels", {
|
||||||
|
position: { x: 1, y: 1, z: 1 },
|
||||||
|
scale: 1,
|
||||||
|
visible: false
|
||||||
|
});
|
||||||
|
var importScale = 1;
|
||||||
var importBoundaries = Overlays.addOverlay("cube", {
|
var importBoundaries = Overlays.addOverlay("cube", {
|
||||||
position: { x: 0, y: 0, z: 0 },
|
position: { x: 0, y: 0, z: 0 },
|
||||||
size: 1,
|
size: 1,
|
||||||
|
@ -337,6 +343,7 @@ var ModelImporter = function(opts) {
|
||||||
|
|
||||||
this.setImportVisible = function(visible) {
|
this.setImportVisible = function(visible) {
|
||||||
Overlays.editOverlay(importBoundaries, { visible: visible });
|
Overlays.editOverlay(importBoundaries, { visible: visible });
|
||||||
|
Overlays.editOverlay(localModels, { visible: visible });
|
||||||
Overlays.editOverlay(cancelButton, { visible: visible });
|
Overlays.editOverlay(cancelButton, { visible: visible });
|
||||||
Overlays.editOverlay(titleText, { visible: visible });
|
Overlays.editOverlay(titleText, { visible: visible });
|
||||||
Overlays.editOverlay(background, { visible: visible });
|
Overlays.editOverlay(background, { visible: visible });
|
||||||
|
@ -346,6 +353,9 @@ var ModelImporter = function(opts) {
|
||||||
this.moveImport = function(position) {
|
this.moveImport = function(position) {
|
||||||
importPosition = position;
|
importPosition = position;
|
||||||
// TODO: Show import preview
|
// TODO: Show import preview
|
||||||
|
Overlays.editOverlay(localModels, {
|
||||||
|
position: { x: importPosition.x, y: importPosition.y, z: importPosition.z }
|
||||||
|
});
|
||||||
Overlays.editOverlay(importBoundaries, {
|
Overlays.editOverlay(importBoundaries, {
|
||||||
position: { x: importPosition.x, y: importPosition.y, z: importPosition.z }
|
position: { x: importPosition.x, y: importPosition.y, z: importPosition.z }
|
||||||
});
|
});
|
||||||
|
@ -412,14 +422,15 @@ var ModelImporter = function(opts) {
|
||||||
var y = parts[3];
|
var y = parts[3];
|
||||||
var z = parts[4];
|
var z = parts[4];
|
||||||
var s = parts[5];
|
var s = parts[5];
|
||||||
|
importScale = s;
|
||||||
if (hostname != location.hostname) {
|
if (hostname != location.hostname) {
|
||||||
if (!Window.confirm(("These models were not originally exported from this domain. Continue?"))) {
|
if (!Window.confirm(("These models were not originally exported from this domain. Continue?"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Window.confirm(("Would you like to import back to the source location?"))) {
|
if (Window.confirm(("Would you like to import back to the source location?"))) {
|
||||||
Window.alert("(TODO) Importing backing to source location");
|
|
||||||
Clipboard.importModels(filename);
|
Clipboard.importModels(filename);
|
||||||
|
Clipboard.pasteModels(x, y, z, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -427,19 +438,21 @@ var ModelImporter = function(opts) {
|
||||||
Clipboard.importModels(filename);
|
Clipboard.importModels(filename);
|
||||||
self._importing = true;
|
self._importing = true;
|
||||||
self.setImportVisible(true);
|
self.setImportVisible(true);
|
||||||
|
Overlays.editOverlay(importBoundaries, { size: s });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.paste = function() {
|
this.paste = function() {
|
||||||
if (self._importing) {
|
if (self._importing) {
|
||||||
self._importing = false;
|
// self._importing = false;
|
||||||
self.setImportVisible(false);
|
// self.setImportVisible(false);
|
||||||
Clipboard.pasteModels();
|
Clipboard.pasteModels(importPosition.x, importPosition.y, importPosition.z, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cleanup = function() {
|
this.cleanup = function() {
|
||||||
|
Overlays.deleteOverlay(localModels);
|
||||||
Overlays.deleteOverlay(importBoundaries);
|
Overlays.deleteOverlay(importBoundaries);
|
||||||
Overlays.deleteOverlay(cancelButton);
|
Overlays.deleteOverlay(cancelButton);
|
||||||
Overlays.deleteOverlay(titleText);
|
Overlays.deleteOverlay(titleText);
|
||||||
|
|
Loading…
Reference in a new issue