mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-07 20:58:19 +02:00
Add grid tool menu option
This commit is contained in:
parent
b04fd89e4f
commit
d537c5efdb
2 changed files with 15 additions and 4 deletions
|
@ -399,6 +399,7 @@ SelectionDisplay = (function () {
|
||||||
alpha: 0.5,
|
alpha: 0.5,
|
||||||
solid: true,
|
solid: true,
|
||||||
visible: false,
|
visible: false,
|
||||||
|
width: 300, height: 200,
|
||||||
rotation: baseOverlayRotation,
|
rotation: baseOverlayRotation,
|
||||||
ignoreRayIntersection: true, // always ignore this
|
ignoreRayIntersection: true, // always ignore this
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,8 +38,6 @@ var cameraManager = new CameraManager();
|
||||||
Script.include("libraries/gridTool.js");
|
Script.include("libraries/gridTool.js");
|
||||||
var grid = Grid();
|
var grid = Grid();
|
||||||
gridTool = GridTool({ horizontalGrid: grid });
|
gridTool = GridTool({ horizontalGrid: grid });
|
||||||
gridTool.addListener(function(data) {
|
|
||||||
});
|
|
||||||
|
|
||||||
selectionManager.setEventListener(selectionDisplay.updateHandles);
|
selectionManager.setEventListener(selectionDisplay.updateHandles);
|
||||||
|
|
||||||
|
@ -57,9 +55,12 @@ var wantEntityGlow = false;
|
||||||
var SPAWN_DISTANCE = 1;
|
var SPAWN_DISTANCE = 1;
|
||||||
var DEFAULT_DIMENSION = 0.20;
|
var DEFAULT_DIMENSION = 0.20;
|
||||||
|
|
||||||
|
var MENU_GRID_TOOL_ENABLED = 'Grid Tool';
|
||||||
var MENU_INSPECT_TOOL_ENABLED = 'Inspect Tool';
|
var MENU_INSPECT_TOOL_ENABLED = 'Inspect Tool';
|
||||||
var MENU_EASE_ON_FOCUS = 'Ease Orientation on Focus';
|
var MENU_EASE_ON_FOCUS = 'Ease Orientation on Focus';
|
||||||
|
|
||||||
|
var SETTING_GRID_TOOL_ENABLED = 'GridToolEnabled';
|
||||||
|
|
||||||
var modelURLs = [
|
var modelURLs = [
|
||||||
HIFI_PUBLIC_BUCKET + "meshes/Feisar_Ship.FBX",
|
HIFI_PUBLIC_BUCKET + "meshes/Feisar_Ship.FBX",
|
||||||
HIFI_PUBLIC_BUCKET + "meshes/birarda/birarda_head.fbx",
|
HIFI_PUBLIC_BUCKET + "meshes/birarda/birarda_head.fbx",
|
||||||
|
@ -264,12 +265,13 @@ var toolBar = (function () {
|
||||||
|
|
||||||
if (activeButton === toolBar.clicked(clickedOverlay)) {
|
if (activeButton === toolBar.clicked(clickedOverlay)) {
|
||||||
isActive = !isActive;
|
isActive = !isActive;
|
||||||
gridTool.setVisible(isActive);
|
|
||||||
if (!isActive) {
|
if (!isActive) {
|
||||||
|
gridTool.setVisible(false);
|
||||||
selectionManager.clearSelections();
|
selectionManager.clearSelections();
|
||||||
cameraManager.disable();
|
cameraManager.disable();
|
||||||
} else {
|
} else {
|
||||||
cameraManager.enable();
|
cameraManager.enable();
|
||||||
|
gridTool.setVisible(Menu.isOptionChecked(MENU_GRID_TOOL_ENABLED));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -597,7 +599,9 @@ function setupModelMenus() {
|
||||||
Menu.addMenuItem({ menuName: "File", menuItemName: "Import Models", shortcutKey: "CTRL+META+I", afterItem: "Export Models" });
|
Menu.addMenuItem({ menuName: "File", menuItemName: "Import Models", shortcutKey: "CTRL+META+I", afterItem: "Export Models" });
|
||||||
Menu.addMenuItem({ menuName: "Developer", menuItemName: "Debug Ryans Rotation Problems", isCheckable: true });
|
Menu.addMenuItem({ menuName: "Developer", menuItemName: "Debug Ryans Rotation Problems", isCheckable: true });
|
||||||
|
|
||||||
Menu.addMenuItem({ menuName: "View", menuItemName: MENU_INSPECT_TOOL_ENABLED, afterItem: "Edit Entities Help...", isCheckable: true });
|
Menu.addMenuItem({ menuName: "View", menuItemName: MENU_GRID_TOOL_ENABLED, afterItem: "Edit Entities Help...", isCheckable: true,
|
||||||
|
isChecked: Settings.getValue(SETTING_GRID_TOOL_ENABLED) == 'true'});
|
||||||
|
Menu.addMenuItem({ menuName: "View", menuItemName: MENU_INSPECT_TOOL_ENABLED, afterItem: MENU_GRID_TOOL_ENABLED, isCheckable: true });
|
||||||
Menu.addMenuItem({ menuName: "View", menuItemName: MENU_EASE_ON_FOCUS, afterItem: MENU_INSPECT_TOOL_ENABLED, isCheckable: true });
|
Menu.addMenuItem({ menuName: "View", menuItemName: MENU_EASE_ON_FOCUS, afterItem: MENU_INSPECT_TOOL_ENABLED, isCheckable: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,6 +625,8 @@ function cleanupModelMenus() {
|
||||||
Menu.removeMenuItem("File", "Import Models");
|
Menu.removeMenuItem("File", "Import Models");
|
||||||
Menu.removeMenuItem("Developer", "Debug Ryans Rotation Problems");
|
Menu.removeMenuItem("Developer", "Debug Ryans Rotation Problems");
|
||||||
|
|
||||||
|
Settings.setValue(SETTING_GRID_TOOL_ENABLED, Menu.isOptionChecked(MENU_GRID_TOOL_ENABLED));
|
||||||
|
Menu.removeMenuItem("View", MENU_GRID_TOOL_ENABLED);
|
||||||
Menu.removeMenuItem("View", MENU_INSPECT_TOOL_ENABLED);
|
Menu.removeMenuItem("View", MENU_INSPECT_TOOL_ENABLED);
|
||||||
Menu.removeMenuItem("View", MENU_EASE_ON_FOCUS);
|
Menu.removeMenuItem("View", MENU_EASE_ON_FOCUS);
|
||||||
}
|
}
|
||||||
|
@ -729,6 +735,10 @@ function handeMenuEvent(menuItem) {
|
||||||
}
|
}
|
||||||
} else if (menuItem == "Import Models") {
|
} else if (menuItem == "Import Models") {
|
||||||
modelImporter.doImport();
|
modelImporter.doImport();
|
||||||
|
} else if (menuItem == MENU_GRID_TOOL_ENABLED) {
|
||||||
|
if (isActive) {
|
||||||
|
gridTool.setVisible(Menu.isOptionChecked(MENU_GRID_TOOL_ENABLED));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tooltip.show(false);
|
tooltip.show(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue