diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 1455 |
1 files changed, 894 insertions, 561 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 110e50e..f8b9352 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -100,6 +100,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
100 | public event AvatarPickerRequest OnAvatarPickerRequest; | 100 | public event AvatarPickerRequest OnAvatarPickerRequest; |
101 | public event StartAnim OnStartAnim; | 101 | public event StartAnim OnStartAnim; |
102 | public event StopAnim OnStopAnim; | 102 | public event StopAnim OnStopAnim; |
103 | public event ChangeAnim OnChangeAnim; | ||
103 | public event Action<IClientAPI> OnRequestAvatarsData; | 104 | public event Action<IClientAPI> OnRequestAvatarsData; |
104 | public event LinkObjects OnLinkObjects; | 105 | public event LinkObjects OnLinkObjects; |
105 | public event DelinkObjects OnDelinkObjects; | 106 | public event DelinkObjects OnDelinkObjects; |
@@ -127,6 +128,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
127 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; | 128 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; |
128 | public event UpdatePrimFlags OnUpdatePrimFlags; | 129 | public event UpdatePrimFlags OnUpdatePrimFlags; |
129 | public event UpdatePrimTexture OnUpdatePrimTexture; | 130 | public event UpdatePrimTexture OnUpdatePrimTexture; |
131 | public event ClientChangeObject onClientChangeObject; | ||
130 | public event UpdateVector OnUpdatePrimGroupPosition; | 132 | public event UpdateVector OnUpdatePrimGroupPosition; |
131 | public event UpdateVector OnUpdatePrimSinglePosition; | 133 | public event UpdateVector OnUpdatePrimSinglePosition; |
132 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; | 134 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; |
@@ -160,6 +162,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
160 | public event RequestTaskInventory OnRequestTaskInventory; | 162 | public event RequestTaskInventory OnRequestTaskInventory; |
161 | public event UpdateInventoryItem OnUpdateInventoryItem; | 163 | public event UpdateInventoryItem OnUpdateInventoryItem; |
162 | public event CopyInventoryItem OnCopyInventoryItem; | 164 | public event CopyInventoryItem OnCopyInventoryItem; |
165 | public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; | ||
163 | public event MoveInventoryItem OnMoveInventoryItem; | 166 | public event MoveInventoryItem OnMoveInventoryItem; |
164 | public event RemoveInventoryItem OnRemoveInventoryItem; | 167 | public event RemoveInventoryItem OnRemoveInventoryItem; |
165 | public event RemoveInventoryFolder OnRemoveInventoryFolder; | 168 | public event RemoveInventoryFolder OnRemoveInventoryFolder; |
@@ -258,7 +261,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
258 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; | 261 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; |
259 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; | 262 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; |
260 | public event ClassifiedDelete OnClassifiedDelete; | 263 | public event ClassifiedDelete OnClassifiedDelete; |
261 | public event ClassifiedDelete OnClassifiedGodDelete; | 264 | public event ClassifiedGodDelete OnClassifiedGodDelete; |
262 | public event EventNotificationAddRequest OnEventNotificationAddRequest; | 265 | public event EventNotificationAddRequest OnEventNotificationAddRequest; |
263 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; | 266 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; |
264 | public event EventGodDelete OnEventGodDelete; | 267 | public event EventGodDelete OnEventGodDelete; |
@@ -289,10 +292,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
289 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; | 292 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; |
290 | public event SimWideDeletesDelegate OnSimWideDeletes; | 293 | public event SimWideDeletesDelegate OnSimWideDeletes; |
291 | public event SendPostcard OnSendPostcard; | 294 | public event SendPostcard OnSendPostcard; |
295 | public event ChangeInventoryItemFlags OnChangeInventoryItemFlags; | ||
292 | public event MuteListEntryUpdate OnUpdateMuteListEntry; | 296 | public event MuteListEntryUpdate OnUpdateMuteListEntry; |
293 | public event MuteListEntryRemove OnRemoveMuteListEntry; | 297 | public event MuteListEntryRemove OnRemoveMuteListEntry; |
294 | public event GodlikeMessage onGodlikeMessage; | 298 | public event GodlikeMessage onGodlikeMessage; |
295 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; | 299 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; |
300 | public event GenericCall2 OnUpdateThrottles; | ||
296 | 301 | ||
297 | #endregion Events | 302 | #endregion Events |
298 | 303 | ||
@@ -327,6 +332,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
327 | private Prioritizer m_prioritizer; | 332 | private Prioritizer m_prioritizer; |
328 | private bool m_disableFacelights = false; | 333 | private bool m_disableFacelights = false; |
329 | 334 | ||
335 | private bool m_VelocityInterpolate = false; | ||
336 | private const uint MaxTransferBytesPerPacket = 600; | ||
337 | |||
338 | |||
330 | /// <value> | 339 | /// <value> |
331 | /// List used in construction of data blocks for an object update packet. This is to stop us having to | 340 | /// List used in construction of data blocks for an object update packet. This is to stop us having to |
332 | /// continually recreate it. | 341 | /// continually recreate it. |
@@ -338,14 +347,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
338 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an | 347 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an |
339 | /// ownerless phantom. | 348 | /// ownerless phantom. |
340 | /// | 349 | /// |
341 | /// All manipulation of this set has to occur under a lock | 350 | /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock |
342 | /// | 351 | /// |
343 | /// </value> | 352 | /// </value> |
344 | protected HashSet<uint> m_killRecord; | 353 | // protected HashSet<uint> m_killRecord; |
345 | 354 | ||
346 | // protected HashSet<uint> m_attachmentsSent; | 355 | // protected HashSet<uint> m_attachmentsSent; |
347 | 356 | ||
348 | private int m_moneyBalance; | 357 | private int m_moneyBalance; |
358 | private bool m_deliverPackets = true; | ||
349 | private int m_animationSequenceNumber = 1; | 359 | private int m_animationSequenceNumber = 1; |
350 | private bool m_SendLogoutPacketWhenClosing = true; | 360 | private bool m_SendLogoutPacketWhenClosing = true; |
351 | 361 | ||
@@ -392,6 +402,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
392 | get { return m_startpos; } | 402 | get { return m_startpos; } |
393 | set { m_startpos = value; } | 403 | set { m_startpos = value; } |
394 | } | 404 | } |
405 | public bool DeliverPackets | ||
406 | { | ||
407 | get { return m_deliverPackets; } | ||
408 | set { | ||
409 | m_deliverPackets = value; | ||
410 | m_udpClient.m_deliverPackets = value; | ||
411 | } | ||
412 | } | ||
395 | public UUID AgentId { get { return m_agentId; } } | 413 | public UUID AgentId { get { return m_agentId; } } |
396 | public ISceneAgent SceneAgent { get; set; } | 414 | public ISceneAgent SceneAgent { get; set; } |
397 | public UUID ActiveGroupId { get { return m_activeGroupID; } } | 415 | public UUID ActiveGroupId { get { return m_activeGroupID; } } |
@@ -443,6 +461,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
443 | } | 461 | } |
444 | 462 | ||
445 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } | 463 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } |
464 | |||
446 | 465 | ||
447 | #endregion Properties | 466 | #endregion Properties |
448 | 467 | ||
@@ -469,7 +488,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
469 | m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); | 488 | m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); |
470 | m_entityProps = new PriorityQueue(m_scene.Entities.Count); | 489 | m_entityProps = new PriorityQueue(m_scene.Entities.Count); |
471 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); | 490 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); |
472 | m_killRecord = new HashSet<uint>(); | 491 | // m_killRecord = new HashSet<uint>(); |
473 | // m_attachmentsSent = new HashSet<uint>(); | 492 | // m_attachmentsSent = new HashSet<uint>(); |
474 | 493 | ||
475 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | 494 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); |
@@ -499,12 +518,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
499 | 518 | ||
500 | #region Client Methods | 519 | #region Client Methods |
501 | 520 | ||
521 | |||
522 | /// <summary> | ||
523 | /// Close down the client view | ||
524 | /// </summary> | ||
502 | public void Close() | 525 | public void Close() |
503 | { | 526 | { |
504 | Close(false); | 527 | Close(true, false); |
505 | } | 528 | } |
506 | 529 | ||
507 | public void Close(bool force) | 530 | public void Close(bool sendStop, bool force) |
508 | { | 531 | { |
509 | // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. | 532 | // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. |
510 | // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. | 533 | // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. |
@@ -516,7 +539,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
516 | return; | 539 | return; |
517 | 540 | ||
518 | IsActive = false; | 541 | IsActive = false; |
519 | CloseWithoutChecks(); | 542 | CloseWithoutChecks(sendStop); |
520 | } | 543 | } |
521 | } | 544 | } |
522 | 545 | ||
@@ -529,12 +552,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
529 | /// | 552 | /// |
530 | /// Callers must lock ClosingSyncLock before calling. | 553 | /// Callers must lock ClosingSyncLock before calling. |
531 | /// </remarks> | 554 | /// </remarks> |
532 | public void CloseWithoutChecks() | 555 | public void CloseWithoutChecks(bool sendStop) |
533 | { | 556 | { |
534 | m_log.DebugFormat( | 557 | m_log.DebugFormat( |
535 | "[CLIENT]: Close has been called for {0} attached to scene {1}", | 558 | "[CLIENT]: Close has been called for {0} attached to scene {1}", |
536 | Name, m_scene.RegionInfo.RegionName); | 559 | Name, m_scene.RegionInfo.RegionName); |
537 | 560 | ||
561 | if (sendStop) | ||
562 | { | ||
563 | // Send the STOP packet | ||
564 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | ||
565 | OutPacket(disable, ThrottleOutPacketType.Unknown); | ||
566 | } | ||
567 | |||
538 | // Shutdown the image manager | 568 | // Shutdown the image manager |
539 | ImageManager.Close(); | 569 | ImageManager.Close(); |
540 | 570 | ||
@@ -557,6 +587,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
557 | // Disable UDP handling for this client | 587 | // Disable UDP handling for this client |
558 | m_udpClient.Shutdown(); | 588 | m_udpClient.Shutdown(); |
559 | 589 | ||
590 | |||
560 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 591 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
561 | //GC.Collect(); | 592 | //GC.Collect(); |
562 | //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 593 | //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
@@ -791,9 +822,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
791 | handshake.RegionInfo3.ColoName = Utils.EmptyBytes; | 822 | handshake.RegionInfo3.ColoName = Utils.EmptyBytes; |
792 | handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); | 823 | handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); |
793 | handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; | 824 | handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; |
825 | |||
794 | handshake.RegionInfo4 = new RegionHandshakePacket.RegionInfo4Block[0]; | 826 | handshake.RegionInfo4 = new RegionHandshakePacket.RegionInfo4Block[0]; |
795 | 827 | // OutPacket(handshake, ThrottleOutPacketType.Task); | |
796 | OutPacket(handshake, ThrottleOutPacketType.Task); | 828 | // use same as MoveAgentIntoRegion (both should be task ) |
829 | OutPacket(handshake, ThrottleOutPacketType.Unknown); | ||
797 | } | 830 | } |
798 | 831 | ||
799 | public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) | 832 | public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) |
@@ -833,7 +866,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
833 | reply.ChatData.OwnerID = ownerID; | 866 | reply.ChatData.OwnerID = ownerID; |
834 | reply.ChatData.SourceID = fromAgentID; | 867 | reply.ChatData.SourceID = fromAgentID; |
835 | 868 | ||
836 | OutPacket(reply, ThrottleOutPacketType.Task); | 869 | OutPacket(reply, ThrottleOutPacketType.Unknown); |
837 | } | 870 | } |
838 | 871 | ||
839 | /// <summary> | 872 | /// <summary> |
@@ -866,32 +899,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
866 | msg.MessageBlock.Message = Util.StringToBytes1024(im.message); | 899 | msg.MessageBlock.Message = Util.StringToBytes1024(im.message); |
867 | msg.MessageBlock.BinaryBucket = im.binaryBucket; | 900 | msg.MessageBlock.BinaryBucket = im.binaryBucket; |
868 | 901 | ||
869 | if (im.message.StartsWith("[grouptest]")) | 902 | OutPacket(msg, ThrottleOutPacketType.Task); |
870 | { // this block is test code for implementing group IM - delete when group IM is finished | ||
871 | IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); | ||
872 | if (eq != null) | ||
873 | { | ||
874 | im.dialog = 17; | ||
875 | |||
876 | //eq.ChatterboxInvitation( | ||
877 | // new UUID("00000000-68f9-1111-024e-222222111123"), | ||
878 | // "OpenSimulator Testing", im.fromAgentID, im.message, im.toAgentID, im.fromAgentName, im.dialog, 0, | ||
879 | // false, 0, new Vector3(), 1, im.imSessionID, im.fromGroup, im.binaryBucket); | ||
880 | |||
881 | eq.ChatterboxInvitation( | ||
882 | new UUID("00000000-68f9-1111-024e-222222111123"), | ||
883 | "OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0, | ||
884 | false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Util.StringToBytes256("OpenSimulator Testing")); | ||
885 | |||
886 | eq.ChatterBoxSessionAgentListUpdates( | ||
887 | new UUID("00000000-68f9-1111-024e-222222111123"), | ||
888 | new UUID(im.fromAgentID), new UUID(im.toAgentID), false, false, false); | ||
889 | } | ||
890 | |||
891 | Console.WriteLine("SendInstantMessage: " + msg); | ||
892 | } | ||
893 | else | ||
894 | OutPacket(msg, ThrottleOutPacketType.Task); | ||
895 | } | 903 | } |
896 | } | 904 | } |
897 | 905 | ||
@@ -1119,6 +1127,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1119 | public virtual void SendLayerData(float[] map) | 1127 | public virtual void SendLayerData(float[] map) |
1120 | { | 1128 | { |
1121 | Util.FireAndForget(DoSendLayerData, map); | 1129 | Util.FireAndForget(DoSendLayerData, map); |
1130 | |||
1131 | // Send it sync, and async. It's not that much data | ||
1132 | // and it improves user experience just so much! | ||
1133 | DoSendLayerData(map); | ||
1122 | } | 1134 | } |
1123 | 1135 | ||
1124 | /// <summary> | 1136 | /// <summary> |
@@ -1131,16 +1143,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1131 | 1143 | ||
1132 | try | 1144 | try |
1133 | { | 1145 | { |
1134 | //for (int y = 0; y < 16; y++) | 1146 | for (int y = 0; y < 16; y++) |
1135 | //{ | 1147 | { |
1136 | // for (int x = 0; x < 16; x++) | 1148 | for (int x = 0; x < 16; x+=4) |
1137 | // { | 1149 | { |
1138 | // SendLayerData(x, y, map); | 1150 | SendLayerPacket(x, y, map); |
1139 | // } | 1151 | } |
1140 | //} | 1152 | } |
1141 | |||
1142 | // Send LayerData in a spiral pattern. Fun! | ||
1143 | SendLayerTopRight(map, 0, 0, 15, 15); | ||
1144 | } | 1153 | } |
1145 | catch (Exception e) | 1154 | catch (Exception e) |
1146 | { | 1155 | { |
@@ -1148,51 +1157,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1148 | } | 1157 | } |
1149 | } | 1158 | } |
1150 | 1159 | ||
1151 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | ||
1152 | { | ||
1153 | // Row | ||
1154 | for (int i = x1; i <= x2; i++) | ||
1155 | SendLayerData(i, y1, map); | ||
1156 | |||
1157 | // Column | ||
1158 | for (int j = y1 + 1; j <= y2; j++) | ||
1159 | SendLayerData(x2, j, map); | ||
1160 | |||
1161 | if (x2 - x1 > 0) | ||
1162 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | ||
1163 | } | ||
1164 | |||
1165 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | ||
1166 | { | ||
1167 | // Row in reverse | ||
1168 | for (int i = x2; i >= x1; i--) | ||
1169 | SendLayerData(i, y2, map); | ||
1170 | |||
1171 | // Column in reverse | ||
1172 | for (int j = y2 - 1; j >= y1; j--) | ||
1173 | SendLayerData(x1, j, map); | ||
1174 | |||
1175 | if (x2 - x1 > 0) | ||
1176 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | ||
1177 | } | ||
1178 | |||
1179 | /// <summary> | 1160 | /// <summary> |
1180 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client | 1161 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client |
1181 | /// </summary> | 1162 | /// </summary> |
1182 | /// <param name="map">heightmap</param> | 1163 | /// <param name="map">heightmap</param> |
1183 | /// <param name="px">X coordinate for patches 0..12</param> | 1164 | /// <param name="px">X coordinate for patches 0..12</param> |
1184 | /// <param name="py">Y coordinate for patches 0..15</param> | 1165 | /// <param name="py">Y coordinate for patches 0..15</param> |
1185 | // private void SendLayerPacket(float[] map, int y, int x) | 1166 | private void SendLayerPacket(int x, int y, float[] map) |
1186 | // { | 1167 | { |
1187 | // int[] patches = new int[4]; | 1168 | int[] patches = new int[4]; |
1188 | // patches[0] = x + 0 + y * 16; | 1169 | patches[0] = x + 0 + y * 16; |
1189 | // patches[1] = x + 1 + y * 16; | 1170 | patches[1] = x + 1 + y * 16; |
1190 | // patches[2] = x + 2 + y * 16; | 1171 | patches[2] = x + 2 + y * 16; |
1191 | // patches[3] = x + 3 + y * 16; | 1172 | patches[3] = x + 3 + y * 16; |
1192 | 1173 | ||
1193 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | 1174 | float[] heightmap = (map.Length == 65536) ? |
1194 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 1175 | map : |
1195 | // } | 1176 | LLHeightFieldMoronize(map); |
1177 | |||
1178 | try | ||
1179 | { | ||
1180 | Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
1181 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
1182 | } | ||
1183 | catch | ||
1184 | { | ||
1185 | for (int px = x ; px < x + 4 ; px++) | ||
1186 | SendLayerData(px, y, map); | ||
1187 | } | ||
1188 | } | ||
1196 | 1189 | ||
1197 | /// <summary> | 1190 | /// <summary> |
1198 | /// Sends a specified patch to a client | 1191 | /// Sends a specified patch to a client |
@@ -1212,7 +1205,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1212 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | 1205 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); |
1213 | layerpack.Header.Reliable = true; | 1206 | layerpack.Header.Reliable = true; |
1214 | 1207 | ||
1215 | OutPacket(layerpack, ThrottleOutPacketType.Land); | 1208 | OutPacket(layerpack, ThrottleOutPacketType.Task); |
1216 | } | 1209 | } |
1217 | catch (Exception e) | 1210 | catch (Exception e) |
1218 | { | 1211 | { |
@@ -1575,7 +1568,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1575 | 1568 | ||
1576 | public void SendKillObject(ulong regionHandle, List<uint> localIDs) | 1569 | public void SendKillObject(ulong regionHandle, List<uint> localIDs) |
1577 | { | 1570 | { |
1578 | // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); | 1571 | // foreach (uint id in localIDs) |
1572 | // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); | ||
1579 | 1573 | ||
1580 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); | 1574 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); |
1581 | // TODO: don't create new blocks if recycling an old packet | 1575 | // TODO: don't create new blocks if recycling an old packet |
@@ -1597,17 +1591,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1597 | // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race | 1591 | // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race |
1598 | // condition where a kill can be processed before an out-of-date update for the same object. | 1592 | // condition where a kill can be processed before an out-of-date update for the same object. |
1599 | // ProcessEntityUpdates() also takes the m_killRecord lock. | 1593 | // ProcessEntityUpdates() also takes the m_killRecord lock. |
1600 | lock (m_killRecord) | 1594 | // lock (m_killRecord) |
1601 | { | 1595 | // { |
1602 | foreach (uint localID in localIDs) | 1596 | // foreach (uint localID in localIDs) |
1603 | m_killRecord.Add(localID); | 1597 | // m_killRecord.Add(localID); |
1604 | 1598 | ||
1605 | // The throttle queue used here must match that being used for updates. Otherwise, there is a | 1599 | // The throttle queue used here must match that being used for updates. Otherwise, there is a |
1606 | // chance that a kill packet put on a separate queue will be sent to the client before an existing | 1600 | // chance that a kill packet put on a separate queue will be sent to the client before an existing |
1607 | // update packet on another queue. Receiving updates after kills results in unowned and undeletable | 1601 | // update packet on another queue. Receiving updates after kills results in unowned and undeletable |
1608 | // scene objects in a viewer until that viewer is relogged in. | 1602 | // scene objects in a viewer until that viewer is relogged in. |
1609 | OutPacket(kill, ThrottleOutPacketType.Task); | 1603 | OutPacket(kill, ThrottleOutPacketType.Task); |
1610 | } | 1604 | // } |
1611 | } | 1605 | } |
1612 | } | 1606 | } |
1613 | 1607 | ||
@@ -2066,9 +2060,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2066 | OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); | 2060 | OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); |
2067 | } | 2061 | } |
2068 | 2062 | ||
2069 | /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see> | ||
2070 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) | 2063 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) |
2071 | { | 2064 | { |
2065 | SendInventoryItemCreateUpdate(Item, UUID.Zero, callbackId); | ||
2066 | } | ||
2067 | |||
2068 | /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see> | ||
2069 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId) | ||
2070 | { | ||
2072 | const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff; | 2071 | const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff; |
2073 | 2072 | ||
2074 | UpdateCreateInventoryItemPacket InventoryReply | 2073 | UpdateCreateInventoryItemPacket InventoryReply |
@@ -2078,6 +2077,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2078 | // TODO: don't create new blocks if recycling an old packet | 2077 | // TODO: don't create new blocks if recycling an old packet |
2079 | InventoryReply.AgentData.AgentID = AgentId; | 2078 | InventoryReply.AgentData.AgentID = AgentId; |
2080 | InventoryReply.AgentData.SimApproved = true; | 2079 | InventoryReply.AgentData.SimApproved = true; |
2080 | InventoryReply.AgentData.TransactionID = transactionID; | ||
2081 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; | 2081 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; |
2082 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); | 2082 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); |
2083 | InventoryReply.InventoryData[0].ItemID = Item.ID; | 2083 | InventoryReply.InventoryData[0].ItemID = Item.ID; |
@@ -2147,16 +2147,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2147 | replytask.InventoryData.TaskID = taskID; | 2147 | replytask.InventoryData.TaskID = taskID; |
2148 | replytask.InventoryData.Serial = serial; | 2148 | replytask.InventoryData.Serial = serial; |
2149 | replytask.InventoryData.Filename = fileName; | 2149 | replytask.InventoryData.Filename = fileName; |
2150 | OutPacket(replytask, ThrottleOutPacketType.Asset); | 2150 | OutPacket(replytask, ThrottleOutPacketType.Task); |
2151 | } | 2151 | } |
2152 | 2152 | ||
2153 | public void SendXferPacket(ulong xferID, uint packet, byte[] data) | 2153 | public void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory) |
2154 | { | 2154 | { |
2155 | ThrottleOutPacketType type = ThrottleOutPacketType.Asset; | ||
2156 | if (isTaskInventory) | ||
2157 | type = ThrottleOutPacketType.Task; | ||
2158 | |||
2155 | SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); | 2159 | SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); |
2156 | sendXfer.XferID.ID = xferID; | 2160 | sendXfer.XferID.ID = xferID; |
2157 | sendXfer.XferID.Packet = packet; | 2161 | sendXfer.XferID.Packet = packet; |
2158 | sendXfer.DataPacket.Data = data; | 2162 | sendXfer.DataPacket.Data = data; |
2159 | OutPacket(sendXfer, ThrottleOutPacketType.Asset); | 2163 | OutPacket(sendXfer, type); |
2160 | } | 2164 | } |
2161 | 2165 | ||
2162 | public void SendAbortXferPacket(ulong xferID) | 2166 | public void SendAbortXferPacket(ulong xferID) |
@@ -2338,6 +2342,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2338 | OutPacket(sound, ThrottleOutPacketType.Task); | 2342 | OutPacket(sound, ThrottleOutPacketType.Task); |
2339 | } | 2343 | } |
2340 | 2344 | ||
2345 | public void SendTransferAbort(TransferRequestPacket transferRequest) | ||
2346 | { | ||
2347 | TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort); | ||
2348 | abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID; | ||
2349 | abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType; | ||
2350 | m_log.Debug("[Assets] Aborting transfer; asset request failed"); | ||
2351 | OutPacket(abort, ThrottleOutPacketType.Task); | ||
2352 | } | ||
2353 | |||
2341 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) | 2354 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) |
2342 | { | 2355 | { |
2343 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); | 2356 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); |
@@ -2646,6 +2659,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2646 | float friction = part.Friction; | 2659 | float friction = part.Friction; |
2647 | float bounce = part.Restitution; | 2660 | float bounce = part.Restitution; |
2648 | float gravmod = part.GravityModifier; | 2661 | float gravmod = part.GravityModifier; |
2662 | |||
2649 | eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); | 2663 | eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); |
2650 | } | 2664 | } |
2651 | } | 2665 | } |
@@ -2716,8 +2730,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2716 | req.AssetInf.ID, req.AssetInf.Metadata.ContentType); | 2730 | req.AssetInf.ID, req.AssetInf.Metadata.ContentType); |
2717 | return; | 2731 | return; |
2718 | } | 2732 | } |
2733 | int WearableOut = 0; | ||
2734 | bool isWearable = false; | ||
2719 | 2735 | ||
2720 | //m_log.Debug("sending asset " + req.RequestAssetID); | 2736 | if (req.AssetInf != null) |
2737 | isWearable = | ||
2738 | ((AssetType) req.AssetInf.Type == | ||
2739 | AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing); | ||
2740 | |||
2741 | |||
2742 | //m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable); | ||
2743 | |||
2744 | |||
2745 | //if (isWearable) | ||
2746 | // m_log.Debug((AssetType)req.AssetInf.Type); | ||
2747 | |||
2721 | TransferInfoPacket Transfer = new TransferInfoPacket(); | 2748 | TransferInfoPacket Transfer = new TransferInfoPacket(); |
2722 | Transfer.TransferInfo.ChannelType = 2; | 2749 | Transfer.TransferInfo.ChannelType = 2; |
2723 | Transfer.TransferInfo.Status = 0; | 2750 | Transfer.TransferInfo.Status = 0; |
@@ -2739,7 +2766,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2739 | Transfer.TransferInfo.Size = req.AssetInf.Data.Length; | 2766 | Transfer.TransferInfo.Size = req.AssetInf.Data.Length; |
2740 | Transfer.TransferInfo.TransferID = req.TransferRequestID; | 2767 | Transfer.TransferInfo.TransferID = req.TransferRequestID; |
2741 | Transfer.Header.Zerocoded = true; | 2768 | Transfer.Header.Zerocoded = true; |
2742 | OutPacket(Transfer, ThrottleOutPacketType.Asset); | 2769 | OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); |
2743 | 2770 | ||
2744 | if (req.NumPackets == 1) | 2771 | if (req.NumPackets == 1) |
2745 | { | 2772 | { |
@@ -2750,12 +2777,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2750 | TransferPacket.TransferData.Data = req.AssetInf.Data; | 2777 | TransferPacket.TransferData.Data = req.AssetInf.Data; |
2751 | TransferPacket.TransferData.Status = 1; | 2778 | TransferPacket.TransferData.Status = 1; |
2752 | TransferPacket.Header.Zerocoded = true; | 2779 | TransferPacket.Header.Zerocoded = true; |
2753 | OutPacket(TransferPacket, ThrottleOutPacketType.Asset); | 2780 | OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); |
2754 | } | 2781 | } |
2755 | else | 2782 | else |
2756 | { | 2783 | { |
2757 | int processedLength = 0; | 2784 | int processedLength = 0; |
2758 | int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; | 2785 | // int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; |
2786 | |||
2787 | int maxChunkSize = (int) MaxTransferBytesPerPacket; | ||
2759 | int packetNumber = 0; | 2788 | int packetNumber = 0; |
2760 | 2789 | ||
2761 | while (processedLength < req.AssetInf.Data.Length) | 2790 | while (processedLength < req.AssetInf.Data.Length) |
@@ -2781,7 +2810,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2781 | TransferPacket.TransferData.Status = 1; | 2810 | TransferPacket.TransferData.Status = 1; |
2782 | } | 2811 | } |
2783 | TransferPacket.Header.Zerocoded = true; | 2812 | TransferPacket.Header.Zerocoded = true; |
2784 | OutPacket(TransferPacket, ThrottleOutPacketType.Asset); | 2813 | OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); |
2785 | 2814 | ||
2786 | processedLength += chunkSize; | 2815 | processedLength += chunkSize; |
2787 | packetNumber++; | 2816 | packetNumber++; |
@@ -2826,7 +2855,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2826 | reply.Data.ParcelID = parcelID; | 2855 | reply.Data.ParcelID = parcelID; |
2827 | reply.Data.OwnerID = land.OwnerID; | 2856 | reply.Data.OwnerID = land.OwnerID; |
2828 | reply.Data.Name = Utils.StringToBytes(land.Name); | 2857 | reply.Data.Name = Utils.StringToBytes(land.Name); |
2829 | reply.Data.Desc = Utils.StringToBytes(land.Description); | 2858 | if (land != null && land.Description != null && land.Description != String.Empty) |
2859 | reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); | ||
2860 | else | ||
2861 | reply.Data.Desc = new Byte[0]; | ||
2830 | reply.Data.ActualArea = land.Area; | 2862 | reply.Data.ActualArea = land.Area; |
2831 | reply.Data.BillableArea = land.Area; // TODO: what is this? | 2863 | reply.Data.BillableArea = land.Area; // TODO: what is this? |
2832 | 2864 | ||
@@ -3533,24 +3565,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3533 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; | 3565 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; |
3534 | AgentWearablesUpdatePacket.WearableDataBlock awb; | 3566 | AgentWearablesUpdatePacket.WearableDataBlock awb; |
3535 | int idx = 0; | 3567 | int idx = 0; |
3536 | for (int i = 0; i < wearables.Length; i++) | 3568 | |
3537 | { | 3569 | for (int i = 0; i < wearables.Length; i++) |
3538 | for (int j = 0; j < wearables[i].Count; j++) | 3570 | { |
3539 | { | 3571 | for (int j = 0; j < wearables[i].Count; j++) |
3540 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | 3572 | { |
3541 | awb.WearableType = (byte)i; | 3573 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); |
3542 | awb.AssetID = wearables[i][j].AssetID; | 3574 | awb.WearableType = (byte) i; |
3543 | awb.ItemID = wearables[i][j].ItemID; | 3575 | awb.AssetID = wearables[i][j].AssetID; |
3544 | aw.WearableData[idx] = awb; | 3576 | awb.ItemID = wearables[i][j].ItemID; |
3545 | idx++; | 3577 | aw.WearableData[idx] = awb; |
3546 | 3578 | idx++; | |
3547 | // m_log.DebugFormat( | 3579 | |
3548 | // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", | 3580 | // m_log.DebugFormat( |
3549 | // awb.ItemID, awb.AssetID, i, Name); | 3581 | // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", |
3550 | } | 3582 | // awb.ItemID, awb.AssetID, i, Name); |
3551 | } | 3583 | } |
3584 | } | ||
3552 | 3585 | ||
3553 | OutPacket(aw, ThrottleOutPacketType.Task); | 3586 | OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); |
3554 | } | 3587 | } |
3555 | 3588 | ||
3556 | public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) | 3589 | public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) |
@@ -3561,7 +3594,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3561 | 3594 | ||
3562 | AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); | 3595 | AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); |
3563 | // TODO: don't create new blocks if recycling an old packet | 3596 | // TODO: don't create new blocks if recycling an old packet |
3564 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | 3597 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length]; |
3565 | avp.ObjectData.TextureEntry = textureEntry; | 3598 | avp.ObjectData.TextureEntry = textureEntry; |
3566 | 3599 | ||
3567 | AvatarAppearancePacket.VisualParamBlock avblock = null; | 3600 | AvatarAppearancePacket.VisualParamBlock avblock = null; |
@@ -3692,7 +3725,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3692 | /// </summary> | 3725 | /// </summary> |
3693 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) | 3726 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) |
3694 | { | 3727 | { |
3695 | //double priority = m_prioritizer.GetUpdatePriority(this, entity); | 3728 | if (entity is SceneObjectPart) |
3729 | { | ||
3730 | SceneObjectPart e = (SceneObjectPart)entity; | ||
3731 | SceneObjectGroup g = e.ParentGroup; | ||
3732 | if (g.RootPart.Shape.State > 30) // HUD | ||
3733 | if (g.OwnerID != AgentId) | ||
3734 | return; // Don't send updates for other people's HUDs | ||
3735 | } | ||
3736 | |||
3696 | uint priority = m_prioritizer.GetUpdatePriority(this, entity); | 3737 | uint priority = m_prioritizer.GetUpdatePriority(this, entity); |
3697 | 3738 | ||
3698 | lock (m_entityUpdates.SyncRoot) | 3739 | lock (m_entityUpdates.SyncRoot) |
@@ -3759,27 +3800,74 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3759 | 3800 | ||
3760 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race | 3801 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race |
3761 | // condition where a kill can be processed before an out-of-date update for the same object. | 3802 | // condition where a kill can be processed before an out-of-date update for the same object. |
3762 | lock (m_killRecord) | 3803 | float avgTimeDilation = 1.0f; |
3804 | IEntityUpdate iupdate; | ||
3805 | Int32 timeinqueue; // this is just debugging code & can be dropped later | ||
3806 | |||
3807 | while (updatesThisCall < maxUpdates) | ||
3763 | { | 3808 | { |
3764 | float avgTimeDilation = 1.0f; | 3809 | lock (m_entityUpdates.SyncRoot) |
3765 | IEntityUpdate iupdate; | 3810 | if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue)) |
3766 | Int32 timeinqueue; // this is just debugging code & can be dropped later | 3811 | break; |
3812 | |||
3813 | EntityUpdate update = (EntityUpdate)iupdate; | ||
3814 | |||
3815 | avgTimeDilation += update.TimeDilation; | ||
3816 | avgTimeDilation *= 0.5f; | ||
3767 | 3817 | ||
3768 | while (updatesThisCall < maxUpdates) | 3818 | if (update.Entity is SceneObjectPart) |
3769 | { | 3819 | { |
3770 | lock (m_entityUpdates.SyncRoot) | 3820 | SceneObjectPart part = (SceneObjectPart)update.Entity; |
3771 | if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue)) | ||
3772 | break; | ||
3773 | 3821 | ||
3774 | EntityUpdate update = (EntityUpdate)iupdate; | 3822 | if (part.ParentGroup.IsDeleted) |
3775 | 3823 | continue; | |
3776 | avgTimeDilation += update.TimeDilation; | ||
3777 | avgTimeDilation *= 0.5f; | ||
3778 | 3824 | ||
3779 | if (update.Entity is SceneObjectPart) | 3825 | if (part.ParentGroup.IsAttachment) |
3826 | { // Someone else's HUD, why are we getting these? | ||
3827 | if (part.ParentGroup.OwnerID != AgentId && | ||
3828 | part.ParentGroup.RootPart.Shape.State > 30) | ||
3829 | continue; | ||
3830 | ScenePresence sp; | ||
3831 | // Owner is not in the sim, don't update it to | ||
3832 | // anyone | ||
3833 | if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) | ||
3834 | continue; | ||
3835 | |||
3836 | List<SceneObjectGroup> atts = sp.GetAttachments(); | ||
3837 | bool found = false; | ||
3838 | foreach (SceneObjectGroup att in atts) | ||
3839 | { | ||
3840 | if (att == part.ParentGroup) | ||
3841 | { | ||
3842 | found = true; | ||
3843 | break; | ||
3844 | } | ||
3845 | } | ||
3846 | |||
3847 | // It's an attachment of a valid avatar, but | ||
3848 | // doesn't seem to be attached, skip | ||
3849 | if (!found) | ||
3850 | continue; | ||
3851 | |||
3852 | // On vehicle crossing, the attachments are received | ||
3853 | // while the avatar is still a child. Don't send | ||
3854 | // updates here because the LocalId has not yet | ||
3855 | // been updated and the viewer will derender the | ||
3856 | // attachments until the avatar becomes root. | ||
3857 | if (sp.IsChildAgent) | ||
3858 | continue; | ||
3859 | |||
3860 | // If the object is an attachment we don't want it to be in the kill | ||
3861 | // record. Else attaching from inworld and subsequently dropping | ||
3862 | // it will no longer work. | ||
3863 | // lock (m_killRecord) | ||
3864 | // { | ||
3865 | // m_killRecord.Remove(part.LocalId); | ||
3866 | // m_killRecord.Remove(part.ParentGroup.RootPart.LocalId); | ||
3867 | // } | ||
3868 | } | ||
3869 | else | ||
3780 | { | 3870 | { |
3781 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3782 | |||
3783 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client | 3871 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client |
3784 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good | 3872 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good |
3785 | // safety measure. | 3873 | // safety measure. |
@@ -3790,21 +3878,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3790 | // | 3878 | // |
3791 | // This doesn't appear to apply to child prims - a client will happily ignore these updates | 3879 | // This doesn't appear to apply to child prims - a client will happily ignore these updates |
3792 | // after the root prim has been deleted. | 3880 | // after the root prim has been deleted. |
3793 | if (m_killRecord.Contains(part.LocalId)) | 3881 | // |
3794 | { | 3882 | // We ignore this for attachments because attaching something from inworld breaks unless we do. |
3795 | // m_log.WarnFormat( | 3883 | // lock (m_killRecord) |
3796 | // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted", | 3884 | // { |
3797 | // part.LocalId, Name); | 3885 | // if (m_killRecord.Contains(part.LocalId)) |
3798 | continue; | 3886 | // continue; |
3799 | } | 3887 | // if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) |
3800 | 3888 | // continue; | |
3801 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | 3889 | // } |
3890 | } | ||
3891 | |||
3892 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | ||
3893 | { | ||
3894 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | ||
3895 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | ||
3802 | { | 3896 | { |
3803 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | 3897 | part.Shape.LightEntry = false; |
3804 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | ||
3805 | { | ||
3806 | part.Shape.LightEntry = false; | ||
3807 | } | ||
3808 | } | 3898 | } |
3809 | 3899 | ||
3810 | if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) | 3900 | if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) |
@@ -3815,224 +3905,166 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3815 | part.Shape.ProfileHollow = 27500; | 3905 | part.Shape.ProfileHollow = 27500; |
3816 | } | 3906 | } |
3817 | } | 3907 | } |
3818 | 3908 | ||
3819 | #region UpdateFlags to packet type conversion | 3909 | if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) |
3820 | |||
3821 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; | ||
3822 | |||
3823 | bool canUseCompressed = true; | ||
3824 | bool canUseImproved = true; | ||
3825 | |||
3826 | // Compressed object updates only make sense for LL primitives | ||
3827 | if (!(update.Entity is SceneObjectPart)) | ||
3828 | { | 3910 | { |
3829 | canUseCompressed = false; | 3911 | // Ensure that mesh has at least 8 valid faces |
3912 | part.Shape.ProfileBegin = 12500; | ||
3913 | part.Shape.ProfileEnd = 0; | ||
3914 | part.Shape.ProfileHollow = 27500; | ||
3830 | } | 3915 | } |
3831 | 3916 | } | |
3832 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | 3917 | |
3918 | ++updatesThisCall; | ||
3919 | |||
3920 | #region UpdateFlags to packet type conversion | ||
3921 | |||
3922 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; | ||
3923 | |||
3924 | bool canUseCompressed = true; | ||
3925 | bool canUseImproved = true; | ||
3926 | |||
3927 | // Compressed object updates only make sense for LL primitives | ||
3928 | if (!(update.Entity is SceneObjectPart)) | ||
3929 | { | ||
3930 | canUseCompressed = false; | ||
3931 | } | ||
3932 | |||
3933 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | ||
3934 | { | ||
3935 | canUseCompressed = false; | ||
3936 | canUseImproved = false; | ||
3937 | } | ||
3938 | else | ||
3939 | { | ||
3940 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || | ||
3941 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || | ||
3942 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || | ||
3943 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3833 | { | 3944 | { |
3834 | canUseCompressed = false; | 3945 | canUseCompressed = false; |
3835 | canUseImproved = false; | ||
3836 | } | 3946 | } |
3837 | else | 3947 | |
3948 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || | ||
3949 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
3950 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
3951 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
3952 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
3953 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
3954 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
3955 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
3956 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
3957 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
3958 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
3959 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
3960 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
3961 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3838 | { | 3962 | { |
3839 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || | 3963 | canUseImproved = false; |
3840 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || | ||
3841 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || | ||
3842 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3843 | { | ||
3844 | canUseCompressed = false; | ||
3845 | } | ||
3846 | |||
3847 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || | ||
3848 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
3849 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
3850 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
3851 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
3852 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
3853 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
3854 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
3855 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
3856 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
3857 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
3858 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
3859 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
3860 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3861 | { | ||
3862 | canUseImproved = false; | ||
3863 | } | ||
3864 | } | 3964 | } |
3965 | } | ||
3865 | 3966 | ||
3866 | #endregion UpdateFlags to packet type conversion | 3967 | #endregion UpdateFlags to packet type conversion |
3867 | |||
3868 | #region Block Construction | ||
3869 | |||
3870 | // TODO: Remove this once we can build compressed updates | ||
3871 | canUseCompressed = false; | ||
3872 | |||
3873 | if (!canUseImproved && !canUseCompressed) | ||
3874 | { | ||
3875 | ObjectUpdatePacket.ObjectDataBlock updateBlock; | ||
3876 | 3968 | ||
3877 | if (update.Entity is ScenePresence) | 3969 | #region Block Construction |
3878 | { | ||
3879 | updateBlock = CreateAvatarUpdateBlock((ScenePresence)update.Entity); | ||
3880 | } | ||
3881 | else | ||
3882 | { | ||
3883 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3884 | updateBlock = CreatePrimUpdateBlock(part, AgentId); | ||
3885 | |||
3886 | // If the part has become a private hud since the update was scheduled then we do not | ||
3887 | // want to send it to other avatars. | ||
3888 | if (part.ParentGroup.IsAttachment | ||
3889 | && part.ParentGroup.HasPrivateAttachmentPoint | ||
3890 | && part.ParentGroup.AttachedAvatar != AgentId) | ||
3891 | continue; | ||
3892 | |||
3893 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3894 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3895 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3896 | // of the test above). | ||
3897 | // | ||
3898 | // Actual deletions (kills) happen in another method. | ||
3899 | if (part.ParentGroup.IsDeleted) | ||
3900 | continue; | ||
3901 | } | ||
3902 | 3970 | ||
3903 | objectUpdateBlocks.Value.Add(updateBlock); | 3971 | // TODO: Remove this once we can build compressed updates |
3904 | objectUpdates.Value.Add(update); | 3972 | canUseCompressed = false; |
3905 | } | ||
3906 | else if (!canUseImproved) | ||
3907 | { | ||
3908 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3909 | ObjectUpdateCompressedPacket.ObjectDataBlock compressedBlock | ||
3910 | = CreateCompressedUpdateBlock(part, updateFlags); | ||
3911 | |||
3912 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3913 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3914 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3915 | // of the test above). | ||
3916 | // | ||
3917 | // Actual deletions (kills) happen in another method. | ||
3918 | if (part.ParentGroup.IsDeleted) | ||
3919 | continue; | ||
3920 | 3973 | ||
3921 | compressedUpdateBlocks.Value.Add(compressedBlock); | 3974 | if (!canUseImproved && !canUseCompressed) |
3922 | compressedUpdates.Value.Add(update); | 3975 | { |
3976 | if (update.Entity is ScenePresence) | ||
3977 | { | ||
3978 | objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); | ||
3923 | } | 3979 | } |
3924 | else | 3980 | else |
3925 | { | 3981 | { |
3926 | if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) | 3982 | objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); |
3927 | { | ||
3928 | // Self updates go into a special list | ||
3929 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3930 | terseAgentUpdates.Value.Add(update); | ||
3931 | } | ||
3932 | else | ||
3933 | { | ||
3934 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseUpdateBlock | ||
3935 | = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); | ||
3936 | |||
3937 | // Everything else goes here | ||
3938 | if (update.Entity is SceneObjectPart) | ||
3939 | { | ||
3940 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3941 | |||
3942 | // If the part has become a private hud since the update was scheduled then we do not | ||
3943 | // want to send it to other avatars. | ||
3944 | if (part.ParentGroup.IsAttachment | ||
3945 | && part.ParentGroup.HasPrivateAttachmentPoint | ||
3946 | && part.ParentGroup.AttachedAvatar != AgentId) | ||
3947 | continue; | ||
3948 | |||
3949 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3950 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3951 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3952 | // of the test above). | ||
3953 | // | ||
3954 | // Actual deletions (kills) happen in another method. | ||
3955 | if (part.ParentGroup.IsDeleted) | ||
3956 | continue; | ||
3957 | } | ||
3958 | |||
3959 | terseUpdateBlocks.Value.Add(terseUpdateBlock); | ||
3960 | terseUpdates.Value.Add(update); | ||
3961 | } | ||
3962 | } | 3983 | } |
3963 | |||
3964 | ++updatesThisCall; | ||
3965 | |||
3966 | #endregion Block Construction | ||
3967 | } | 3984 | } |
3968 | 3985 | else if (!canUseImproved) | |
3969 | #region Packet Sending | 3986 | { |
3970 | ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); | 3987 | compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); |
3971 | 3988 | } | |
3972 | if (terseAgentUpdateBlocks.IsValueCreated) | 3989 | else |
3973 | { | 3990 | { |
3974 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | 3991 | if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) |
3992 | // Self updates go into a special list | ||
3993 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3994 | else | ||
3995 | // Everything else goes here | ||
3996 | terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3997 | } | ||
3975 | 3998 | ||
3976 | ImprovedTerseObjectUpdatePacket packet | 3999 | #endregion Block Construction |
3977 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); | 4000 | } |
3978 | 4001 | ||
3979 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 4002 | #region Packet Sending |
3980 | packet.RegionData.TimeDilation = timeDilation; | 4003 | |
3981 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | 4004 | const float TIME_DILATION = 1.0f; |
4005 | ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); | ||
4006 | |||
4007 | if (terseAgentUpdateBlocks.IsValueCreated) | ||
4008 | { | ||
4009 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | ||
3982 | 4010 | ||
3983 | for (int i = 0; i < blocks.Count; i++) | 4011 | ImprovedTerseObjectUpdatePacket packet |
3984 | packet.ObjectData[i] = blocks[i]; | 4012 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); |
3985 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | 4013 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; |
3986 | OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); }); | 4014 | packet.RegionData.TimeDilation = timeDilation; |
3987 | } | 4015 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; |
3988 | 4016 | ||
3989 | if (objectUpdateBlocks.IsValueCreated) | 4017 | for (int i = 0; i < blocks.Count; i++) |
3990 | { | 4018 | packet.ObjectData[i] = blocks[i]; |
3991 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; | ||
3992 | |||
3993 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | ||
3994 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3995 | packet.RegionData.TimeDilation = timeDilation; | ||
3996 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
3997 | |||
3998 | for (int i = 0; i < blocks.Count; i++) | ||
3999 | packet.ObjectData[i] = blocks[i]; | ||
4000 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
4001 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); }); | ||
4002 | } | ||
4003 | |||
4004 | if (compressedUpdateBlocks.IsValueCreated) | ||
4005 | { | ||
4006 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | ||
4007 | |||
4008 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
4009 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4010 | packet.RegionData.TimeDilation = timeDilation; | ||
4011 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
4012 | |||
4013 | for (int i = 0; i < blocks.Count; i++) | ||
4014 | packet.ObjectData[i] = blocks[i]; | ||
4015 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
4016 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); }); | ||
4017 | } | ||
4018 | 4019 | ||
4019 | if (terseUpdateBlocks.IsValueCreated) | 4020 | OutPacket(packet, ThrottleOutPacketType.Unknown, true); |
4020 | { | 4021 | } |
4021 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | ||
4022 | |||
4023 | ImprovedTerseObjectUpdatePacket packet | ||
4024 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( | ||
4025 | PacketType.ImprovedTerseObjectUpdate); | ||
4026 | 4022 | ||
4027 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 4023 | if (objectUpdateBlocks.IsValueCreated) |
4028 | packet.RegionData.TimeDilation = timeDilation; | 4024 | { |
4029 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | 4025 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; |
4030 | 4026 | ||
4031 | for (int i = 0; i < blocks.Count; i++) | 4027 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
4032 | packet.ObjectData[i] = blocks[i]; | 4028 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; |
4033 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | 4029 | packet.RegionData.TimeDilation = timeDilation; |
4034 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | 4030 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; |
4035 | } | 4031 | |
4032 | for (int i = 0; i < blocks.Count; i++) | ||
4033 | packet.ObjectData[i] = blocks[i]; | ||
4034 | |||
4035 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4036 | } | ||
4037 | |||
4038 | if (compressedUpdateBlocks.IsValueCreated) | ||
4039 | { | ||
4040 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | ||
4041 | |||
4042 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
4043 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4044 | packet.RegionData.TimeDilation = timeDilation; | ||
4045 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
4046 | |||
4047 | for (int i = 0; i < blocks.Count; i++) | ||
4048 | packet.ObjectData[i] = blocks[i]; | ||
4049 | |||
4050 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4051 | } | ||
4052 | |||
4053 | if (terseUpdateBlocks.IsValueCreated) | ||
4054 | { | ||
4055 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | ||
4056 | |||
4057 | ImprovedTerseObjectUpdatePacket packet | ||
4058 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( | ||
4059 | PacketType.ImprovedTerseObjectUpdate); | ||
4060 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4061 | packet.RegionData.TimeDilation = timeDilation; | ||
4062 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
4063 | |||
4064 | for (int i = 0; i < blocks.Count; i++) | ||
4065 | packet.ObjectData[i] = blocks[i]; | ||
4066 | |||
4067 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | ||
4036 | } | 4068 | } |
4037 | 4069 | ||
4038 | #endregion Packet Sending | 4070 | #endregion Packet Sending |
@@ -4325,11 +4357,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4325 | 4357 | ||
4326 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties | 4358 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties |
4327 | // of the object rather than the properties when the packet was created | 4359 | // of the object rather than the properties when the packet was created |
4328 | OutPacket(packet, ThrottleOutPacketType.Task, true, | 4360 | // HACK : Remove intelligent resending until it's fixed in core |
4329 | delegate(OutgoingPacket oPacket) | 4361 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4330 | { | 4362 | // delegate(OutgoingPacket oPacket) |
4331 | ResendPropertyUpdates(updates, oPacket); | 4363 | // { |
4332 | }); | 4364 | // ResendPropertyUpdates(updates, oPacket); |
4365 | // }); | ||
4366 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4333 | 4367 | ||
4334 | // pbcnt += blocks.Count; | 4368 | // pbcnt += blocks.Count; |
4335 | // ppcnt++; | 4369 | // ppcnt++; |
@@ -4355,11 +4389,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4355 | // of the object rather than the properties when the packet was created | 4389 | // of the object rather than the properties when the packet was created |
4356 | List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); | 4390 | List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); |
4357 | updates.Add(familyUpdates.Value[i]); | 4391 | updates.Add(familyUpdates.Value[i]); |
4358 | OutPacket(packet, ThrottleOutPacketType.Task, true, | 4392 | // HACK : Remove intelligent resending until it's fixed in core |
4359 | delegate(OutgoingPacket oPacket) | 4393 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4360 | { | 4394 | // delegate(OutgoingPacket oPacket) |
4361 | ResendPropertyUpdates(updates, oPacket); | 4395 | // { |
4362 | }); | 4396 | // ResendPropertyUpdates(updates, oPacket); |
4397 | // }); | ||
4398 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4363 | 4399 | ||
4364 | // fpcnt++; | 4400 | // fpcnt++; |
4365 | // fbcnt++; | 4401 | // fbcnt++; |
@@ -4731,7 +4767,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4731 | 4767 | ||
4732 | if (landData.SimwideArea > 0) | 4768 | if (landData.SimwideArea > 0) |
4733 | { | 4769 | { |
4734 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); | 4770 | int simulatorCapacity = (int)((long)landData.SimwideArea * (long)m_scene.RegionInfo.ObjectCapacity * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus / 65536L); |
4771 | // Never report more than sim total capacity | ||
4772 | if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity) | ||
4773 | simulatorCapacity = m_scene.RegionInfo.ObjectCapacity; | ||
4735 | updateMessage.SimWideMaxPrims = simulatorCapacity; | 4774 | updateMessage.SimWideMaxPrims = simulatorCapacity; |
4736 | } | 4775 | } |
4737 | else | 4776 | else |
@@ -4860,14 +4899,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4860 | 4899 | ||
4861 | if (notifyCount > 0) | 4900 | if (notifyCount > 0) |
4862 | { | 4901 | { |
4863 | if (notifyCount > 32) | 4902 | // if (notifyCount > 32) |
4864 | { | 4903 | // { |
4865 | m_log.InfoFormat( | 4904 | // m_log.InfoFormat( |
4866 | "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" | 4905 | // "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" |
4867 | + " - a developer might want to investigate whether this is a hard limit", 32); | 4906 | // + " - a developer might want to investigate whether this is a hard limit", 32); |
4868 | 4907 | // | |
4869 | notifyCount = 32; | 4908 | // notifyCount = 32; |
4870 | } | 4909 | // } |
4871 | 4910 | ||
4872 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock | 4911 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock |
4873 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; | 4912 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; |
@@ -4922,9 +4961,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4922 | { | 4961 | { |
4923 | ScenePresence presence = (ScenePresence)entity; | 4962 | ScenePresence presence = (ScenePresence)entity; |
4924 | 4963 | ||
4964 | position = presence.OffsetPosition; | ||
4965 | rotation = presence.Rotation; | ||
4966 | |||
4967 | if (presence.ParentID != 0) | ||
4968 | { | ||
4969 | SceneObjectPart part = m_scene.GetSceneObjectPart(presence.ParentID); | ||
4970 | if (part != null && part != part.ParentGroup.RootPart) | ||
4971 | { | ||
4972 | position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset; | ||
4973 | rotation = part.RotationOffset * presence.Rotation; | ||
4974 | } | ||
4975 | angularVelocity = Vector3.Zero; | ||
4976 | } | ||
4977 | else | ||
4978 | { | ||
4979 | angularVelocity = presence.AngularVelocity; | ||
4980 | rotation = presence.Rotation; | ||
4981 | } | ||
4982 | |||
4925 | attachPoint = 0; | 4983 | attachPoint = 0; |
4926 | collisionPlane = presence.CollisionPlane; | 4984 | collisionPlane = presence.CollisionPlane; |
4927 | position = presence.OffsetPosition; | ||
4928 | velocity = presence.Velocity; | 4985 | velocity = presence.Velocity; |
4929 | acceleration = Vector3.Zero; | 4986 | acceleration = Vector3.Zero; |
4930 | 4987 | ||
@@ -4933,9 +4990,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4933 | // may improve movement smoothness. | 4990 | // may improve movement smoothness. |
4934 | // acceleration = new Vector3(1, 0, 0); | 4991 | // acceleration = new Vector3(1, 0, 0); |
4935 | 4992 | ||
4936 | angularVelocity = presence.AngularVelocity; | ||
4937 | rotation = presence.Rotation; | ||
4938 | |||
4939 | if (sendTexture) | 4993 | if (sendTexture) |
4940 | textureEntry = presence.Appearance.Texture.GetBytes(); | 4994 | textureEntry = presence.Appearance.Texture.GetBytes(); |
4941 | else | 4995 | else |
@@ -5041,13 +5095,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5041 | 5095 | ||
5042 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) | 5096 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) |
5043 | { | 5097 | { |
5098 | Vector3 offsetPosition = data.OffsetPosition; | ||
5099 | Quaternion rotation = data.Rotation; | ||
5100 | uint parentID = data.ParentID; | ||
5101 | |||
5102 | if (parentID != 0) | ||
5103 | { | ||
5104 | SceneObjectPart part = m_scene.GetSceneObjectPart(parentID); | ||
5105 | if (part != null && part != part.ParentGroup.RootPart) | ||
5106 | { | ||
5107 | offsetPosition = part.OffsetPosition + data.OffsetPosition * part.RotationOffset; | ||
5108 | rotation = part.RotationOffset * data.Rotation; | ||
5109 | parentID = part.ParentGroup.RootPart.LocalId; | ||
5110 | } | ||
5111 | } | ||
5112 | |||
5044 | byte[] objectData = new byte[76]; | 5113 | byte[] objectData = new byte[76]; |
5045 | 5114 | ||
5046 | data.CollisionPlane.ToBytes(objectData, 0); | 5115 | data.CollisionPlane.ToBytes(objectData, 0); |
5047 | data.OffsetPosition.ToBytes(objectData, 16); | 5116 | offsetPosition.ToBytes(objectData, 16); |
5048 | // data.Velocity.ToBytes(objectData, 28); | 5117 | // data.Velocity.ToBytes(objectData, 28); |
5049 | // data.Acceleration.ToBytes(objectData, 40); | 5118 | // data.Acceleration.ToBytes(objectData, 40); |
5050 | data.Rotation.ToBytes(objectData, 52); | 5119 | rotation.ToBytes(objectData, 52); |
5051 | //data.AngularVelocity.ToBytes(objectData, 64); | 5120 | //data.AngularVelocity.ToBytes(objectData, 64); |
5052 | 5121 | ||
5053 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); | 5122 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); |
@@ -5061,14 +5130,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5061 | update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + | 5130 | update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + |
5062 | data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); | 5131 | data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); |
5063 | update.ObjectData = objectData; | 5132 | update.ObjectData = objectData; |
5064 | update.ParentID = data.ParentID; | 5133 | update.ParentID = parentID; |
5065 | update.PathCurve = 16; | 5134 | update.PathCurve = 16; |
5066 | update.PathScaleX = 100; | 5135 | update.PathScaleX = 100; |
5067 | update.PathScaleY = 100; | 5136 | update.PathScaleY = 100; |
5068 | update.PCode = (byte)PCode.Avatar; | 5137 | update.PCode = (byte)PCode.Avatar; |
5069 | update.ProfileCurve = 1; | 5138 | update.ProfileCurve = 1; |
5070 | update.PSBlock = Utils.EmptyBytes; | 5139 | update.PSBlock = Utils.EmptyBytes; |
5071 | update.Scale = new Vector3(0.45f, 0.6f, 1.9f); | 5140 | update.Scale = data.Appearance.AvatarSize; |
5141 | // update.Scale.Z -= 0.2f; | ||
5142 | |||
5072 | update.Text = Utils.EmptyBytes; | 5143 | update.Text = Utils.EmptyBytes; |
5073 | update.TextColor = new byte[4]; | 5144 | update.TextColor = new byte[4]; |
5074 | 5145 | ||
@@ -5079,10 +5150,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5079 | update.TextureEntry = Utils.EmptyBytes; | 5150 | update.TextureEntry = Utils.EmptyBytes; |
5080 | // update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; | 5151 | // update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; |
5081 | 5152 | ||
5153 | /* 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) | ||
5082 | update.UpdateFlags = (uint)( | 5154 | update.UpdateFlags = (uint)( |
5083 | PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | | 5155 | PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | |
5084 | PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | | 5156 | PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | |
5085 | PrimFlags.ObjectOwnerModify); | 5157 | PrimFlags.ObjectOwnerModify); |
5158 | */ | ||
5159 | update.UpdateFlags = 0; | ||
5086 | 5160 | ||
5087 | return update; | 5161 | return update; |
5088 | } | 5162 | } |
@@ -5253,8 +5327,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5253 | // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs | 5327 | // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs |
5254 | // for each AgentUpdate packet. | 5328 | // for each AgentUpdate packet. |
5255 | AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false); | 5329 | AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false); |
5256 | 5330 | ||
5257 | AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false); | 5331 | AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false); |
5332 | AddLocalPacketHandler(PacketType.VelocityInterpolateOff, HandleVelocityInterpolateOff, false); | ||
5333 | AddLocalPacketHandler(PacketType.VelocityInterpolateOn, HandleVelocityInterpolateOn, false); | ||
5258 | AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false); | 5334 | AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false); |
5259 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); | 5335 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); |
5260 | AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); | 5336 | AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); |
@@ -5406,6 +5482,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5406 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); | 5482 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); |
5407 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); | 5483 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); |
5408 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); | 5484 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); |
5485 | AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments); | ||
5409 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); | 5486 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); |
5410 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); | 5487 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); |
5411 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); | 5488 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); |
@@ -5472,6 +5549,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5472 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); | 5549 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); |
5473 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); | 5550 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); |
5474 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); | 5551 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); |
5552 | AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags); | ||
5475 | 5553 | ||
5476 | AddGenericPacketHandler("autopilot", HandleAutopilot); | 5554 | AddGenericPacketHandler("autopilot", HandleAutopilot); |
5477 | } | 5555 | } |
@@ -5510,6 +5588,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5510 | (x.CameraLeftAxis != m_lastAgentUpdateArgs.CameraLeftAxis) || | 5588 | (x.CameraLeftAxis != m_lastAgentUpdateArgs.CameraLeftAxis) || |
5511 | (x.CameraUpAxis != m_lastAgentUpdateArgs.CameraUpAxis) || | 5589 | (x.CameraUpAxis != m_lastAgentUpdateArgs.CameraUpAxis) || |
5512 | (x.ControlFlags != m_lastAgentUpdateArgs.ControlFlags) || | 5590 | (x.ControlFlags != m_lastAgentUpdateArgs.ControlFlags) || |
5591 | (x.ControlFlags != 0) || | ||
5513 | (x.Far != m_lastAgentUpdateArgs.Far) || | 5592 | (x.Far != m_lastAgentUpdateArgs.Far) || |
5514 | (x.Flags != m_lastAgentUpdateArgs.Flags) || | 5593 | (x.Flags != m_lastAgentUpdateArgs.Flags) || |
5515 | (x.State != m_lastAgentUpdateArgs.State) || | 5594 | (x.State != m_lastAgentUpdateArgs.State) || |
@@ -5769,6 +5848,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5769 | return true; | 5848 | return true; |
5770 | } | 5849 | } |
5771 | 5850 | ||
5851 | private bool HandleVelocityInterpolateOff(IClientAPI sender, Packet Pack) | ||
5852 | { | ||
5853 | VelocityInterpolateOffPacket p = (VelocityInterpolateOffPacket)Pack; | ||
5854 | if (p.AgentData.SessionID != SessionId || | ||
5855 | p.AgentData.AgentID != AgentId) | ||
5856 | return true; | ||
5857 | |||
5858 | m_VelocityInterpolate = false; | ||
5859 | return true; | ||
5860 | } | ||
5861 | |||
5862 | private bool HandleVelocityInterpolateOn(IClientAPI sender, Packet Pack) | ||
5863 | { | ||
5864 | VelocityInterpolateOnPacket p = (VelocityInterpolateOnPacket)Pack; | ||
5865 | if (p.AgentData.SessionID != SessionId || | ||
5866 | p.AgentData.AgentID != AgentId) | ||
5867 | return true; | ||
5868 | |||
5869 | m_VelocityInterpolate = true; | ||
5870 | return true; | ||
5871 | } | ||
5872 | |||
5873 | |||
5772 | private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack) | 5874 | private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack) |
5773 | { | 5875 | { |
5774 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; | 5876 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; |
@@ -6189,17 +6291,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6189 | // Temporarily protect ourselves from the mantis #951 failure. | 6291 | // Temporarily protect ourselves from the mantis #951 failure. |
6190 | // However, we could do this for several other handlers where a failure isn't terminal | 6292 | // However, we could do this for several other handlers where a failure isn't terminal |
6191 | // for the client session anyway, in order to protect ourselves against bad code in plugins | 6293 | // for the client session anyway, in order to protect ourselves against bad code in plugins |
6294 | Vector3 avSize = appear.AgentData.Size; | ||
6192 | try | 6295 | try |
6193 | { | 6296 | { |
6194 | byte[] visualparams = new byte[appear.VisualParam.Length]; | 6297 | byte[] visualparams = new byte[appear.VisualParam.Length]; |
6195 | for (int i = 0; i < appear.VisualParam.Length; i++) | 6298 | for (int i = 0; i < appear.VisualParam.Length; i++) |
6196 | visualparams[i] = appear.VisualParam[i].ParamValue; | 6299 | visualparams[i] = appear.VisualParam[i].ParamValue; |
6197 | 6300 | //var b = appear.WearableData[0]; | |
6301 | |||
6198 | Primitive.TextureEntry te = null; | 6302 | Primitive.TextureEntry te = null; |
6199 | if (appear.ObjectData.TextureEntry.Length > 1) | 6303 | if (appear.ObjectData.TextureEntry.Length > 1) |
6200 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); | 6304 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); |
6305 | |||
6306 | WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length]; | ||
6307 | for (int i=0; i<appear.WearableData.Length;i++) | ||
6308 | cacheitems[i] = new WearableCacheItem(){CacheId = appear.WearableData[i].CacheID,TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex)}; | ||
6201 | 6309 | ||
6202 | handlerSetAppearance(sender, te, visualparams); | 6310 | |
6311 | |||
6312 | handlerSetAppearance(sender, te, visualparams,avSize, cacheitems); | ||
6203 | } | 6313 | } |
6204 | catch (Exception e) | 6314 | catch (Exception e) |
6205 | { | 6315 | { |
@@ -6408,6 +6518,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6408 | { | 6518 | { |
6409 | handlerCompleteMovementToRegion(sender, true); | 6519 | handlerCompleteMovementToRegion(sender, true); |
6410 | } | 6520 | } |
6521 | else | ||
6522 | m_log.Debug("HandleCompleteAgentMovement NULL handler"); | ||
6523 | |||
6411 | handlerCompleteMovementToRegion = null; | 6524 | handlerCompleteMovementToRegion = null; |
6412 | 6525 | ||
6413 | return true; | 6526 | return true; |
@@ -6425,7 +6538,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6425 | return true; | 6538 | return true; |
6426 | } | 6539 | } |
6427 | #endregion | 6540 | #endregion |
6428 | 6541 | /* | |
6429 | StartAnim handlerStartAnim = null; | 6542 | StartAnim handlerStartAnim = null; |
6430 | StopAnim handlerStopAnim = null; | 6543 | StopAnim handlerStopAnim = null; |
6431 | 6544 | ||
@@ -6449,6 +6562,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6449 | } | 6562 | } |
6450 | } | 6563 | } |
6451 | return true; | 6564 | return true; |
6565 | */ | ||
6566 | ChangeAnim handlerChangeAnim = null; | ||
6567 | |||
6568 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) | ||
6569 | { | ||
6570 | handlerChangeAnim = OnChangeAnim; | ||
6571 | if (handlerChangeAnim != null) | ||
6572 | { | ||
6573 | handlerChangeAnim(AgentAni.AnimationList[i].AnimID, AgentAni.AnimationList[i].StartAnim, false); | ||
6574 | } | ||
6575 | } | ||
6576 | |||
6577 | handlerChangeAnim = OnChangeAnim; | ||
6578 | if (handlerChangeAnim != null) | ||
6579 | { | ||
6580 | handlerChangeAnim(UUID.Zero, false, true); | ||
6581 | } | ||
6582 | |||
6583 | return true; | ||
6452 | } | 6584 | } |
6453 | 6585 | ||
6454 | private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) | 6586 | private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) |
@@ -6674,6 +6806,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6674 | #endregion | 6806 | #endregion |
6675 | 6807 | ||
6676 | m_udpClient.SetThrottles(atpack.Throttle.Throttles); | 6808 | m_udpClient.SetThrottles(atpack.Throttle.Throttles); |
6809 | GenericCall2 handler = OnUpdateThrottles; | ||
6810 | if (handler != null) | ||
6811 | { | ||
6812 | handler(); | ||
6813 | } | ||
6677 | return true; | 6814 | return true; |
6678 | } | 6815 | } |
6679 | 6816 | ||
@@ -7098,7 +7235,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7098 | physdata.Bounce = phsblock.Restitution; | 7235 | physdata.Bounce = phsblock.Restitution; |
7099 | physdata.Density = phsblock.Density; | 7236 | physdata.Density = phsblock.Density; |
7100 | physdata.Friction = phsblock.Friction; | 7237 | physdata.Friction = phsblock.Friction; |
7101 | physdata.GravitationModifier = phsblock.GravityMultiplier; | 7238 | physdata.GravitationModifier = phsblock.GravityMultiplier; |
7102 | } | 7239 | } |
7103 | 7240 | ||
7104 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); | 7241 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); |
@@ -7684,6 +7821,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7684 | // surrounding scene | 7821 | // surrounding scene |
7685 | if ((ImageType)block.Type == ImageType.Baked) | 7822 | if ((ImageType)block.Type == ImageType.Baked) |
7686 | args.Priority *= 2.0f; | 7823 | args.Priority *= 2.0f; |
7824 | int wearableout = 0; | ||
7687 | 7825 | ||
7688 | ImageManager.EnqueueReq(args); | 7826 | ImageManager.EnqueueReq(args); |
7689 | } | 7827 | } |
@@ -8702,16 +8840,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8702 | 8840 | ||
8703 | #region Parcel related packets | 8841 | #region Parcel related packets |
8704 | 8842 | ||
8843 | // acumulate several HandleRegionHandleRequest consecutive overlaping requests | ||
8844 | // to be done with minimal resources as possible | ||
8845 | // variables temporary here while in test | ||
8846 | |||
8847 | Queue<UUID> RegionHandleRequests = new Queue<UUID>(); | ||
8848 | bool RegionHandleRequestsInService = false; | ||
8849 | |||
8705 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) | 8850 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) |
8706 | { | 8851 | { |
8707 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | 8852 | UUID currentUUID; |
8708 | 8853 | ||
8709 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; | 8854 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; |
8710 | if (handlerRegionHandleRequest != null) | 8855 | |
8856 | if (handlerRegionHandleRequest == null) | ||
8857 | return true; | ||
8858 | |||
8859 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | ||
8860 | |||
8861 | lock (RegionHandleRequests) | ||
8711 | { | 8862 | { |
8712 | handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); | 8863 | if (RegionHandleRequestsInService) |
8864 | { | ||
8865 | // we are already busy doing a previus request | ||
8866 | // so enqueue it | ||
8867 | RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID); | ||
8868 | return true; | ||
8869 | } | ||
8870 | |||
8871 | // else do it | ||
8872 | currentUUID = rhrPack.RequestBlock.RegionID; | ||
8873 | RegionHandleRequestsInService = true; | ||
8713 | } | 8874 | } |
8714 | return true; | 8875 | |
8876 | while (true) | ||
8877 | { | ||
8878 | handlerRegionHandleRequest(this, currentUUID); | ||
8879 | |||
8880 | lock (RegionHandleRequests) | ||
8881 | { | ||
8882 | // exit condition, nothing to do or closed | ||
8883 | // current code seems to assume we may loose the handler at anytime, | ||
8884 | // so keep checking it | ||
8885 | handlerRegionHandleRequest = OnRegionHandleRequest; | ||
8886 | |||
8887 | if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null) | ||
8888 | { | ||
8889 | RegionHandleRequests.Clear(); | ||
8890 | RegionHandleRequestsInService = false; | ||
8891 | return true; | ||
8892 | } | ||
8893 | currentUUID = RegionHandleRequests.Dequeue(); | ||
8894 | } | ||
8895 | } | ||
8896 | |||
8897 | return true; // actually unreached | ||
8715 | } | 8898 | } |
8716 | 8899 | ||
8717 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) | 8900 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) |
@@ -9967,7 +10150,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9967 | handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, | 10150 | handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, |
9968 | Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), | 10151 | Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), |
9969 | UpdateMuteListEntry.MuteData.MuteType, | 10152 | UpdateMuteListEntry.MuteData.MuteType, |
9970 | UpdateMuteListEntry.AgentData.AgentID); | 10153 | UpdateMuteListEntry.MuteData.MuteFlags); |
9971 | return true; | 10154 | return true; |
9972 | } | 10155 | } |
9973 | return false; | 10156 | return false; |
@@ -9982,8 +10165,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9982 | { | 10165 | { |
9983 | handlerRemoveMuteListEntry(this, | 10166 | handlerRemoveMuteListEntry(this, |
9984 | RemoveMuteListEntry.MuteData.MuteID, | 10167 | RemoveMuteListEntry.MuteData.MuteID, |
9985 | Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName), | 10168 | Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName)); |
9986 | RemoveMuteListEntry.AgentData.AgentID); | ||
9987 | return true; | 10169 | return true; |
9988 | } | 10170 | } |
9989 | return false; | 10171 | return false; |
@@ -10027,10 +10209,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10027 | return false; | 10209 | return false; |
10028 | } | 10210 | } |
10029 | 10211 | ||
10212 | private bool HandleChangeInventoryItemFlags(IClientAPI client, Packet packet) | ||
10213 | { | ||
10214 | ChangeInventoryItemFlagsPacket ChangeInventoryItemFlags = | ||
10215 | (ChangeInventoryItemFlagsPacket)packet; | ||
10216 | ChangeInventoryItemFlags handlerChangeInventoryItemFlags = OnChangeInventoryItemFlags; | ||
10217 | if (handlerChangeInventoryItemFlags != null) | ||
10218 | { | ||
10219 | foreach(ChangeInventoryItemFlagsPacket.InventoryDataBlock b in ChangeInventoryItemFlags.InventoryData) | ||
10220 | handlerChangeInventoryItemFlags(this, b.ItemID, b.Flags); | ||
10221 | return true; | ||
10222 | } | ||
10223 | return false; | ||
10224 | } | ||
10225 | |||
10030 | private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) | 10226 | private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) |
10031 | { | 10227 | { |
10032 | return true; | 10228 | return true; |
10033 | } | 10229 | } |
10230 | |||
10231 | private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack) | ||
10232 | { | ||
10233 | CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack; | ||
10234 | |||
10235 | #region Packet Session and User Check | ||
10236 | if (m_checkPackets) | ||
10237 | { | ||
10238 | if (packet.AgentData.SessionID != SessionId || | ||
10239 | packet.AgentData.AgentID != AgentId) | ||
10240 | return true; | ||
10241 | } | ||
10242 | #endregion | ||
10243 | MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null; | ||
10244 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | ||
10245 | foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData) | ||
10246 | { | ||
10247 | InventoryItemBase b = new InventoryItemBase(); | ||
10248 | b.ID = n.OldItemID; | ||
10249 | b.Folder = n.OldFolderID; | ||
10250 | items.Add(b); | ||
10251 | } | ||
10252 | |||
10253 | handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy; | ||
10254 | if (handlerMoveItemsAndLeaveCopy != null) | ||
10255 | { | ||
10256 | handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID); | ||
10257 | } | ||
10258 | |||
10259 | return true; | ||
10260 | } | ||
10034 | 10261 | ||
10035 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) | 10262 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) |
10036 | { | 10263 | { |
@@ -10457,6 +10684,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10457 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; | 10684 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; |
10458 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; | 10685 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; |
10459 | 10686 | ||
10687 | Scene scene = (Scene)m_scene; | ||
10688 | if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID))) | ||
10689 | { | ||
10690 | ScenePresence p; | ||
10691 | if (scene.TryGetScenePresence(sender.AgentId, out p)) | ||
10692 | { | ||
10693 | if (p.GodLevel >= 200) | ||
10694 | { | ||
10695 | groupProfileReply.GroupData.OpenEnrollment = true; | ||
10696 | groupProfileReply.GroupData.MembershipFee = 0; | ||
10697 | } | ||
10698 | } | ||
10699 | } | ||
10700 | |||
10460 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); | 10701 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); |
10461 | } | 10702 | } |
10462 | return true; | 10703 | return true; |
@@ -11030,11 +11271,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11030 | 11271 | ||
11031 | StartLure handlerStartLure = OnStartLure; | 11272 | StartLure handlerStartLure = OnStartLure; |
11032 | if (handlerStartLure != null) | 11273 | if (handlerStartLure != null) |
11033 | handlerStartLure(startLureRequest.Info.LureType, | 11274 | { |
11034 | Utils.BytesToString( | 11275 | for (int i = 0 ; i < startLureRequest.TargetData.Length ; i++) |
11035 | startLureRequest.Info.Message), | 11276 | { |
11036 | startLureRequest.TargetData[0].TargetID, | 11277 | handlerStartLure(startLureRequest.Info.LureType, |
11037 | this); | 11278 | Utils.BytesToString( |
11279 | startLureRequest.Info.Message), | ||
11280 | startLureRequest.TargetData[i].TargetID, | ||
11281 | this); | ||
11282 | } | ||
11283 | } | ||
11038 | return true; | 11284 | return true; |
11039 | } | 11285 | } |
11040 | private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) | 11286 | private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) |
@@ -11148,10 +11394,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11148 | } | 11394 | } |
11149 | #endregion | 11395 | #endregion |
11150 | 11396 | ||
11151 | ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; | 11397 | ClassifiedGodDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; |
11152 | if (handlerClassifiedGodDelete != null) | 11398 | if (handlerClassifiedGodDelete != null) |
11153 | handlerClassifiedGodDelete( | 11399 | handlerClassifiedGodDelete( |
11154 | classifiedGodDelete.Data.ClassifiedID, | 11400 | classifiedGodDelete.Data.ClassifiedID, |
11401 | classifiedGodDelete.Data.QueryID, | ||
11155 | this); | 11402 | this); |
11156 | return true; | 11403 | return true; |
11157 | } | 11404 | } |
@@ -11464,6 +11711,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11464 | 11711 | ||
11465 | if (cachedtex.AgentData.SessionID != SessionId) | 11712 | if (cachedtex.AgentData.SessionID != SessionId) |
11466 | return false; | 11713 | return false; |
11714 | |||
11467 | 11715 | ||
11468 | // TODO: don't create new blocks if recycling an old packet | 11716 | // TODO: don't create new blocks if recycling an old packet |
11469 | cachedresp.AgentData.AgentID = AgentId; | 11717 | cachedresp.AgentData.AgentID = AgentId; |
@@ -11473,14 +11721,140 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11473 | cachedresp.WearableData = | 11721 | cachedresp.WearableData = |
11474 | new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; | 11722 | new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; |
11475 | 11723 | ||
11476 | for (int i = 0; i < cachedtex.WearableData.Length; i++) | 11724 | //IAvatarFactoryModule fac = m_scene.RequestModuleInterface<IAvatarFactoryModule>(); |
11725 | // var item = fac.GetBakedTextureFaces(AgentId); | ||
11726 | //WearableCacheItem[] items = fac.GetCachedItems(AgentId); | ||
11727 | |||
11728 | IAssetService cache = m_scene.AssetService; | ||
11729 | IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | ||
11730 | //bakedTextureModule = null; | ||
11731 | int maxWearablesLoop = cachedtex.WearableData.Length; | ||
11732 | if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) | ||
11733 | maxWearablesLoop = AvatarWearable.MAX_WEARABLES; | ||
11734 | |||
11735 | if (bakedTextureModule != null && cache != null) | ||
11477 | { | 11736 | { |
11478 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | 11737 | // 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 |
11479 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | 11738 | |
11480 | cachedresp.WearableData[i].TextureID = UUID.Zero; | 11739 | WearableCacheItem[] cacheItems = null; |
11481 | cachedresp.WearableData[i].HostName = new byte[0]; | 11740 | ScenePresence p = m_scene.GetScenePresence(AgentId); |
11741 | if (p.Appearance != null) | ||
11742 | if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) | ||
11743 | { | ||
11744 | try | ||
11745 | { | ||
11746 | cacheItems = bakedTextureModule.Get(AgentId); | ||
11747 | p.Appearance.WearableCacheItems = cacheItems; | ||
11748 | p.Appearance.WearableCacheItemsDirty = false; | ||
11749 | } | ||
11750 | |||
11751 | /* | ||
11752 | * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception! | ||
11753 | * | ||
11754 | catch (System.Net.Sockets.SocketException) | ||
11755 | { | ||
11756 | cacheItems = null; | ||
11757 | } | ||
11758 | catch (WebException) | ||
11759 | { | ||
11760 | cacheItems = null; | ||
11761 | } | ||
11762 | catch (InvalidOperationException) | ||
11763 | { | ||
11764 | cacheItems = null; | ||
11765 | } */ | ||
11766 | catch (Exception) | ||
11767 | { | ||
11768 | cacheItems = null; | ||
11769 | } | ||
11770 | |||
11771 | } | ||
11772 | else if (p.Appearance.WearableCacheItems != null) | ||
11773 | { | ||
11774 | cacheItems = p.Appearance.WearableCacheItems; | ||
11775 | } | ||
11776 | |||
11777 | if (cache != null && cacheItems != null) | ||
11778 | { | ||
11779 | foreach (WearableCacheItem item in cacheItems) | ||
11780 | { | ||
11781 | |||
11782 | if (cache.GetCached(item.TextureID.ToString()) == null) | ||
11783 | { | ||
11784 | item.TextureAsset.Temporary = true; | ||
11785 | cache.Store(item.TextureAsset); | ||
11786 | } | ||
11787 | |||
11788 | |||
11789 | } | ||
11790 | } | ||
11791 | |||
11792 | if (cacheItems != null) | ||
11793 | { | ||
11794 | |||
11795 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11796 | { | ||
11797 | WearableCacheItem item = | ||
11798 | WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems); | ||
11799 | |||
11800 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11801 | cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex; | ||
11802 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11803 | if (item != null && cachedtex.WearableData[i].ID == item.CacheId) | ||
11804 | { | ||
11805 | |||
11806 | cachedresp.WearableData[i].TextureID = item.TextureID; | ||
11807 | } | ||
11808 | else | ||
11809 | { | ||
11810 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11811 | } | ||
11812 | } | ||
11813 | } | ||
11814 | else | ||
11815 | { | ||
11816 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11817 | { | ||
11818 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11819 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
11820 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11821 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11822 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11823 | } | ||
11824 | } | ||
11482 | } | 11825 | } |
11826 | else | ||
11827 | { | ||
11828 | if (cache == null) | ||
11829 | { | ||
11830 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11831 | { | ||
11832 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11833 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
11834 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11835 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11836 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11837 | } | ||
11838 | } | ||
11839 | else | ||
11840 | { | ||
11841 | for (int i = 0; i < maxWearablesLoop; i++) | ||
11842 | { | ||
11843 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | ||
11844 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | ||
11483 | 11845 | ||
11846 | |||
11847 | |||
11848 | if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null) | ||
11849 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11850 | //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11851 | else | ||
11852 | cachedresp.WearableData[i].TextureID = UUID.Zero; | ||
11853 | // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); | ||
11854 | cachedresp.WearableData[i].HostName = new byte[0]; | ||
11855 | } | ||
11856 | } | ||
11857 | } | ||
11484 | cachedresp.Header.Zerocoded = true; | 11858 | cachedresp.Header.Zerocoded = true; |
11485 | OutPacket(cachedresp, ThrottleOutPacketType.Task); | 11859 | OutPacket(cachedresp, ThrottleOutPacketType.Task); |
11486 | 11860 | ||
@@ -11517,209 +11891,147 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11517 | } | 11891 | } |
11518 | else | 11892 | else |
11519 | { | 11893 | { |
11520 | // m_log.DebugFormat( | 11894 | ClientChangeObject updatehandler = onClientChangeObject; |
11521 | // "[CLIENT]: Processing block {0} type {1} for {2} {3}", | ||
11522 | // i, block.Type, part.Name, part.LocalId); | ||
11523 | 11895 | ||
11524 | // // Do this once since fetch parts creates a new array. | 11896 | if (updatehandler != null) |
11525 | // SceneObjectPart[] parts = part.ParentGroup.Parts; | 11897 | { |
11526 | // for (int j = 0; j < parts.Length; j++) | 11898 | ObjectChangeData udata = new ObjectChangeData(); |
11527 | // { | ||
11528 | // part.StoreUndoState(); | ||
11529 | // parts[j].IgnoreUndoUpdate = true; | ||
11530 | // } | ||
11531 | 11899 | ||
11532 | UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; | 11900 | /*ubit from ll JIRA: |
11901 | * 0x01 position | ||
11902 | * 0x02 rotation | ||
11903 | * 0x04 scale | ||
11904 | |||
11905 | * 0x08 LINK_SET | ||
11906 | * 0x10 UNIFORM for scale | ||
11907 | */ | ||
11533 | 11908 | ||
11534 | switch (block.Type) | 11909 | // translate to internal changes |
11535 | { | 11910 | // not all cases .. just the ones older code did |
11536 | case 1: | ||
11537 | Vector3 pos1 = new Vector3(block.Data, 0); | ||
11538 | 11911 | ||
11539 | UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 11912 | switch (block.Type) |
11540 | if (handlerUpdatePrimSinglePosition != null) | 11913 | { |
11541 | { | 11914 | case 1: //change position sp |
11542 | // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 11915 | udata.position = new Vector3(block.Data, 0); |
11543 | handlerUpdatePrimSinglePosition(localId, pos1, this); | ||
11544 | } | ||
11545 | break; | ||
11546 | 11916 | ||
11547 | case 2: | 11917 | udata.change = ObjectChangeType.primP; |
11548 | Quaternion rot1 = new Quaternion(block.Data, 0, true); | 11918 | updatehandler(localId, udata, this); |
11919 | break; | ||
11549 | 11920 | ||
11550 | UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; | 11921 | case 2: // rotation sp |
11551 | if (handlerUpdatePrimSingleRotation != null) | 11922 | udata.rotation = new Quaternion(block.Data, 0, true); |
11552 | { | ||
11553 | // m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W); | ||
11554 | handlerUpdatePrimSingleRotation(localId, rot1, this); | ||
11555 | } | ||
11556 | break; | ||
11557 | 11923 | ||
11558 | case 3: | 11924 | udata.change = ObjectChangeType.primR; |
11559 | Vector3 rotPos = new Vector3(block.Data, 0); | 11925 | updatehandler(localId, udata, this); |
11560 | Quaternion rot2 = new Quaternion(block.Data, 12, true); | 11926 | break; |
11561 | 11927 | ||
11562 | UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition; | 11928 | case 3: // position plus rotation |
11563 | if (handlerUpdatePrimSingleRotationPosition != null) | 11929 | udata.position = new Vector3(block.Data, 0); |
11564 | { | 11930 | udata.rotation = new Quaternion(block.Data, 12, true); |
11565 | // m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z); | ||
11566 | // m_log.Info("new mouse rotation is " + rot2.X + " , " + rot2.Y + " , " + rot2.Z + " , " + rot2.W); | ||
11567 | handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this); | ||
11568 | } | ||
11569 | break; | ||
11570 | 11931 | ||
11571 | case 4: | 11932 | udata.change = ObjectChangeType.primPR; |
11572 | case 20: | 11933 | updatehandler(localId, udata, this); |
11573 | Vector3 scale4 = new Vector3(block.Data, 0); | 11934 | break; |
11574 | 11935 | ||
11575 | UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale; | 11936 | case 4: // scale sp |
11576 | if (handlerUpdatePrimScale != null) | 11937 | udata.scale = new Vector3(block.Data, 0); |
11577 | { | 11938 | udata.change = ObjectChangeType.primS; |
11578 | // m_log.Debug("new scale is " + scale4.X + " , " + scale4.Y + " , " + scale4.Z); | ||
11579 | handlerUpdatePrimScale(localId, scale4, this); | ||
11580 | } | ||
11581 | break; | ||
11582 | 11939 | ||
11583 | case 5: | 11940 | updatehandler(localId, udata, this); |
11584 | Vector3 scale1 = new Vector3(block.Data, 12); | 11941 | break; |
11585 | Vector3 pos11 = new Vector3(block.Data, 0); | ||
11586 | 11942 | ||
11587 | handlerUpdatePrimScale = OnUpdatePrimScale; | 11943 | case 0x14: // uniform scale sp |
11588 | if (handlerUpdatePrimScale != null) | 11944 | udata.scale = new Vector3(block.Data, 0); |
11589 | { | ||
11590 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
11591 | handlerUpdatePrimScale(localId, scale1, this); | ||
11592 | 11945 | ||
11593 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 11946 | udata.change = ObjectChangeType.primUS; |
11594 | if (handlerUpdatePrimSinglePosition != null) | 11947 | updatehandler(localId, udata, this); |
11595 | { | 11948 | break; |
11596 | handlerUpdatePrimSinglePosition(localId, pos11, this); | ||
11597 | } | ||
11598 | } | ||
11599 | break; | ||
11600 | 11949 | ||
11601 | case 9: | 11950 | case 5: // scale and position sp |
11602 | Vector3 pos2 = new Vector3(block.Data, 0); | 11951 | udata.position = new Vector3(block.Data, 0); |
11952 | udata.scale = new Vector3(block.Data, 12); | ||
11603 | 11953 | ||
11604 | UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; | 11954 | udata.change = ObjectChangeType.primPS; |
11955 | updatehandler(localId, udata, this); | ||
11956 | break; | ||
11605 | 11957 | ||
11606 | if (handlerUpdateVector != null) | 11958 | case 0x15: //uniform scale and position |
11607 | { | 11959 | udata.position = new Vector3(block.Data, 0); |
11608 | handlerUpdateVector(localId, pos2, this); | 11960 | udata.scale = new Vector3(block.Data, 12); |
11609 | } | ||
11610 | break; | ||
11611 | 11961 | ||
11612 | case 10: | 11962 | udata.change = ObjectChangeType.primPUS; |
11613 | Quaternion rot3 = new Quaternion(block.Data, 0, true); | 11963 | updatehandler(localId, udata, this); |
11964 | break; | ||
11614 | 11965 | ||
11615 | UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; | 11966 | // now group related (bit 4) |
11616 | if (handlerUpdatePrimRotation != null) | 11967 | case 9: //( 8 + 1 )group position |
11617 | { | 11968 | udata.position = new Vector3(block.Data, 0); |
11618 | // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W); | ||
11619 | handlerUpdatePrimRotation(localId, rot3, this); | ||
11620 | } | ||
11621 | break; | ||
11622 | 11969 | ||
11623 | case 11: | 11970 | udata.change = ObjectChangeType.groupP; |
11624 | Vector3 pos3 = new Vector3(block.Data, 0); | 11971 | updatehandler(localId, udata, this); |
11625 | Quaternion rot4 = new Quaternion(block.Data, 12, true); | 11972 | break; |
11626 | 11973 | ||
11627 | handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; | 11974 | case 0x0A: // (8 + 2) group rotation |
11628 | if (handlerUpdatePrimGroupRotation != null) | 11975 | udata.rotation = new Quaternion(block.Data, 0, true); |
11629 | { | ||
11630 | // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | ||
11631 | // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W); | ||
11632 | handlerUpdatePrimGroupRotation(localId, pos3, rot4, this); | ||
11633 | } | ||
11634 | break; | ||
11635 | case 12: | ||
11636 | case 28: | ||
11637 | Vector3 scale7 = new Vector3(block.Data, 0); | ||
11638 | 11976 | ||
11639 | UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; | 11977 | udata.change = ObjectChangeType.groupR; |
11640 | if (handlerUpdatePrimGroupScale != null) | 11978 | updatehandler(localId, udata, this); |
11641 | { | 11979 | break; |
11642 | // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z); | ||
11643 | handlerUpdatePrimGroupScale(localId, scale7, this); | ||
11644 | } | ||
11645 | break; | ||
11646 | 11980 | ||
11647 | case 13: | 11981 | case 0x0B: //( 8 + 2 + 1) group rotation and position |
11648 | Vector3 scale2 = new Vector3(block.Data, 12); | 11982 | udata.position = new Vector3(block.Data, 0); |
11649 | Vector3 pos4 = new Vector3(block.Data, 0); | 11983 | udata.rotation = new Quaternion(block.Data, 12, true); |
11650 | 11984 | ||
11651 | handlerUpdatePrimScale = OnUpdatePrimScale; | 11985 | udata.change = ObjectChangeType.groupPR; |
11652 | if (handlerUpdatePrimScale != null) | 11986 | updatehandler(localId, udata, this); |
11653 | { | 11987 | break; |
11654 | //m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
11655 | handlerUpdatePrimScale(localId, scale2, this); | ||
11656 | 11988 | ||
11657 | // Change the position based on scale (for bug number 246) | 11989 | case 0x0C: // (8 + 4) group scale |
11658 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 11990 | // only afects root prim and only sent by viewer editor object tab scaling |
11659 | // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 11991 | // mouse edition only allows uniform scaling |
11660 | if (handlerUpdatePrimSinglePosition != null) | 11992 | // SL MAY CHANGE THIS in viewers |
11661 | { | ||
11662 | handlerUpdatePrimSinglePosition(localId, pos4, this); | ||
11663 | } | ||
11664 | } | ||
11665 | break; | ||
11666 | 11993 | ||
11667 | case 29: | 11994 | udata.scale = new Vector3(block.Data, 0); |
11668 | Vector3 scale5 = new Vector3(block.Data, 12); | ||
11669 | Vector3 pos5 = new Vector3(block.Data, 0); | ||
11670 | 11995 | ||
11671 | handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; | 11996 | udata.change = ObjectChangeType.groupS; |
11672 | if (handlerUpdatePrimGroupScale != null) | 11997 | updatehandler(localId, udata, this); |
11673 | { | ||
11674 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
11675 | part.StoreUndoState(true); | ||
11676 | part.IgnoreUndoUpdate = true; | ||
11677 | handlerUpdatePrimGroupScale(localId, scale5, this); | ||
11678 | handlerUpdateVector = OnUpdatePrimGroupPosition; | ||
11679 | 11998 | ||
11680 | if (handlerUpdateVector != null) | 11999 | break; |
11681 | { | ||
11682 | handlerUpdateVector(localId, pos5, this); | ||
11683 | } | ||
11684 | 12000 | ||
11685 | part.IgnoreUndoUpdate = false; | 12001 | case 0x0D: //(8 + 4 + 1) group scale and position |
11686 | } | 12002 | // exception as above |
11687 | 12003 | ||
11688 | break; | 12004 | udata.position = new Vector3(block.Data, 0); |
12005 | udata.scale = new Vector3(block.Data, 12); | ||
11689 | 12006 | ||
11690 | case 21: | 12007 | udata.change = ObjectChangeType.groupPS; |
11691 | Vector3 scale6 = new Vector3(block.Data, 12); | 12008 | updatehandler(localId, udata, this); |
11692 | Vector3 pos6 = new Vector3(block.Data, 0); | 12009 | break; |
11693 | 12010 | ||
11694 | handlerUpdatePrimScale = OnUpdatePrimScale; | 12011 | case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM |
11695 | if (handlerUpdatePrimScale != null) | 12012 | udata.scale = new Vector3(block.Data, 0); |
11696 | { | ||
11697 | part.StoreUndoState(false); | ||
11698 | part.IgnoreUndoUpdate = true; | ||
11699 | 12013 | ||
11700 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | 12014 | udata.change = ObjectChangeType.groupUS; |
11701 | handlerUpdatePrimScale(localId, scale6, this); | 12015 | updatehandler(localId, udata, this); |
11702 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 12016 | break; |
11703 | if (handlerUpdatePrimSinglePosition != null) | ||
11704 | { | ||
11705 | handlerUpdatePrimSinglePosition(localId, pos6, this); | ||
11706 | } | ||
11707 | 12017 | ||
11708 | part.IgnoreUndoUpdate = false; | 12018 | case 0x1D: // (UNIFORM + GROUP + SCALE + POS) |
11709 | } | 12019 | udata.position = new Vector3(block.Data, 0); |
11710 | break; | 12020 | udata.scale = new Vector3(block.Data, 12); |
11711 | 12021 | ||
11712 | default: | 12022 | udata.change = ObjectChangeType.groupPUS; |
11713 | m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); | 12023 | updatehandler(localId, udata, this); |
11714 | break; | 12024 | break; |
12025 | |||
12026 | default: | ||
12027 | m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); | ||
12028 | break; | ||
12029 | } | ||
11715 | } | 12030 | } |
11716 | 12031 | ||
11717 | // for (int j = 0; j < parts.Length; j++) | ||
11718 | // parts[j].IgnoreUndoUpdate = false; | ||
11719 | } | 12032 | } |
11720 | } | 12033 | } |
11721 | } | 12034 | } |
11722 | |||
11723 | return true; | 12035 | return true; |
11724 | } | 12036 | } |
11725 | 12037 | ||
@@ -11780,9 +12092,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11780 | public void SetChildAgentThrottle(byte[] throttles) | 12092 | public void SetChildAgentThrottle(byte[] throttles) |
11781 | { | 12093 | { |
11782 | m_udpClient.SetThrottles(throttles); | 12094 | m_udpClient.SetThrottles(throttles); |
12095 | GenericCall2 handler = OnUpdateThrottles; | ||
12096 | if (handler != null) | ||
12097 | { | ||
12098 | handler(); | ||
12099 | } | ||
11783 | } | 12100 | } |
11784 | 12101 | ||
11785 | /// <summary> | 12102 | /// <summary> |
12103 | /// Sets the throttles from values supplied by the client | ||
12104 | /// </summary> | ||
12105 | /// <param name="throttles"></param> | ||
12106 | public void SetAgentThrottleSilent(int throttle, int setting) | ||
12107 | { | ||
12108 | m_udpClient.ForceThrottleSetting(throttle,setting); | ||
12109 | //m_udpClient.SetThrottles(throttles); | ||
12110 | |||
12111 | } | ||
12112 | |||
12113 | |||
12114 | /// <summary> | ||
11786 | /// Get the current throttles for this client as a packed byte array | 12115 | /// Get the current throttles for this client as a packed byte array |
11787 | /// </summary> | 12116 | /// </summary> |
11788 | /// <param name="multiplier">Unused</param> | 12117 | /// <param name="multiplier">Unused</param> |
@@ -12174,7 +12503,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12174 | // "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", | 12503 | // "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", |
12175 | // requestID, taskID, (SourceType)sourceType, Name); | 12504 | // requestID, taskID, (SourceType)sourceType, Name); |
12176 | 12505 | ||
12506 | |||
12507 | //Note, the bool returned from the below function is useless since it is always false. | ||
12177 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); | 12508 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); |
12509 | |||
12178 | } | 12510 | } |
12179 | 12511 | ||
12180 | /// <summary> | 12512 | /// <summary> |
@@ -12240,7 +12572,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12240 | /// <returns></returns> | 12572 | /// <returns></returns> |
12241 | private static int CalculateNumPackets(byte[] data) | 12573 | private static int CalculateNumPackets(byte[] data) |
12242 | { | 12574 | { |
12243 | const uint m_maxPacketSize = 600; | 12575 | // const uint m_maxPacketSize = 600; |
12576 | uint m_maxPacketSize = MaxTransferBytesPerPacket; | ||
12244 | int numPackets = 1; | 12577 | int numPackets = 1; |
12245 | 12578 | ||
12246 | if (data == null) | 12579 | if (data == null) |