From 28a8b180605c205d913442414f8423d3a4b76d64 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sat, 7 Oct 2017 16:54:05 -0700 Subject: [PATCH] Revert "fix importing of avatar entities" --- interface/src/avatar/MyAvatar.cpp | 6 ------ interface/src/avatar/MyAvatar.h | 2 -- .../entities/src/EntityEditPacketSender.cpp | 2 +- libraries/entities/src/EntityTree.cpp | 18 +++--------------- libraries/shared/src/SpatiallyNestable.cpp | 18 ++++-------------- .../libraries/controllerDispatcherUtils.js | 2 +- 6 files changed, 9 insertions(+), 39 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 5d82405aee..10e2202553 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -3238,9 +3238,3 @@ void MyAvatar::setModelScale(float scale) { emit sensorToWorldScaleChanged(sensorToWorldScale); } } - -SpatialParentTree* MyAvatar::getParentTree() const { - auto entityTreeRenderer = qApp->getEntities(); - EntityTreePointer entityTree = entityTreeRenderer ? entityTreeRenderer->getTree() : nullptr; - return entityTree.get(); -} diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index 952315a85f..9620d61a49 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -544,8 +544,6 @@ public: float getUserHeight() const; float getUserEyeHeight() const; - virtual SpatialParentTree* getParentTree() const override; - public slots: void increaseSize(); void decreaseSize(); diff --git a/libraries/entities/src/EntityEditPacketSender.cpp b/libraries/entities/src/EntityEditPacketSender.cpp index f93b6a49ec..ee0fcf8218 100644 --- a/libraries/entities/src/EntityEditPacketSender.cpp +++ b/libraries/entities/src/EntityEditPacketSender.cpp @@ -45,7 +45,7 @@ void EntityEditPacketSender::queueEditAvatarEntityMessage(PacketType type, } EntityItemPointer entity = entityTree->findEntityByEntityItemID(entityItemID); if (!entity) { - qCDebug(entities) << "EntityEditPacketSender::queueEditAvatarEntityMessage can't find entity: " << entityItemID; + qCDebug(entities) << "EntityEditPacketSender::queueEditEntityMessage can't find entity."; return; } diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index e19d7a3a7f..bf37a08386 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -1842,13 +1842,7 @@ bool EntityTree::sendEntitiesOperation(const OctreeElementPointer& element, void QHash::iterator iter = args->map->find(oldID); if (iter == args->map->end()) { - EntityItemID newID; - if (oldID == AVATAR_SELF_ID) { - auto nodeList = DependencyManager::get(); - newID = EntityItemID(nodeList->getSessionUUID()); - } else { - newID = QUuid::createUuid(); - } + EntityItemID newID = QUuid::createUuid(); args->map->insert(oldID, newID); return newID; } @@ -1865,8 +1859,8 @@ bool EntityTree::sendEntitiesOperation(const OctreeElementPointer& element, void properties.setPosition(properties.getPosition() + args->root); } else { EntityItemPointer parentEntity = args->ourTree->findEntityByEntityItemID(oldParentID); - if (parentEntity || oldParentID == AVATAR_SELF_ID) { // map the parent - properties.setParentID(getMapped(oldParentID)); + if (parentEntity) { // map the parent + properties.setParentID(getMapped(parentEntity->getID())); // But do not add root offset in this case. } else { // Should not happen, but let's try to be helpful... item->globalizeProperties(properties, "Cannot find %3 parent of %2 %1", args->root); @@ -1941,12 +1935,6 @@ bool EntityTree::readFromMap(QVariantMap& map) { entityItemID = EntityItemID(QUuid::createUuid()); } - if (properties.getClientOnly()) { - auto nodeList = DependencyManager::get(); - const QUuid myNodeID = nodeList->getSessionUUID(); - properties.setOwningAvatarID(myNodeID); - } - EntityItemPointer entity = addEntity(entityItemID, properties); if (!entity) { qCDebug(entities) << "adding Entity failed:" << entityItemID << properties.getType(); diff --git a/libraries/shared/src/SpatiallyNestable.cpp b/libraries/shared/src/SpatiallyNestable.cpp index 8c43632456..8ea38f5f13 100644 --- a/libraries/shared/src/SpatiallyNestable.cpp +++ b/libraries/shared/src/SpatiallyNestable.cpp @@ -102,11 +102,8 @@ SpatiallyNestablePointer SpatiallyNestable::getParentPointer(bool& success) cons if (parent && parent->getID() == parentID) { // parent pointer is up-to-date if (!_parentKnowsMe) { - SpatialParentTree* parentTree = parent->getParentTree(); - if (!parentTree || parentTree == getParentTree()) { - parent->beParentOfChild(getThisPointer()); - _parentKnowsMe = true; - } + parent->beParentOfChild(getThisPointer()); + _parentKnowsMe = true; } success = true; return parent; @@ -132,15 +129,8 @@ SpatiallyNestablePointer SpatiallyNestable::getParentPointer(bool& success) cons parent = _parent.lock(); if (parent) { - - // it's possible for an entity with a parent of AVATAR_SELF_ID can be imported into a side-tree - // such as the clipboard's. if this is the case, we don't want the parent to consider this a - // child. - SpatialParentTree* parentTree = parent->getParentTree(); - if (!parentTree || parentTree == getParentTree()) { - parent->beParentOfChild(getThisPointer()); - _parentKnowsMe = true; - } + parent->beParentOfChild(getThisPointer()); + _parentKnowsMe = true; } success = (parent || parentID.isNull()); diff --git a/scripts/system/libraries/controllerDispatcherUtils.js b/scripts/system/libraries/controllerDispatcherUtils.js index d6d80541ee..e9e25b058b 100644 --- a/scripts/system/libraries/controllerDispatcherUtils.js +++ b/scripts/system/libraries/controllerDispatcherUtils.js @@ -222,7 +222,7 @@ getControllerJointIndex = function (hand) { return controllerJointIndex; } - return -1; + return MyAvatar.getJointIndex("Head"); }; propsArePhysical = function (props) {