From 299389ccef8ece4cf0cdd87a51f9c122de767ea2 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 8 Dec 2014 09:59:33 -0800 Subject: [PATCH 1/9] Fixed typo --- interface/src/Application.cpp | 2 -- interface/src/ui/ApplicationOverlay.cpp | 28 ++++++++++++------------- interface/src/ui/ApplicationOverlay.h | 10 ++++----- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 2d92a99cab..6f12957b2d 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2347,12 +2347,10 @@ void Application::update(float deltaTime) { if (OculusManager::isConnected() && Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode)){ if (_window->cursor().shape() != Qt::BlankCursor) { - qDebug() << "Hiding cursor" << _window->cursor().shape(); cursor = _window->cursor(); _window->setCursor(QCursor(Qt::BlankCursor)); } } else if(_window->cursor().shape() == Qt::BlankCursor) { - qDebug() << "Showing cursor" << _window->cursor().shape(); _window->setCursor(cursor); } diff --git a/interface/src/ui/ApplicationOverlay.cpp b/interface/src/ui/ApplicationOverlay.cpp index f4e9e627ad..602e99ac31 100644 --- a/interface/src/ui/ApplicationOverlay.cpp +++ b/interface/src/ui/ApplicationOverlay.cpp @@ -103,7 +103,7 @@ bool raySphereIntersect(const glm::vec3 &dir, const glm::vec3 &origin, float r, } } -void renderReticule(glm::quat orientation, float alpha) { +void renderReticle(glm::quat orientation, float alpha) { glm::vec3 topLeft = getPoint(reticleSize / 2.0f, -reticleSize / 2.0f); glm::vec3 topRight = getPoint(-reticleSize / 2.0f, -reticleSize / 2.0f); glm::vec3 bottomLeft = getPoint(reticleSize / 2.0f, reticleSize / 2.0f); @@ -269,7 +269,7 @@ void ApplicationOverlay::displayOverlayTextureOculus(Camera& whichCamera) { glm::mat4 rotation = glm::toMat4(orientation); glMultMatrixf(&rotation[0][0]); glScalef(scale, scale, scale); - for (int i = 0; i < NUMBER_OF_RETICULES; i++) { + for (int i = 0; i < NUMBER_OF_RETICLES; i++) { if (_magActive[i]) { _magSizeMult[i] += MAG_SPEED; @@ -285,8 +285,8 @@ void ApplicationOverlay::displayOverlayTextureOculus(Camera& whichCamera) { if (_magSizeMult[i] > 0.0f) { //Render magnifier, but dont show border for mouse magnifier - glm::vec2 projection = screenToOverlay(glm::vec2(_reticulePosition[MOUSE].x(), - _reticulePosition[MOUSE].y())); + glm::vec2 projection = screenToOverlay(glm::vec2(_reticlePosition[MOUSE].x(), + _reticlePosition[MOUSE].y())); renderMagnifier(projection, _magSizeMult[i], i != MOUSE); } @@ -528,7 +528,7 @@ void ApplicationOverlay::renderPointers() { QPoint position = QPoint(application->getTrueMouseX(), application->getTrueMouseY()); static const int MAX_IDLE_TIME = 3; - if (_reticulePosition[MOUSE] != position) { + if (_reticlePosition[MOUSE] != position) { _lastMouseMove = usecTimestampNow(); } else if (usecTimestampNow() - _lastMouseMove > MAX_IDLE_TIME * USECS_PER_SECOND) { float pitch, yaw, roll; @@ -539,7 +539,7 @@ void ApplicationOverlay::renderPointers() { QCursor::setPos(application->getGLWidget()->mapToGlobal(position)); } - _reticulePosition[MOUSE] = position; + _reticlePosition[MOUSE] = position; _reticleActive[MOUSE] = true; _magActive[MOUSE] = true; _reticleActive[LEFT_CONTROLLER] = false; @@ -561,9 +561,9 @@ void ApplicationOverlay::renderControllerPointers() { MyAvatar* myAvatar = application->getAvatar(); //Static variables used for storing controller state - static quint64 pressedTime[NUMBER_OF_RETICULES] = { 0ULL, 0ULL, 0ULL }; - static bool isPressed[NUMBER_OF_RETICULES] = { false, false, false }; - static bool stateWhenPressed[NUMBER_OF_RETICULES] = { false, false, false }; + static quint64 pressedTime[NUMBER_OF_RETICLES] = { 0ULL, 0ULL, 0ULL }; + static bool isPressed[NUMBER_OF_RETICLES] = { false, false, false }; + static bool stateWhenPressed[NUMBER_OF_RETICLES] = { false, false, false }; const HandData* handData = Application::getInstance()->getAvatar()->getHandData(); @@ -610,7 +610,7 @@ void ApplicationOverlay::renderControllerPointers() { QPoint point = getPalmClickLocation(palmData); - _reticulePosition[index] = point; + _reticlePosition[index] = point; //When button 2 is pressed we drag the mag window if (isPressed[index]) { @@ -685,16 +685,16 @@ void ApplicationOverlay::renderPointersOculus(const glm::vec3& eyePos) { float yaw = glm::acos(-tipDirection.z) * ((yawSign == 0.0f) ? 1.0f : yawSign); glm::quat orientation = glm::quat(glm::vec3(pitch, yaw, 0.0f)); - renderReticule(orientation, _alpha); + renderReticle(orientation, _alpha); } } //Mouse Pointer if (_reticleActive[MOUSE]) { - glm::vec2 projection = screenToSpherical(glm::vec2(_reticulePosition[MOUSE].x(), - _reticulePosition[MOUSE].y())); + glm::vec2 projection = screenToSpherical(glm::vec2(_reticlePosition[MOUSE].x(), + _reticlePosition[MOUSE].y())); glm::quat orientation(glm::vec3(-projection.y, projection.x, 0.0f)); - renderReticule(orientation, _alpha); + renderReticle(orientation, _alpha); } glEnable(GL_DEPTH_TEST); diff --git a/interface/src/ui/ApplicationOverlay.h b/interface/src/ui/ApplicationOverlay.h index 538a163d0e..269adef4f3 100644 --- a/interface/src/ui/ApplicationOverlay.h +++ b/interface/src/ui/ApplicationOverlay.h @@ -94,11 +94,11 @@ private: float _textureFov; float _textureAspectRatio; - enum Reticules { MOUSE, LEFT_CONTROLLER, RIGHT_CONTROLLER, NUMBER_OF_RETICULES }; - bool _reticleActive[NUMBER_OF_RETICULES]; - QPoint _reticulePosition[NUMBER_OF_RETICULES]; - bool _magActive[NUMBER_OF_RETICULES]; - float _magSizeMult[NUMBER_OF_RETICULES]; + enum Reticles { MOUSE, LEFT_CONTROLLER, RIGHT_CONTROLLER, NUMBER_OF_RETICLES }; + bool _reticleActive[NUMBER_OF_RETICLES]; + QPoint _reticlePosition[NUMBER_OF_RETICLES]; + bool _magActive[NUMBER_OF_RETICLES]; + float _magSizeMult[NUMBER_OF_RETICLES]; quint64 _lastMouseMove; float _alpha; From e5aee44ceb60c0261533988e5ea7df740aad3fe0 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 9 Dec 2014 08:51:04 -0800 Subject: [PATCH 2/9] Add setting save/load to grid tool --- examples/html/gridControls.html | 6 +-- examples/libraries/gridTool.js | 77 ++++++++++++++++++++++++++++----- 2 files changed, 68 insertions(+), 15 deletions(-) diff --git a/examples/html/gridControls.html b/examples/html/gridControls.html index d95c9545e4..06090da423 100644 --- a/examples/html/gridControls.html +++ b/examples/html/gridControls.html @@ -29,11 +29,11 @@ elPosY.value = origin.y.toFixed(2); } - if (data.minorGridSpacing) { + if (data.minorGridSpacing !== undefined) { elMinorSpacing.value = data.minorGridSpacing; } - if (data.majorGridEvery) { + if (data.majorGridEvery !== undefined) { elMajorSpacing.value = data.majorGridEvery; } @@ -41,7 +41,7 @@ gridColor = data.gridColor; } - if (data.elSnapToGrid !== undefined) { + if (data.snapToGrid !== undefined) { elSnapToGrid.checked = data.snapToGrid == true; } diff --git a/examples/libraries/gridTool.js b/examples/libraries/gridTool.js index 7d98befec8..1793fb5b4f 100644 --- a/examples/libraries/gridTool.js +++ b/examples/libraries/gridTool.js @@ -1,3 +1,9 @@ +var SETTING_GRID_VISIBLE = 'gridVisible'; +var SETTING_GRID_SNAP_TO_GRID = 'gridSnapToGrid'; +var SETTING_GRID_MINOR_WIDTH= 'gridMinorWidth'; +var SETTING_GRID_MAJOR_EVERY = 'gridMajorEvery'; +var SETTING_GRID_COLOR = 'gridColor'; + Grid = function(opts) { var that = {}; @@ -12,9 +18,6 @@ Grid = function(opts) { var worldSize = 16384; - var minorGridWidth = 0.5; - var majorGridWidth = 1.5; - var snapToGrid = false; var gridOverlay = Overlays.addOverlay("grid", { @@ -23,7 +26,7 @@ Grid = function(opts) { color: { red: 0, green: 0, blue: 128 }, alpha: 1.0, rotation: Quat.fromPitchYawRollDegrees(90, 0, 0), - minorGridWidth: 0.1, + minorGridSpacing: 0.1, majorGridEvery: 2, }); @@ -40,16 +43,38 @@ Grid = function(opts) { that.getSnapToGrid = function() { return snapToGrid; }; that.setEnabled = function(enabled) { - that.enabled = enabled; - updateGrid(); + if (that.enabled != enabled) { + that.enabled = enabled; + + if (enabled) { + if (selectionManager.hasSelection()) { + that.setPosition(selectionManager.getBottomPosition()); + } else { + that.setPosition(MyAvatar.position); + } + } + + updateGrid(); + } } that.setVisible = function(visible, noUpdate) { - that.visible = visible; - updateGrid(); + if (visible != that.visible) { + that.visible = visible; + updateGrid(); - if (!noUpdate) { - that.emitUpdate(); + print("Setting visible"); + if (visible) { + if (selectionManager.hasSelection()) { + that.setPosition(selectionManager.getBottomPosition()); + } else { + that.setPosition(MyAvatar.position); + } + } + + if (!noUpdate) { + that.emitUpdate(); + } } } @@ -171,7 +196,7 @@ Grid = function(opts) { Overlays.editOverlay(gridOverlay, { position: { x: origin.y, y: origin.y, z: -origin.y }, visible: that.visible && that.enabled, - minorGridWidth: minorGridSpacing, + minorGridSpacing: minorGridSpacing, majorGridEvery: majorGridEvery, color: gridColor, alpha: gridAlpha, @@ -181,15 +206,43 @@ Grid = function(opts) { } function cleanup() { + saveSettings(); + Overlays.deleteOverlay(gridOverlay); } + function loadSettings() { + that.setVisible(Settings.getValue(SETTING_GRID_VISIBLE) == "true", true); + snapToGrid = Settings.getValue(SETTING_GRID_SNAP_TO_GRID) == "true"; + minorGridSpacing = parseFloat(Settings.getValue(SETTING_GRID_MINOR_WIDTH), 10); + majorGridEvery = parseInt(Settings.getValue(SETTING_GRID_MAJOR_EVERY), 10); + try { + var newColor = JSON.parse(Settings.getValue(SETTING_GRID_COLOR)); + if (newColor.red !== undefined && newColor.green !== undefined && newColor.blue !== undefined) { + gridColor.red = newColor.red; + gridColor.green = newColor.green; + gridColor.blue = newColor.blue; + } + } catch (e) { + } + updateGrid(); + } + + function saveSettings() { + Settings.setValue(SETTING_GRID_VISIBLE, that.visible); + Settings.setValue(SETTING_GRID_SNAP_TO_GRID, snapToGrid); + Settings.setValue(SETTING_GRID_MINOR_WIDTH, minorGridSpacing); + Settings.setValue(SETTING_GRID_MAJOR_EVERY, majorGridEvery); + Settings.setValue(SETTING_GRID_COLOR, JSON.stringify(gridColor)); + } + that.addListener = function(callback) { that.onUpdate = callback; } Script.scriptEnding.connect(cleanup); - updateGrid(); + + loadSettings(); that.onUpdate = null; From 2696f71be93b318098d5217ce455557d9343a13f Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 9 Dec 2014 08:54:28 -0800 Subject: [PATCH 3/9] Update edit entities to disable on wasd or arrow keys --- examples/newEditEntities.js | 45 ++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/examples/newEditEntities.js b/examples/newEditEntities.js index ef1be8fef9..f9f604afe8 100644 --- a/examples/newEditEntities.js +++ b/examples/newEditEntities.js @@ -215,6 +215,28 @@ var toolBar = (function () { Overlays.editOverlay(loadFileMenuItem, { visible: active }); } + + that.setActive = function(active) { + if (active != isActive) { + isActive = active; + if (!isActive) { + entityListTool.setVisible(false); + gridTool.setVisible(false); + grid.setEnabled(false); + propertiesTool.setVisible(false); + selectionManager.clearSelections(); + cameraManager.disable(); + } else { + cameraManager.enable(); + entityListTool.setVisible(true); + gridTool.setVisible(true); + propertiesTool.setVisible(true); + grid.setEnabled(true); + } + } + toolBar.selectTool(activeButton, active); + }; + var RESIZE_INTERVAL = 50; var RESIZE_TIMEOUT = 20000; var RESIZE_MAX_CHECKS = RESIZE_TIMEOUT / RESIZE_INTERVAL; @@ -290,21 +312,7 @@ var toolBar = (function () { clickedOverlay = Overlays.getOverlayAtPoint({ x: event.x, y: event.y }); if (activeButton === toolBar.clicked(clickedOverlay)) { - isActive = !isActive; - if (!isActive) { - entityListTool.setVisible(false); - gridTool.setVisible(false); - grid.setEnabled(false); - propertiesTool.setVisible(false); - selectionManager.clearSelections(); - cameraManager.disable(); - } else { - cameraManager.enable(); - entityListTool.setVisible(true); - gridTool.setVisible(true); - grid.setEnabled(true); - propertiesTool.setVisible(true); - } + that.setActive(!isActive); return true; } @@ -817,6 +825,13 @@ function handeMenuEvent(menuItem) { Menu.menuItemEvent.connect(handeMenuEvent); +Controller.keyPressEvent.connect(function(event) { + if (event.text == 'w' || event.text == 'a' || event.text == 's' || event.text == 'd' + || event.text == 'UP' || event.text == 'DOWN' || event.text == 'LEFT' || event.text == 'RIGHT') { + toolBar.setActive(false); + } +}); + Controller.keyReleaseEvent.connect(function (event) { // since sometimes our menu shortcut keys don't work, trap our menu items here also and fire the appropriate menu items if (event.text == "`") { From 19ba2a1f84a6cd1ac0361e022885e2d1d134bdf4 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 9 Dec 2014 08:56:29 -0800 Subject: [PATCH 4/9] Remove print statement --- examples/libraries/gridTool.js | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/libraries/gridTool.js b/examples/libraries/gridTool.js index 1793fb5b4f..622822e108 100644 --- a/examples/libraries/gridTool.js +++ b/examples/libraries/gridTool.js @@ -63,7 +63,6 @@ Grid = function(opts) { that.visible = visible; updateGrid(); - print("Setting visible"); if (visible) { if (selectionManager.hasSelection()) { that.setPosition(selectionManager.getBottomPosition()); From 1eaa2caa6ccbd37fd871fa144ce9dab4732a60d8 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 9 Dec 2014 11:40:47 -0800 Subject: [PATCH 5/9] fix to crash on rapidly switching domains --- interface/src/entities/EntityTreeRenderer.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/interface/src/entities/EntityTreeRenderer.cpp b/interface/src/entities/EntityTreeRenderer.cpp index dd9a0b6a4f..2c2b81fa3a 100644 --- a/interface/src/entities/EntityTreeRenderer.cpp +++ b/interface/src/entities/EntityTreeRenderer.cpp @@ -151,12 +151,19 @@ QScriptValue EntityTreeRenderer::loadEntityScript(EntityItem* entity) { return QScriptValue(); // no entity... } + // NOTE: we keep local variables for the entityID and the script because + // below in loadScriptContents() it's possible for us to execute the + // application event loop, which may cause our entity to be deleted on + // us. We don't really need access the entity after this point, can + // can accomplish all we need to here with just the script "text" and the ID. EntityItemID entityID = entity->getEntityItemID(); + QString entityScript = entity->getScript(); + if (_entityScripts.contains(entityID)) { EntityScriptDetails details = _entityScripts[entityID]; // check to make sure our script text hasn't changed on us since we last loaded it - if (details.scriptText == entity->getScript()) { + if (details.scriptText == entityScript) { return details.scriptObject; // previously loaded } @@ -164,18 +171,18 @@ QScriptValue EntityTreeRenderer::loadEntityScript(EntityItem* entity) { // has changed and so we need to reload it. _entityScripts.remove(entityID); } - if (entity->getScript().isEmpty()) { + if (entityScript.isEmpty()) { return QScriptValue(); // no script } - QString scriptContents = loadScriptContents(entity->getScript()); + QString scriptContents = loadScriptContents(entityScript); QScriptSyntaxCheckResult syntaxCheck = QScriptEngine::checkSyntax(scriptContents); if (syntaxCheck.state() != QScriptSyntaxCheckResult::Valid) { qDebug() << "EntityTreeRenderer::loadEntityScript() entity:" << entityID; qDebug() << " " << syntaxCheck.errorMessage() << ":" << syntaxCheck.errorLineNumber() << syntaxCheck.errorColumnNumber(); - qDebug() << " SCRIPT:" << entity->getScript(); + qDebug() << " SCRIPT:" << entityScript; return QScriptValue(); // invalid script } @@ -184,12 +191,12 @@ QScriptValue EntityTreeRenderer::loadEntityScript(EntityItem* entity) { if (!entityScriptConstructor.isFunction()) { qDebug() << "EntityTreeRenderer::loadEntityScript() entity:" << entityID; qDebug() << " NOT CONSTRUCTOR"; - qDebug() << " SCRIPT:" << entity->getScript(); + qDebug() << " SCRIPT:" << entityScript; return QScriptValue(); // invalid script } QScriptValue entityScriptObject = entityScriptConstructor.construct(); - EntityScriptDetails newDetails = { entity->getScript(), entityScriptObject }; + EntityScriptDetails newDetails = { entityScript, entityScriptObject }; _entityScripts[entityID] = newDetails; return entityScriptObject; // newly constructed From a6f7a1ce15713124825193c143d3b0ba39dec9b8 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 9 Dec 2014 11:52:20 -0800 Subject: [PATCH 6/9] guard against NULL _models --- interface/src/entities/RenderableModelEntityItem.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/interface/src/entities/RenderableModelEntityItem.cpp b/interface/src/entities/RenderableModelEntityItem.cpp index 8509fa1f67..080162dc16 100644 --- a/interface/src/entities/RenderableModelEntityItem.cpp +++ b/interface/src/entities/RenderableModelEntityItem.cpp @@ -268,7 +268,10 @@ EntityItemProperties RenderableModelEntityItem::getProperties() const { bool RenderableModelEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const glm::vec3& direction, bool& keepSearching, OctreeElement*& element, float& distance, BoxFace& face, void** intersectedObject, bool precisionPicking) const { - + if (!_model) { + return true; + } + glm::vec3 originInMeters = origin * (float)TREE_SCALE; QString extraInfo; float localDistance; From eaaaa0687ca19d1d2a7839616d873f44fc6436de Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 9 Dec 2014 11:53:14 -0800 Subject: [PATCH 7/9] spacing --- libraries/octree/src/ViewFrustum.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/octree/src/ViewFrustum.cpp b/libraries/octree/src/ViewFrustum.cpp index 0549c60134..1d23bf800e 100644 --- a/libraries/octree/src/ViewFrustum.cpp +++ b/libraries/octree/src/ViewFrustum.cpp @@ -591,7 +591,7 @@ PickRay ViewFrustum::computePickRay(float x, float y) { } void ViewFrustum::computePickRay(float x, float y, glm::vec3& origin, glm::vec3& direction) const { - origin = _nearTopLeft + x*(_nearTopRight - _nearTopLeft) + y*(_nearBottomLeft - _nearTopLeft); + origin = _nearTopLeft + x * (_nearTopRight - _nearTopLeft) + y * (_nearBottomLeft - _nearTopLeft); direction = glm::normalize(origin - (_position + _orientation * _eyeOffsetPosition)); } From 649940de244b7fc509818448c3addb0aa0c49d51 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 9 Dec 2014 11:53:32 -0800 Subject: [PATCH 8/9] wrong pickray function --- interface/src/ui/NodeBounds.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/src/ui/NodeBounds.cpp b/interface/src/ui/NodeBounds.cpp index 3c6b4c625a..b0d3ddd14f 100644 --- a/interface/src/ui/NodeBounds.cpp +++ b/interface/src/ui/NodeBounds.cpp @@ -38,7 +38,8 @@ void NodeBounds::draw() { // Compute ray to find selected nodes later on. We can't use the pre-computed ray in Application because it centers // itself after the cursor disappears. Application* application = Application::getInstance(); - PickRay pickRay = application->getCamera()->computeViewPickRay(application->getTrueMouseX(), application->getTrueMouseY()); + PickRay pickRay = application->getCamera()->computePickRay(application->getTrueMouseX(), + application->getTrueMouseY()); // Variables to keep track of the selected node and properties to draw the cube later if needed Node* selectedNode = NULL; From 79fc8a5a7114c1d012d859163cfbe8d3f24e5a46 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 9 Dec 2014 11:58:01 -0800 Subject: [PATCH 9/9] remove debug ryans rotate problem --- examples/libraries/entitySelectionTool.js | 74 ----------------------- examples/newEditEntities.js | 2 - 2 files changed, 76 deletions(-) diff --git a/examples/libraries/entitySelectionTool.js b/examples/libraries/entitySelectionTool.js index 382b8de215..8aff9c32ed 100644 --- a/examples/libraries/entitySelectionTool.js +++ b/examples/libraries/entitySelectionTool.js @@ -1749,13 +1749,6 @@ SelectionDisplay = (function () { pushCommandForSelections(); }, onMove: function(event) { - var debug = Menu.isOptionChecked("Debug Ryans Rotation Problems"); - - if (debug) { - print("rotateYaw()..."); - print(" event.x,y:" + event.x + "," + event.y); - } - var pickRay = Camera.computePickRay(event.x, event.y); Overlays.editOverlay(selectionBox, { ignoreRayIntersection: true, visible: false}); Overlays.editOverlay(baseOfEntityProjectionOverlay, { ignoreRayIntersection: true, visible: false }); @@ -1763,10 +1756,6 @@ SelectionDisplay = (function () { var result = Overlays.findRayIntersection(pickRay); - if (debug) { - print(" findRayIntersection() .... result.intersects:" + result.intersects); - } - if (result.intersects) { var center = yawCenter; var zero = yawZero; @@ -1776,26 +1765,7 @@ SelectionDisplay = (function () { var distanceFromCenter = Vec3.distance(center, result.intersection); var snapToInner = distanceFromCenter < innerRadius; var snapAngle = snapToInner ? innerSnapAngle : 1.0; - - // for debugging - if (debug) { - Vec3.print(" result.intersection:",result.intersection); - Overlays.editOverlay(rotateCurrentOverlay, { visible: true, start: center, end: result.intersection }); - Vec3.print(" centerToZero:", centerToZero); - Vec3.print(" centerToIntersect:", centerToIntersect); - Vec3.print(" rotationNormal:", rotationNormal); - print(" angleFromZero:" + angleFromZero); - print(" distanceFromCenter:" + distanceFromCenter); - print(" snapAngle:" + snapAngle); - } - angleFromZero = Math.floor(angleFromZero / snapAngle) * snapAngle; - - // for debugging - if (debug) { - print(" angleFromZero:" + angleFromZero + " --- after snap"); - } - var yawChange = Quat.fromVec3Degrees({ x: 0, y: angleFromZero, z: 0 }); // Entities should only reposition if we are rotating multiple selections around @@ -1906,23 +1876,12 @@ SelectionDisplay = (function () { pushCommandForSelections(); }, onMove: function(event) { - var debug = Menu.isOptionChecked("Debug Ryans Rotation Problems"); - - if (debug) { - print("rotatePitch()..."); - print(" event.x,y:" + event.x + "," + event.y); - } - var pickRay = Camera.computePickRay(event.x, event.y); Overlays.editOverlay(selectionBox, { ignoreRayIntersection: true, visible: false}); Overlays.editOverlay(baseOfEntityProjectionOverlay, { ignoreRayIntersection: true, visible: false }); Overlays.editOverlay(rotateOverlayTarget, { ignoreRayIntersection: false }); var result = Overlays.findRayIntersection(pickRay); - if (debug) { - print(" findRayIntersection() .... result.intersects:" + result.intersects); - } - if (result.intersects) { var properties = Entities.getEntityProperties(selectionManager.selections[0]); var center = pitchCenter; @@ -1936,13 +1895,6 @@ SelectionDisplay = (function () { var snapAngle = snapToInner ? innerSnapAngle : 1.0; angleFromZero = Math.floor(angleFromZero / snapAngle) * snapAngle; - // for debugging - if (debug) { - Vec3.print(" result.intersection:",result.intersection); - Overlays.editOverlay(rotateCurrentOverlay, { visible: true, start: center, end: result.intersection }); - print(" angleFromZero:" + angleFromZero); - } - var pitchChange = Quat.fromVec3Degrees({ x: angleFromZero, y: 0, z: 0 }); for (var i = 0; i < SelectionManager.selections.length; i++) { @@ -2043,23 +1995,12 @@ SelectionDisplay = (function () { pushCommandForSelections(); }, onMove: function(event) { - var debug = Menu.isOptionChecked("Debug Ryans Rotation Problems"); - - if (debug) { - print("rotateRoll()..."); - print(" event.x,y:" + event.x + "," + event.y); - } - var pickRay = Camera.computePickRay(event.x, event.y); Overlays.editOverlay(selectionBox, { ignoreRayIntersection: true, visible: false}); Overlays.editOverlay(baseOfEntityProjectionOverlay, { ignoreRayIntersection: true, visible: false }); Overlays.editOverlay(rotateOverlayTarget, { ignoreRayIntersection: false }); var result = Overlays.findRayIntersection(pickRay); - if (debug) { - print(" findRayIntersection() .... result.intersects:" + result.intersects); - } - if (result.intersects) { var properties = Entities.getEntityProperties(selectionManager.selections[0]); var center = rollCenter; @@ -2073,13 +2014,6 @@ SelectionDisplay = (function () { var snapAngle = snapToInner ? innerSnapAngle : 1.0; angleFromZero = Math.floor(angleFromZero / snapAngle) * snapAngle; - // for debugging - if (debug) { - Vec3.print(" result.intersection:",result.intersection); - Overlays.editOverlay(rotateCurrentOverlay, { visible: true, start: center, end: result.intersection }); - print(" angleFromZero:" + angleFromZero); - } - var rollChange = Quat.fromVec3Degrees({ x: 0, y: 0, z: angleFromZero }); for (var i = 0; i < SelectionManager.selections.length; i++) { var entityID = SelectionManager.selections[i]; @@ -2310,14 +2244,6 @@ SelectionDisplay = (function () { Overlays.editOverlay(rotateOverlayInner, { visible: true, rotation: overlayOrientation, position: overlayCenter }); Overlays.editOverlay(rotateOverlayOuter, { visible: true, rotation: overlayOrientation, position: overlayCenter, startAt: 0, endAt: 360 }); Overlays.editOverlay(rotateOverlayCurrent, { visible: true, rotation: overlayOrientation, position: overlayCenter, startAt: 0, endAt: 0 }); - - // for debugging - var debug = Menu.isOptionChecked("Debug Ryans Rotation Problems"); - if (debug) { - Overlays.editOverlay(rotateZeroOverlay, { visible: true, start: overlayCenter, end: result.intersection }); - Overlays.editOverlay(rotateCurrentOverlay, { visible: true, start: overlayCenter, end: result.intersection }); - } - Overlays.editOverlay(yawHandle, { visible: false }); Overlays.editOverlay(pitchHandle, { visible: false }); Overlays.editOverlay(rollHandle, { visible: false }); diff --git a/examples/newEditEntities.js b/examples/newEditEntities.js index 90208ba24e..f1b9dd4421 100644 --- a/examples/newEditEntities.js +++ b/examples/newEditEntities.js @@ -666,7 +666,6 @@ function setupModelMenus() { Menu.addMenuItem({ menuName: "File", menuItemName: "Models", isSeparator: true, beforeItem: "Settings" }); Menu.addMenuItem({ menuName: "File", menuItemName: "Export Models", shortcutKey: "CTRL+META+E", afterItem: "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: "View", menuItemName: MENU_EASE_ON_FOCUS, afterItem: MENU_INSPECT_TOOL_ENABLED, isCheckable: true, isChecked: Settings.getValue(SETTING_EASE_ON_FOCUS) == "true" }); @@ -693,7 +692,6 @@ function cleanupModelMenus() { Menu.removeSeparator("File", "Models"); Menu.removeMenuItem("File", "Export Models"); Menu.removeMenuItem("File", "Import Models"); - Menu.removeMenuItem("Developer", "Debug Ryans Rotation Problems"); Menu.removeMenuItem("View", MENU_INSPECT_TOOL_ENABLED); Menu.removeMenuItem("View", MENU_EASE_ON_FOCUS);