fix bug which caused observers of a parenting grab to not see the entity in the grabber's hand

This commit is contained in:
Seth Alves 2016-03-17 17:09:32 -07:00
parent a6ecfd789c
commit cbfde2032c
3 changed files with 8 additions and 5 deletions

View file

@ -1157,6 +1157,12 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentJointIndex, setParentJointIndex); SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentJointIndex, setParentJointIndex);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(queryAACube, setQueryAACube); SET_ENTITY_PROPERTY_FROM_PROPERTIES(queryAACube, setQueryAACube);
AACube saveQueryAACube = _queryAACube;
checkAndAdjustQueryAACube();
if (saveQueryAACube != _queryAACube) {
somethingChanged = true;
}
if (somethingChanged) { if (somethingChanged) {
uint64_t now = usecTimestampNow(); uint64_t now = usecTimestampNow();
#ifdef WANT_DEBUG #ifdef WANT_DEBUG
@ -1184,6 +1190,7 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
_created = timestamp; _created = timestamp;
} }
return somethingChanged; return somethingChanged;
} }

View file

@ -55,7 +55,6 @@ void SpatiallyNestable::setParentID(const QUuid& parentID) {
_parentKnowsMe = false; _parentKnowsMe = false;
} }
}); });
checkAndAdjustQueryAACube();
} }
Transform SpatiallyNestable::getParentTransform(bool& success, int depth) const { Transform SpatiallyNestable::getParentTransform(bool& success, int depth) const {
@ -140,7 +139,6 @@ void SpatiallyNestable::forgetChild(SpatiallyNestablePointer newChild) const {
void SpatiallyNestable::setParentJointIndex(quint16 parentJointIndex) { void SpatiallyNestable::setParentJointIndex(quint16 parentJointIndex) {
_parentJointIndex = parentJointIndex; _parentJointIndex = parentJointIndex;
checkAndAdjustQueryAACube();
} }
glm::vec3 SpatiallyNestable::worldToLocal(const glm::vec3& position, glm::vec3 SpatiallyNestable::worldToLocal(const glm::vec3& position,
@ -754,7 +752,6 @@ void SpatiallyNestable::forEachDescendant(std::function<void(SpatiallyNestablePo
} }
void SpatiallyNestable::locationChanged() { void SpatiallyNestable::locationChanged() {
checkAndAdjustQueryAACube();
forEachChild([&](SpatiallyNestablePointer object) { forEachChild([&](SpatiallyNestablePointer object) {
object->locationChanged(); object->locationChanged();
}); });
@ -781,7 +778,6 @@ void SpatiallyNestable::setQueryAACube(const AACube& queryAACube) {
if (queryAACube.getScale() > 0.0f) { if (queryAACube.getScale() > 0.0f) {
_queryAACubeSet = true; _queryAACubeSet = true;
} }
checkAndAdjustQueryAACube();
} }
bool SpatiallyNestable::queryAABoxNeedsUpdate() const { bool SpatiallyNestable::queryAABoxNeedsUpdate() const {

View file

@ -157,7 +157,7 @@ protected:
mutable QHash<QUuid, SpatiallyNestableWeakPointer> _children; mutable QHash<QUuid, SpatiallyNestableWeakPointer> _children;
virtual void locationChanged(); // called when a this object's location has changed 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 // _queryAACube is used to decide where something lives in the octree
mutable AACube _queryAACube; mutable AACube _queryAACube;