From cbfde2032c0e866a6bc0ec471dc3856d88d4f8c8 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 17 Mar 2016 17:09:32 -0700 Subject: [PATCH] fix bug which caused observers of a parenting grab to not see the entity in the grabber's hand --- libraries/entities/src/EntityItem.cpp | 7 +++++++ libraries/shared/src/SpatiallyNestable.cpp | 4 ---- libraries/shared/src/SpatiallyNestable.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index b79fd7107d..482a23ed7d 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -1157,6 +1157,12 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) { SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentJointIndex, setParentJointIndex); SET_ENTITY_PROPERTY_FROM_PROPERTIES(queryAACube, setQueryAACube); + AACube saveQueryAACube = _queryAACube; + checkAndAdjustQueryAACube(); + if (saveQueryAACube != _queryAACube) { + somethingChanged = true; + } + if (somethingChanged) { uint64_t now = usecTimestampNow(); #ifdef WANT_DEBUG @@ -1184,6 +1190,7 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) { _created = timestamp; } + return somethingChanged; } diff --git a/libraries/shared/src/SpatiallyNestable.cpp b/libraries/shared/src/SpatiallyNestable.cpp index 3392e9c66d..55da4822ef 100644 --- a/libraries/shared/src/SpatiallyNestable.cpp +++ b/libraries/shared/src/SpatiallyNestable.cpp @@ -55,7 +55,6 @@ void SpatiallyNestable::setParentID(const QUuid& parentID) { _parentKnowsMe = false; } }); - checkAndAdjustQueryAACube(); } Transform SpatiallyNestable::getParentTransform(bool& success, int depth) const { @@ -140,7 +139,6 @@ void SpatiallyNestable::forgetChild(SpatiallyNestablePointer newChild) const { void SpatiallyNestable::setParentJointIndex(quint16 parentJointIndex) { _parentJointIndex = parentJointIndex; - checkAndAdjustQueryAACube(); } glm::vec3 SpatiallyNestable::worldToLocal(const glm::vec3& position, @@ -754,7 +752,6 @@ void SpatiallyNestable::forEachDescendant(std::functionlocationChanged(); }); @@ -781,7 +778,6 @@ void SpatiallyNestable::setQueryAACube(const AACube& queryAACube) { if (queryAACube.getScale() > 0.0f) { _queryAACubeSet = true; } - checkAndAdjustQueryAACube(); } bool SpatiallyNestable::queryAABoxNeedsUpdate() const { diff --git a/libraries/shared/src/SpatiallyNestable.h b/libraries/shared/src/SpatiallyNestable.h index e6728bc923..a65c7c7f2c 100644 --- a/libraries/shared/src/SpatiallyNestable.h +++ b/libraries/shared/src/SpatiallyNestable.h @@ -157,7 +157,7 @@ protected: mutable QHash _children; virtual void locationChanged(); // called when a this object's location has changed - virtual void dimensionsChanged() { checkAndAdjustQueryAACube(); } // called when a this object's dimensions have changed + virtual void dimensionsChanged() { } // called when a this object's dimensions have changed // _queryAACube is used to decide where something lives in the octree mutable AACube _queryAACube;