diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 1206 |
1 files changed, 700 insertions, 506 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 65daca0..f80a00f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -114,6 +114,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
114 | public event AvatarPickerRequest OnAvatarPickerRequest; | 114 | public event AvatarPickerRequest OnAvatarPickerRequest; |
115 | public event StartAnim OnStartAnim; | 115 | public event StartAnim OnStartAnim; |
116 | public event StopAnim OnStopAnim; | 116 | public event StopAnim OnStopAnim; |
117 | public event ChangeAnim OnChangeAnim; | ||
117 | public event Action<IClientAPI> OnRequestAvatarsData; | 118 | public event Action<IClientAPI> OnRequestAvatarsData; |
118 | public event LinkObjects OnLinkObjects; | 119 | public event LinkObjects OnLinkObjects; |
119 | public event DelinkObjects OnDelinkObjects; | 120 | public event DelinkObjects OnDelinkObjects; |
@@ -141,6 +142,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
141 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; | 142 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; |
142 | public event UpdatePrimFlags OnUpdatePrimFlags; | 143 | public event UpdatePrimFlags OnUpdatePrimFlags; |
143 | public event UpdatePrimTexture OnUpdatePrimTexture; | 144 | public event UpdatePrimTexture OnUpdatePrimTexture; |
145 | public event ClientChangeObject onClientChangeObject; | ||
144 | public event UpdateVector OnUpdatePrimGroupPosition; | 146 | public event UpdateVector OnUpdatePrimGroupPosition; |
145 | public event UpdateVector OnUpdatePrimSinglePosition; | 147 | public event UpdateVector OnUpdatePrimSinglePosition; |
146 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; | 148 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; |
@@ -174,6 +176,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
174 | public event RequestTaskInventory OnRequestTaskInventory; | 176 | public event RequestTaskInventory OnRequestTaskInventory; |
175 | public event UpdateInventoryItem OnUpdateInventoryItem; | 177 | public event UpdateInventoryItem OnUpdateInventoryItem; |
176 | public event CopyInventoryItem OnCopyInventoryItem; | 178 | public event CopyInventoryItem OnCopyInventoryItem; |
179 | public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; | ||
177 | public event MoveInventoryItem OnMoveInventoryItem; | 180 | public event MoveInventoryItem OnMoveInventoryItem; |
178 | public event RemoveInventoryItem OnRemoveInventoryItem; | 181 | public event RemoveInventoryItem OnRemoveInventoryItem; |
179 | public event RemoveInventoryFolder OnRemoveInventoryFolder; | 182 | public event RemoveInventoryFolder OnRemoveInventoryFolder; |
@@ -272,7 +275,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
272 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; | 275 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; |
273 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; | 276 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; |
274 | public event ClassifiedDelete OnClassifiedDelete; | 277 | public event ClassifiedDelete OnClassifiedDelete; |
275 | public event ClassifiedDelete OnClassifiedGodDelete; | 278 | public event ClassifiedGodDelete OnClassifiedGodDelete; |
276 | public event EventNotificationAddRequest OnEventNotificationAddRequest; | 279 | public event EventNotificationAddRequest OnEventNotificationAddRequest; |
277 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; | 280 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; |
278 | public event EventGodDelete OnEventGodDelete; | 281 | public event EventGodDelete OnEventGodDelete; |
@@ -303,6 +306,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
303 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; | 306 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; |
304 | public event SimWideDeletesDelegate OnSimWideDeletes; | 307 | public event SimWideDeletesDelegate OnSimWideDeletes; |
305 | public event SendPostcard OnSendPostcard; | 308 | public event SendPostcard OnSendPostcard; |
309 | public event ChangeInventoryItemFlags OnChangeInventoryItemFlags; | ||
306 | public event MuteListEntryUpdate OnUpdateMuteListEntry; | 310 | public event MuteListEntryUpdate OnUpdateMuteListEntry; |
307 | public event MuteListEntryRemove OnRemoveMuteListEntry; | 311 | public event MuteListEntryRemove OnRemoveMuteListEntry; |
308 | public event GodlikeMessage onGodlikeMessage; | 312 | public event GodlikeMessage onGodlikeMessage; |
@@ -341,6 +345,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
341 | private Prioritizer m_prioritizer; | 345 | private Prioritizer m_prioritizer; |
342 | private bool m_disableFacelights = false; | 346 | private bool m_disableFacelights = false; |
343 | 347 | ||
348 | private const uint MaxTransferBytesPerPacket = 600; | ||
349 | |||
350 | |||
344 | /// <value> | 351 | /// <value> |
345 | /// List used in construction of data blocks for an object update packet. This is to stop us having to | 352 | /// List used in construction of data blocks for an object update packet. This is to stop us having to |
346 | /// continually recreate it. | 353 | /// continually recreate it. |
@@ -352,14 +359,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
352 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an | 359 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an |
353 | /// ownerless phantom. | 360 | /// ownerless phantom. |
354 | /// | 361 | /// |
355 | /// All manipulation of this set has to occur under a lock | 362 | /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock |
356 | /// | 363 | /// |
357 | /// </value> | 364 | /// </value> |
358 | protected HashSet<uint> m_killRecord; | 365 | // protected HashSet<uint> m_killRecord; |
359 | 366 | ||
360 | // protected HashSet<uint> m_attachmentsSent; | 367 | // protected HashSet<uint> m_attachmentsSent; |
361 | 368 | ||
362 | private int m_moneyBalance; | 369 | private int m_moneyBalance; |
370 | private bool m_deliverPackets = true; | ||
363 | private int m_animationSequenceNumber = 1; | 371 | private int m_animationSequenceNumber = 1; |
364 | private bool m_SendLogoutPacketWhenClosing = true; | 372 | private bool m_SendLogoutPacketWhenClosing = true; |
365 | 373 | ||
@@ -406,6 +414,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
406 | get { return m_startpos; } | 414 | get { return m_startpos; } |
407 | set { m_startpos = value; } | 415 | set { m_startpos = value; } |
408 | } | 416 | } |
417 | public bool DeliverPackets | ||
418 | { | ||
419 | get { return m_deliverPackets; } | ||
420 | set { | ||
421 | m_deliverPackets = value; | ||
422 | m_udpClient.m_deliverPackets = value; | ||
423 | } | ||
424 | } | ||
409 | public UUID AgentId { get { return m_agentId; } } | 425 | public UUID AgentId { get { return m_agentId; } } |
410 | public ISceneAgent SceneAgent { get; set; } | 426 | public ISceneAgent SceneAgent { get; set; } |
411 | public UUID ActiveGroupId { get { return m_activeGroupID; } } | 427 | public UUID ActiveGroupId { get { return m_activeGroupID; } } |
@@ -483,7 +499,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
483 | m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); | 499 | m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); |
484 | m_entityProps = new PriorityQueue(m_scene.Entities.Count); | 500 | m_entityProps = new PriorityQueue(m_scene.Entities.Count); |
485 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); | 501 | m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); |
486 | m_killRecord = new HashSet<uint>(); | 502 | // m_killRecord = new HashSet<uint>(); |
487 | // m_attachmentsSent = new HashSet<uint>(); | 503 | // m_attachmentsSent = new HashSet<uint>(); |
488 | 504 | ||
489 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | 505 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); |
@@ -513,12 +529,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
513 | 529 | ||
514 | #region Client Methods | 530 | #region Client Methods |
515 | 531 | ||
532 | |||
533 | /// <summary> | ||
534 | /// Close down the client view | ||
535 | /// </summary> | ||
516 | public void Close() | 536 | public void Close() |
517 | { | 537 | { |
518 | Close(false); | 538 | Close(true, false); |
519 | } | 539 | } |
520 | 540 | ||
521 | public void Close(bool force) | 541 | public void Close(bool sendStop, bool force) |
522 | { | 542 | { |
523 | // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. | 543 | // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. |
524 | // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. | 544 | // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. |
@@ -530,7 +550,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
530 | return; | 550 | return; |
531 | 551 | ||
532 | IsActive = false; | 552 | IsActive = false; |
533 | CloseWithoutChecks(); | 553 | CloseWithoutChecks(sendStop); |
534 | } | 554 | } |
535 | } | 555 | } |
536 | 556 | ||
@@ -543,12 +563,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
543 | /// | 563 | /// |
544 | /// Callers must lock ClosingSyncLock before calling. | 564 | /// Callers must lock ClosingSyncLock before calling. |
545 | /// </remarks> | 565 | /// </remarks> |
546 | public void CloseWithoutChecks() | 566 | public void CloseWithoutChecks(bool sendStop) |
547 | { | 567 | { |
548 | m_log.DebugFormat( | 568 | m_log.DebugFormat( |
549 | "[CLIENT]: Close has been called for {0} attached to scene {1}", | 569 | "[CLIENT]: Close has been called for {0} attached to scene {1}", |
550 | Name, m_scene.RegionInfo.RegionName); | 570 | Name, m_scene.RegionInfo.RegionName); |
551 | 571 | ||
572 | if (sendStop) | ||
573 | { | ||
574 | // Send the STOP packet | ||
575 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | ||
576 | OutPacket(disable, ThrottleOutPacketType.Unknown); | ||
577 | } | ||
578 | |||
552 | // Shutdown the image manager | 579 | // Shutdown the image manager |
553 | ImageManager.Close(); | 580 | ImageManager.Close(); |
554 | 581 | ||
@@ -806,7 +833,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
806 | handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); | 833 | handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); |
807 | handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; | 834 | handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; |
808 | 835 | ||
809 | OutPacket(handshake, ThrottleOutPacketType.Task); | 836 | // OutPacket(handshake, ThrottleOutPacketType.Task); |
837 | // use same as MoveAgentIntoRegion (both should be task ) | ||
838 | OutPacket(handshake, ThrottleOutPacketType.Unknown); | ||
810 | } | 839 | } |
811 | 840 | ||
812 | public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) | 841 | public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) |
@@ -845,7 +874,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
845 | reply.ChatData.OwnerID = fromAgentID; | 874 | reply.ChatData.OwnerID = fromAgentID; |
846 | reply.ChatData.SourceID = fromAgentID; | 875 | reply.ChatData.SourceID = fromAgentID; |
847 | 876 | ||
848 | OutPacket(reply, ThrottleOutPacketType.Task); | 877 | OutPacket(reply, ThrottleOutPacketType.Unknown); |
849 | } | 878 | } |
850 | 879 | ||
851 | /// <summary> | 880 | /// <summary> |
@@ -1131,6 +1160,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1131 | public virtual void SendLayerData(float[] map) | 1160 | public virtual void SendLayerData(float[] map) |
1132 | { | 1161 | { |
1133 | Util.FireAndForget(DoSendLayerData, map); | 1162 | Util.FireAndForget(DoSendLayerData, map); |
1163 | |||
1164 | // Send it sync, and async. It's not that much data | ||
1165 | // and it improves user experience just so much! | ||
1166 | DoSendLayerData(map); | ||
1134 | } | 1167 | } |
1135 | 1168 | ||
1136 | /// <summary> | 1169 | /// <summary> |
@@ -1143,16 +1176,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1143 | 1176 | ||
1144 | try | 1177 | try |
1145 | { | 1178 | { |
1146 | //for (int y = 0; y < 16; y++) | 1179 | for (int y = 0; y < 16; y++) |
1147 | //{ | 1180 | { |
1148 | // for (int x = 0; x < 16; x++) | 1181 | for (int x = 0; x < 16; x+=4) |
1149 | // { | 1182 | { |
1150 | // SendLayerData(x, y, map); | 1183 | SendLayerPacket(x, y, map); |
1151 | // } | 1184 | } |
1152 | //} | 1185 | } |
1153 | |||
1154 | // Send LayerData in a spiral pattern. Fun! | ||
1155 | SendLayerTopRight(map, 0, 0, 15, 15); | ||
1156 | } | 1186 | } |
1157 | catch (Exception e) | 1187 | catch (Exception e) |
1158 | { | 1188 | { |
@@ -1160,51 +1190,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1160 | } | 1190 | } |
1161 | } | 1191 | } |
1162 | 1192 | ||
1163 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | ||
1164 | { | ||
1165 | // Row | ||
1166 | for (int i = x1; i <= x2; i++) | ||
1167 | SendLayerData(i, y1, map); | ||
1168 | |||
1169 | // Column | ||
1170 | for (int j = y1 + 1; j <= y2; j++) | ||
1171 | SendLayerData(x2, j, map); | ||
1172 | |||
1173 | if (x2 - x1 > 0) | ||
1174 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | ||
1175 | } | ||
1176 | |||
1177 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | ||
1178 | { | ||
1179 | // Row in reverse | ||
1180 | for (int i = x2; i >= x1; i--) | ||
1181 | SendLayerData(i, y2, map); | ||
1182 | |||
1183 | // Column in reverse | ||
1184 | for (int j = y2 - 1; j >= y1; j--) | ||
1185 | SendLayerData(x1, j, map); | ||
1186 | |||
1187 | if (x2 - x1 > 0) | ||
1188 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | ||
1189 | } | ||
1190 | |||
1191 | /// <summary> | 1193 | /// <summary> |
1192 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client | 1194 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client |
1193 | /// </summary> | 1195 | /// </summary> |
1194 | /// <param name="map">heightmap</param> | 1196 | /// <param name="map">heightmap</param> |
1195 | /// <param name="px">X coordinate for patches 0..12</param> | 1197 | /// <param name="px">X coordinate for patches 0..12</param> |
1196 | /// <param name="py">Y coordinate for patches 0..15</param> | 1198 | /// <param name="py">Y coordinate for patches 0..15</param> |
1197 | // private void SendLayerPacket(float[] map, int y, int x) | 1199 | private void SendLayerPacket(int x, int y, float[] map) |
1198 | // { | 1200 | { |
1199 | // int[] patches = new int[4]; | 1201 | int[] patches = new int[4]; |
1200 | // patches[0] = x + 0 + y * 16; | 1202 | patches[0] = x + 0 + y * 16; |
1201 | // patches[1] = x + 1 + y * 16; | 1203 | patches[1] = x + 1 + y * 16; |
1202 | // patches[2] = x + 2 + y * 16; | 1204 | patches[2] = x + 2 + y * 16; |
1203 | // patches[3] = x + 3 + y * 16; | 1205 | patches[3] = x + 3 + y * 16; |
1204 | 1206 | ||
1205 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | 1207 | float[] heightmap = (map.Length == 65536) ? |
1206 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 1208 | map : |
1207 | // } | 1209 | LLHeightFieldMoronize(map); |
1210 | |||
1211 | try | ||
1212 | { | ||
1213 | Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
1214 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
1215 | } | ||
1216 | catch | ||
1217 | { | ||
1218 | for (int px = x ; px < x + 4 ; px++) | ||
1219 | SendLayerData(px, y, map); | ||
1220 | } | ||
1221 | } | ||
1208 | 1222 | ||
1209 | /// <summary> | 1223 | /// <summary> |
1210 | /// Sends a specified patch to a client | 1224 | /// Sends a specified patch to a client |
@@ -1224,7 +1238,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1224 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | 1238 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); |
1225 | layerpack.Header.Reliable = true; | 1239 | layerpack.Header.Reliable = true; |
1226 | 1240 | ||
1227 | OutPacket(layerpack, ThrottleOutPacketType.Land); | 1241 | OutPacket(layerpack, ThrottleOutPacketType.Task); |
1228 | } | 1242 | } |
1229 | catch (Exception e) | 1243 | catch (Exception e) |
1230 | { | 1244 | { |
@@ -1587,7 +1601,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1587 | 1601 | ||
1588 | public void SendKillObject(ulong regionHandle, List<uint> localIDs) | 1602 | public void SendKillObject(ulong regionHandle, List<uint> localIDs) |
1589 | { | 1603 | { |
1590 | // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); | 1604 | // foreach (uint id in localIDs) |
1605 | // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); | ||
1591 | 1606 | ||
1592 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); | 1607 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); |
1593 | // TODO: don't create new blocks if recycling an old packet | 1608 | // TODO: don't create new blocks if recycling an old packet |
@@ -1609,17 +1624,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1609 | // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race | 1624 | // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race |
1610 | // condition where a kill can be processed before an out-of-date update for the same object. | 1625 | // condition where a kill can be processed before an out-of-date update for the same object. |
1611 | // ProcessEntityUpdates() also takes the m_killRecord lock. | 1626 | // ProcessEntityUpdates() also takes the m_killRecord lock. |
1612 | lock (m_killRecord) | 1627 | // lock (m_killRecord) |
1613 | { | 1628 | // { |
1614 | foreach (uint localID in localIDs) | 1629 | // foreach (uint localID in localIDs) |
1615 | m_killRecord.Add(localID); | 1630 | // m_killRecord.Add(localID); |
1616 | 1631 | ||
1617 | // The throttle queue used here must match that being used for updates. Otherwise, there is a | 1632 | // The throttle queue used here must match that being used for updates. Otherwise, there is a |
1618 | // chance that a kill packet put on a separate queue will be sent to the client before an existing | 1633 | // chance that a kill packet put on a separate queue will be sent to the client before an existing |
1619 | // update packet on another queue. Receiving updates after kills results in unowned and undeletable | 1634 | // update packet on another queue. Receiving updates after kills results in unowned and undeletable |
1620 | // scene objects in a viewer until that viewer is relogged in. | 1635 | // scene objects in a viewer until that viewer is relogged in. |
1621 | OutPacket(kill, ThrottleOutPacketType.Task); | 1636 | OutPacket(kill, ThrottleOutPacketType.Task); |
1622 | } | 1637 | // } |
1623 | } | 1638 | } |
1624 | } | 1639 | } |
1625 | 1640 | ||
@@ -2077,9 +2092,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2077 | OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); | 2092 | OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); |
2078 | } | 2093 | } |
2079 | 2094 | ||
2080 | /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see> | ||
2081 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) | 2095 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) |
2082 | { | 2096 | { |
2097 | SendInventoryItemCreateUpdate(Item, UUID.Zero, callbackId); | ||
2098 | } | ||
2099 | |||
2100 | /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see> | ||
2101 | public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId) | ||
2102 | { | ||
2083 | const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; | 2103 | const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; |
2084 | 2104 | ||
2085 | UpdateCreateInventoryItemPacket InventoryReply | 2105 | UpdateCreateInventoryItemPacket InventoryReply |
@@ -2089,6 +2109,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2089 | // TODO: don't create new blocks if recycling an old packet | 2109 | // TODO: don't create new blocks if recycling an old packet |
2090 | InventoryReply.AgentData.AgentID = AgentId; | 2110 | InventoryReply.AgentData.AgentID = AgentId; |
2091 | InventoryReply.AgentData.SimApproved = true; | 2111 | InventoryReply.AgentData.SimApproved = true; |
2112 | InventoryReply.AgentData.TransactionID = transactionID; | ||
2092 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; | 2113 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; |
2093 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); | 2114 | InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); |
2094 | InventoryReply.InventoryData[0].ItemID = Item.ID; | 2115 | InventoryReply.InventoryData[0].ItemID = Item.ID; |
@@ -2158,16 +2179,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2158 | replytask.InventoryData.TaskID = taskID; | 2179 | replytask.InventoryData.TaskID = taskID; |
2159 | replytask.InventoryData.Serial = serial; | 2180 | replytask.InventoryData.Serial = serial; |
2160 | replytask.InventoryData.Filename = fileName; | 2181 | replytask.InventoryData.Filename = fileName; |
2161 | OutPacket(replytask, ThrottleOutPacketType.Asset); | 2182 | OutPacket(replytask, ThrottleOutPacketType.Task); |
2162 | } | 2183 | } |
2163 | 2184 | ||
2164 | public void SendXferPacket(ulong xferID, uint packet, byte[] data) | 2185 | public void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory) |
2165 | { | 2186 | { |
2187 | ThrottleOutPacketType type = ThrottleOutPacketType.Asset; | ||
2188 | if (isTaskInventory) | ||
2189 | type = ThrottleOutPacketType.Task; | ||
2190 | |||
2166 | SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); | 2191 | SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); |
2167 | sendXfer.XferID.ID = xferID; | 2192 | sendXfer.XferID.ID = xferID; |
2168 | sendXfer.XferID.Packet = packet; | 2193 | sendXfer.XferID.Packet = packet; |
2169 | sendXfer.DataPacket.Data = data; | 2194 | sendXfer.DataPacket.Data = data; |
2170 | OutPacket(sendXfer, ThrottleOutPacketType.Asset); | 2195 | OutPacket(sendXfer, type); |
2171 | } | 2196 | } |
2172 | 2197 | ||
2173 | public void SendAbortXferPacket(ulong xferID) | 2198 | public void SendAbortXferPacket(ulong xferID) |
@@ -2349,6 +2374,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2349 | OutPacket(sound, ThrottleOutPacketType.Task); | 2374 | OutPacket(sound, ThrottleOutPacketType.Task); |
2350 | } | 2375 | } |
2351 | 2376 | ||
2377 | public void SendTransferAbort(TransferRequestPacket transferRequest) | ||
2378 | { | ||
2379 | TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort); | ||
2380 | abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID; | ||
2381 | abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType; | ||
2382 | m_log.Debug("[Assets] Aborting transfer; asset request failed"); | ||
2383 | OutPacket(abort, ThrottleOutPacketType.Task); | ||
2384 | } | ||
2385 | |||
2352 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) | 2386 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) |
2353 | { | 2387 | { |
2354 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); | 2388 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); |
@@ -2641,6 +2675,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2641 | } | 2675 | } |
2642 | } | 2676 | } |
2643 | 2677 | ||
2678 | public void SendPartPhysicsProprieties(ISceneEntity entity) | ||
2679 | { | ||
2680 | SceneObjectPart part = (SceneObjectPart)entity; | ||
2681 | if (part != null && AgentId != UUID.Zero) | ||
2682 | { | ||
2683 | try | ||
2684 | { | ||
2685 | IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); | ||
2686 | if (eq != null) | ||
2687 | { | ||
2688 | uint localid = part.LocalId; | ||
2689 | byte physshapetype = part.PhysicsShapeType; | ||
2690 | float density = part.Density; | ||
2691 | float friction = part.Friction; | ||
2692 | float bounce = part.Bounciness; | ||
2693 | float gravmod = part.GravityModifier; | ||
2694 | |||
2695 | eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); | ||
2696 | } | ||
2697 | } | ||
2698 | catch (Exception ex) | ||
2699 | { | ||
2700 | m_log.Error("Unable to send part Physics Proprieties - exception: " + ex.ToString()); | ||
2701 | } | ||
2702 | part.UpdatePhysRequired = false; | ||
2703 | } | ||
2704 | } | ||
2705 | |||
2706 | |||
2644 | 2707 | ||
2645 | public void SendGroupNameReply(UUID groupLLUID, string GroupName) | 2708 | public void SendGroupNameReply(UUID groupLLUID, string GroupName) |
2646 | { | 2709 | { |
@@ -2738,7 +2801,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2738 | else | 2801 | else |
2739 | { | 2802 | { |
2740 | int processedLength = 0; | 2803 | int processedLength = 0; |
2741 | int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; | 2804 | // int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; |
2805 | |||
2806 | int maxChunkSize = (int) MaxTransferBytesPerPacket; | ||
2742 | int packetNumber = 0; | 2807 | int packetNumber = 0; |
2743 | 2808 | ||
2744 | while (processedLength < req.AssetInf.Data.Length) | 2809 | while (processedLength < req.AssetInf.Data.Length) |
@@ -2809,7 +2874,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2809 | reply.Data.ParcelID = parcelID; | 2874 | reply.Data.ParcelID = parcelID; |
2810 | reply.Data.OwnerID = land.OwnerID; | 2875 | reply.Data.OwnerID = land.OwnerID; |
2811 | reply.Data.Name = Utils.StringToBytes(land.Name); | 2876 | reply.Data.Name = Utils.StringToBytes(land.Name); |
2812 | reply.Data.Desc = Utils.StringToBytes(land.Description); | 2877 | if (land != null && land.Description != null && land.Description != String.Empty) |
2878 | reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); | ||
2879 | else | ||
2880 | reply.Data.Desc = new Byte[0]; | ||
2813 | reply.Data.ActualArea = land.Area; | 2881 | reply.Data.ActualArea = land.Area; |
2814 | reply.Data.BillableArea = land.Area; // TODO: what is this? | 2882 | reply.Data.BillableArea = land.Area; // TODO: what is this? |
2815 | 2883 | ||
@@ -3544,7 +3612,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3544 | 3612 | ||
3545 | AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); | 3613 | AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); |
3546 | // TODO: don't create new blocks if recycling an old packet | 3614 | // TODO: don't create new blocks if recycling an old packet |
3547 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | 3615 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length]; |
3548 | avp.ObjectData.TextureEntry = textureEntry; | 3616 | avp.ObjectData.TextureEntry = textureEntry; |
3549 | 3617 | ||
3550 | AvatarAppearancePacket.VisualParamBlock avblock = null; | 3618 | AvatarAppearancePacket.VisualParamBlock avblock = null; |
@@ -3674,7 +3742,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3674 | /// </summary> | 3742 | /// </summary> |
3675 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) | 3743 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) |
3676 | { | 3744 | { |
3677 | //double priority = m_prioritizer.GetUpdatePriority(this, entity); | 3745 | if (entity is SceneObjectPart) |
3746 | { | ||
3747 | SceneObjectPart e = (SceneObjectPart)entity; | ||
3748 | SceneObjectGroup g = e.ParentGroup; | ||
3749 | if (g.RootPart.Shape.State > 30) // HUD | ||
3750 | if (g.OwnerID != AgentId) | ||
3751 | return; // Don't send updates for other people's HUDs | ||
3752 | } | ||
3753 | |||
3678 | uint priority = m_prioritizer.GetUpdatePriority(this, entity); | 3754 | uint priority = m_prioritizer.GetUpdatePriority(this, entity); |
3679 | 3755 | ||
3680 | lock (m_entityUpdates.SyncRoot) | 3756 | lock (m_entityUpdates.SyncRoot) |
@@ -3741,27 +3817,74 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3741 | 3817 | ||
3742 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race | 3818 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race |
3743 | // condition where a kill can be processed before an out-of-date update for the same object. | 3819 | // condition where a kill can be processed before an out-of-date update for the same object. |
3744 | lock (m_killRecord) | 3820 | float avgTimeDilation = 1.0f; |
3821 | IEntityUpdate iupdate; | ||
3822 | Int32 timeinqueue; // this is just debugging code & can be dropped later | ||
3823 | |||
3824 | while (updatesThisCall < maxUpdates) | ||
3745 | { | 3825 | { |
3746 | float avgTimeDilation = 1.0f; | 3826 | lock (m_entityUpdates.SyncRoot) |
3747 | IEntityUpdate iupdate; | 3827 | if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue)) |
3748 | Int32 timeinqueue; // this is just debugging code & can be dropped later | 3828 | break; |
3829 | |||
3830 | EntityUpdate update = (EntityUpdate)iupdate; | ||
3831 | |||
3832 | avgTimeDilation += update.TimeDilation; | ||
3833 | avgTimeDilation *= 0.5f; | ||
3749 | 3834 | ||
3750 | while (updatesThisCall < maxUpdates) | 3835 | if (update.Entity is SceneObjectPart) |
3751 | { | 3836 | { |
3752 | lock (m_entityUpdates.SyncRoot) | 3837 | SceneObjectPart part = (SceneObjectPart)update.Entity; |
3753 | if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue)) | ||
3754 | break; | ||
3755 | 3838 | ||
3756 | EntityUpdate update = (EntityUpdate)iupdate; | 3839 | if (part.ParentGroup.IsDeleted) |
3757 | 3840 | continue; | |
3758 | avgTimeDilation += update.TimeDilation; | ||
3759 | avgTimeDilation *= 0.5f; | ||
3760 | 3841 | ||
3761 | if (update.Entity is SceneObjectPart) | 3842 | if (part.ParentGroup.IsAttachment) |
3843 | { // Someone else's HUD, why are we getting these? | ||
3844 | if (part.ParentGroup.OwnerID != AgentId && | ||
3845 | part.ParentGroup.RootPart.Shape.State > 30) | ||
3846 | continue; | ||
3847 | ScenePresence sp; | ||
3848 | // Owner is not in the sim, don't update it to | ||
3849 | // anyone | ||
3850 | if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) | ||
3851 | continue; | ||
3852 | |||
3853 | List<SceneObjectGroup> atts = sp.GetAttachments(); | ||
3854 | bool found = false; | ||
3855 | foreach (SceneObjectGroup att in atts) | ||
3856 | { | ||
3857 | if (att == part.ParentGroup) | ||
3858 | { | ||
3859 | found = true; | ||
3860 | break; | ||
3861 | } | ||
3862 | } | ||
3863 | |||
3864 | // It's an attachment of a valid avatar, but | ||
3865 | // doesn't seem to be attached, skip | ||
3866 | if (!found) | ||
3867 | continue; | ||
3868 | |||
3869 | // On vehicle crossing, the attachments are received | ||
3870 | // while the avatar is still a child. Don't send | ||
3871 | // updates here because the LocalId has not yet | ||
3872 | // been updated and the viewer will derender the | ||
3873 | // attachments until the avatar becomes root. | ||
3874 | if (sp.IsChildAgent) | ||
3875 | continue; | ||
3876 | |||
3877 | // If the object is an attachment we don't want it to be in the kill | ||
3878 | // record. Else attaching from inworld and subsequently dropping | ||
3879 | // it will no longer work. | ||
3880 | // lock (m_killRecord) | ||
3881 | // { | ||
3882 | // m_killRecord.Remove(part.LocalId); | ||
3883 | // m_killRecord.Remove(part.ParentGroup.RootPart.LocalId); | ||
3884 | // } | ||
3885 | } | ||
3886 | else | ||
3762 | { | 3887 | { |
3763 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3764 | |||
3765 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client | 3888 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client |
3766 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good | 3889 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good |
3767 | // safety measure. | 3890 | // safety measure. |
@@ -3772,241 +3895,177 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3772 | // | 3895 | // |
3773 | // This doesn't appear to apply to child prims - a client will happily ignore these updates | 3896 | // This doesn't appear to apply to child prims - a client will happily ignore these updates |
3774 | // after the root prim has been deleted. | 3897 | // after the root prim has been deleted. |
3775 | if (m_killRecord.Contains(part.LocalId)) | 3898 | // |
3776 | { | 3899 | // We ignore this for attachments because attaching something from inworld breaks unless we do. |
3777 | // m_log.WarnFormat( | 3900 | // lock (m_killRecord) |
3778 | // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted", | 3901 | // { |
3779 | // part.LocalId, Name); | 3902 | // if (m_killRecord.Contains(part.LocalId)) |
3780 | continue; | 3903 | // continue; |
3781 | } | 3904 | // if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) |
3782 | 3905 | // continue; | |
3783 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | 3906 | // } |
3907 | } | ||
3908 | |||
3909 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | ||
3910 | { | ||
3911 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | ||
3912 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | ||
3784 | { | 3913 | { |
3785 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | 3914 | part.Shape.LightEntry = false; |
3786 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | ||
3787 | { | ||
3788 | part.Shape.LightEntry = false; | ||
3789 | } | ||
3790 | } | 3915 | } |
3791 | } | 3916 | } |
3792 | 3917 | } | |
3793 | #region UpdateFlags to packet type conversion | 3918 | |
3794 | 3919 | ++updatesThisCall; | |
3795 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; | 3920 | |
3796 | 3921 | #region UpdateFlags to packet type conversion | |
3797 | bool canUseCompressed = true; | 3922 | |
3798 | bool canUseImproved = true; | 3923 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; |
3799 | 3924 | ||
3800 | // Compressed object updates only make sense for LL primitives | 3925 | bool canUseCompressed = true; |
3801 | if (!(update.Entity is SceneObjectPart)) | 3926 | bool canUseImproved = true; |
3927 | |||
3928 | // Compressed object updates only make sense for LL primitives | ||
3929 | if (!(update.Entity is SceneObjectPart)) | ||
3930 | { | ||
3931 | canUseCompressed = false; | ||
3932 | } | ||
3933 | |||
3934 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | ||
3935 | { | ||
3936 | canUseCompressed = false; | ||
3937 | canUseImproved = false; | ||
3938 | } | ||
3939 | else | ||
3940 | { | ||
3941 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || | ||
3942 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || | ||
3943 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || | ||
3944 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3802 | { | 3945 | { |
3803 | canUseCompressed = false; | 3946 | canUseCompressed = false; |
3804 | } | 3947 | } |
3805 | 3948 | ||
3806 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | 3949 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || |
3950 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
3951 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
3952 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
3953 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
3954 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
3955 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
3956 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
3957 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
3958 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
3959 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
3960 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
3961 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
3962 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3807 | { | 3963 | { |
3808 | canUseCompressed = false; | ||
3809 | canUseImproved = false; | 3964 | canUseImproved = false; |
3810 | } | 3965 | } |
3811 | else | 3966 | } |
3812 | { | ||
3813 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || | ||
3814 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || | ||
3815 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || | ||
3816 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3817 | { | ||
3818 | canUseCompressed = false; | ||
3819 | } | ||
3820 | |||
3821 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || | ||
3822 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
3823 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
3824 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
3825 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
3826 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
3827 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
3828 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
3829 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
3830 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
3831 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
3832 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
3833 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
3834 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3835 | { | ||
3836 | canUseImproved = false; | ||
3837 | } | ||
3838 | } | ||
3839 | |||
3840 | #endregion UpdateFlags to packet type conversion | ||
3841 | |||
3842 | #region Block Construction | ||
3843 | |||
3844 | // TODO: Remove this once we can build compressed updates | ||
3845 | canUseCompressed = false; | ||
3846 | 3967 | ||
3847 | if (!canUseImproved && !canUseCompressed) | 3968 | #endregion UpdateFlags to packet type conversion |
3848 | { | ||
3849 | ObjectUpdatePacket.ObjectDataBlock updateBlock; | ||
3850 | 3969 | ||
3851 | if (update.Entity is ScenePresence) | 3970 | #region Block Construction |
3852 | { | ||
3853 | updateBlock = CreateAvatarUpdateBlock((ScenePresence)update.Entity); | ||
3854 | } | ||
3855 | else | ||
3856 | { | ||
3857 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3858 | updateBlock = CreatePrimUpdateBlock(part, AgentId); | ||
3859 | |||
3860 | // If the part has become a private hud since the update was scheduled then we do not | ||
3861 | // want to send it to other avatars. | ||
3862 | if (part.ParentGroup.IsAttachment | ||
3863 | && part.ParentGroup.HasPrivateAttachmentPoint | ||
3864 | && part.ParentGroup.AttachedAvatar != AgentId) | ||
3865 | continue; | ||
3866 | |||
3867 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3868 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3869 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3870 | // of the test above). | ||
3871 | // | ||
3872 | // Actual deletions (kills) happen in another method. | ||
3873 | if (part.ParentGroup.IsDeleted) | ||
3874 | continue; | ||
3875 | } | ||
3876 | 3971 | ||
3877 | objectUpdateBlocks.Value.Add(updateBlock); | 3972 | // TODO: Remove this once we can build compressed updates |
3878 | objectUpdates.Value.Add(update); | 3973 | canUseCompressed = false; |
3879 | } | ||
3880 | else if (!canUseImproved) | ||
3881 | { | ||
3882 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3883 | ObjectUpdateCompressedPacket.ObjectDataBlock compressedBlock | ||
3884 | = CreateCompressedUpdateBlock(part, updateFlags); | ||
3885 | |||
3886 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3887 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3888 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3889 | // of the test above). | ||
3890 | // | ||
3891 | // Actual deletions (kills) happen in another method. | ||
3892 | if (part.ParentGroup.IsDeleted) | ||
3893 | continue; | ||
3894 | 3974 | ||
3895 | compressedUpdateBlocks.Value.Add(compressedBlock); | 3975 | if (!canUseImproved && !canUseCompressed) |
3896 | compressedUpdates.Value.Add(update); | 3976 | { |
3977 | if (update.Entity is ScenePresence) | ||
3978 | { | ||
3979 | objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); | ||
3897 | } | 3980 | } |
3898 | else | 3981 | else |
3899 | { | 3982 | { |
3900 | if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) | 3983 | objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); |
3901 | { | ||
3902 | // Self updates go into a special list | ||
3903 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3904 | terseAgentUpdates.Value.Add(update); | ||
3905 | } | ||
3906 | else | ||
3907 | { | ||
3908 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseUpdateBlock | ||
3909 | = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); | ||
3910 | |||
3911 | // Everything else goes here | ||
3912 | if (update.Entity is SceneObjectPart) | ||
3913 | { | ||
3914 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3915 | |||
3916 | // If the part has become a private hud since the update was scheduled then we do not | ||
3917 | // want to send it to other avatars. | ||
3918 | if (part.ParentGroup.IsAttachment | ||
3919 | && part.ParentGroup.HasPrivateAttachmentPoint | ||
3920 | && part.ParentGroup.AttachedAvatar != AgentId) | ||
3921 | continue; | ||
3922 | |||
3923 | // If the part has since been deleted, then drop the update. In the case of attachments, | ||
3924 | // this is to avoid spurious updates to other viewers since post-processing of attachments | ||
3925 | // has to change the IsAttachment flag for various reasons (which will end up in a pass | ||
3926 | // of the test above). | ||
3927 | // | ||
3928 | // Actual deletions (kills) happen in another method. | ||
3929 | if (part.ParentGroup.IsDeleted) | ||
3930 | continue; | ||
3931 | } | ||
3932 | |||
3933 | terseUpdateBlocks.Value.Add(terseUpdateBlock); | ||
3934 | terseUpdates.Value.Add(update); | ||
3935 | } | ||
3936 | } | 3984 | } |
3937 | |||
3938 | ++updatesThisCall; | ||
3939 | |||
3940 | #endregion Block Construction | ||
3941 | } | 3985 | } |
3942 | 3986 | else if (!canUseImproved) | |
3943 | #region Packet Sending | 3987 | { |
3944 | ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); | 3988 | compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); |
3945 | 3989 | } | |
3946 | if (terseAgentUpdateBlocks.IsValueCreated) | 3990 | else |
3947 | { | 3991 | { |
3948 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | 3992 | if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) |
3993 | // Self updates go into a special list | ||
3994 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3995 | else | ||
3996 | // Everything else goes here | ||
3997 | terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3998 | } | ||
3949 | 3999 | ||
3950 | ImprovedTerseObjectUpdatePacket packet | 4000 | #endregion Block Construction |
3951 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); | 4001 | } |
3952 | 4002 | ||
3953 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 4003 | #region Packet Sending |
3954 | packet.RegionData.TimeDilation = timeDilation; | 4004 | |
3955 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | 4005 | const float TIME_DILATION = 1.0f; |
4006 | ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); | ||
4007 | |||
4008 | if (terseAgentUpdateBlocks.IsValueCreated) | ||
4009 | { | ||
4010 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | ||
3956 | 4011 | ||
3957 | for (int i = 0; i < blocks.Count; i++) | 4012 | ImprovedTerseObjectUpdatePacket packet |
3958 | packet.ObjectData[i] = blocks[i]; | 4013 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); |
3959 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | 4014 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; |
3960 | OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); }); | 4015 | packet.RegionData.TimeDilation = timeDilation; |
3961 | } | 4016 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; |
3962 | 4017 | ||
3963 | if (objectUpdateBlocks.IsValueCreated) | 4018 | for (int i = 0; i < blocks.Count; i++) |
3964 | { | 4019 | packet.ObjectData[i] = blocks[i]; |
3965 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; | ||
3966 | |||
3967 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | ||
3968 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3969 | packet.RegionData.TimeDilation = timeDilation; | ||
3970 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
3971 | |||
3972 | for (int i = 0; i < blocks.Count; i++) | ||
3973 | packet.ObjectData[i] = blocks[i]; | ||
3974 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
3975 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); }); | ||
3976 | } | ||
3977 | |||
3978 | if (compressedUpdateBlocks.IsValueCreated) | ||
3979 | { | ||
3980 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | ||
3981 | |||
3982 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
3983 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3984 | packet.RegionData.TimeDilation = timeDilation; | ||
3985 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
3986 | |||
3987 | for (int i = 0; i < blocks.Count; i++) | ||
3988 | packet.ObjectData[i] = blocks[i]; | ||
3989 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
3990 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); }); | ||
3991 | } | ||
3992 | 4020 | ||
3993 | if (terseUpdateBlocks.IsValueCreated) | 4021 | OutPacket(packet, ThrottleOutPacketType.Unknown, true); |
3994 | { | 4022 | } |
3995 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | ||
3996 | |||
3997 | ImprovedTerseObjectUpdatePacket packet | ||
3998 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( | ||
3999 | PacketType.ImprovedTerseObjectUpdate); | ||
4000 | 4023 | ||
4001 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 4024 | if (objectUpdateBlocks.IsValueCreated) |
4002 | packet.RegionData.TimeDilation = timeDilation; | 4025 | { |
4003 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | 4026 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; |
4004 | 4027 | ||
4005 | for (int i = 0; i < blocks.Count; i++) | 4028 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
4006 | packet.ObjectData[i] = blocks[i]; | 4029 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; |
4007 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | 4030 | packet.RegionData.TimeDilation = timeDilation; |
4008 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | 4031 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; |
4009 | } | 4032 | |
4033 | for (int i = 0; i < blocks.Count; i++) | ||
4034 | packet.ObjectData[i] = blocks[i]; | ||
4035 | |||
4036 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4037 | } | ||
4038 | |||
4039 | if (compressedUpdateBlocks.IsValueCreated) | ||
4040 | { | ||
4041 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | ||
4042 | |||
4043 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
4044 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4045 | packet.RegionData.TimeDilation = timeDilation; | ||
4046 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
4047 | |||
4048 | for (int i = 0; i < blocks.Count; i++) | ||
4049 | packet.ObjectData[i] = blocks[i]; | ||
4050 | |||
4051 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4052 | } | ||
4053 | |||
4054 | if (terseUpdateBlocks.IsValueCreated) | ||
4055 | { | ||
4056 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | ||
4057 | |||
4058 | ImprovedTerseObjectUpdatePacket packet | ||
4059 | = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( | ||
4060 | PacketType.ImprovedTerseObjectUpdate); | ||
4061 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4062 | packet.RegionData.TimeDilation = timeDilation; | ||
4063 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
4064 | |||
4065 | for (int i = 0; i < blocks.Count; i++) | ||
4066 | packet.ObjectData[i] = blocks[i]; | ||
4067 | |||
4068 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | ||
4010 | } | 4069 | } |
4011 | 4070 | ||
4012 | #endregion Packet Sending | 4071 | #endregion Packet Sending |
@@ -4299,11 +4358,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4299 | 4358 | ||
4300 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties | 4359 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties |
4301 | // of the object rather than the properties when the packet was created | 4360 | // of the object rather than the properties when the packet was created |
4302 | OutPacket(packet, ThrottleOutPacketType.Task, true, | 4361 | // HACK : Remove intelligent resending until it's fixed in core |
4303 | delegate(OutgoingPacket oPacket) | 4362 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4304 | { | 4363 | // delegate(OutgoingPacket oPacket) |
4305 | ResendPropertyUpdates(updates, oPacket); | 4364 | // { |
4306 | }); | 4365 | // ResendPropertyUpdates(updates, oPacket); |
4366 | // }); | ||
4367 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4307 | 4368 | ||
4308 | // pbcnt += blocks.Count; | 4369 | // pbcnt += blocks.Count; |
4309 | // ppcnt++; | 4370 | // ppcnt++; |
@@ -4329,11 +4390,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4329 | // of the object rather than the properties when the packet was created | 4390 | // of the object rather than the properties when the packet was created |
4330 | List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); | 4391 | List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); |
4331 | updates.Add(familyUpdates.Value[i]); | 4392 | updates.Add(familyUpdates.Value[i]); |
4332 | OutPacket(packet, ThrottleOutPacketType.Task, true, | 4393 | // HACK : Remove intelligent resending until it's fixed in core |
4333 | delegate(OutgoingPacket oPacket) | 4394 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4334 | { | 4395 | // delegate(OutgoingPacket oPacket) |
4335 | ResendPropertyUpdates(updates, oPacket); | 4396 | // { |
4336 | }); | 4397 | // ResendPropertyUpdates(updates, oPacket); |
4398 | // }); | ||
4399 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4337 | 4400 | ||
4338 | // fpcnt++; | 4401 | // fpcnt++; |
4339 | // fbcnt++; | 4402 | // fbcnt++; |
@@ -4705,7 +4768,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4705 | 4768 | ||
4706 | if (landData.SimwideArea > 0) | 4769 | if (landData.SimwideArea > 0) |
4707 | { | 4770 | { |
4708 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); | 4771 | int simulatorCapacity = (int)((long)landData.SimwideArea * (long)m_scene.RegionInfo.ObjectCapacity * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus / 65536L); |
4772 | // Never report more than sim total capacity | ||
4773 | if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity) | ||
4774 | simulatorCapacity = m_scene.RegionInfo.ObjectCapacity; | ||
4709 | updateMessage.SimWideMaxPrims = simulatorCapacity; | 4775 | updateMessage.SimWideMaxPrims = simulatorCapacity; |
4710 | } | 4776 | } |
4711 | else | 4777 | else |
@@ -4834,14 +4900,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4834 | 4900 | ||
4835 | if (notifyCount > 0) | 4901 | if (notifyCount > 0) |
4836 | { | 4902 | { |
4837 | if (notifyCount > 32) | 4903 | // if (notifyCount > 32) |
4838 | { | 4904 | // { |
4839 | m_log.InfoFormat( | 4905 | // m_log.InfoFormat( |
4840 | "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" | 4906 | // "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" |
4841 | + " - a developer might want to investigate whether this is a hard limit", 32); | 4907 | // + " - a developer might want to investigate whether this is a hard limit", 32); |
4842 | 4908 | // | |
4843 | notifyCount = 32; | 4909 | // notifyCount = 32; |
4844 | } | 4910 | // } |
4845 | 4911 | ||
4846 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock | 4912 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock |
4847 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; | 4913 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; |
@@ -4896,9 +4962,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4896 | { | 4962 | { |
4897 | ScenePresence presence = (ScenePresence)entity; | 4963 | ScenePresence presence = (ScenePresence)entity; |
4898 | 4964 | ||
4965 | position = presence.OffsetPosition; | ||
4966 | rotation = presence.Rotation; | ||
4967 | |||
4968 | if (presence.ParentID != 0) | ||
4969 | { | ||
4970 | SceneObjectPart part = m_scene.GetSceneObjectPart(presence.ParentID); | ||
4971 | if (part != null && part != part.ParentGroup.RootPart) | ||
4972 | { | ||
4973 | position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset; | ||
4974 | rotation = part.RotationOffset * presence.Rotation; | ||
4975 | } | ||
4976 | } | ||
4977 | |||
4899 | attachPoint = 0; | 4978 | attachPoint = 0; |
4900 | collisionPlane = presence.CollisionPlane; | 4979 | collisionPlane = presence.CollisionPlane; |
4901 | position = presence.OffsetPosition; | ||
4902 | velocity = presence.Velocity; | 4980 | velocity = presence.Velocity; |
4903 | acceleration = Vector3.Zero; | 4981 | acceleration = Vector3.Zero; |
4904 | 4982 | ||
@@ -4908,7 +4986,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4908 | // acceleration = new Vector3(1, 0, 0); | 4986 | // acceleration = new Vector3(1, 0, 0); |
4909 | 4987 | ||
4910 | angularVelocity = Vector3.Zero; | 4988 | angularVelocity = Vector3.Zero; |
4911 | rotation = presence.Rotation; | ||
4912 | 4989 | ||
4913 | if (sendTexture) | 4990 | if (sendTexture) |
4914 | textureEntry = presence.Appearance.Texture.GetBytes(); | 4991 | textureEntry = presence.Appearance.Texture.GetBytes(); |
@@ -5015,13 +5092,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5015 | 5092 | ||
5016 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) | 5093 | protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) |
5017 | { | 5094 | { |
5095 | Vector3 offsetPosition = data.OffsetPosition; | ||
5096 | Quaternion rotation = data.Rotation; | ||
5097 | uint parentID = data.ParentID; | ||
5098 | |||
5099 | if (parentID != 0) | ||
5100 | { | ||
5101 | SceneObjectPart part = m_scene.GetSceneObjectPart(parentID); | ||
5102 | if (part != null && part != part.ParentGroup.RootPart) | ||
5103 | { | ||
5104 | offsetPosition = part.OffsetPosition + data.OffsetPosition * part.RotationOffset; | ||
5105 | rotation = part.RotationOffset * data.Rotation; | ||
5106 | parentID = part.ParentGroup.RootPart.LocalId; | ||
5107 | } | ||
5108 | } | ||
5109 | |||
5018 | byte[] objectData = new byte[76]; | 5110 | byte[] objectData = new byte[76]; |
5019 | 5111 | ||
5020 | data.CollisionPlane.ToBytes(objectData, 0); | 5112 | data.CollisionPlane.ToBytes(objectData, 0); |
5021 | data.OffsetPosition.ToBytes(objectData, 16); | 5113 | offsetPosition.ToBytes(objectData, 16); |
5022 | // data.Velocity.ToBytes(objectData, 28); | 5114 | // data.Velocity.ToBytes(objectData, 28); |
5023 | // data.Acceleration.ToBytes(objectData, 40); | 5115 | // data.Acceleration.ToBytes(objectData, 40); |
5024 | data.Rotation.ToBytes(objectData, 52); | 5116 | rotation.ToBytes(objectData, 52); |
5025 | //data.AngularVelocity.ToBytes(objectData, 64); | 5117 | //data.AngularVelocity.ToBytes(objectData, 64); |
5026 | 5118 | ||
5027 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); | 5119 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); |
@@ -5035,7 +5127,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5035 | update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + | 5127 | update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + |
5036 | data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); | 5128 | data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); |
5037 | update.ObjectData = objectData; | 5129 | update.ObjectData = objectData; |
5038 | update.ParentID = data.ParentID; | 5130 | update.ParentID = parentID; |
5039 | update.PathCurve = 16; | 5131 | update.PathCurve = 16; |
5040 | update.PathScaleX = 100; | 5132 | update.PathScaleX = 100; |
5041 | update.PathScaleY = 100; | 5133 | update.PathScaleY = 100; |
@@ -5053,10 +5145,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5053 | update.TextureEntry = Utils.EmptyBytes; | 5145 | update.TextureEntry = Utils.EmptyBytes; |
5054 | // update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; | 5146 | // update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; |
5055 | 5147 | ||
5148 | /* 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) | ||
5056 | update.UpdateFlags = (uint)( | 5149 | update.UpdateFlags = (uint)( |
5057 | PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | | 5150 | PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | |
5058 | PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | | 5151 | PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | |
5059 | PrimFlags.ObjectOwnerModify); | 5152 | PrimFlags.ObjectOwnerModify); |
5153 | */ | ||
5154 | update.UpdateFlags = 0; | ||
5060 | 5155 | ||
5061 | return update; | 5156 | return update; |
5062 | } | 5157 | } |
@@ -5380,6 +5475,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5380 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); | 5475 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); |
5381 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); | 5476 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); |
5382 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); | 5477 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); |
5478 | AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments); | ||
5383 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); | 5479 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); |
5384 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); | 5480 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); |
5385 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); | 5481 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); |
@@ -5446,6 +5542,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5446 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); | 5542 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); |
5447 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); | 5543 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); |
5448 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); | 5544 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); |
5545 | AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags); | ||
5449 | 5546 | ||
5450 | AddGenericPacketHandler("autopilot", HandleAutopilot); | 5547 | AddGenericPacketHandler("autopilot", HandleAutopilot); |
5451 | } | 5548 | } |
@@ -5484,6 +5581,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5484 | (x.CameraLeftAxis != m_lastAgentUpdateArgs.CameraLeftAxis) || | 5581 | (x.CameraLeftAxis != m_lastAgentUpdateArgs.CameraLeftAxis) || |
5485 | (x.CameraUpAxis != m_lastAgentUpdateArgs.CameraUpAxis) || | 5582 | (x.CameraUpAxis != m_lastAgentUpdateArgs.CameraUpAxis) || |
5486 | (x.ControlFlags != m_lastAgentUpdateArgs.ControlFlags) || | 5583 | (x.ControlFlags != m_lastAgentUpdateArgs.ControlFlags) || |
5584 | (x.ControlFlags != 0) || | ||
5487 | (x.Far != m_lastAgentUpdateArgs.Far) || | 5585 | (x.Far != m_lastAgentUpdateArgs.Far) || |
5488 | (x.Flags != m_lastAgentUpdateArgs.Flags) || | 5586 | (x.Flags != m_lastAgentUpdateArgs.Flags) || |
5489 | (x.State != m_lastAgentUpdateArgs.State) || | 5587 | (x.State != m_lastAgentUpdateArgs.State) || |
@@ -6382,6 +6480,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6382 | { | 6480 | { |
6383 | handlerCompleteMovementToRegion(sender, true); | 6481 | handlerCompleteMovementToRegion(sender, true); |
6384 | } | 6482 | } |
6483 | else | ||
6484 | m_log.Debug("HandleCompleteAgentMovement NULL handler"); | ||
6485 | |||
6385 | handlerCompleteMovementToRegion = null; | 6486 | handlerCompleteMovementToRegion = null; |
6386 | 6487 | ||
6387 | return true; | 6488 | return true; |
@@ -6399,7 +6500,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6399 | return true; | 6500 | return true; |
6400 | } | 6501 | } |
6401 | #endregion | 6502 | #endregion |
6402 | 6503 | /* | |
6403 | StartAnim handlerStartAnim = null; | 6504 | StartAnim handlerStartAnim = null; |
6404 | StopAnim handlerStopAnim = null; | 6505 | StopAnim handlerStopAnim = null; |
6405 | 6506 | ||
@@ -6423,6 +6524,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6423 | } | 6524 | } |
6424 | } | 6525 | } |
6425 | return true; | 6526 | return true; |
6527 | */ | ||
6528 | ChangeAnim handlerChangeAnim = null; | ||
6529 | |||
6530 | for (int i = 0; i < AgentAni.AnimationList.Length; i++) | ||
6531 | { | ||
6532 | handlerChangeAnim = OnChangeAnim; | ||
6533 | if (handlerChangeAnim != null) | ||
6534 | { | ||
6535 | handlerChangeAnim(AgentAni.AnimationList[i].AnimID, AgentAni.AnimationList[i].StartAnim, false); | ||
6536 | } | ||
6537 | } | ||
6538 | |||
6539 | handlerChangeAnim = OnChangeAnim; | ||
6540 | if (handlerChangeAnim != null) | ||
6541 | { | ||
6542 | handlerChangeAnim(UUID.Zero, false, true); | ||
6543 | } | ||
6544 | |||
6545 | return true; | ||
6426 | } | 6546 | } |
6427 | 6547 | ||
6428 | private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) | 6548 | private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) |
@@ -7048,10 +7168,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7048 | // 46,47,48 are special positions within the packet | 7168 | // 46,47,48 are special positions within the packet |
7049 | // This may change so perhaps we need a better way | 7169 | // This may change so perhaps we need a better way |
7050 | // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?) | 7170 | // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?) |
7051 | bool UsePhysics = (data[46] != 0) ? true : false; | 7171 | /* |
7052 | bool IsTemporary = (data[47] != 0) ? true : false; | 7172 | bool UsePhysics = (data[46] != 0) ? true : false; |
7053 | bool IsPhantom = (data[48] != 0) ? true : false; | 7173 | bool IsTemporary = (data[47] != 0) ? true : false; |
7054 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); | 7174 | bool IsPhantom = (data[48] != 0) ? true : false; |
7175 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); | ||
7176 | */ | ||
7177 | bool UsePhysics = flags.AgentData.UsePhysics; | ||
7178 | bool IsPhantom = flags.AgentData.IsPhantom; | ||
7179 | bool IsTemporary = flags.AgentData.IsTemporary; | ||
7180 | ObjectFlagUpdatePacket.ExtraPhysicsBlock[] blocks = flags.ExtraPhysics; | ||
7181 | ExtraPhysicsData physdata = new ExtraPhysicsData(); | ||
7182 | |||
7183 | if (blocks == null || blocks.Length == 0) | ||
7184 | { | ||
7185 | physdata.PhysShapeType = PhysShapeType.invalid; | ||
7186 | } | ||
7187 | else | ||
7188 | { | ||
7189 | ObjectFlagUpdatePacket.ExtraPhysicsBlock phsblock = blocks[0]; | ||
7190 | physdata.PhysShapeType = (PhysShapeType)phsblock.PhysicsShapeType; | ||
7191 | physdata.Bounce = phsblock.Restitution; | ||
7192 | physdata.Density = phsblock.Density; | ||
7193 | physdata.Friction = phsblock.Friction; | ||
7194 | physdata.GravitationModifier = phsblock.GravityMultiplier; | ||
7195 | } | ||
7196 | |||
7197 | handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); | ||
7055 | } | 7198 | } |
7056 | return true; | 7199 | return true; |
7057 | } | 7200 | } |
@@ -8652,16 +8795,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8652 | 8795 | ||
8653 | #region Parcel related packets | 8796 | #region Parcel related packets |
8654 | 8797 | ||
8798 | // acumulate several HandleRegionHandleRequest consecutive overlaping requests | ||
8799 | // to be done with minimal resources as possible | ||
8800 | // variables temporary here while in test | ||
8801 | |||
8802 | Queue<UUID> RegionHandleRequests = new Queue<UUID>(); | ||
8803 | bool RegionHandleRequestsInService = false; | ||
8804 | |||
8655 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) | 8805 | private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) |
8656 | { | 8806 | { |
8657 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | 8807 | UUID currentUUID; |
8658 | 8808 | ||
8659 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; | 8809 | RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; |
8660 | if (handlerRegionHandleRequest != null) | 8810 | |
8811 | if (handlerRegionHandleRequest == null) | ||
8812 | return true; | ||
8813 | |||
8814 | RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; | ||
8815 | |||
8816 | lock (RegionHandleRequests) | ||
8661 | { | 8817 | { |
8662 | handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); | 8818 | if (RegionHandleRequestsInService) |
8819 | { | ||
8820 | // we are already busy doing a previus request | ||
8821 | // so enqueue it | ||
8822 | RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID); | ||
8823 | return true; | ||
8824 | } | ||
8825 | |||
8826 | // else do it | ||
8827 | currentUUID = rhrPack.RequestBlock.RegionID; | ||
8828 | RegionHandleRequestsInService = true; | ||
8663 | } | 8829 | } |
8664 | return true; | 8830 | |
8831 | while (true) | ||
8832 | { | ||
8833 | handlerRegionHandleRequest(this, currentUUID); | ||
8834 | |||
8835 | lock (RegionHandleRequests) | ||
8836 | { | ||
8837 | // exit condition, nothing to do or closed | ||
8838 | // current code seems to assume we may loose the handler at anytime, | ||
8839 | // so keep checking it | ||
8840 | handlerRegionHandleRequest = OnRegionHandleRequest; | ||
8841 | |||
8842 | if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null) | ||
8843 | { | ||
8844 | RegionHandleRequests.Clear(); | ||
8845 | RegionHandleRequestsInService = false; | ||
8846 | return true; | ||
8847 | } | ||
8848 | currentUUID = RegionHandleRequests.Dequeue(); | ||
8849 | } | ||
8850 | } | ||
8851 | |||
8852 | return true; // actually unreached | ||
8665 | } | 8853 | } |
8666 | 8854 | ||
8667 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) | 8855 | private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) |
@@ -9917,7 +10105,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9917 | handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, | 10105 | handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, |
9918 | Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), | 10106 | Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), |
9919 | UpdateMuteListEntry.MuteData.MuteType, | 10107 | UpdateMuteListEntry.MuteData.MuteType, |
9920 | UpdateMuteListEntry.AgentData.AgentID); | 10108 | UpdateMuteListEntry.MuteData.MuteFlags); |
9921 | return true; | 10109 | return true; |
9922 | } | 10110 | } |
9923 | return false; | 10111 | return false; |
@@ -9932,8 +10120,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9932 | { | 10120 | { |
9933 | handlerRemoveMuteListEntry(this, | 10121 | handlerRemoveMuteListEntry(this, |
9934 | RemoveMuteListEntry.MuteData.MuteID, | 10122 | RemoveMuteListEntry.MuteData.MuteID, |
9935 | Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName), | 10123 | Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName)); |
9936 | RemoveMuteListEntry.AgentData.AgentID); | ||
9937 | return true; | 10124 | return true; |
9938 | } | 10125 | } |
9939 | return false; | 10126 | return false; |
@@ -9977,10 +10164,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9977 | return false; | 10164 | return false; |
9978 | } | 10165 | } |
9979 | 10166 | ||
10167 | private bool HandleChangeInventoryItemFlags(IClientAPI client, Packet packet) | ||
10168 | { | ||
10169 | ChangeInventoryItemFlagsPacket ChangeInventoryItemFlags = | ||
10170 | (ChangeInventoryItemFlagsPacket)packet; | ||
10171 | ChangeInventoryItemFlags handlerChangeInventoryItemFlags = OnChangeInventoryItemFlags; | ||
10172 | if (handlerChangeInventoryItemFlags != null) | ||
10173 | { | ||
10174 | foreach(ChangeInventoryItemFlagsPacket.InventoryDataBlock b in ChangeInventoryItemFlags.InventoryData) | ||
10175 | handlerChangeInventoryItemFlags(this, b.ItemID, b.Flags); | ||
10176 | return true; | ||
10177 | } | ||
10178 | return false; | ||
10179 | } | ||
10180 | |||
9980 | private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) | 10181 | private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) |
9981 | { | 10182 | { |
9982 | return true; | 10183 | return true; |
9983 | } | 10184 | } |
10185 | |||
10186 | private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack) | ||
10187 | { | ||
10188 | CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack; | ||
10189 | |||
10190 | #region Packet Session and User Check | ||
10191 | if (m_checkPackets) | ||
10192 | { | ||
10193 | if (packet.AgentData.SessionID != SessionId || | ||
10194 | packet.AgentData.AgentID != AgentId) | ||
10195 | return true; | ||
10196 | } | ||
10197 | #endregion | ||
10198 | MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null; | ||
10199 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | ||
10200 | foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData) | ||
10201 | { | ||
10202 | InventoryItemBase b = new InventoryItemBase(); | ||
10203 | b.ID = n.OldItemID; | ||
10204 | b.Folder = n.OldFolderID; | ||
10205 | items.Add(b); | ||
10206 | } | ||
10207 | |||
10208 | handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy; | ||
10209 | if (handlerMoveItemsAndLeaveCopy != null) | ||
10210 | { | ||
10211 | handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID); | ||
10212 | } | ||
10213 | |||
10214 | return true; | ||
10215 | } | ||
9984 | 10216 | ||
9985 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) | 10217 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) |
9986 | { | 10218 | { |
@@ -10407,6 +10639,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10407 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; | 10639 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; |
10408 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; | 10640 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; |
10409 | 10641 | ||
10642 | Scene scene = (Scene)m_scene; | ||
10643 | if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID))) | ||
10644 | { | ||
10645 | ScenePresence p; | ||
10646 | if (scene.TryGetScenePresence(sender.AgentId, out p)) | ||
10647 | { | ||
10648 | if (p.GodLevel >= 200) | ||
10649 | { | ||
10650 | groupProfileReply.GroupData.OpenEnrollment = true; | ||
10651 | groupProfileReply.GroupData.MembershipFee = 0; | ||
10652 | } | ||
10653 | } | ||
10654 | } | ||
10655 | |||
10410 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); | 10656 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); |
10411 | } | 10657 | } |
10412 | return true; | 10658 | return true; |
@@ -10980,11 +11226,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10980 | 11226 | ||
10981 | StartLure handlerStartLure = OnStartLure; | 11227 | StartLure handlerStartLure = OnStartLure; |
10982 | if (handlerStartLure != null) | 11228 | if (handlerStartLure != null) |
10983 | handlerStartLure(startLureRequest.Info.LureType, | 11229 | { |
10984 | Utils.BytesToString( | 11230 | for (int i = 0 ; i < startLureRequest.TargetData.Length ; i++) |
10985 | startLureRequest.Info.Message), | 11231 | { |
10986 | startLureRequest.TargetData[0].TargetID, | 11232 | handlerStartLure(startLureRequest.Info.LureType, |
10987 | this); | 11233 | Utils.BytesToString( |
11234 | startLureRequest.Info.Message), | ||
11235 | startLureRequest.TargetData[i].TargetID, | ||
11236 | this); | ||
11237 | } | ||
11238 | } | ||
10988 | return true; | 11239 | return true; |
10989 | } | 11240 | } |
10990 | private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) | 11241 | private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) |
@@ -11098,10 +11349,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11098 | } | 11349 | } |
11099 | #endregion | 11350 | #endregion |
11100 | 11351 | ||
11101 | ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; | 11352 | ClassifiedGodDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; |
11102 | if (handlerClassifiedGodDelete != null) | 11353 | if (handlerClassifiedGodDelete != null) |
11103 | handlerClassifiedGodDelete( | 11354 | handlerClassifiedGodDelete( |
11104 | classifiedGodDelete.Data.ClassifiedID, | 11355 | classifiedGodDelete.Data.ClassifiedID, |
11356 | classifiedGodDelete.Data.QueryID, | ||
11105 | this); | 11357 | this); |
11106 | return true; | 11358 | return true; |
11107 | } | 11359 | } |
@@ -11467,209 +11719,147 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11467 | } | 11719 | } |
11468 | else | 11720 | else |
11469 | { | 11721 | { |
11470 | // m_log.DebugFormat( | 11722 | ClientChangeObject updatehandler = onClientChangeObject; |
11471 | // "[CLIENT]: Processing block {0} type {1} for {2} {3}", | ||
11472 | // i, block.Type, part.Name, part.LocalId); | ||
11473 | 11723 | ||
11474 | // // Do this once since fetch parts creates a new array. | 11724 | if (updatehandler != null) |
11475 | // SceneObjectPart[] parts = part.ParentGroup.Parts; | 11725 | { |
11476 | // for (int j = 0; j < parts.Length; j++) | 11726 | ObjectChangeData udata = new ObjectChangeData(); |
11477 | // { | ||
11478 | // part.StoreUndoState(); | ||
11479 | // parts[j].IgnoreUndoUpdate = true; | ||
11480 | // } | ||
11481 | 11727 | ||
11482 | UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; | 11728 | /*ubit from ll JIRA: |
11729 | * 0x01 position | ||
11730 | * 0x02 rotation | ||
11731 | * 0x04 scale | ||
11732 | |||
11733 | * 0x08 LINK_SET | ||
11734 | * 0x10 UNIFORM for scale | ||
11735 | */ | ||
11483 | 11736 | ||
11484 | switch (block.Type) | 11737 | // translate to internal changes |
11485 | { | 11738 | // not all cases .. just the ones older code did |
11486 | case 1: | ||
11487 | Vector3 pos1 = new Vector3(block.Data, 0); | ||
11488 | 11739 | ||
11489 | UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 11740 | switch (block.Type) |
11490 | if (handlerUpdatePrimSinglePosition != null) | 11741 | { |
11491 | { | 11742 | case 1: //change position sp |
11492 | // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 11743 | udata.position = new Vector3(block.Data, 0); |
11493 | handlerUpdatePrimSinglePosition(localId, pos1, this); | ||
11494 | } | ||
11495 | break; | ||
11496 | 11744 | ||
11497 | case 2: | 11745 | udata.change = ObjectChangeType.primP; |
11498 | Quaternion rot1 = new Quaternion(block.Data, 0, true); | 11746 | updatehandler(localId, udata, this); |
11747 | break; | ||
11499 | 11748 | ||
11500 | UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; | 11749 | case 2: // rotation sp |
11501 | if (handlerUpdatePrimSingleRotation != null) | 11750 | udata.rotation = new Quaternion(block.Data, 0, true); |
11502 | { | ||
11503 | // m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W); | ||
11504 | handlerUpdatePrimSingleRotation(localId, rot1, this); | ||
11505 | } | ||
11506 | break; | ||
11507 | 11751 | ||
11508 | case 3: | 11752 | udata.change = ObjectChangeType.primR; |
11509 | Vector3 rotPos = new Vector3(block.Data, 0); | 11753 | updatehandler(localId, udata, this); |
11510 | Quaternion rot2 = new Quaternion(block.Data, 12, true); | 11754 | break; |
11511 | 11755 | ||
11512 | UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition; | 11756 | case 3: // position plus rotation |
11513 | if (handlerUpdatePrimSingleRotationPosition != null) | 11757 | udata.position = new Vector3(block.Data, 0); |
11514 | { | 11758 | udata.rotation = new Quaternion(block.Data, 12, true); |
11515 | // m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z); | ||
11516 | // m_log.Info("new mouse rotation is " + rot2.X + " , " + rot2.Y + " , " + rot2.Z + " , " + rot2.W); | ||
11517 | handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this); | ||
11518 | } | ||
11519 | break; | ||
11520 | 11759 | ||
11521 | case 4: | 11760 | udata.change = ObjectChangeType.primPR; |
11522 | case 20: | 11761 | updatehandler(localId, udata, this); |
11523 | Vector3 scale4 = new Vector3(block.Data, 0); | 11762 | break; |
11524 | 11763 | ||
11525 | UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale; | 11764 | case 4: // scale sp |
11526 | if (handlerUpdatePrimScale != null) | 11765 | udata.scale = new Vector3(block.Data, 0); |
11527 | { | 11766 | udata.change = ObjectChangeType.primS; |
11528 | // m_log.Debug("new scale is " + scale4.X + " , " + scale4.Y + " , " + scale4.Z); | ||
11529 | handlerUpdatePrimScale(localId, scale4, this); | ||
11530 | } | ||
11531 | break; | ||
11532 | 11767 | ||
11533 | case 5: | 11768 | updatehandler(localId, udata, this); |
11534 | Vector3 scale1 = new Vector3(block.Data, 12); | 11769 | break; |
11535 | Vector3 pos11 = new Vector3(block.Data, 0); | ||
11536 | 11770 | ||
11537 | handlerUpdatePrimScale = OnUpdatePrimScale; | 11771 | case 0x14: // uniform scale sp |
11538 | if (handlerUpdatePrimScale != null) | 11772 | udata.scale = new Vector3(block.Data, 0); |
11539 | { | ||
11540 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
11541 | handlerUpdatePrimScale(localId, scale1, this); | ||
11542 | 11773 | ||
11543 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 11774 | udata.change = ObjectChangeType.primUS; |
11544 | if (handlerUpdatePrimSinglePosition != null) | 11775 | updatehandler(localId, udata, this); |
11545 | { | 11776 | break; |
11546 | handlerUpdatePrimSinglePosition(localId, pos11, this); | ||
11547 | } | ||
11548 | } | ||
11549 | break; | ||
11550 | 11777 | ||
11551 | case 9: | 11778 | case 5: // scale and position sp |
11552 | Vector3 pos2 = new Vector3(block.Data, 0); | 11779 | udata.position = new Vector3(block.Data, 0); |
11780 | udata.scale = new Vector3(block.Data, 12); | ||
11553 | 11781 | ||
11554 | UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; | 11782 | udata.change = ObjectChangeType.primPS; |
11783 | updatehandler(localId, udata, this); | ||
11784 | break; | ||
11555 | 11785 | ||
11556 | if (handlerUpdateVector != null) | 11786 | case 0x15: //uniform scale and position |
11557 | { | 11787 | udata.position = new Vector3(block.Data, 0); |
11558 | handlerUpdateVector(localId, pos2, this); | 11788 | udata.scale = new Vector3(block.Data, 12); |
11559 | } | ||
11560 | break; | ||
11561 | 11789 | ||
11562 | case 10: | 11790 | udata.change = ObjectChangeType.primPUS; |
11563 | Quaternion rot3 = new Quaternion(block.Data, 0, true); | 11791 | updatehandler(localId, udata, this); |
11792 | break; | ||
11564 | 11793 | ||
11565 | UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; | 11794 | // now group related (bit 4) |
11566 | if (handlerUpdatePrimRotation != null) | 11795 | case 9: //( 8 + 1 )group position |
11567 | { | 11796 | udata.position = new Vector3(block.Data, 0); |
11568 | // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W); | ||
11569 | handlerUpdatePrimRotation(localId, rot3, this); | ||
11570 | } | ||
11571 | break; | ||
11572 | 11797 | ||
11573 | case 11: | 11798 | udata.change = ObjectChangeType.groupP; |
11574 | Vector3 pos3 = new Vector3(block.Data, 0); | 11799 | updatehandler(localId, udata, this); |
11575 | Quaternion rot4 = new Quaternion(block.Data, 12, true); | 11800 | break; |
11576 | 11801 | ||
11577 | handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; | 11802 | case 0x0A: // (8 + 2) group rotation |
11578 | if (handlerUpdatePrimGroupRotation != null) | 11803 | udata.rotation = new Quaternion(block.Data, 0, true); |
11579 | { | ||
11580 | // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | ||
11581 | // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W); | ||
11582 | handlerUpdatePrimGroupRotation(localId, pos3, rot4, this); | ||
11583 | } | ||
11584 | break; | ||
11585 | case 12: | ||
11586 | case 28: | ||
11587 | Vector3 scale7 = new Vector3(block.Data, 0); | ||
11588 | 11804 | ||
11589 | UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; | 11805 | udata.change = ObjectChangeType.groupR; |
11590 | if (handlerUpdatePrimGroupScale != null) | 11806 | updatehandler(localId, udata, this); |
11591 | { | 11807 | break; |
11592 | // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z); | ||
11593 | handlerUpdatePrimGroupScale(localId, scale7, this); | ||
11594 | } | ||
11595 | break; | ||
11596 | 11808 | ||
11597 | case 13: | 11809 | case 0x0B: //( 8 + 2 + 1) group rotation and position |
11598 | Vector3 scale2 = new Vector3(block.Data, 12); | 11810 | udata.position = new Vector3(block.Data, 0); |
11599 | Vector3 pos4 = new Vector3(block.Data, 0); | 11811 | udata.rotation = new Quaternion(block.Data, 12, true); |
11600 | 11812 | ||
11601 | handlerUpdatePrimScale = OnUpdatePrimScale; | 11813 | udata.change = ObjectChangeType.groupPR; |
11602 | if (handlerUpdatePrimScale != null) | 11814 | updatehandler(localId, udata, this); |
11603 | { | 11815 | break; |
11604 | //m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
11605 | handlerUpdatePrimScale(localId, scale2, this); | ||
11606 | 11816 | ||
11607 | // Change the position based on scale (for bug number 246) | 11817 | case 0x0C: // (8 + 4) group scale |
11608 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 11818 | // only afects root prim and only sent by viewer editor object tab scaling |
11609 | // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); | 11819 | // mouse edition only allows uniform scaling |
11610 | if (handlerUpdatePrimSinglePosition != null) | 11820 | // SL MAY CHANGE THIS in viewers |
11611 | { | ||
11612 | handlerUpdatePrimSinglePosition(localId, pos4, this); | ||
11613 | } | ||
11614 | } | ||
11615 | break; | ||
11616 | 11821 | ||
11617 | case 29: | 11822 | udata.scale = new Vector3(block.Data, 0); |
11618 | Vector3 scale5 = new Vector3(block.Data, 12); | ||
11619 | Vector3 pos5 = new Vector3(block.Data, 0); | ||
11620 | 11823 | ||
11621 | handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; | 11824 | udata.change = ObjectChangeType.groupS; |
11622 | if (handlerUpdatePrimGroupScale != null) | 11825 | updatehandler(localId, udata, this); |
11623 | { | ||
11624 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | ||
11625 | part.StoreUndoState(true); | ||
11626 | part.IgnoreUndoUpdate = true; | ||
11627 | handlerUpdatePrimGroupScale(localId, scale5, this); | ||
11628 | handlerUpdateVector = OnUpdatePrimGroupPosition; | ||
11629 | 11826 | ||
11630 | if (handlerUpdateVector != null) | 11827 | break; |
11631 | { | ||
11632 | handlerUpdateVector(localId, pos5, this); | ||
11633 | } | ||
11634 | 11828 | ||
11635 | part.IgnoreUndoUpdate = false; | 11829 | case 0x0D: //(8 + 4 + 1) group scale and position |
11636 | } | 11830 | // exception as above |
11637 | 11831 | ||
11638 | break; | 11832 | udata.position = new Vector3(block.Data, 0); |
11833 | udata.scale = new Vector3(block.Data, 12); | ||
11639 | 11834 | ||
11640 | case 21: | 11835 | udata.change = ObjectChangeType.groupPS; |
11641 | Vector3 scale6 = new Vector3(block.Data, 12); | 11836 | updatehandler(localId, udata, this); |
11642 | Vector3 pos6 = new Vector3(block.Data, 0); | 11837 | break; |
11643 | 11838 | ||
11644 | handlerUpdatePrimScale = OnUpdatePrimScale; | 11839 | case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM |
11645 | if (handlerUpdatePrimScale != null) | 11840 | udata.scale = new Vector3(block.Data, 0); |
11646 | { | ||
11647 | part.StoreUndoState(false); | ||
11648 | part.IgnoreUndoUpdate = true; | ||
11649 | 11841 | ||
11650 | // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); | 11842 | udata.change = ObjectChangeType.groupUS; |
11651 | handlerUpdatePrimScale(localId, scale6, this); | 11843 | updatehandler(localId, udata, this); |
11652 | handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; | 11844 | break; |
11653 | if (handlerUpdatePrimSinglePosition != null) | ||
11654 | { | ||
11655 | handlerUpdatePrimSinglePosition(localId, pos6, this); | ||
11656 | } | ||
11657 | 11845 | ||
11658 | part.IgnoreUndoUpdate = false; | 11846 | case 0x1D: // (UNIFORM + GROUP + SCALE + POS) |
11659 | } | 11847 | udata.position = new Vector3(block.Data, 0); |
11660 | break; | 11848 | udata.scale = new Vector3(block.Data, 12); |
11661 | 11849 | ||
11662 | default: | 11850 | udata.change = ObjectChangeType.groupPUS; |
11663 | m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); | 11851 | updatehandler(localId, udata, this); |
11664 | break; | 11852 | break; |
11853 | |||
11854 | default: | ||
11855 | m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); | ||
11856 | break; | ||
11857 | } | ||
11665 | } | 11858 | } |
11666 | 11859 | ||
11667 | // for (int j = 0; j < parts.Length; j++) | ||
11668 | // parts[j].IgnoreUndoUpdate = false; | ||
11669 | } | 11860 | } |
11670 | } | 11861 | } |
11671 | } | 11862 | } |
11672 | |||
11673 | return true; | 11863 | return true; |
11674 | } | 11864 | } |
11675 | 11865 | ||
@@ -12117,7 +12307,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12117 | // "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", | 12307 | // "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", |
12118 | // requestID, taskID, (SourceType)sourceType, Name); | 12308 | // requestID, taskID, (SourceType)sourceType, Name); |
12119 | 12309 | ||
12310 | |||
12311 | //Note, the bool returned from the below function is useless since it is always false. | ||
12120 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); | 12312 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); |
12313 | |||
12121 | } | 12314 | } |
12122 | 12315 | ||
12123 | /// <summary> | 12316 | /// <summary> |
@@ -12183,7 +12376,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12183 | /// <returns></returns> | 12376 | /// <returns></returns> |
12184 | private static int CalculateNumPackets(byte[] data) | 12377 | private static int CalculateNumPackets(byte[] data) |
12185 | { | 12378 | { |
12186 | const uint m_maxPacketSize = 600; | 12379 | // const uint m_maxPacketSize = 600; |
12380 | uint m_maxPacketSize = MaxTransferBytesPerPacket; | ||
12187 | int numPackets = 1; | 12381 | int numPackets = 1; |
12188 | 12382 | ||
12189 | if (data == null) | 12383 | if (data == null) |