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 f0d8181..8cbbfd9 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -102,6 +102,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
102 public event AvatarPickerRequest OnAvatarPickerRequest; 102 public event AvatarPickerRequest OnAvatarPickerRequest;
103 public event StartAnim OnStartAnim; 103 public event StartAnim OnStartAnim;
104 public event StopAnim OnStopAnim; 104 public event StopAnim OnStopAnim;
105 public event ChangeAnim OnChangeAnim;
105 public event Action<IClientAPI> OnRequestAvatarsData; 106 public event Action<IClientAPI> OnRequestAvatarsData;
106 public event LinkObjects OnLinkObjects; 107 public event LinkObjects OnLinkObjects;
107 public event DelinkObjects OnDelinkObjects; 108 public event DelinkObjects OnDelinkObjects;
@@ -129,6 +130,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
129 public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; 130 public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
130 public event UpdatePrimFlags OnUpdatePrimFlags; 131 public event UpdatePrimFlags OnUpdatePrimFlags;
131 public event UpdatePrimTexture OnUpdatePrimTexture; 132 public event UpdatePrimTexture OnUpdatePrimTexture;
133 public event ClientChangeObject onClientChangeObject;
132 public event UpdateVector OnUpdatePrimGroupPosition; 134 public event UpdateVector OnUpdatePrimGroupPosition;
133 public event UpdateVector OnUpdatePrimSinglePosition; 135 public event UpdateVector OnUpdatePrimSinglePosition;
134 public event UpdatePrimRotation OnUpdatePrimGroupRotation; 136 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
@@ -162,6 +164,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
162 public event RequestTaskInventory OnRequestTaskInventory; 164 public event RequestTaskInventory OnRequestTaskInventory;
163 public event UpdateInventoryItem OnUpdateInventoryItem; 165 public event UpdateInventoryItem OnUpdateInventoryItem;
164 public event CopyInventoryItem OnCopyInventoryItem; 166 public event CopyInventoryItem OnCopyInventoryItem;
167 public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy;
165 public event MoveInventoryItem OnMoveInventoryItem; 168 public event MoveInventoryItem OnMoveInventoryItem;
166 public event RemoveInventoryItem OnRemoveInventoryItem; 169 public event RemoveInventoryItem OnRemoveInventoryItem;
167 public event RemoveInventoryFolder OnRemoveInventoryFolder; 170 public event RemoveInventoryFolder OnRemoveInventoryFolder;
@@ -260,7 +263,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
260 public event ClassifiedInfoRequest OnClassifiedInfoRequest; 263 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
261 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; 264 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
262 public event ClassifiedDelete OnClassifiedDelete; 265 public event ClassifiedDelete OnClassifiedDelete;
263 public event ClassifiedDelete OnClassifiedGodDelete; 266 public event ClassifiedGodDelete OnClassifiedGodDelete;
264 public event EventNotificationAddRequest OnEventNotificationAddRequest; 267 public event EventNotificationAddRequest OnEventNotificationAddRequest;
265 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; 268 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
266 public event EventGodDelete OnEventGodDelete; 269 public event EventGodDelete OnEventGodDelete;
@@ -291,10 +294,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
291 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 294 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
292 public event SimWideDeletesDelegate OnSimWideDeletes; 295 public event SimWideDeletesDelegate OnSimWideDeletes;
293 public event SendPostcard OnSendPostcard; 296 public event SendPostcard OnSendPostcard;
297 public event ChangeInventoryItemFlags OnChangeInventoryItemFlags;
294 public event MuteListEntryUpdate OnUpdateMuteListEntry; 298 public event MuteListEntryUpdate OnUpdateMuteListEntry;
295 public event MuteListEntryRemove OnRemoveMuteListEntry; 299 public event MuteListEntryRemove OnRemoveMuteListEntry;
296 public event GodlikeMessage onGodlikeMessage; 300 public event GodlikeMessage onGodlikeMessage;
297 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; 301 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
302 public event GenericCall2 OnUpdateThrottles;
298 303
299 #endregion Events 304 #endregion Events
300 305
@@ -323,11 +328,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
323 private readonly byte[] m_channelVersion = Utils.EmptyBytes; 328 private readonly byte[] m_channelVersion = Utils.EmptyBytes;
324 private readonly IGroupsModule m_GroupsModule; 329 private readonly IGroupsModule m_GroupsModule;
325 330
331 private int m_cachedTextureSerial;
326 private PriorityQueue m_entityUpdates; 332 private PriorityQueue m_entityUpdates;
327 private PriorityQueue m_entityProps; 333 private PriorityQueue m_entityProps;
328 private Prioritizer m_prioritizer; 334 private Prioritizer m_prioritizer;
329 private bool m_disableFacelights = false; 335 private bool m_disableFacelights = false;
336
337 private bool m_VelocityInterpolate = false;
338 private const uint MaxTransferBytesPerPacket = 600;
339
330 private volatile bool m_justEditedTerrain = false; 340 private volatile bool m_justEditedTerrain = false;
341
331 /// <value> 342 /// <value>
332 /// List used in construction of data blocks for an object update packet. This is to stop us having to 343 /// List used in construction of data blocks for an object update packet. This is to stop us having to
333 /// continually recreate it. 344 /// continually recreate it.
@@ -339,13 +350,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
339 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an 350 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an
340 /// ownerless phantom. 351 /// ownerless phantom.
341 /// 352 ///
342 /// All manipulation of this set has to occur under a lock 353 /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
343 /// 354 ///
344 /// </value> 355 /// </value>
345 protected HashSet<uint> m_killRecord; 356// protected HashSet<uint> m_killRecord;
346 357
347// protected HashSet<uint> m_attachmentsSent; 358// protected HashSet<uint> m_attachmentsSent;
348 359
360 private bool m_deliverPackets = true;
349 private int m_animationSequenceNumber = 1; 361 private int m_animationSequenceNumber = 1;
350 private bool m_SendLogoutPacketWhenClosing = true; 362 private bool m_SendLogoutPacketWhenClosing = true;
351 363
@@ -392,6 +404,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
392 get { return m_startpos; } 404 get { return m_startpos; }
393 set { m_startpos = value; } 405 set { m_startpos = value; }
394 } 406 }
407 public bool DeliverPackets
408 {
409 get { return m_deliverPackets; }
410 set {
411 m_deliverPackets = value;
412 m_udpClient.m_deliverPackets = value;
413 }
414 }
395 public UUID AgentId { get { return m_agentId; } } 415 public UUID AgentId { get { return m_agentId; } }
396 public ISceneAgent SceneAgent { get; set; } 416 public ISceneAgent SceneAgent { get; set; }
397 public UUID ActiveGroupId { get { return m_activeGroupID; } } 417 public UUID ActiveGroupId { get { return m_activeGroupID; } }
@@ -442,6 +462,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
442 } 462 }
443 463
444 public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } 464 public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } }
465
445 466
446 #endregion Properties 467 #endregion Properties
447 468
@@ -468,7 +489,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
468 m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); 489 m_entityUpdates = new PriorityQueue(m_scene.Entities.Count);
469 m_entityProps = new PriorityQueue(m_scene.Entities.Count); 490 m_entityProps = new PriorityQueue(m_scene.Entities.Count);
470 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); 491 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
471 m_killRecord = new HashSet<uint>(); 492// m_killRecord = new HashSet<uint>();
472// m_attachmentsSent = new HashSet<uint>(); 493// m_attachmentsSent = new HashSet<uint>();
473 494
474 m_assetService = m_scene.RequestModuleInterface<IAssetService>(); 495 m_assetService = m_scene.RequestModuleInterface<IAssetService>();
@@ -498,12 +519,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
498 519
499 #region Client Methods 520 #region Client Methods
500 521
522
523 /// <summary>
524 /// Close down the client view
525 /// </summary>
501 public void Close() 526 public void Close()
502 { 527 {
503 Close(false); 528 Close(true, false);
504 } 529 }
505 530
506 public void Close(bool force) 531 public void Close(bool sendStop, bool force)
507 { 532 {
508 // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. 533 // We lock here to prevent race conditions between two threads calling close simultaneously (e.g.
509 // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. 534 // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection.
@@ -521,7 +546,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
521 } 546 }
522 547
523 IsActive = false; 548 IsActive = false;
524 CloseWithoutChecks(); 549 CloseWithoutChecks(sendStop);
525 } 550 }
526 } 551 }
527 552
@@ -534,12 +559,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
534 /// 559 ///
535 /// Callers must lock ClosingSyncLock before calling. 560 /// Callers must lock ClosingSyncLock before calling.
536 /// </remarks> 561 /// </remarks>
537 public void CloseWithoutChecks() 562 public void CloseWithoutChecks(bool sendStop)
538 { 563 {
539 m_log.DebugFormat( 564 m_log.DebugFormat(
540 "[CLIENT]: Close has been called for {0} attached to scene {1}", 565 "[CLIENT]: Close has been called for {0} attached to scene {1}",
541 Name, m_scene.RegionInfo.RegionName); 566 Name, m_scene.RegionInfo.RegionName);
542 567
568 if (sendStop)
569 {
570 // Send the STOP packet
571 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
572 OutPacket(disable, ThrottleOutPacketType.Unknown);
573 }
574
543 // Shutdown the image manager 575 // Shutdown the image manager
544 ImageManager.Close(); 576 ImageManager.Close();
545 577
@@ -562,6 +594,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
562 // Disable UDP handling for this client 594 // Disable UDP handling for this client
563 m_udpClient.Shutdown(); 595 m_udpClient.Shutdown();
564 596
597
565 //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); 598 //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false));
566 //GC.Collect(); 599 //GC.Collect();
567 //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); 600 //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true));
@@ -858,7 +891,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
858 reply.ChatData.OwnerID = ownerID; 891 reply.ChatData.OwnerID = ownerID;
859 reply.ChatData.SourceID = fromAgentID; 892 reply.ChatData.SourceID = fromAgentID;
860 893
861 OutPacket(reply, ThrottleOutPacketType.Task); 894 OutPacket(reply, ThrottleOutPacketType.Unknown);
862 } 895 }
863 896
864 /// <summary> 897 /// <summary>
@@ -891,32 +924,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
891 msg.MessageBlock.Message = Util.StringToBytes1024(im.message); 924 msg.MessageBlock.Message = Util.StringToBytes1024(im.message);
892 msg.MessageBlock.BinaryBucket = im.binaryBucket; 925 msg.MessageBlock.BinaryBucket = im.binaryBucket;
893 926
894 if (im.message.StartsWith("[grouptest]")) 927 OutPacket(msg, ThrottleOutPacketType.Task);
895 { // this block is test code for implementing group IM - delete when group IM is finished
896 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
897 if (eq != null)
898 {
899 im.dialog = 17;
900
901 //eq.ChatterboxInvitation(
902 // new UUID("00000000-68f9-1111-024e-222222111123"),
903 // "OpenSimulator Testing", im.fromAgentID, im.message, im.toAgentID, im.fromAgentName, im.dialog, 0,
904 // false, 0, new Vector3(), 1, im.imSessionID, im.fromGroup, im.binaryBucket);
905
906 eq.ChatterboxInvitation(
907 new UUID("00000000-68f9-1111-024e-222222111123"),
908 "OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0,
909 false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Util.StringToBytes256("OpenSimulator Testing"));
910
911 eq.ChatterBoxSessionAgentListUpdates(
912 new UUID("00000000-68f9-1111-024e-222222111123"),
913 new UUID(im.fromAgentID), new UUID(im.toAgentID), false, false, false);
914 }
915
916 Console.WriteLine("SendInstantMessage: " + msg);
917 }
918 else
919 OutPacket(msg, ThrottleOutPacketType.Task);
920 } 928 }
921 } 929 }
922 930
@@ -1154,6 +1162,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1154 public virtual void SendLayerData(float[] map) 1162 public virtual void SendLayerData(float[] map)
1155 { 1163 {
1156 Util.FireAndForget(DoSendLayerData, map); 1164 Util.FireAndForget(DoSendLayerData, map);
1165
1166 // Send it sync, and async. It's not that much data
1167 // and it improves user experience just so much!
1168 DoSendLayerData(map);
1157 } 1169 }
1158 1170
1159 /// <summary> 1171 /// <summary>
@@ -1166,16 +1178,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1166 1178
1167 try 1179 try
1168 { 1180 {
1169 //for (int y = 0; y < 16; y++) 1181 for (int y = 0; y < 16; y++)
1170 //{ 1182 {
1171 // for (int x = 0; x < 16; x++) 1183 for (int x = 0; x < 16; x+=4)
1172 // { 1184 {
1173 // SendLayerData(x, y, map); 1185 SendLayerPacket(x, y, map);
1174 // } 1186 }
1175 //} 1187 }
1176
1177 // Send LayerData in a spiral pattern. Fun!
1178 SendLayerTopRight(map, 0, 0, 15, 15);
1179 } 1188 }
1180 catch (Exception e) 1189 catch (Exception e)
1181 { 1190 {
@@ -1183,51 +1192,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1183 } 1192 }
1184 } 1193 }
1185 1194
1186 private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2)
1187 {
1188 // Row
1189 for (int i = x1; i <= x2; i++)
1190 SendLayerData(i, y1, map);
1191
1192 // Column
1193 for (int j = y1 + 1; j <= y2; j++)
1194 SendLayerData(x2, j, map);
1195
1196 if (x2 - x1 > 0)
1197 SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
1198 }
1199
1200 void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2)
1201 {
1202 // Row in reverse
1203 for (int i = x2; i >= x1; i--)
1204 SendLayerData(i, y2, map);
1205
1206 // Column in reverse
1207 for (int j = y2 - 1; j >= y1; j--)
1208 SendLayerData(x1, j, map);
1209
1210 if (x2 - x1 > 0)
1211 SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
1212 }
1213
1214 /// <summary> 1195 /// <summary>
1215 /// Sends a set of four patches (x, x+1, ..., x+3) to the client 1196 /// Sends a set of four patches (x, x+1, ..., x+3) to the client
1216 /// </summary> 1197 /// </summary>
1217 /// <param name="map">heightmap</param> 1198 /// <param name="map">heightmap</param>
1218 /// <param name="px">X coordinate for patches 0..12</param> 1199 /// <param name="px">X coordinate for patches 0..12</param>
1219 /// <param name="py">Y coordinate for patches 0..15</param> 1200 /// <param name="py">Y coordinate for patches 0..15</param>
1220 // private void SendLayerPacket(float[] map, int y, int x) 1201 private void SendLayerPacket(int x, int y, float[] map)
1221 // { 1202 {
1222 // int[] patches = new int[4]; 1203 int[] patches = new int[4];
1223 // patches[0] = x + 0 + y * 16; 1204 patches[0] = x + 0 + y * 16;
1224 // patches[1] = x + 1 + y * 16; 1205 patches[1] = x + 1 + y * 16;
1225 // patches[2] = x + 2 + y * 16; 1206 patches[2] = x + 2 + y * 16;
1226 // patches[3] = x + 3 + y * 16; 1207 patches[3] = x + 3 + y * 16;
1227 1208
1228 // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); 1209 float[] heightmap = (map.Length == 65536) ?
1229 // OutPacket(layerpack, ThrottleOutPacketType.Land); 1210 map :
1230 // } 1211 LLHeightFieldMoronize(map);
1212
1213 try
1214 {
1215 Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
1216 OutPacket(layerpack, ThrottleOutPacketType.Land);
1217 }
1218 catch
1219 {
1220 for (int px = x ; px < x + 4 ; px++)
1221 SendLayerData(px, y, map);
1222 }
1223 }
1231 1224
1232 /// <summary> 1225 /// <summary>
1233 /// Sends a specified patch to a client 1226 /// Sends a specified patch to a client
@@ -1269,7 +1262,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1269 { 1262 {
1270 layerpack.Header.Reliable = true; 1263 layerpack.Header.Reliable = true;
1271 OutPacket(layerpack, 1264 OutPacket(layerpack,
1272 ThrottleOutPacketType.Land); 1265 ThrottleOutPacketType.Task);
1273 } 1266 }
1274 } 1267 }
1275 catch (Exception e) 1268 catch (Exception e)
@@ -1640,7 +1633,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1640 1633
1641 public void SendKillObject(List<uint> localIDs) 1634 public void SendKillObject(List<uint> localIDs)
1642 { 1635 {
1643// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); 1636// foreach (uint id in localIDs)
1637// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle);
1644 1638
1645 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); 1639 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject);
1646 // TODO: don't create new blocks if recycling an old packet 1640 // TODO: don't create new blocks if recycling an old packet
@@ -1662,17 +1656,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1662 // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race 1656 // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race
1663 // condition where a kill can be processed before an out-of-date update for the same object. 1657 // condition where a kill can be processed before an out-of-date update for the same object.
1664 // ProcessEntityUpdates() also takes the m_killRecord lock. 1658 // ProcessEntityUpdates() also takes the m_killRecord lock.
1665 lock (m_killRecord) 1659// lock (m_killRecord)
1666 { 1660// {
1667 foreach (uint localID in localIDs) 1661// foreach (uint localID in localIDs)
1668 m_killRecord.Add(localID); 1662// m_killRecord.Add(localID);
1669 1663
1670 // The throttle queue used here must match that being used for updates. Otherwise, there is a 1664 // The throttle queue used here must match that being used for updates. Otherwise, there is a
1671 // chance that a kill packet put on a separate queue will be sent to the client before an existing 1665 // chance that a kill packet put on a separate queue will be sent to the client before an existing
1672 // update packet on another queue. Receiving updates after kills results in unowned and undeletable 1666 // update packet on another queue. Receiving updates after kills results in unowned and undeletable
1673 // scene objects in a viewer until that viewer is relogged in. 1667 // scene objects in a viewer until that viewer is relogged in.
1674 OutPacket(kill, ThrottleOutPacketType.Task); 1668 OutPacket(kill, ThrottleOutPacketType.Task);
1675 } 1669// }
1676 } 1670 }
1677 } 1671 }
1678 1672
@@ -1794,7 +1788,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1794 newBlock.CreationDate = item.CreationDate; 1788 newBlock.CreationDate = item.CreationDate;
1795 newBlock.SalePrice = item.SalePrice; 1789 newBlock.SalePrice = item.SalePrice;
1796 newBlock.SaleType = item.SaleType; 1790 newBlock.SaleType = item.SaleType;
1797 newBlock.Flags = item.Flags; 1791 newBlock.Flags = item.Flags & 0xff;
1798 1792
1799 newBlock.CRC = 1793 newBlock.CRC =
1800 Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType, 1794 Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType,
@@ -2048,7 +2042,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2048 itemBlock.GroupID = item.GroupID; 2042 itemBlock.GroupID = item.GroupID;
2049 itemBlock.GroupOwned = item.GroupOwned; 2043 itemBlock.GroupOwned = item.GroupOwned;
2050 itemBlock.GroupMask = item.GroupPermissions; 2044 itemBlock.GroupMask = item.GroupPermissions;
2051 itemBlock.Flags = item.Flags; 2045 itemBlock.Flags = item.Flags & 0xff;
2052 itemBlock.SalePrice = item.SalePrice; 2046 itemBlock.SalePrice = item.SalePrice;
2053 itemBlock.SaleType = item.SaleType; 2047 itemBlock.SaleType = item.SaleType;
2054 itemBlock.CreationDate = item.CreationDate; 2048 itemBlock.CreationDate = item.CreationDate;
@@ -2115,7 +2109,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2115 bulkUpdate.ItemData[0].GroupID = item.GroupID; 2109 bulkUpdate.ItemData[0].GroupID = item.GroupID;
2116 bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned; 2110 bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned;
2117 bulkUpdate.ItemData[0].GroupMask = item.GroupPermissions; 2111 bulkUpdate.ItemData[0].GroupMask = item.GroupPermissions;
2118 bulkUpdate.ItemData[0].Flags = item.Flags; 2112 bulkUpdate.ItemData[0].Flags = item.Flags & 0xff;
2119 bulkUpdate.ItemData[0].SalePrice = item.SalePrice; 2113 bulkUpdate.ItemData[0].SalePrice = item.SalePrice;
2120 bulkUpdate.ItemData[0].SaleType = item.SaleType; 2114 bulkUpdate.ItemData[0].SaleType = item.SaleType;
2121 2115
@@ -2131,9 +2125,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2131 OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); 2125 OutPacket(bulkUpdate, ThrottleOutPacketType.Asset);
2132 } 2126 }
2133 2127
2134 /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see>
2135 public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) 2128 public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId)
2136 { 2129 {
2130 SendInventoryItemCreateUpdate(Item, UUID.Zero, callbackId);
2131 }
2132
2133 /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see>
2134 public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId)
2135 {
2137 const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff; 2136 const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff;
2138 2137
2139 UpdateCreateInventoryItemPacket InventoryReply 2138 UpdateCreateInventoryItemPacket InventoryReply
@@ -2143,6 +2142,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2143 // TODO: don't create new blocks if recycling an old packet 2142 // TODO: don't create new blocks if recycling an old packet
2144 InventoryReply.AgentData.AgentID = AgentId; 2143 InventoryReply.AgentData.AgentID = AgentId;
2145 InventoryReply.AgentData.SimApproved = true; 2144 InventoryReply.AgentData.SimApproved = true;
2145 InventoryReply.AgentData.TransactionID = transactionID;
2146 InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; 2146 InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1];
2147 InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); 2147 InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock();
2148 InventoryReply.InventoryData[0].ItemID = Item.ID; 2148 InventoryReply.InventoryData[0].ItemID = Item.ID;
@@ -2163,7 +2163,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2163 InventoryReply.InventoryData[0].GroupID = Item.GroupID; 2163 InventoryReply.InventoryData[0].GroupID = Item.GroupID;
2164 InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned; 2164 InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned;
2165 InventoryReply.InventoryData[0].GroupMask = Item.GroupPermissions; 2165 InventoryReply.InventoryData[0].GroupMask = Item.GroupPermissions;
2166 InventoryReply.InventoryData[0].Flags = Item.Flags; 2166 InventoryReply.InventoryData[0].Flags = Item.Flags & 0xff;
2167 InventoryReply.InventoryData[0].SalePrice = Item.SalePrice; 2167 InventoryReply.InventoryData[0].SalePrice = Item.SalePrice;
2168 InventoryReply.InventoryData[0].SaleType = Item.SaleType; 2168 InventoryReply.InventoryData[0].SaleType = Item.SaleType;
2169 InventoryReply.InventoryData[0].CreationDate = Item.CreationDate; 2169 InventoryReply.InventoryData[0].CreationDate = Item.CreationDate;
@@ -2212,16 +2212,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2212 replytask.InventoryData.TaskID = taskID; 2212 replytask.InventoryData.TaskID = taskID;
2213 replytask.InventoryData.Serial = serial; 2213 replytask.InventoryData.Serial = serial;
2214 replytask.InventoryData.Filename = fileName; 2214 replytask.InventoryData.Filename = fileName;
2215 OutPacket(replytask, ThrottleOutPacketType.Asset); 2215 OutPacket(replytask, ThrottleOutPacketType.Task);
2216 } 2216 }
2217 2217
2218 public void SendXferPacket(ulong xferID, uint packet, byte[] data) 2218 public void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory)
2219 { 2219 {
2220 ThrottleOutPacketType type = ThrottleOutPacketType.Asset;
2221 if (isTaskInventory)
2222 type = ThrottleOutPacketType.Task;
2223
2220 SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); 2224 SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket);
2221 sendXfer.XferID.ID = xferID; 2225 sendXfer.XferID.ID = xferID;
2222 sendXfer.XferID.Packet = packet; 2226 sendXfer.XferID.Packet = packet;
2223 sendXfer.DataPacket.Data = data; 2227 sendXfer.DataPacket.Data = data;
2224 OutPacket(sendXfer, ThrottleOutPacketType.Asset); 2228 OutPacket(sendXfer, type);
2225 } 2229 }
2226 2230
2227 public void SendAbortXferPacket(ulong xferID) 2231 public void SendAbortXferPacket(ulong xferID)
@@ -2408,6 +2412,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2408 OutPacket(sound, ThrottleOutPacketType.Task); 2412 OutPacket(sound, ThrottleOutPacketType.Task);
2409 } 2413 }
2410 2414
2415 public void SendTransferAbort(TransferRequestPacket transferRequest)
2416 {
2417 TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort);
2418 abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID;
2419 abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType;
2420 m_log.Debug("[Assets] Aborting transfer; asset request failed");
2421 OutPacket(abort, ThrottleOutPacketType.Task);
2422 }
2423
2411 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) 2424 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain)
2412 { 2425 {
2413 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); 2426 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger);
@@ -2716,6 +2729,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2716 float friction = part.Friction; 2729 float friction = part.Friction;
2717 float bounce = part.Restitution; 2730 float bounce = part.Restitution;
2718 float gravmod = part.GravityModifier; 2731 float gravmod = part.GravityModifier;
2732
2719 eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); 2733 eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId);
2720 } 2734 }
2721 } 2735 }
@@ -2786,8 +2800,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2786 req.AssetInf.ID, req.AssetInf.Metadata.ContentType); 2800 req.AssetInf.ID, req.AssetInf.Metadata.ContentType);
2787 return; 2801 return;
2788 } 2802 }
2803 int WearableOut = 0;
2804 bool isWearable = false;
2789 2805
2790 //m_log.Debug("sending asset " + req.RequestAssetID); 2806 if (req.AssetInf != null)
2807 isWearable =
2808 ((AssetType) req.AssetInf.Type ==
2809 AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing);
2810
2811
2812 //m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable);
2813
2814
2815 //if (isWearable)
2816 // m_log.Debug((AssetType)req.AssetInf.Type);
2817
2791 TransferInfoPacket Transfer = new TransferInfoPacket(); 2818 TransferInfoPacket Transfer = new TransferInfoPacket();
2792 Transfer.TransferInfo.ChannelType = 2; 2819 Transfer.TransferInfo.ChannelType = 2;
2793 Transfer.TransferInfo.Status = 0; 2820 Transfer.TransferInfo.Status = 0;
@@ -2809,7 +2836,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2809 Transfer.TransferInfo.Size = req.AssetInf.Data.Length; 2836 Transfer.TransferInfo.Size = req.AssetInf.Data.Length;
2810 Transfer.TransferInfo.TransferID = req.TransferRequestID; 2837 Transfer.TransferInfo.TransferID = req.TransferRequestID;
2811 Transfer.Header.Zerocoded = true; 2838 Transfer.Header.Zerocoded = true;
2812 OutPacket(Transfer, ThrottleOutPacketType.Asset); 2839 OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
2813 2840
2814 if (req.NumPackets == 1) 2841 if (req.NumPackets == 1)
2815 { 2842 {
@@ -2820,12 +2847,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2820 TransferPacket.TransferData.Data = req.AssetInf.Data; 2847 TransferPacket.TransferData.Data = req.AssetInf.Data;
2821 TransferPacket.TransferData.Status = 1; 2848 TransferPacket.TransferData.Status = 1;
2822 TransferPacket.Header.Zerocoded = true; 2849 TransferPacket.Header.Zerocoded = true;
2823 OutPacket(TransferPacket, ThrottleOutPacketType.Asset); 2850 OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
2824 } 2851 }
2825 else 2852 else
2826 { 2853 {
2827 int processedLength = 0; 2854 int processedLength = 0;
2828 int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; 2855// int maxChunkSize = Settings.MAX_PACKET_SIZE - 100;
2856
2857 int maxChunkSize = (int) MaxTransferBytesPerPacket;
2829 int packetNumber = 0; 2858 int packetNumber = 0;
2830 2859
2831 while (processedLength < req.AssetInf.Data.Length) 2860 while (processedLength < req.AssetInf.Data.Length)
@@ -2851,7 +2880,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2851 TransferPacket.TransferData.Status = 1; 2880 TransferPacket.TransferData.Status = 1;
2852 } 2881 }
2853 TransferPacket.Header.Zerocoded = true; 2882 TransferPacket.Header.Zerocoded = true;
2854 OutPacket(TransferPacket, ThrottleOutPacketType.Asset); 2883 OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
2855 2884
2856 processedLength += chunkSize; 2885 processedLength += chunkSize;
2857 packetNumber++; 2886 packetNumber++;
@@ -2896,7 +2925,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2896 reply.Data.ParcelID = parcelID; 2925 reply.Data.ParcelID = parcelID;
2897 reply.Data.OwnerID = land.OwnerID; 2926 reply.Data.OwnerID = land.OwnerID;
2898 reply.Data.Name = Utils.StringToBytes(land.Name); 2927 reply.Data.Name = Utils.StringToBytes(land.Name);
2899 reply.Data.Desc = Utils.StringToBytes(land.Description); 2928 if (land != null && land.Description != null && land.Description != String.Empty)
2929 reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length));
2930 else
2931 reply.Data.Desc = new Byte[0];
2900 reply.Data.ActualArea = land.Area; 2932 reply.Data.ActualArea = land.Area;
2901 reply.Data.BillableArea = land.Area; // TODO: what is this? 2933 reply.Data.BillableArea = land.Area; // TODO: what is this?
2902 2934
@@ -3603,24 +3635,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3603 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; 3635 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count];
3604 AgentWearablesUpdatePacket.WearableDataBlock awb; 3636 AgentWearablesUpdatePacket.WearableDataBlock awb;
3605 int idx = 0; 3637 int idx = 0;
3606 for (int i = 0; i < wearables.Length; i++) 3638
3607 { 3639 for (int i = 0; i < wearables.Length; i++)
3608 for (int j = 0; j < wearables[i].Count; j++) 3640 {
3609 { 3641 for (int j = 0; j < wearables[i].Count; j++)
3610 awb = new AgentWearablesUpdatePacket.WearableDataBlock(); 3642 {
3611 awb.WearableType = (byte)i; 3643 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
3612 awb.AssetID = wearables[i][j].AssetID; 3644 awb.WearableType = (byte) i;
3613 awb.ItemID = wearables[i][j].ItemID; 3645 awb.AssetID = wearables[i][j].AssetID;
3614 aw.WearableData[idx] = awb; 3646 awb.ItemID = wearables[i][j].ItemID;
3615 idx++; 3647 aw.WearableData[idx] = awb;
3616 3648 idx++;
3617// m_log.DebugFormat( 3649
3618// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", 3650 // m_log.DebugFormat(
3619// awb.ItemID, awb.AssetID, i, Name); 3651 // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}",
3620 } 3652 // awb.ItemID, awb.AssetID, i, Name);
3621 } 3653 }
3654 }
3622 3655
3623 OutPacket(aw, ThrottleOutPacketType.Task); 3656 OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
3624 } 3657 }
3625 3658
3626 public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) 3659 public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)
@@ -3631,7 +3664,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3631 3664
3632 AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); 3665 AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance);
3633 // TODO: don't create new blocks if recycling an old packet 3666 // TODO: don't create new blocks if recycling an old packet
3634 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; 3667 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length];
3635 avp.ObjectData.TextureEntry = textureEntry; 3668 avp.ObjectData.TextureEntry = textureEntry;
3636 3669
3637 AvatarAppearancePacket.VisualParamBlock avblock = null; 3670 AvatarAppearancePacket.VisualParamBlock avblock = null;
@@ -3762,7 +3795,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3762 /// </summary> 3795 /// </summary>
3763 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) 3796 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
3764 { 3797 {
3765 //double priority = m_prioritizer.GetUpdatePriority(this, entity); 3798 if (entity is SceneObjectPart)
3799 {
3800 SceneObjectPart e = (SceneObjectPart)entity;
3801 SceneObjectGroup g = e.ParentGroup;
3802 if (g.RootPart.Shape.State > 30) // HUD
3803 if (g.OwnerID != AgentId)
3804 return; // Don't send updates for other people's HUDs
3805 }
3806
3766 uint priority = m_prioritizer.GetUpdatePriority(this, entity); 3807 uint priority = m_prioritizer.GetUpdatePriority(this, entity);
3767 3808
3768 lock (m_entityUpdates.SyncRoot) 3809 lock (m_entityUpdates.SyncRoot)
@@ -3849,27 +3890,74 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3849 3890
3850 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race 3891 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race
3851 // condition where a kill can be processed before an out-of-date update for the same object. 3892 // condition where a kill can be processed before an out-of-date update for the same object.
3852 lock (m_killRecord) 3893 float avgTimeDilation = 1.0f;
3894 IEntityUpdate iupdate;
3895 Int32 timeinqueue; // this is just debugging code & can be dropped later
3896
3897 while (updatesThisCall < maxUpdates)
3853 { 3898 {
3854 float avgTimeDilation = 1.0f; 3899 lock (m_entityUpdates.SyncRoot)
3855 IEntityUpdate iupdate; 3900 if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue))
3856 Int32 timeinqueue; // this is just debugging code & can be dropped later 3901 break;
3902
3903 EntityUpdate update = (EntityUpdate)iupdate;
3904
3905 avgTimeDilation += update.TimeDilation;
3906 avgTimeDilation *= 0.5f;
3857 3907
3858 while (updatesThisCall < maxUpdates) 3908 if (update.Entity is SceneObjectPart)
3859 { 3909 {
3860 lock (m_entityUpdates.SyncRoot) 3910 SceneObjectPart part = (SceneObjectPart)update.Entity;
3861 if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue))
3862 break;
3863 3911
3864 EntityUpdate update = (EntityUpdate)iupdate; 3912 if (part.ParentGroup.IsDeleted)
3865 3913 continue;
3866 avgTimeDilation += update.TimeDilation;
3867 avgTimeDilation *= 0.5f;
3868 3914
3869 if (update.Entity is SceneObjectPart) 3915 if (part.ParentGroup.IsAttachment)
3916 { // Someone else's HUD, why are we getting these?
3917 if (part.ParentGroup.OwnerID != AgentId &&
3918 part.ParentGroup.RootPart.Shape.State > 30)
3919 continue;
3920 ScenePresence sp;
3921 // Owner is not in the sim, don't update it to
3922 // anyone
3923 if (!m_scene.TryGetScenePresence(part.OwnerID, out sp))
3924 continue;
3925
3926 List<SceneObjectGroup> atts = sp.GetAttachments();
3927 bool found = false;
3928 foreach (SceneObjectGroup att in atts)
3929 {
3930 if (att == part.ParentGroup)
3931 {
3932 found = true;
3933 break;
3934 }
3935 }
3936
3937 // It's an attachment of a valid avatar, but
3938 // doesn't seem to be attached, skip
3939 if (!found)
3940 continue;
3941
3942 // On vehicle crossing, the attachments are received
3943 // while the avatar is still a child. Don't send
3944 // updates here because the LocalId has not yet
3945 // been updated and the viewer will derender the
3946 // attachments until the avatar becomes root.
3947 if (sp.IsChildAgent)
3948 continue;
3949
3950 // If the object is an attachment we don't want it to be in the kill
3951 // record. Else attaching from inworld and subsequently dropping
3952 // it will no longer work.
3953// lock (m_killRecord)
3954// {
3955// m_killRecord.Remove(part.LocalId);
3956// m_killRecord.Remove(part.ParentGroup.RootPart.LocalId);
3957// }
3958 }
3959 else
3870 { 3960 {
3871 SceneObjectPart part = (SceneObjectPart)update.Entity;
3872
3873 // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client 3961 // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
3874 // will never receive an update after a prim kill. Even then, keeping the kill record may be a good 3962 // will never receive an update after a prim kill. Even then, keeping the kill record may be a good
3875 // safety measure. 3963 // safety measure.
@@ -3880,21 +3968,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3880 // 3968 //
3881 // This doesn't appear to apply to child prims - a client will happily ignore these updates 3969 // This doesn't appear to apply to child prims - a client will happily ignore these updates
3882 // after the root prim has been deleted. 3970 // after the root prim has been deleted.
3883 if (m_killRecord.Contains(part.LocalId)) 3971 //
3884 { 3972 // We ignore this for attachments because attaching something from inworld breaks unless we do.
3885 // m_log.WarnFormat( 3973// lock (m_killRecord)
3886 // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted", 3974// {
3887 // part.LocalId, Name); 3975// if (m_killRecord.Contains(part.LocalId))
3888 continue; 3976// continue;
3889 } 3977// if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId))
3890 3978// continue;
3891 if (part.ParentGroup.IsAttachment && m_disableFacelights) 3979// }
3980 }
3981
3982 if (part.ParentGroup.IsAttachment && m_disableFacelights)
3983 {
3984 if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
3985 part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
3892 { 3986 {
3893 if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && 3987 part.Shape.LightEntry = false;
3894 part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
3895 {
3896 part.Shape.LightEntry = false;
3897 }
3898 } 3988 }
3899 3989
3900 if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) 3990 if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
@@ -3905,224 +3995,166 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3905 part.Shape.ProfileHollow = 27500; 3995 part.Shape.ProfileHollow = 27500;
3906 } 3996 }
3907 } 3997 }
3908 3998
3909 #region UpdateFlags to packet type conversion 3999 if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
3910
3911 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
3912
3913 bool canUseCompressed = true;
3914 bool canUseImproved = true;
3915
3916 // Compressed object updates only make sense for LL primitives
3917 if (!(update.Entity is SceneObjectPart))
3918 { 4000 {
3919 canUseCompressed = false; 4001 // Ensure that mesh has at least 8 valid faces
4002 part.Shape.ProfileBegin = 12500;
4003 part.Shape.ProfileEnd = 0;
4004 part.Shape.ProfileHollow = 27500;
3920 } 4005 }
3921 4006 }
3922 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) 4007
4008 ++updatesThisCall;
4009
4010 #region UpdateFlags to packet type conversion
4011
4012 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
4013
4014 bool canUseCompressed = true;
4015 bool canUseImproved = true;
4016
4017 // Compressed object updates only make sense for LL primitives
4018 if (!(update.Entity is SceneObjectPart))
4019 {
4020 canUseCompressed = false;
4021 }
4022
4023 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
4024 {
4025 canUseCompressed = false;
4026 canUseImproved = false;
4027 }
4028 else
4029 {
4030 if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) ||
4031 updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
4032 updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
4033 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3923 { 4034 {
3924 canUseCompressed = false; 4035 canUseCompressed = false;
3925 canUseImproved = false;
3926 } 4036 }
3927 else 4037
4038 if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
4039 updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
4040 updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
4041 updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
4042 updateFlags.HasFlag(PrimUpdateFlags.Text) ||
4043 updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
4044 updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
4045 updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
4046 updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
4047 updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
4048 updateFlags.HasFlag(PrimUpdateFlags.Material) ||
4049 updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
4050 updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
4051 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3928 { 4052 {
3929 if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || 4053 canUseImproved = false;
3930 updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
3931 updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
3932 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3933 {
3934 canUseCompressed = false;
3935 }
3936
3937 if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
3938 updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
3939 updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
3940 updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
3941 updateFlags.HasFlag(PrimUpdateFlags.Text) ||
3942 updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
3943 updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
3944 updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
3945 updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
3946 updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
3947 updateFlags.HasFlag(PrimUpdateFlags.Material) ||
3948 updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
3949 updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
3950 updateFlags.HasFlag(PrimUpdateFlags.Joint))
3951 {
3952 canUseImproved = false;
3953 }
3954 } 4054 }
4055 }
3955 4056
3956 #endregion UpdateFlags to packet type conversion 4057 #endregion UpdateFlags to packet type conversion
3957
3958 #region Block Construction
3959
3960 // TODO: Remove this once we can build compressed updates
3961 canUseCompressed = false;
3962
3963 if (!canUseImproved && !canUseCompressed)
3964 {
3965 ObjectUpdatePacket.ObjectDataBlock updateBlock;
3966 4058
3967 if (update.Entity is ScenePresence) 4059 #region Block Construction
3968 {
3969 updateBlock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
3970 }
3971 else
3972 {
3973 SceneObjectPart part = (SceneObjectPart)update.Entity;
3974 updateBlock = CreatePrimUpdateBlock(part, AgentId);
3975
3976 // If the part has become a private hud since the update was scheduled then we do not
3977 // want to send it to other avatars.
3978 if (part.ParentGroup.IsAttachment
3979 && part.ParentGroup.HasPrivateAttachmentPoint
3980 && part.ParentGroup.AttachedAvatar != AgentId)
3981 continue;
3982
3983 // If the part has since been deleted, then drop the update. In the case of attachments,
3984 // this is to avoid spurious updates to other viewers since post-processing of attachments
3985 // has to change the IsAttachment flag for various reasons (which will end up in a pass
3986 // of the test above).
3987 //
3988 // Actual deletions (kills) happen in another method.
3989 if (part.ParentGroup.IsDeleted)
3990 continue;
3991 }
3992 4060
3993 objectUpdateBlocks.Value.Add(updateBlock); 4061 // TODO: Remove this once we can build compressed updates
3994 objectUpdates.Value.Add(update); 4062 canUseCompressed = false;
3995 }
3996 else if (!canUseImproved)
3997 {
3998 SceneObjectPart part = (SceneObjectPart)update.Entity;
3999 ObjectUpdateCompressedPacket.ObjectDataBlock compressedBlock
4000 = CreateCompressedUpdateBlock(part, updateFlags);
4001
4002 // If the part has since been deleted, then drop the update. In the case of attachments,
4003 // this is to avoid spurious updates to other viewers since post-processing of attachments
4004 // has to change the IsAttachment flag for various reasons (which will end up in a pass
4005 // of the test above).
4006 //
4007 // Actual deletions (kills) happen in another method.
4008 if (part.ParentGroup.IsDeleted)
4009 continue;
4010 4063
4011 compressedUpdateBlocks.Value.Add(compressedBlock); 4064 if (!canUseImproved && !canUseCompressed)
4012 compressedUpdates.Value.Add(update); 4065 {
4066 if (update.Entity is ScenePresence)
4067 {
4068 objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
4013 } 4069 }
4014 else 4070 else
4015 { 4071 {
4016 if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) 4072 objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
4017 {
4018 // Self updates go into a special list
4019 terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
4020 terseAgentUpdates.Value.Add(update);
4021 }
4022 else
4023 {
4024 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseUpdateBlock
4025 = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures));
4026
4027 // Everything else goes here
4028 if (update.Entity is SceneObjectPart)
4029 {
4030 SceneObjectPart part = (SceneObjectPart)update.Entity;
4031
4032 // If the part has become a private hud since the update was scheduled then we do not
4033 // want to send it to other avatars.
4034 if (part.ParentGroup.IsAttachment
4035 && part.ParentGroup.HasPrivateAttachmentPoint
4036 && part.ParentGroup.AttachedAvatar != AgentId)
4037 continue;
4038
4039 // If the part has since been deleted, then drop the update. In the case of attachments,
4040 // this is to avoid spurious updates to other viewers since post-processing of attachments
4041 // has to change the IsAttachment flag for various reasons (which will end up in a pass
4042 // of the test above).
4043 //
4044 // Actual deletions (kills) happen in another method.
4045 if (part.ParentGroup.IsDeleted)
4046 continue;
4047 }
4048
4049 terseUpdateBlocks.Value.Add(terseUpdateBlock);
4050 terseUpdates.Value.Add(update);
4051 }
4052 } 4073 }
4053
4054 ++updatesThisCall;
4055
4056 #endregion Block Construction
4057 } 4074 }
4058 4075 else if (!canUseImproved)
4059 #region Packet Sending 4076 {
4060 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); 4077 compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags));
4061 4078 }
4062 if (terseAgentUpdateBlocks.IsValueCreated) 4079 else
4063 { 4080 {
4064 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; 4081 if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId)
4082 // Self updates go into a special list
4083 terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
4084 else
4085 // Everything else goes here
4086 terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
4087 }
4065 4088
4066 ImprovedTerseObjectUpdatePacket packet 4089 #endregion Block Construction
4067 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); 4090 }
4068 4091
4069 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 4092 #region Packet Sending
4070 packet.RegionData.TimeDilation = timeDilation; 4093
4071 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 4094 const float TIME_DILATION = 1.0f;
4095 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f);
4096
4097 if (terseAgentUpdateBlocks.IsValueCreated)
4098 {
4099 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
4072 4100
4073 for (int i = 0; i < blocks.Count; i++) 4101 ImprovedTerseObjectUpdatePacket packet
4074 packet.ObjectData[i] = blocks[i]; 4102 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
4075 // If any of the packets created from this call go unacknowledged, all of the updates will be resent 4103 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4076 OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); }); 4104 packet.RegionData.TimeDilation = timeDilation;
4077 } 4105 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
4078 4106
4079 if (objectUpdateBlocks.IsValueCreated) 4107 for (int i = 0; i < blocks.Count; i++)
4080 { 4108 packet.ObjectData[i] = blocks[i];
4081 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value;
4082
4083 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
4084 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4085 packet.RegionData.TimeDilation = timeDilation;
4086 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count];
4087
4088 for (int i = 0; i < blocks.Count; i++)
4089 packet.ObjectData[i] = blocks[i];
4090 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
4091 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); });
4092 }
4093
4094 if (compressedUpdateBlocks.IsValueCreated)
4095 {
4096 List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value;
4097
4098 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
4099 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4100 packet.RegionData.TimeDilation = timeDilation;
4101 packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
4102
4103 for (int i = 0; i < blocks.Count; i++)
4104 packet.ObjectData[i] = blocks[i];
4105 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
4106 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); });
4107 }
4108 4109
4109 if (terseUpdateBlocks.IsValueCreated) 4110 OutPacket(packet, ThrottleOutPacketType.Unknown, true);
4110 { 4111 }
4111 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
4112
4113 ImprovedTerseObjectUpdatePacket packet
4114 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(
4115 PacketType.ImprovedTerseObjectUpdate);
4116 4112
4117 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 4113 if (objectUpdateBlocks.IsValueCreated)
4118 packet.RegionData.TimeDilation = timeDilation; 4114 {
4119 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; 4115 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value;
4120 4116
4121 for (int i = 0; i < blocks.Count; i++) 4117 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
4122 packet.ObjectData[i] = blocks[i]; 4118 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4123 // If any of the packets created from this call go unacknowledged, all of the updates will be resent 4119 packet.RegionData.TimeDilation = timeDilation;
4124 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); 4120 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count];
4125 } 4121
4122 for (int i = 0; i < blocks.Count; i++)
4123 packet.ObjectData[i] = blocks[i];
4124
4125 OutPacket(packet, ThrottleOutPacketType.Task, true);
4126 }
4127
4128 if (compressedUpdateBlocks.IsValueCreated)
4129 {
4130 List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value;
4131
4132 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
4133 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4134 packet.RegionData.TimeDilation = timeDilation;
4135 packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
4136
4137 for (int i = 0; i < blocks.Count; i++)
4138 packet.ObjectData[i] = blocks[i];
4139
4140 OutPacket(packet, ThrottleOutPacketType.Task, true);
4141 }
4142
4143 if (terseUpdateBlocks.IsValueCreated)
4144 {
4145 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
4146
4147 ImprovedTerseObjectUpdatePacket packet
4148 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(
4149 PacketType.ImprovedTerseObjectUpdate);
4150 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4151 packet.RegionData.TimeDilation = timeDilation;
4152 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
4153
4154 for (int i = 0; i < blocks.Count; i++)
4155 packet.ObjectData[i] = blocks[i];
4156
4157 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); });
4126 } 4158 }
4127 4159
4128 #endregion Packet Sending 4160 #endregion Packet Sending
@@ -4442,11 +4474,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4442 4474
4443 // Pass in the delegate so that if this packet needs to be resent, we send the current properties 4475 // Pass in the delegate so that if this packet needs to be resent, we send the current properties
4444 // of the object rather than the properties when the packet was created 4476 // of the object rather than the properties when the packet was created
4445 OutPacket(packet, ThrottleOutPacketType.Task, true, 4477 // HACK : Remove intelligent resending until it's fixed in core
4446 delegate(OutgoingPacket oPacket) 4478 //OutPacket(packet, ThrottleOutPacketType.Task, true,
4447 { 4479 // delegate(OutgoingPacket oPacket)
4448 ResendPropertyUpdates(updates, oPacket); 4480 // {
4449 }); 4481 // ResendPropertyUpdates(updates, oPacket);
4482 // });
4483 OutPacket(packet, ThrottleOutPacketType.Task, true);
4450 4484
4451 // pbcnt += blocks.Count; 4485 // pbcnt += blocks.Count;
4452 // ppcnt++; 4486 // ppcnt++;
@@ -4472,11 +4506,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4472 // of the object rather than the properties when the packet was created 4506 // of the object rather than the properties when the packet was created
4473 List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); 4507 List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>();
4474 updates.Add(familyUpdates.Value[i]); 4508 updates.Add(familyUpdates.Value[i]);
4475 OutPacket(packet, ThrottleOutPacketType.Task, true, 4509 // HACK : Remove intelligent resending until it's fixed in core
4476 delegate(OutgoingPacket oPacket) 4510 //OutPacket(packet, ThrottleOutPacketType.Task, true,
4477 { 4511 // delegate(OutgoingPacket oPacket)
4478 ResendPropertyUpdates(updates, oPacket); 4512 // {
4479 }); 4513 // ResendPropertyUpdates(updates, oPacket);
4514 // });
4515 OutPacket(packet, ThrottleOutPacketType.Task, true);
4480 4516
4481 // fpcnt++; 4517 // fpcnt++;
4482 // fbcnt++; 4518 // fbcnt++;
@@ -4848,7 +4884,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4848 4884
4849 if (landData.SimwideArea > 0) 4885 if (landData.SimwideArea > 0)
4850 { 4886 {
4851 int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); 4887 int simulatorCapacity = (int)((long)landData.SimwideArea * (long)m_scene.RegionInfo.ObjectCapacity * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus / 65536L);
4888 // Never report more than sim total capacity
4889 if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity)
4890 simulatorCapacity = m_scene.RegionInfo.ObjectCapacity;
4852 updateMessage.SimWideMaxPrims = simulatorCapacity; 4891 updateMessage.SimWideMaxPrims = simulatorCapacity;
4853 } 4892 }
4854 else 4893 else
@@ -4977,14 +5016,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4977 5016
4978 if (notifyCount > 0) 5017 if (notifyCount > 0)
4979 { 5018 {
4980 if (notifyCount > 32) 5019// if (notifyCount > 32)
4981 { 5020// {
4982 m_log.InfoFormat( 5021// m_log.InfoFormat(
4983 "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" 5022// "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}"
4984 + " - a developer might want to investigate whether this is a hard limit", 32); 5023// + " - a developer might want to investigate whether this is a hard limit", 32);
4985 5024//
4986 notifyCount = 32; 5025// notifyCount = 32;
4987 } 5026// }
4988 5027
4989 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock 5028 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock
4990 = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; 5029 = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount];
@@ -5039,9 +5078,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5039 { 5078 {
5040 ScenePresence presence = (ScenePresence)entity; 5079 ScenePresence presence = (ScenePresence)entity;
5041 5080
5042 attachPoint = presence.State;
5043 collisionPlane = presence.CollisionPlane;
5044 position = presence.OffsetPosition; 5081 position = presence.OffsetPosition;
5082 rotation = presence.Rotation;
5083
5084 if (presence.ParentID != 0)
5085 {
5086 SceneObjectPart part = m_scene.GetSceneObjectPart(presence.ParentID);
5087 if (part != null && part != part.ParentGroup.RootPart)
5088 {
5089 position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset;
5090 rotation = part.RotationOffset * presence.Rotation;
5091 }
5092 angularVelocity = Vector3.Zero;
5093 }
5094 else
5095 {
5096 angularVelocity = presence.AngularVelocity;
5097 rotation = presence.Rotation;
5098 }
5099
5100 attachPoint = 0;
5101 collisionPlane = presence.CollisionPlane;
5045 velocity = presence.Velocity; 5102 velocity = presence.Velocity;
5046 acceleration = Vector3.Zero; 5103 acceleration = Vector3.Zero;
5047 5104
@@ -5050,9 +5107,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5050 // may improve movement smoothness. 5107 // may improve movement smoothness.
5051// acceleration = new Vector3(1, 0, 0); 5108// acceleration = new Vector3(1, 0, 0);
5052 5109
5053 angularVelocity = presence.AngularVelocity;
5054 rotation = presence.Rotation;
5055
5056 if (sendTexture) 5110 if (sendTexture)
5057 textureEntry = presence.Appearance.Texture.GetBytes(); 5111 textureEntry = presence.Appearance.Texture.GetBytes();
5058 else 5112 else
@@ -5158,13 +5212,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5158 5212
5159 protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) 5213 protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data)
5160 { 5214 {
5215 Vector3 offsetPosition = data.OffsetPosition;
5216 Quaternion rotation = data.Rotation;
5217 uint parentID = data.ParentID;
5218
5219 if (parentID != 0)
5220 {
5221 SceneObjectPart part = m_scene.GetSceneObjectPart(parentID);
5222 if (part != null && part != part.ParentGroup.RootPart)
5223 {
5224 offsetPosition = part.OffsetPosition + data.OffsetPosition * part.RotationOffset;
5225 rotation = part.RotationOffset * data.Rotation;
5226 parentID = part.ParentGroup.RootPart.LocalId;
5227 }
5228 }
5229
5161 byte[] objectData = new byte[76]; 5230 byte[] objectData = new byte[76];
5162 5231
5163 data.CollisionPlane.ToBytes(objectData, 0); 5232 data.CollisionPlane.ToBytes(objectData, 0);
5164 data.OffsetPosition.ToBytes(objectData, 16); 5233 offsetPosition.ToBytes(objectData, 16);
5234 Vector3 velocity = new Vector3(0, 0, 0);
5235 Vector3 acceleration = new Vector3(0, 0, 0);
5236 velocity.ToBytes(objectData, 28);
5237 acceleration.ToBytes(objectData, 40);
5165// data.Velocity.ToBytes(objectData, 28); 5238// data.Velocity.ToBytes(objectData, 28);
5166// data.Acceleration.ToBytes(objectData, 40); 5239// data.Acceleration.ToBytes(objectData, 40);
5167 data.Rotation.ToBytes(objectData, 52); 5240 rotation.ToBytes(objectData, 52);
5168 //data.AngularVelocity.ToBytes(objectData, 64); 5241 //data.AngularVelocity.ToBytes(objectData, 64);
5169 5242
5170 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); 5243 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
@@ -5178,14 +5251,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5178 update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + 5251 update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " +
5179 data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); 5252 data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle);
5180 update.ObjectData = objectData; 5253 update.ObjectData = objectData;
5181 update.ParentID = data.ParentID; 5254 update.ParentID = parentID;
5182 update.PathCurve = 16; 5255 update.PathCurve = 16;
5183 update.PathScaleX = 100; 5256 update.PathScaleX = 100;
5184 update.PathScaleY = 100; 5257 update.PathScaleY = 100;
5185 update.PCode = (byte)PCode.Avatar; 5258 update.PCode = (byte)PCode.Avatar;
5186 update.ProfileCurve = 1; 5259 update.ProfileCurve = 1;
5187 update.PSBlock = Utils.EmptyBytes; 5260 update.PSBlock = Utils.EmptyBytes;
5188 update.Scale = new Vector3(0.45f, 0.6f, 1.9f); 5261 update.Scale = data.Appearance.AvatarSize;
5262// update.Scale.Z -= 0.2f;
5263
5189 update.Text = Utils.EmptyBytes; 5264 update.Text = Utils.EmptyBytes;
5190 update.TextColor = new byte[4]; 5265 update.TextColor = new byte[4];
5191 5266
@@ -5196,10 +5271,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5196 update.TextureEntry = Utils.EmptyBytes; 5271 update.TextureEntry = Utils.EmptyBytes;
5197// update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; 5272// update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes;
5198 5273
5274/* 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)
5199 update.UpdateFlags = (uint)( 5275 update.UpdateFlags = (uint)(
5200 PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | 5276 PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner |
5201 PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | 5277 PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer |
5202 PrimFlags.ObjectOwnerModify); 5278 PrimFlags.ObjectOwnerModify);
5279*/
5280 update.UpdateFlags = 0;
5203 5281
5204 return update; 5282 return update;
5205 } 5283 }
@@ -5370,8 +5448,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5370 // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs 5448 // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs
5371 // for each AgentUpdate packet. 5449 // for each AgentUpdate packet.
5372 AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false); 5450 AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false);
5373 5451
5374 AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false); 5452 AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false);
5453 AddLocalPacketHandler(PacketType.VelocityInterpolateOff, HandleVelocityInterpolateOff, false);
5454 AddLocalPacketHandler(PacketType.VelocityInterpolateOn, HandleVelocityInterpolateOn, false);
5375 AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false); 5455 AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false);
5376 AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); 5456 AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false);
5377 AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); 5457 AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false);
@@ -5523,6 +5603,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5523 AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); 5603 AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false);
5524 AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); 5604 AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false);
5525 AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); 5605 AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode);
5606 AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments);
5526 AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); 5607 AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false);
5527 AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); 5608 AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents);
5528 AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); 5609 AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery);
@@ -5589,6 +5670,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5589 AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); 5670 AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest);
5590 AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); 5671 AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes);
5591 AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); 5672 AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard);
5673 AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags);
5592 5674
5593 AddGenericPacketHandler("autopilot", HandleAutopilot); 5675 AddGenericPacketHandler("autopilot", HandleAutopilot);
5594 } 5676 }
@@ -5941,6 +6023,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5941 return true; 6023 return true;
5942 } 6024 }
5943 6025
6026 private bool HandleVelocityInterpolateOff(IClientAPI sender, Packet Pack)
6027 {
6028 VelocityInterpolateOffPacket p = (VelocityInterpolateOffPacket)Pack;
6029 if (p.AgentData.SessionID != SessionId ||
6030 p.AgentData.AgentID != AgentId)
6031 return true;
6032
6033 m_VelocityInterpolate = false;
6034 return true;
6035 }
6036
6037 private bool HandleVelocityInterpolateOn(IClientAPI sender, Packet Pack)
6038 {
6039 VelocityInterpolateOnPacket p = (VelocityInterpolateOnPacket)Pack;
6040 if (p.AgentData.SessionID != SessionId ||
6041 p.AgentData.AgentID != AgentId)
6042 return true;
6043
6044 m_VelocityInterpolate = true;
6045 return true;
6046 }
6047
6048
5944 private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack) 6049 private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack)
5945 { 6050 {
5946 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; 6051 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
@@ -6365,26 +6470,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6365 // Temporarily protect ourselves from the mantis #951 failure. 6470 // Temporarily protect ourselves from the mantis #951 failure.
6366 // However, we could do this for several other handlers where a failure isn't terminal 6471 // However, we could do this for several other handlers where a failure isn't terminal
6367 // for the client session anyway, in order to protect ourselves against bad code in plugins 6472 // for the client session anyway, in order to protect ourselves against bad code in plugins
6473 Vector3 avSize = appear.AgentData.Size;
6368 try 6474 try
6369 { 6475 {
6370 byte[] visualparams = new byte[appear.VisualParam.Length]; 6476 byte[] visualparams = new byte[appear.VisualParam.Length];
6371 for (int i = 0; i < appear.VisualParam.Length; i++) 6477 for (int i = 0; i < appear.VisualParam.Length; i++)
6372 visualparams[i] = appear.VisualParam[i].ParamValue; 6478 visualparams[i] = appear.VisualParam[i].ParamValue;
6373 6479 //var b = appear.WearableData[0];
6480
6374 Primitive.TextureEntry te = null; 6481 Primitive.TextureEntry te = null;
6375 if (appear.ObjectData.TextureEntry.Length > 1) 6482 if (appear.ObjectData.TextureEntry.Length > 1)
6376 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); 6483 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length);
6484
6485 WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length];
6486 for (int i=0; i<appear.WearableData.Length;i++)
6487 cacheitems[i] = new WearableCacheItem(){CacheId = appear.WearableData[i].CacheID,TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex)};
6377 6488
6378 List<CachedTextureRequestArg> hashes = new List<CachedTextureRequestArg>(); 6489
6379 for (int i = 0; i < appear.WearableData.Length; i++)
6380 {
6381 CachedTextureRequestArg arg = new CachedTextureRequestArg();
6382 arg.BakedTextureIndex = appear.WearableData[i].TextureIndex;
6383 arg.WearableHashID = appear.WearableData[i].CacheID;
6384 hashes.Add(arg);
6385 }
6386 6490
6387 handlerSetAppearance(sender, te, visualparams, hashes); 6491 handlerSetAppearance(sender, te, visualparams,avSize, cacheitems);
6388 } 6492 }
6389 catch (Exception e) 6493 catch (Exception e)
6390 { 6494 {
@@ -6593,6 +6697,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6593 { 6697 {
6594 handlerCompleteMovementToRegion(sender, true); 6698 handlerCompleteMovementToRegion(sender, true);
6595 } 6699 }
6700 else
6701 m_log.Debug("HandleCompleteAgentMovement NULL handler");
6702
6596 handlerCompleteMovementToRegion = null; 6703 handlerCompleteMovementToRegion = null;
6597 6704
6598 return true; 6705 return true;
@@ -6610,7 +6717,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6610 return true; 6717 return true;
6611 } 6718 }
6612 #endregion 6719 #endregion
6613 6720/*
6614 StartAnim handlerStartAnim = null; 6721 StartAnim handlerStartAnim = null;
6615 StopAnim handlerStopAnim = null; 6722 StopAnim handlerStopAnim = null;
6616 6723
@@ -6634,6 +6741,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6634 } 6741 }
6635 } 6742 }
6636 return true; 6743 return true;
6744*/
6745 ChangeAnim handlerChangeAnim = null;
6746
6747 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
6748 {
6749 handlerChangeAnim = OnChangeAnim;
6750 if (handlerChangeAnim != null)
6751 {
6752 handlerChangeAnim(AgentAni.AnimationList[i].AnimID, AgentAni.AnimationList[i].StartAnim, false);
6753 }
6754 }
6755
6756 handlerChangeAnim = OnChangeAnim;
6757 if (handlerChangeAnim != null)
6758 {
6759 handlerChangeAnim(UUID.Zero, false, true);
6760 }
6761
6762 return true;
6637 } 6763 }
6638 6764
6639 private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) 6765 private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack)
@@ -6859,6 +6985,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6859 #endregion 6985 #endregion
6860 6986
6861 m_udpClient.SetThrottles(atpack.Throttle.Throttles); 6987 m_udpClient.SetThrottles(atpack.Throttle.Throttles);
6988 GenericCall2 handler = OnUpdateThrottles;
6989 if (handler != null)
6990 {
6991 handler();
6992 }
6862 return true; 6993 return true;
6863 } 6994 }
6864 6995
@@ -7283,7 +7414,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7283 physdata.Bounce = phsblock.Restitution; 7414 physdata.Bounce = phsblock.Restitution;
7284 physdata.Density = phsblock.Density; 7415 physdata.Density = phsblock.Density;
7285 physdata.Friction = phsblock.Friction; 7416 physdata.Friction = phsblock.Friction;
7286 physdata.GravitationModifier = phsblock.GravityMultiplier; 7417 physdata.GravitationModifier = phsblock.GravityMultiplier;
7287 } 7418 }
7288 7419
7289 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); 7420 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this);
@@ -7869,6 +8000,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7869 // surrounding scene 8000 // surrounding scene
7870 if ((ImageType)block.Type == ImageType.Baked) 8001 if ((ImageType)block.Type == ImageType.Baked)
7871 args.Priority *= 2.0f; 8002 args.Priority *= 2.0f;
8003 int wearableout = 0;
7872 8004
7873 ImageManager.EnqueueReq(args); 8005 ImageManager.EnqueueReq(args);
7874 } 8006 }
@@ -8903,16 +9035,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8903 9035
8904 #region Parcel related packets 9036 #region Parcel related packets
8905 9037
9038 // acumulate several HandleRegionHandleRequest consecutive overlaping requests
9039 // to be done with minimal resources as possible
9040 // variables temporary here while in test
9041
9042 Queue<UUID> RegionHandleRequests = new Queue<UUID>();
9043 bool RegionHandleRequestsInService = false;
9044
8906 private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) 9045 private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack)
8907 { 9046 {
8908 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; 9047 UUID currentUUID;
8909 9048
8910 RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; 9049 RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest;
8911 if (handlerRegionHandleRequest != null) 9050
9051 if (handlerRegionHandleRequest == null)
9052 return true;
9053
9054 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack;
9055
9056 lock (RegionHandleRequests)
8912 { 9057 {
8913 handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); 9058 if (RegionHandleRequestsInService)
9059 {
9060 // we are already busy doing a previus request
9061 // so enqueue it
9062 RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID);
9063 return true;
9064 }
9065
9066 // else do it
9067 currentUUID = rhrPack.RequestBlock.RegionID;
9068 RegionHandleRequestsInService = true;
8914 } 9069 }
8915 return true; 9070
9071 while (true)
9072 {
9073 handlerRegionHandleRequest(this, currentUUID);
9074
9075 lock (RegionHandleRequests)
9076 {
9077 // exit condition, nothing to do or closed
9078 // current code seems to assume we may loose the handler at anytime,
9079 // so keep checking it
9080 handlerRegionHandleRequest = OnRegionHandleRequest;
9081
9082 if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null)
9083 {
9084 RegionHandleRequests.Clear();
9085 RegionHandleRequestsInService = false;
9086 return true;
9087 }
9088 currentUUID = RegionHandleRequests.Dequeue();
9089 }
9090 }
9091
9092 return true; // actually unreached
8916 } 9093 }
8917 9094
8918 private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) 9095 private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack)
@@ -10168,7 +10345,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10168 handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, 10345 handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID,
10169 Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), 10346 Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName),
10170 UpdateMuteListEntry.MuteData.MuteType, 10347 UpdateMuteListEntry.MuteData.MuteType,
10171 UpdateMuteListEntry.AgentData.AgentID); 10348 UpdateMuteListEntry.MuteData.MuteFlags);
10172 return true; 10349 return true;
10173 } 10350 }
10174 return false; 10351 return false;
@@ -10183,8 +10360,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10183 { 10360 {
10184 handlerRemoveMuteListEntry(this, 10361 handlerRemoveMuteListEntry(this,
10185 RemoveMuteListEntry.MuteData.MuteID, 10362 RemoveMuteListEntry.MuteData.MuteID,
10186 Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName), 10363 Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName));
10187 RemoveMuteListEntry.AgentData.AgentID);
10188 return true; 10364 return true;
10189 } 10365 }
10190 return false; 10366 return false;
@@ -10228,10 +10404,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10228 return false; 10404 return false;
10229 } 10405 }
10230 10406
10407 private bool HandleChangeInventoryItemFlags(IClientAPI client, Packet packet)
10408 {
10409 ChangeInventoryItemFlagsPacket ChangeInventoryItemFlags =
10410 (ChangeInventoryItemFlagsPacket)packet;
10411 ChangeInventoryItemFlags handlerChangeInventoryItemFlags = OnChangeInventoryItemFlags;
10412 if (handlerChangeInventoryItemFlags != null)
10413 {
10414 foreach(ChangeInventoryItemFlagsPacket.InventoryDataBlock b in ChangeInventoryItemFlags.InventoryData)
10415 handlerChangeInventoryItemFlags(this, b.ItemID, b.Flags);
10416 return true;
10417 }
10418 return false;
10419 }
10420
10231 private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) 10421 private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack)
10232 { 10422 {
10233 return true; 10423 return true;
10234 } 10424 }
10425
10426 private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack)
10427 {
10428 CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack;
10429
10430 #region Packet Session and User Check
10431 if (m_checkPackets)
10432 {
10433 if (packet.AgentData.SessionID != SessionId ||
10434 packet.AgentData.AgentID != AgentId)
10435 return true;
10436 }
10437 #endregion
10438 MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null;
10439 List<InventoryItemBase> items = new List<InventoryItemBase>();
10440 foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData)
10441 {
10442 InventoryItemBase b = new InventoryItemBase();
10443 b.ID = n.OldItemID;
10444 b.Folder = n.OldFolderID;
10445 items.Add(b);
10446 }
10447
10448 handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy;
10449 if (handlerMoveItemsAndLeaveCopy != null)
10450 {
10451 handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID);
10452 }
10453
10454 return true;
10455 }
10235 10456
10236 private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) 10457 private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack)
10237 { 10458 {
@@ -10658,6 +10879,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10658 groupProfileReply.GroupData.MaturePublish = d.MaturePublish; 10879 groupProfileReply.GroupData.MaturePublish = d.MaturePublish;
10659 groupProfileReply.GroupData.OwnerRole = d.OwnerRole; 10880 groupProfileReply.GroupData.OwnerRole = d.OwnerRole;
10660 10881
10882 Scene scene = (Scene)m_scene;
10883 if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID)))
10884 {
10885 ScenePresence p;
10886 if (scene.TryGetScenePresence(sender.AgentId, out p))
10887 {
10888 if (p.GodLevel >= 200)
10889 {
10890 groupProfileReply.GroupData.OpenEnrollment = true;
10891 groupProfileReply.GroupData.MembershipFee = 0;
10892 }
10893 }
10894 }
10895
10661 OutPacket(groupProfileReply, ThrottleOutPacketType.Task); 10896 OutPacket(groupProfileReply, ThrottleOutPacketType.Task);
10662 } 10897 }
10663 return true; 10898 return true;
@@ -11231,11 +11466,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11231 11466
11232 StartLure handlerStartLure = OnStartLure; 11467 StartLure handlerStartLure = OnStartLure;
11233 if (handlerStartLure != null) 11468 if (handlerStartLure != null)
11234 handlerStartLure(startLureRequest.Info.LureType, 11469 {
11235 Utils.BytesToString( 11470 for (int i = 0 ; i < startLureRequest.TargetData.Length ; i++)
11236 startLureRequest.Info.Message), 11471 {
11237 startLureRequest.TargetData[0].TargetID, 11472 handlerStartLure(startLureRequest.Info.LureType,
11238 this); 11473 Utils.BytesToString(
11474 startLureRequest.Info.Message),
11475 startLureRequest.TargetData[i].TargetID,
11476 this);
11477 }
11478 }
11239 return true; 11479 return true;
11240 } 11480 }
11241 private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) 11481 private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack)
@@ -11349,10 +11589,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11349 } 11589 }
11350 #endregion 11590 #endregion
11351 11591
11352 ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; 11592 ClassifiedGodDelete handlerClassifiedGodDelete = OnClassifiedGodDelete;
11353 if (handlerClassifiedGodDelete != null) 11593 if (handlerClassifiedGodDelete != null)
11354 handlerClassifiedGodDelete( 11594 handlerClassifiedGodDelete(
11355 classifiedGodDelete.Data.ClassifiedID, 11595 classifiedGodDelete.Data.ClassifiedID,
11596 classifiedGodDelete.Data.QueryID,
11356 this); 11597 this);
11357 return true; 11598 return true;
11358 } 11599 }
@@ -11655,12 +11896,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11655 /// <param name="simclient"></param> 11896 /// <param name="simclient"></param>
11656 /// <param name="packet"></param> 11897 /// <param name="packet"></param>
11657 /// <returns></returns> 11898 /// <returns></returns>
11658 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) 11899 // TODO: Convert old handler to use new method
11900 /*protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
11659 { 11901 {
11660 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; 11902 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
11661 11903
11662 if (cachedtex.AgentData.SessionID != SessionId) 11904 if (cachedtex.AgentData.SessionID != SessionId)
11663 return false; 11905 return false;
11906
11664 11907
11665 List<CachedTextureRequestArg> requestArgs = new List<CachedTextureRequestArg>(); 11908 List<CachedTextureRequestArg> requestArgs = new List<CachedTextureRequestArg>();
11666 11909
@@ -11673,23 +11916,173 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11673 requestArgs.Add(arg); 11916 requestArgs.Add(arg);
11674 } 11917 }
11675 11918
11676 try 11919 CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest;
11920 if (handlerCachedTextureRequest != null)
11677 { 11921 {
11678 CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest; 11922 handlerCachedTextureRequest(simclient,cachedtex.AgentData.SerialNum,requestArgs);
11679 if (handlerCachedTextureRequest != null) 11923 }
11924
11925 return true;
11926 }*/
11927
11928 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
11929 {
11930 //m_log.Debug("texture cached: " + packet.ToString());
11931 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
11932 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
11933
11934 if (cachedtex.AgentData.SessionID != SessionId)
11935 return false;
11936
11937
11938 // TODO: don't create new blocks if recycling an old packet
11939 cachedresp.AgentData.AgentID = AgentId;
11940 cachedresp.AgentData.SessionID = m_sessionId;
11941 cachedresp.AgentData.SerialNum = m_cachedTextureSerial;
11942 m_cachedTextureSerial++;
11943 cachedresp.WearableData =
11944 new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length];
11945
11946 //IAvatarFactoryModule fac = m_scene.RequestModuleInterface<IAvatarFactoryModule>();
11947 // var item = fac.GetBakedTextureFaces(AgentId);
11948 //WearableCacheItem[] items = fac.GetCachedItems(AgentId);
11949
11950 IAssetService cache = m_scene.AssetService;
11951 IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
11952 //bakedTextureModule = null;
11953 int maxWearablesLoop = cachedtex.WearableData.Length;
11954 if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES)
11955 maxWearablesLoop = AvatarWearable.MAX_WEARABLES;
11956
11957 if (bakedTextureModule != null && cache != null)
11958 {
11959 // 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
11960
11961 WearableCacheItem[] cacheItems = null;
11962 ScenePresence p = m_scene.GetScenePresence(AgentId);
11963 if (p.Appearance != null)
11964 if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty)
11965 {
11966 try
11967 {
11968 cacheItems = bakedTextureModule.Get(AgentId);
11969 p.Appearance.WearableCacheItems = cacheItems;
11970 p.Appearance.WearableCacheItemsDirty = false;
11971 }
11972
11973 /*
11974 * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception!
11975 *
11976 catch (System.Net.Sockets.SocketException)
11977 {
11978 cacheItems = null;
11979 }
11980 catch (WebException)
11981 {
11982 cacheItems = null;
11983 }
11984 catch (InvalidOperationException)
11985 {
11986 cacheItems = null;
11987 } */
11988 catch (Exception)
11989 {
11990 cacheItems = null;
11991 }
11992
11993 }
11994 else if (p.Appearance.WearableCacheItems != null)
11995 {
11996 cacheItems = p.Appearance.WearableCacheItems;
11997 }
11998
11999 if (cache != null && cacheItems != null)
11680 { 12000 {
11681 handlerCachedTextureRequest(simclient,cachedtex.AgentData.SerialNum,requestArgs); 12001 foreach (WearableCacheItem item in cacheItems)
12002 {
12003
12004 if (cache.GetCached(item.TextureID.ToString()) == null)
12005 {
12006 item.TextureAsset.Temporary = true;
12007 cache.Store(item.TextureAsset);
12008 }
12009
12010
12011 }
12012 }
12013
12014 if (cacheItems != null)
12015 {
12016
12017 for (int i = 0; i < maxWearablesLoop; i++)
12018 {
12019 WearableCacheItem item =
12020 WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems);
12021
12022 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
12023 cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex;
12024 cachedresp.WearableData[i].HostName = new byte[0];
12025 if (item != null && cachedtex.WearableData[i].ID == item.CacheId)
12026 {
12027
12028 cachedresp.WearableData[i].TextureID = item.TextureID;
12029 }
12030 else
12031 {
12032 cachedresp.WearableData[i].TextureID = UUID.Zero;
12033 }
12034 }
12035 }
12036 else
12037 {
12038 for (int i = 0; i < maxWearablesLoop; i++)
12039 {
12040 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
12041 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
12042 cachedresp.WearableData[i].TextureID = UUID.Zero;
12043 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
12044 cachedresp.WearableData[i].HostName = new byte[0];
12045 }
11682 } 12046 }
11683 } 12047 }
11684 catch (Exception e) 12048 else
11685 { 12049 {
11686 m_log.ErrorFormat("[CLIENT VIEW]: AgentTextureCached packet handler threw an exception, {0}", e); 12050 if (cache == null)
11687 return false; 12051 {
12052 for (int i = 0; i < maxWearablesLoop; i++)
12053 {
12054 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
12055 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
12056 cachedresp.WearableData[i].TextureID = UUID.Zero;
12057 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
12058 cachedresp.WearableData[i].HostName = new byte[0];
12059 }
12060 }
12061 else
12062 {
12063 for (int i = 0; i < maxWearablesLoop; i++)
12064 {
12065 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
12066 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
12067
12068
12069
12070 if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null)
12071 cachedresp.WearableData[i].TextureID = UUID.Zero;
12072 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
12073 else
12074 cachedresp.WearableData[i].TextureID = UUID.Zero;
12075 // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
12076 cachedresp.WearableData[i].HostName = new byte[0];
12077 }
12078 }
11688 } 12079 }
11689 12080 cachedresp.Header.Zerocoded = true;
12081 OutPacket(cachedresp, ThrottleOutPacketType.Task);
12082
11690 return true; 12083 return true;
11691 } 12084 }
11692 12085
11693 /// <summary> 12086 /// <summary>
11694 /// Send a response back to a client when it asks the asset server (via the region server) if it has 12087 /// Send a response back to a client when it asks the asset server (via the region server) if it has
11695 /// its appearance texture cached. 12088 /// its appearance texture cached.
@@ -11753,209 +12146,147 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11753 } 12146 }
11754 else 12147 else
11755 { 12148 {
11756// m_log.DebugFormat( 12149 ClientChangeObject updatehandler = onClientChangeObject;
11757// "[CLIENT]: Processing block {0} type {1} for {2} {3}",
11758// i, block.Type, part.Name, part.LocalId);
11759 12150
11760// // Do this once since fetch parts creates a new array. 12151 if (updatehandler != null)
11761// SceneObjectPart[] parts = part.ParentGroup.Parts; 12152 {
11762// for (int j = 0; j < parts.Length; j++) 12153 ObjectChangeData udata = new ObjectChangeData();
11763// {
11764// part.StoreUndoState();
11765// parts[j].IgnoreUndoUpdate = true;
11766// }
11767 12154
11768 UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; 12155 /*ubit from ll JIRA:
12156 * 0x01 position
12157 * 0x02 rotation
12158 * 0x04 scale
12159
12160 * 0x08 LINK_SET
12161 * 0x10 UNIFORM for scale
12162 */
11769 12163
11770 switch (block.Type) 12164 // translate to internal changes
11771 { 12165 // not all cases .. just the ones older code did
11772 case 1:
11773 Vector3 pos1 = new Vector3(block.Data, 0);
11774 12166
11775 UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 12167 switch (block.Type)
11776 if (handlerUpdatePrimSinglePosition != null) 12168 {
11777 { 12169 case 1: //change position sp
11778 // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 12170 udata.position = new Vector3(block.Data, 0);
11779 handlerUpdatePrimSinglePosition(localId, pos1, this);
11780 }
11781 break;
11782 12171
11783 case 2: 12172 udata.change = ObjectChangeType.primP;
11784 Quaternion rot1 = new Quaternion(block.Data, 0, true); 12173 updatehandler(localId, udata, this);
12174 break;
11785 12175
11786 UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; 12176 case 2: // rotation sp
11787 if (handlerUpdatePrimSingleRotation != null) 12177 udata.rotation = new Quaternion(block.Data, 0, true);
11788 {
11789 // m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W);
11790 handlerUpdatePrimSingleRotation(localId, rot1, this);
11791 }
11792 break;
11793 12178
11794 case 3: 12179 udata.change = ObjectChangeType.primR;
11795 Vector3 rotPos = new Vector3(block.Data, 0); 12180 updatehandler(localId, udata, this);
11796 Quaternion rot2 = new Quaternion(block.Data, 12, true); 12181 break;
11797 12182
11798 UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition; 12183 case 3: // position plus rotation
11799 if (handlerUpdatePrimSingleRotationPosition != null) 12184 udata.position = new Vector3(block.Data, 0);
11800 { 12185 udata.rotation = new Quaternion(block.Data, 12, true);
11801 // m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z);
11802 // m_log.Info("new mouse rotation is " + rot2.X + " , " + rot2.Y + " , " + rot2.Z + " , " + rot2.W);
11803 handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this);
11804 }
11805 break;
11806 12186
11807 case 4: 12187 udata.change = ObjectChangeType.primPR;
11808 case 20: 12188 updatehandler(localId, udata, this);
11809 Vector3 scale4 = new Vector3(block.Data, 0); 12189 break;
11810 12190
11811 UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale; 12191 case 4: // scale sp
11812 if (handlerUpdatePrimScale != null) 12192 udata.scale = new Vector3(block.Data, 0);
11813 { 12193 udata.change = ObjectChangeType.primS;
11814 // m_log.Debug("new scale is " + scale4.X + " , " + scale4.Y + " , " + scale4.Z);
11815 handlerUpdatePrimScale(localId, scale4, this);
11816 }
11817 break;
11818 12194
11819 case 5: 12195 updatehandler(localId, udata, this);
11820 Vector3 scale1 = new Vector3(block.Data, 12); 12196 break;
11821 Vector3 pos11 = new Vector3(block.Data, 0);
11822 12197
11823 handlerUpdatePrimScale = OnUpdatePrimScale; 12198 case 0x14: // uniform scale sp
11824 if (handlerUpdatePrimScale != null) 12199 udata.scale = new Vector3(block.Data, 0);
11825 {
11826 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
11827 handlerUpdatePrimScale(localId, scale1, this);
11828 12200
11829 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 12201 udata.change = ObjectChangeType.primUS;
11830 if (handlerUpdatePrimSinglePosition != null) 12202 updatehandler(localId, udata, this);
11831 { 12203 break;
11832 handlerUpdatePrimSinglePosition(localId, pos11, this);
11833 }
11834 }
11835 break;
11836 12204
11837 case 9: 12205 case 5: // scale and position sp
11838 Vector3 pos2 = new Vector3(block.Data, 0); 12206 udata.position = new Vector3(block.Data, 0);
12207 udata.scale = new Vector3(block.Data, 12);
11839 12208
11840 UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; 12209 udata.change = ObjectChangeType.primPS;
12210 updatehandler(localId, udata, this);
12211 break;
11841 12212
11842 if (handlerUpdateVector != null) 12213 case 0x15: //uniform scale and position
11843 { 12214 udata.position = new Vector3(block.Data, 0);
11844 handlerUpdateVector(localId, pos2, this); 12215 udata.scale = new Vector3(block.Data, 12);
11845 }
11846 break;
11847 12216
11848 case 10: 12217 udata.change = ObjectChangeType.primPUS;
11849 Quaternion rot3 = new Quaternion(block.Data, 0, true); 12218 updatehandler(localId, udata, this);
12219 break;
11850 12220
11851 UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; 12221 // now group related (bit 4)
11852 if (handlerUpdatePrimRotation != null) 12222 case 9: //( 8 + 1 )group position
11853 { 12223 udata.position = new Vector3(block.Data, 0);
11854 // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W);
11855 handlerUpdatePrimRotation(localId, rot3, this);
11856 }
11857 break;
11858 12224
11859 case 11: 12225 udata.change = ObjectChangeType.groupP;
11860 Vector3 pos3 = new Vector3(block.Data, 0); 12226 updatehandler(localId, udata, this);
11861 Quaternion rot4 = new Quaternion(block.Data, 12, true); 12227 break;
11862 12228
11863 handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; 12229 case 0x0A: // (8 + 2) group rotation
11864 if (handlerUpdatePrimGroupRotation != null) 12230 udata.rotation = new Quaternion(block.Data, 0, true);
11865 {
11866 // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
11867 // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W);
11868 handlerUpdatePrimGroupRotation(localId, pos3, rot4, this);
11869 }
11870 break;
11871 case 12:
11872 case 28:
11873 Vector3 scale7 = new Vector3(block.Data, 0);
11874 12231
11875 UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; 12232 udata.change = ObjectChangeType.groupR;
11876 if (handlerUpdatePrimGroupScale != null) 12233 updatehandler(localId, udata, this);
11877 { 12234 break;
11878 // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z);
11879 handlerUpdatePrimGroupScale(localId, scale7, this);
11880 }
11881 break;
11882 12235
11883 case 13: 12236 case 0x0B: //( 8 + 2 + 1) group rotation and position
11884 Vector3 scale2 = new Vector3(block.Data, 12); 12237 udata.position = new Vector3(block.Data, 0);
11885 Vector3 pos4 = new Vector3(block.Data, 0); 12238 udata.rotation = new Quaternion(block.Data, 12, true);
11886 12239
11887 handlerUpdatePrimScale = OnUpdatePrimScale; 12240 udata.change = ObjectChangeType.groupPR;
11888 if (handlerUpdatePrimScale != null) 12241 updatehandler(localId, udata, this);
11889 { 12242 break;
11890 //m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
11891 handlerUpdatePrimScale(localId, scale2, this);
11892 12243
11893 // Change the position based on scale (for bug number 246) 12244 case 0x0C: // (8 + 4) group scale
11894 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 12245 // only afects root prim and only sent by viewer editor object tab scaling
11895 // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 12246 // mouse edition only allows uniform scaling
11896 if (handlerUpdatePrimSinglePosition != null) 12247 // SL MAY CHANGE THIS in viewers
11897 {
11898 handlerUpdatePrimSinglePosition(localId, pos4, this);
11899 }
11900 }
11901 break;
11902 12248
11903 case 29: 12249 udata.scale = new Vector3(block.Data, 0);
11904 Vector3 scale5 = new Vector3(block.Data, 12);
11905 Vector3 pos5 = new Vector3(block.Data, 0);
11906 12250
11907 handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; 12251 udata.change = ObjectChangeType.groupS;
11908 if (handlerUpdatePrimGroupScale != null) 12252 updatehandler(localId, udata, this);
11909 {
11910 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
11911 part.StoreUndoState(true);
11912 part.IgnoreUndoUpdate = true;
11913 handlerUpdatePrimGroupScale(localId, scale5, this);
11914 handlerUpdateVector = OnUpdatePrimGroupPosition;
11915 12253
11916 if (handlerUpdateVector != null) 12254 break;
11917 {
11918 handlerUpdateVector(localId, pos5, this);
11919 }
11920 12255
11921 part.IgnoreUndoUpdate = false; 12256 case 0x0D: //(8 + 4 + 1) group scale and position
11922 } 12257 // exception as above
11923 12258
11924 break; 12259 udata.position = new Vector3(block.Data, 0);
12260 udata.scale = new Vector3(block.Data, 12);
11925 12261
11926 case 21: 12262 udata.change = ObjectChangeType.groupPS;
11927 Vector3 scale6 = new Vector3(block.Data, 12); 12263 updatehandler(localId, udata, this);
11928 Vector3 pos6 = new Vector3(block.Data, 0); 12264 break;
11929 12265
11930 handlerUpdatePrimScale = OnUpdatePrimScale; 12266 case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM
11931 if (handlerUpdatePrimScale != null) 12267 udata.scale = new Vector3(block.Data, 0);
11932 {
11933 part.StoreUndoState(false);
11934 part.IgnoreUndoUpdate = true;
11935 12268
11936 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); 12269 udata.change = ObjectChangeType.groupUS;
11937 handlerUpdatePrimScale(localId, scale6, this); 12270 updatehandler(localId, udata, this);
11938 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 12271 break;
11939 if (handlerUpdatePrimSinglePosition != null)
11940 {
11941 handlerUpdatePrimSinglePosition(localId, pos6, this);
11942 }
11943 12272
11944 part.IgnoreUndoUpdate = false; 12273 case 0x1D: // (UNIFORM + GROUP + SCALE + POS)
11945 } 12274 udata.position = new Vector3(block.Data, 0);
11946 break; 12275 udata.scale = new Vector3(block.Data, 12);
11947 12276
11948 default: 12277 udata.change = ObjectChangeType.groupPUS;
11949 m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); 12278 updatehandler(localId, udata, this);
11950 break; 12279 break;
12280
12281 default:
12282 m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type));
12283 break;
12284 }
11951 } 12285 }
11952 12286
11953// for (int j = 0; j < parts.Length; j++)
11954// parts[j].IgnoreUndoUpdate = false;
11955 } 12287 }
11956 } 12288 }
11957 } 12289 }
11958
11959 return true; 12290 return true;
11960 } 12291 }
11961 12292
@@ -12016,9 +12347,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12016 public void SetChildAgentThrottle(byte[] throttles) 12347 public void SetChildAgentThrottle(byte[] throttles)
12017 { 12348 {
12018 m_udpClient.SetThrottles(throttles); 12349 m_udpClient.SetThrottles(throttles);
12350 GenericCall2 handler = OnUpdateThrottles;
12351 if (handler != null)
12352 {
12353 handler();
12354 }
12019 } 12355 }
12020 12356
12021 /// <summary> 12357 /// <summary>
12358 /// Sets the throttles from values supplied by the client
12359 /// </summary>
12360 /// <param name="throttles"></param>
12361 public void SetAgentThrottleSilent(int throttle, int setting)
12362 {
12363 m_udpClient.ForceThrottleSetting(throttle,setting);
12364 //m_udpClient.SetThrottles(throttles);
12365
12366 }
12367
12368
12369 /// <summary>
12022 /// Get the current throttles for this client as a packed byte array 12370 /// Get the current throttles for this client as a packed byte array
12023 /// </summary> 12371 /// </summary>
12024 /// <param name="multiplier">Unused</param> 12372 /// <param name="multiplier">Unused</param>
@@ -12400,7 +12748,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12400// "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", 12748// "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}",
12401// requestID, taskID, (SourceType)sourceType, Name); 12749// requestID, taskID, (SourceType)sourceType, Name);
12402 12750
12751
12752 //Note, the bool returned from the below function is useless since it is always false.
12403 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); 12753 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
12754
12404 } 12755 }
12405 12756
12406 /// <summary> 12757 /// <summary>
@@ -12466,7 +12817,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12466 /// <returns></returns> 12817 /// <returns></returns>
12467 private static int CalculateNumPackets(byte[] data) 12818 private static int CalculateNumPackets(byte[] data)
12468 { 12819 {
12469 const uint m_maxPacketSize = 600; 12820// const uint m_maxPacketSize = 600;
12821 uint m_maxPacketSize = MaxTransferBytesPerPacket;
12470 int numPackets = 1; 12822 int numPackets = 1;
12471 12823
12472 if (data == null) 12824 if (data == null)