aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs1506
1 files changed, 929 insertions, 577 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 79c80a7..dfad485 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -101,6 +101,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
101 public event AvatarPickerRequest OnAvatarPickerRequest; 101 public event AvatarPickerRequest OnAvatarPickerRequest;
102 public event StartAnim OnStartAnim; 102 public event StartAnim OnStartAnim;
103 public event StopAnim OnStopAnim; 103 public event StopAnim OnStopAnim;
104 public event ChangeAnim OnChangeAnim;
104 public event Action<IClientAPI> OnRequestAvatarsData; 105 public event Action<IClientAPI> OnRequestAvatarsData;
105 public event LinkObjects OnLinkObjects; 106 public event LinkObjects OnLinkObjects;
106 public event DelinkObjects OnDelinkObjects; 107 public event DelinkObjects OnDelinkObjects;
@@ -128,6 +129,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
128 public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; 129 public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
129 public event UpdatePrimFlags OnUpdatePrimFlags; 130 public event UpdatePrimFlags OnUpdatePrimFlags;
130 public event UpdatePrimTexture OnUpdatePrimTexture; 131 public event UpdatePrimTexture OnUpdatePrimTexture;
132 public event ClientChangeObject onClientChangeObject;
131 public event UpdateVector OnUpdatePrimGroupPosition; 133 public event UpdateVector OnUpdatePrimGroupPosition;
132 public event UpdateVector OnUpdatePrimSinglePosition; 134 public event UpdateVector OnUpdatePrimSinglePosition;
133 public event UpdatePrimRotation OnUpdatePrimGroupRotation; 135 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
@@ -161,6 +163,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
161 public event RequestTaskInventory OnRequestTaskInventory; 163 public event RequestTaskInventory OnRequestTaskInventory;
162 public event UpdateInventoryItem OnUpdateInventoryItem; 164 public event UpdateInventoryItem OnUpdateInventoryItem;
163 public event CopyInventoryItem OnCopyInventoryItem; 165 public event CopyInventoryItem OnCopyInventoryItem;
166 public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy;
164 public event MoveInventoryItem OnMoveInventoryItem; 167 public event MoveInventoryItem OnMoveInventoryItem;
165 public event RemoveInventoryItem OnRemoveInventoryItem; 168 public event RemoveInventoryItem OnRemoveInventoryItem;
166 public event RemoveInventoryFolder OnRemoveInventoryFolder; 169 public event RemoveInventoryFolder OnRemoveInventoryFolder;
@@ -259,7 +262,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
259 public event ClassifiedInfoRequest OnClassifiedInfoRequest; 262 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
260 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; 263 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
261 public event ClassifiedDelete OnClassifiedDelete; 264 public event ClassifiedDelete OnClassifiedDelete;
262 public event ClassifiedDelete OnClassifiedGodDelete; 265 public event ClassifiedGodDelete OnClassifiedGodDelete;
263 public event EventNotificationAddRequest OnEventNotificationAddRequest; 266 public event EventNotificationAddRequest OnEventNotificationAddRequest;
264 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; 267 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
265 public event EventGodDelete OnEventGodDelete; 268 public event EventGodDelete OnEventGodDelete;
@@ -290,10 +293,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
290 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 293 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
291 public event SimWideDeletesDelegate OnSimWideDeletes; 294 public event SimWideDeletesDelegate OnSimWideDeletes;
292 public event SendPostcard OnSendPostcard; 295 public event SendPostcard OnSendPostcard;
296 public event ChangeInventoryItemFlags OnChangeInventoryItemFlags;
293 public event MuteListEntryUpdate OnUpdateMuteListEntry; 297 public event MuteListEntryUpdate OnUpdateMuteListEntry;
294 public event MuteListEntryRemove OnRemoveMuteListEntry; 298 public event MuteListEntryRemove OnRemoveMuteListEntry;
295 public event GodlikeMessage onGodlikeMessage; 299 public event GodlikeMessage onGodlikeMessage;
296 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; 300 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
301 public event GenericCall2 OnUpdateThrottles;
297 302
298 #endregion Events 303 #endregion Events
299 304
@@ -322,11 +327,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
322 private readonly byte[] m_channelVersion = Utils.EmptyBytes; 327 private readonly byte[] m_channelVersion = Utils.EmptyBytes;
323 private readonly IGroupsModule m_GroupsModule; 328 private readonly IGroupsModule m_GroupsModule;
324 329
330 private int m_cachedTextureSerial;
325 private PriorityQueue m_entityUpdates; 331 private PriorityQueue m_entityUpdates;
326 private PriorityQueue m_entityProps; 332 private PriorityQueue m_entityProps;
327 private Prioritizer m_prioritizer; 333 private Prioritizer m_prioritizer;
328 private bool m_disableFacelights = false; 334 private bool m_disableFacelights = false;
329 335
336 private bool m_VelocityInterpolate = false;
337 private const uint MaxTransferBytesPerPacket = 600;
338
339
330 /// <value> 340 /// <value>
331 /// List used in construction of data blocks for an object update packet. This is to stop us having to 341 /// List used in construction of data blocks for an object update packet. This is to stop us having to
332 /// continually recreate it. 342 /// continually recreate it.
@@ -338,13 +348,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
338 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an 348 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an
339 /// ownerless phantom. 349 /// ownerless phantom.
340 /// 350 ///
341 /// All manipulation of this set has to occur under a lock 351 /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
342 /// 352 ///
343 /// </value> 353 /// </value>
344 protected HashSet<uint> m_killRecord; 354// protected HashSet<uint> m_killRecord;
345 355
346// protected HashSet<uint> m_attachmentsSent; 356// protected HashSet<uint> m_attachmentsSent;
347 357
358 private bool m_deliverPackets = true;
348 private int m_animationSequenceNumber = 1; 359 private int m_animationSequenceNumber = 1;
349 private bool m_SendLogoutPacketWhenClosing = true; 360 private bool m_SendLogoutPacketWhenClosing = true;
350 361
@@ -391,6 +402,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
391 get { return m_startpos; } 402 get { return m_startpos; }
392 set { m_startpos = value; } 403 set { m_startpos = value; }
393 } 404 }
405 public bool DeliverPackets
406 {
407 get { return m_deliverPackets; }
408 set {
409 m_deliverPackets = value;
410 m_udpClient.m_deliverPackets = value;
411 }
412 }
394 public UUID AgentId { get { return m_agentId; } } 413 public UUID AgentId { get { return m_agentId; } }
395 public ISceneAgent SceneAgent { get; set; } 414 public ISceneAgent SceneAgent { get; set; }
396 public UUID ActiveGroupId { get { return m_activeGroupID; } } 415 public UUID ActiveGroupId { get { return m_activeGroupID; } }
@@ -441,6 +460,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
441 } 460 }
442 461
443 public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } 462 public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } }
463
444 464
445 #endregion Properties 465 #endregion Properties
446 466
@@ -467,7 +487,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
467 m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); 487 m_entityUpdates = new PriorityQueue(m_scene.Entities.Count);
468 m_entityProps = new PriorityQueue(m_scene.Entities.Count); 488 m_entityProps = new PriorityQueue(m_scene.Entities.Count);
469 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); 489 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
470 m_killRecord = new HashSet<uint>(); 490// m_killRecord = new HashSet<uint>();
471// m_attachmentsSent = new HashSet<uint>(); 491// m_attachmentsSent = new HashSet<uint>();
472 492
473 m_assetService = m_scene.RequestModuleInterface<IAssetService>(); 493 m_assetService = m_scene.RequestModuleInterface<IAssetService>();
@@ -496,12 +516,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
496 516
497 #region Client Methods 517 #region Client Methods
498 518
519
520 /// <summary>
521 /// Close down the client view
522 /// </summary>
499 public void Close() 523 public void Close()
500 { 524 {
501 Close(false); 525 Close(true, false);
502 } 526 }
503 527
504 public void Close(bool force) 528 public void Close(bool sendStop, bool force)
505 { 529 {
506 // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. 530 // We lock here to prevent race conditions between two threads calling close simultaneously (e.g.
507 // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. 531 // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection.
@@ -513,7 +537,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
513 return; 537 return;
514 538
515 IsActive = false; 539 IsActive = false;
516 CloseWithoutChecks(); 540 CloseWithoutChecks(sendStop);
517 } 541 }
518 } 542 }
519 543
@@ -526,12 +550,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
526 /// 550 ///
527 /// Callers must lock ClosingSyncLock before calling. 551 /// Callers must lock ClosingSyncLock before calling.
528 /// </remarks> 552 /// </remarks>
529 public void CloseWithoutChecks() 553 public void CloseWithoutChecks(bool sendStop)
530 { 554 {
531 m_log.DebugFormat( 555 m_log.DebugFormat(
532 "[CLIENT]: Close has been called for {0} attached to scene {1}", 556 "[CLIENT]: Close has been called for {0} attached to scene {1}",
533 Name, m_scene.RegionInfo.RegionName); 557 Name, m_scene.RegionInfo.RegionName);
534 558
559 if (sendStop)
560 {
561 // Send the STOP packet
562 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
563 OutPacket(disable, ThrottleOutPacketType.Unknown);
564 }
565
535 // Shutdown the image manager 566 // Shutdown the image manager
536 ImageManager.Close(); 567 ImageManager.Close();
537 568
@@ -554,6 +585,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
554 // Disable UDP handling for this client 585 // Disable UDP handling for this client
555 m_udpClient.Shutdown(); 586 m_udpClient.Shutdown();
556 587
588
557 //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); 589 //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false));
558 //GC.Collect(); 590 //GC.Collect();
559 //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); 591 //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true));
@@ -809,7 +841,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
809 handshake.RegionInfo4[0].RegionFlagsExtended = args.regionFlags; 841 handshake.RegionInfo4[0].RegionFlagsExtended = args.regionFlags;
810 handshake.RegionInfo4[0].RegionProtocols = 0; // 1 here would indicate that SSB is supported 842 handshake.RegionInfo4[0].RegionProtocols = 0; // 1 here would indicate that SSB is supported
811 843
812 OutPacket(handshake, ThrottleOutPacketType.Task); 844 OutPacket(handshake, ThrottleOutPacketType.Unknown);
813 } 845 }
814 846
815 847
@@ -850,7 +882,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
850 reply.ChatData.OwnerID = ownerID; 882 reply.ChatData.OwnerID = ownerID;
851 reply.ChatData.SourceID = fromAgentID; 883 reply.ChatData.SourceID = fromAgentID;
852 884
853 OutPacket(reply, ThrottleOutPacketType.Task); 885 OutPacket(reply, ThrottleOutPacketType.Unknown);
854 } 886 }
855 887
856 /// <summary> 888 /// <summary>
@@ -883,32 +915,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
883 msg.MessageBlock.Message = Util.StringToBytes1024(im.message); 915 msg.MessageBlock.Message = Util.StringToBytes1024(im.message);
884 msg.MessageBlock.BinaryBucket = im.binaryBucket; 916 msg.MessageBlock.BinaryBucket = im.binaryBucket;
885 917
886 if (im.message.StartsWith("[grouptest]")) 918 OutPacket(msg, ThrottleOutPacketType.Task);
887 { // this block is test code for implementing group IM - delete when group IM is finished
888 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
889 if (eq != null)
890 {
891 im.dialog = 17;
892
893 //eq.ChatterboxInvitation(
894 // new UUID("00000000-68f9-1111-024e-222222111123"),
895 // "OpenSimulator Testing", im.fromAgentID, im.message, im.toAgentID, im.fromAgentName, im.dialog, 0,
896 // false, 0, new Vector3(), 1, im.imSessionID, im.fromGroup, im.binaryBucket);
897
898 eq.ChatterboxInvitation(
899 new UUID("00000000-68f9-1111-024e-222222111123"),
900 "OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0,
901 false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Util.StringToBytes256("OpenSimulator Testing"));
902
903 eq.ChatterBoxSessionAgentListUpdates(
904 new UUID("00000000-68f9-1111-024e-222222111123"),
905 new UUID(im.fromAgentID), new UUID(im.toAgentID), false, false, false);
906 }
907
908 Console.WriteLine("SendInstantMessage: " + msg);
909 }
910 else
911 OutPacket(msg, ThrottleOutPacketType.Task);
912 } 919 }
913 } 920 }
914 921
@@ -1146,6 +1153,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1146 public virtual void SendLayerData(float[] map) 1153 public virtual void SendLayerData(float[] map)
1147 { 1154 {
1148 Util.FireAndForget(DoSendLayerData, map); 1155 Util.FireAndForget(DoSendLayerData, map);
1156
1157 // Send it sync, and async. It's not that much data
1158 // and it improves user experience just so much!
1159 DoSendLayerData(map);
1149 } 1160 }
1150 1161
1151 /// <summary> 1162 /// <summary>
@@ -1158,16 +1169,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1158 1169
1159 try 1170 try
1160 { 1171 {
1161 //for (int y = 0; y < 16; y++) 1172 for (int y = 0; y < 16; y++)
1162 //{ 1173 {
1163 // for (int x = 0; x < 16; x++) 1174 for (int x = 0; x < 16; x+=4)
1164 // { 1175 {
1165 // SendLayerData(x, y, map); 1176 SendLayerPacket(x, y, map);
1166 // } 1177 }
1167 //} 1178 }
1168
1169 // Send LayerData in a spiral pattern. Fun!
1170 SendLayerTopRight(map, 0, 0, 15, 15);
1171 } 1179 }
1172 catch (Exception e) 1180 catch (Exception e)
1173 { 1181 {
@@ -1175,51 +1183,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1175 } 1183 }
1176 } 1184 }
1177 1185
1178 private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2)
1179 {
1180 // Row
1181 for (int i = x1; i <= x2; i++)
1182 SendLayerData(i, y1, map);
1183
1184 // Column
1185 for (int j = y1 + 1; j <= y2; j++)
1186 SendLayerData(x2, j, map);
1187
1188 if (x2 - x1 > 0)
1189 SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
1190 }
1191
1192 void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2)
1193 {
1194 // Row in reverse
1195 for (int i = x2; i >= x1; i--)
1196 SendLayerData(i, y2, map);
1197
1198 // Column in reverse
1199 for (int j = y2 - 1; j >= y1; j--)
1200 SendLayerData(x1, j, map);
1201
1202 if (x2 - x1 > 0)
1203 SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
1204 }
1205
1206 /// <summary> 1186 /// <summary>
1207 /// Sends a set of four patches (x, x+1, ..., x+3) to the client 1187 /// Sends a set of four patches (x, x+1, ..., x+3) to the client
1208 /// </summary> 1188 /// </summary>
1209 /// <param name="map">heightmap</param> 1189 /// <param name="map">heightmap</param>
1210 /// <param name="px">X coordinate for patches 0..12</param> 1190 /// <param name="px">X coordinate for patches 0..12</param>
1211 /// <param name="py">Y coordinate for patches 0..15</param> 1191 /// <param name="py">Y coordinate for patches 0..15</param>
1212 // private void SendLayerPacket(float[] map, int y, int x) 1192 private void SendLayerPacket(int x, int y, float[] map)
1213 // { 1193 {
1214 // int[] patches = new int[4]; 1194 int[] patches = new int[4];
1215 // patches[0] = x + 0 + y * 16; 1195 patches[0] = x + 0 + y * 16;
1216 // patches[1] = x + 1 + y * 16; 1196 patches[1] = x + 1 + y * 16;
1217 // patches[2] = x + 2 + y * 16; 1197 patches[2] = x + 2 + y * 16;
1218 // patches[3] = x + 3 + y * 16; 1198 patches[3] = x + 3 + y * 16;
1219 1199
1220 // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); 1200 float[] heightmap = (map.Length == 65536) ?
1221 // OutPacket(layerpack, ThrottleOutPacketType.Land); 1201 map :
1222 // } 1202 LLHeightFieldMoronize(map);
1203
1204 try
1205 {
1206 Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1207 OutPacket(layerpack, ThrottleOutPacketType.Land);
1208 }
1209 catch
1210 {
1211 for (int px = x ; px < x + 4 ; px++)
1212 SendLayerData(px, y, map);
1213 }
1214 }
1223 1215
1224 /// <summary> 1216 /// <summary>
1225 /// Sends a specified patch to a client 1217 /// Sends a specified patch to a client
@@ -1239,7 +1231,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1239 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); 1231 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1240 layerpack.Header.Reliable = true; 1232 layerpack.Header.Reliable = true;
1241 1233
1242 OutPacket(layerpack, ThrottleOutPacketType.Land); 1234 OutPacket(layerpack, ThrottleOutPacketType.Task);
1243 } 1235 }
1244 catch (Exception e) 1236 catch (Exception e)
1245 { 1237 {
@@ -1609,7 +1601,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1609 1601
1610 public void SendKillObject(List<uint> localIDs) 1602 public void SendKillObject(List<uint> localIDs)
1611 { 1603 {
1612// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); 1604// foreach (uint id in localIDs)
1605// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle);
1613 1606
1614 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); 1607 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject);
1615 // TODO: don't create new blocks if recycling an old packet 1608 // TODO: don't create new blocks if recycling an old packet
@@ -1631,17 +1624,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1631 // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race 1624 // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race
1632 // condition where a kill can be processed before an out-of-date update for the same object. 1625 // condition where a kill can be processed before an out-of-date update for the same object.
1633 // ProcessEntityUpdates() also takes the m_killRecord lock. 1626 // ProcessEntityUpdates() also takes the m_killRecord lock.
1634 lock (m_killRecord) 1627// lock (m_killRecord)
1635 { 1628// {
1636 foreach (uint localID in localIDs) 1629// foreach (uint localID in localIDs)
1637 m_killRecord.Add(localID); 1630// m_killRecord.Add(localID);
1638 1631
1639 // The throttle queue used here must match that being used for updates. Otherwise, there is a 1632 // The throttle queue used here must match that being used for updates. Otherwise, there is a
1640 // chance that a kill packet put on a separate queue will be sent to the client before an existing 1633 // chance that a kill packet put on a separate queue will be sent to the client before an existing
1641 // update packet on another queue. Receiving updates after kills results in unowned and undeletable 1634 // update packet on another queue. Receiving updates after kills results in unowned and undeletable
1642 // scene objects in a viewer until that viewer is relogged in. 1635 // scene objects in a viewer until that viewer is relogged in.
1643 OutPacket(kill, ThrottleOutPacketType.Task); 1636 OutPacket(kill, ThrottleOutPacketType.Task);
1644 } 1637// }
1645 } 1638 }
1646 } 1639 }
1647 1640
@@ -1763,7 +1756,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1763 newBlock.CreationDate = item.CreationDate; 1756 newBlock.CreationDate = item.CreationDate;
1764 newBlock.SalePrice = item.SalePrice; 1757 newBlock.SalePrice = item.SalePrice;
1765 newBlock.SaleType = item.SaleType; 1758 newBlock.SaleType = item.SaleType;
1766 newBlock.Flags = item.Flags; 1759 newBlock.Flags = item.Flags & 0xff;
1767 1760
1768 newBlock.CRC = 1761 newBlock.CRC =
1769 Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType, 1762 Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType,
@@ -2017,7 +2010,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2017 itemBlock.GroupID = item.GroupID; 2010 itemBlock.GroupID = item.GroupID;
2018 itemBlock.GroupOwned = item.GroupOwned; 2011 itemBlock.GroupOwned = item.GroupOwned;
2019 itemBlock.GroupMask = item.GroupPermissions; 2012 itemBlock.GroupMask = item.GroupPermissions;
2020 itemBlock.Flags = item.Flags; 2013 itemBlock.Flags = item.Flags & 0xff;
2021 itemBlock.SalePrice = item.SalePrice; 2014 itemBlock.SalePrice = item.SalePrice;
2022 itemBlock.SaleType = item.SaleType; 2015 itemBlock.SaleType = item.SaleType;
2023 itemBlock.CreationDate = item.CreationDate; 2016 itemBlock.CreationDate = item.CreationDate;
@@ -2084,7 +2077,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2084 bulkUpdate.ItemData[0].GroupID = item.GroupID; 2077 bulkUpdate.ItemData[0].GroupID = item.GroupID;
2085 bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned; 2078 bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned;
2086 bulkUpdate.ItemData[0].GroupMask = item.GroupPermissions; 2079 bulkUpdate.ItemData[0].GroupMask = item.GroupPermissions;
2087 bulkUpdate.ItemData[0].Flags = item.Flags; 2080 bulkUpdate.ItemData[0].Flags = item.Flags & 0xff;
2088 bulkUpdate.ItemData[0].SalePrice = item.SalePrice; 2081 bulkUpdate.ItemData[0].SalePrice = item.SalePrice;
2089 bulkUpdate.ItemData[0].SaleType = item.SaleType; 2082 bulkUpdate.ItemData[0].SaleType = item.SaleType;
2090 2083
@@ -2100,9 +2093,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2100 OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); 2093 OutPacket(bulkUpdate, ThrottleOutPacketType.Asset);
2101 } 2094 }
2102 2095
2103 /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see>
2104 public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) 2096 public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId)
2105 { 2097 {
2098 SendInventoryItemCreateUpdate(Item, UUID.Zero, callbackId);
2099 }
2100
2101 /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see>
2102 public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId)
2103 {
2106 const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff; 2104 const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff;
2107 2105
2108 UpdateCreateInventoryItemPacket InventoryReply 2106 UpdateCreateInventoryItemPacket InventoryReply
@@ -2112,6 +2110,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2112 // TODO: don't create new blocks if recycling an old packet 2110 // TODO: don't create new blocks if recycling an old packet
2113 InventoryReply.AgentData.AgentID = AgentId; 2111 InventoryReply.AgentData.AgentID = AgentId;
2114 InventoryReply.AgentData.SimApproved = true; 2112 InventoryReply.AgentData.SimApproved = true;
2113 InventoryReply.AgentData.TransactionID = transactionID;
2115 InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; 2114 InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1];
2116 InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); 2115 InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock();
2117 InventoryReply.InventoryData[0].ItemID = Item.ID; 2116 InventoryReply.InventoryData[0].ItemID = Item.ID;
@@ -2132,7 +2131,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2132 InventoryReply.InventoryData[0].GroupID = Item.GroupID; 2131 InventoryReply.InventoryData[0].GroupID = Item.GroupID;
2133 InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned; 2132 InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned;
2134 InventoryReply.InventoryData[0].GroupMask = Item.GroupPermissions; 2133 InventoryReply.InventoryData[0].GroupMask = Item.GroupPermissions;
2135 InventoryReply.InventoryData[0].Flags = Item.Flags; 2134 InventoryReply.InventoryData[0].Flags = Item.Flags & 0xff;
2136 InventoryReply.InventoryData[0].SalePrice = Item.SalePrice; 2135 InventoryReply.InventoryData[0].SalePrice = Item.SalePrice;
2137 InventoryReply.InventoryData[0].SaleType = Item.SaleType; 2136 InventoryReply.InventoryData[0].SaleType = Item.SaleType;
2138 InventoryReply.InventoryData[0].CreationDate = Item.CreationDate; 2137 InventoryReply.InventoryData[0].CreationDate = Item.CreationDate;
@@ -2181,16 +2180,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2181 replytask.InventoryData.TaskID = taskID; 2180 replytask.InventoryData.TaskID = taskID;
2182 replytask.InventoryData.Serial = serial; 2181 replytask.InventoryData.Serial = serial;
2183 replytask.InventoryData.Filename = fileName; 2182 replytask.InventoryData.Filename = fileName;
2184 OutPacket(replytask, ThrottleOutPacketType.Asset); 2183 OutPacket(replytask, ThrottleOutPacketType.Task);
2185 } 2184 }
2186 2185
2187 public void SendXferPacket(ulong xferID, uint packet, byte[] data) 2186 public void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory)
2188 { 2187 {
2188 ThrottleOutPacketType type = ThrottleOutPacketType.Asset;
2189 if (isTaskInventory)
2190 type = ThrottleOutPacketType.Task;
2191
2189 SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); 2192 SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket);
2190 sendXfer.XferID.ID = xferID; 2193 sendXfer.XferID.ID = xferID;
2191 sendXfer.XferID.Packet = packet; 2194 sendXfer.XferID.Packet = packet;
2192 sendXfer.DataPacket.Data = data; 2195 sendXfer.DataPacket.Data = data;
2193 OutPacket(sendXfer, ThrottleOutPacketType.Asset); 2196 OutPacket(sendXfer, type);
2194 } 2197 }
2195 2198
2196 public void SendAbortXferPacket(ulong xferID) 2199 public void SendAbortXferPacket(ulong xferID)
@@ -2377,6 +2380,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2377 OutPacket(sound, ThrottleOutPacketType.Task); 2380 OutPacket(sound, ThrottleOutPacketType.Task);
2378 } 2381 }
2379 2382
2383 public void SendTransferAbort(TransferRequestPacket transferRequest)
2384 {
2385 TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort);
2386 abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID;
2387 abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType;
2388 m_log.Debug("[Assets] Aborting transfer; asset request failed");
2389 OutPacket(abort, ThrottleOutPacketType.Task);
2390 }
2391
2380 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) 2392 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain)
2381 { 2393 {
2382 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); 2394 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger);
@@ -2685,6 +2697,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2685 float friction = part.Friction; 2697 float friction = part.Friction;
2686 float bounce = part.Restitution; 2698 float bounce = part.Restitution;
2687 float gravmod = part.GravityModifier; 2699 float gravmod = part.GravityModifier;
2700
2688 eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); 2701 eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId);
2689 } 2702 }
2690 } 2703 }
@@ -2755,8 +2768,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2755 req.AssetInf.ID, req.AssetInf.Metadata.ContentType); 2768 req.AssetInf.ID, req.AssetInf.Metadata.ContentType);
2756 return; 2769 return;
2757 } 2770 }
2771 int WearableOut = 0;
2772 bool isWearable = false;
2773
2774 if (req.AssetInf != null)
2775 isWearable =
2776 ((AssetType) req.AssetInf.Type ==
2777 AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing);
2758 2778
2759 //m_log.Debug("sending asset " + req.RequestAssetID); 2779
2780 //m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable);
2781
2782
2783 //if (isWearable)
2784 // m_log.Debug((AssetType)req.AssetInf.Type);
2785
2760 TransferInfoPacket Transfer = new TransferInfoPacket(); 2786 TransferInfoPacket Transfer = new TransferInfoPacket();
2761 Transfer.TransferInfo.ChannelType = 2; 2787 Transfer.TransferInfo.ChannelType = 2;
2762 Transfer.TransferInfo.Status = 0; 2788 Transfer.TransferInfo.Status = 0;
@@ -2778,7 +2804,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2778 Transfer.TransferInfo.Size = req.AssetInf.Data.Length; 2804 Transfer.TransferInfo.Size = req.AssetInf.Data.Length;
2779 Transfer.TransferInfo.TransferID = req.TransferRequestID; 2805 Transfer.TransferInfo.TransferID = req.TransferRequestID;
2780 Transfer.Header.Zerocoded = true; 2806 Transfer.Header.Zerocoded = true;
2781 OutPacket(Transfer, ThrottleOutPacketType.Asset); 2807 OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
2782 2808
2783 if (req.NumPackets == 1) 2809 if (req.NumPackets == 1)
2784 { 2810 {
@@ -2789,12 +2815,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2789 TransferPacket.TransferData.Data = req.AssetInf.Data; 2815 TransferPacket.TransferData.Data = req.AssetInf.Data;
2790 TransferPacket.TransferData.Status = 1; 2816 TransferPacket.TransferData.Status = 1;
2791 TransferPacket.Header.Zerocoded = true; 2817 TransferPacket.Header.Zerocoded = true;
2792 OutPacket(TransferPacket, ThrottleOutPacketType.Asset); 2818 OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
2793 } 2819 }
2794 else 2820 else
2795 { 2821 {
2796 int processedLength = 0; 2822 int processedLength = 0;
2797 int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; 2823// int maxChunkSize = Settings.MAX_PACKET_SIZE - 100;
2824
2825 int maxChunkSize = (int) MaxTransferBytesPerPacket;
2798 int packetNumber = 0; 2826 int packetNumber = 0;
2799 2827
2800 while (processedLength < req.AssetInf.Data.Length) 2828 while (processedLength < req.AssetInf.Data.Length)
@@ -2820,7 +2848,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2820 TransferPacket.TransferData.Status = 1; 2848 TransferPacket.TransferData.Status = 1;
2821 } 2849 }
2822 TransferPacket.Header.Zerocoded = true; 2850 TransferPacket.Header.Zerocoded = true;
2823 OutPacket(TransferPacket, ThrottleOutPacketType.Asset); 2851 OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
2824 2852
2825 processedLength += chunkSize; 2853 processedLength += chunkSize;
2826 packetNumber++; 2854 packetNumber++;
@@ -2865,7 +2893,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2865 reply.Data.ParcelID = parcelID; 2893 reply.Data.ParcelID = parcelID;
2866 reply.Data.OwnerID = land.OwnerID; 2894 reply.Data.OwnerID = land.OwnerID;
2867 reply.Data.Name = Utils.StringToBytes(land.Name); 2895 reply.Data.Name = Utils.StringToBytes(land.Name);
2868 reply.Data.Desc = Utils.StringToBytes(land.Description); 2896 if (land != null && land.Description != null && land.Description != String.Empty)
2897 reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length));
2898 else
2899 reply.Data.Desc = new Byte[0];
2869 reply.Data.ActualArea = land.Area; 2900 reply.Data.ActualArea = land.Area;
2870 reply.Data.BillableArea = land.Area; // TODO: what is this? 2901 reply.Data.BillableArea = land.Area; // TODO: what is this?
2871 2902
@@ -3572,24 +3603,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3572 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; 3603 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count];
3573 AgentWearablesUpdatePacket.WearableDataBlock awb; 3604 AgentWearablesUpdatePacket.WearableDataBlock awb;
3574 int idx = 0; 3605 int idx = 0;
3575 for (int i = 0; i < wearables.Length; i++) 3606
3576 { 3607 for (int i = 0; i < wearables.Length; i++)
3577 for (int j = 0; j < wearables[i].Count; j++) 3608 {
3578 { 3609 for (int j = 0; j < wearables[i].Count; j++)
3579 awb = new AgentWearablesUpdatePacket.WearableDataBlock(); 3610 {
3580 awb.WearableType = (byte)i; 3611 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
3581 awb.AssetID = wearables[i][j].AssetID; 3612 awb.WearableType = (byte) i;
3582 awb.ItemID = wearables[i][j].ItemID; 3613 awb.AssetID = wearables[i][j].AssetID;
3583 aw.WearableData[idx] = awb; 3614 awb.ItemID = wearables[i][j].ItemID;
3584 idx++; 3615 aw.WearableData[idx] = awb;
3585 3616 idx++;
3586// m_log.DebugFormat( 3617
3587// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", 3618 // m_log.DebugFormat(
3588// awb.ItemID, awb.AssetID, i, Name); 3619 // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}",
3589 } 3620 // awb.ItemID, awb.AssetID, i, Name);
3590 } 3621 }
3622 }
3591 3623
3592 OutPacket(aw, ThrottleOutPacketType.Task); 3624 OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
3593 } 3625 }
3594 3626
3595 public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) 3627 public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)
@@ -3600,7 +3632,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3600 3632
3601 AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); 3633 AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance);
3602 // TODO: don't create new blocks if recycling an old packet 3634 // TODO: don't create new blocks if recycling an old packet
3603 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; 3635 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length];
3604 avp.ObjectData.TextureEntry = textureEntry; 3636 avp.ObjectData.TextureEntry = textureEntry;
3605 3637
3606 AvatarAppearancePacket.VisualParamBlock avblock = null; 3638 AvatarAppearancePacket.VisualParamBlock avblock = null;
@@ -3731,7 +3763,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3731 /// </summary> 3763 /// </summary>
3732 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) 3764 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
3733 { 3765 {
3734 //double priority = m_prioritizer.GetUpdatePriority(this, entity); 3766 if (entity is SceneObjectPart)
3767 {
3768 SceneObjectPart e = (SceneObjectPart)entity;
3769 SceneObjectGroup g = e.ParentGroup;
3770 if (g.RootPart.Shape.State > 30) // HUD
3771 if (g.OwnerID != AgentId)
3772 return; // Don't send updates for other people's HUDs
3773 }
3774
3735 uint priority = m_prioritizer.GetUpdatePriority(this, entity); 3775 uint priority = m_prioritizer.GetUpdatePriority(this, entity);
3736 3776
3737 lock (m_entityUpdates.SyncRoot) 3777 lock (m_entityUpdates.SyncRoot)
@@ -3798,27 +3838,74 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3798 3838
3799 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race 3839 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race
3800 // condition where a kill can be processed before an out-of-date update for the same object. 3840 // condition where a kill can be processed before an out-of-date update for the same object.
3801 lock (m_killRecord) 3841 float avgTimeDilation = 1.0f;
3842 IEntityUpdate iupdate;
3843 Int32 timeinqueue; // this is just debugging code & can be dropped later
3844
3845 while (updatesThisCall < maxUpdates)
3802 { 3846 {
3803 float avgTimeDilation = 1.0f; 3847 lock (m_entityUpdates.SyncRoot)
3804 IEntityUpdate iupdate; 3848 if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue))
3805 Int32 timeinqueue; // this is just debugging code & can be dropped later 3849 break;
3806 3850
3807 while (updatesThisCall < maxUpdates) 3851 EntityUpdate update = (EntityUpdate)iupdate;
3852
3853 avgTimeDilation += update.TimeDilation;
3854 avgTimeDilation *= 0.5f;
3855
3856 if (update.Entity is SceneObjectPart)
3808 { 3857 {
3809 lock (m_entityUpdates.SyncRoot) 3858 SceneObjectPart part = (SceneObjectPart)update.Entity;
3810 if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue))
3811 break;
3812 3859
3813 EntityUpdate update = (EntityUpdate)iupdate; 3860 if (part.ParentGroup.IsDeleted)
3814 3861 continue;
3815 avgTimeDilation += update.TimeDilation;
3816 avgTimeDilation *= 0.5f;
3817 3862
3818 if (update.Entity is SceneObjectPart) 3863 if (part.ParentGroup.IsAttachment)
3864 { // Someone else's HUD, why are we getting these?
3865 if (part.ParentGroup.OwnerID != AgentId &&
3866 part.ParentGroup.RootPart.Shape.State > 30)
3867 continue;
3868 ScenePresence sp;
3869 // Owner is not in the sim, don't update it to
3870 // anyone
3871 if (!m_scene.TryGetScenePresence(part.OwnerID, out sp))
3872 continue;
3873
3874 List<SceneObjectGroup> atts = sp.GetAttachments();
3875 bool found = false;
3876 foreach (SceneObjectGroup att in atts)
3877 {
3878 if (att == part.ParentGroup)
3879 {
3880 found = true;
3881 break;
3882 }
3883 }
3884
3885 // It's an attachment of a valid avatar, but
3886 // doesn't seem to be attached, skip
3887 if (!found)
3888 continue;
3889
3890 // On vehicle crossing, the attachments are received
3891 // while the avatar is still a child. Don't send
3892 // updates here because the LocalId has not yet
3893 // been updated and the viewer will derender the
3894 // attachments until the avatar becomes root.
3895 if (sp.IsChildAgent)
3896 continue;
3897
3898 // If the object is an attachment we don't want it to be in the kill
3899 // record. Else attaching from inworld and subsequently dropping
3900 // it will no longer work.
3901// lock (m_killRecord)
3902// {
3903// m_killRecord.Remove(part.LocalId);
3904// m_killRecord.Remove(part.ParentGroup.RootPart.LocalId);
3905// }
3906 }
3907 else
3819 { 3908 {
3820 SceneObjectPart part = (SceneObjectPart)update.Entity;
3821
3822 // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client 3909 // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
3823 // will never receive an update after a prim kill. Even then, keeping the kill record may be a good 3910 // will never receive an update after a prim kill. Even then, keeping the kill record may be a good
3824 // safety measure. 3911 // safety measure.
@@ -3829,21 +3916,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3829 // 3916 //
3830 // This doesn't appear to apply to child prims - a client will happily ignore these updates 3917 // This doesn't appear to apply to child prims - a client will happily ignore these updates
3831 // after the root prim has been deleted. 3918 // after the root prim has been deleted.
3832 if (m_killRecord.Contains(part.LocalId)) 3919 //
3833 { 3920 // We ignore this for attachments because attaching something from inworld breaks unless we do.
3834 // m_log.WarnFormat( 3921// lock (m_killRecord)
3835 // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted", 3922// {
3836 // part.LocalId, Name); 3923// if (m_killRecord.Contains(part.LocalId))
3837 continue; 3924// continue;
3838 } 3925// if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId))
3839 3926// continue;
3840 if (part.ParentGroup.IsAttachment && m_disableFacelights) 3927// }
3928 }
3929
3930 if (part.ParentGroup.IsAttachment && m_disableFacelights)
3931 {
3932 if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
3933 part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
3841 { 3934 {
3842 if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && 3935 part.Shape.LightEntry = false;
3843 part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
3844 {
3845 part.Shape.LightEntry = false;
3846 }
3847 } 3936 }
3848 3937
3849 if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) 3938 if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
@@ -3854,224 +3943,166 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3854 part.Shape.ProfileHollow = 27500; 3943 part.Shape.ProfileHollow = 27500;
3855 } 3944 }
3856 } 3945 }
3857 3946
3858 #region UpdateFlags to packet type conversion 3947 if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
3859
3860 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
3861
3862 bool canUseCompressed = true;
3863 bool canUseImproved = true;
3864
3865 // Compressed object updates only make sense for LL primitives
3866 if (!(update.Entity is SceneObjectPart))
3867 { 3948 {
3868 canUseCompressed = false; 3949 // Ensure that mesh has at least 8 valid faces
3950 part.Shape.ProfileBegin = 12500;
3951 part.Shape.ProfileEnd = 0;
3952 part.Shape.ProfileHollow = 27500;
3869 } 3953 }
3870 3954 }
3871 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) 3955
3956 ++updatesThisCall;
3957
3958 #region UpdateFlags to packet type conversion
3959
3960 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
3961
3962 bool canUseCompressed = true;
3963 bool canUseImproved = true;
3964
3965 // Compressed object updates only make sense for LL primitives
3966 if (!(update.Entity is SceneObjectPart))
3967 {
3968 canUseCompressed = false;
3969 }
3970
3971 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
3972 {
3973 canUseCompressed = false;
3974 canUseImproved = false;
3975 }
3976 else
3977 {
3978 if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) ||
3979 updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
3980 updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
3981 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3872 { 3982 {
3873 canUseCompressed = false; 3983 canUseCompressed = false;
3874 canUseImproved = false;
3875 } 3984 }
3876 else 3985
3986 if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
3987 updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
3988 updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
3989 updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
3990 updateFlags.HasFlag(PrimUpdateFlags.Text) ||
3991 updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
3992 updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
3993 updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
3994 updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
3995 updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
3996 updateFlags.HasFlag(PrimUpdateFlags.Material) ||
3997 updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
3998 updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
3999 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3877 { 4000 {
3878 if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || 4001 canUseImproved = false;
3879 updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
3880 updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
3881 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3882 {
3883 canUseCompressed = false;
3884 }
3885
3886 if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
3887 updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
3888 updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
3889 updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
3890 updateFlags.HasFlag(PrimUpdateFlags.Text) ||
3891 updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
3892 updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
3893 updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
3894 updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
3895 updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
3896 updateFlags.HasFlag(PrimUpdateFlags.Material) ||
3897 updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
3898 updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
3899 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3900 {
3901 canUseImproved = false;
3902 }
3903 } 4002 }
4003 }
3904 4004
3905 #endregion UpdateFlags to packet type conversion 4005 #endregion UpdateFlags to packet type conversion
3906
3907 #region Block Construction
3908
3909 // TODO: Remove this once we can build compressed updates
3910 canUseCompressed = false;
3911
3912 if (!canUseImproved && !canUseCompressed)
3913 {
3914 ObjectUpdatePacket.ObjectDataBlock updateBlock;
3915 4006
3916 if (update.Entity is ScenePresence) 4007 #region Block Construction
3917 {
3918 updateBlock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
3919 }
3920 else
3921 {
3922 SceneObjectPart part = (SceneObjectPart)update.Entity;
3923 updateBlock = CreatePrimUpdateBlock(part, AgentId);
3924
3925 // If the part has become a private hud since the update was scheduled then we do not
3926 // want to send it to other avatars.
3927 if (part.ParentGroup.IsAttachment
3928 && part.ParentGroup.HasPrivateAttachmentPoint
3929 && part.ParentGroup.AttachedAvatar != AgentId)
3930 continue;
3931
3932 // If the part has since been deleted, then drop the update. In the case of attachments,
3933 // this is to avoid spurious updates to other viewers since post-processing of attachments
3934 // has to change the IsAttachment flag for various reasons (which will end up in a pass
3935 // of the test above).
3936 //
3937 // Actual deletions (kills) happen in another method.
3938 if (part.ParentGroup.IsDeleted)
3939 continue;
3940 }
3941 4008
3942 objectUpdateBlocks.Value.Add(updateBlock); 4009 // TODO: Remove this once we can build compressed updates
3943 objectUpdates.Value.Add(update); 4010 canUseCompressed = false;
3944 }
3945 else if (!canUseImproved)
3946 {
3947 SceneObjectPart part = (SceneObjectPart)update.Entity;
3948 ObjectUpdateCompressedPacket.ObjectDataBlock compressedBlock
3949 = CreateCompressedUpdateBlock(part, updateFlags);
3950
3951 // If the part has since been deleted, then drop the update. In the case of attachments,
3952 // this is to avoid spurious updates to other viewers since post-processing of attachments
3953 // has to change the IsAttachment flag for various reasons (which will end up in a pass
3954 // of the test above).
3955 //
3956 // Actual deletions (kills) happen in another method.
3957 if (part.ParentGroup.IsDeleted)
3958 continue;
3959 4011
3960 compressedUpdateBlocks.Value.Add(compressedBlock); 4012 if (!canUseImproved && !canUseCompressed)
3961 compressedUpdates.Value.Add(update); 4013 {
4014 if (update.Entity is ScenePresence)
4015 {
4016 objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
3962 } 4017 }
3963 else 4018 else
3964 { 4019 {
3965 if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) 4020 objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
3966 {
3967 // Self updates go into a special list
3968 terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
3969 terseAgentUpdates.Value.Add(update);
3970 }
3971 else
3972 {
3973 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseUpdateBlock
3974 = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures));
3975
3976 // Everything else goes here
3977 if (update.Entity is SceneObjectPart)
3978 {
3979 SceneObjectPart part = (SceneObjectPart)update.Entity;
3980
3981 // If the part has become a private hud since the update was scheduled then we do not
3982 // want to send it to other avatars.
3983 if (part.ParentGroup.IsAttachment
3984 && part.ParentGroup.HasPrivateAttachmentPoint
3985 && part.ParentGroup.AttachedAvatar != AgentId)
3986 continue;
3987
3988 // If the part has since been deleted, then drop the update. In the case of attachments,
3989 // this is to avoid spurious updates to other viewers since post-processing of attachments
3990 // has to change the IsAttachment flag for various reasons (which will end up in a pass
3991 // of the test above).
3992 //
3993 // Actual deletions (kills) happen in another method.
3994 if (part.ParentGroup.IsDeleted)
3995 continue;
3996 }
3997
3998 terseUpdateBlocks.Value.Add(terseUpdateBlock);
3999 terseUpdates.Value.Add(update);
4000 }
4001 } 4021 }
4002
4003 ++updatesThisCall;
4004
4005 #endregion Block Construction
4006 } 4022 }
4007 4023 else if (!canUseImproved)
4008 #region Packet Sending 4024 {
4009 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); 4025 compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags));
4010 4026 }
4011 if (terseAgentUpdateBlocks.IsValueCreated) 4027 else
4012 { 4028 {
4013 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; 4029 if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId)
4030 // Self updates go into a special list
4031 terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
4032 else
4033 // Everything else goes here
4034 terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
4035 }
4014 4036
4015 ImprovedTerseObjectUpdatePacket packet 4037 #endregion Block Construction
4016 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); 4038 }
4017 4039
4018 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 4040 #region Packet Sending
4019 packet.RegionData.TimeDilation = timeDilation; 4041
4020 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 4042 const float TIME_DILATION = 1.0f;
4043 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f);
4044
4045 if (terseAgentUpdateBlocks.IsValueCreated)
4046 {
4047 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
4021 4048
4022 for (int i = 0; i < blocks.Count; i++) 4049 ImprovedTerseObjectUpdatePacket packet
4023 packet.ObjectData[i] = blocks[i]; 4050 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
4024 // If any of the packets created from this call go unacknowledged, all of the updates will be resent 4051 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4025 OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); }); 4052 packet.RegionData.TimeDilation = timeDilation;
4026 } 4053 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
4027 4054
4028 if (objectUpdateBlocks.IsValueCreated) 4055 for (int i = 0; i < blocks.Count; i++)
4029 { 4056 packet.ObjectData[i] = blocks[i];
4030 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value;
4031
4032 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
4033 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4034 packet.RegionData.TimeDilation = timeDilation;
4035 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count];
4036
4037 for (int i = 0; i < blocks.Count; i++)
4038 packet.ObjectData[i] = blocks[i];
4039 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
4040 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); });
4041 }
4042
4043 if (compressedUpdateBlocks.IsValueCreated)
4044 {
4045 List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value;
4046
4047 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
4048 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4049 packet.RegionData.TimeDilation = timeDilation;
4050 packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
4051
4052 for (int i = 0; i < blocks.Count; i++)
4053 packet.ObjectData[i] = blocks[i];
4054 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
4055 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); });
4056 }
4057 4057
4058 if (terseUpdateBlocks.IsValueCreated) 4058 OutPacket(packet, ThrottleOutPacketType.Unknown, true);
4059 { 4059 }
4060 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
4061
4062 ImprovedTerseObjectUpdatePacket packet
4063 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(
4064 PacketType.ImprovedTerseObjectUpdate);
4065 4060
4066 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 4061 if (objectUpdateBlocks.IsValueCreated)
4067 packet.RegionData.TimeDilation = timeDilation; 4062 {
4068 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 4063 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value;
4069 4064
4070 for (int i = 0; i < blocks.Count; i++) 4065 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
4071 packet.ObjectData[i] = blocks[i]; 4066 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4072 // If any of the packets created from this call go unacknowledged, all of the updates will be resent 4067 packet.RegionData.TimeDilation = timeDilation;
4073 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); 4068 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count];
4074 } 4069
4070 for (int i = 0; i < blocks.Count; i++)
4071 packet.ObjectData[i] = blocks[i];
4072
4073 OutPacket(packet, ThrottleOutPacketType.Task, true);
4074 }
4075
4076 if (compressedUpdateBlocks.IsValueCreated)
4077 {
4078 List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value;
4079
4080 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
4081 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4082 packet.RegionData.TimeDilation = timeDilation;
4083 packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
4084
4085 for (int i = 0; i < blocks.Count; i++)
4086 packet.ObjectData[i] = blocks[i];
4087
4088 OutPacket(packet, ThrottleOutPacketType.Task, true);
4089 }
4090
4091 if (terseUpdateBlocks.IsValueCreated)
4092 {
4093 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
4094
4095 ImprovedTerseObjectUpdatePacket packet
4096 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(
4097 PacketType.ImprovedTerseObjectUpdate);
4098 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4099 packet.RegionData.TimeDilation = timeDilation;
4100 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
4101
4102 for (int i = 0; i < blocks.Count; i++)
4103 packet.ObjectData[i] = blocks[i];
4104
4105 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); });
4075 } 4106 }
4076 4107
4077 #endregion Packet Sending 4108 #endregion Packet Sending
@@ -4364,11 +4395,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4364 4395
4365 // Pass in the delegate so that if this packet needs to be resent, we send the current properties 4396 // Pass in the delegate so that if this packet needs to be resent, we send the current properties
4366 // of the object rather than the properties when the packet was created 4397 // of the object rather than the properties when the packet was created
4367 OutPacket(packet, ThrottleOutPacketType.Task, true, 4398 // HACK : Remove intelligent resending until it's fixed in core
4368 delegate(OutgoingPacket oPacket) 4399 //OutPacket(packet, ThrottleOutPacketType.Task, true,
4369 { 4400 // delegate(OutgoingPacket oPacket)
4370 ResendPropertyUpdates(updates, oPacket); 4401 // {
4371 }); 4402 // ResendPropertyUpdates(updates, oPacket);
4403 // });
4404 OutPacket(packet, ThrottleOutPacketType.Task, true);
4372 4405
4373 // pbcnt += blocks.Count; 4406 // pbcnt += blocks.Count;
4374 // ppcnt++; 4407 // ppcnt++;
@@ -4394,11 +4427,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4394 // of the object rather than the properties when the packet was created 4427 // of the object rather than the properties when the packet was created
4395 List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); 4428 List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>();
4396 updates.Add(familyUpdates.Value[i]); 4429 updates.Add(familyUpdates.Value[i]);
4397 OutPacket(packet, ThrottleOutPacketType.Task, true, 4430 // HACK : Remove intelligent resending until it's fixed in core
4398 delegate(OutgoingPacket oPacket) 4431 //OutPacket(packet, ThrottleOutPacketType.Task, true,
4399 { 4432 // delegate(OutgoingPacket oPacket)
4400 ResendPropertyUpdates(updates, oPacket); 4433 // {
4401 }); 4434 // ResendPropertyUpdates(updates, oPacket);
4435 // });
4436 OutPacket(packet, ThrottleOutPacketType.Task, true);
4402 4437
4403 // fpcnt++; 4438 // fpcnt++;
4404 // fbcnt++; 4439 // fbcnt++;
@@ -4770,7 +4805,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4770 4805
4771 if (landData.SimwideArea > 0) 4806 if (landData.SimwideArea > 0)
4772 { 4807 {
4773 int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); 4808 int simulatorCapacity = (int)((long)landData.SimwideArea * (long)m_scene.RegionInfo.ObjectCapacity * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus / 65536L);
4809 // Never report more than sim total capacity
4810 if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity)
4811 simulatorCapacity = m_scene.RegionInfo.ObjectCapacity;
4774 updateMessage.SimWideMaxPrims = simulatorCapacity; 4812 updateMessage.SimWideMaxPrims = simulatorCapacity;
4775 } 4813 }
4776 else 4814 else
@@ -4899,14 +4937,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4899 4937
4900 if (notifyCount > 0) 4938 if (notifyCount > 0)
4901 { 4939 {
4902 if (notifyCount > 32) 4940// if (notifyCount > 32)
4903 { 4941// {
4904 m_log.InfoFormat( 4942// m_log.InfoFormat(
4905 "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" 4943// "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}"
4906 + " - a developer might want to investigate whether this is a hard limit", 32); 4944// + " - a developer might want to investigate whether this is a hard limit", 32);
4907 4945//
4908 notifyCount = 32; 4946// notifyCount = 32;
4909 } 4947// }
4910 4948
4911 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock 4949 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock
4912 = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; 4950 = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount];
@@ -4961,9 +4999,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4961 { 4999 {
4962 ScenePresence presence = (ScenePresence)entity; 5000 ScenePresence presence = (ScenePresence)entity;
4963 5001
5002 position = presence.OffsetPosition;
5003 rotation = presence.Rotation;
5004
5005 if (presence.ParentID != 0)
5006 {
5007 SceneObjectPart part = m_scene.GetSceneObjectPart(presence.ParentID);
5008 if (part != null && part != part.ParentGroup.RootPart)
5009 {
5010 position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset;
5011 rotation = part.RotationOffset * presence.Rotation;
5012 }
5013 angularVelocity = Vector3.Zero;
5014 }
5015 else
5016 {
5017 angularVelocity = presence.AngularVelocity;
5018 rotation = presence.Rotation;
5019 }
5020
4964 attachPoint = 0; 5021 attachPoint = 0;
4965 collisionPlane = presence.CollisionPlane; 5022 collisionPlane = presence.CollisionPlane;
4966 position = presence.OffsetPosition;
4967 velocity = presence.Velocity; 5023 velocity = presence.Velocity;
4968 acceleration = Vector3.Zero; 5024 acceleration = Vector3.Zero;
4969 5025
@@ -4972,9 +5028,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4972 // may improve movement smoothness. 5028 // may improve movement smoothness.
4973// acceleration = new Vector3(1, 0, 0); 5029// acceleration = new Vector3(1, 0, 0);
4974 5030
4975 angularVelocity = presence.AngularVelocity;
4976 rotation = presence.Rotation;
4977
4978 if (sendTexture) 5031 if (sendTexture)
4979 textureEntry = presence.Appearance.Texture.GetBytes(); 5032 textureEntry = presence.Appearance.Texture.GetBytes();
4980 else 5033 else
@@ -5080,13 +5133,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5080 5133
5081 protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) 5134 protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data)
5082 { 5135 {
5136 Vector3 offsetPosition = data.OffsetPosition;
5137 Quaternion rotation = data.Rotation;
5138 uint parentID = data.ParentID;
5139
5140 if (parentID != 0)
5141 {
5142 SceneObjectPart part = m_scene.GetSceneObjectPart(parentID);
5143 if (part != null && part != part.ParentGroup.RootPart)
5144 {
5145 offsetPosition = part.OffsetPosition + data.OffsetPosition * part.RotationOffset;
5146 rotation = part.RotationOffset * data.Rotation;
5147 parentID = part.ParentGroup.RootPart.LocalId;
5148 }
5149 }
5150
5083 byte[] objectData = new byte[76]; 5151 byte[] objectData = new byte[76];
5084 5152
5085 data.CollisionPlane.ToBytes(objectData, 0); 5153 data.CollisionPlane.ToBytes(objectData, 0);
5086 data.OffsetPosition.ToBytes(objectData, 16); 5154 offsetPosition.ToBytes(objectData, 16);
5155 Vector3 velocity = new Vector3(0, 0, 0);
5156 Vector3 acceleration = new Vector3(0, 0, 0);
5157 velocity.ToBytes(objectData, 28);
5158 acceleration.ToBytes(objectData, 40);
5087// data.Velocity.ToBytes(objectData, 28); 5159// data.Velocity.ToBytes(objectData, 28);
5088// data.Acceleration.ToBytes(objectData, 40); 5160// data.Acceleration.ToBytes(objectData, 40);
5089 data.Rotation.ToBytes(objectData, 52); 5161 rotation.ToBytes(objectData, 52);
5090 //data.AngularVelocity.ToBytes(objectData, 64); 5162 //data.AngularVelocity.ToBytes(objectData, 64);
5091 5163
5092 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); 5164 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
@@ -5100,14 +5172,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5100 update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + 5172 update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " +
5101 data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); 5173 data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle);
5102 update.ObjectData = objectData; 5174 update.ObjectData = objectData;
5103 update.ParentID = data.ParentID; 5175 update.ParentID = parentID;
5104 update.PathCurve = 16; 5176 update.PathCurve = 16;
5105 update.PathScaleX = 100; 5177 update.PathScaleX = 100;
5106 update.PathScaleY = 100; 5178 update.PathScaleY = 100;
5107 update.PCode = (byte)PCode.Avatar; 5179 update.PCode = (byte)PCode.Avatar;
5108 update.ProfileCurve = 1; 5180 update.ProfileCurve = 1;
5109 update.PSBlock = Utils.EmptyBytes; 5181 update.PSBlock = Utils.EmptyBytes;
5110 update.Scale = new Vector3(0.45f, 0.6f, 1.9f); 5182 update.Scale = data.Appearance.AvatarSize;
5183// update.Scale.Z -= 0.2f;
5184
5111 update.Text = Utils.EmptyBytes; 5185 update.Text = Utils.EmptyBytes;
5112 update.TextColor = new byte[4]; 5186 update.TextColor = new byte[4];
5113 5187
@@ -5118,10 +5192,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5118 update.TextureEntry = Utils.EmptyBytes; 5192 update.TextureEntry = Utils.EmptyBytes;
5119// update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; 5193// update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes;
5120 5194
5195/* all this flags seem related to prims and not avatars. This allow for wrong viewer side move of a avatar in prim edition mode (anv mantis 854)
5121 update.UpdateFlags = (uint)( 5196 update.UpdateFlags = (uint)(
5122 PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | 5197 PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner |
5123 PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | 5198 PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer |
5124 PrimFlags.ObjectOwnerModify); 5199 PrimFlags.ObjectOwnerModify);
5200*/
5201 update.UpdateFlags = 0;
5125 5202
5126 return update; 5203 return update;
5127 } 5204 }
@@ -5292,8 +5369,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5292 // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs 5369 // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs
5293 // for each AgentUpdate packet. 5370 // for each AgentUpdate packet.
5294 AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false); 5371 AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false);
5295 5372
5296 AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false); 5373 AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false);
5374 AddLocalPacketHandler(PacketType.VelocityInterpolateOff, HandleVelocityInterpolateOff, false);
5375 AddLocalPacketHandler(PacketType.VelocityInterpolateOn, HandleVelocityInterpolateOn, false);
5297 AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false); 5376 AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false);
5298 AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); 5377 AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false);
5299 AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); 5378 AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false);
@@ -5445,6 +5524,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5445 AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); 5524 AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false);
5446 AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); 5525 AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false);
5447 AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); 5526 AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode);
5527 AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments);
5448 AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); 5528 AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false);
5449 AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); 5529 AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents);
5450 AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); 5530 AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery);
@@ -5511,6 +5591,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5511 AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); 5591 AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest);
5512 AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); 5592 AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes);
5513 AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); 5593 AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard);
5594 AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags);
5514 5595
5515 AddGenericPacketHandler("autopilot", HandleAutopilot); 5596 AddGenericPacketHandler("autopilot", HandleAutopilot);
5516 } 5597 }
@@ -5549,6 +5630,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5549 (x.CameraLeftAxis != m_lastAgentUpdateArgs.CameraLeftAxis) || 5630 (x.CameraLeftAxis != m_lastAgentUpdateArgs.CameraLeftAxis) ||
5550 (x.CameraUpAxis != m_lastAgentUpdateArgs.CameraUpAxis) || 5631 (x.CameraUpAxis != m_lastAgentUpdateArgs.CameraUpAxis) ||
5551 (x.ControlFlags != m_lastAgentUpdateArgs.ControlFlags) || 5632 (x.ControlFlags != m_lastAgentUpdateArgs.ControlFlags) ||
5633 (x.ControlFlags != 0) ||
5552 (x.Far != m_lastAgentUpdateArgs.Far) || 5634 (x.Far != m_lastAgentUpdateArgs.Far) ||
5553 (x.Flags != m_lastAgentUpdateArgs.Flags) || 5635 (x.Flags != m_lastAgentUpdateArgs.Flags) ||
5554 (x.State != m_lastAgentUpdateArgs.State) || 5636 (x.State != m_lastAgentUpdateArgs.State) ||
@@ -5808,6 +5890,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5808 return true; 5890 return true;
5809 } 5891 }
5810 5892
5893 private bool HandleVelocityInterpolateOff(IClientAPI sender, Packet Pack)
5894 {
5895 VelocityInterpolateOffPacket p = (VelocityInterpolateOffPacket)Pack;
5896 if (p.AgentData.SessionID != SessionId ||
5897 p.AgentData.AgentID != AgentId)
5898 return true;
5899
5900 m_VelocityInterpolate = false;
5901 return true;
5902 }
5903
5904 private bool HandleVelocityInterpolateOn(IClientAPI sender, Packet Pack)
5905 {
5906 VelocityInterpolateOnPacket p = (VelocityInterpolateOnPacket)Pack;
5907 if (p.AgentData.SessionID != SessionId ||
5908 p.AgentData.AgentID != AgentId)
5909 return true;
5910
5911 m_VelocityInterpolate = true;
5912 return true;
5913 }
5914
5915
5811 private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack) 5916 private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack)
5812 { 5917 {
5813 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; 5918 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
@@ -6228,26 +6333,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6228 // Temporarily protect ourselves from the mantis #951 failure. 6333 // Temporarily protect ourselves from the mantis #951 failure.
6229 // However, we could do this for several other handlers where a failure isn't terminal 6334 // However, we could do this for several other handlers where a failure isn't terminal
6230 // for the client session anyway, in order to protect ourselves against bad code in plugins 6335 // for the client session anyway, in order to protect ourselves against bad code in plugins
6336 Vector3 avSize = appear.AgentData.Size;
6231 try 6337 try
6232 { 6338 {
6233 byte[] visualparams = new byte[appear.VisualParam.Length]; 6339 byte[] visualparams = new byte[appear.VisualParam.Length];
6234 for (int i = 0; i < appear.VisualParam.Length; i++) 6340 for (int i = 0; i < appear.VisualParam.Length; i++)
6235 visualparams[i] = appear.VisualParam[i].ParamValue; 6341 visualparams[i] = appear.VisualParam[i].ParamValue;
6236 6342 //var b = appear.WearableData[0];
6343
6237 Primitive.TextureEntry te = null; 6344 Primitive.TextureEntry te = null;
6238 if (appear.ObjectData.TextureEntry.Length > 1) 6345 if (appear.ObjectData.TextureEntry.Length > 1)
6239 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); 6346 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length);
6347
6348 WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length];
6349 for (int i=0; i<appear.WearableData.Length;i++)
6350 cacheitems[i] = new WearableCacheItem(){CacheId = appear.WearableData[i].CacheID,TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex)};
6240 6351
6241 List<CachedTextureRequestArg> hashes = new List<CachedTextureRequestArg>(); 6352
6242 for (int i = 0; i < appear.WearableData.Length; i++)
6243 {
6244 CachedTextureRequestArg arg = new CachedTextureRequestArg();
6245 arg.BakedTextureIndex = appear.WearableData[i].TextureIndex;
6246 arg.WearableHashID = appear.WearableData[i].CacheID;
6247 hashes.Add(arg);
6248 }
6249 6353
6250 handlerSetAppearance(sender, te, visualparams, hashes); 6354 handlerSetAppearance(sender, te, visualparams,avSize, cacheitems);
6251 } 6355 }
6252 catch (Exception e) 6356 catch (Exception e)
6253 { 6357 {
@@ -6456,6 +6560,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6456 { 6560 {
6457 handlerCompleteMovementToRegion(sender, true); 6561 handlerCompleteMovementToRegion(sender, true);
6458 } 6562 }
6563 else
6564 m_log.Debug("HandleCompleteAgentMovement NULL handler");
6565
6459 handlerCompleteMovementToRegion = null; 6566 handlerCompleteMovementToRegion = null;
6460 6567
6461 return true; 6568 return true;
@@ -6473,7 +6580,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6473 return true; 6580 return true;
6474 } 6581 }
6475 #endregion 6582 #endregion
6476 6583/*
6477 StartAnim handlerStartAnim = null; 6584 StartAnim handlerStartAnim = null;
6478 StopAnim handlerStopAnim = null; 6585 StopAnim handlerStopAnim = null;
6479 6586
@@ -6497,6 +6604,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6497 } 6604 }
6498 } 6605 }
6499 return true; 6606 return true;
6607*/
6608 ChangeAnim handlerChangeAnim = null;
6609
6610 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
6611 {
6612 handlerChangeAnim = OnChangeAnim;
6613 if (handlerChangeAnim != null)
6614 {
6615 handlerChangeAnim(AgentAni.AnimationList[i].AnimID, AgentAni.AnimationList[i].StartAnim, false);
6616 }
6617 }
6618
6619 handlerChangeAnim = OnChangeAnim;
6620 if (handlerChangeAnim != null)
6621 {
6622 handlerChangeAnim(UUID.Zero, false, true);
6623 }
6624
6625 return true;
6500 } 6626 }
6501 6627
6502 private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) 6628 private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack)
@@ -6722,6 +6848,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6722 #endregion 6848 #endregion
6723 6849
6724 m_udpClient.SetThrottles(atpack.Throttle.Throttles); 6850 m_udpClient.SetThrottles(atpack.Throttle.Throttles);
6851 GenericCall2 handler = OnUpdateThrottles;
6852 if (handler != null)
6853 {
6854 handler();
6855 }
6725 return true; 6856 return true;
6726 } 6857 }
6727 6858
@@ -7146,7 +7277,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7146 physdata.Bounce = phsblock.Restitution; 7277 physdata.Bounce = phsblock.Restitution;
7147 physdata.Density = phsblock.Density; 7278 physdata.Density = phsblock.Density;
7148 physdata.Friction = phsblock.Friction; 7279 physdata.Friction = phsblock.Friction;
7149 physdata.GravitationModifier = phsblock.GravityMultiplier; 7280 physdata.GravitationModifier = phsblock.GravityMultiplier;
7150 } 7281 }
7151 7282
7152 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); 7283 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this);
@@ -7732,6 +7863,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7732 // surrounding scene 7863 // surrounding scene
7733 if ((ImageType)block.Type == ImageType.Baked) 7864 if ((ImageType)block.Type == ImageType.Baked)
7734 args.Priority *= 2.0f; 7865 args.Priority *= 2.0f;
7866 int wearableout = 0;
7735 7867
7736 ImageManager.EnqueueReq(args); 7868 ImageManager.EnqueueReq(args);
7737 } 7869 }
@@ -8766,16 +8898,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8766 8898
8767 #region Parcel related packets 8899 #region Parcel related packets
8768 8900
8901 // acumulate several HandleRegionHandleRequest consecutive overlaping requests
8902 // to be done with minimal resources as possible
8903 // variables temporary here while in test
8904
8905 Queue<UUID> RegionHandleRequests = new Queue<UUID>();
8906 bool RegionHandleRequestsInService = false;
8907
8769 private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) 8908 private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack)
8770 { 8909 {
8771 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; 8910 UUID currentUUID;
8772 8911
8773 RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; 8912 RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest;
8774 if (handlerRegionHandleRequest != null) 8913
8914 if (handlerRegionHandleRequest == null)
8915 return true;
8916
8917 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack;
8918
8919 lock (RegionHandleRequests)
8775 { 8920 {
8776 handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); 8921 if (RegionHandleRequestsInService)
8922 {
8923 // we are already busy doing a previus request
8924 // so enqueue it
8925 RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID);
8926 return true;
8927 }
8928
8929 // else do it
8930 currentUUID = rhrPack.RequestBlock.RegionID;
8931 RegionHandleRequestsInService = true;
8777 } 8932 }
8778 return true; 8933
8934 while (true)
8935 {
8936 handlerRegionHandleRequest(this, currentUUID);
8937
8938 lock (RegionHandleRequests)
8939 {
8940 // exit condition, nothing to do or closed
8941 // current code seems to assume we may loose the handler at anytime,
8942 // so keep checking it
8943 handlerRegionHandleRequest = OnRegionHandleRequest;
8944
8945 if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null)
8946 {
8947 RegionHandleRequests.Clear();
8948 RegionHandleRequestsInService = false;
8949 return true;
8950 }
8951 currentUUID = RegionHandleRequests.Dequeue();
8952 }
8953 }
8954
8955 return true; // actually unreached
8779 } 8956 }
8780 8957
8781 private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) 8958 private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack)
@@ -10031,7 +10208,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10031 handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, 10208 handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID,
10032 Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), 10209 Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName),
10033 UpdateMuteListEntry.MuteData.MuteType, 10210 UpdateMuteListEntry.MuteData.MuteType,
10034 UpdateMuteListEntry.AgentData.AgentID); 10211 UpdateMuteListEntry.MuteData.MuteFlags);
10035 return true; 10212 return true;
10036 } 10213 }
10037 return false; 10214 return false;
@@ -10046,8 +10223,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10046 { 10223 {
10047 handlerRemoveMuteListEntry(this, 10224 handlerRemoveMuteListEntry(this,
10048 RemoveMuteListEntry.MuteData.MuteID, 10225 RemoveMuteListEntry.MuteData.MuteID,
10049 Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName), 10226 Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName));
10050 RemoveMuteListEntry.AgentData.AgentID);
10051 return true; 10227 return true;
10052 } 10228 }
10053 return false; 10229 return false;
@@ -10091,10 +10267,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10091 return false; 10267 return false;
10092 } 10268 }
10093 10269
10270 private bool HandleChangeInventoryItemFlags(IClientAPI client, Packet packet)
10271 {
10272 ChangeInventoryItemFlagsPacket ChangeInventoryItemFlags =
10273 (ChangeInventoryItemFlagsPacket)packet;
10274 ChangeInventoryItemFlags handlerChangeInventoryItemFlags = OnChangeInventoryItemFlags;
10275 if (handlerChangeInventoryItemFlags != null)
10276 {
10277 foreach(ChangeInventoryItemFlagsPacket.InventoryDataBlock b in ChangeInventoryItemFlags.InventoryData)
10278 handlerChangeInventoryItemFlags(this, b.ItemID, b.Flags);
10279 return true;
10280 }
10281 return false;
10282 }
10283
10094 private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) 10284 private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack)
10095 { 10285 {
10096 return true; 10286 return true;
10097 } 10287 }
10288
10289 private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack)
10290 {
10291 CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack;
10292
10293 #region Packet Session and User Check
10294 if (m_checkPackets)
10295 {
10296 if (packet.AgentData.SessionID != SessionId ||
10297 packet.AgentData.AgentID != AgentId)
10298 return true;
10299 }
10300 #endregion
10301 MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null;
10302 List<InventoryItemBase> items = new List<InventoryItemBase>();
10303 foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData)
10304 {
10305 InventoryItemBase b = new InventoryItemBase();
10306 b.ID = n.OldItemID;
10307 b.Folder = n.OldFolderID;
10308 items.Add(b);
10309 }
10310
10311 handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy;
10312 if (handlerMoveItemsAndLeaveCopy != null)
10313 {
10314 handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID);
10315 }
10316
10317 return true;
10318 }
10098 10319
10099 private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) 10320 private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack)
10100 { 10321 {
@@ -10521,6 +10742,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10521 groupProfileReply.GroupData.MaturePublish = d.MaturePublish; 10742 groupProfileReply.GroupData.MaturePublish = d.MaturePublish;
10522 groupProfileReply.GroupData.OwnerRole = d.OwnerRole; 10743 groupProfileReply.GroupData.OwnerRole = d.OwnerRole;
10523 10744
10745 Scene scene = (Scene)m_scene;
10746 if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID)))
10747 {
10748 ScenePresence p;
10749 if (scene.TryGetScenePresence(sender.AgentId, out p))
10750 {
10751 if (p.GodLevel >= 200)
10752 {
10753 groupProfileReply.GroupData.OpenEnrollment = true;
10754 groupProfileReply.GroupData.MembershipFee = 0;
10755 }
10756 }
10757 }
10758
10524 OutPacket(groupProfileReply, ThrottleOutPacketType.Task); 10759 OutPacket(groupProfileReply, ThrottleOutPacketType.Task);
10525 } 10760 }
10526 return true; 10761 return true;
@@ -11094,11 +11329,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11094 11329
11095 StartLure handlerStartLure = OnStartLure; 11330 StartLure handlerStartLure = OnStartLure;
11096 if (handlerStartLure != null) 11331 if (handlerStartLure != null)
11097 handlerStartLure(startLureRequest.Info.LureType, 11332 {
11098 Utils.BytesToString( 11333 for (int i = 0 ; i < startLureRequest.TargetData.Length ; i++)
11099 startLureRequest.Info.Message), 11334 {
11100 startLureRequest.TargetData[0].TargetID, 11335 handlerStartLure(startLureRequest.Info.LureType,
11101 this); 11336 Utils.BytesToString(
11337 startLureRequest.Info.Message),
11338 startLureRequest.TargetData[i].TargetID,
11339 this);
11340 }
11341 }
11102 return true; 11342 return true;
11103 } 11343 }
11104 private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) 11344 private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack)
@@ -11212,10 +11452,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11212 } 11452 }
11213 #endregion 11453 #endregion
11214 11454
11215 ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; 11455 ClassifiedGodDelete handlerClassifiedGodDelete = OnClassifiedGodDelete;
11216 if (handlerClassifiedGodDelete != null) 11456 if (handlerClassifiedGodDelete != null)
11217 handlerClassifiedGodDelete( 11457 handlerClassifiedGodDelete(
11218 classifiedGodDelete.Data.ClassifiedID, 11458 classifiedGodDelete.Data.ClassifiedID,
11459 classifiedGodDelete.Data.QueryID,
11219 this); 11460 this);
11220 return true; 11461 return true;
11221 } 11462 }
@@ -11518,12 +11759,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11518 /// <param name="simclient"></param> 11759 /// <param name="simclient"></param>
11519 /// <param name="packet"></param> 11760 /// <param name="packet"></param>
11520 /// <returns></returns> 11761 /// <returns></returns>
11521 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) 11762 // TODO: Convert old handler to use new method
11763 /*protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
11522 { 11764 {
11523 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; 11765 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
11524 11766
11525 if (cachedtex.AgentData.SessionID != SessionId) 11767 if (cachedtex.AgentData.SessionID != SessionId)
11526 return false; 11768 return false;
11769
11527 11770
11528 List<CachedTextureRequestArg> requestArgs = new List<CachedTextureRequestArg>(); 11771 List<CachedTextureRequestArg> requestArgs = new List<CachedTextureRequestArg>();
11529 11772
@@ -11536,23 +11779,173 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11536 requestArgs.Add(arg); 11779 requestArgs.Add(arg);
11537 } 11780 }
11538 11781
11539 try 11782 CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest;
11783 if (handlerCachedTextureRequest != null)
11540 { 11784 {
11541 CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest; 11785 handlerCachedTextureRequest(simclient,cachedtex.AgentData.SerialNum,requestArgs);
11542 if (handlerCachedTextureRequest != null) 11786 }
11787
11788 return true;
11789 }*/
11790
11791 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
11792 {
11793 //m_log.Debug("texture cached: " + packet.ToString());
11794 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
11795 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
11796
11797 if (cachedtex.AgentData.SessionID != SessionId)
11798 return false;
11799
11800
11801 // TODO: don't create new blocks if recycling an old packet
11802 cachedresp.AgentData.AgentID = AgentId;
11803 cachedresp.AgentData.SessionID = m_sessionId;
11804 cachedresp.AgentData.SerialNum = m_cachedTextureSerial;
11805 m_cachedTextureSerial++;
11806 cachedresp.WearableData =
11807 new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length];
11808
11809 //IAvatarFactoryModule fac = m_scene.RequestModuleInterface<IAvatarFactoryModule>();
11810 // var item = fac.GetBakedTextureFaces(AgentId);
11811 //WearableCacheItem[] items = fac.GetCachedItems(AgentId);
11812
11813 IAssetService cache = m_scene.AssetService;
11814 IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
11815 //bakedTextureModule = null;
11816 int maxWearablesLoop = cachedtex.WearableData.Length;
11817 if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES)
11818 maxWearablesLoop = AvatarWearable.MAX_WEARABLES;
11819
11820 if (bakedTextureModule != null && cache != null)
11821 {
11822 // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid
11823
11824 WearableCacheItem[] cacheItems = null;
11825 ScenePresence p = m_scene.GetScenePresence(AgentId);
11826 if (p.Appearance != null)
11827 if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty)
11828 {
11829 try
11830 {
11831 cacheItems = bakedTextureModule.Get(AgentId);
11832 p.Appearance.WearableCacheItems = cacheItems;
11833 p.Appearance.WearableCacheItemsDirty = false;
11834 }
11835
11836 /*
11837 * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception!
11838 *
11839 catch (System.Net.Sockets.SocketException)
11840 {
11841 cacheItems = null;
11842 }
11843 catch (WebException)
11844 {
11845 cacheItems = null;
11846 }
11847 catch (InvalidOperationException)
11848 {
11849 cacheItems = null;
11850 } */
11851 catch (Exception)
11852 {
11853 cacheItems = null;
11854 }
11855
11856 }
11857 else if (p.Appearance.WearableCacheItems != null)
11858 {
11859 cacheItems = p.Appearance.WearableCacheItems;
11860 }
11861
11862 if (cache != null && cacheItems != null)
11543 { 11863 {
11544 handlerCachedTextureRequest(simclient,cachedtex.AgentData.SerialNum,requestArgs); 11864 foreach (WearableCacheItem item in cacheItems)
11865 {
11866
11867 if (cache.GetCached(item.TextureID.ToString()) == null)
11868 {
11869 item.TextureAsset.Temporary = true;
11870 cache.Store(item.TextureAsset);
11871 }
11872
11873
11874 }
11875 }
11876
11877 if (cacheItems != null)
11878 {
11879
11880 for (int i = 0; i < maxWearablesLoop; i++)
11881 {
11882 WearableCacheItem item =
11883 WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems);
11884
11885 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11886 cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex;
11887 cachedresp.WearableData[i].HostName = new byte[0];
11888 if (item != null && cachedtex.WearableData[i].ID == item.CacheId)
11889 {
11890
11891 cachedresp.WearableData[i].TextureID = item.TextureID;
11892 }
11893 else
11894 {
11895 cachedresp.WearableData[i].TextureID = UUID.Zero;
11896 }
11897 }
11898 }
11899 else
11900 {
11901 for (int i = 0; i < maxWearablesLoop; i++)
11902 {
11903 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11904 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11905 cachedresp.WearableData[i].TextureID = UUID.Zero;
11906 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
11907 cachedresp.WearableData[i].HostName = new byte[0];
11908 }
11545 } 11909 }
11546 } 11910 }
11547 catch (Exception e) 11911 else
11548 { 11912 {
11549 m_log.ErrorFormat("[CLIENT VIEW]: AgentTextureCached packet handler threw an exception, {0}", e); 11913 if (cache == null)
11550 return false; 11914 {
11915 for (int i = 0; i < maxWearablesLoop; i++)
11916 {
11917 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11918 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11919 cachedresp.WearableData[i].TextureID = UUID.Zero;
11920 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
11921 cachedresp.WearableData[i].HostName = new byte[0];
11922 }
11923 }
11924 else
11925 {
11926 for (int i = 0; i < maxWearablesLoop; i++)
11927 {
11928 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11929 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11930
11931
11932
11933 if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null)
11934 cachedresp.WearableData[i].TextureID = UUID.Zero;
11935 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
11936 else
11937 cachedresp.WearableData[i].TextureID = UUID.Zero;
11938 // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
11939 cachedresp.WearableData[i].HostName = new byte[0];
11940 }
11941 }
11551 } 11942 }
11552 11943 cachedresp.Header.Zerocoded = true;
11944 OutPacket(cachedresp, ThrottleOutPacketType.Task);
11945
11553 return true; 11946 return true;
11554 } 11947 }
11555 11948
11556 /// <summary> 11949 /// <summary>
11557 /// Send a response back to a client when it asks the asset server (via the region server) if it has 11950 /// Send a response back to a client when it asks the asset server (via the region server) if it has
11558 /// its appearance texture cached. 11951 /// its appearance texture cached.
@@ -11616,209 +12009,147 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11616 } 12009 }
11617 else 12010 else
11618 { 12011 {
11619// m_log.DebugFormat( 12012 ClientChangeObject updatehandler = onClientChangeObject;
11620// "[CLIENT]: Processing block {0} type {1} for {2} {3}",
11621// i, block.Type, part.Name, part.LocalId);
11622 12013
11623// // Do this once since fetch parts creates a new array. 12014 if (updatehandler != null)
11624// SceneObjectPart[] parts = part.ParentGroup.Parts; 12015 {
11625// for (int j = 0; j < parts.Length; j++) 12016 ObjectChangeData udata = new ObjectChangeData();
11626// {
11627// part.StoreUndoState();
11628// parts[j].IgnoreUndoUpdate = true;
11629// }
11630 12017
11631 UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; 12018 /*ubit from ll JIRA:
12019 * 0x01 position
12020 * 0x02 rotation
12021 * 0x04 scale
12022
12023 * 0x08 LINK_SET
12024 * 0x10 UNIFORM for scale
12025 */
11632 12026
11633 switch (block.Type) 12027 // translate to internal changes
11634 { 12028 // not all cases .. just the ones older code did
11635 case 1:
11636 Vector3 pos1 = new Vector3(block.Data, 0);
11637 12029
11638 UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 12030 switch (block.Type)
11639 if (handlerUpdatePrimSinglePosition != null) 12031 {
11640 { 12032 case 1: //change position sp
11641 // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 12033 udata.position = new Vector3(block.Data, 0);
11642 handlerUpdatePrimSinglePosition(localId, pos1, this);
11643 }
11644 break;
11645 12034
11646 case 2: 12035 udata.change = ObjectChangeType.primP;
11647 Quaternion rot1 = new Quaternion(block.Data, 0, true); 12036 updatehandler(localId, udata, this);
12037 break;
11648 12038
11649 UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; 12039 case 2: // rotation sp
11650 if (handlerUpdatePrimSingleRotation != null) 12040 udata.rotation = new Quaternion(block.Data, 0, true);
11651 {
11652 // m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W);
11653 handlerUpdatePrimSingleRotation(localId, rot1, this);
11654 }
11655 break;
11656 12041
11657 case 3: 12042 udata.change = ObjectChangeType.primR;
11658 Vector3 rotPos = new Vector3(block.Data, 0); 12043 updatehandler(localId, udata, this);
11659 Quaternion rot2 = new Quaternion(block.Data, 12, true); 12044 break;
11660 12045
11661 UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition; 12046 case 3: // position plus rotation
11662 if (handlerUpdatePrimSingleRotationPosition != null) 12047 udata.position = new Vector3(block.Data, 0);
11663 { 12048 udata.rotation = new Quaternion(block.Data, 12, true);
11664 // m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z);
11665 // m_log.Info("new mouse rotation is " + rot2.X + " , " + rot2.Y + " , " + rot2.Z + " , " + rot2.W);
11666 handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this);
11667 }
11668 break;
11669 12049
11670 case 4: 12050 udata.change = ObjectChangeType.primPR;
11671 case 20: 12051 updatehandler(localId, udata, this);
11672 Vector3 scale4 = new Vector3(block.Data, 0); 12052 break;
11673 12053
11674 UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale; 12054 case 4: // scale sp
11675 if (handlerUpdatePrimScale != null) 12055 udata.scale = new Vector3(block.Data, 0);
11676 { 12056 udata.change = ObjectChangeType.primS;
11677 // m_log.Debug("new scale is " + scale4.X + " , " + scale4.Y + " , " + scale4.Z);
11678 handlerUpdatePrimScale(localId, scale4, this);
11679 }
11680 break;
11681 12057
11682 case 5: 12058 updatehandler(localId, udata, this);
11683 Vector3 scale1 = new Vector3(block.Data, 12); 12059 break;
11684 Vector3 pos11 = new Vector3(block.Data, 0);
11685 12060
11686 handlerUpdatePrimScale = OnUpdatePrimScale; 12061 case 0x14: // uniform scale sp
11687 if (handlerUpdatePrimScale != null) 12062 udata.scale = new Vector3(block.Data, 0);
11688 {
11689 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
11690 handlerUpdatePrimScale(localId, scale1, this);
11691 12063
11692 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 12064 udata.change = ObjectChangeType.primUS;
11693 if (handlerUpdatePrimSinglePosition != null) 12065 updatehandler(localId, udata, this);
11694 { 12066 break;
11695 handlerUpdatePrimSinglePosition(localId, pos11, this);
11696 }
11697 }
11698 break;
11699 12067
11700 case 9: 12068 case 5: // scale and position sp
11701 Vector3 pos2 = new Vector3(block.Data, 0); 12069 udata.position = new Vector3(block.Data, 0);
12070 udata.scale = new Vector3(block.Data, 12);
11702 12071
11703 UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; 12072 udata.change = ObjectChangeType.primPS;
12073 updatehandler(localId, udata, this);
12074 break;
11704 12075
11705 if (handlerUpdateVector != null) 12076 case 0x15: //uniform scale and position
11706 { 12077 udata.position = new Vector3(block.Data, 0);
11707 handlerUpdateVector(localId, pos2, this); 12078 udata.scale = new Vector3(block.Data, 12);
11708 }
11709 break;
11710 12079
11711 case 10: 12080 udata.change = ObjectChangeType.primPUS;
11712 Quaternion rot3 = new Quaternion(block.Data, 0, true); 12081 updatehandler(localId, udata, this);
12082 break;
11713 12083
11714 UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; 12084 // now group related (bit 4)
11715 if (handlerUpdatePrimRotation != null) 12085 case 9: //( 8 + 1 )group position
11716 { 12086 udata.position = new Vector3(block.Data, 0);
11717 // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W);
11718 handlerUpdatePrimRotation(localId, rot3, this);
11719 }
11720 break;
11721 12087
11722 case 11: 12088 udata.change = ObjectChangeType.groupP;
11723 Vector3 pos3 = new Vector3(block.Data, 0); 12089 updatehandler(localId, udata, this);
11724 Quaternion rot4 = new Quaternion(block.Data, 12, true); 12090 break;
11725 12091
11726 handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; 12092 case 0x0A: // (8 + 2) group rotation
11727 if (handlerUpdatePrimGroupRotation != null) 12093 udata.rotation = new Quaternion(block.Data, 0, true);
11728 {
11729 // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
11730 // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W);
11731 handlerUpdatePrimGroupRotation(localId, pos3, rot4, this);
11732 }
11733 break;
11734 case 12:
11735 case 28:
11736 Vector3 scale7 = new Vector3(block.Data, 0);
11737 12094
11738 UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; 12095 udata.change = ObjectChangeType.groupR;
11739 if (handlerUpdatePrimGroupScale != null) 12096 updatehandler(localId, udata, this);
11740 { 12097 break;
11741 // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z);
11742 handlerUpdatePrimGroupScale(localId, scale7, this);
11743 }
11744 break;
11745 12098
11746 case 13: 12099 case 0x0B: //( 8 + 2 + 1) group rotation and position
11747 Vector3 scale2 = new Vector3(block.Data, 12); 12100 udata.position = new Vector3(block.Data, 0);
11748 Vector3 pos4 = new Vector3(block.Data, 0); 12101 udata.rotation = new Quaternion(block.Data, 12, true);
11749 12102
11750 handlerUpdatePrimScale = OnUpdatePrimScale; 12103 udata.change = ObjectChangeType.groupPR;
11751 if (handlerUpdatePrimScale != null) 12104 updatehandler(localId, udata, this);
11752 { 12105 break;
11753 //m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
11754 handlerUpdatePrimScale(localId, scale2, this);
11755 12106
11756 // Change the position based on scale (for bug number 246) 12107 case 0x0C: // (8 + 4) group scale
11757 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 12108 // only afects root prim and only sent by viewer editor object tab scaling
11758 // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 12109 // mouse edition only allows uniform scaling
11759 if (handlerUpdatePrimSinglePosition != null) 12110 // SL MAY CHANGE THIS in viewers
11760 {
11761 handlerUpdatePrimSinglePosition(localId, pos4, this);
11762 }
11763 }
11764 break;
11765 12111
11766 case 29: 12112 udata.scale = new Vector3(block.Data, 0);
11767 Vector3 scale5 = new Vector3(block.Data, 12);
11768 Vector3 pos5 = new Vector3(block.Data, 0);
11769 12113
11770 handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; 12114 udata.change = ObjectChangeType.groupS;
11771 if (handlerUpdatePrimGroupScale != null) 12115 updatehandler(localId, udata, this);
11772 {
11773 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
11774 part.StoreUndoState(true);
11775 part.IgnoreUndoUpdate = true;
11776 handlerUpdatePrimGroupScale(localId, scale5, this);
11777 handlerUpdateVector = OnUpdatePrimGroupPosition;
11778 12116
11779 if (handlerUpdateVector != null) 12117 break;
11780 {
11781 handlerUpdateVector(localId, pos5, this);
11782 }
11783 12118
11784 part.IgnoreUndoUpdate = false; 12119 case 0x0D: //(8 + 4 + 1) group scale and position
11785 } 12120 // exception as above
11786 12121
11787 break; 12122 udata.position = new Vector3(block.Data, 0);
12123 udata.scale = new Vector3(block.Data, 12);
11788 12124
11789 case 21: 12125 udata.change = ObjectChangeType.groupPS;
11790 Vector3 scale6 = new Vector3(block.Data, 12); 12126 updatehandler(localId, udata, this);
11791 Vector3 pos6 = new Vector3(block.Data, 0); 12127 break;
11792 12128
11793 handlerUpdatePrimScale = OnUpdatePrimScale; 12129 case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM
11794 if (handlerUpdatePrimScale != null) 12130 udata.scale = new Vector3(block.Data, 0);
11795 {
11796 part.StoreUndoState(false);
11797 part.IgnoreUndoUpdate = true;
11798 12131
11799 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); 12132 udata.change = ObjectChangeType.groupUS;
11800 handlerUpdatePrimScale(localId, scale6, this); 12133 updatehandler(localId, udata, this);
11801 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 12134 break;
11802 if (handlerUpdatePrimSinglePosition != null)
11803 {
11804 handlerUpdatePrimSinglePosition(localId, pos6, this);
11805 }
11806 12135
11807 part.IgnoreUndoUpdate = false; 12136 case 0x1D: // (UNIFORM + GROUP + SCALE + POS)
11808 } 12137 udata.position = new Vector3(block.Data, 0);
11809 break; 12138 udata.scale = new Vector3(block.Data, 12);
11810 12139
11811 default: 12140 udata.change = ObjectChangeType.groupPUS;
11812 m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); 12141 updatehandler(localId, udata, this);
11813 break; 12142 break;
12143
12144 default:
12145 m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type));
12146 break;
12147 }
11814 } 12148 }
11815 12149
11816// for (int j = 0; j < parts.Length; j++)
11817// parts[j].IgnoreUndoUpdate = false;
11818 } 12150 }
11819 } 12151 }
11820 } 12152 }
11821
11822 return true; 12153 return true;
11823 } 12154 }
11824 12155
@@ -11879,9 +12210,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11879 public void SetChildAgentThrottle(byte[] throttles) 12210 public void SetChildAgentThrottle(byte[] throttles)
11880 { 12211 {
11881 m_udpClient.SetThrottles(throttles); 12212 m_udpClient.SetThrottles(throttles);
12213 GenericCall2 handler = OnUpdateThrottles;
12214 if (handler != null)
12215 {
12216 handler();
12217 }
11882 } 12218 }
11883 12219
11884 /// <summary> 12220 /// <summary>
12221 /// Sets the throttles from values supplied by the client
12222 /// </summary>
12223 /// <param name="throttles"></param>
12224 public void SetAgentThrottleSilent(int throttle, int setting)
12225 {
12226 m_udpClient.ForceThrottleSetting(throttle,setting);
12227 //m_udpClient.SetThrottles(throttles);
12228
12229 }
12230
12231
12232 /// <summary>
11885 /// Get the current throttles for this client as a packed byte array 12233 /// Get the current throttles for this client as a packed byte array
11886 /// </summary> 12234 /// </summary>
11887 /// <param name="multiplier">Unused</param> 12235 /// <param name="multiplier">Unused</param>
@@ -12263,7 +12611,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12263// "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", 12611// "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}",
12264// requestID, taskID, (SourceType)sourceType, Name); 12612// requestID, taskID, (SourceType)sourceType, Name);
12265 12613
12614
12615 //Note, the bool returned from the below function is useless since it is always false.
12266 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); 12616 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
12617
12267 } 12618 }
12268 12619
12269 /// <summary> 12620 /// <summary>
@@ -12329,7 +12680,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12329 /// <returns></returns> 12680 /// <returns></returns>
12330 private static int CalculateNumPackets(byte[] data) 12681 private static int CalculateNumPackets(byte[] data)
12331 { 12682 {
12332 const uint m_maxPacketSize = 600; 12683// const uint m_maxPacketSize = 600;
12684 uint m_maxPacketSize = MaxTransferBytesPerPacket;
12333 int numPackets = 1; 12685 int numPackets = 1;
12334 12686
12335 if (data == null) 12687 if (data == null)