diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 1800 |
1 files changed, 1021 insertions, 779 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e7dd9d3..62206e9 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; |
@@ -156,6 +158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
156 | public event RequestTaskInventory OnRequestTaskInventory; | 158 | public event RequestTaskInventory OnRequestTaskInventory; |
157 | public event UpdateInventoryItem OnUpdateInventoryItem; | 159 | public event UpdateInventoryItem OnUpdateInventoryItem; |
158 | public event CopyInventoryItem OnCopyInventoryItem; | 160 | public event CopyInventoryItem OnCopyInventoryItem; |
161 | public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; | ||
159 | public event MoveInventoryItem OnMoveInventoryItem; | 162 | public event MoveInventoryItem OnMoveInventoryItem; |
160 | public event RemoveInventoryItem OnRemoveInventoryItem; | 163 | public event RemoveInventoryItem OnRemoveInventoryItem; |
161 | public event RemoveInventoryFolder OnRemoveInventoryFolder; | 164 | public event RemoveInventoryFolder OnRemoveInventoryFolder; |
@@ -250,7 +253,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
250 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; | 253 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; |
251 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; | 254 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; |
252 | public event ClassifiedDelete OnClassifiedDelete; | 255 | public event ClassifiedDelete OnClassifiedDelete; |
253 | public event ClassifiedDelete OnClassifiedGodDelete; | 256 | public event ClassifiedGodDelete OnClassifiedGodDelete; |
254 | public event EventNotificationAddRequest OnEventNotificationAddRequest; | 257 | public event EventNotificationAddRequest OnEventNotificationAddRequest; |
255 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; | 258 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; |
256 | public event EventGodDelete OnEventGodDelete; | 259 | public event EventGodDelete OnEventGodDelete; |
@@ -281,10 +284,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
281 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; | 284 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; |
282 | public event SimWideDeletesDelegate OnSimWideDeletes; | 285 | public event SimWideDeletesDelegate OnSimWideDeletes; |
283 | public event SendPostcard OnSendPostcard; | 286 | public event SendPostcard OnSendPostcard; |
287 | public event ChangeInventoryItemFlags OnChangeInventoryItemFlags; | ||
284 | public event MuteListEntryUpdate OnUpdateMuteListEntry; | 288 | public event MuteListEntryUpdate OnUpdateMuteListEntry; |
285 | public event MuteListEntryRemove OnRemoveMuteListEntry; | 289 | public event MuteListEntryRemove OnRemoveMuteListEntry; |
286 | public event GodlikeMessage onGodlikeMessage; | 290 | public event GodlikeMessage onGodlikeMessage; |
287 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; | 291 | public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; |
292 | public event GenericCall2 OnUpdateThrottles; | ||
288 | 293 | ||
289 | #pragma warning disable 0067 | 294 | #pragma warning disable 0067 |
290 | public event GenericMessage OnGenericMessage; | 295 | public event GenericMessage OnGenericMessage; |
@@ -333,7 +338,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
333 | private PriorityQueue m_entityProps; | 338 | private PriorityQueue m_entityProps; |
334 | private Prioritizer m_prioritizer; | 339 | private Prioritizer m_prioritizer; |
335 | private bool m_disableFacelights = false; | 340 | private bool m_disableFacelights = false; |
336 | private volatile bool m_justEditedTerrain = false; | 341 | |
342 | private bool m_VelocityInterpolate = false; | ||
343 | private const uint MaxTransferBytesPerPacket = 600; | ||
344 | |||
337 | /// <value> | 345 | /// <value> |
338 | /// List used in construction of data blocks for an object update packet. This is to stop us having to | 346 | /// List used in construction of data blocks for an object update packet. This is to stop us having to |
339 | /// continually recreate it. | 347 | /// continually recreate it. |
@@ -345,14 +353,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
345 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an | 353 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an |
346 | /// ownerless phantom. | 354 | /// ownerless phantom. |
347 | /// | 355 | /// |
348 | /// All manipulation of this set has to occur under a lock | 356 | /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock |
349 | /// | 357 | /// |
350 | /// </value> | 358 | /// </value> |
351 | protected HashSet<uint> m_killRecord; | 359 | // protected HashSet<uint> m_killRecord; |
352 | 360 | ||
353 | // protected HashSet<uint> m_attachmentsSent; | 361 | // protected HashSet<uint> m_attachmentsSent; |
354 | 362 | ||
355 | private int m_animationSequenceNumber = 1; | 363 | private bool m_deliverPackets = true; |
364 | |||
356 | private bool m_SendLogoutPacketWhenClosing = true; | 365 | private bool m_SendLogoutPacketWhenClosing = true; |
357 | 366 | ||
358 | /// <summary> | 367 | /// <summary> |
@@ -398,6 +407,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
398 | get { return m_startpos; } | 407 | get { return m_startpos; } |
399 | set { m_startpos = value; } | 408 | set { m_startpos = value; } |
400 | } | 409 | } |
410 | public bool DeliverPackets | ||
411 | { | ||
412 | get { return m_deliverPackets; } | ||
413 | set { | ||
414 | m_deliverPackets = value; | ||
415 | m_udpClient.m_deliverPackets = value; | ||
416 | } | ||
417 | } | ||
401 | public UUID AgentId { get { return m_agentId; } } | 418 | public UUID AgentId { get { return m_agentId; } } |
402 | public ISceneAgent SceneAgent { get; set; } | 419 | public ISceneAgent SceneAgent { get; set; } |
403 | public UUID ActiveGroupId { get { return m_activeGroupID; } private set { m_activeGroupID = value; } } | 420 | public UUID ActiveGroupId { get { return m_activeGroupID; } private set { m_activeGroupID = value; } } |
@@ -405,6 +422,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
405 | public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } private set { m_activeGroupPowers = value; } } | 422 | public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } private set { m_activeGroupPowers = value; } } |
406 | public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } | 423 | public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } |
407 | 424 | ||
425 | public int PingTimeMS | ||
426 | { | ||
427 | get | ||
428 | { | ||
429 | if (UDPClient != null) | ||
430 | return UDPClient.PingTimeMS; | ||
431 | return 0; | ||
432 | } | ||
433 | } | ||
434 | |||
408 | /// <summary> | 435 | /// <summary> |
409 | /// Entity update queues | 436 | /// Entity update queues |
410 | /// </summary> | 437 | /// </summary> |
@@ -426,7 +453,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
426 | public string Name { get { return FirstName + " " + LastName; } } | 453 | public string Name { get { return FirstName + " " + LastName; } } |
427 | 454 | ||
428 | public uint CircuitCode { get { return m_circuitCode; } } | 455 | public uint CircuitCode { get { return m_circuitCode; } } |
429 | public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } | 456 | public int NextAnimationSequenceNumber |
457 | { | ||
458 | get { return m_udpServer.NextAnimationSequenceNumber; } | ||
459 | } | ||
430 | 460 | ||
431 | /// <summary> | 461 | /// <summary> |
432 | /// As well as it's function in IClientAPI, in LLClientView we are locking on this property in order to | 462 | /// As well as it's function in IClientAPI, in LLClientView we are locking on this property in order to |
@@ -447,7 +477,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
447 | set { m_disableFacelights = value; } | 477 | set { m_disableFacelights = value; } |
448 | } | 478 | } |
449 | 479 | ||
480 | public List<uint> SelectedObjects {get; private set;} | ||
481 | |||
450 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } | 482 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } |
483 | |||
451 | 484 | ||
452 | #endregion Properties | 485 | #endregion Properties |
453 | 486 | ||
@@ -465,6 +498,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
465 | // DebugPacketLevel = 1; | 498 | // DebugPacketLevel = 1; |
466 | 499 | ||
467 | CloseSyncLock = new Object(); | 500 | CloseSyncLock = new Object(); |
501 | SelectedObjects = new List<uint>(); | ||
468 | 502 | ||
469 | RegisterInterface<IClientIM>(this); | 503 | RegisterInterface<IClientIM>(this); |
470 | RegisterInterface<IClientInventory>(this); | 504 | RegisterInterface<IClientInventory>(this); |
@@ -474,7 +508,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
474 | m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); | 508 | m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); |
475 | m_entityProps = new PriorityQueue(m_scene.Entities.Count); | 509 | m_entityProps = new PriorityQueue(m_scene.Entities.Count); |
476 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); | 510 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); |
477 | m_killRecord = new HashSet<uint>(); | 511 | // m_killRecord = new HashSet<uint>(); |
478 | // m_attachmentsSent = new HashSet<uint>(); | 512 | // m_attachmentsSent = new HashSet<uint>(); |
479 | 513 | ||
480 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | 514 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); |
@@ -504,12 +538,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
504 | 538 | ||
505 | #region Client Methods | 539 | #region Client Methods |
506 | 540 | ||
541 | |||
542 | /// <summary> | ||
543 | /// Close down the client view | ||
544 | /// </summary> | ||
507 | public void Close() | 545 | public void Close() |
508 | { | 546 | { |
509 | Close(false); | 547 | Close(true, false); |
510 | } | 548 | } |
511 | 549 | ||
512 | public void Close(bool force) | 550 | public void Close(bool sendStop, bool force) |
513 | { | 551 | { |
514 | // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. | 552 | // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. |
515 | // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. | 553 | // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. |
@@ -526,7 +564,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
526 | } | 564 | } |
527 | 565 | ||
528 | IsActive = false; | 566 | IsActive = false; |
529 | CloseWithoutChecks(); | 567 | CloseWithoutChecks(sendStop); |
530 | } | 568 | } |
531 | } | 569 | } |
532 | 570 | ||
@@ -539,12 +577,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
539 | /// | 577 | /// |
540 | /// Callers must lock ClosingSyncLock before calling. | 578 | /// Callers must lock ClosingSyncLock before calling. |
541 | /// </remarks> | 579 | /// </remarks> |
542 | public void CloseWithoutChecks() | 580 | public void CloseWithoutChecks(bool sendStop) |
543 | { | 581 | { |
544 | m_log.DebugFormat( | 582 | m_log.DebugFormat( |
545 | "[CLIENT]: Close has been called for {0} attached to scene {1}", | 583 | "[CLIENT]: Close has been called for {0} attached to scene {1}", |
546 | Name, m_scene.RegionInfo.RegionName); | 584 | Name, m_scene.RegionInfo.RegionName); |
547 | 585 | ||
586 | if (sendStop) | ||
587 | { | ||
588 | // Send the STOP packet | ||
589 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | ||
590 | OutPacket(disable, ThrottleOutPacketType.Unknown); | ||
591 | } | ||
592 | |||
548 | // Shutdown the image manager | 593 | // Shutdown the image manager |
549 | ImageManager.Close(); | 594 | ImageManager.Close(); |
550 | 595 | ||
@@ -566,7 +611,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
566 | 611 | ||
567 | // Disable UDP handling for this client | 612 | // Disable UDP handling for this client |
568 | m_udpClient.Shutdown(); | 613 | m_udpClient.Shutdown(); |
569 | 614 | ||
615 | |||
570 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 616 | //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
571 | //GC.Collect(); | 617 | //GC.Collect(); |
572 | //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 618 | //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
@@ -858,6 +904,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
858 | 904 | ||
859 | public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) | 905 | public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) |
860 | { | 906 | { |
907 | m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue; | ||
908 | m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue; | ||
909 | |||
861 | AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); | 910 | AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); |
862 | mov.SimData.ChannelVersion = m_channelVersion; | 911 | mov.SimData.ChannelVersion = m_channelVersion; |
863 | mov.AgentData.SessionID = m_sessionId; | 912 | mov.AgentData.SessionID = m_sessionId; |
@@ -893,7 +942,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
893 | reply.ChatData.OwnerID = ownerID; | 942 | reply.ChatData.OwnerID = ownerID; |
894 | reply.ChatData.SourceID = fromAgentID; | 943 | reply.ChatData.SourceID = fromAgentID; |
895 | 944 | ||
896 | OutPacket(reply, ThrottleOutPacketType.Task); | 945 | OutPacket(reply, ThrottleOutPacketType.Unknown); |
897 | } | 946 | } |
898 | 947 | ||
899 | /// <summary> | 948 | /// <summary> |
@@ -926,32 +975,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
926 | msg.MessageBlock.Message = Util.StringToBytes1024(im.message); | 975 | msg.MessageBlock.Message = Util.StringToBytes1024(im.message); |
927 | msg.MessageBlock.BinaryBucket = im.binaryBucket; | 976 | msg.MessageBlock.BinaryBucket = im.binaryBucket; |
928 | 977 | ||
929 | if (im.message.StartsWith("[grouptest]")) | 978 | OutPacket(msg, ThrottleOutPacketType.Task); |
930 | { // this block is test code for implementing group IM - delete when group IM is finished | ||
931 | IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); | ||
932 | if (eq != null) | ||
933 | { | ||
934 | im.dialog = 17; | ||
935 | |||
936 | //eq.ChatterboxInvitation( | ||
937 | // new UUID("00000000-68f9-1111-024e-222222111123"), | ||
938 | // "OpenSimulator Testing", im.fromAgentID, im.message, im.toAgentID, im.fromAgentName, im.dialog, 0, | ||
939 | // false, 0, new Vector3(), 1, im.imSessionID, im.fromGroup, im.binaryBucket); | ||
940 | |||
941 | eq.ChatterboxInvitation( | ||
942 | new UUID("00000000-68f9-1111-024e-222222111123"), | ||
943 | "OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0, | ||
944 | false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Util.StringToBytes256("OpenSimulator Testing")); | ||
945 | |||
946 | eq.ChatterBoxSessionAgentListUpdates( | ||
947 | new UUID("00000000-68f9-1111-024e-222222111123"), | ||
948 | new UUID(im.fromAgentID), new UUID(im.toAgentID), false, false, false); | ||
949 | } | ||
950 | |||
951 | Console.WriteLine("SendInstantMessage: " + msg); | ||
952 | } | ||
953 | else | ||
954 | OutPacket(msg, ThrottleOutPacketType.Task); | ||
955 | } | 979 | } |
956 | } | 980 | } |
957 | 981 | ||
@@ -1182,6 +1206,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1182 | OutPacket(GATRP, ThrottleOutPacketType.Task); | 1206 | OutPacket(GATRP, ThrottleOutPacketType.Task); |
1183 | } | 1207 | } |
1184 | 1208 | ||
1209 | |||
1210 | public virtual bool CanSendLayerData() | ||
1211 | { | ||
1212 | int n = m_udpClient.GetPacketsQueuedCount(ThrottleOutPacketType.Land); | ||
1213 | if ( n > 128) | ||
1214 | return false; | ||
1215 | return true; | ||
1216 | } | ||
1217 | |||
1185 | /// <summary> | 1218 | /// <summary> |
1186 | /// Send the region heightmap to the client | 1219 | /// Send the region heightmap to the client |
1187 | /// This method is only called when not doing intellegent terrain patch sending and | 1220 | /// This method is only called when not doing intellegent terrain patch sending and |
@@ -1192,6 +1225,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1192 | public virtual void SendLayerData(float[] map) | 1225 | public virtual void SendLayerData(float[] map) |
1193 | { | 1226 | { |
1194 | Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData(), "LLClientView.DoSendLayerData"); | 1227 | Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData(), "LLClientView.DoSendLayerData"); |
1228 | |||
1229 | // Send it sync, and async. It's not that much data | ||
1230 | // and it improves user experience just so much! | ||
1231 | // DoSendLayerData(map); | ||
1195 | } | 1232 | } |
1196 | 1233 | ||
1197 | /// <summary> | 1234 | /// <summary> |
@@ -1214,7 +1251,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1214 | //} | 1251 | //} |
1215 | 1252 | ||
1216 | // Send LayerData in a spiral pattern. Fun! | 1253 | // Send LayerData in a spiral pattern. Fun! |
1217 | SendLayerTopRight(map, 0, 0, map.SizeX/Constants.TerrainPatchSize-1, map.SizeY/Constants.TerrainPatchSize-1); | 1254 | SendLayerTopRight(map, 0, 0, map.SizeX / Constants.TerrainPatchSize - 1, map.SizeY / Constants.TerrainPatchSize - 1); |
1218 | } | 1255 | } |
1219 | catch (Exception e) | 1256 | catch (Exception e) |
1220 | { | 1257 | { |
@@ -1250,23 +1287,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1250 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | 1287 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); |
1251 | } | 1288 | } |
1252 | 1289 | ||
1253 | /// <summary> | ||
1254 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client | ||
1255 | /// </summary> | ||
1256 | /// <param name="map">heightmap</param> | ||
1257 | /// <param name="px">X coordinate for patches 0..12</param> | ||
1258 | /// <param name="py">Y coordinate for patches 0..15</param> | ||
1259 | // private void SendLayerPacket(float[] map, int y, int x) | ||
1260 | // { | ||
1261 | // int[] patches = new int[4]; | ||
1262 | // patches[0] = x + 0 + y * 16; | ||
1263 | // patches[1] = x + 1 + y * 16; | ||
1264 | // patches[2] = x + 2 + y * 16; | ||
1265 | // patches[3] = x + 3 + y * 16; | ||
1266 | |||
1267 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | ||
1268 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
1269 | // } | ||
1270 | 1290 | ||
1271 | // Legacy form of invocation that passes around a bare data array. | 1291 | // Legacy form of invocation that passes around a bare data array. |
1272 | // Just ignore what was passed and use the real terrain info that is part of the scene. | 1292 | // Just ignore what was passed and use the real terrain info that is part of the scene. |
@@ -1316,6 +1336,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1316 | } | 1336 | } |
1317 | 1337 | ||
1318 | /// <summary> | 1338 | /// <summary> |
1339 | |||
1319 | /// Sends a terrain packet for the point specified. | 1340 | /// Sends a terrain packet for the point specified. |
1320 | /// This is a legacy call that has refarbed the terrain into a flat map of floats. | 1341 | /// This is a legacy call that has refarbed the terrain into a flat map of floats. |
1321 | /// We just use the terrain from the region we know about. | 1342 | /// We just use the terrain from the region we know about. |
@@ -1334,32 +1355,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1334 | { | 1355 | { |
1335 | try | 1356 | try |
1336 | { | 1357 | { |
1337 | /* test code using the terrain compressor in libOpenMetaverse | 1358 | byte landPacketType; |
1338 | int[] patchInd = new int[1]; | 1359 | if (terrData.SizeX > Constants.RegionSize || terrData.SizeY > Constants.RegionSize) |
1339 | patchInd[0] = px + (py * Constants.TerrainPatchSize); | 1360 | landPacketType = (byte)TerrainPatch.LayerType.LandExtended; |
1340 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(terrData.GetFloatsSerialized(), patchInd); | 1361 | else |
1341 | */ | 1362 | landPacketType = (byte)TerrainPatch.LayerType.Land; |
1342 | // Many, many patches could have been passed to us. Since the patches will be compressed | ||
1343 | // into variable sized blocks, we cannot pre-compute how many will fit into one | ||
1344 | // packet. While some fancy packing algorithm is possible, 4 seems to always fit. | ||
1345 | int PatchesAssumedToFit = 4; | ||
1346 | for (int pcnt = 0; pcnt < px.Length; pcnt += PatchesAssumedToFit) | ||
1347 | { | ||
1348 | int remaining = Math.Min(px.Length - pcnt, PatchesAssumedToFit); | ||
1349 | int[] xPatches = new int[remaining]; | ||
1350 | int[] yPatches = new int[remaining]; | ||
1351 | for (int ii = 0; ii < remaining; ii++) | ||
1352 | { | ||
1353 | xPatches[ii] = px[pcnt + ii]; | ||
1354 | yPatches[ii] = py[pcnt + ii]; | ||
1355 | } | ||
1356 | LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(terrData, xPatches, yPatches); | ||
1357 | // DebugSendingPatches("SendLayerDataInternal", xPatches, yPatches); | ||
1358 | |||
1359 | SendTheLayerPacket(layerpack); | ||
1360 | } | ||
1361 | // LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(terrData, px, py); | ||
1362 | 1363 | ||
1364 | List<LayerDataPacket> packets = OpenSimTerrainCompressor.CreateLayerDataPackets(terrData, px, py, landPacketType); | ||
1365 | foreach(LayerDataPacket pkt in packets) | ||
1366 | OutPacket(pkt, ThrottleOutPacketType.Land); | ||
1363 | } | 1367 | } |
1364 | catch (Exception e) | 1368 | catch (Exception e) |
1365 | { | 1369 | { |
@@ -1367,36 +1371,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1367 | } | 1371 | } |
1368 | } | 1372 | } |
1369 | 1373 | ||
1370 | // When a user edits the terrain, so much data is sent, the data queues up fast and presents a | ||
1371 | // sub optimal editing experience. To alleviate this issue, when the user edits the terrain, we | ||
1372 | // start skipping the queues until they're done editing the terrain. We also make them | ||
1373 | // unreliable because it's extremely likely that multiple packets will be sent for a terrain patch | ||
1374 | // area invalidating previous packets for that area. | ||
1375 | |||
1376 | // It's possible for an editing user to flood themselves with edited packets but the majority | ||
1377 | // of use cases are such that only a tiny percentage of users will be editing the terrain. | ||
1378 | // Other, non-editing users will see the edits much slower. | ||
1379 | |||
1380 | // One last note on this topic, by the time users are going to be editing the terrain, it's | ||
1381 | // extremely likely that the sim will have rezzed already and therefore this is not likely going | ||
1382 | // to cause any additional issues with lost packets, objects or terrain patches. | ||
1383 | |||
1384 | // m_justEditedTerrain is volatile, so test once and duplicate two affected statements so we | ||
1385 | // only have one cache miss. | ||
1386 | private void SendTheLayerPacket(LayerDataPacket layerpack) | ||
1387 | { | ||
1388 | if (m_justEditedTerrain) | ||
1389 | { | ||
1390 | layerpack.Header.Reliable = false; | ||
1391 | OutPacket(layerpack, ThrottleOutPacketType.Unknown ); | ||
1392 | } | ||
1393 | else | ||
1394 | { | ||
1395 | layerpack.Header.Reliable = true; | ||
1396 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
1397 | } | ||
1398 | } | ||
1399 | |||
1400 | /// <summary> | 1374 | /// <summary> |
1401 | /// Send the wind matrix to the client | 1375 | /// Send the wind matrix to the client |
1402 | /// </summary> | 1376 | /// </summary> |
@@ -1432,13 +1406,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1432 | patches[1].Data[x] = windSpeeds[x].Y; | 1406 | patches[1].Data[x] = windSpeeds[x].Y; |
1433 | } | 1407 | } |
1434 | 1408 | ||
1409 | // neither we or viewers have extended wind | ||
1435 | byte layerType = (byte)TerrainPatch.LayerType.Wind; | 1410 | byte layerType = (byte)TerrainPatch.LayerType.Wind; |
1436 | if (m_scene.RegionInfo.RegionSizeX > Constants.RegionSize || m_scene.RegionInfo.RegionSizeY > Constants.RegionSize) | ||
1437 | layerType = (byte)TerrainPatch.LayerType.WindExtended; | ||
1438 | 1411 | ||
1439 | // LayerDataPacket layerpack = TerrainCompressor.CreateLayerDataPacket(patches, (TerrainPatch.LayerType)layerType); | 1412 | LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLayerDataPacketStandardSize(patches, layerType); |
1440 | LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLayerDataPacket(patches, layerType, | ||
1441 | (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY); | ||
1442 | layerpack.Header.Zerocoded = true; | 1413 | layerpack.Header.Zerocoded = true; |
1443 | OutPacket(layerpack, ThrottleOutPacketType.Wind); | 1414 | OutPacket(layerpack, ThrottleOutPacketType.Wind); |
1444 | } | 1415 | } |
@@ -1461,14 +1432,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1461 | patches[0].Data[y * 16 + x] = cloudCover[y * 16 + x]; | 1432 | patches[0].Data[y * 16 + x] = cloudCover[y * 16 + x]; |
1462 | } | 1433 | } |
1463 | } | 1434 | } |
1464 | 1435 | // neither we or viewers have extended clouds | |
1465 | byte layerType = (byte)TerrainPatch.LayerType.Cloud; | 1436 | byte layerType = (byte)TerrainPatch.LayerType.Cloud; |
1466 | if (m_scene.RegionInfo.RegionSizeX > Constants.RegionSize || m_scene.RegionInfo.RegionSizeY > Constants.RegionSize) | ||
1467 | layerType = (byte)TerrainPatch.LayerType.CloudExtended; | ||
1468 | 1437 | ||
1469 | // LayerDataPacket layerpack = TerrainCompressor.CreateLayerDataPacket(patches, (TerrainPatch.LayerType)layerType); | 1438 | LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLayerDataPacketStandardSize(patches, layerType); |
1470 | LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLayerDataPacket(patches, layerType, | ||
1471 | (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY); | ||
1472 | layerpack.Header.Zerocoded = true; | 1439 | layerpack.Header.Zerocoded = true; |
1473 | OutPacket(layerpack, ThrottleOutPacketType.Cloud); | 1440 | OutPacket(layerpack, ThrottleOutPacketType.Cloud); |
1474 | } | 1441 | } |
@@ -1735,11 +1702,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1735 | pc.PingID.OldestUnacked = 0; | 1702 | pc.PingID.OldestUnacked = 0; |
1736 | 1703 | ||
1737 | OutPacket(pc, ThrottleOutPacketType.Unknown); | 1704 | OutPacket(pc, ThrottleOutPacketType.Unknown); |
1705 | UDPClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount(); | ||
1738 | } | 1706 | } |
1739 | 1707 | ||
1740 | public void SendKillObject(List<uint> localIDs) | 1708 | public void SendKillObject(List<uint> localIDs) |
1741 | { | 1709 | { |
1742 | // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); | 1710 | // think we do need this |
1711 | // foreach (uint id in localIDs) | ||
1712 | // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); | ||
1713 | |||
1714 | // remove pending entities | ||
1715 | lock (m_entityProps.SyncRoot) | ||
1716 | m_entityProps.Remove(localIDs); | ||
1717 | lock (m_entityUpdates.SyncRoot) | ||
1718 | m_entityUpdates.Remove(localIDs); | ||
1743 | 1719 | ||
1744 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); | 1720 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); |
1745 | // TODO: don't create new blocks if recycling an old packet | 1721 | // TODO: don't create new blocks if recycling an old packet |
@@ -1752,28 +1728,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1752 | kill.Header.Reliable = true; | 1728 | kill.Header.Reliable = true; |
1753 | kill.Header.Zerocoded = true; | 1729 | kill.Header.Zerocoded = true; |
1754 | 1730 | ||
1755 | if (localIDs.Count == 1 && m_scene.GetScenePresence(localIDs[0]) != null) | 1731 | OutPacket(kill, ThrottleOutPacketType.Task); |
1756 | { | 1732 | } |
1757 | OutPacket(kill, ThrottleOutPacketType.Task); | ||
1758 | } | ||
1759 | else | ||
1760 | { | ||
1761 | // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race | ||
1762 | // condition where a kill can be processed before an out-of-date update for the same object. | ||
1763 | // ProcessEntityUpdates() also takes the m_killRecord lock. | ||
1764 | lock (m_killRecord) | ||
1765 | { | ||
1766 | foreach (uint localID in localIDs) | ||
1767 | m_killRecord.Add(localID); | ||
1768 | |||
1769 | // The throttle queue used here must match that being used for updates. Otherwise, there is a | ||
1770 | // chance that a kill packet put on a separate queue will be sent to the client before an existing | ||
1771 | // update packet on another queue. Receiving updates after kills results in unowned and undeletable | ||
1772 | // scene objects in a viewer until that viewer is relogged in. | ||
1773 | OutPacket(kill, ThrottleOutPacketType.Task); | ||
1774 | } | ||
1775 | } | ||
1776 | } | ||
1777 | 1733 | ||
1778 | /// <summary> | 1734 | /// <summary> |
1779 | /// Send information about the items contained in a folder to the client. | 1735 | /// Send information about the items contained in a folder to the client. |
@@ -1895,7 +1851,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1895 | newBlock.CreationDate = item.CreationDate; | 1851 | newBlock.CreationDate = item.CreationDate; |
1896 | newBlock.SalePrice = item.SalePrice; | 1852 | newBlock.SalePrice = item.SalePrice; |
1897 | newBlock.SaleType = item.SaleType; | 1853 | newBlock.SaleType = item.SaleType; |
1898 | newBlock.Flags = item.Flags; | 1854 | newBlock.Flags = item.Flags & 0x2000ff; |
1899 | 1855 | ||
1900 | newBlock.CRC = | 1856 | newBlock.CRC = |
1901 | Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType, | 1857 | Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType, |
@@ -2151,7 +2107,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2151 | itemBlock.GroupID = item.GroupID; | 2107 | itemBlock.GroupID = item.GroupID; |
2152 | itemBlock.GroupOwned = item.GroupOwned; | 2108 | itemBlock.GroupOwned = item.GroupOwned; |
2153 | itemBlock.GroupMask = item.GroupPermissions; | 2109 | itemBlock.GroupMask = item.GroupPermissions; |
2154 | itemBlock.Flags = item.Flags; | 2110 | itemBlock.Flags = item.Flags & 0x2000ff; |
2155 | itemBlock.SalePrice = item.SalePrice; | 2111 | itemBlock.SalePrice = item.SalePrice; |
2156 | itemBlock.SaleType = item.SaleType; | 2112 | itemBlock.SaleType = item.SaleType; |
2157 | itemBlock.CreationDate = item.CreationDate; | 2113 | itemBlock.CreationDate = item.CreationDate; |
@@ -2218,7 +2174,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2218 | bulkUpdate.ItemData[0].GroupID = item.GroupID; | 2174 | bulkUpdate.ItemData[0].GroupID = item.GroupID; |
2219 | bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned; | 2175 | bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned; |
2220 | bulkUpdate.ItemData[0].GroupMask = item.GroupPermissions; | 2176 | bulkUpdate.ItemData[0].GroupMask = item.GroupPermissions; |
2221 | bulkUpdate.ItemData[0].Flags = item.Flags; | 2177 | bulkUpdate.ItemData[0].Flags = item.Flags & 0x2000ff; |
2222 | bulkUpdate.ItemData[0].SalePrice = item.SalePrice; | 2178 | bulkUpdate.ItemData[0].SalePrice = item.SalePrice; |
2223 | bulkUpdate.ItemData[0].SaleType = item.SaleType; | 2179 | bulkUpdate.ItemData[0].SaleType = item.SaleType; |
2224 | 2180 | ||
@@ -2234,9 +2190,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2234 | OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); | 2190 | OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); |
2235 | } | 2191 | } |
2236 | 2192 | ||
2237 | /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see> | ||
2238 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) | 2193 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) |
2239 | { | 2194 | { |
2195 | SendInventoryItemCreateUpdate(Item, UUID.Zero, callbackId); | ||
2196 | } | ||
2197 | |||
2198 | /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see> | ||
2199 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId) | ||
2200 | { | ||
2240 | const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff; | 2201 | const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff; |
2241 | 2202 | ||
2242 | UpdateCreateInventoryItemPacket InventoryReply | 2203 | UpdateCreateInventoryItemPacket InventoryReply |
@@ -2246,6 +2207,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2246 | // TODO: don't create new blocks if recycling an old packet | 2207 | // TODO: don't create new blocks if recycling an old packet |
2247 | InventoryReply.AgentData.AgentID = AgentId; | 2208 | InventoryReply.AgentData.AgentID = AgentId; |
2248 | InventoryReply.AgentData.SimApproved = true; | 2209 | InventoryReply.AgentData.SimApproved = true; |
2210 | InventoryReply.AgentData.TransactionID = transactionID; | ||
2249 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; | 2211 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; |
2250 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); | 2212 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); |
2251 | InventoryReply.InventoryData[0].ItemID = Item.ID; | 2213 | InventoryReply.InventoryData[0].ItemID = Item.ID; |
@@ -2266,7 +2228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2266 | InventoryReply.InventoryData[0].GroupID = Item.GroupID; | 2228 | InventoryReply.InventoryData[0].GroupID = Item.GroupID; |
2267 | InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned; | 2229 | InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned; |
2268 | InventoryReply.InventoryData[0].GroupMask = Item.GroupPermissions; | 2230 | InventoryReply.InventoryData[0].GroupMask = Item.GroupPermissions; |
2269 | InventoryReply.InventoryData[0].Flags = Item.Flags; | 2231 | InventoryReply.InventoryData[0].Flags = Item.Flags & 0x2000ff; |
2270 | InventoryReply.InventoryData[0].SalePrice = Item.SalePrice; | 2232 | InventoryReply.InventoryData[0].SalePrice = Item.SalePrice; |
2271 | InventoryReply.InventoryData[0].SaleType = Item.SaleType; | 2233 | InventoryReply.InventoryData[0].SaleType = Item.SaleType; |
2272 | InventoryReply.InventoryData[0].CreationDate = Item.CreationDate; | 2234 | InventoryReply.InventoryData[0].CreationDate = Item.CreationDate; |
@@ -2315,16 +2277,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2315 | replytask.InventoryData.TaskID = taskID; | 2277 | replytask.InventoryData.TaskID = taskID; |
2316 | replytask.InventoryData.Serial = serial; | 2278 | replytask.InventoryData.Serial = serial; |
2317 | replytask.InventoryData.Filename = fileName; | 2279 | replytask.InventoryData.Filename = fileName; |
2318 | OutPacket(replytask, ThrottleOutPacketType.Asset); | 2280 | OutPacket(replytask, ThrottleOutPacketType.Task); |
2319 | } | 2281 | } |
2320 | 2282 | ||
2321 | public void SendXferPacket(ulong xferID, uint packet, byte[] data) | 2283 | public void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory) |
2322 | { | 2284 | { |
2285 | ThrottleOutPacketType type = ThrottleOutPacketType.Asset; | ||
2286 | if (isTaskInventory) | ||
2287 | type = ThrottleOutPacketType.Task; | ||
2288 | |||
2323 | SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); | 2289 | SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); |
2324 | sendXfer.XferID.ID = xferID; | 2290 | sendXfer.XferID.ID = xferID; |
2325 | sendXfer.XferID.Packet = packet; | 2291 | sendXfer.XferID.Packet = packet; |
2326 | sendXfer.DataPacket.Data = data; | 2292 | sendXfer.DataPacket.Data = data; |
2327 | OutPacket(sendXfer, ThrottleOutPacketType.Asset); | 2293 | OutPacket(sendXfer, type); |
2328 | } | 2294 | } |
2329 | 2295 | ||
2330 | public void SendAbortXferPacket(ulong xferID) | 2296 | public void SendAbortXferPacket(ulong xferID) |
@@ -2471,14 +2437,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2471 | // this is the username of the *owner* | 2437 | // this is the username of the *owner* |
2472 | dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName); | 2438 | dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName); |
2473 | dialog.Data.LastName = Util.StringToBytes256(ownerLastName); | 2439 | dialog.Data.LastName = Util.StringToBytes256(ownerLastName); |
2474 | dialog.Data.Message = Util.StringToBytes1024(msg); | 2440 | dialog.Data.Message = Util.StringToBytes(msg,512); |
2475 | dialog.Data.ImageID = textureID; | 2441 | dialog.Data.ImageID = textureID; |
2476 | dialog.Data.ChatChannel = ch; | 2442 | dialog.Data.ChatChannel = ch; |
2477 | ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[buttonlabels.Length]; | 2443 | ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[buttonlabels.Length]; |
2478 | for (int i = 0; i < buttonlabels.Length; i++) | 2444 | for (int i = 0; i < buttonlabels.Length; i++) |
2479 | { | 2445 | { |
2480 | buttons[i] = new ScriptDialogPacket.ButtonsBlock(); | 2446 | buttons[i] = new ScriptDialogPacket.ButtonsBlock(); |
2481 | buttons[i].ButtonLabel = Util.StringToBytes256(buttonlabels[i]); | 2447 | buttons[i].ButtonLabel = Util.StringToBytes(buttonlabels[i],24); |
2482 | } | 2448 | } |
2483 | dialog.Buttons = buttons; | 2449 | dialog.Buttons = buttons; |
2484 | 2450 | ||
@@ -2514,6 +2480,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2514 | OutPacket(sound, ThrottleOutPacketType.Task); | 2480 | OutPacket(sound, ThrottleOutPacketType.Task); |
2515 | } | 2481 | } |
2516 | 2482 | ||
2483 | public void SendTransferAbort(TransferRequestPacket transferRequest) | ||
2484 | { | ||
2485 | TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort); | ||
2486 | abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID; | ||
2487 | abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType; | ||
2488 | m_log.Debug("[Assets] Aborting transfer; asset request failed"); | ||
2489 | OutPacket(abort, ThrottleOutPacketType.Task); | ||
2490 | } | ||
2491 | |||
2517 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) | 2492 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) |
2518 | { | 2493 | { |
2519 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); | 2494 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); |
@@ -2730,8 +2705,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2730 | OutPacket(offp, ThrottleOutPacketType.Task); | 2705 | OutPacket(offp, ThrottleOutPacketType.Task); |
2731 | } | 2706 | } |
2732 | 2707 | ||
2733 | public void SendSitResponse(UUID TargetID, Vector3 OffsetPos, Quaternion SitOrientation, bool autopilot, | 2708 | public void SendFindAgent(UUID HunterID, UUID PreyID, double GlobalX, double GlobalY) |
2734 | Vector3 CameraAtOffset, Vector3 CameraEyeOffset, bool ForceMouseLook) | 2709 | { |
2710 | FindAgentPacket fap = new FindAgentPacket(); | ||
2711 | fap.AgentBlock.Hunter = HunterID; | ||
2712 | fap.AgentBlock.Prey = PreyID; | ||
2713 | fap.AgentBlock.SpaceIP = 0; | ||
2714 | |||
2715 | fap.LocationBlock = new FindAgentPacket.LocationBlockBlock[1]; | ||
2716 | fap.LocationBlock[0] = new FindAgentPacket.LocationBlockBlock(); | ||
2717 | fap.LocationBlock[0].GlobalX = GlobalX; | ||
2718 | fap.LocationBlock[0].GlobalY = GlobalY; | ||
2719 | |||
2720 | OutPacket(fap, ThrottleOutPacketType.Task); | ||
2721 | } | ||
2722 | |||
2723 | public void SendSitResponse(UUID TargetID, Vector3 OffsetPos, | ||
2724 | Quaternion SitOrientation, bool autopilot, | ||
2725 | Vector3 CameraAtOffset, Vector3 CameraEyeOffset, bool ForceMouseLook) | ||
2735 | { | 2726 | { |
2736 | AvatarSitResponsePacket avatarSitResponse = new AvatarSitResponsePacket(); | 2727 | AvatarSitResponsePacket avatarSitResponse = new AvatarSitResponsePacket(); |
2737 | avatarSitResponse.SitObject.ID = TargetID; | 2728 | avatarSitResponse.SitObject.ID = TargetID; |
@@ -2819,6 +2810,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2819 | float friction = part.Friction; | 2810 | float friction = part.Friction; |
2820 | float bounce = part.Restitution; | 2811 | float bounce = part.Restitution; |
2821 | float gravmod = part.GravityModifier; | 2812 | float gravmod = part.GravityModifier; |
2813 | |||
2822 | eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); | 2814 | eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); |
2823 | } | 2815 | } |
2824 | } | 2816 | } |
@@ -2889,8 +2881,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2889 | LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType); | 2881 | LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType); |
2890 | return; | 2882 | return; |
2891 | } | 2883 | } |
2884 | int WearableOut = 0; | ||
2885 | bool isWearable = false; | ||
2886 | |||
2887 | if (req.AssetInf != null) | ||
2888 | isWearable = | ||
2889 | ((AssetType) req.AssetInf.Type == | ||
2890 | AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing); | ||
2892 | 2891 | ||
2893 | //m_log.Debug("sending asset " + req.RequestAssetID); | 2892 | |
2893 | //m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable); | ||
2894 | |||
2895 | |||
2896 | //if (isWearable) | ||
2897 | // m_log.Debug((AssetType)req.AssetInf.Type); | ||
2898 | |||
2894 | TransferInfoPacket Transfer = new TransferInfoPacket(); | 2899 | TransferInfoPacket Transfer = new TransferInfoPacket(); |
2895 | Transfer.TransferInfo.ChannelType = 2; | 2900 | Transfer.TransferInfo.ChannelType = 2; |
2896 | Transfer.TransferInfo.Status = 0; | 2901 | Transfer.TransferInfo.Status = 0; |
@@ -2912,7 +2917,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2912 | Transfer.TransferInfo.Size = req.AssetInf.Data.Length; | 2917 | Transfer.TransferInfo.Size = req.AssetInf.Data.Length; |
2913 | Transfer.TransferInfo.TransferID = req.TransferRequestID; | 2918 | Transfer.TransferInfo.TransferID = req.TransferRequestID; |
2914 | Transfer.Header.Zerocoded = true; | 2919 | Transfer.Header.Zerocoded = true; |
2915 | OutPacket(Transfer, ThrottleOutPacketType.Asset); | 2920 | OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); |
2916 | 2921 | ||
2917 | if (req.NumPackets == 1) | 2922 | if (req.NumPackets == 1) |
2918 | { | 2923 | { |
@@ -2923,12 +2928,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2923 | TransferPacket.TransferData.Data = req.AssetInf.Data; | 2928 | TransferPacket.TransferData.Data = req.AssetInf.Data; |
2924 | TransferPacket.TransferData.Status = 1; | 2929 | TransferPacket.TransferData.Status = 1; |
2925 | TransferPacket.Header.Zerocoded = true; | 2930 | TransferPacket.Header.Zerocoded = true; |
2926 | OutPacket(TransferPacket, ThrottleOutPacketType.Asset); | 2931 | OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); |
2927 | } | 2932 | } |
2928 | else | 2933 | else |
2929 | { | 2934 | { |
2930 | int processedLength = 0; | 2935 | int processedLength = 0; |
2931 | int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; | 2936 | // int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; |
2937 | |||
2938 | int maxChunkSize = (int) MaxTransferBytesPerPacket; | ||
2932 | int packetNumber = 0; | 2939 | int packetNumber = 0; |
2933 | 2940 | ||
2934 | while (processedLength < req.AssetInf.Data.Length) | 2941 | while (processedLength < req.AssetInf.Data.Length) |
@@ -2954,7 +2961,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2954 | TransferPacket.TransferData.Status = 1; | 2961 | TransferPacket.TransferData.Status = 1; |
2955 | } | 2962 | } |
2956 | TransferPacket.Header.Zerocoded = true; | 2963 | TransferPacket.Header.Zerocoded = true; |
2957 | OutPacket(TransferPacket, ThrottleOutPacketType.Asset); | 2964 | OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); |
2958 | 2965 | ||
2959 | processedLength += chunkSize; | 2966 | processedLength += chunkSize; |
2960 | packetNumber++; | 2967 | packetNumber++; |
@@ -2999,7 +3006,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2999 | reply.Data.ParcelID = parcelID; | 3006 | reply.Data.ParcelID = parcelID; |
3000 | reply.Data.OwnerID = land.OwnerID; | 3007 | reply.Data.OwnerID = land.OwnerID; |
3001 | reply.Data.Name = Utils.StringToBytes(land.Name); | 3008 | reply.Data.Name = Utils.StringToBytes(land.Name); |
3002 | reply.Data.Desc = Utils.StringToBytes(land.Description); | 3009 | if (land != null && land.Description != null && land.Description != String.Empty) |
3010 | reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); | ||
3011 | else | ||
3012 | reply.Data.Desc = new Byte[0]; | ||
3003 | reply.Data.ActualArea = land.Area; | 3013 | reply.Data.ActualArea = land.Area; |
3004 | reply.Data.BillableArea = land.Area; // TODO: what is this? | 3014 | reply.Data.BillableArea = land.Area; // TODO: what is this? |
3005 | 3015 | ||
@@ -3385,7 +3395,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3385 | AgentData.Add(AgentDataMap); | 3395 | AgentData.Add(AgentDataMap); |
3386 | llsd.Add("AgentData", AgentData); | 3396 | llsd.Add("AgentData", AgentData); |
3387 | OSDArray GroupData = new OSDArray(data.Length); | 3397 | OSDArray GroupData = new OSDArray(data.Length); |
3388 | OSDArray NewGroupData = new OSDArray(data.Length); | 3398 | // OSDArray NewGroupData = new OSDArray(data.Length); |
3389 | foreach (GroupMembershipData m in data) | 3399 | foreach (GroupMembershipData m in data) |
3390 | { | 3400 | { |
3391 | OSDMap GroupDataMap = new OSDMap(6); | 3401 | OSDMap GroupDataMap = new OSDMap(6); |
@@ -3396,12 +3406,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3396 | GroupDataMap.Add("GroupID", OSD.FromUUID(m.GroupID)); | 3406 | GroupDataMap.Add("GroupID", OSD.FromUUID(m.GroupID)); |
3397 | GroupDataMap.Add("GroupName", OSD.FromString(m.GroupName)); | 3407 | GroupDataMap.Add("GroupName", OSD.FromString(m.GroupName)); |
3398 | GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(m.GroupPicture)); | 3408 | GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(m.GroupPicture)); |
3399 | NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(m.ListInProfile)); | 3409 | // NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(m.ListInProfile)); |
3400 | GroupData.Add(GroupDataMap); | 3410 | GroupData.Add(GroupDataMap); |
3401 | NewGroupData.Add(NewGroupDataMap); | 3411 | // NewGroupData.Add(NewGroupDataMap); |
3402 | } | 3412 | } |
3403 | llsd.Add("GroupData", GroupData); | 3413 | llsd.Add("GroupData", GroupData); |
3404 | llsd.Add("NewGroupData", NewGroupData); | 3414 | // llsd.Add("NewGroupData", NewGroupData); |
3405 | 3415 | ||
3406 | IEventQueue eq = this.Scene.RequestModuleInterface<IEventQueue>(); | 3416 | IEventQueue eq = this.Scene.RequestModuleInterface<IEventQueue>(); |
3407 | if (eq != null) | 3417 | if (eq != null) |
@@ -3410,6 +3420,45 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3410 | } | 3420 | } |
3411 | } | 3421 | } |
3412 | 3422 | ||
3423 | public void SendAgentGroupDataUpdate(UUID avatarID, GroupMembershipData[] data) | ||
3424 | { | ||
3425 | IEventQueue eq = this.Scene.RequestModuleInterface<IEventQueue>(); | ||
3426 | |||
3427 | // use UDP if no caps | ||
3428 | if (eq == null) | ||
3429 | { | ||
3430 | SendGroupMembership(data); | ||
3431 | } | ||
3432 | |||
3433 | OSDMap llsd = new OSDMap(3); | ||
3434 | OSDArray AgentData = new OSDArray(1); | ||
3435 | OSDMap AgentDataMap = new OSDMap(1); | ||
3436 | AgentDataMap.Add("AgentID", OSD.FromUUID(this.AgentId)); | ||
3437 | AgentDataMap.Add("AvatarID", OSD.FromUUID(avatarID)); | ||
3438 | AgentData.Add(AgentDataMap); | ||
3439 | llsd.Add("AgentData", AgentData); | ||
3440 | OSDArray GroupData = new OSDArray(data.Length); | ||
3441 | OSDArray NewGroupData = new OSDArray(data.Length); | ||
3442 | foreach (GroupMembershipData m in data) | ||
3443 | { | ||
3444 | OSDMap GroupDataMap = new OSDMap(6); | ||
3445 | OSDMap NewGroupDataMap = new OSDMap(1); | ||
3446 | GroupDataMap.Add("GroupPowers", OSD.FromULong(m.GroupPowers)); | ||
3447 | GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(m.AcceptNotices)); | ||
3448 | GroupDataMap.Add("GroupTitle", OSD.FromString(m.GroupTitle)); | ||
3449 | GroupDataMap.Add("GroupID", OSD.FromUUID(m.GroupID)); | ||
3450 | GroupDataMap.Add("GroupName", OSD.FromString(m.GroupName)); | ||
3451 | GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(m.GroupPicture)); | ||
3452 | NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(m.ListInProfile)); | ||
3453 | GroupData.Add(GroupDataMap); | ||
3454 | NewGroupData.Add(NewGroupDataMap); | ||
3455 | } | ||
3456 | llsd.Add("GroupData", GroupData); | ||
3457 | llsd.Add("NewGroupData", NewGroupData); | ||
3458 | |||
3459 | eq.Enqueue(BuildEvent("AgentGroupDataUpdate", llsd), this.AgentId); | ||
3460 | } | ||
3461 | |||
3413 | public void SendJoinGroupReply(UUID groupID, bool success) | 3462 | public void SendJoinGroupReply(UUID groupID, bool success) |
3414 | { | 3463 | { |
3415 | JoinGroupReplyPacket p = (JoinGroupReplyPacket)PacketPool.Instance.GetPacket(PacketType.JoinGroupReply); | 3464 | JoinGroupReplyPacket p = (JoinGroupReplyPacket)PacketPool.Instance.GetPacket(PacketType.JoinGroupReply); |
@@ -3706,24 +3755,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3706 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; | 3755 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; |
3707 | AgentWearablesUpdatePacket.WearableDataBlock awb; | 3756 | AgentWearablesUpdatePacket.WearableDataBlock awb; |
3708 | int idx = 0; | 3757 | int idx = 0; |
3709 | for (int i = 0; i < wearables.Length; i++) | 3758 | |
3710 | { | 3759 | for (int i = 0; i < wearables.Length; i++) |
3711 | for (int j = 0; j < wearables[i].Count; j++) | 3760 | { |
3712 | { | 3761 | for (int j = 0; j < wearables[i].Count; j++) |
3713 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | 3762 | { |
3714 | awb.WearableType = (byte)i; | 3763 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); |
3715 | awb.AssetID = wearables[i][j].AssetID; | 3764 | awb.WearableType = (byte) i; |
3716 | awb.ItemID = wearables[i][j].ItemID; | 3765 | awb.AssetID = wearables[i][j].AssetID; |
3717 | aw.WearableData[idx] = awb; | 3766 | awb.ItemID = wearables[i][j].ItemID; |
3718 | idx++; | 3767 | aw.WearableData[idx] = awb; |
3719 | 3768 | idx++; | |
3720 | // m_log.DebugFormat( | 3769 | |
3721 | // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", | 3770 | // m_log.DebugFormat( |
3722 | // awb.ItemID, awb.AssetID, i, Name); | 3771 | // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", |
3723 | } | 3772 | // awb.ItemID, awb.AssetID, i, Name); |
3724 | } | 3773 | } |
3774 | } | ||
3725 | 3775 | ||
3726 | OutPacket(aw, ThrottleOutPacketType.Task); | 3776 | OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); |
3727 | } | 3777 | } |
3728 | 3778 | ||
3729 | public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) | 3779 | public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) |
@@ -3749,8 +3799,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3749 | avp.Sender.ID = agentID; | 3799 | avp.Sender.ID = agentID; |
3750 | avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0]; | 3800 | avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0]; |
3751 | avp.AppearanceHover = new AvatarAppearancePacket.AppearanceHoverBlock[0]; | 3801 | avp.AppearanceHover = new AvatarAppearancePacket.AppearanceHoverBlock[0]; |
3802 | |||
3803 | // this need be use in future ? | ||
3804 | // avp.AppearanceData[0].AppearanceVersion = 0; | ||
3805 | // avp.AppearanceData[0].CofVersion = 0; | ||
3806 | |||
3752 | //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); | 3807 | //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); |
3753 | OutPacket(avp, ThrottleOutPacketType.Task); | 3808 | OutPacket(avp, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); |
3754 | } | 3809 | } |
3755 | 3810 | ||
3756 | public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) | 3811 | public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) |
@@ -3778,7 +3833,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3778 | ani.AnimationSourceList[i].ObjectID = objectIDs[i]; | 3833 | ani.AnimationSourceList[i].ObjectID = objectIDs[i]; |
3779 | } | 3834 | } |
3780 | ani.Header.Reliable = false; | 3835 | ani.Header.Reliable = false; |
3781 | OutPacket(ani, ThrottleOutPacketType.Task); | 3836 | OutPacket(ani, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); |
3782 | } | 3837 | } |
3783 | 3838 | ||
3784 | #endregion | 3839 | #endregion |
@@ -3802,12 +3857,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3802 | objupdate.Header.Zerocoded = true; | 3857 | objupdate.Header.Zerocoded = true; |
3803 | 3858 | ||
3804 | objupdate.RegionData.RegionHandle = presence.RegionHandle; | 3859 | objupdate.RegionData.RegionHandle = presence.RegionHandle; |
3805 | objupdate.RegionData.TimeDilation = ushort.MaxValue; | 3860 | // objupdate.RegionData.TimeDilation = ushort.MaxValue; |
3806 | 3861 | objupdate.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); | |
3807 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | 3862 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; |
3808 | objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence); | 3863 | objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence); |
3809 | 3864 | ||
3810 | OutPacket(objupdate, ThrottleOutPacketType.Task); | 3865 | OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); |
3811 | 3866 | ||
3812 | // We need to record the avatar local id since the root prim of an attachment points to this. | 3867 | // We need to record the avatar local id since the root prim of an attachment points to this. |
3813 | // m_attachmentsSent.Add(avatar.LocalId); | 3868 | // m_attachmentsSent.Add(avatar.LocalId); |
@@ -3866,6 +3921,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3866 | /// </summary> | 3921 | /// </summary> |
3867 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) | 3922 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) |
3868 | { | 3923 | { |
3924 | /* | ||
3869 | if (entity.UUID == m_agentId && !updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | 3925 | if (entity.UUID == m_agentId && !updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) |
3870 | { | 3926 | { |
3871 | ImprovedTerseObjectUpdatePacket packet | 3927 | ImprovedTerseObjectUpdatePacket packet |
@@ -3876,15 +3932,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3876 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 3932 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
3877 | packet.ObjectData[0] = CreateImprovedTerseBlock(entity, false); | 3933 | packet.ObjectData[0] = CreateImprovedTerseBlock(entity, false); |
3878 | OutPacket(packet, ThrottleOutPacketType.Unknown, true); | 3934 | OutPacket(packet, ThrottleOutPacketType.Unknown, true); |
3935 | return; | ||
3879 | } | 3936 | } |
3880 | else | 3937 | */ |
3938 | if (entity is SceneObjectPart) | ||
3881 | { | 3939 | { |
3882 | //double priority = m_prioritizer.GetUpdatePriority(this, entity); | 3940 | SceneObjectPart e = (SceneObjectPart)entity; |
3883 | uint priority = m_prioritizer.GetUpdatePriority(this, entity); | 3941 | SceneObjectGroup g = e.ParentGroup; |
3884 | 3942 | if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId) | |
3885 | lock (m_entityUpdates.SyncRoot) | 3943 | return; // Don't send updates for other people's HUDs |
3886 | m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); | ||
3887 | } | 3944 | } |
3945 | |||
3946 | //double priority = m_prioritizer.GetUpdatePriority(this, entity); | ||
3947 | uint priority = m_prioritizer.GetUpdatePriority(this, entity); | ||
3948 | |||
3949 | lock (m_entityUpdates.SyncRoot) | ||
3950 | m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); | ||
3888 | } | 3951 | } |
3889 | 3952 | ||
3890 | /// <summary> | 3953 | /// <summary> |
@@ -3894,8 +3957,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3894 | /// The original update time is used for the merged update. | 3957 | /// The original update time is used for the merged update. |
3895 | /// </summary> | 3958 | /// </summary> |
3896 | private void ResendPrimUpdate(EntityUpdate update) | 3959 | private void ResendPrimUpdate(EntityUpdate update) |
3897 | { | 3960 | { |
3898 | // If the update exists in priority queue, it will be updated. | 3961 | // If the update exists in priority queue, it will be updated. |
3899 | // If it does not exist then it will be added with the current (rather than its original) priority | 3962 | // If it does not exist then it will be added with the current (rather than its original) priority |
3900 | uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); | 3963 | uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); |
3901 | 3964 | ||
@@ -3919,7 +3982,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3919 | m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber); | 3982 | m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber); |
3920 | 3983 | ||
3921 | // Count this as a resent packet since we are going to requeue all of the updates contained in it | 3984 | // Count this as a resent packet since we are going to requeue all of the updates contained in it |
3922 | Interlocked.Increment(ref m_udpClient.PacketsResent); | 3985 | Interlocked.Increment(ref m_udpClient.PacketsResent); |
3923 | 3986 | ||
3924 | // We're not going to worry about interlock yet since its not currently critical that this total count | 3987 | // We're not going to worry about interlock yet since its not currently critical that this total count |
3925 | // is 100% correct | 3988 | // is 100% correct |
@@ -3928,18 +3991,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3928 | foreach (EntityUpdate update in updates) | 3991 | foreach (EntityUpdate update in updates) |
3929 | ResendPrimUpdate(update); | 3992 | ResendPrimUpdate(update); |
3930 | } | 3993 | } |
3931 | 3994 | ||
3932 | // OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); | ||
3933 | // OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); | ||
3934 | // OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); | ||
3935 | // OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); | ||
3936 | // | ||
3937 | // OpenSim.Framework.Lazy<List<EntityUpdate>> objectUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); | ||
3938 | // OpenSim.Framework.Lazy<List<EntityUpdate>> compressedUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); | ||
3939 | // OpenSim.Framework.Lazy<List<EntityUpdate>> terseUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); | ||
3940 | // OpenSim.Framework.Lazy<List<EntityUpdate>> terseAgentUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); | ||
3941 | |||
3942 | |||
3943 | private void ProcessEntityUpdates(int maxUpdates) | 3995 | private void ProcessEntityUpdates(int maxUpdates) |
3944 | { | 3996 | { |
3945 | OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); | 3997 | OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); |
@@ -3952,15 +4004,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3952 | OpenSim.Framework.Lazy<List<EntityUpdate>> terseUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); | 4004 | OpenSim.Framework.Lazy<List<EntityUpdate>> terseUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); |
3953 | OpenSim.Framework.Lazy<List<EntityUpdate>> terseAgentUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); | 4005 | OpenSim.Framework.Lazy<List<EntityUpdate>> terseAgentUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); |
3954 | 4006 | ||
3955 | // objectUpdateBlocks.Value.Clear(); | ||
3956 | // compressedUpdateBlocks.Value.Clear(); | ||
3957 | // terseUpdateBlocks.Value.Clear(); | ||
3958 | // terseAgentUpdateBlocks.Value.Clear(); | ||
3959 | // objectUpdates.Value.Clear(); | ||
3960 | // compressedUpdates.Value.Clear(); | ||
3961 | // terseUpdates.Value.Clear(); | ||
3962 | // terseAgentUpdates.Value.Clear(); | ||
3963 | |||
3964 | // Check to see if this is a flush | 4007 | // Check to see if this is a flush |
3965 | if (maxUpdates <= 0) | 4008 | if (maxUpdates <= 0) |
3966 | { | 4009 | { |
@@ -3971,54 +4014,71 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3971 | 4014 | ||
3972 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race | 4015 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race |
3973 | // condition where a kill can be processed before an out-of-date update for the same object. | 4016 | // condition where a kill can be processed before an out-of-date update for the same object. |
3974 | lock (m_killRecord) | 4017 | // float avgTimeDilation = 0.0f; |
4018 | IEntityUpdate iupdate; | ||
4019 | Int32 timeinqueue; // this is just debugging code & can be dropped later | ||
4020 | |||
4021 | while (updatesThisCall < maxUpdates) | ||
3975 | { | 4022 | { |
3976 | float avgTimeDilation = 1.0f; | 4023 | lock (m_entityUpdates.SyncRoot) |
3977 | IEntityUpdate iupdate; | 4024 | if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue)) |
3978 | Int32 timeinqueue; // this is just debugging code & can be dropped later | 4025 | break; |
3979 | 4026 | ||
3980 | while (updatesThisCall < maxUpdates) | 4027 | EntityUpdate update = (EntityUpdate)iupdate; |
4028 | |||
4029 | // avgTimeDilation += update.TimeDilation; | ||
4030 | |||
4031 | if (update.Entity is SceneObjectPart) | ||
3981 | { | 4032 | { |
3982 | lock (m_entityUpdates.SyncRoot) | 4033 | SceneObjectPart part = (SceneObjectPart)update.Entity; |
3983 | if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue)) | ||
3984 | break; | ||
3985 | 4034 | ||
3986 | EntityUpdate update = (EntityUpdate)iupdate; | 4035 | if (part.ParentGroup.IsDeleted || part.ParentGroup.inTransit) |
3987 | 4036 | continue; | |
3988 | avgTimeDilation += update.TimeDilation; | ||
3989 | avgTimeDilation *= 0.5f; | ||
3990 | 4037 | ||
3991 | if (update.Entity is SceneObjectPart) | 4038 | if (part.ParentGroup.IsAttachment) |
3992 | { | 4039 | { // Someone else's HUD, why are we getting these? |
3993 | SceneObjectPart part = (SceneObjectPart)update.Entity; | 4040 | if (part.ParentGroup.OwnerID != AgentId && part.ParentGroup.HasPrivateAttachmentPoint) |
3994 | |||
3995 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client | ||
3996 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good | ||
3997 | // safety measure. | ||
3998 | // | ||
3999 | // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update | ||
4000 | // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs | ||
4001 | // updates and kills on different threads with different scheduling strategies, hence this protection. | ||
4002 | // | ||
4003 | // This doesn't appear to apply to child prims - a client will happily ignore these updates | ||
4004 | // after the root prim has been deleted. | ||
4005 | if (m_killRecord.Contains(part.LocalId)) | ||
4006 | { | ||
4007 | // m_log.WarnFormat( | ||
4008 | // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted", | ||
4009 | // part.LocalId, Name); | ||
4010 | continue; | 4041 | continue; |
4011 | } | 4042 | ScenePresence sp; |
4012 | 4043 | // Owner is not in the sim, don't update it to | |
4013 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | 4044 | // anyone |
4045 | if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) | ||
4046 | continue; | ||
4047 | |||
4048 | List<SceneObjectGroup> atts = sp.GetAttachments(); | ||
4049 | bool found = false; | ||
4050 | foreach (SceneObjectGroup att in atts) | ||
4014 | { | 4051 | { |
4015 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | 4052 | if (att == part.ParentGroup) |
4016 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | ||
4017 | { | 4053 | { |
4018 | part.Shape.LightEntry = false; | 4054 | found = true; |
4055 | break; | ||
4019 | } | 4056 | } |
4020 | } | 4057 | } |
4021 | 4058 | ||
4059 | // It's an attachment of a valid avatar, but | ||
4060 | // doesn't seem to be attached, skip | ||
4061 | if (!found) | ||
4062 | continue; | ||
4063 | |||
4064 | // On vehicle crossing, the attachments are received | ||
4065 | // while the avatar is still a child. Don't send | ||
4066 | // updates here because the LocalId has not yet | ||
4067 | // been updated and the viewer will derender the | ||
4068 | // attachments until the avatar becomes root. | ||
4069 | if (sp.IsChildAgent) | ||
4070 | continue; | ||
4071 | |||
4072 | } | ||
4073 | |||
4074 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | ||
4075 | { | ||
4076 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | ||
4077 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | ||
4078 | { | ||
4079 | part.Shape.LightEntry = false; | ||
4080 | } | ||
4081 | |||
4022 | if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) | 4082 | if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) |
4023 | { | 4083 | { |
4024 | // Ensure that mesh has at least 8 valid faces | 4084 | // Ensure that mesh has at least 8 valid faces |
@@ -4027,233 +4087,218 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4027 | part.Shape.ProfileHollow = 27500; | 4087 | part.Shape.ProfileHollow = 27500; |
4028 | } | 4088 | } |
4029 | } | 4089 | } |
4030 | 4090 | ||
4031 | #region UpdateFlags to packet type conversion | 4091 | if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) |
4032 | |||
4033 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; | ||
4034 | |||
4035 | bool canUseCompressed = true; | ||
4036 | bool canUseImproved = true; | ||
4037 | |||
4038 | // Compressed object updates only make sense for LL primitives | ||
4039 | if (!(update.Entity is SceneObjectPart)) | ||
4040 | { | 4092 | { |
4041 | canUseCompressed = false; | 4093 | // Ensure that mesh has at least 8 valid faces |
4094 | part.Shape.ProfileBegin = 12500; | ||
4095 | part.Shape.ProfileEnd = 0; | ||
4096 | part.Shape.ProfileHollow = 27500; | ||
4042 | } | 4097 | } |
4043 | 4098 | } | |
4044 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | 4099 | else if (update.Entity is ScenePresence) |
4100 | { | ||
4101 | ScenePresence presence = (ScenePresence)update.Entity; | ||
4102 | if (presence.IsDeleted) | ||
4103 | continue; | ||
4104 | // If ParentUUID is not UUID.Zero and ParentID is 0, this | ||
4105 | // avatar is in the process of crossing regions while | ||
4106 | // sat on an object. In this state, we don't want any | ||
4107 | // updates because they will visually orbit the avatar. | ||
4108 | // Update will be forced once crossing is completed anyway. | ||
4109 | if (presence.ParentUUID != UUID.Zero && presence.ParentID == 0) | ||
4110 | continue; | ||
4111 | } | ||
4112 | |||
4113 | ++updatesThisCall; | ||
4114 | |||
4115 | #region UpdateFlags to packet type conversion | ||
4116 | |||
4117 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; | ||
4118 | |||
4119 | bool canUseCompressed = true; | ||
4120 | bool canUseImproved = true; | ||
4121 | |||
4122 | // Compressed object updates only make sense for LL primitives | ||
4123 | if (!(update.Entity is SceneObjectPart)) | ||
4124 | { | ||
4125 | canUseCompressed = false; | ||
4126 | } | ||
4127 | |||
4128 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | ||
4129 | { | ||
4130 | canUseCompressed = false; | ||
4131 | canUseImproved = false; | ||
4132 | } | ||
4133 | else | ||
4134 | { | ||
4135 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || | ||
4136 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || | ||
4137 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || | ||
4138 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
4045 | { | 4139 | { |
4046 | canUseCompressed = false; | 4140 | canUseCompressed = false; |
4047 | canUseImproved = false; | ||
4048 | } | 4141 | } |
4049 | else | 4142 | |
4143 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || | ||
4144 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
4145 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
4146 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
4147 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
4148 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
4149 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
4150 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
4151 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
4152 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
4153 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
4154 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
4155 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
4156 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
4050 | { | 4157 | { |
4051 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || | 4158 | canUseImproved = false; |
4052 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || | ||
4053 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || | ||
4054 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
4055 | { | ||
4056 | canUseCompressed = false; | ||
4057 | } | ||
4058 | |||
4059 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || | ||
4060 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
4061 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
4062 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
4063 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
4064 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
4065 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
4066 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
4067 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
4068 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
4069 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
4070 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
4071 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
4072 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
4073 | { | ||
4074 | canUseImproved = false; | ||
4075 | } | ||
4076 | } | 4159 | } |
4160 | } | ||
4077 | 4161 | ||
4078 | #endregion UpdateFlags to packet type conversion | 4162 | #endregion UpdateFlags to packet type conversion |
4079 | |||
4080 | #region Block Construction | ||
4081 | |||
4082 | // TODO: Remove this once we can build compressed updates | ||
4083 | canUseCompressed = false; | ||
4084 | |||
4085 | if (!canUseImproved && !canUseCompressed) | ||
4086 | { | ||
4087 | ObjectUpdatePacket.ObjectDataBlock updateBlock; | ||
4088 | 4163 | ||
4089 | if (update.Entity is ScenePresence) | 4164 | #region Block Construction |
4090 | { | ||
4091 | updateBlock = CreateAvatarUpdateBlock((ScenePresence)update.Entity); | ||
4092 | } | ||
4093 | else | ||
4094 | { | ||
4095 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
4096 | updateBlock = CreatePrimUpdateBlock(part, AgentId); | ||
4097 | |||
4098 | // If the part has become a private hud since the update was scheduled then we do not | ||
4099 | // want to send it to other avatars. | ||
4100 | if (part.ParentGroup.IsAttachment | ||
4101 | && part.ParentGroup.HasPrivateAttachmentPoint | ||
4102 | && part.ParentGroup.AttachedAvatar != AgentId) | ||
4103 | continue; | ||
4104 | |||
4105 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
4106 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
4107 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
4108 | // of the test above). | ||
4109 | // | ||
4110 | // Actual deletions (kills) happen in another method. | ||
4111 | if (part.ParentGroup.IsDeleted) | ||
4112 | continue; | ||
4113 | } | ||
4114 | 4165 | ||
4115 | objectUpdateBlocks.Value.Add(updateBlock); | 4166 | // TODO: Remove this once we can build compressed updates |
4116 | objectUpdates.Value.Add(update); | 4167 | canUseCompressed = false; |
4117 | } | ||
4118 | else if (!canUseImproved) | ||
4119 | { | ||
4120 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
4121 | ObjectUpdateCompressedPacket.ObjectDataBlock compressedBlock | ||
4122 | = CreateCompressedUpdateBlock(part, updateFlags); | ||
4123 | |||
4124 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
4125 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
4126 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
4127 | // of the test above). | ||
4128 | // | ||
4129 | // Actual deletions (kills) happen in another method. | ||
4130 | if (part.ParentGroup.IsDeleted) | ||
4131 | continue; | ||
4132 | 4168 | ||
4133 | compressedUpdateBlocks.Value.Add(compressedBlock); | 4169 | if (!canUseImproved && !canUseCompressed) |
4134 | compressedUpdates.Value.Add(update); | 4170 | { |
4171 | if (update.Entity is ScenePresence) | ||
4172 | { | ||
4173 | objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); | ||
4135 | } | 4174 | } |
4136 | else | 4175 | else |
4137 | { | 4176 | { |
4138 | if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) | 4177 | objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); |
4139 | { | 4178 | } |
4140 | // Self updates go into a special list | 4179 | } |
4141 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | 4180 | else if (!canUseImproved) |
4142 | terseAgentUpdates.Value.Add(update); | 4181 | { |
4143 | } | 4182 | compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); |
4144 | else | 4183 | } |
4145 | { | 4184 | else |
4146 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseUpdateBlock | 4185 | { |
4147 | = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); | 4186 | if (update.Entity is ScenePresence) |
4187 | // ALL presence updates go into a special list | ||
4188 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
4189 | else | ||
4190 | // Everything else goes here | ||
4191 | terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
4192 | } | ||
4148 | 4193 | ||
4149 | // Everything else goes here | 4194 | #endregion Block Construction |
4150 | if (update.Entity is SceneObjectPart) | 4195 | } |
4151 | { | ||
4152 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
4153 | |||
4154 | // If the part has become a private hud since the update was scheduled then we do not | ||
4155 | // want to send it to other avatars. | ||
4156 | if (part.ParentGroup.IsAttachment | ||
4157 | && part.ParentGroup.HasPrivateAttachmentPoint | ||
4158 | && part.ParentGroup.AttachedAvatar != AgentId) | ||
4159 | continue; | ||
4160 | |||
4161 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
4162 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
4163 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
4164 | // of the test above). | ||
4165 | // | ||
4166 | // Actual deletions (kills) happen in another method. | ||
4167 | if (part.ParentGroup.IsDeleted) | ||
4168 | continue; | ||
4169 | } | ||
4170 | 4196 | ||
4171 | terseUpdateBlocks.Value.Add(terseUpdateBlock); | 4197 | #region Packet Sending |
4172 | terseUpdates.Value.Add(update); | 4198 | |
4173 | } | 4199 | // const float TIME_DILATION = 1.0f; |
4174 | } | 4200 | ushort timeDilation; |
4201 | // if(updatesThisCall > 0) | ||
4202 | // timeDilation = Utils.FloatToUInt16(avgTimeDilation/updatesThisCall, 0.0f, 1.0f); | ||
4203 | // else | ||
4204 | // timeDilation = ushort.MaxValue; // 1.0; | ||
4205 | |||
4206 | timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); | ||
4175 | 4207 | ||
4176 | ++updatesThisCall; | 4208 | if (terseAgentUpdateBlocks.IsValueCreated) |
4209 | { | ||
4210 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | ||
4211 | |||
4212 | ImprovedTerseObjectUpdatePacket packet | ||
4213 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); | ||
4214 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4215 | packet.RegionData.TimeDilation = timeDilation; | ||
4216 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
4217 | |||
4218 | for (int i = 0; i < blocks.Count; i++) | ||
4219 | packet.ObjectData[i] = blocks[i]; | ||
4220 | |||
4221 | OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | ||
4222 | } | ||
4223 | |||
4224 | if (objectUpdateBlocks.IsValueCreated) | ||
4225 | { | ||
4226 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; | ||
4177 | 4227 | ||
4178 | #endregion Block Construction | 4228 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
4179 | } | 4229 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; |
4230 | packet.RegionData.TimeDilation = timeDilation; | ||
4231 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
4232 | |||
4233 | for (int i = 0; i < blocks.Count; i++) | ||
4234 | packet.ObjectData[i] = blocks[i]; | ||
4180 | 4235 | ||
4181 | #region Packet Sending | 4236 | OutPacket(packet, ThrottleOutPacketType.Task, true); |
4182 | ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); | 4237 | } |
4238 | |||
4239 | if (compressedUpdateBlocks.IsValueCreated) | ||
4240 | { | ||
4241 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | ||
4242 | |||
4243 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
4244 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4245 | packet.RegionData.TimeDilation = timeDilation; | ||
4246 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
4183 | 4247 | ||
4184 | if (terseAgentUpdateBlocks.IsValueCreated) | 4248 | for (int i = 0; i < blocks.Count; i++) |
4185 | { | 4249 | packet.ObjectData[i] = blocks[i]; |
4186 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | 4250 | |
4251 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4252 | } | ||
4253 | |||
4254 | if (terseUpdateBlocks.IsValueCreated) | ||
4255 | { | ||
4256 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | ||
4257 | |||
4258 | ImprovedTerseObjectUpdatePacket packet | ||
4259 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( | ||
4260 | PacketType.ImprovedTerseObjectUpdate); | ||
4261 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4262 | packet.RegionData.TimeDilation = timeDilation; | ||
4263 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
4264 | |||
4265 | for (int i = 0; i < blocks.Count; i++) | ||
4266 | packet.ObjectData[i] = blocks[i]; | ||
4187 | 4267 | ||
4188 | ImprovedTerseObjectUpdatePacket packet | 4268 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); |
4189 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); | 4269 | } |
4190 | 4270 | ||
4191 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 4271 | #endregion Packet Sending |
4192 | packet.RegionData.TimeDilation = timeDilation; | 4272 | } |
4193 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
4194 | 4273 | ||
4195 | for (int i = 0; i < blocks.Count; i++) | 4274 | // hack.. dont use |
4196 | packet.ObjectData[i] = blocks[i]; | 4275 | public void SendPartFullUpdate(ISceneEntity ent, uint? parentID) |
4197 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | 4276 | { |
4198 | OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); }); | 4277 | if (ent is SceneObjectPart) |
4199 | } | 4278 | { |
4279 | SceneObjectPart part = (SceneObjectPart)ent; | ||
4280 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | ||
4281 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4282 | packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); | ||
4283 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | ||
4200 | 4284 | ||
4201 | if (objectUpdateBlocks.IsValueCreated) | 4285 | ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, this.m_agentId); |
4202 | { | 4286 | if (parentID.HasValue) |
4203 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; | ||
4204 | |||
4205 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | ||
4206 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4207 | packet.RegionData.TimeDilation = timeDilation; | ||
4208 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
4209 | |||
4210 | for (int i = 0; i < blocks.Count; i++) | ||
4211 | packet.ObjectData[i] = blocks[i]; | ||
4212 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
4213 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); }); | ||
4214 | } | ||
4215 | |||
4216 | if (compressedUpdateBlocks.IsValueCreated) | ||
4217 | { | 4287 | { |
4218 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | 4288 | blk.ParentID = parentID.Value; |
4219 | |||
4220 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
4221 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4222 | packet.RegionData.TimeDilation = timeDilation; | ||
4223 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
4224 | |||
4225 | for (int i = 0; i < blocks.Count; i++) | ||
4226 | packet.ObjectData[i] = blocks[i]; | ||
4227 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
4228 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); }); | ||
4229 | } | 4289 | } |
4230 | 4290 | ||
4231 | if (terseUpdateBlocks.IsValueCreated) | 4291 | packet.ObjectData[0] = blk; |
4232 | { | ||
4233 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | ||
4234 | |||
4235 | ImprovedTerseObjectUpdatePacket packet | ||
4236 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( | ||
4237 | PacketType.ImprovedTerseObjectUpdate); | ||
4238 | 4292 | ||
4239 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 4293 | OutPacket(packet, ThrottleOutPacketType.Task, true); |
4240 | packet.RegionData.TimeDilation = timeDilation; | ||
4241 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
4242 | |||
4243 | for (int i = 0; i < blocks.Count; i++) | ||
4244 | packet.ObjectData[i] = blocks[i]; | ||
4245 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
4246 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | ||
4247 | } | ||
4248 | } | 4294 | } |
4249 | 4295 | ||
4250 | // m_log.DebugFormat( | 4296 | // m_log.DebugFormat( |
4251 | // "[LLCLIENTVIEW]: Sent {0} updates in ProcessEntityUpdates() for {1} {2} in {3}", | 4297 | // "[LLCLIENTVIEW]: Sent {0} updates in ProcessEntityUpdates() for {1} {2} in {3}", |
4252 | // updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name); | 4298 | // updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name); |
4253 | // | 4299 | // |
4254 | #endregion Packet Sending | ||
4255 | } | 4300 | } |
4256 | 4301 | ||
4257 | public void ReprioritizeUpdates() | 4302 | public void ReprioritizeUpdates() |
4258 | { | 4303 | { |
4259 | lock (m_entityUpdates.SyncRoot) | 4304 | lock (m_entityUpdates.SyncRoot) |
@@ -4572,11 +4617,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4572 | 4617 | ||
4573 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties | 4618 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties |
4574 | // of the object rather than the properties when the packet was created | 4619 | // of the object rather than the properties when the packet was created |
4575 | OutPacket(packet, ThrottleOutPacketType.Task, true, | 4620 | // HACK : Remove intelligent resending until it's fixed in core |
4576 | delegate(OutgoingPacket oPacket) | 4621 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4577 | { | 4622 | // delegate(OutgoingPacket oPacket) |
4578 | ResendPropertyUpdates(updates, oPacket); | 4623 | // { |
4579 | }); | 4624 | // ResendPropertyUpdates(updates, oPacket); |
4625 | // }); | ||
4626 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4580 | 4627 | ||
4581 | // pbcnt += blocks.Count; | 4628 | // pbcnt += blocks.Count; |
4582 | // ppcnt++; | 4629 | // ppcnt++; |
@@ -4602,11 +4649,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4602 | // of the object rather than the properties when the packet was created | 4649 | // of the object rather than the properties when the packet was created |
4603 | List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); | 4650 | List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); |
4604 | updates.Add(familyUpdates.Value[i]); | 4651 | updates.Add(familyUpdates.Value[i]); |
4605 | OutPacket(packet, ThrottleOutPacketType.Task, true, | 4652 | // HACK : Remove intelligent resending until it's fixed in core |
4606 | delegate(OutgoingPacket oPacket) | 4653 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4607 | { | 4654 | // delegate(OutgoingPacket oPacket) |
4608 | ResendPropertyUpdates(updates, oPacket); | 4655 | // { |
4609 | }); | 4656 | // ResendPropertyUpdates(updates, oPacket); |
4657 | // }); | ||
4658 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4610 | 4659 | ||
4611 | // fpcnt++; | 4660 | // fpcnt++; |
4612 | // fbcnt++; | 4661 | // fbcnt++; |
@@ -4939,7 +4988,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4939 | packet.ParcelData.Data = data; | 4988 | packet.ParcelData.Data = data; |
4940 | packet.ParcelData.SequenceID = sequence_id; | 4989 | packet.ParcelData.SequenceID = sequence_id; |
4941 | packet.Header.Zerocoded = true; | 4990 | packet.Header.Zerocoded = true; |
4942 | OutPacket(packet, ThrottleOutPacketType.Task); | 4991 | // OutPacket(packet, ThrottleOutPacketType.Task); |
4992 | OutPacket(packet, ThrottleOutPacketType.Land); | ||
4943 | } | 4993 | } |
4944 | 4994 | ||
4945 | public void SendLandProperties( | 4995 | public void SendLandProperties( |
@@ -5004,7 +5054,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5004 | 5054 | ||
5005 | if (landData.SimwideArea > 0) | 5055 | if (landData.SimwideArea > 0) |
5006 | { | 5056 | { |
5007 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); | 5057 | int simulatorCapacity = (int)((long)landData.SimwideArea * (long)m_scene.RegionInfo.ObjectCapacity * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus / 65536L); |
5058 | // Never report more than sim total capacity | ||
5059 | if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity) | ||
5060 | simulatorCapacity = m_scene.RegionInfo.ObjectCapacity; | ||
5008 | updateMessage.SimWideMaxPrims = simulatorCapacity; | 5061 | updateMessage.SimWideMaxPrims = simulatorCapacity; |
5009 | } | 5062 | } |
5010 | else | 5063 | else |
@@ -5039,7 +5092,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5039 | IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); | 5092 | IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); |
5040 | if (eq != null) | 5093 | if (eq != null) |
5041 | { | 5094 | { |
5042 | eq.ParcelProperties(updateMessage, this.AgentId); | 5095 | |
5096 | OSD message_body = updateMessage.Serialize(); | ||
5097 | // Add new fields here until OMV has them | ||
5098 | OSDMap bodyMap = (OSDMap)message_body; | ||
5099 | OSDArray parcelDataArray = (OSDArray)bodyMap["ParcelData"]; | ||
5100 | OSDMap parcelData = (OSDMap)parcelDataArray[0]; | ||
5101 | parcelData["SeeAVs"] = OSD.FromBoolean(landData.SeeAVs); | ||
5102 | parcelData["AnyAVSounds"] = OSD.FromBoolean(landData.AnyAVSounds); | ||
5103 | parcelData["GroupAVSounds"] = OSD.FromBoolean(landData.GroupAVSounds); | ||
5104 | OSDMap message = new OSDMap(); | ||
5105 | message.Add("message", OSD.FromString("ParcelProperties")); | ||
5106 | message.Add("body", message_body); | ||
5107 | |||
5108 | eq.Enqueue (message, this.AgentId); | ||
5109 | |||
5110 | // eq.ParcelProperties(updateMessage, this.AgentId); | ||
5043 | } | 5111 | } |
5044 | else | 5112 | else |
5045 | { | 5113 | { |
@@ -5133,14 +5201,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5133 | 5201 | ||
5134 | if (notifyCount > 0) | 5202 | if (notifyCount > 0) |
5135 | { | 5203 | { |
5136 | if (notifyCount > 32) | 5204 | // if (notifyCount > 32) |
5137 | { | 5205 | // { |
5138 | m_log.InfoFormat( | 5206 | // m_log.InfoFormat( |
5139 | "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" | 5207 | // "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" |
5140 | + " - a developer might want to investigate whether this is a hard limit", 32); | 5208 | // + " - a developer might want to investigate whether this is a hard limit", 32); |
5141 | 5209 | // | |
5142 | notifyCount = 32; | 5210 | // notifyCount = 32; |
5143 | } | 5211 | // } |
5144 | 5212 | ||
5145 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock | 5213 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock |
5146 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; | 5214 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; |
@@ -5195,41 +5263,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5195 | { | 5263 | { |
5196 | ScenePresence presence = (ScenePresence)entity; | 5264 | ScenePresence presence = (ScenePresence)entity; |
5197 | 5265 | ||
5198 | // m_log.DebugFormat( | ||
5199 | // "[LLCLIENTVIEW]: Sending terse update to {0} with pos {1}, vel {2} in {3}", | ||
5200 | // Name, presence.OffsetPosition, presence.Velocity, m_scene.Name); | ||
5201 | |||
5202 | attachPoint = presence.State; | ||
5203 | collisionPlane = presence.CollisionPlane; | ||
5204 | position = presence.OffsetPosition; | 5266 | position = presence.OffsetPosition; |
5205 | velocity = presence.Velocity; | 5267 | rotation = presence.Rotation; |
5206 | acceleration = Vector3.Zero; | ||
5207 | |||
5208 | // Interestingly, sending this to non-zero will cause the client's avatar to start moving & accelerating | ||
5209 | // in that direction, even though we don't model this on the server. Implementing this in the future | ||
5210 | // may improve movement smoothness. | ||
5211 | // acceleration = new Vector3(1, 0, 0); | ||
5212 | |||
5213 | angularVelocity = presence.AngularVelocity; | 5268 | angularVelocity = presence.AngularVelocity; |
5214 | |||
5215 | // Whilst not in mouselook, an avatar will transmit only the Z rotation as this is the only axis | ||
5216 | // it rotates around. | ||
5217 | // In mouselook, X and Y co-ordinate will also be sent but when used in Rotation, these cause unwanted | ||
5218 | // excessive up and down movements of the camera when looking up and down. | ||
5219 | // See http://opensimulator.org/mantis/view.php?id=3274 | ||
5220 | // This does not affect head movement, since this is controlled entirely by camera movement rather than | ||
5221 | // body rotation. We still need to transmit X and Y for sitting avatars but mouselook does not change | ||
5222 | // the rotation in this case. | ||
5223 | rotation = presence.Rotation; | 5269 | rotation = presence.Rotation; |
5224 | 5270 | ||
5225 | if (!presence.IsSatOnObject) | 5271 | attachPoint = 0; |
5226 | { | 5272 | // m_log.DebugFormat( |
5227 | rotation.X = 0; | 5273 | // "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name); |
5228 | rotation.Y = 0; | 5274 | |
5229 | } | 5275 | // attachPoint = presence.State; // Core: commented |
5276 | collisionPlane = presence.CollisionPlane; | ||
5277 | velocity = presence.Velocity; | ||
5278 | acceleration = Vector3.Zero; | ||
5230 | 5279 | ||
5231 | if (sendTexture) | 5280 | if (sendTexture) |
5281 | { | ||
5232 | textureEntry = presence.Appearance.Texture.GetBytes(); | 5282 | textureEntry = presence.Appearance.Texture.GetBytes(); |
5283 | } | ||
5233 | else | 5284 | else |
5234 | textureEntry = null; | 5285 | textureEntry = null; |
5235 | } | 5286 | } |
@@ -5333,34 +5384,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5333 | 5384 | ||
5334 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) | 5385 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) |
5335 | { | 5386 | { |
5387 | Vector3 offsetPosition = data.OffsetPosition; | ||
5388 | Quaternion rotation = data.Rotation; | ||
5389 | uint parentID = data.ParentID; | ||
5390 | |||
5336 | // m_log.DebugFormat( | 5391 | // m_log.DebugFormat( |
5337 | // "[LLCLIENTVIEW]: Sending full update to {0} with pos {1}, vel {2} in {3}", Name, data.OffsetPosition, data.Velocity, m_scene.Name); | 5392 | // "[LLCLIENTVIEW]: Sending full update to {0} with pos {1}, vel {2} in {3}", Name, data.OffsetPosition, data.Velocity, m_scene.Name); |
5338 | 5393 | ||
5339 | byte[] objectData = new byte[76]; | 5394 | byte[] objectData = new byte[76]; |
5340 | 5395 | ||
5341 | data.CollisionPlane.ToBytes(objectData, 0); | 5396 | Vector3 velocity = new Vector3(0, 0, 0); |
5342 | data.OffsetPosition.ToBytes(objectData, 16); | 5397 | Vector3 acceleration = new Vector3(0, 0, 0); |
5343 | data.Velocity.ToBytes(objectData, 28); | 5398 | rotation.Normalize(); |
5344 | // data.Acceleration.ToBytes(objectData, 40); | ||
5345 | |||
5346 | // Whilst not in mouselook, an avatar will transmit only the Z rotation as this is the only axis | ||
5347 | // it rotates around. | ||
5348 | // In mouselook, X and Y co-ordinate will also be sent but when used in Rotation, these cause unwanted | ||
5349 | // excessive up and down movements of the camera when looking up and down. | ||
5350 | // See http://opensimulator.org/mantis/view.php?id=3274 | ||
5351 | // This does not affect head movement, since this is controlled entirely by camera movement rather than | ||
5352 | // body rotation. We still need to transmit X and Y for sitting avatars but mouselook does not change | ||
5353 | // the rotation in this case. | ||
5354 | Quaternion rot = data.Rotation; | ||
5355 | |||
5356 | if (!data.IsSatOnObject) | ||
5357 | { | ||
5358 | rot.X = 0; | ||
5359 | rot.Y = 0; | ||
5360 | } | ||
5361 | 5399 | ||
5362 | rot.ToBytes(objectData, 52); | 5400 | data.CollisionPlane.ToBytes(objectData, 0); |
5363 | //data.AngularVelocity.ToBytes(objectData, 64); | 5401 | offsetPosition.ToBytes(objectData, 16); |
5402 | velocity.ToBytes(objectData, 28); | ||
5403 | acceleration.ToBytes(objectData, 40); | ||
5404 | rotation.ToBytes(objectData, 52); | ||
5405 | data.AngularVelocity.ToBytes(objectData, 64); | ||
5364 | 5406 | ||
5365 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); | 5407 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); |
5366 | 5408 | ||
@@ -5386,7 +5428,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5386 | update.PCode = (byte)PCode.Avatar; | 5428 | update.PCode = (byte)PCode.Avatar; |
5387 | update.ProfileCurve = 1; | 5429 | update.ProfileCurve = 1; |
5388 | update.PSBlock = Utils.EmptyBytes; | 5430 | update.PSBlock = Utils.EmptyBytes; |
5389 | update.Scale = new Vector3(0.45f, 0.6f, 1.9f); | 5431 | update.Scale = data.Appearance.AvatarSize; |
5432 | // update.Scale.Z -= 0.2f; | ||
5433 | |||
5390 | update.Text = Utils.EmptyBytes; | 5434 | update.Text = Utils.EmptyBytes; |
5391 | update.TextColor = new byte[4]; | 5435 | update.TextColor = new byte[4]; |
5392 | 5436 | ||
@@ -5397,10 +5441,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5397 | update.TextureEntry = Utils.EmptyBytes; | 5441 | update.TextureEntry = Utils.EmptyBytes; |
5398 | // update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; | 5442 | // update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; |
5399 | 5443 | ||
5444 | /* 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) | ||
5400 | update.UpdateFlags = (uint)( | 5445 | update.UpdateFlags = (uint)( |
5401 | PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | | 5446 | PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | |
5402 | PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | | 5447 | PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | |
5403 | PrimFlags.ObjectOwnerModify); | 5448 | PrimFlags.ObjectOwnerModify); |
5449 | */ | ||
5450 | update.UpdateFlags = 0; | ||
5404 | 5451 | ||
5405 | return update; | 5452 | return update; |
5406 | } | 5453 | } |
@@ -5411,15 +5458,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5411 | data.RelativePosition.ToBytes(objectData, 0); | 5458 | data.RelativePosition.ToBytes(objectData, 0); |
5412 | data.Velocity.ToBytes(objectData, 12); | 5459 | data.Velocity.ToBytes(objectData, 12); |
5413 | data.Acceleration.ToBytes(objectData, 24); | 5460 | data.Acceleration.ToBytes(objectData, 24); |
5414 | try | 5461 | |
5415 | { | 5462 | Quaternion rotation = data.RotationOffset; |
5416 | data.RotationOffset.ToBytes(objectData, 36); | 5463 | rotation.Normalize(); |
5417 | } | 5464 | rotation.ToBytes(objectData, 36); |
5418 | catch (Exception e) | ||
5419 | { | ||
5420 | m_log.Warn("[LLClientView]: exception converting quaternion to bytes, using Quaternion.Identity. Exception: " + e.ToString()); | ||
5421 | OpenMetaverse.Quaternion.Identity.ToBytes(objectData, 36); | ||
5422 | } | ||
5423 | data.AngularVelocity.ToBytes(objectData, 48); | 5465 | data.AngularVelocity.ToBytes(objectData, 48); |
5424 | 5466 | ||
5425 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); | 5467 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); |
@@ -5433,7 +5475,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5433 | //update.JointType = 0; | 5475 | //update.JointType = 0; |
5434 | update.Material = data.Material; | 5476 | update.Material = data.Material; |
5435 | update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim | 5477 | update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim |
5436 | 5478 | /* | |
5437 | if (data.ParentGroup.IsAttachment) | 5479 | if (data.ParentGroup.IsAttachment) |
5438 | { | 5480 | { |
5439 | update.NameValue | 5481 | update.NameValue |
@@ -5458,6 +5500,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5458 | // case for attachments may contain conflicting values that can end up crashing the viewer. | 5500 | // case for attachments may contain conflicting values that can end up crashing the viewer. |
5459 | update.State = data.ParentGroup.RootPart.Shape.State; | 5501 | update.State = data.ParentGroup.RootPart.Shape.State; |
5460 | } | 5502 | } |
5503 | */ | ||
5504 | |||
5505 | if (data.ParentGroup.IsAttachment) | ||
5506 | { | ||
5507 | if (data.IsRoot) | ||
5508 | { | ||
5509 | update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID); | ||
5510 | } | ||
5511 | else | ||
5512 | update.NameValue = Utils.EmptyBytes; | ||
5513 | |||
5514 | int st = (int)data.ParentGroup.AttachmentPoint; | ||
5515 | update.State = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ; | ||
5516 | } | ||
5517 | else | ||
5518 | { | ||
5519 | update.NameValue = Utils.EmptyBytes; | ||
5520 | update.State = data.Shape.State; // not sure about this | ||
5521 | } | ||
5522 | |||
5461 | 5523 | ||
5462 | update.ObjectData = objectData; | 5524 | update.ObjectData = objectData; |
5463 | update.ParentID = data.ParentID; | 5525 | update.ParentID = data.ParentID; |
@@ -5579,8 +5641,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5579 | // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs | 5641 | // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs |
5580 | // for each AgentUpdate packet. | 5642 | // for each AgentUpdate packet. |
5581 | AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false); | 5643 | AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false); |
5582 | 5644 | ||
5583 | AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false); | 5645 | AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false); |
5646 | AddLocalPacketHandler(PacketType.VelocityInterpolateOff, HandleVelocityInterpolateOff, false); | ||
5647 | AddLocalPacketHandler(PacketType.VelocityInterpolateOn, HandleVelocityInterpolateOn, false); | ||
5584 | AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false); | 5648 | AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false); |
5585 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); | 5649 | AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); |
5586 | AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); | 5650 | AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); |
@@ -5732,6 +5796,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5732 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); | 5796 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); |
5733 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); | 5797 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); |
5734 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); | 5798 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); |
5799 | AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments); | ||
5735 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); | 5800 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); |
5736 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); | 5801 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); |
5737 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); | 5802 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); |
@@ -5798,6 +5863,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5798 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); | 5863 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); |
5799 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); | 5864 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); |
5800 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); | 5865 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); |
5866 | AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags); | ||
5801 | 5867 | ||
5802 | AddGenericPacketHandler("autopilot", HandleAutopilot); | 5868 | AddGenericPacketHandler("autopilot", HandleAutopilot); |
5803 | } | 5869 | } |
@@ -5809,7 +5875,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5809 | #region Scene/Avatar | 5875 | #region Scene/Avatar |
5810 | 5876 | ||
5811 | // Threshold for body rotation to be a significant agent update | 5877 | // Threshold for body rotation to be a significant agent update |
5812 | private const float QDELTA = 0.000001f; | 5878 | // use the abs of cos |
5879 | private const float QDELTABody = 1.0f - 0.0001f; | ||
5880 | private const float QDELTAHead = 1.0f - 0.0001f; | ||
5813 | // Threshold for camera rotation to be a significant agent update | 5881 | // Threshold for camera rotation to be a significant agent update |
5814 | private const float VDELTA = 0.01f; | 5882 | private const float VDELTA = 0.01f; |
5815 | 5883 | ||
@@ -5832,18 +5900,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5832 | /// <param name='x'></param> | 5900 | /// <param name='x'></param> |
5833 | private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) | 5901 | private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) |
5834 | { | 5902 | { |
5835 | float qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2); | 5903 | float qdelta1 = Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation)); |
5836 | //qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2); | 5904 | //qdelta2 = Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation)); |
5837 | 5905 | ||
5838 | bool movementSignificant = | 5906 | bool movementSignificant = |
5839 | (qdelta1 > QDELTA) // significant if body rotation above threshold | 5907 | (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed |
5840 | // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack | ||
5841 | // || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold | ||
5842 | || (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed | ||
5843 | || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands | 5908 | || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands |
5844 | || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed | ||
5845 | || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed | 5909 | || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed |
5846 | || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed | 5910 | || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed |
5911 | || (qdelta1 < QDELTABody) // significant if body rotation above(below cos) threshold | ||
5912 | // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack | ||
5913 | // || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold | ||
5914 | || (Math.Abs(x.Far - m_thisAgentUpdateArgs.Far) >= 32) // significant if far distance changed | ||
5847 | ; | 5915 | ; |
5848 | //if (movementSignificant) | 5916 | //if (movementSignificant) |
5849 | //{ | 5917 | //{ |
@@ -5886,55 +5954,63 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5886 | return cameraSignificant; | 5954 | return cameraSignificant; |
5887 | } | 5955 | } |
5888 | 5956 | ||
5889 | private bool HandleAgentUpdate(IClientAPI sener, Packet packet) | 5957 | private bool HandleAgentUpdate(IClientAPI sender, Packet packet) |
5890 | { | 5958 | { |
5891 | // We got here, which means that something in agent update was significant | 5959 | // We got here, which means that something in agent update was significant |
5892 | 5960 | ||
5893 | AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; | 5961 | AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; |
5894 | AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData; | 5962 | AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData; |
5895 | 5963 | ||
5896 | if (x.AgentID != AgentId || x.SessionID != SessionId) | 5964 | if (x.AgentID != AgentId || x.SessionID != SessionId) |
5965 | { | ||
5966 | PacketPool.Instance.ReturnPacket(packet); | ||
5897 | return false; | 5967 | return false; |
5968 | } | ||
5969 | |||
5970 | TotalAgentUpdates++; | ||
5898 | 5971 | ||
5899 | // Before we update the current m_thisAgentUpdateArgs, let's check this again | ||
5900 | // to see what exactly changed | ||
5901 | bool movement = CheckAgentMovementUpdateSignificance(x); | 5972 | bool movement = CheckAgentMovementUpdateSignificance(x); |
5902 | bool camera = CheckAgentCameraUpdateSignificance(x); | 5973 | bool camera = CheckAgentCameraUpdateSignificance(x); |
5903 | 5974 | ||
5904 | m_thisAgentUpdateArgs.AgentID = x.AgentID; | ||
5905 | m_thisAgentUpdateArgs.BodyRotation = x.BodyRotation; | ||
5906 | m_thisAgentUpdateArgs.CameraAtAxis = x.CameraAtAxis; | ||
5907 | m_thisAgentUpdateArgs.CameraCenter = x.CameraCenter; | ||
5908 | m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis; | ||
5909 | m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis; | ||
5910 | m_thisAgentUpdateArgs.ControlFlags = x.ControlFlags; | ||
5911 | m_thisAgentUpdateArgs.Far = x.Far; | ||
5912 | m_thisAgentUpdateArgs.Flags = x.Flags; | ||
5913 | m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; | ||
5914 | m_thisAgentUpdateArgs.SessionID = x.SessionID; | ||
5915 | m_thisAgentUpdateArgs.State = x.State; | ||
5916 | |||
5917 | UpdateAgent handlerAgentUpdate = OnAgentUpdate; | ||
5918 | UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate; | ||
5919 | UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate; | ||
5920 | |||
5921 | // Was there a significant movement/state change? | 5975 | // Was there a significant movement/state change? |
5922 | if (movement) | 5976 | if (movement) |
5923 | { | 5977 | { |
5978 | m_thisAgentUpdateArgs.BodyRotation = x.BodyRotation; | ||
5979 | m_thisAgentUpdateArgs.ControlFlags = x.ControlFlags; | ||
5980 | m_thisAgentUpdateArgs.Far = x.Far; | ||
5981 | m_thisAgentUpdateArgs.Flags = x.Flags; | ||
5982 | m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; | ||
5983 | // m_thisAgentUpdateArgs.SessionID = x.SessionID; | ||
5984 | m_thisAgentUpdateArgs.State = x.State; | ||
5985 | |||
5986 | UpdateAgent handlerAgentUpdate = OnAgentUpdate; | ||
5987 | UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate; | ||
5988 | |||
5924 | if (handlerPreAgentUpdate != null) | 5989 | if (handlerPreAgentUpdate != null) |
5925 | OnPreAgentUpdate(this, m_thisAgentUpdateArgs); | 5990 | OnPreAgentUpdate(this, m_thisAgentUpdateArgs); |
5926 | 5991 | ||
5927 | if (handlerAgentUpdate != null) | 5992 | if (handlerAgentUpdate != null) |
5928 | OnAgentUpdate(this, m_thisAgentUpdateArgs); | 5993 | OnAgentUpdate(this, m_thisAgentUpdateArgs); |
5994 | |||
5995 | handlerAgentUpdate = null; | ||
5996 | handlerPreAgentUpdate = null; | ||
5929 | } | 5997 | } |
5998 | |||
5930 | // Was there a significant camera(s) change? | 5999 | // Was there a significant camera(s) change? |
5931 | if (camera) | 6000 | if (camera) |
6001 | { | ||
6002 | m_thisAgentUpdateArgs.CameraAtAxis = x.CameraAtAxis; | ||
6003 | m_thisAgentUpdateArgs.CameraCenter = x.CameraCenter; | ||
6004 | m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis; | ||
6005 | m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis; | ||
6006 | |||
6007 | UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate; | ||
6008 | |||
5932 | if (handlerAgentCameraUpdate != null) | 6009 | if (handlerAgentCameraUpdate != null) |
5933 | handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs); | 6010 | handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs); |
5934 | 6011 | ||
5935 | handlerAgentUpdate = null; | 6012 | handlerAgentCameraUpdate = null; |
5936 | handlerPreAgentUpdate = null; | 6013 | } |
5937 | handlerAgentCameraUpdate = null; | ||
5938 | 6014 | ||
5939 | PacketPool.Instance.ReturnPacket(packet); | 6015 | PacketPool.Instance.ReturnPacket(packet); |
5940 | 6016 | ||
@@ -6150,6 +6226,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6150 | return true; | 6226 | return true; |
6151 | } | 6227 | } |
6152 | 6228 | ||
6229 | private bool HandleVelocityInterpolateOff(IClientAPI sender, Packet Pack) | ||
6230 | { | ||
6231 | VelocityInterpolateOffPacket p = (VelocityInterpolateOffPacket)Pack; | ||
6232 | if (p.AgentData.SessionID != SessionId || | ||
6233 | p.AgentData.AgentID != AgentId) | ||
6234 | return true; | ||
6235 | |||
6236 | m_VelocityInterpolate = false; | ||
6237 | return true; | ||
6238 | } | ||
6239 | |||
6240 | private bool HandleVelocityInterpolateOn(IClientAPI sender, Packet Pack) | ||
6241 | { | ||
6242 | VelocityInterpolateOnPacket p = (VelocityInterpolateOnPacket)Pack; | ||
6243 | if (p.AgentData.SessionID != SessionId || | ||
6244 | p.AgentData.AgentID != AgentId) | ||
6245 | return true; | ||
6246 | |||
6247 | m_VelocityInterpolate = true; | ||
6248 | return true; | ||
6249 | } | ||
6250 | |||
6251 | |||
6153 | private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack) | 6252 | private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack) |
6154 | { | 6253 | { |
6155 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; | 6254 | AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; |
@@ -6503,7 +6602,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6503 | { | 6602 | { |
6504 | // Note: the ModifyTerrain event handler sends out updated packets before the end of this event. Therefore, | 6603 | // Note: the ModifyTerrain event handler sends out updated packets before the end of this event. Therefore, |
6505 | // a simple boolean value should work and perhaps queue up just a few terrain patch packets at the end of the edit. | 6604 | // a simple boolean value should work and perhaps queue up just a few terrain patch packets at the end of the edit. |
6506 | m_justEditedTerrain = true; // Prevent terrain packet (Land layer) from being queued, make it unreliable | ||
6507 | if (OnModifyTerrain != null) | 6605 | if (OnModifyTerrain != null) |
6508 | { | 6606 | { |
6509 | for (int i = 0; i < modify.ParcelData.Length; i++) | 6607 | for (int i = 0; i < modify.ParcelData.Length; i++) |
@@ -6519,7 +6617,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6519 | } | 6617 | } |
6520 | } | 6618 | } |
6521 | } | 6619 | } |
6522 | m_justEditedTerrain = false; // Queue terrain packet (Land layer) if necessary, make it reliable again | ||
6523 | } | 6620 | } |
6524 | 6621 | ||
6525 | return true; | 6622 | return true; |
@@ -6581,16 +6678,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6581 | for (int i = 0; i < appear.VisualParam.Length; i++) | 6678 | for (int i = 0; i < appear.VisualParam.Length; i++) |
6582 | visualparams[i] = appear.VisualParam[i].ParamValue; | 6679 | visualparams[i] = appear.VisualParam[i].ParamValue; |
6583 | //var b = appear.WearableData[0]; | 6680 | //var b = appear.WearableData[0]; |
6584 | 6681 | ||
6585 | Primitive.TextureEntry te = null; | 6682 | Primitive.TextureEntry te = null; |
6586 | if (appear.ObjectData.TextureEntry.Length > 1) | 6683 | if (appear.ObjectData.TextureEntry.Length > 1) |
6587 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); | 6684 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); |
6588 | 6685 | ||
6589 | WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length]; | 6686 | WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length]; |
6590 | for (int i=0; i<appear.WearableData.Length;i++) | 6687 | for (int i=0; i<appear.WearableData.Length;i++) |
6591 | cacheitems[i] = new WearableCacheItem(){CacheId = appear.WearableData[i].CacheID,TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex)}; | 6688 | cacheitems[i] = new WearableCacheItem(){ |
6592 | 6689 | CacheId = appear.WearableData[i].CacheID, | |
6690 | TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex) | ||
6691 | }; | ||
6593 | 6692 | ||
6693 | |||
6594 | 6694 | ||
6595 | handlerSetAppearance(sender, te, visualparams,avSize, cacheitems); | 6695 | handlerSetAppearance(sender, te, visualparams,avSize, cacheitems); |
6596 | } | 6696 | } |
@@ -6794,13 +6894,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6794 | return true; | 6894 | return true; |
6795 | } | 6895 | } |
6796 | 6896 | ||
6797 | private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) | 6897 | private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) |
6798 | { | 6898 | { |
6899 | m_log.DebugFormat("[LLClientView] HandleCompleteAgentMovement"); | ||
6900 | |||
6799 | Action<IClientAPI, bool> handlerCompleteMovementToRegion = OnCompleteMovementToRegion; | 6901 | Action<IClientAPI, bool> handlerCompleteMovementToRegion = OnCompleteMovementToRegion; |
6800 | if (handlerCompleteMovementToRegion != null) | 6902 | if (handlerCompleteMovementToRegion != null) |
6801 | { | 6903 | { |
6802 | handlerCompleteMovementToRegion(sender, true); | 6904 | handlerCompleteMovementToRegion(sender, true); |
6803 | } | 6905 | } |
6906 | else | ||
6907 | m_log.Debug("HandleCompleteAgentMovement NULL handler"); | ||
6908 | |||
6804 | handlerCompleteMovementToRegion = null; | 6909 | handlerCompleteMovementToRegion = null; |
6805 | 6910 | ||
6806 | return true; | 6911 | return true; |
@@ -6818,7 +6923,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6818 | return true; | 6923 | return true; |
6819 | } | 6924 | } |
6820 | #endregion | 6925 | #endregion |
6821 | 6926 | /* | |
6822 | StartAnim handlerStartAnim = null; | 6927 | StartAnim handlerStartAnim = null; |
6823 | StopAnim handlerStopAnim = null; | 6928 | StopAnim handlerStopAnim = null; |
6824 | 6929 | ||
@@ -6842,6 +6947,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6842 | } | 6947 | } |
6843 | } | 6948 | } |
6844 | return true; | 6949 | return true; |
6950 | */ | ||
6951 | ChangeAnim handlerChangeAnim = null; | ||
6952 | |||
6953 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) | ||
6954 | { | ||
6955 | handlerChangeAnim = OnChangeAnim; | ||
6956 | if (handlerChangeAnim != null) | ||
6957 | { | ||
6958 | handlerChangeAnim(AgentAni.AnimationList[i].AnimID, AgentAni.AnimationList[i].StartAnim, false); | ||
6959 | } | ||
6960 | } | ||
6961 | |||
6962 | handlerChangeAnim = OnChangeAnim; | ||
6963 | if (handlerChangeAnim != null) | ||
6964 | { | ||
6965 | handlerChangeAnim(UUID.Zero, false, true); | ||
6966 | } | ||
6967 | |||
6968 | return true; | ||
6845 | } | 6969 | } |
6846 | 6970 | ||
6847 | private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) | 6971 | private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) |
@@ -7087,6 +7211,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7087 | #endregion | 7211 | #endregion |
7088 | 7212 | ||
7089 | m_udpClient.SetThrottles(atpack.Throttle.Throttles); | 7213 | m_udpClient.SetThrottles(atpack.Throttle.Throttles); |
7214 | GenericCall2 handler = OnUpdateThrottles; | ||
7215 | if (handler != null) | ||
7216 | { | ||
7217 | handler(); | ||
7218 | } | ||
7090 | return true; | 7219 | return true; |
7091 | } | 7220 | } |
7092 | 7221 | ||
@@ -7359,6 +7488,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7359 | 7488 | ||
7360 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) | 7489 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) |
7361 | { | 7490 | { |
7491 | if (!SelectedObjects.Contains(incomingselect.ObjectData[i].ObjectLocalID)) | ||
7492 | SelectedObjects.Add(incomingselect.ObjectData[i].ObjectLocalID); | ||
7362 | handlerObjectSelect = OnObjectSelect; | 7493 | handlerObjectSelect = OnObjectSelect; |
7363 | if (handlerObjectSelect != null) | 7494 | if (handlerObjectSelect != null) |
7364 | { | 7495 | { |
@@ -7385,6 +7516,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7385 | 7516 | ||
7386 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) | 7517 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) |
7387 | { | 7518 | { |
7519 | if (!SelectedObjects.Contains(incomingdeselect.ObjectData[i].ObjectLocalID)) | ||
7520 | SelectedObjects.Add(incomingdeselect.ObjectData[i].ObjectLocalID); | ||
7388 | handlerObjectDeselect = OnObjectDeselect; | 7521 | handlerObjectDeselect = OnObjectDeselect; |
7389 | if (handlerObjectDeselect != null) | 7522 | if (handlerObjectDeselect != null) |
7390 | { | 7523 | { |
@@ -7511,7 +7644,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7511 | physdata.Bounce = phsblock.Restitution; | 7644 | physdata.Bounce = phsblock.Restitution; |
7512 | physdata.Density = phsblock.Density; | 7645 | physdata.Density = phsblock.Density; |
7513 | physdata.Friction = phsblock.Friction; | 7646 | physdata.Friction = phsblock.Friction; |
7514 | physdata.GravitationModifier = phsblock.GravityMultiplier; | 7647 | physdata.GravitationModifier = phsblock.GravityMultiplier; |
7515 | } | 7648 | } |
7516 | 7649 | ||
7517 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); | 7650 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); |
@@ -8097,6 +8230,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8097 | // surrounding scene | 8230 | // surrounding scene |
8098 | if ((ImageType)block.Type == ImageType.Baked) | 8231 | if ((ImageType)block.Type == ImageType.Baked) |
8099 | args.Priority *= 2.0f; | 8232 | args.Priority *= 2.0f; |
8233 | int wearableout = 0; | ||
8100 | 8234 | ||
8101 | ImageManager.EnqueueReq(args); | 8235 | ImageManager.EnqueueReq(args); |
8102 | } | 8236 | } |
@@ -9106,7 +9240,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9106 | if ((locX >= m_scene.RegionInfo.WorldLocX) | 9240 | if ((locX >= m_scene.RegionInfo.WorldLocX) |
9107 | && (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX)) | 9241 | && (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX)) |
9108 | && (locY >= m_scene.RegionInfo.WorldLocY) | 9242 | && (locY >= m_scene.RegionInfo.WorldLocY) |
9109 | && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)) ) | 9243 | && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY))) |
9110 | { | 9244 | { |
9111 | tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle; | 9245 | tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle; |
9112 | tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX; | 9246 | tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX; |
@@ -9146,16 +9280,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9146 | 9280 | ||
9147 | #region Parcel related packets | 9281 | #region Parcel related packets |
9148 | 9282 | ||
9283 | // acumulate several HandleRegionHandleRequest consecutive overlaping requests | ||
9284 | // to be done with minimal resources as possible | ||
9285 | // variables temporary here while in test | ||
9286 | |||
9287 | Queue<UUID> RegionHandleRequests = new Queue<UUID>(); | ||
9288 | bool RegionHandleRequestsInService = false; | ||
9289 | |||
9149 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) | 9290 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) |
9150 | { | 9291 | { |
9151 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | 9292 | UUID currentUUID; |
9152 | 9293 | ||
9153 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; | 9294 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; |
9154 | if (handlerRegionHandleRequest != null) | 9295 | |
9296 | if (handlerRegionHandleRequest == null) | ||
9297 | return true; | ||
9298 | |||
9299 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | ||
9300 | |||
9301 | lock (RegionHandleRequests) | ||
9155 | { | 9302 | { |
9156 | handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); | 9303 | if (RegionHandleRequestsInService) |
9304 | { | ||
9305 | // we are already busy doing a previus request | ||
9306 | // so enqueue it | ||
9307 | RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID); | ||
9308 | return true; | ||
9309 | } | ||
9310 | |||
9311 | // else do it | ||
9312 | currentUUID = rhrPack.RequestBlock.RegionID; | ||
9313 | RegionHandleRequestsInService = true; | ||
9157 | } | 9314 | } |
9158 | return true; | 9315 | |
9316 | while (true) | ||
9317 | { | ||
9318 | handlerRegionHandleRequest(this, currentUUID); | ||
9319 | |||
9320 | lock (RegionHandleRequests) | ||
9321 | { | ||
9322 | // exit condition, nothing to do or closed | ||
9323 | // current code seems to assume we may loose the handler at anytime, | ||
9324 | // so keep checking it | ||
9325 | handlerRegionHandleRequest = OnRegionHandleRequest; | ||
9326 | |||
9327 | if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null) | ||
9328 | { | ||
9329 | RegionHandleRequests.Clear(); | ||
9330 | RegionHandleRequestsInService = false; | ||
9331 | return true; | ||
9332 | } | ||
9333 | currentUUID = RegionHandleRequests.Dequeue(); | ||
9334 | } | ||
9335 | } | ||
9336 | |||
9337 | return true; // actually unreached | ||
9159 | } | 9338 | } |
9160 | 9339 | ||
9161 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) | 9340 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) |
@@ -10425,7 +10604,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10425 | handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, | 10604 | handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, |
10426 | Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), | 10605 | Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), |
10427 | UpdateMuteListEntry.MuteData.MuteType, | 10606 | UpdateMuteListEntry.MuteData.MuteType, |
10428 | UpdateMuteListEntry.AgentData.AgentID); | 10607 | UpdateMuteListEntry.MuteData.MuteFlags); |
10429 | return true; | 10608 | return true; |
10430 | } | 10609 | } |
10431 | return false; | 10610 | return false; |
@@ -10440,8 +10619,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10440 | { | 10619 | { |
10441 | handlerRemoveMuteListEntry(this, | 10620 | handlerRemoveMuteListEntry(this, |
10442 | RemoveMuteListEntry.MuteData.MuteID, | 10621 | RemoveMuteListEntry.MuteData.MuteID, |
10443 | Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName), | 10622 | Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName)); |
10444 | RemoveMuteListEntry.AgentData.AgentID); | ||
10445 | return true; | 10623 | return true; |
10446 | } | 10624 | } |
10447 | return false; | 10625 | return false; |
@@ -10485,10 +10663,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10485 | return false; | 10663 | return false; |
10486 | } | 10664 | } |
10487 | 10665 | ||
10666 | private bool HandleChangeInventoryItemFlags(IClientAPI client, Packet packet) | ||
10667 | { | ||
10668 | ChangeInventoryItemFlagsPacket ChangeInventoryItemFlags = | ||
10669 | (ChangeInventoryItemFlagsPacket)packet; | ||
10670 | ChangeInventoryItemFlags handlerChangeInventoryItemFlags = OnChangeInventoryItemFlags; | ||
10671 | if (handlerChangeInventoryItemFlags != null) | ||
10672 | { | ||
10673 | foreach(ChangeInventoryItemFlagsPacket.InventoryDataBlock b in ChangeInventoryItemFlags.InventoryData) | ||
10674 | handlerChangeInventoryItemFlags(this, b.ItemID, b.Flags); | ||
10675 | return true; | ||
10676 | } | ||
10677 | return false; | ||
10678 | } | ||
10679 | |||
10488 | private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) | 10680 | private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) |
10489 | { | 10681 | { |
10490 | return true; | 10682 | return true; |
10491 | } | 10683 | } |
10684 | |||
10685 | private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack) | ||
10686 | { | ||
10687 | CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack; | ||
10688 | |||
10689 | #region Packet Session and User Check | ||
10690 | if (m_checkPackets) | ||
10691 | { | ||
10692 | if (packet.AgentData.SessionID != SessionId || | ||
10693 | packet.AgentData.AgentID != AgentId) | ||
10694 | return true; | ||
10695 | } | ||
10696 | #endregion | ||
10697 | MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null; | ||
10698 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | ||
10699 | foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData) | ||
10700 | { | ||
10701 | InventoryItemBase b = new InventoryItemBase(); | ||
10702 | b.ID = n.OldItemID; | ||
10703 | b.Folder = n.OldFolderID; | ||
10704 | items.Add(b); | ||
10705 | } | ||
10706 | |||
10707 | handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy; | ||
10708 | if (handlerMoveItemsAndLeaveCopy != null) | ||
10709 | { | ||
10710 | handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID); | ||
10711 | } | ||
10712 | |||
10713 | return true; | ||
10714 | } | ||
10492 | 10715 | ||
10493 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) | 10716 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) |
10494 | { | 10717 | { |
@@ -10915,6 +11138,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10915 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; | 11138 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; |
10916 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; | 11139 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; |
10917 | 11140 | ||
11141 | Scene scene = (Scene)m_scene; | ||
11142 | if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID))) | ||
11143 | { | ||
11144 | ScenePresence p; | ||
11145 | if (scene.TryGetScenePresence(sender.AgentId, out p)) | ||
11146 | { | ||
11147 | if (p.GodLevel >= 200) | ||
11148 | { | ||
11149 | groupProfileReply.GroupData.OpenEnrollment = true; | ||
11150 | groupProfileReply.GroupData.MembershipFee = 0; | ||
11151 | } | ||
11152 | } | ||
11153 | } | ||
11154 | |||
10918 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); | 11155 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); |
10919 | } | 11156 | } |
10920 | return true; | 11157 | return true; |
@@ -11488,11 +11725,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11488 | 11725 | ||
11489 | StartLure handlerStartLure = OnStartLure; | 11726 | StartLure handlerStartLure = OnStartLure; |
11490 | if (handlerStartLure != null) | 11727 | if (handlerStartLure != null) |
11491 | handlerStartLure(startLureRequest.Info.LureType, | 11728 | { |
11492 | Utils.BytesToString( | 11729 | for (int i = 0 ; i < startLureRequest.TargetData.Length ; i++) |
11493 | startLureRequest.Info.Message), | 11730 | { |
11494 | startLureRequest.TargetData[0].TargetID, | 11731 | handlerStartLure(startLureRequest.Info.LureType, |
11495 | this); | 11732 | Utils.BytesToString( |
11733 | startLureRequest.Info.Message), | ||
11734 | startLureRequest.TargetData[i].TargetID, | ||
11735 | this); | ||
11736 | } | ||
11737 | } | ||
11496 | return true; | 11738 | return true; |
11497 | } | 11739 | } |
11498 | private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) | 11740 | private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) |
@@ -11606,10 +11848,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11606 | } | 11848 | } |
11607 | #endregion | 11849 | #endregion |
11608 | 11850 | ||
11609 | ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; | 11851 | ClassifiedGodDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; |
11610 | if (handlerClassifiedGodDelete != null) | 11852 | if (handlerClassifiedGodDelete != null) |
11611 | handlerClassifiedGodDelete( | 11853 | handlerClassifiedGodDelete( |
11612 | classifiedGodDelete.Data.ClassifiedID, | 11854 | classifiedGodDelete.Data.ClassifiedID, |
11855 | classifiedGodDelete.Data.QueryID, | ||
11613 | this); | 11856 | this); |
11614 | return true; | 11857 | return true; |
11615 | } | 11858 | } |
@@ -11912,6 +12155,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11912 | /// <param name="simclient"></param> | 12155 | /// <param name="simclient"></param> |
11913 | /// <param name="packet"></param> | 12156 | /// <param name="packet"></param> |
11914 | /// <returns></returns> | 12157 | /// <returns></returns> |
12158 | // TODO: Convert old handler to use new method | ||
12159 | /* | ||
11915 | protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) | 12160 | protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) |
11916 | { | 12161 | { |
11917 | AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; | 12162 | AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; |
@@ -11919,6 +12164,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11919 | 12164 | ||
11920 | if (cachedtex.AgentData.SessionID != SessionId) | 12165 | if (cachedtex.AgentData.SessionID != SessionId) |
11921 | return false; | 12166 | return false; |
12167 | |||
11922 | 12168 | ||
11923 | 12169 | ||
11924 | // TODO: don't create new blocks if recycling an old packet | 12170 | // TODO: don't create new blocks if recycling an old packet |
@@ -11966,32 +12212,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11966 | } | 12212 | } |
11967 | } | 12213 | } |
11968 | 12214 | ||
11969 | if (cacheItems != null) | 12215 | CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest; |
12216 | if (handlerCachedTextureRequest != null) | ||
11970 | { | 12217 | { |
11971 | // We need to make sure the asset stored in the bake is available on this server also by its assetid before we map it to a Cacheid. | 12218 | handlerCachedTextureRequest(simclient,cachedtex.AgentData.SerialNum,requestArgs); |
11972 | // Copy the baked textures to the sim's assets cache (local only). | 12219 | } |
11973 | foreach (WearableCacheItem item in cacheItems) | 12220 | |
11974 | { | 12221 | return true; |
11975 | if (cache.GetCached(item.TextureID.ToString()) == null) | 12222 | } |
11976 | { | 12223 | */ |
11977 | item.TextureAsset.Temporary = true; | 12224 | |
11978 | item.TextureAsset.Local = true; | 12225 | protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) |
11979 | cache.Store(item.TextureAsset); | 12226 | { |
11980 | } | 12227 | //m_log.Debug("texture cached: " + packet.ToString()); |
11981 | } | 12228 | AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; |
12229 | AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); | ||
12230 | |||
12231 | if (cachedtex.AgentData.SessionID != SessionId) | ||
12232 | return false; | ||
12233 | |||
12234 | // TODO: don't create new blocks if recycling an old packet | ||
12235 | cachedresp.AgentData.AgentID = AgentId; | ||
12236 | cachedresp.AgentData.SessionID = m_sessionId; | ||
12237 | cachedresp.AgentData.SerialNum = cachedtex.AgentData.SerialNum; | ||
12238 | cachedresp.WearableData = | ||
12239 | new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; | ||
12240 | |||
12241 | int cacheHits = 0; | ||
12242 | |||
12243 | // 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 | ||
12244 | |||
12245 | WearableCacheItem[] cacheItems = null; | ||
11982 | 12246 | ||
11983 | // Return the cached textures | 12247 | ScenePresence p = m_scene.GetScenePresence(AgentId); |
12248 | |||
12249 | if (p != null && p.Appearance != null) | ||
12250 | { | ||
12251 | cacheItems = p.Appearance.WearableCacheItems; | ||
12252 | } | ||
12253 | |||
12254 | int maxWearablesLoop = cachedtex.WearableData.Length; | ||
12255 | if (maxWearablesLoop > cacheItems.Length) | ||
12256 | maxWearablesLoop = cacheItems.Length; | ||
12257 | |||
12258 | if (cacheItems != null) | ||
12259 | { | ||
11984 | for (int i = 0; i < maxWearablesLoop; i++) | 12260 | for (int i = 0; i < maxWearablesLoop; i++) |
11985 | { | 12261 | { |
11986 | WearableCacheItem item = | 12262 | int idx = cachedtex.WearableData[i].TextureIndex; |
11987 | WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex, cacheItems); | ||
11988 | |||
11989 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | 12263 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); |
11990 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; | 12264 | cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; |
11991 | cachedresp.WearableData[i].HostName = new byte[0]; | 12265 | cachedresp.WearableData[i].HostName = new byte[0]; |
11992 | if (item != null && cachedtex.WearableData[i].ID == item.CacheId) | 12266 | if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) |
11993 | { | 12267 | { |
11994 | cachedresp.WearableData[i].TextureID = item.TextureID; | 12268 | cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID; |
12269 | cacheHits++; | ||
11995 | } | 12270 | } |
11996 | else | 12271 | else |
11997 | { | 12272 | { |
@@ -12001,7 +12276,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12001 | } | 12276 | } |
12002 | else | 12277 | else |
12003 | { | 12278 | { |
12004 | // Cached textures not available | ||
12005 | for (int i = 0; i < maxWearablesLoop; i++) | 12279 | for (int i = 0; i < maxWearablesLoop; i++) |
12006 | { | 12280 | { |
12007 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | 12281 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); |
@@ -12010,13 +12284,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12010 | cachedresp.WearableData[i].HostName = new byte[0]; | 12284 | cachedresp.WearableData[i].HostName = new byte[0]; |
12011 | } | 12285 | } |
12012 | } | 12286 | } |
12013 | 12287 | ||
12288 | m_log.DebugFormat("texture cached: hits {0}", cacheHits); | ||
12289 | |||
12014 | cachedresp.Header.Zerocoded = true; | 12290 | cachedresp.Header.Zerocoded = true; |
12015 | OutPacket(cachedresp, ThrottleOutPacketType.Task); | 12291 | OutPacket(cachedresp, ThrottleOutPacketType.Task); |
12016 | 12292 | ||
12017 | return true; | 12293 | return true; |
12018 | } | 12294 | } |
12019 | 12295 | ||
12020 | /// <summary> | 12296 | /// <summary> |
12021 | /// Send a response back to a client when it asks the asset server (via the region server) if it has | 12297 | /// Send a response back to a client when it asks the asset server (via the region server) if it has |
12022 | /// its appearance texture cached. | 12298 | /// its appearance texture cached. |
@@ -12080,209 +12356,147 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12080 | } | 12356 | } |
12081 | else | 12357 | else |
12082 | { | 12358 | { |
12083 | // m_log.DebugFormat( | 12359 | ClientChangeObject updatehandler = onClientChangeObject; |
12084 | // "[CLIENT]: Processing block {0} type {1} for {2} {3}", | ||
12085 | // i, block.Type, part.Name, part.LocalId); | ||
12086 | 12360 | ||
12087 | // // Do this once since fetch parts creates a new array. | 12361 | if (updatehandler != null) |
12088 | // SceneObjectPart[] parts = part.ParentGroup.Parts; | 12362 | { |
12089 | // for (int j = 0; j < parts.Length; j++) | 12363 | ObjectChangeData udata = new ObjectChangeData(); |
12090 | // { | ||
12091 | // part.StoreUndoState(); | ||
12092 | // parts[j].IgnoreUndoUpdate = true; | ||
12093 | // } | ||
12094 | 12364 | ||
12095 | UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; | 12365 | /*ubit from ll JIRA: |
12366 | * 0x01 position | ||
12367 | * 0x02 rotation | ||
12368 | * 0x04 scale | ||
12369 | |||
12370 | * 0x08 LINK_SET | ||
12371 | * 0x10 UNIFORM for scale | ||
12372 | */ | ||
12096 | 12373 | ||
12097 | switch (block.Type) | 12374 | // translate to internal changes |
12098 | { | 12375 | // not all cases .. just the ones older code did |
12099 | case 1: | ||
12100 | Vector3 pos1 = new Vector3(block.Data, 0); | ||
12101 | 12376 | ||
12102 | UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 12377 | switch (block.Type) |
12103 | if (handlerUpdatePrimSinglePosition != null) | 12378 | { |
12104 | { | 12379 | case 1: //change position sp |
12105 | // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 12380 | udata.position = new Vector3(block.Data, 0); |
12106 | handlerUpdatePrimSinglePosition(localId, pos1, this); | ||
12107 | } | ||
12108 | break; | ||
12109 | 12381 | ||
12110 | case 2: | 12382 | udata.change = ObjectChangeType.primP; |
12111 | Quaternion rot1 = new Quaternion(block.Data, 0, true); | 12383 | updatehandler(localId, udata, this); |
12384 | break; | ||
12112 | 12385 | ||
12113 | UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; | 12386 | case 2: // rotation sp |
12114 | if (handlerUpdatePrimSingleRotation != null) | 12387 | udata.rotation = new Quaternion(block.Data, 0, true); |
12115 | { | ||
12116 | // m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W); | ||
12117 | handlerUpdatePrimSingleRotation(localId, rot1, this); | ||
12118 | } | ||
12119 | break; | ||
12120 | 12388 | ||
12121 | case 3: | 12389 | udata.change = ObjectChangeType.primR; |
12122 | Vector3 rotPos = new Vector3(block.Data, 0); | 12390 | updatehandler(localId, udata, this); |
12123 | Quaternion rot2 = new Quaternion(block.Data, 12, true); | 12391 | break; |
12124 | 12392 | ||
12125 | UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition; | 12393 | case 3: // position plus rotation |
12126 | if (handlerUpdatePrimSingleRotationPosition != null) | 12394 | udata.position = new Vector3(block.Data, 0); |
12127 | { | 12395 | udata.rotation = new Quaternion(block.Data, 12, true); |
12128 | // m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z); | ||
12129 | // m_log.Info("new mouse rotation is " + rot2.X + " , " + rot2.Y + " , " + rot2.Z + " , " + rot2.W); | ||
12130 | handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this); | ||
12131 | } | ||
12132 | break; | ||
12133 | 12396 | ||
12134 | case 4: | 12397 | udata.change = ObjectChangeType.primPR; |
12135 | case 20: | 12398 | updatehandler(localId, udata, this); |
12136 | Vector3 scale4 = new Vector3(block.Data, 0); | 12399 | break; |
12137 | 12400 | ||
12138 | UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale; | 12401 | case 4: // scale sp |
12139 | if (handlerUpdatePrimScale != null) | 12402 | udata.scale = new Vector3(block.Data, 0); |
12140 | { | 12403 | udata.change = ObjectChangeType.primS; |
12141 | // m_log.Debug("new scale is " + scale4.X + " , " + scale4.Y + " , " + scale4.Z); | ||
12142 | handlerUpdatePrimScale(localId, scale4, this); | ||
12143 | } | ||
12144 | break; | ||
12145 | 12404 | ||
12146 | case 5: | 12405 | updatehandler(localId, udata, this); |
12147 | Vector3 scale1 = new Vector3(block.Data, 12); | 12406 | break; |
12148 | Vector3 pos11 = new Vector3(block.Data, 0); | ||
12149 | 12407 | ||
12150 | handlerUpdatePrimScale = OnUpdatePrimScale; | 12408 | case 0x14: // uniform scale sp |
12151 | if (handlerUpdatePrimScale != null) | 12409 | udata.scale = new Vector3(block.Data, 0); |
12152 | { | ||
12153 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
12154 | handlerUpdatePrimScale(localId, scale1, this); | ||
12155 | 12410 | ||
12156 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 12411 | udata.change = ObjectChangeType.primUS; |
12157 | if (handlerUpdatePrimSinglePosition != null) | 12412 | updatehandler(localId, udata, this); |
12158 | { | 12413 | break; |
12159 | handlerUpdatePrimSinglePosition(localId, pos11, this); | ||
12160 | } | ||
12161 | } | ||
12162 | break; | ||
12163 | 12414 | ||
12164 | case 9: | 12415 | case 5: // scale and position sp |
12165 | Vector3 pos2 = new Vector3(block.Data, 0); | 12416 | udata.position = new Vector3(block.Data, 0); |
12417 | udata.scale = new Vector3(block.Data, 12); | ||
12166 | 12418 | ||
12167 | UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; | 12419 | udata.change = ObjectChangeType.primPS; |
12420 | updatehandler(localId, udata, this); | ||
12421 | break; | ||
12168 | 12422 | ||
12169 | if (handlerUpdateVector != null) | 12423 | case 0x15: //uniform scale and position |
12170 | { | 12424 | udata.position = new Vector3(block.Data, 0); |
12171 | handlerUpdateVector(localId, pos2, this); | 12425 | udata.scale = new Vector3(block.Data, 12); |
12172 | } | ||
12173 | break; | ||
12174 | 12426 | ||
12175 | case 10: | 12427 | udata.change = ObjectChangeType.primPUS; |
12176 | Quaternion rot3 = new Quaternion(block.Data, 0, true); | 12428 | updatehandler(localId, udata, this); |
12429 | break; | ||
12177 | 12430 | ||
12178 | UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; | 12431 | // now group related (bit 4) |
12179 | if (handlerUpdatePrimRotation != null) | 12432 | case 9: //( 8 + 1 )group position |
12180 | { | 12433 | udata.position = new Vector3(block.Data, 0); |
12181 | // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W); | ||
12182 | handlerUpdatePrimRotation(localId, rot3, this); | ||
12183 | } | ||
12184 | break; | ||
12185 | 12434 | ||
12186 | case 11: | 12435 | udata.change = ObjectChangeType.groupP; |
12187 | Vector3 pos3 = new Vector3(block.Data, 0); | 12436 | updatehandler(localId, udata, this); |
12188 | Quaternion rot4 = new Quaternion(block.Data, 12, true); | 12437 | break; |
12189 | 12438 | ||
12190 | handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; | 12439 | case 0x0A: // (8 + 2) group rotation |
12191 | if (handlerUpdatePrimGroupRotation != null) | 12440 | udata.rotation = new Quaternion(block.Data, 0, true); |
12192 | { | ||
12193 | // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | ||
12194 | // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W); | ||
12195 | handlerUpdatePrimGroupRotation(localId, pos3, rot4, this); | ||
12196 | } | ||
12197 | break; | ||
12198 | case 12: | ||
12199 | case 28: | ||
12200 | Vector3 scale7 = new Vector3(block.Data, 0); | ||
12201 | 12441 | ||
12202 | UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; | 12442 | udata.change = ObjectChangeType.groupR; |
12203 | if (handlerUpdatePrimGroupScale != null) | 12443 | updatehandler(localId, udata, this); |
12204 | { | 12444 | break; |
12205 | // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z); | ||
12206 | handlerUpdatePrimGroupScale(localId, scale7, this); | ||
12207 | } | ||
12208 | break; | ||
12209 | 12445 | ||
12210 | case 13: | 12446 | case 0x0B: //( 8 + 2 + 1) group rotation and position |
12211 | Vector3 scale2 = new Vector3(block.Data, 12); | 12447 | udata.position = new Vector3(block.Data, 0); |
12212 | Vector3 pos4 = new Vector3(block.Data, 0); | 12448 | udata.rotation = new Quaternion(block.Data, 12, true); |
12213 | 12449 | ||
12214 | handlerUpdatePrimScale = OnUpdatePrimScale; | 12450 | udata.change = ObjectChangeType.groupPR; |
12215 | if (handlerUpdatePrimScale != null) | 12451 | updatehandler(localId, udata, this); |
12216 | { | 12452 | break; |
12217 | //m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
12218 | handlerUpdatePrimScale(localId, scale2, this); | ||
12219 | 12453 | ||
12220 | // Change the position based on scale (for bug number 246) | 12454 | case 0x0C: // (8 + 4) group scale |
12221 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 12455 | // only afects root prim and only sent by viewer editor object tab scaling |
12222 | // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 12456 | // mouse edition only allows uniform scaling |
12223 | if (handlerUpdatePrimSinglePosition != null) | 12457 | // SL MAY CHANGE THIS in viewers |
12224 | { | ||
12225 | handlerUpdatePrimSinglePosition(localId, pos4, this); | ||
12226 | } | ||
12227 | } | ||
12228 | break; | ||
12229 | 12458 | ||
12230 | case 29: | 12459 | udata.scale = new Vector3(block.Data, 0); |
12231 | Vector3 scale5 = new Vector3(block.Data, 12); | ||
12232 | Vector3 pos5 = new Vector3(block.Data, 0); | ||
12233 | 12460 | ||
12234 | handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; | 12461 | udata.change = ObjectChangeType.groupS; |
12235 | if (handlerUpdatePrimGroupScale != null) | 12462 | updatehandler(localId, udata, this); |
12236 | { | ||
12237 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
12238 | part.StoreUndoState(true); | ||
12239 | part.IgnoreUndoUpdate = true; | ||
12240 | handlerUpdatePrimGroupScale(localId, scale5, this); | ||
12241 | handlerUpdateVector = OnUpdatePrimGroupPosition; | ||
12242 | 12463 | ||
12243 | if (handlerUpdateVector != null) | 12464 | break; |
12244 | { | ||
12245 | handlerUpdateVector(localId, pos5, this); | ||
12246 | } | ||
12247 | 12465 | ||
12248 | part.IgnoreUndoUpdate = false; | 12466 | case 0x0D: //(8 + 4 + 1) group scale and position |
12249 | } | 12467 | // exception as above |
12250 | 12468 | ||
12251 | break; | 12469 | udata.position = new Vector3(block.Data, 0); |
12470 | udata.scale = new Vector3(block.Data, 12); | ||
12252 | 12471 | ||
12253 | case 21: | 12472 | udata.change = ObjectChangeType.groupPS; |
12254 | Vector3 scale6 = new Vector3(block.Data, 12); | 12473 | updatehandler(localId, udata, this); |
12255 | Vector3 pos6 = new Vector3(block.Data, 0); | 12474 | break; |
12256 | 12475 | ||
12257 | handlerUpdatePrimScale = OnUpdatePrimScale; | 12476 | case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM |
12258 | if (handlerUpdatePrimScale != null) | 12477 | udata.scale = new Vector3(block.Data, 0); |
12259 | { | ||
12260 | part.StoreUndoState(false); | ||
12261 | part.IgnoreUndoUpdate = true; | ||
12262 | 12478 | ||
12263 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | 12479 | udata.change = ObjectChangeType.groupUS; |
12264 | handlerUpdatePrimScale(localId, scale6, this); | 12480 | updatehandler(localId, udata, this); |
12265 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 12481 | break; |
12266 | if (handlerUpdatePrimSinglePosition != null) | ||
12267 | { | ||
12268 | handlerUpdatePrimSinglePosition(localId, pos6, this); | ||
12269 | } | ||
12270 | 12482 | ||
12271 | part.IgnoreUndoUpdate = false; | 12483 | case 0x1D: // (UNIFORM + GROUP + SCALE + POS) |
12272 | } | 12484 | udata.position = new Vector3(block.Data, 0); |
12273 | break; | 12485 | udata.scale = new Vector3(block.Data, 12); |
12274 | 12486 | ||
12275 | default: | 12487 | udata.change = ObjectChangeType.groupPUS; |
12276 | m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); | 12488 | updatehandler(localId, udata, this); |
12277 | break; | 12489 | break; |
12490 | |||
12491 | default: | ||
12492 | m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); | ||
12493 | break; | ||
12494 | } | ||
12278 | } | 12495 | } |
12279 | 12496 | ||
12280 | // for (int j = 0; j < parts.Length; j++) | ||
12281 | // parts[j].IgnoreUndoUpdate = false; | ||
12282 | } | 12497 | } |
12283 | } | 12498 | } |
12284 | } | 12499 | } |
12285 | |||
12286 | return true; | 12500 | return true; |
12287 | } | 12501 | } |
12288 | 12502 | ||
@@ -12342,7 +12556,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12342 | /// <param name="throttles"></param> | 12556 | /// <param name="throttles"></param> |
12343 | public void SetChildAgentThrottle(byte[] throttles) | 12557 | public void SetChildAgentThrottle(byte[] throttles) |
12344 | { | 12558 | { |
12345 | m_udpClient.SetThrottles(throttles); | 12559 | SetChildAgentThrottle(throttles, 1.0f); |
12560 | } | ||
12561 | |||
12562 | public void SetChildAgentThrottle(byte[] throttles,float factor) | ||
12563 | { | ||
12564 | m_udpClient.SetThrottles(throttles, factor); | ||
12565 | GenericCall2 handler = OnUpdateThrottles; | ||
12566 | if (handler != null) | ||
12567 | { | ||
12568 | handler(); | ||
12569 | } | ||
12570 | } | ||
12571 | |||
12572 | /// <summary> | ||
12573 | /// Sets the throttles from values supplied caller | ||
12574 | /// </summary> | ||
12575 | /// <param name="throttles"></param> | ||
12576 | public void SetAgentThrottleSilent(int throttle, int setting) | ||
12577 | { | ||
12578 | m_udpClient.ForceThrottleSetting(throttle,setting); | ||
12579 | } | ||
12580 | |||
12581 | public int GetAgentThrottleSilent(int throttle) | ||
12582 | { | ||
12583 | return m_udpClient.GetThrottleSetting(throttle); | ||
12346 | } | 12584 | } |
12347 | 12585 | ||
12348 | /// <summary> | 12586 | /// <summary> |
@@ -12450,8 +12688,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12450 | uint regionY = 0; | 12688 | uint regionY = 0; |
12451 | 12689 | ||
12452 | Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out regionX, out regionY); | 12690 | Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out regionX, out regionY); |
12453 | locx = Convert.ToSingle(args[0]) - (float)regionX; | 12691 | locx = (float)(Convert.ToDouble(args[0]) - (double)regionX); |
12454 | locy = Convert.ToSingle(args[1]) - (float)regionY; | 12692 | locy = (float)(Convert.ToDouble(args[1]) - (double)regionY); |
12455 | locz = Convert.ToSingle(args[2]); | 12693 | locz = Convert.ToSingle(args[2]); |
12456 | 12694 | ||
12457 | Action<Vector3, bool, bool> handlerAutoPilotGo = OnAutoPilotGo; | 12695 | Action<Vector3, bool, bool> handlerAutoPilotGo = OnAutoPilotGo; |
@@ -12736,7 +12974,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12736 | // "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", | 12974 | // "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", |
12737 | // requestID, taskID, (SourceType)sourceType, Name); | 12975 | // requestID, taskID, (SourceType)sourceType, Name); |
12738 | 12976 | ||
12977 | |||
12978 | //Note, the bool returned from the below function is useless since it is always false. | ||
12739 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); | 12979 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); |
12980 | |||
12740 | } | 12981 | } |
12741 | 12982 | ||
12742 | /// <summary> | 12983 | /// <summary> |
@@ -12819,7 +13060,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12819 | /// <returns></returns> | 13060 | /// <returns></returns> |
12820 | private static int CalculateNumPackets(byte[] data) | 13061 | private static int CalculateNumPackets(byte[] data) |
12821 | { | 13062 | { |
12822 | const uint m_maxPacketSize = 600; | 13063 | // const uint m_maxPacketSize = 600; |
13064 | uint m_maxPacketSize = MaxTransferBytesPerPacket; | ||
12823 | int numPackets = 1; | 13065 | int numPackets = 1; |
12824 | 13066 | ||
12825 | if (data == null) | 13067 | if (data == null) |
@@ -12930,7 +13172,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12930 | // this is the username of the *owner* | 13172 | // this is the username of the *owner* |
12931 | dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName); | 13173 | dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName); |
12932 | dialog.Data.LastName = Util.StringToBytes256(ownerLastName); | 13174 | dialog.Data.LastName = Util.StringToBytes256(ownerLastName); |
12933 | dialog.Data.Message = Util.StringToBytes256(message); | 13175 | dialog.Data.Message = Util.StringToBytes(message,512); |
12934 | 13176 | ||
12935 | ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1]; | 13177 | ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1]; |
12936 | buttons[0] = new ScriptDialogPacket.ButtonsBlock(); | 13178 | buttons[0] = new ScriptDialogPacket.ButtonsBlock(); |
@@ -12962,8 +13204,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12962 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = | 13204 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = |
12963 | CreateImprovedTerseBlock(p, false); | 13205 | CreateImprovedTerseBlock(p, false); |
12964 | 13206 | ||
12965 | const float TIME_DILATION = 1.0f; | 13207 | // const float TIME_DILATION = 1.0f; |
12966 | ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); | 13208 | ushort timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);; |
12967 | 13209 | ||
12968 | ImprovedTerseObjectUpdatePacket packet | 13210 | ImprovedTerseObjectUpdatePacket packet |
12969 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( | 13211 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( |