mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 12:04:03 +02:00
use NodeList ownerUUID for DataServerScriptingInterface, fix double UUID send
This commit is contained in:
parent
d57aec9793
commit
a9ce6c7467
5 changed files with 7 additions and 19 deletions
|
@ -2494,17 +2494,14 @@ void Application::updateAvatar(float deltaTime) {
|
||||||
// Get audio loudness data from audio input device
|
// Get audio loudness data from audio input device
|
||||||
_myAvatar.getHead().setAudioLoudness(_audio.getLastInputLoudness());
|
_myAvatar.getHead().setAudioLoudness(_audio.getLastInputLoudness());
|
||||||
|
|
||||||
NodeList* nodeList = NodeList::getInstance();
|
|
||||||
|
|
||||||
// send head/hand data to the avatar mixer and voxel server
|
// send head/hand data to the avatar mixer and voxel server
|
||||||
unsigned char broadcastString[MAX_PACKET_SIZE];
|
unsigned char broadcastString[MAX_PACKET_SIZE];
|
||||||
unsigned char* endOfBroadcastStringWrite = broadcastString;
|
unsigned char* endOfBroadcastStringWrite = broadcastString;
|
||||||
|
|
||||||
endOfBroadcastStringWrite += populateTypeAndVersion(endOfBroadcastStringWrite, PACKET_TYPE_HEAD_DATA);
|
endOfBroadcastStringWrite += populateTypeAndVersion(endOfBroadcastStringWrite, PACKET_TYPE_HEAD_DATA);
|
||||||
|
|
||||||
QByteArray ownerUUID = nodeList->getOwnerUUID().toRfc4122();
|
// pack the NodeList owner UUID
|
||||||
memcpy(endOfBroadcastStringWrite, ownerUUID.constData(), ownerUUID.size());
|
endOfBroadcastStringWrite += NodeList::getInstance()->packOwnerUUID(endOfBroadcastStringWrite);
|
||||||
endOfBroadcastStringWrite += ownerUUID.size();
|
|
||||||
|
|
||||||
endOfBroadcastStringWrite += _myAvatar.getBroadcastData(endOfBroadcastStringWrite);
|
endOfBroadcastStringWrite += _myAvatar.getBroadcastData(endOfBroadcastStringWrite);
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,6 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
||||||
_handData = new HandData(this);
|
_handData = new HandData(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// pack the NodeList owner UUID
|
|
||||||
destinationBuffer += NodeList::getInstance()->packOwnerUUID(destinationBuffer);
|
|
||||||
|
|
||||||
// Body world position
|
// Body world position
|
||||||
memcpy(destinationBuffer, &_position, sizeof(float) * 3);
|
memcpy(destinationBuffer, &_position, sizeof(float) * 3);
|
||||||
destinationBuffer += sizeof(float) * 3;
|
destinationBuffer += sizeof(float) * 3;
|
||||||
|
|
|
@ -7,15 +7,15 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <DataServerClient.h>
|
#include <DataServerClient.h>
|
||||||
|
#include <NodeList.h>
|
||||||
|
|
||||||
#include "DataServerScriptingInterface.h"
|
#include "DataServerScriptingInterface.h"
|
||||||
|
|
||||||
DataServerScriptingInterface::DataServerScriptingInterface() :
|
DataServerScriptingInterface::DataServerScriptingInterface()
|
||||||
_uuid(QUuid::createUuid())
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataServerScriptingInterface::setValueForKey(const QString& key, const QString& value) {
|
void DataServerScriptingInterface::setValueForKey(const QString& key, const QString& value) {
|
||||||
DataServerClient::putValueForKeyAndUUID(key, value, _uuid);
|
DataServerClient::putValueForKeyAndUUID(key, value, NodeList::getInstance()->getOwnerUUID());
|
||||||
}
|
}
|
|
@ -18,13 +18,8 @@ class DataServerScriptingInterface : public QObject {
|
||||||
public:
|
public:
|
||||||
DataServerScriptingInterface();
|
DataServerScriptingInterface();
|
||||||
|
|
||||||
void refreshUUID() { _uuid = QUuid::createUuid(); }
|
|
||||||
const QUuid& getUUID() const { return _uuid; }
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setValueForKey(const QString& key, const QString& value);
|
void setValueForKey(const QString& key, const QString& value);
|
||||||
private:
|
|
||||||
QUuid _uuid;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__hifi__DataServerScriptingInterface__) */
|
#endif /* defined(__hifi__DataServerScriptingInterface__) */
|
||||||
|
|
|
@ -41,6 +41,7 @@ static QScriptValue soundConstructor(QScriptContext* context, QScriptEngine* eng
|
||||||
|
|
||||||
ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems, const QString& fileNameString, AbstractMenuInterface* menu,
|
ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems, const QString& fileNameString, AbstractMenuInterface* menu,
|
||||||
AbstractControllerScriptingInterface* controllerScriptingInterface) :
|
AbstractControllerScriptingInterface* controllerScriptingInterface) :
|
||||||
|
_dataServerScriptingInterface(),
|
||||||
_avatarData(NULL)
|
_avatarData(NULL)
|
||||||
{
|
{
|
||||||
_scriptContents = scriptContents;
|
_scriptContents = scriptContents;
|
||||||
|
@ -249,9 +250,7 @@ void ScriptEngine::run() {
|
||||||
numAvatarHeaderBytes = populateTypeAndVersion(avatarPacket, PACKET_TYPE_HEAD_DATA);
|
numAvatarHeaderBytes = populateTypeAndVersion(avatarPacket, PACKET_TYPE_HEAD_DATA);
|
||||||
|
|
||||||
// pack the owner UUID for this script
|
// pack the owner UUID for this script
|
||||||
QByteArray ownerUUID = nodeList->getOwnerUUID().toRfc4122();
|
numAvatarHeaderBytes += NodeList::getInstance()->packOwnerUUID(avatarPacket);
|
||||||
memcpy(avatarPacket + numAvatarHeaderBytes, ownerUUID.constData(), ownerUUID.size());
|
|
||||||
numAvatarHeaderBytes += ownerUUID.size();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int numAvatarPacketBytes = _avatarData->getBroadcastData(avatarPacket + numAvatarHeaderBytes) + numAvatarHeaderBytes;
|
int numAvatarPacketBytes = _avatarData->getBroadcastData(avatarPacket + numAvatarHeaderBytes) + numAvatarHeaderBytes;
|
||||||
|
|
Loading…
Reference in a new issue