From 135fa8c2aaa6fb8987d7fe5eda9b16518ecb8ec0 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Wed, 18 May 2016 15:41:21 -0700 Subject: [PATCH] Moved jointIndices transmission behind #ifdef --- libraries/avatars/src/AvatarData.cpp | 40 ++++++++++++---------------- libraries/avatars/src/AvatarData.h | 4 +++ 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index abf3f52ed6..09ea34a5c4 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -611,10 +611,11 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) { // an earlier AvatarIdentity packet. Because if we do, we risk applying the joint data // the wrong bones, resulting in a twisted avatar, An un-animated avatar is preferable to this. bool skipJoints = false; +#ifdef TRANSMIT_JOINT_INDICES_IN_IDENTITY_PACKET if (_networkJointIndexMap.empty()) { - qCDebug(avatars) << "AJT: parseAvatarDataPacket _networkJointIndexMap.size = " << _networkJointIndexMap.size(); - skipJoints = false; + skipJoints = true; } +#endif int bytesOfValidity = (int)ceil((float)numJoints / (float)BITS_IN_BYTE); minPossibleSize += bytesOfValidity; @@ -984,29 +985,28 @@ void AvatarData::clearJointsData() { void AvatarData::parseAvatarIdentityPacket(const QByteArray& data, Identity& identityOut) { QDataStream packetStream(data); - packetStream >> identityOut.uuid >> identityOut.skeletonModelURL >> identityOut.attachmentData >> identityOut.displayName >> identityOut.jointIndices; - // AJT: just got a new networkJointIndicesMap. - qCDebug(avatars) << "AJT: receiving identity.jointIndices.size = " << identityOut.jointIndices.size(); +#ifdef TRANSMIT_JOINT_INDICES_IN_IDENTITY_PACKET + packetStream >> identityOut.uuid >> identityOut.skeletonModelURL >> identityOut.attachmentData >> identityOut.displayName >> identityOut.jointIndices; +#else + packetStream >> identityOut.uuid >> identityOut.skeletonModelURL >> identityOut.attachmentData >> identityOut.displayName; +#endif } bool AvatarData::processAvatarIdentity(const Identity& identity) { bool hasIdentityChanged = false; - qCDebug(avatars) << "AJT: processAvatarIdentity got here!"; - + #ifdef TRANSMIT_JOINT_INDICES_IN_IDENTITY_PACKET if (!_jointIndices.empty() && _networkJointIndexMap.empty() && !identity.jointIndices.empty()) { // build networkJointIndexMap from _jointIndices and networkJointIndices. _networkJointIndexMap.fill(identity.jointIndices.size(), -1); for (auto iter = identity.jointIndices.cbegin(); iter != identity.jointIndices.end(); ++iter) { int jointIndex = getJointIndex(iter.key()); _networkJointIndexMap[iter.value()] = jointIndex; - qCDebug(avatars) << "AJT: mapping " << iter.value() << " -> " << jointIndex; } } - - qCDebug(avatars) << "AJT: processAvatarIdentity got here!"; +#endif if (_firstSkeletonCheck || (identity.skeletonModelURL != _skeletonModelURL)) { setSkeletonModelURL(identity.skeletonModelURL); @@ -1033,10 +1033,11 @@ QByteArray AvatarData::identityByteArray() { QUrl emptyURL(""); const QUrl& urlToSend = _skeletonModelURL.scheme() == "file" ? emptyURL : _skeletonModelURL; - // AJT: just got a sending networkJointIndices - qCDebug(avatars) << "AJT: sending _jointIndices.size = " << _jointIndices.size(); - +#ifdef TRANSMIT_JOINT_INDICES_IN_IDENTITY_PACKET identityStream << QUuid() << urlToSend << _attachmentData << _displayName << _jointIndices; +#else + identityStream << QUuid() << urlToSend << _attachmentData << _displayName; +#endif return identityData; } @@ -1141,8 +1142,6 @@ void AvatarData::detachAll(const QString& modelURL, const QString& jointName) { void AvatarData::setJointMappingsFromNetworkReply() { QNetworkReply* networkReply = static_cast(sender()); - qCDebug(avatars) << "AJT: GOT HERE! finished fst network request"; - QByteArray line; while (!(line = networkReply->readLine()).isEmpty()) { line = line.trimmed(); @@ -1180,8 +1179,6 @@ void AvatarData::setJointMappingsFromNetworkReply() { // now that we have the jointIndices send them to the AvatarMixer. sendIdentityPacket(); - qCDebug(avatars) << "AJT: _jointIndices.size = " << _jointIndices.size(); - networkReply->deleteLater(); } @@ -1208,8 +1205,6 @@ void AvatarData::sendIdentityPacket() { QByteArray identityData = identityByteArray(); - qCDebug(avatars) << "AJT: sendIdentityPacket() size = " << identityData.size(); - auto packetList = NLPacketList::create(PacketType::AvatarIdentity, QByteArray(), true, true); packetList->write(identityData); nodeList->eachMatchingNode( @@ -1219,16 +1214,15 @@ void AvatarData::sendIdentityPacket() { [&](const SharedNodePointer& node) { nodeList->sendPacketList(std::move(packetList), *node); }); - - qCDebug(avatars) << "AJT: sendIdentityPacket() done!"; } void AvatarData::updateJointMappings() { _jointIndices.clear(); _jointNames.clear(); - _networkJointIndexMap.clear(); - qCDebug(avatars) << "AJT: GOT HERE! kicking off fst network request"; +#ifdef TRANSMIT_JOINT_INDICES_IN_IDENTITY_PACKET + _networkJointIndexMap.clear(); +#endif if (_skeletonModelURL.fileName().toLower().endsWith(".fst")) { QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance(); diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index feabfad544..5af66fae4e 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -285,7 +285,9 @@ public: QUrl skeletonModelURL; QVector attachmentData; QString displayName; +#ifdef TRANSMIT_JOINT_INDICES_IN_IDENTITY_PACKET QHash jointIndices; +#endif }; static void parseAvatarIdentityPacket(const QByteArray& data, Identity& identityOut); @@ -378,7 +380,9 @@ protected: float _displayNameAlpha; QHash _jointIndices; ///< 1-based, since zero is returned for missing keys +#ifdef TRANSMIT_JOINT_INDICES_IN_IDENTITY_PACKET QVector _networkJointIndexMap; // maps network joint indices to local model joint indices. +#endif QStringList _jointNames; ///< in order of depth-first traversal quint64 _errorLogExpiry; ///< time in future when to log an error