mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 01:17:19 +02:00
Add isReplicated to avatar identity data
This commit is contained in:
parent
b3824c6a25
commit
8ce1474d9a
4 changed files with 19 additions and 5 deletions
|
@ -236,7 +236,7 @@ void AvatarMixer::start() {
|
||||||
auto start = usecTimestampNow();
|
auto start = usecTimestampNow();
|
||||||
nodeList->nestedEach([&](NodeList::const_iterator cbegin, NodeList::const_iterator cend) {
|
nodeList->nestedEach([&](NodeList::const_iterator cbegin, NodeList::const_iterator cend) {
|
||||||
std::for_each(cbegin, cend, [&](const SharedNodePointer& node) {
|
std::for_each(cbegin, cend, [&](const SharedNodePointer& node) {
|
||||||
if (node->getType() == NodeType::Agent && !node->isUpstream()) {
|
if (node->getType() == NodeType::Agent) {
|
||||||
manageIdentityData(node);
|
manageIdentityData(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ void AvatarMixer::manageIdentityData(const SharedNodePointer& node) {
|
||||||
sendIdentity = true;
|
sendIdentity = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sendIdentity) {
|
if (sendIdentity && !node->isUpstream()) {
|
||||||
sendIdentityPacket(nodeData, node); // Tell node whose name changed about its new session display name or avatar.
|
sendIdentityPacket(nodeData, node); // Tell node whose name changed about its new session display name or avatar.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ int AvatarMixerSlave::sendIdentityPacket(const AvatarMixerClientData* nodeData,
|
||||||
|
|
||||||
int AvatarMixerSlave::sendReplicatedIdentityPacket(const AvatarMixerClientData* nodeData, const SharedNodePointer& destinationNode) {
|
int AvatarMixerSlave::sendReplicatedIdentityPacket(const AvatarMixerClientData* nodeData, const SharedNodePointer& destinationNode) {
|
||||||
if (destinationNode->getType() == NodeType::DownstreamAvatarMixer) {
|
if (destinationNode->getType() == NodeType::DownstreamAvatarMixer) {
|
||||||
QByteArray individualData = nodeData->getConstAvatarData()->identityByteArray(true);
|
QByteArray individualData = nodeData->getConstAvatarData()->identityByteArray(true, true);
|
||||||
individualData.replace(0, NUM_BYTES_RFC4122_UUID, nodeData->getNodeID().toRfc4122()); // FIXME, this looks suspicious
|
individualData.replace(0, NUM_BYTES_RFC4122_UUID, nodeData->getNodeID().toRfc4122()); // FIXME, this looks suspicious
|
||||||
auto identityPacket = NLPacket::create(PacketType::ReplicatedAvatarIdentity);
|
auto identityPacket = NLPacket::create(PacketType::ReplicatedAvatarIdentity);
|
||||||
identityPacket->write(individualData);
|
identityPacket->write(individualData);
|
||||||
|
|
|
@ -1509,6 +1509,7 @@ void AvatarData::processAvatarIdentity(const QByteArray& identityData, bool& ide
|
||||||
>> identity.attachmentData
|
>> identity.attachmentData
|
||||||
>> identity.displayName
|
>> identity.displayName
|
||||||
>> identity.sessionDisplayName
|
>> identity.sessionDisplayName
|
||||||
|
>> identity.isReplicated
|
||||||
>> identity.avatarEntityData;
|
>> identity.avatarEntityData;
|
||||||
|
|
||||||
// set the store identity sequence number to match the incoming identity
|
// set the store identity sequence number to match the incoming identity
|
||||||
|
@ -1531,6 +1532,11 @@ void AvatarData::processAvatarIdentity(const QByteArray& identityData, bool& ide
|
||||||
}
|
}
|
||||||
maybeUpdateSessionDisplayNameFromTransport(identity.sessionDisplayName);
|
maybeUpdateSessionDisplayNameFromTransport(identity.sessionDisplayName);
|
||||||
|
|
||||||
|
if (identity.isReplicated != _isReplicated) {
|
||||||
|
_isReplicated = identity.isReplicated;
|
||||||
|
identityChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (identity.attachmentData != _attachmentData) {
|
if (identity.attachmentData != _attachmentData) {
|
||||||
setAttachmentData(identity.attachmentData);
|
setAttachmentData(identity.attachmentData);
|
||||||
identityChanged = true;
|
identityChanged = true;
|
||||||
|
@ -1563,7 +1569,7 @@ void AvatarData::processAvatarIdentity(const QByteArray& identityData, bool& ide
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray AvatarData::identityByteArray(bool shouldForwardIncomingSequenceNumber) const {
|
QByteArray AvatarData::identityByteArray(bool shouldForwardIncomingSequenceNumber, bool setIsReplicated) const {
|
||||||
QByteArray identityData;
|
QByteArray identityData;
|
||||||
QDataStream identityStream(&identityData, QIODevice::Append);
|
QDataStream identityStream(&identityData, QIODevice::Append);
|
||||||
const QUrl& urlToSend = cannonicalSkeletonModelURL(emptyURL); // depends on _skeletonModelURL
|
const QUrl& urlToSend = cannonicalSkeletonModelURL(emptyURL); // depends on _skeletonModelURL
|
||||||
|
@ -1584,6 +1590,7 @@ QByteArray AvatarData::identityByteArray(bool shouldForwardIncomingSequenceNumbe
|
||||||
<< _attachmentData
|
<< _attachmentData
|
||||||
<< _displayName
|
<< _displayName
|
||||||
<< getSessionDisplayNameForTransport() // depends on _sessionDisplayName
|
<< getSessionDisplayNameForTransport() // depends on _sessionDisplayName
|
||||||
|
<< (_isReplicated || setIsReplicated)
|
||||||
<< _avatarEntityData;
|
<< _avatarEntityData;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -531,6 +531,7 @@ public:
|
||||||
QVector<AttachmentData> attachmentData;
|
QVector<AttachmentData> attachmentData;
|
||||||
QString displayName;
|
QString displayName;
|
||||||
QString sessionDisplayName;
|
QString sessionDisplayName;
|
||||||
|
bool isReplicated;
|
||||||
AvatarEntityMap avatarEntityData;
|
AvatarEntityMap avatarEntityData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -539,7 +540,7 @@ public:
|
||||||
void processAvatarIdentity(const QByteArray& identityData, bool& identityChanged,
|
void processAvatarIdentity(const QByteArray& identityData, bool& identityChanged,
|
||||||
bool& displayNameChanged, bool& skeletonModelUrlChanged);
|
bool& displayNameChanged, bool& skeletonModelUrlChanged);
|
||||||
|
|
||||||
QByteArray identityByteArray(bool shouldForwardIncomingSequenceNumber = false) const;
|
QByteArray identityByteArray(bool shouldForwardIncomingSequenceNumber = false, bool setIsReplicated = false) const;
|
||||||
|
|
||||||
const QUrl& getSkeletonModelURL() const { return _skeletonModelURL; }
|
const QUrl& getSkeletonModelURL() const { return _skeletonModelURL; }
|
||||||
const QString& getDisplayName() const { return _displayName; }
|
const QString& getDisplayName() const { return _displayName; }
|
||||||
|
@ -627,6 +628,8 @@ public:
|
||||||
|
|
||||||
float getDensity() const { return _density; }
|
float getDensity() const { return _density; }
|
||||||
|
|
||||||
|
bool getIsReplicated() const { return _isReplicated; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void displayNameChanged();
|
void displayNameChanged();
|
||||||
|
|
||||||
|
@ -663,6 +666,10 @@ protected:
|
||||||
bool hasParent() const { return !getParentID().isNull(); }
|
bool hasParent() const { return !getParentID().isNull(); }
|
||||||
bool hasFaceTracker() const { return _headData ? _headData->_isFaceTrackerConnected : false; }
|
bool hasFaceTracker() const { return _headData ? _headData->_isFaceTrackerConnected : false; }
|
||||||
|
|
||||||
|
// isReplicated will be true on downstream Avatar Mixers and their clients, but false on the upstream "master"
|
||||||
|
// Audio Mixer that the replicated avatar is connected to.
|
||||||
|
bool _isReplicated{ false };
|
||||||
|
|
||||||
glm::vec3 _handPosition;
|
glm::vec3 _handPosition;
|
||||||
virtual const QString& getSessionDisplayNameForTransport() const { return _sessionDisplayName; }
|
virtual const QString& getSessionDisplayNameForTransport() const { return _sessionDisplayName; }
|
||||||
virtual void maybeUpdateSessionDisplayNameFromTransport(const QString& sessionDisplayName) { } // No-op in AvatarMixer
|
virtual void maybeUpdateSessionDisplayNameFromTransport(const QString& sessionDisplayName) { } // No-op in AvatarMixer
|
||||||
|
|
Loading…
Reference in a new issue