Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 159 files). Show all
Unified · Split
| @@ -234,21 +234,19 @@ void ScriptEngine::run() { · 233 unmodified lines | |||
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | if (_isAvatar && _avatarData) { | 236 | if (_isAvatar && _avatarData) { |
| 237 | static unsigned char avatarPacket[MAX_PACKET_SIZE]; | 237 | static QByteArray avatarPacket; |
| 238 | static int numAvatarHeaderBytes = 0; | 238 | int numAvatarHeaderBytes = 0; |
| 239 | 239 | ||
| 240 | if (numAvatarHeaderBytes == 0) { | 240 | if (avatarPacket.size() == 0) { |
| 241 | // pack the avatar header bytes the first time | 241 | // pack the avatar header bytes the first time |
| 242 | // unlike the _avatar.getBroadcastData these won't change | 242 | // unlike the _avatar.getBroadcastData these won't change |
| 243 | numAvatarHeaderBytes = populateTypeAndVersion(avatarPacket, PACKET_TYPE_HEAD_DATA); | 243 | numAvatarHeaderBytes = populatePacketHeader(avatarPacket, PacketTypeAvatarData); |
| 244 | |||
| 245 | // pack the owner UUID for this script | ||
| 246 | numAvatarHeaderBytes += NodeList::getInstance()->packOwnerUUID(avatarPacket); | ||
| 247 | } | 244 | } |
| 248 | 245 | ||
| 249 | int numAvatarPacketBytes = _avatarData->getBroadcastData(avatarPacket + numAvatarHeaderBytes) + numAvatarHeaderBytes; | 246 | avatarPacket.resize(numAvatarHeaderBytes); |
| 247 | avatarPacket.append(_avatarData->toByteArray()); | ||
| 250 | 248 | ||
| 251 | nodeList->broadcastToNodes(avatarPacket, numAvatarPacketBytes, QSet<NODE_TYPE>() << NODE_TYPE_AVATAR_MIXER); | 249 | nodeList->broadcastToNodes(avatarPacket, NodeSet() << NodeType::AvatarMixer); |
| 252 | } | 250 | } |
| 253 | 251 | ||
| 254 | if (willSendVisualDataCallBack) { | 252 | if (willSendVisualDataCallBack) { |