From 082a9196ffa4e307e36dd0c260bbe22c1e207d57 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 7 Apr 2015 13:43:04 -0700 Subject: [PATCH 01/18] Fix manually entered animation URL not being able to be started --- interface/src/ui/AnimationsDialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/ui/AnimationsDialog.cpp b/interface/src/ui/AnimationsDialog.cpp index 1586d9ebad..9230d70f55 100644 --- a/interface/src/ui/AnimationsDialog.cpp +++ b/interface/src/ui/AnimationsDialog.cpp @@ -96,7 +96,7 @@ AnimationPanel::AnimationPanel(AnimationsDialog* dialog, const AnimationHandlePo QHBoxLayout* urlBox = new QHBoxLayout(); layout->addRow("URL:", urlBox); urlBox->addWidget(_url = new QLineEdit(handle->getURL().toString()), 1); - connect(_url, SIGNAL(returnPressed()), SLOT(updateHandle())); + connect(_url, SIGNAL(editingFinished()), SLOT(updateHandle())); QPushButton* chooseURL = new QPushButton("Choose"); urlBox->addWidget(chooseURL); connect(chooseURL, SIGNAL(clicked(bool)), SLOT(chooseURL())); @@ -168,7 +168,7 @@ void AnimationPanel::chooseURL() { } _animationDirectory.set(QFileInfo(filename).path()); _url->setText(QUrl::fromLocalFile(filename).toString()); - emit _url->returnPressed(); + emit _url->editingFinished(); } void AnimationPanel::chooseMaskedJoints() { From ccf3afadfba2e02d6f0046c8f262efa6d2e7b4f0 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 7 Apr 2015 13:43:58 -0700 Subject: [PATCH 02/18] Fix manually entered joint mask value not being applied --- interface/src/ui/AnimationsDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/ui/AnimationsDialog.cpp b/interface/src/ui/AnimationsDialog.cpp index 9230d70f55..0428e79e6f 100644 --- a/interface/src/ui/AnimationsDialog.cpp +++ b/interface/src/ui/AnimationsDialog.cpp @@ -118,7 +118,7 @@ AnimationPanel::AnimationPanel(AnimationsDialog* dialog, const AnimationHandlePo QHBoxLayout* maskedJointBox = new QHBoxLayout(); layout->addRow("Masked Joints:", maskedJointBox); maskedJointBox->addWidget(_maskedJoints = new QLineEdit(handle->getMaskedJoints().join(", ")), 1); - connect(_maskedJoints, SIGNAL(returnPressed()), SLOT(updateHandle())); + connect(_maskedJoints, SIGNAL(editingFinished()), SLOT(updateHandle())); maskedJointBox->addWidget(_chooseMaskedJoints = new QPushButton("Choose")); connect(_chooseMaskedJoints, SIGNAL(clicked(bool)), SLOT(chooseMaskedJoints())); From 670d455b90809524e7c898d63d0969bb252950e8 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 7 Apr 2015 13:47:37 -0700 Subject: [PATCH 03/18] Fix manually entered attachment model URL not being used --- interface/src/ui/AttachmentsDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/ui/AttachmentsDialog.cpp b/interface/src/ui/AttachmentsDialog.cpp index 2a6ff2b2b1..1d53eb3871 100644 --- a/interface/src/ui/AttachmentsDialog.cpp +++ b/interface/src/ui/AttachmentsDialog.cpp @@ -113,7 +113,7 @@ AttachmentPanel::AttachmentPanel(AttachmentsDialog* dialog, const AttachmentData layout->addRow("Model URL:", urlBox); urlBox->addWidget(_modelURL = new QLineEdit(data.modelURL.toString()), 1); _modelURL->setText(data.modelURL.toString()); - connect(_modelURL, SIGNAL(returnPressed()), SLOT(modelURLChanged())); + connect(_modelURL, SIGNAL(editingFinished()), SLOT(modelURLChanged())); QPushButton* chooseURL = new QPushButton("Choose"); urlBox->addWidget(chooseURL); connect(chooseURL, SIGNAL(clicked(bool)), SLOT(chooseModelURL())); From 09b929b729e7529f938b2689d933e26cf6140b05 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 7 Apr 2015 14:02:24 -0700 Subject: [PATCH 04/18] Restart looped animation running at shutdown when Interface starts --- interface/src/avatar/MyAvatar.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 25803e5c36..0c456da824 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -640,6 +640,7 @@ void MyAvatar::saveData() { settings.setValue("firstFrame", pointer->getFirstFrame()); settings.setValue("lastFrame", pointer->getLastFrame()); settings.setValue("maskedJoints", pointer->getMaskedJoints()); + settings.setValue("running", pointer->getLoop() && pointer->isRunning()); } settings.endArray(); @@ -713,6 +714,9 @@ void MyAvatar::loadData() { handle->setFirstFrame(settings.value("firstFrame", 0.0f).toFloat()); handle->setLastFrame(settings.value("lastFrame", INT_MAX).toFloat()); handle->setMaskedJoints(settings.value("maskedJoints").toStringList()); + if (settings.value("loop", true).toBool() && settings.value("running", false).toBool()) { + handle->setRunning(true); + } } settings.endArray(); From 43a130dabe2224f961ee129177b5883c4433cf4f Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 7 Apr 2015 14:02:42 -0700 Subject: [PATCH 05/18] Fix Stop button not working at the end of a non-looped animation --- libraries/render-utils/src/AnimationHandle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/render-utils/src/AnimationHandle.cpp b/libraries/render-utils/src/AnimationHandle.cpp index 64e2bf28b9..1cb3d4654f 100644 --- a/libraries/render-utils/src/AnimationHandle.cpp +++ b/libraries/render-utils/src/AnimationHandle.cpp @@ -64,8 +64,8 @@ void AnimationHandle::setRunning(bool running) { if (running) { // move back to the beginning setFrameIndex(getFirstFrame()); + return; } - return; } _animationLoop.setRunning(running); if (isRunning()) { From dc503ac068b1af8fbbece261e489a7d9cbd7adbf Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 8 Apr 2015 10:18:04 -0700 Subject: [PATCH 06/18] Update entityProperties checkboxes to be inlined --- examples/html/entityProperties.html | 36 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index a1f1a5ea79..d0be4144c9 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -517,17 +517,17 @@
-
Locked
-
+ Locked + -
+
-
Visible
-
+ Visible + -
+
@@ -625,17 +625,17 @@
-
Ignore For Collisions
-
+ Ignore For Collisions + -
+
-
Collisions Will Move
-
+ Collisions Will Move + -
+
@@ -690,10 +690,10 @@
-
Animation Playing
-
+ Animation Playing + -
+
Animation FPS
@@ -768,10 +768,10 @@
-
Spot Light
-
+ Spot Light + -
+
Color
From 83918c53b929914591a4b5fd2e3e39449ff98f89 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 8 Apr 2015 10:18:29 -0700 Subject: [PATCH 07/18] Update entityProperties properties to take up less space --- examples/html/style.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/html/style.css b/examples/html/style.css index 02f02b9649..1b5b71176f 100644 --- a/examples/html/style.css +++ b/examples/html/style.css @@ -210,8 +210,8 @@ input:disabled, textarea:disabled { } #properties-list .property { - padding: 6pt 6pt; - border-top: 0.75pt solid rgb(63, 63, 63); + padding: 4pt; + border-bottom: 0.75pt solid rgb(63, 63, 63); min-height: 1em; } From 4fb5c8f907c1b97b94c748b882ddea6c05118736 Mon Sep 17 00:00:00 2001 From: samcake Date: Wed, 8 Apr 2015 11:04:13 -0700 Subject: [PATCH 08/18] fix the rendering bug on mac release due to the State::DepthTest not properly aligned to 4bytes. Improved the glCheckError for knowing where the error comes from. --- libraries/gpu/src/gpu/GLBackend.cpp | 19 ++++++++++--------- libraries/gpu/src/gpu/GLBackend.h | 2 +- libraries/gpu/src/gpu/GLBackendShared.h | 4 ++-- libraries/gpu/src/gpu/GLBackendState.cpp | 11 ++++++++--- libraries/gpu/src/gpu/State.h | 7 ++++--- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/libraries/gpu/src/gpu/GLBackend.cpp b/libraries/gpu/src/gpu/GLBackend.cpp index e1eff5f3cd..8fcc2362c1 100644 --- a/libraries/gpu/src/gpu/GLBackend.cpp +++ b/libraries/gpu/src/gpu/GLBackend.cpp @@ -95,35 +95,36 @@ void GLBackend::renderBatch(Batch& batch) { backend.render(batch); } -void GLBackend::checkGLError() { +bool GLBackend::checkGLError(const char* name) { GLenum error = glGetError(); if (!error) { - return; + return false; } else { switch (error) { case GL_INVALID_ENUM: - qCDebug(gpulogging) << "An unacceptable value is specified for an enumerated argument.The offending command is ignored and has no other side effect than to set the error flag."; + qCDebug(gpulogging) << "GLBackend::" << name << ": An unacceptable value is specified for an enumerated argument.The offending command is ignored and has no other side effect than to set the error flag."; break; case GL_INVALID_VALUE: - qCDebug(gpulogging) << "A numeric argument is out of range.The offending command is ignored and has no other side effect than to set the error flag"; + qCDebug(gpulogging) << "GLBackend" << name << ": A numeric argument is out of range.The offending command is ignored and has no other side effect than to set the error flag"; break; case GL_INVALID_OPERATION: - qCDebug(gpulogging) << "The specified operation is not allowed in the current state.The offending command is ignored and has no other side effect than to set the error flag.."; + qCDebug(gpulogging) << "GLBackend" << name << ": The specified operation is not allowed in the current state.The offending command is ignored and has no other side effect than to set the error flag.."; break; case GL_INVALID_FRAMEBUFFER_OPERATION: - qCDebug(gpulogging) << "The framebuffer object is not complete.The offending command is ignored and has no other side effect than to set the error flag."; + qCDebug(gpulogging) << "GLBackend" << name << ": The framebuffer object is not complete.The offending command is ignored and has no other side effect than to set the error flag."; break; case GL_OUT_OF_MEMORY: - qCDebug(gpulogging) << "There is not enough memory left to execute the command.The state of the GL is undefined, except for the state of the error flags, after this error is recorded."; + qCDebug(gpulogging) << "GLBackend" << name << ": There is not enough memory left to execute the command.The state of the GL is undefined, except for the state of the error flags, after this error is recorded."; break; case GL_STACK_UNDERFLOW: - qCDebug(gpulogging) << "An attempt has been made to perform an operation that would cause an internal stack to underflow."; + qCDebug(gpulogging) << "GLBackend" << name << ": An attempt has been made to perform an operation that would cause an internal stack to underflow."; break; case GL_STACK_OVERFLOW: - qCDebug(gpulogging) << "An attempt has been made to perform an operation that would cause an internal stack to overflow."; + qCDebug(gpulogging) << "GLBackend" << name << ": An attempt has been made to perform an operation that would cause an internal stack to overflow."; break; } + return true; } } diff --git a/libraries/gpu/src/gpu/GLBackend.h b/libraries/gpu/src/gpu/GLBackend.h index 71e44ddfda..ea97fd8908 100644 --- a/libraries/gpu/src/gpu/GLBackend.h +++ b/libraries/gpu/src/gpu/GLBackend.h @@ -31,7 +31,7 @@ public: static void renderBatch(Batch& batch); - static void checkGLError(); + static bool checkGLError(const char* name = nullptr); static bool makeProgram(Shader& shader, const Shader::BindingSet& bindings = Shader::BindingSet()); diff --git a/libraries/gpu/src/gpu/GLBackendShared.h b/libraries/gpu/src/gpu/GLBackendShared.h index f51e455447..92e06e1d11 100644 --- a/libraries/gpu/src/gpu/GLBackendShared.h +++ b/libraries/gpu/src/gpu/GLBackendShared.h @@ -50,9 +50,9 @@ static const GLenum _elementTypeToGLType[NUM_TYPES]= { }; #if _DEBUG -#define CHECK_GL_ERROR() ::gpu::GLBackend::checkGLError() +#define CHECK_GL_ERROR() ::gpu::GLBackend::checkGLError(__FUNCTION__) #else -#define CHECK_GL_ERROR() +#define CHECK_GL_ERROR() false #endif #endif diff --git a/libraries/gpu/src/gpu/GLBackendState.cpp b/libraries/gpu/src/gpu/GLBackendState.cpp index fba40ca77f..dec28786a5 100644 --- a/libraries/gpu/src/gpu/GLBackendState.cpp +++ b/libraries/gpu/src/gpu/GLBackendState.cpp @@ -598,9 +598,14 @@ void GLBackend::do_setStateDepthTest(State::DepthTest test) { } else { glDisable(GL_DEPTH_TEST); } - CHECK_GL_ERROR(); + if (CHECK_GL_ERROR()) { + qDebug() << "DepthTest" << (test.isEnabled() ? "Enabled" : "Disabled") + << "Mask=" << (test.getWriteMask() ? "Write" : "no Write") + << "Func=" << test.getFunction() + << "Raw=" << test.getRaw(); + } - _pipeline._stateCache.depthTest = test; + _pipeline._stateCache.depthTest = test; } } @@ -712,7 +717,7 @@ void GLBackend::do_setStateBlend(State::BlendFunction function) { } void GLBackend::do_setStateColorWriteMask(uint32 mask) { - if (_pipeline._stateCache.colorWriteMask = mask) { + if (_pipeline._stateCache.colorWriteMask != mask) { glColorMask(mask & State::ColorMask::WRITE_RED, mask & State::ColorMask::WRITE_GREEN, mask & State::ColorMask::WRITE_BLUE, diff --git a/libraries/gpu/src/gpu/State.h b/libraries/gpu/src/gpu/State.h index 56bc472cac..84f44d8efd 100755 --- a/libraries/gpu/src/gpu/State.h +++ b/libraries/gpu/src/gpu/State.h @@ -127,10 +127,11 @@ public: class DepthTest { uint8 _function = LESS; - bool _writeMask = true; - bool _enabled = false; + uint8 _writeMask = true; + uint8 _enabled = false; + uint8 _spare; public: - DepthTest(bool enabled, bool writeMask, ComparisonFunction func) : + DepthTest(bool enabled = false, bool writeMask = true, ComparisonFunction func = LESS) : _function(func), _writeMask(writeMask), _enabled(enabled) {} bool isEnabled() const { return _enabled; } From e2a707227056dc4d2b3479f13670237831e13caf Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 8 Apr 2015 12:50:02 -0700 Subject: [PATCH 09/18] Update new entity positioning to be in front of camera --- examples/edit.js | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index 156cf44fa0..2e0d9410f3 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -338,7 +338,7 @@ var toolBar = (function () { } if (newCubeButton === toolBar.clicked(clickedOverlay)) { - var position = Vec3.sum(MyAvatar.position, Vec3.multiply(Quat.getFront(MyAvatar.orientation), SPAWN_DISTANCE)); + var position = getPositionToCreateEntity(); if (position.x > 0 && position.y > 0 && position.z > 0) { placingEntityID = Entities.addEntity({ @@ -355,7 +355,7 @@ var toolBar = (function () { } if (newSphereButton === toolBar.clicked(clickedOverlay)) { - var position = Vec3.sum(MyAvatar.position, Vec3.multiply(Quat.getFront(MyAvatar.orientation), SPAWN_DISTANCE)); + var position = getPositionToCreateEntity(); if (position.x > 0 && position.y > 0 && position.z > 0) { placingEntityID = Entities.addEntity({ @@ -371,7 +371,7 @@ var toolBar = (function () { } if (newLightButton === toolBar.clicked(clickedOverlay)) { - var position = Vec3.sum(MyAvatar.position, Vec3.multiply(Quat.getFront(MyAvatar.orientation), SPAWN_DISTANCE)); + var position = getPositionToCreateEntity(); if (position.x > 0 && position.y > 0 && position.z > 0) { placingEntityID = Entities.addEntity({ @@ -395,7 +395,7 @@ var toolBar = (function () { if (newTextButton === toolBar.clicked(clickedOverlay)) { - var position = Vec3.sum(MyAvatar.position, Vec3.multiply(Quat.getFront(MyAvatar.orientation), SPAWN_DISTANCE)); + var position = getPositionToCreateEntity(); if (position.x > 0 && position.y > 0 && position.z > 0) { placingEntityID = Entities.addEntity({ @@ -947,6 +947,19 @@ function handeMenuEvent(menuItem) { tooltip.show(false); } +function getPositionToCreateEntity() { + var distance = cameraManager.enabled ? cameraManager.zoomDistance : DEFAULT_ENTITY_DRAG_DROP_DISTANCE; + var direction = Quat.getFront(Camera.orientation); + var offset = Vec3.multiply(distance, direction); + var position = Vec3.sum(Camera.position, offset); + + position.x = Math.max(0, position.x); + position.y = Math.max(0, position.y); + position.z = Math.max(0, position.z); + + return position; +} + function importSVO(importURL) { Overlays.editOverlay(importingSVOTextOverlay, { visible: true }); Overlays.editOverlay(importingSVOImageOverlay, { visible: true }); @@ -954,14 +967,7 @@ function importSVO(importURL) { var success = Clipboard.importEntities(importURL); if (success) { - var distance = cameraManager.enabled ? cameraManager.zoomDistance : DEFAULT_ENTITY_DRAG_DROP_DISTANCE; - var direction = Quat.getFront(Camera.orientation); - var offset = Vec3.multiply(distance, direction); - var position = Vec3.sum(Camera.position, offset); - - position.x = Math.max(0, position.x); - position.y = Math.max(0, position.y); - position.z = Math.max(0, position.z); + var position = getPositionToCreateEntity(); var pastedEntityIDs = Clipboard.pasteEntities(position); From 92b91c9a3877c1dc1df1d146c9bac83849454cb6 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 8 Apr 2015 13:23:48 -0700 Subject: [PATCH 10/18] Fix checkboxes not aligning with label --- examples/html/style.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/html/style.css b/examples/html/style.css index 1b5b71176f..719e650085 100644 --- a/examples/html/style.css +++ b/examples/html/style.css @@ -194,6 +194,10 @@ input:disabled, textarea:disabled { color: rgb(160, 160, 160); } +#properties-list input[type=checkbox] { + vertical-align: bottom; +} + #properties-list input[type=button] { cursor: pointer; background-color: rgb(51, 102, 102); From e3dea8ccc8662834872e02f0a134984e77615813 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 8 Apr 2015 13:24:03 -0700 Subject: [PATCH 11/18] Remove margin in entityProperties --- examples/html/style.css | 4 ---- 1 file changed, 4 deletions(-) diff --git a/examples/html/style.css b/examples/html/style.css index 719e650085..6a258d8f02 100644 --- a/examples/html/style.css +++ b/examples/html/style.css @@ -229,10 +229,6 @@ table#properties-list { table-layout: fixed; } -#properties-list > div { - margin: 3pt 0; -} - #properties-list { border-bottom: 0.75pt solid #e5e5e5; } From b6af9fde9e1cdd281c7b10ee001bf0d489031f82 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 8 Apr 2015 13:57:41 -0700 Subject: [PATCH 12/18] Make marketplace button always visible --- examples/edit.js | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/examples/edit.js b/examples/edit.js index 2e0d9410f3..702dc4b287 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -134,12 +134,19 @@ var toolBar = (function () { newSphereButton, newLightButton, newTextButton, - browseModelsButton; + browseMarketplaceButton; function initialize() { toolBar = new ToolBar(0, 0, ToolBar.VERTICAL); - // Hide active button for now - this may come back, so not deleting yet. + browseMarketplaceButton = toolBar.addTool({ + imageURL: toolIconUrl + "marketplace.svg", + width: toolWidth, + height: toolHeight, + alpha: 0.9, + visible: true, + }); + activeButton = toolBar.addTool({ imageURL: toolIconUrl + "edit-status.svg", subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT }, @@ -158,14 +165,6 @@ var toolBar = (function () { visible: false }); - browseModelsButton = toolBar.addTool({ - imageURL: toolIconUrl + "marketplace.svg", - width: toolWidth, - height: toolHeight, - alpha: 0.9, - visible: false - }); - newCubeButton = toolBar.addTool({ imageURL: toolIconUrl + "add-cube.svg", subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT }, @@ -237,7 +236,6 @@ var toolBar = (function () { // Sets visibility of tool buttons, excluding the power button that.showTools = function(doShow) { toolBar.showTool(newModelButton, doShow); - toolBar.showTool(browseModelsButton, doShow); toolBar.showTool(newCubeButton, doShow); toolBar.showTool(newSphereButton, doShow); toolBar.showTool(newLightButton, doShow); @@ -309,7 +307,7 @@ var toolBar = (function () { }; var newModelButtonDown = false; - var browseModelsButtonDown = false; + var browseMarketplaceButtonDown = false; that.mousePressEvent = function (event) { var clickedOverlay, url, @@ -328,7 +326,7 @@ var toolBar = (function () { newModelButtonDown = true; return true; } - if (browseModelsButton === toolBar.clicked(clickedOverlay)) { + if (browseMarketplaceButton === toolBar.clicked(clickedOverlay)) { if (marketplaceWindow.url != MARKETPLACE_URL) { marketplaceWindow.setURL(MARKETPLACE_URL); } @@ -427,9 +425,9 @@ var toolBar = (function () { } handled = true; } - } else if (browseModelsButtonDown) { + } else if (browseMarketplaceButtonDown) { var clickedOverlay = Overlays.getOverlayAtPoint({ x: event.x, y: event.y }); - if (browseModelsButton === toolBar.clicked(clickedOverlay)) { + if (browseMarketplaceButton === toolBar.clicked(clickedOverlay)) { url = Window.s3Browse(".*(fbx|FBX|obj|OBJ)"); if (url !== null && url !== "") { addModel(url); @@ -439,7 +437,7 @@ var toolBar = (function () { } newModelButtonDown = false; - browseModelsButtonDown = false; + browseMarketplaceButtonDown = false; return handled; } From a0e324f9f559ec9b4bf5c9f5a9374623003e7833 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 8 Apr 2015 13:58:14 -0700 Subject: [PATCH 13/18] Add error for when importing on a domain without permissions --- examples/edit.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/edit.js b/examples/edit.js index 702dc4b287..2b32769337 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -84,6 +84,7 @@ var SETTING_EASE_ON_FOCUS = "cameraEaseOnFocus"; var SETTING_SHOW_LIGHTS_IN_EDIT_MODE = "showLightsInEditMode"; var INSUFFICIENT_PERMISSIONS_ERROR_MSG = "You do not have the necessary permissions to edit on this domain." +var INSUFFICIENT_PERMISSIONS_IMPORT_ERROR_MSG = "You do not have the necessary permissions to place items on this domain." var modelURLs = [ "Insert the URL to your FBX" @@ -959,6 +960,11 @@ function getPositionToCreateEntity() { } function importSVO(importURL) { + if (!Entities.canAdjustLocks()) { + Window.alert(INSUFFICIENT_PERMISSIONS_IMPORT_ERROR_MSG); + return; + } + Overlays.editOverlay(importingSVOTextOverlay, { visible: true }); Overlays.editOverlay(importingSVOImageOverlay, { visible: true }); From e7688526456bba02c88ffdd2e42ae9341e709f79 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 8 Apr 2015 20:02:22 -0700 Subject: [PATCH 14/18] Fix catching bad_alloc Non-allocation wasn't caught on Windows; it just crashed. --- libraries/gpu/src/gpu/Resource.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/gpu/src/gpu/Resource.cpp b/libraries/gpu/src/gpu/Resource.cpp index f1956727f8..e9be897170 100644 --- a/libraries/gpu/src/gpu/Resource.cpp +++ b/libraries/gpu/src/gpu/Resource.cpp @@ -27,9 +27,10 @@ Resource::Size Resource::Sysmem::allocateMemory(Byte** dataAllocated, Size size) if (size > 0) { // Try allocating as much as the required size + one block of memory newSize = size; - (*dataAllocated) = new Byte[newSize]; - // Failed? - if (!(*dataAllocated)) { + try { + (*dataAllocated) = new Byte[newSize]; + } + catch (const std::bad_alloc&) { qWarning() << "Buffer::Sysmem::allocate() : Can't allocate a system memory buffer of " << newSize << "bytes. Fails to create the buffer Sysmem."; return NOT_ALLOCATED; } From 76d6c6cac5b3a097301a16d9f554ff2591e66d93 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 8 Apr 2015 20:03:42 -0700 Subject: [PATCH 15/18] Delete char* items properly --- libraries/octree/src/Octree.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/octree/src/Octree.cpp b/libraries/octree/src/Octree.cpp index f4121d051f..b1e92e2140 100644 --- a/libraries/octree/src/Octree.cpp +++ b/libraries/octree/src/Octree.cpp @@ -1024,7 +1024,7 @@ int Octree::encodeTreeBitstream(OctreeElement* element, roomForOctalCode = packetData->startSubTree(newCode); if (newCode) { - delete newCode; + delete[] newCode; codeLength = numberOfThreeBitSectionsInCode(newCode); } else { codeLength = 1; @@ -2064,7 +2064,7 @@ bool Octree::readJSONFromStream(unsigned long streamLength, QDataStream& inputSt QVariant asVariant = asDocument.toVariant(); QVariantMap asMap = asVariant.toMap(); readFromMap(asMap); - delete rawData; + delete[] rawData; return true; } From 298a81cea905ae142d682b7d17fe3023cefd61a1 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 9 Apr 2015 14:42:26 +0200 Subject: [PATCH 16/18] Trim entity properties set from JS that are strings --- libraries/entities/src/EntityItemPropertiesMacros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities/src/EntityItemPropertiesMacros.h b/libraries/entities/src/EntityItemPropertiesMacros.h index 6a8f52719e..e3e54f5bc8 100644 --- a/libraries/entities/src/EntityItemPropertiesMacros.h +++ b/libraries/entities/src/EntityItemPropertiesMacros.h @@ -201,7 +201,7 @@ #define COPY_PROPERTY_FROM_QSCRIPTVALUE_STRING(P, S)\ QScriptValue P = object.property(#P); \ if (P.isValid()) { \ - QString newValue = P.toVariant().toString();\ + QString newValue = P.toVariant().toString().trimmed();\ if (_defaultSettings || newValue != _##P) { \ S(newValue); \ } \ From b2dd53ac431f2d76c41b6d35d47910f18439edee Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 9 Apr 2015 08:37:24 -0700 Subject: [PATCH 17/18] Coding standard --- libraries/gpu/src/gpu/Resource.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/gpu/src/gpu/Resource.cpp b/libraries/gpu/src/gpu/Resource.cpp index e9be897170..a13a5cc444 100644 --- a/libraries/gpu/src/gpu/Resource.cpp +++ b/libraries/gpu/src/gpu/Resource.cpp @@ -29,8 +29,7 @@ Resource::Size Resource::Sysmem::allocateMemory(Byte** dataAllocated, Size size) newSize = size; try { (*dataAllocated) = new Byte[newSize]; - } - catch (const std::bad_alloc&) { + } catch (const std::bad_alloc&) { qWarning() << "Buffer::Sysmem::allocate() : Can't allocate a system memory buffer of " << newSize << "bytes. Fails to create the buffer Sysmem."; return NOT_ALLOCATED; } From 5efb9606459c8241f4fa685223d2a8bf7e738164 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 9 Apr 2015 09:18:53 -0700 Subject: [PATCH 18/18] Ensure blending is enabled during starfield rendering --- interface/src/starfield/renderer/Renderer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/src/starfield/renderer/Renderer.cpp b/interface/src/starfield/renderer/Renderer.cpp index 034a571814..1ebb4245e2 100644 --- a/interface/src/starfield/renderer/Renderer.cpp +++ b/interface/src/starfield/renderer/Renderer.cpp @@ -212,6 +212,7 @@ void Renderer::glUpload(GLsizei numStars) { void Renderer::glBatch(GLfloat const* matrix, GLsizei n_ranges, float alpha) { glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); + glEnable(GL_BLEND); // setup modelview matrix glPushMatrix();