mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 18:44:00 +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
|
||||
_myAvatar.getHead().setAudioLoudness(_audio.getLastInputLoudness());
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
|
||||
// send head/hand data to the avatar mixer and voxel server
|
||||
unsigned char broadcastString[MAX_PACKET_SIZE];
|
||||
unsigned char* endOfBroadcastStringWrite = broadcastString;
|
||||
|
||||
endOfBroadcastStringWrite += populateTypeAndVersion(endOfBroadcastStringWrite, PACKET_TYPE_HEAD_DATA);
|
||||
|
||||
QByteArray ownerUUID = nodeList->getOwnerUUID().toRfc4122();
|
||||
memcpy(endOfBroadcastStringWrite, ownerUUID.constData(), ownerUUID.size());
|
||||
endOfBroadcastStringWrite += ownerUUID.size();
|
||||
// pack the NodeList owner UUID
|
||||
endOfBroadcastStringWrite += NodeList::getInstance()->packOwnerUUID(endOfBroadcastStringWrite);
|
||||
|
||||
endOfBroadcastStringWrite += _myAvatar.getBroadcastData(endOfBroadcastStringWrite);
|
||||
|
||||
|
|
|
@ -68,9 +68,6 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
|||
_handData = new HandData(this);
|
||||
}
|
||||
|
||||
// pack the NodeList owner UUID
|
||||
destinationBuffer += NodeList::getInstance()->packOwnerUUID(destinationBuffer);
|
||||
|
||||
// Body world position
|
||||
memcpy(destinationBuffer, &_position, sizeof(float) * 3);
|
||||
destinationBuffer += sizeof(float) * 3;
|
||||
|
|
|
@ -7,15 +7,15 @@
|
|||
//
|
||||
|
||||
#include <DataServerClient.h>
|
||||
#include <NodeList.h>
|
||||
|
||||
#include "DataServerScriptingInterface.h"
|
||||
|
||||
DataServerScriptingInterface::DataServerScriptingInterface() :
|
||||
_uuid(QUuid::createUuid())
|
||||
DataServerScriptingInterface::DataServerScriptingInterface()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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:
|
||||
DataServerScriptingInterface();
|
||||
|
||||
void refreshUUID() { _uuid = QUuid::createUuid(); }
|
||||
const QUuid& getUUID() const { return _uuid; }
|
||||
|
||||
public slots:
|
||||
void setValueForKey(const QString& key, const QString& value);
|
||||
private:
|
||||
QUuid _uuid;
|
||||
};
|
||||
|
||||
#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,
|
||||
AbstractControllerScriptingInterface* controllerScriptingInterface) :
|
||||
_dataServerScriptingInterface(),
|
||||
_avatarData(NULL)
|
||||
{
|
||||
_scriptContents = scriptContents;
|
||||
|
@ -249,9 +250,7 @@ void ScriptEngine::run() {
|
|||
numAvatarHeaderBytes = populateTypeAndVersion(avatarPacket, PACKET_TYPE_HEAD_DATA);
|
||||
|
||||
// pack the owner UUID for this script
|
||||
QByteArray ownerUUID = nodeList->getOwnerUUID().toRfc4122();
|
||||
memcpy(avatarPacket + numAvatarHeaderBytes, ownerUUID.constData(), ownerUUID.size());
|
||||
numAvatarHeaderBytes += ownerUUID.size();
|
||||
numAvatarHeaderBytes += NodeList::getInstance()->packOwnerUUID(avatarPacket);
|
||||
}
|
||||
|
||||
int numAvatarPacketBytes = _avatarData->getBroadcastData(avatarPacket + numAvatarHeaderBytes) + numAvatarHeaderBytes;
|
||||
|
|
Loading…
Reference in a new issue