mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 16:10:40 +02:00
Add import svo requests in editEntities
This commit is contained in:
parent
0048b91311
commit
76ebac1185
1 changed files with 46 additions and 18 deletions
|
@ -95,6 +95,21 @@ var isActive = false;
|
|||
|
||||
var placingEntityID = null;
|
||||
|
||||
IMPORTING_SVO_OVERLAY_WIDTH = 130;
|
||||
IMPORTING_SVO_OVERLAY_HEIGHT = 30;
|
||||
IMPORTING_SVO_OVERLAY_MARGIN = 6;
|
||||
var importingSVOOverlay = Overlays.addOverlay("text", {
|
||||
font: { size: 14 },
|
||||
text: "Importing SVO...",
|
||||
x: Window.innerWidth - IMPORTING_SVO_OVERLAY_WIDTH - IMPORTING_SVO_OVERLAY_MARGIN,
|
||||
y: Window.innerHeight - IMPORTING_SVO_OVERLAY_HEIGHT - IMPORTING_SVO_OVERLAY_MARGIN,
|
||||
width: IMPORTING_SVO_OVERLAY_WIDTH,
|
||||
height: IMPORTING_SVO_OVERLAY_HEIGHT,
|
||||
backgroundColor: { red: 80, green: 80, blue: 80 },
|
||||
backgroundAlpha: 0.7,
|
||||
visible: false,
|
||||
});
|
||||
|
||||
var toolBar = (function () {
|
||||
var that = {},
|
||||
toolBar,
|
||||
|
@ -753,6 +768,8 @@ Script.scriptEnding.connect(function() {
|
|||
tooltip.cleanup();
|
||||
selectionDisplay.cleanup();
|
||||
Entities.setLightsArePickable(originalLightsArePickable);
|
||||
|
||||
Overlays.deleteOverlay(importingSVOOverlay);
|
||||
});
|
||||
|
||||
// Do some stuff regularly, like check for placement of various overlays
|
||||
|
@ -816,6 +833,17 @@ function handeMenuEvent(menuItem) {
|
|||
}
|
||||
|
||||
if (importURL) {
|
||||
importSVO(importURL);
|
||||
}
|
||||
} else if (menuItem == "Entity List...") {
|
||||
entityListTool.toggleVisible();
|
||||
}
|
||||
tooltip.show(false);
|
||||
}
|
||||
|
||||
function importSVO(importURL) {
|
||||
Overlays.editOverlay(importingSVOOverlay, { visible: true });
|
||||
|
||||
var success = Clipboard.importEntities(importURL);
|
||||
|
||||
if (success) {
|
||||
|
@ -830,16 +858,16 @@ function handeMenuEvent(menuItem) {
|
|||
|
||||
var pastedEntityIDs = Clipboard.pasteEntities(position);
|
||||
|
||||
if (isActive) {
|
||||
selectionManager.setSelections(pastedEntityIDs);
|
||||
}
|
||||
} else {
|
||||
Window.alert("There was an error importing the entity file.");
|
||||
}
|
||||
|
||||
Overlays.editOverlay(importingSVOOverlay, { visible: false });
|
||||
}
|
||||
} else if (menuItem == "Entity List...") {
|
||||
entityListTool.toggleVisible();
|
||||
}
|
||||
tooltip.show(false);
|
||||
}
|
||||
Window.svoImportRequested.connect(importSVO);
|
||||
|
||||
Menu.menuItemEvent.connect(handeMenuEvent);
|
||||
|
||||
|
|
Loading…
Reference in a new issue