mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
turn off editModels by default
This commit is contained in:
parent
5a51950771
commit
74edf6557f
1 changed files with 27 additions and 2 deletions
|
@ -1051,6 +1051,11 @@ function checkController(deltaTime) {
|
||||||
var numberOfTriggers = Controller.getNumberOfTriggers();
|
var numberOfTriggers = Controller.getNumberOfTriggers();
|
||||||
var numberOfSpatialControls = Controller.getNumberOfSpatialControls();
|
var numberOfSpatialControls = Controller.getNumberOfSpatialControls();
|
||||||
var controllersPerTrigger = numberOfSpatialControls / numberOfTriggers;
|
var controllersPerTrigger = numberOfSpatialControls / numberOfTriggers;
|
||||||
|
|
||||||
|
if (!isActive) {
|
||||||
|
// So that we hide the lasers bellow and keep updating the overlays position
|
||||||
|
numberOfButtons = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// this is expected for hydras
|
// this is expected for hydras
|
||||||
if (numberOfButtons==12 && numberOfTriggers == 2 && controllersPerTrigger == 2) {
|
if (numberOfButtons==12 && numberOfTriggers == 2 && controllersPerTrigger == 2) {
|
||||||
|
@ -1072,11 +1077,21 @@ function checkController(deltaTime) {
|
||||||
|
|
||||||
moveOverlays();
|
moveOverlays();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isActive = false;
|
||||||
|
var active;
|
||||||
var newModel;
|
var newModel;
|
||||||
var browser;
|
var browser;
|
||||||
function initToolBar() {
|
function initToolBar() {
|
||||||
toolBar = new ToolBar(0, 0, ToolBar.VERTICAL);
|
toolBar = new ToolBar(0, 0, ToolBar.VERTICAL);
|
||||||
// New Model
|
// New Model
|
||||||
|
active = toolBar.addTool({
|
||||||
|
imageURL: toolIconUrl + "models-tool.svg",
|
||||||
|
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
|
||||||
|
width: toolWidth, height: toolHeight,
|
||||||
|
visible: true,
|
||||||
|
alpha: 0.9
|
||||||
|
}, true, false);
|
||||||
newModel = toolBar.addTool({
|
newModel = toolBar.addTool({
|
||||||
imageURL: toolIconUrl + "add-model-tool.svg",
|
imageURL: toolIconUrl + "add-model-tool.svg",
|
||||||
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
|
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
|
||||||
|
@ -1194,6 +1209,11 @@ function mousePressEvent(event) {
|
||||||
modelSelected = false;
|
modelSelected = false;
|
||||||
var clickedOverlay = Overlays.getOverlayAtPoint({x: event.x, y: event.y});
|
var clickedOverlay = Overlays.getOverlayAtPoint({x: event.x, y: event.y});
|
||||||
|
|
||||||
|
if (active == toolBar.clicked(clickedOverlay)) {
|
||||||
|
isActive = !isActive;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (newModel == toolBar.clicked(clickedOverlay)) {
|
if (newModel == toolBar.clicked(clickedOverlay)) {
|
||||||
var url = Window.prompt("Model URL", modelURLs[Math.floor(Math.random() * modelURLs.length)]);
|
var url = Window.prompt("Model URL", modelURLs[Math.floor(Math.random() * modelURLs.length)]);
|
||||||
if (url == null || url == "") {
|
if (url == null || url == "") {
|
||||||
|
@ -1229,6 +1249,11 @@ function mousePressEvent(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// If we aren't active and didn't click on an overlay: quit
|
||||||
|
if (!isActive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var pickRay = Camera.computePickRay(event.x, event.y);
|
var pickRay = Camera.computePickRay(event.x, event.y);
|
||||||
Vec3.print("[Mouse] Looking at: ", pickRay.origin);
|
Vec3.print("[Mouse] Looking at: ", pickRay.origin);
|
||||||
var foundIntersection = Models.findRayIntersection(pickRay);
|
var foundIntersection = Models.findRayIntersection(pickRay);
|
||||||
|
@ -1313,7 +1338,7 @@ var oldModifier = 0;
|
||||||
var modifier = 0;
|
var modifier = 0;
|
||||||
var wasShifted = false;
|
var wasShifted = false;
|
||||||
function mouseMoveEvent(event) {
|
function mouseMoveEvent(event) {
|
||||||
if (event.isAlt) {
|
if (event.isAlt || !isActive) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1456,7 +1481,7 @@ function mouseMoveEvent(event) {
|
||||||
|
|
||||||
|
|
||||||
function mouseReleaseEvent(event) {
|
function mouseReleaseEvent(event) {
|
||||||
if (event.isAlt) {
|
if (event.isAlt || !isActive) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue