Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 166 files). Show all
Unified · Split
| @@ -42,6 +42,7 @@ static QScriptValue soundConstructor(QScriptContext* context, QScriptEngine* eng · 41 unmodified lines | |||
| 42 | 42 | ||
| 43 | ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems, const QString& fileNameString, AbstractMenuInterface* menu, | 43 | ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems, const QString& fileNameString, AbstractMenuInterface* menu, |
| 44 | AbstractControllerScriptingInterface* controllerScriptingInterface) : | 44 | AbstractControllerScriptingInterface* controllerScriptingInterface) : |
| 45 | _isAvatar(false), | ||
| 45 | _dataServerScriptingInterface(), | 46 | _dataServerScriptingInterface(), |
| 46 | _avatarData(NULL) | 47 | _avatarData(NULL) |
| 47 | { | 48 | { |
| @@ -234,21 +235,19 @@ void ScriptEngine::run() { · 186 unmodified lines | |||
| 234 | } | 235 | } |
| 235 | 236 | ||
| 236 | if (_isAvatar && _avatarData) { | 237 | if (_isAvatar && _avatarData) { |
| 237 | static unsigned char avatarPacket[MAX_PACKET_SIZE]; | 238 | static QByteArray avatarPacket; |
| 238 | static int numAvatarHeaderBytes = 0; | 239 | int numAvatarHeaderBytes = 0; |
| 239 | 240 | ||
| 240 | if (numAvatarHeaderBytes == 0) { | 241 | if (avatarPacket.size() == 0) { |
| 241 | // pack the avatar header bytes the first time | 242 | // pack the avatar header bytes the first time |
| 242 | // unlike the _avatar.getBroadcastData these won't change | 243 | // unlike the _avatar.getBroadcastData these won't change |
| 243 | numAvatarHeaderBytes = populateTypeAndVersion(avatarPacket, PACKET_TYPE_HEAD_DATA); | 244 | numAvatarHeaderBytes = populatePacketHeader(avatarPacket, PacketTypeAvatarData); |
| 244 | |||
| 245 | // pack the owner UUID for this script | ||
| 246 | numAvatarHeaderBytes += NodeList::getInstance()->packOwnerUUID(avatarPacket); | ||
| 247 | } | 245 | } |
| 248 | 246 | ||
| 249 | int numAvatarPacketBytes = _avatarData->getBroadcastData(avatarPacket + numAvatarHeaderBytes) + numAvatarHeaderBytes; | 247 | avatarPacket.resize(numAvatarHeaderBytes); |
| 248 | avatarPacket.append(_avatarData->toByteArray()); | ||
| 250 | 249 | ||
| 251 | nodeList->broadcastToNodes(avatarPacket, numAvatarPacketBytes, QSet<NODE_TYPE>() << NODE_TYPE_AVATAR_MIXER); | 250 | nodeList->broadcastToNodes(avatarPacket, NodeSet() << NodeType::AvatarMixer); |
| 252 | } | 251 | } |
| 253 | 252 | ||
| 254 | if (willSendVisualDataCallBack) { | 253 | if (willSendVisualDataCallBack) { |