diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 17997acab3..a102f2a42e 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -812,7 +812,7 @@ Menu::Menu() { }); essLogAction->setEnabled(nodeList->getThisNodeCanRez()); - action = addActionToQMenuAndActionHash(developerMenu, "Script Log (HMD friendly)...", Qt::NoButton, + addActionToQMenuAndActionHash(developerMenu, "Script Log (HMD friendly)...", Qt::NoButton, qApp, SLOT(showScriptLogs())); addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::VerboseLogging, 0, false, diff --git a/interface/src/ui/overlays/Circle3DOverlay.cpp b/interface/src/ui/overlays/Circle3DOverlay.cpp index ef89213d68..8b04f17269 100644 --- a/interface/src/ui/overlays/Circle3DOverlay.cpp +++ b/interface/src/ui/overlays/Circle3DOverlay.cpp @@ -201,13 +201,12 @@ void Circle3DOverlay::render(RenderArgs* args) { float tickMarkAngle = getMajorTickMarksAngle(); float angle = _startAt - fmodf(_startAt, tickMarkAngle) + tickMarkAngle; - float angleInRadians = glm::radians(angle); float tickMarkLength = getMajorTickMarksLength(); float startRadius = (tickMarkLength > 0.0f) ? _innerRadius : _outerRadius; float endRadius = startRadius + tickMarkLength; while (angle <= _endAt) { - angleInRadians = glm::radians(angle); + float angleInRadians = glm::radians(angle); glm::vec2 thisPointA(cosf(angleInRadians) * startRadius, sinf(angleInRadians) * startRadius); glm::vec2 thisPointB(cosf(angleInRadians) * endRadius, sinf(angleInRadians) * endRadius); @@ -223,13 +222,12 @@ void Circle3DOverlay::render(RenderArgs* args) { float tickMarkAngle = getMinorTickMarksAngle(); float angle = _startAt - fmodf(_startAt, tickMarkAngle) + tickMarkAngle; - float angleInRadians = glm::radians(angle); float tickMarkLength = getMinorTickMarksLength(); float startRadius = (tickMarkLength > 0.0f) ? _innerRadius : _outerRadius; float endRadius = startRadius + tickMarkLength; while (angle <= _endAt) { - angleInRadians = glm::radians(angle); + float angleInRadians = glm::radians(angle); glm::vec2 thisPointA(cosf(angleInRadians) * startRadius, sinf(angleInRadians) * startRadius); glm::vec2 thisPointB(cosf(angleInRadians) * endRadius, sinf(angleInRadians) * endRadius); diff --git a/libraries/animation/src/AnimationCache.cpp b/libraries/animation/src/AnimationCache.cpp index 9aa315beb8..f30d5605d7 100644 --- a/libraries/animation/src/AnimationCache.cpp +++ b/libraries/animation/src/AnimationCache.cpp @@ -105,8 +105,10 @@ QStringList Animation::getJointNames() const { return result; } QStringList names; - foreach (const FBXJoint& joint, _geometry->joints) { - names.append(joint.name); + if (_geometry) { + foreach (const FBXJoint& joint, _geometry->joints) { + names.append(joint.name); + } } return names; } @@ -114,11 +116,15 @@ QStringList Animation::getJointNames() const { QVector Animation::getFrames() const { if (QThread::currentThread() != thread()) { QVector result; - BLOCKING_INVOKE_METHOD(const_cast(this), "getFrames", + BLOCKING_INVOKE_METHOD(const_cast(this), "getFrames", Q_RETURN_ARG(QVector, result)); return result; } - return _geometry->animationFrames; + if (_geometry) { + return _geometry->animationFrames; + } else { + return QVector(); + } } const QVector& Animation::getFramesReference() const { diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 84e248b74d..dbf4725e68 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -2423,9 +2423,7 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy if (appendState != OctreeElement::COMPLETED) { didntFitProperties = propertiesDidntFit; } - } - if (success) { packetData->endSubTree(); const char* finalizedData = reinterpret_cast(packetData->getFinalizedData()); @@ -2436,7 +2434,6 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy buffer.resize(finalizedSize); } else { qCDebug(entities) << "ERROR - encoded edit message doesn't fit in output buffer."; - success = false; appendState = OctreeElement::NONE; // if we got here, then we didn't include the item // maybe we should assert!!! } @@ -2444,7 +2441,6 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy packetData->discardSubTree(); } - return appendState; } @@ -2834,7 +2830,6 @@ bool EntityItemProperties::encodeEraseEntityMessage(const EntityItemID& entityIt outputLength = sizeof(numberOfIds); memcpy(copyAt, entityItemID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID); - copyAt += NUM_BYTES_RFC4122_UUID; outputLength += NUM_BYTES_RFC4122_UUID; buffer.resize(outputLength); @@ -2856,7 +2851,6 @@ bool EntityItemProperties::encodeCloneEntityMessage(const EntityItemID& entityID outputLength += NUM_BYTES_RFC4122_UUID; memcpy(copyAt, newEntityID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID); - copyAt += NUM_BYTES_RFC4122_UUID; outputLength += NUM_BYTES_RFC4122_UUID; buffer.resize(outputLength); diff --git a/libraries/entities/src/SimulationOwner.h b/libraries/entities/src/SimulationOwner.h index cc2069dcc8..8e5ad42601 100644 --- a/libraries/entities/src/SimulationOwner.h +++ b/libraries/entities/src/SimulationOwner.h @@ -67,11 +67,12 @@ // when multiple participants (with variable ping-times to the server) bid simultaneously for a // recently activated entity. // -// (9) When a participant changes an entity's transform/velocity it will bid at priority = POKE (=127) +// (9) When a participant changes an entity's transform/velocity (via script) it will bid at +// priority = POKE (=127). // -// (10) When an entity touches MyAvatar the participant it will bid at priority = POKE. +// (10) When an entity collides with MyAvatar the participant it will bid at priority = POKE. // -// (11) When a participant grabs an entity it will bid at priority = GRAB (=128). +// (11) When a participant grabs (via script) an entity it will bid at priority = GRAB (=128). // // (12) When entityA, locally owned at priority = N, collides with an unowned entityB the owner will // also bid for entityB at priority = N-1 (or VOLUNTEER, whichever is larger). @@ -79,7 +80,7 @@ // (13) When an entity comes to rest and is deactivated in the physics simulation the owner will // send an update to: clear their ownerhsip, set priority to zero, and set the object's // velocities to be zero. As per a normal bid, the owner does NOT assume that its ownership -// has been cleared until it hears from the entity-server. This, if the packet is lost the +// has been cleared until it hears from the entity-server. Thus, if the packet is lost the // owner will re-send after some period. // // (14) When an entity's ownership priority drops below VOLUNTEER other participants may bid for it diff --git a/libraries/gpu/src/gpu/Sysmem.cpp b/libraries/gpu/src/gpu/Sysmem.cpp index a642d40478..a2f3b60c36 100644 --- a/libraries/gpu/src/gpu/Sysmem.cpp +++ b/libraries/gpu/src/gpu/Sysmem.cpp @@ -63,13 +63,13 @@ Sysmem& Sysmem::operator=(const Sysmem& sysmem) { Sysmem::~Sysmem() { deallocateMemory( _data, _size ); - _data = NULL; + _data = nullptr; _size = 0; } Size Sysmem::allocate(Size size) { if (size != _size) { - Byte* newData = NULL; + Byte* newData = nullptr; Size newSize = 0; if (size > 0) { Size allocated = allocateMemory(&newData, size); @@ -90,7 +90,7 @@ Size Sysmem::allocate(Size size) { Size Sysmem::resize(Size size) { if (size != _size) { - Byte* newData = NULL; + Byte* newData = nullptr; Size newSize = 0; if (size > 0) { Size allocated = allocateMemory(&newData, size); @@ -124,7 +124,7 @@ Size Sysmem::setData( Size size, const Byte* bytes ) { } Size Sysmem::setSubData( Size offset, Size size, const Byte* bytes) { - if (size && ((offset + size) <= getSize()) && bytes) { + if (_data && size && ((offset + size) <= getSize()) && bytes) { memcpy( _data + offset, bytes, size ); return size; } diff --git a/libraries/gpu/src/gpu/Texture_ktx.cpp b/libraries/gpu/src/gpu/Texture_ktx.cpp index 839cb915e2..0d4abe78d3 100644 --- a/libraries/gpu/src/gpu/Texture_ktx.cpp +++ b/libraries/gpu/src/gpu/Texture_ktx.cpp @@ -140,7 +140,6 @@ struct IrradianceKTXPayload { data += sizeof(Version); memcpy(&_irradianceSH, data, sizeof(SphericalHarmonics)); - data += sizeof(SphericalHarmonics); return true; } diff --git a/libraries/networking/src/PacketSender.cpp b/libraries/networking/src/PacketSender.cpp index 6288743c46..14cfde8d18 100644 --- a/libraries/networking/src/PacketSender.cpp +++ b/libraries/networking/src/PacketSender.cpp @@ -267,8 +267,6 @@ bool PacketSender::nonThreadedProcess() { // Keep average packets and time for "second half" of check interval _lastPPSCheck += (elapsedSinceLastCheck / 2); _packetsOverCheckInterval = (_packetsOverCheckInterval / 2); - - elapsedSinceLastCheck = now - _lastPPSCheck; } } @@ -296,12 +294,10 @@ bool PacketSender::nonThreadedProcess() { DependencyManager::get()->sendPacketList(std::move(packetPair.second.second), *packetPair.first); } - packetsSentThisCall += packetCount; _packetsOverCheckInterval += packetCount; _totalPacketsSent += packetCount; - _totalBytesSent += packetSize; emit packetSent(packetSize); // FIXME should include number of packets? _lastSendTime = now; diff --git a/libraries/octree/src/Octree.cpp b/libraries/octree/src/Octree.cpp index f0e41d59ea..9bb0e25982 100644 --- a/libraries/octree/src/Octree.cpp +++ b/libraries/octree/src/Octree.cpp @@ -401,7 +401,6 @@ int Octree::readElementData(const OctreeElementPointer& destinationElement, cons // tell the element to read the subsequent data int rootDataSize = _rootElement->readElementDataFromBuffer(nodeData + bytesRead, bytesLeftToRead, args); bytesRead += rootDataSize; - bytesLeftToRead -= rootDataSize; } return bytesRead; diff --git a/libraries/physics/src/ObjectMotionState.cpp b/libraries/physics/src/ObjectMotionState.cpp index 64d2368207..161d6bd636 100644 --- a/libraries/physics/src/ObjectMotionState.cpp +++ b/libraries/physics/src/ObjectMotionState.cpp @@ -92,7 +92,7 @@ void ObjectMotionState::setMass(float mass) { } float ObjectMotionState::getMass() const { - if (_shape) { + if (_shape && _shape->getShapeType() != TRIANGLE_MESH_SHAPE_PROXYTYPE) { // scale the density by the current Aabb volume to get mass btTransform transform; transform.setIdentity(); @@ -348,8 +348,10 @@ void ObjectMotionState::updateLastKinematicStep() { void ObjectMotionState::updateBodyMassProperties() { float mass = getMass(); - btVector3 inertia(0.0f, 0.0f, 0.0f); - _body->getCollisionShape()->calculateLocalInertia(mass, inertia); + btVector3 inertia(1.0f, 1.0f, 1.0f); + if (mass > 0.0f) { + _body->getCollisionShape()->calculateLocalInertia(mass, inertia); + } _body->setMassProps(mass, inertia); _body->updateInertiaTensor(); } diff --git a/libraries/recording/src/recording/impl/PointerClip.cpp b/libraries/recording/src/recording/impl/PointerClip.cpp index bd632a3f4a..bb8d6cfb33 100644 --- a/libraries/recording/src/recording/impl/PointerClip.cpp +++ b/libraries/recording/src/recording/impl/PointerClip.cpp @@ -61,7 +61,6 @@ PointerFrameHeaderList parseFrameHeaders(uchar* const start, const size_t& size) current += sizeof(FrameSize); header.fileOffset = current - start; if (end - current < header.size) { - current = end; break; } current += header.size; diff --git a/libraries/ui/src/ui/Menu.cpp b/libraries/ui/src/ui/Menu.cpp index 16af862324..848b2362ee 100644 --- a/libraries/ui/src/ui/Menu.cpp +++ b/libraries/ui/src/ui/Menu.cpp @@ -402,8 +402,10 @@ MenuWrapper* Menu::addMenu(const QString& menuName, const QString& grouping) { // hook our show/hide for popup menus, so we can keep track of whether or not one // of our submenus is currently showing. - connect(menu->_realMenu, &QMenu::aboutToShow, []() { _isSomeSubmenuShown = true; }); - connect(menu->_realMenu, &QMenu::aboutToHide, []() { _isSomeSubmenuShown = false; }); + if (menu && menu->_realMenu) { + connect(menu->_realMenu, &QMenu::aboutToShow, []() { _isSomeSubmenuShown = true; }); + connect(menu->_realMenu, &QMenu::aboutToHide, []() { _isSomeSubmenuShown = false; }); + } return menu; }