aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs1694
1 files changed, 1052 insertions, 642 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index e7dd9d3..806269f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -100,6 +100,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
100 public event AvatarPickerRequest OnAvatarPickerRequest; 100 public event AvatarPickerRequest OnAvatarPickerRequest;
101 public event StartAnim OnStartAnim; 101 public event StartAnim OnStartAnim;
102 public event StopAnim OnStopAnim; 102 public event StopAnim OnStopAnim;
103 public event ChangeAnim OnChangeAnim;
103 public event Action<IClientAPI> OnRequestAvatarsData; 104 public event Action<IClientAPI> OnRequestAvatarsData;
104 public event LinkObjects OnLinkObjects; 105 public event LinkObjects OnLinkObjects;
105 public event DelinkObjects OnDelinkObjects; 106 public event DelinkObjects OnDelinkObjects;
@@ -127,6 +128,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
127 public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; 128 public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
128 public event UpdatePrimFlags OnUpdatePrimFlags; 129 public event UpdatePrimFlags OnUpdatePrimFlags;
129 public event UpdatePrimTexture OnUpdatePrimTexture; 130 public event UpdatePrimTexture OnUpdatePrimTexture;
131 public event ClientChangeObject onClientChangeObject;
130 public event UpdateVector OnUpdatePrimGroupPosition; 132 public event UpdateVector OnUpdatePrimGroupPosition;
131 public event UpdateVector OnUpdatePrimSinglePosition; 133 public event UpdateVector OnUpdatePrimSinglePosition;
132 public event UpdatePrimRotation OnUpdatePrimGroupRotation; 134 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
@@ -156,6 +158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
156 public event RequestTaskInventory OnRequestTaskInventory; 158 public event RequestTaskInventory OnRequestTaskInventory;
157 public event UpdateInventoryItem OnUpdateInventoryItem; 159 public event UpdateInventoryItem OnUpdateInventoryItem;
158 public event CopyInventoryItem OnCopyInventoryItem; 160 public event CopyInventoryItem OnCopyInventoryItem;
161 public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy;
159 public event MoveInventoryItem OnMoveInventoryItem; 162 public event MoveInventoryItem OnMoveInventoryItem;
160 public event RemoveInventoryItem OnRemoveInventoryItem; 163 public event RemoveInventoryItem OnRemoveInventoryItem;
161 public event RemoveInventoryFolder OnRemoveInventoryFolder; 164 public event RemoveInventoryFolder OnRemoveInventoryFolder;
@@ -250,7 +253,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
250 public event ClassifiedInfoRequest OnClassifiedInfoRequest; 253 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
251 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; 254 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
252 public event ClassifiedDelete OnClassifiedDelete; 255 public event ClassifiedDelete OnClassifiedDelete;
253 public event ClassifiedDelete OnClassifiedGodDelete; 256 public event ClassifiedGodDelete OnClassifiedGodDelete;
254 public event EventNotificationAddRequest OnEventNotificationAddRequest; 257 public event EventNotificationAddRequest OnEventNotificationAddRequest;
255 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; 258 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
256 public event EventGodDelete OnEventGodDelete; 259 public event EventGodDelete OnEventGodDelete;
@@ -281,10 +284,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
281 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 284 public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
282 public event SimWideDeletesDelegate OnSimWideDeletes; 285 public event SimWideDeletesDelegate OnSimWideDeletes;
283 public event SendPostcard OnSendPostcard; 286 public event SendPostcard OnSendPostcard;
287 public event ChangeInventoryItemFlags OnChangeInventoryItemFlags;
284 public event MuteListEntryUpdate OnUpdateMuteListEntry; 288 public event MuteListEntryUpdate OnUpdateMuteListEntry;
285 public event MuteListEntryRemove OnRemoveMuteListEntry; 289 public event MuteListEntryRemove OnRemoveMuteListEntry;
286 public event GodlikeMessage onGodlikeMessage; 290 public event GodlikeMessage onGodlikeMessage;
287 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; 291 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
292 public event GenericCall2 OnUpdateThrottles;
288 293
289#pragma warning disable 0067 294#pragma warning disable 0067
290 public event GenericMessage OnGenericMessage; 295 public event GenericMessage OnGenericMessage;
@@ -333,7 +338,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
333 private PriorityQueue m_entityProps; 338 private PriorityQueue m_entityProps;
334 private Prioritizer m_prioritizer; 339 private Prioritizer m_prioritizer;
335 private bool m_disableFacelights = false; 340 private bool m_disableFacelights = false;
336 private volatile bool m_justEditedTerrain = false; 341
342 private bool m_VelocityInterpolate = false;
343 private const uint MaxTransferBytesPerPacket = 600;
344
337 /// <value> 345 /// <value>
338 /// List used in construction of data blocks for an object update packet. This is to stop us having to 346 /// List used in construction of data blocks for an object update packet. This is to stop us having to
339 /// continually recreate it. 347 /// continually recreate it.
@@ -345,14 +353,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
345 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an 353 /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an
346 /// ownerless phantom. 354 /// ownerless phantom.
347 /// 355 ///
348 /// All manipulation of this set has to occur under a lock 356 /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
349 /// 357 ///
350 /// </value> 358 /// </value>
351 protected HashSet<uint> m_killRecord; 359// protected HashSet<uint> m_killRecord;
352 360
353// protected HashSet<uint> m_attachmentsSent; 361// protected HashSet<uint> m_attachmentsSent;
354 362
355 private int m_animationSequenceNumber = 1; 363 private bool m_deliverPackets = true;
364
356 private bool m_SendLogoutPacketWhenClosing = true; 365 private bool m_SendLogoutPacketWhenClosing = true;
357 366
358 /// <summary> 367 /// <summary>
@@ -398,6 +407,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
398 get { return m_startpos; } 407 get { return m_startpos; }
399 set { m_startpos = value; } 408 set { m_startpos = value; }
400 } 409 }
410 public bool DeliverPackets
411 {
412 get { return m_deliverPackets; }
413 set {
414 m_deliverPackets = value;
415 m_udpClient.m_deliverPackets = value;
416 }
417 }
401 public UUID AgentId { get { return m_agentId; } } 418 public UUID AgentId { get { return m_agentId; } }
402 public ISceneAgent SceneAgent { get; set; } 419 public ISceneAgent SceneAgent { get; set; }
403 public UUID ActiveGroupId { get { return m_activeGroupID; } private set { m_activeGroupID = value; } } 420 public UUID ActiveGroupId { get { return m_activeGroupID; } private set { m_activeGroupID = value; } }
@@ -405,6 +422,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
405 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } private set { m_activeGroupPowers = value; } } 422 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } private set { m_activeGroupPowers = value; } }
406 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } 423 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
407 424
425 public int PingTimeMS
426 {
427 get
428 {
429 if (UDPClient != null)
430 return UDPClient.PingTimeMS;
431 return 0;
432 }
433 }
434
408 /// <summary> 435 /// <summary>
409 /// Entity update queues 436 /// Entity update queues
410 /// </summary> 437 /// </summary>
@@ -426,7 +453,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
426 public string Name { get { return FirstName + " " + LastName; } } 453 public string Name { get { return FirstName + " " + LastName; } }
427 454
428 public uint CircuitCode { get { return m_circuitCode; } } 455 public uint CircuitCode { get { return m_circuitCode; } }
429 public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } 456 public int NextAnimationSequenceNumber
457 {
458 get { return m_udpServer.NextAnimationSequenceNumber; }
459 }
430 460
431 /// <summary> 461 /// <summary>
432 /// As well as it's function in IClientAPI, in LLClientView we are locking on this property in order to 462 /// As well as it's function in IClientAPI, in LLClientView we are locking on this property in order to
@@ -447,7 +477,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
447 set { m_disableFacelights = value; } 477 set { m_disableFacelights = value; }
448 } 478 }
449 479
480 public List<uint> SelectedObjects {get; private set;}
481
450 public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } 482 public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } }
483
451 484
452 #endregion Properties 485 #endregion Properties
453 486
@@ -465,6 +498,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
465// DebugPacketLevel = 1; 498// DebugPacketLevel = 1;
466 499
467 CloseSyncLock = new Object(); 500 CloseSyncLock = new Object();
501 SelectedObjects = new List<uint>();
468 502
469 RegisterInterface<IClientIM>(this); 503 RegisterInterface<IClientIM>(this);
470 RegisterInterface<IClientInventory>(this); 504 RegisterInterface<IClientInventory>(this);
@@ -474,7 +508,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
474 m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); 508 m_entityUpdates = new PriorityQueue(m_scene.Entities.Count);
475 m_entityProps = new PriorityQueue(m_scene.Entities.Count); 509 m_entityProps = new PriorityQueue(m_scene.Entities.Count);
476 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); 510 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
477 m_killRecord = new HashSet<uint>(); 511// m_killRecord = new HashSet<uint>();
478// m_attachmentsSent = new HashSet<uint>(); 512// m_attachmentsSent = new HashSet<uint>();
479 513
480 m_assetService = m_scene.RequestModuleInterface<IAssetService>(); 514 m_assetService = m_scene.RequestModuleInterface<IAssetService>();
@@ -504,12 +538,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
504 538
505 #region Client Methods 539 #region Client Methods
506 540
541
542 /// <summary>
543 /// Close down the client view
544 /// </summary>
507 public void Close() 545 public void Close()
508 { 546 {
509 Close(false); 547 Close(true, false);
510 } 548 }
511 549
512 public void Close(bool force) 550 public void Close(bool sendStop, bool force)
513 { 551 {
514 // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. 552 // We lock here to prevent race conditions between two threads calling close simultaneously (e.g.
515 // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. 553 // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection.
@@ -526,7 +564,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
526 } 564 }
527 565
528 IsActive = false; 566 IsActive = false;
529 CloseWithoutChecks(); 567 CloseWithoutChecks(sendStop);
530 } 568 }
531 } 569 }
532 570
@@ -539,12 +577,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
539 /// 577 ///
540 /// Callers must lock ClosingSyncLock before calling. 578 /// Callers must lock ClosingSyncLock before calling.
541 /// </remarks> 579 /// </remarks>
542 public void CloseWithoutChecks() 580 public void CloseWithoutChecks(bool sendStop)
543 { 581 {
544 m_log.DebugFormat( 582 m_log.DebugFormat(
545 "[CLIENT]: Close has been called for {0} attached to scene {1}", 583 "[CLIENT]: Close has been called for {0} attached to scene {1}",
546 Name, m_scene.RegionInfo.RegionName); 584 Name, m_scene.RegionInfo.RegionName);
547 585
586 if (sendStop)
587 {
588 // Send the STOP packet
589 DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
590 OutPacket(disable, ThrottleOutPacketType.Unknown);
591 }
592
548 // Shutdown the image manager 593 // Shutdown the image manager
549 ImageManager.Close(); 594 ImageManager.Close();
550 595
@@ -566,7 +611,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
566 611
567 // Disable UDP handling for this client 612 // Disable UDP handling for this client
568 m_udpClient.Shutdown(); 613 m_udpClient.Shutdown();
569 614
615
570 //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); 616 //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false));
571 //GC.Collect(); 617 //GC.Collect();
572 //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); 618 //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true));
@@ -677,7 +723,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
677 if (!m_packetHandlers.ContainsKey(packetType)) 723 if (!m_packetHandlers.ContainsKey(packetType))
678 { 724 {
679 m_packetHandlers.Add( 725 m_packetHandlers.Add(
726<<<<<<< HEAD
680 packetType, new PacketProcessor() { method = handler, Async = doAsync, InEngine = inEngine }); 727 packetType, new PacketProcessor() { method = handler, Async = doAsync, InEngine = inEngine });
728=======
729 packetType, new PacketProcessor() { method = handler, Async = doAsync });
730>>>>>>> avn/ubitvar
681 result = true; 731 result = true;
682 } 732 }
683 } 733 }
@@ -858,6 +908,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
858 908
859 public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) 909 public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
860 { 910 {
911 m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue;
912 m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue;
913
861 AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); 914 AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete);
862 mov.SimData.ChannelVersion = m_channelVersion; 915 mov.SimData.ChannelVersion = m_channelVersion;
863 mov.AgentData.SessionID = m_sessionId; 916 mov.AgentData.SessionID = m_sessionId;
@@ -893,7 +946,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
893 reply.ChatData.OwnerID = ownerID; 946 reply.ChatData.OwnerID = ownerID;
894 reply.ChatData.SourceID = fromAgentID; 947 reply.ChatData.SourceID = fromAgentID;
895 948
896 OutPacket(reply, ThrottleOutPacketType.Task); 949 OutPacket(reply, ThrottleOutPacketType.Unknown);
897 } 950 }
898 951
899 /// <summary> 952 /// <summary>
@@ -926,32 +979,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
926 msg.MessageBlock.Message = Util.StringToBytes1024(im.message); 979 msg.MessageBlock.Message = Util.StringToBytes1024(im.message);
927 msg.MessageBlock.BinaryBucket = im.binaryBucket; 980 msg.MessageBlock.BinaryBucket = im.binaryBucket;
928 981
929 if (im.message.StartsWith("[grouptest]")) 982 OutPacket(msg, ThrottleOutPacketType.Task);
930 { // this block is test code for implementing group IM - delete when group IM is finished
931 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
932 if (eq != null)
933 {
934 im.dialog = 17;
935
936 //eq.ChatterboxInvitation(
937 // new UUID("00000000-68f9-1111-024e-222222111123"),
938 // "OpenSimulator Testing", im.fromAgentID, im.message, im.toAgentID, im.fromAgentName, im.dialog, 0,
939 // false, 0, new Vector3(), 1, im.imSessionID, im.fromGroup, im.binaryBucket);
940
941 eq.ChatterboxInvitation(
942 new UUID("00000000-68f9-1111-024e-222222111123"),
943 "OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0,
944 false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Util.StringToBytes256("OpenSimulator Testing"));
945
946 eq.ChatterBoxSessionAgentListUpdates(
947 new UUID("00000000-68f9-1111-024e-222222111123"),
948 new UUID(im.fromAgentID), new UUID(im.toAgentID), false, false, false);
949 }
950
951 Console.WriteLine("SendInstantMessage: " + msg);
952 }
953 else
954 OutPacket(msg, ThrottleOutPacketType.Task);
955 } 983 }
956 } 984 }
957 985
@@ -1182,6 +1210,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1182 OutPacket(GATRP, ThrottleOutPacketType.Task); 1210 OutPacket(GATRP, ThrottleOutPacketType.Task);
1183 } 1211 }
1184 1212
1213
1214 public virtual bool CanSendLayerData()
1215 {
1216 int n = m_udpClient.GetCatBytesInSendQueue(ThrottleOutPacketType.Land);
1217 if ( n > 100000)
1218 return false;
1219 return true;
1220 }
1221
1185 /// <summary> 1222 /// <summary>
1186 /// Send the region heightmap to the client 1223 /// Send the region heightmap to the client
1187 /// This method is only called when not doing intellegent terrain patch sending and 1224 /// This method is only called when not doing intellegent terrain patch sending and
@@ -1191,7 +1228,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1191 /// <param name="map">heightmap</param> 1228 /// <param name="map">heightmap</param>
1192 public virtual void SendLayerData(float[] map) 1229 public virtual void SendLayerData(float[] map)
1193 { 1230 {
1231<<<<<<< HEAD
1194 Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData(), "LLClientView.DoSendLayerData"); 1232 Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData(), "LLClientView.DoSendLayerData");
1233=======
1234 Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData());
1235
1236 // Send it sync, and async. It's not that much data
1237 // and it improves user experience just so much!
1238// DoSendLayerData(map);
1239>>>>>>> avn/ubitvar
1195 } 1240 }
1196 1241
1197 /// <summary> 1242 /// <summary>
@@ -1205,6 +1250,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1205 try 1250 try
1206 { 1251 {
1207 // Send LayerData in typerwriter pattern 1252 // Send LayerData in typerwriter pattern
1253<<<<<<< HEAD
1208 //for (int y = 0; y < 16; y++) 1254 //for (int y = 0; y < 16; y++)
1209 //{ 1255 //{
1210 // for (int x = 0; x < 16; x++) 1256 // for (int x = 0; x < 16; x++)
@@ -1215,6 +1261,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1215 1261
1216 // Send LayerData in a spiral pattern. Fun! 1262 // Send LayerData in a spiral pattern. Fun!
1217 SendLayerTopRight(map, 0, 0, map.SizeX/Constants.TerrainPatchSize-1, map.SizeY/Constants.TerrainPatchSize-1); 1263 SendLayerTopRight(map, 0, 0, map.SizeX/Constants.TerrainPatchSize-1, map.SizeY/Constants.TerrainPatchSize-1);
1264=======
1265 for (int y = 0; y < 16; y++)
1266 {
1267 for (int x = 0; x < 16; x++)
1268 {
1269 SendLayerData(x, y, map);
1270 }
1271 }
1272>>>>>>> avn/ubitvar
1218 } 1273 }
1219 catch (Exception e) 1274 catch (Exception e)
1220 { 1275 {
@@ -1222,16 +1277,38 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1222 } 1277 }
1223 } 1278 }
1224 1279
1280<<<<<<< HEAD
1225 private void SendLayerTopRight(TerrainData map, int x1, int y1, int x2, int y2) 1281 private void SendLayerTopRight(TerrainData map, int x1, int y1, int x2, int y2)
1282=======
1283 // Legacy form of invocation that passes around a bare data array.
1284 // Just ignore what was passed and use the real terrain info that is part of the scene.
1285 // As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI,
1286 // there is a special form for specifying multiple terrain patches to send.
1287 // The form is to pass 'px' as negative the number of patches to send and to
1288 // pass the float array as pairs of patch X and Y coordinates. So, passing 'px'
1289 // as -2 and map= [3, 5, 8, 4] would mean to send two terrain heightmap patches
1290 // and the patches to send are <3,5> and <8,4>.
1291 public void SendLayerData(int px, int py, float[] map)
1292>>>>>>> avn/ubitvar
1226 { 1293 {
1227 // Row 1294 if (px >= 0)
1228 for (int i = x1; i <= x2; i++) 1295 {
1229 SendLayerData(i, y1, map); 1296 SendLayerData(px, py, m_scene.Heightmap.GetTerrainData());
1297 }
1298 else
1299 {
1300 int numPatches = -px;
1301 int[] xPatches = new int[numPatches];
1302 int[] yPatches = new int[numPatches];
1303 for (int pp = 0; pp < numPatches; pp++)
1304 {
1305 xPatches[pp] = (int)map[pp * 2];
1306 yPatches[pp] = (int)map[pp * 2 + 1];
1307 }
1230 1308
1231 // Column 1309 // DebugSendingPatches("SendLayerData", xPatches, yPatches);
1232 for (int j = y1 + 1; j <= y2; j++)
1233 SendLayerData(x2, j, map);
1234 1310
1311<<<<<<< HEAD
1235 if (x2 - x1 > 0 && y2 - y1 > 0) 1312 if (x2 - x1 > 0 && y2 - y1 > 0)
1236 SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); 1313 SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
1237 } 1314 }
@@ -1316,6 +1393,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1316 } 1393 }
1317 1394
1318 /// <summary> 1395 /// <summary>
1396=======
1397 SendLayerData(xPatches, yPatches, m_scene.Heightmap.GetTerrainData());
1398 }
1399 }
1400
1401 private void DebugSendingPatches(string pWho, int[] pX, int[] pY)
1402 {
1403 if (m_log.IsDebugEnabled)
1404 {
1405 int numPatches = pX.Length;
1406 string Xs = "";
1407 string Ys = "";
1408 for (int pp = 0; pp < numPatches; pp++)
1409 {
1410 Xs += String.Format("{0}", (int)pX[pp]) + ",";
1411 Ys += String.Format("{0}", (int)pY[pp]) + ",";
1412 }
1413 m_log.DebugFormat("{0} {1}: numPatches={2}, X={3}, Y={4}", LogHeader, pWho, numPatches, Xs, Ys);
1414 }
1415 }
1416
1417 /// <summary>
1418>>>>>>> avn/ubitvar
1319 /// Sends a terrain packet for the point specified. 1419 /// Sends a terrain packet for the point specified.
1320 /// This is a legacy call that has refarbed the terrain into a flat map of floats. 1420 /// This is a legacy call that has refarbed the terrain into a flat map of floats.
1321 /// We just use the terrain from the region we know about. 1421 /// We just use the terrain from the region we know about.
@@ -1367,6 +1467,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1367 } 1467 }
1368 } 1468 }
1369 1469
1470<<<<<<< HEAD
1370 // When a user edits the terrain, so much data is sent, the data queues up fast and presents a 1471 // When a user edits the terrain, so much data is sent, the data queues up fast and presents a
1371 // sub optimal editing experience. To alleviate this issue, when the user edits the terrain, we 1472 // sub optimal editing experience. To alleviate this issue, when the user edits the terrain, we
1372 // start skipping the queues until they're done editing the terrain. We also make them 1473 // start skipping the queues until they're done editing the terrain. We also make them
@@ -1395,6 +1496,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1395 layerpack.Header.Reliable = true; 1496 layerpack.Header.Reliable = true;
1396 OutPacket(layerpack, ThrottleOutPacketType.Land); 1497 OutPacket(layerpack, ThrottleOutPacketType.Land);
1397 } 1498 }
1499=======
1500 private void SendTheLayerPacket(LayerDataPacket layerpack)
1501 {
1502 OutPacket(layerpack, ThrottleOutPacketType.Land);
1503>>>>>>> avn/ubitvar
1398 } 1504 }
1399 1505
1400 /// <summary> 1506 /// <summary>
@@ -1735,11 +1841,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1735 pc.PingID.OldestUnacked = 0; 1841 pc.PingID.OldestUnacked = 0;
1736 1842
1737 OutPacket(pc, ThrottleOutPacketType.Unknown); 1843 OutPacket(pc, ThrottleOutPacketType.Unknown);
1844 UDPClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount();
1738 } 1845 }
1739 1846
1740 public void SendKillObject(List<uint> localIDs) 1847 public void SendKillObject(List<uint> localIDs)
1741 { 1848 {
1742// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); 1849 // think we do need this
1850 // foreach (uint id in localIDs)
1851 // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle);
1852
1853 // remove pending entities
1854 lock (m_entityProps.SyncRoot)
1855 m_entityProps.Remove(localIDs);
1856 lock (m_entityUpdates.SyncRoot)
1857 m_entityUpdates.Remove(localIDs);
1743 1858
1744 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); 1859 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject);
1745 // TODO: don't create new blocks if recycling an old packet 1860 // TODO: don't create new blocks if recycling an old packet
@@ -1752,28 +1867,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1752 kill.Header.Reliable = true; 1867 kill.Header.Reliable = true;
1753 kill.Header.Zerocoded = true; 1868 kill.Header.Zerocoded = true;
1754 1869
1755 if (localIDs.Count == 1 && m_scene.GetScenePresence(localIDs[0]) != null) 1870 OutPacket(kill, ThrottleOutPacketType.Task);
1756 { 1871 }
1757 OutPacket(kill, ThrottleOutPacketType.Task);
1758 }
1759 else
1760 {
1761 // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race
1762 // condition where a kill can be processed before an out-of-date update for the same object.
1763 // ProcessEntityUpdates() also takes the m_killRecord lock.
1764 lock (m_killRecord)
1765 {
1766 foreach (uint localID in localIDs)
1767 m_killRecord.Add(localID);
1768
1769 // The throttle queue used here must match that being used for updates. Otherwise, there is a
1770 // chance that a kill packet put on a separate queue will be sent to the client before an existing
1771 // update packet on another queue. Receiving updates after kills results in unowned and undeletable
1772 // scene objects in a viewer until that viewer is relogged in.
1773 OutPacket(kill, ThrottleOutPacketType.Task);
1774 }
1775 }
1776 }
1777 1872
1778 /// <summary> 1873 /// <summary>
1779 /// Send information about the items contained in a folder to the client. 1874 /// Send information about the items contained in a folder to the client.
@@ -1895,7 +1990,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1895 newBlock.CreationDate = item.CreationDate; 1990 newBlock.CreationDate = item.CreationDate;
1896 newBlock.SalePrice = item.SalePrice; 1991 newBlock.SalePrice = item.SalePrice;
1897 newBlock.SaleType = item.SaleType; 1992 newBlock.SaleType = item.SaleType;
1898 newBlock.Flags = item.Flags; 1993 newBlock.Flags = item.Flags & 0x2000ff;
1899 1994
1900 newBlock.CRC = 1995 newBlock.CRC =
1901 Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType, 1996 Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType,
@@ -2151,7 +2246,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2151 itemBlock.GroupID = item.GroupID; 2246 itemBlock.GroupID = item.GroupID;
2152 itemBlock.GroupOwned = item.GroupOwned; 2247 itemBlock.GroupOwned = item.GroupOwned;
2153 itemBlock.GroupMask = item.GroupPermissions; 2248 itemBlock.GroupMask = item.GroupPermissions;
2154 itemBlock.Flags = item.Flags; 2249 itemBlock.Flags = item.Flags & 0x2000ff;
2155 itemBlock.SalePrice = item.SalePrice; 2250 itemBlock.SalePrice = item.SalePrice;
2156 itemBlock.SaleType = item.SaleType; 2251 itemBlock.SaleType = item.SaleType;
2157 itemBlock.CreationDate = item.CreationDate; 2252 itemBlock.CreationDate = item.CreationDate;
@@ -2218,7 +2313,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2218 bulkUpdate.ItemData[0].GroupID = item.GroupID; 2313 bulkUpdate.ItemData[0].GroupID = item.GroupID;
2219 bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned; 2314 bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned;
2220 bulkUpdate.ItemData[0].GroupMask = item.GroupPermissions; 2315 bulkUpdate.ItemData[0].GroupMask = item.GroupPermissions;
2221 bulkUpdate.ItemData[0].Flags = item.Flags; 2316 bulkUpdate.ItemData[0].Flags = item.Flags & 0x2000ff;
2222 bulkUpdate.ItemData[0].SalePrice = item.SalePrice; 2317 bulkUpdate.ItemData[0].SalePrice = item.SalePrice;
2223 bulkUpdate.ItemData[0].SaleType = item.SaleType; 2318 bulkUpdate.ItemData[0].SaleType = item.SaleType;
2224 2319
@@ -2234,9 +2329,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2234 OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); 2329 OutPacket(bulkUpdate, ThrottleOutPacketType.Asset);
2235 } 2330 }
2236 2331
2237 /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see>
2238 public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) 2332 public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId)
2239 { 2333 {
2334 SendInventoryItemCreateUpdate(Item, UUID.Zero, callbackId);
2335 }
2336
2337 /// <see>IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase)</see>
2338 public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId)
2339 {
2240 const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff; 2340 const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff;
2241 2341
2242 UpdateCreateInventoryItemPacket InventoryReply 2342 UpdateCreateInventoryItemPacket InventoryReply
@@ -2246,6 +2346,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2246 // TODO: don't create new blocks if recycling an old packet 2346 // TODO: don't create new blocks if recycling an old packet
2247 InventoryReply.AgentData.AgentID = AgentId; 2347 InventoryReply.AgentData.AgentID = AgentId;
2248 InventoryReply.AgentData.SimApproved = true; 2348 InventoryReply.AgentData.SimApproved = true;
2349 InventoryReply.AgentData.TransactionID = transactionID;
2249 InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; 2350 InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1];
2250 InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); 2351 InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock();
2251 InventoryReply.InventoryData[0].ItemID = Item.ID; 2352 InventoryReply.InventoryData[0].ItemID = Item.ID;
@@ -2266,7 +2367,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2266 InventoryReply.InventoryData[0].GroupID = Item.GroupID; 2367 InventoryReply.InventoryData[0].GroupID = Item.GroupID;
2267 InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned; 2368 InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned;
2268 InventoryReply.InventoryData[0].GroupMask = Item.GroupPermissions; 2369 InventoryReply.InventoryData[0].GroupMask = Item.GroupPermissions;
2269 InventoryReply.InventoryData[0].Flags = Item.Flags; 2370 InventoryReply.InventoryData[0].Flags = Item.Flags & 0x2000ff;
2270 InventoryReply.InventoryData[0].SalePrice = Item.SalePrice; 2371 InventoryReply.InventoryData[0].SalePrice = Item.SalePrice;
2271 InventoryReply.InventoryData[0].SaleType = Item.SaleType; 2372 InventoryReply.InventoryData[0].SaleType = Item.SaleType;
2272 InventoryReply.InventoryData[0].CreationDate = Item.CreationDate; 2373 InventoryReply.InventoryData[0].CreationDate = Item.CreationDate;
@@ -2315,16 +2416,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2315 replytask.InventoryData.TaskID = taskID; 2416 replytask.InventoryData.TaskID = taskID;
2316 replytask.InventoryData.Serial = serial; 2417 replytask.InventoryData.Serial = serial;
2317 replytask.InventoryData.Filename = fileName; 2418 replytask.InventoryData.Filename = fileName;
2318 OutPacket(replytask, ThrottleOutPacketType.Asset); 2419 OutPacket(replytask, ThrottleOutPacketType.Task);
2319 } 2420 }
2320 2421
2321 public void SendXferPacket(ulong xferID, uint packet, byte[] data) 2422 public void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory)
2322 { 2423 {
2424 ThrottleOutPacketType type = ThrottleOutPacketType.Asset;
2425 if (isTaskInventory)
2426 type = ThrottleOutPacketType.Task;
2427
2323 SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); 2428 SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket);
2324 sendXfer.XferID.ID = xferID; 2429 sendXfer.XferID.ID = xferID;
2325 sendXfer.XferID.Packet = packet; 2430 sendXfer.XferID.Packet = packet;
2326 sendXfer.DataPacket.Data = data; 2431 sendXfer.DataPacket.Data = data;
2327 OutPacket(sendXfer, ThrottleOutPacketType.Asset); 2432 OutPacket(sendXfer, type);
2328 } 2433 }
2329 2434
2330 public void SendAbortXferPacket(ulong xferID) 2435 public void SendAbortXferPacket(ulong xferID)
@@ -2385,9 +2490,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2385 { 2490 {
2386 if (agentid == AgentId) 2491 if (agentid == AgentId)
2387 { 2492 {
2493<<<<<<< HEAD
2388 ActiveGroupId = activegroupid; 2494 ActiveGroupId = activegroupid;
2389 ActiveGroupName = groupname; 2495 ActiveGroupName = groupname;
2390 ActiveGroupPowers = grouppowers; 2496 ActiveGroupPowers = grouppowers;
2497=======
2498 m_activeGroupID = activegroupid;
2499 m_activeGroupName = groupname;
2500 m_activeGroupPowers = grouppowers;
2501>>>>>>> avn/ubitvar
2391 } 2502 }
2392 2503
2393 AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate); 2504 AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate);
@@ -2514,6 +2625,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2514 OutPacket(sound, ThrottleOutPacketType.Task); 2625 OutPacket(sound, ThrottleOutPacketType.Task);
2515 } 2626 }
2516 2627
2628 public void SendTransferAbort(TransferRequestPacket transferRequest)
2629 {
2630 TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort);
2631 abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID;
2632 abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType;
2633 m_log.Debug("[Assets] Aborting transfer; asset request failed");
2634 OutPacket(abort, ThrottleOutPacketType.Task);
2635 }
2636
2517 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) 2637 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain)
2518 { 2638 {
2519 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); 2639 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger);
@@ -2819,6 +2939,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2819 float friction = part.Friction; 2939 float friction = part.Friction;
2820 float bounce = part.Restitution; 2940 float bounce = part.Restitution;
2821 float gravmod = part.GravityModifier; 2941 float gravmod = part.GravityModifier;
2942
2822 eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); 2943 eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId);
2823 } 2944 }
2824 } 2945 }
@@ -2889,8 +3010,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2889 LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType); 3010 LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType);
2890 return; 3011 return;
2891 } 3012 }
3013 int WearableOut = 0;
3014 bool isWearable = false;
3015
3016 if (req.AssetInf != null)
3017 isWearable =
3018 ((AssetType) req.AssetInf.Type ==
3019 AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing);
2892 3020
2893 //m_log.Debug("sending asset " + req.RequestAssetID); 3021
3022 //m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable);
3023
3024
3025 //if (isWearable)
3026 // m_log.Debug((AssetType)req.AssetInf.Type);
3027
2894 TransferInfoPacket Transfer = new TransferInfoPacket(); 3028 TransferInfoPacket Transfer = new TransferInfoPacket();
2895 Transfer.TransferInfo.ChannelType = 2; 3029 Transfer.TransferInfo.ChannelType = 2;
2896 Transfer.TransferInfo.Status = 0; 3030 Transfer.TransferInfo.Status = 0;
@@ -2912,7 +3046,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2912 Transfer.TransferInfo.Size = req.AssetInf.Data.Length; 3046 Transfer.TransferInfo.Size = req.AssetInf.Data.Length;
2913 Transfer.TransferInfo.TransferID = req.TransferRequestID; 3047 Transfer.TransferInfo.TransferID = req.TransferRequestID;
2914 Transfer.Header.Zerocoded = true; 3048 Transfer.Header.Zerocoded = true;
2915 OutPacket(Transfer, ThrottleOutPacketType.Asset); 3049 OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
2916 3050
2917 if (req.NumPackets == 1) 3051 if (req.NumPackets == 1)
2918 { 3052 {
@@ -2923,12 +3057,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2923 TransferPacket.TransferData.Data = req.AssetInf.Data; 3057 TransferPacket.TransferData.Data = req.AssetInf.Data;
2924 TransferPacket.TransferData.Status = 1; 3058 TransferPacket.TransferData.Status = 1;
2925 TransferPacket.Header.Zerocoded = true; 3059 TransferPacket.Header.Zerocoded = true;
2926 OutPacket(TransferPacket, ThrottleOutPacketType.Asset); 3060 OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
2927 } 3061 }
2928 else 3062 else
2929 { 3063 {
2930 int processedLength = 0; 3064 int processedLength = 0;
2931 int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; 3065// int maxChunkSize = Settings.MAX_PACKET_SIZE - 100;
3066
3067 int maxChunkSize = (int) MaxTransferBytesPerPacket;
2932 int packetNumber = 0; 3068 int packetNumber = 0;
2933 3069
2934 while (processedLength < req.AssetInf.Data.Length) 3070 while (processedLength < req.AssetInf.Data.Length)
@@ -2954,7 +3090,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2954 TransferPacket.TransferData.Status = 1; 3090 TransferPacket.TransferData.Status = 1;
2955 } 3091 }
2956 TransferPacket.Header.Zerocoded = true; 3092 TransferPacket.Header.Zerocoded = true;
2957 OutPacket(TransferPacket, ThrottleOutPacketType.Asset); 3093 OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
2958 3094
2959 processedLength += chunkSize; 3095 processedLength += chunkSize;
2960 packetNumber++; 3096 packetNumber++;
@@ -2999,7 +3135,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2999 reply.Data.ParcelID = parcelID; 3135 reply.Data.ParcelID = parcelID;
3000 reply.Data.OwnerID = land.OwnerID; 3136 reply.Data.OwnerID = land.OwnerID;
3001 reply.Data.Name = Utils.StringToBytes(land.Name); 3137 reply.Data.Name = Utils.StringToBytes(land.Name);
3002 reply.Data.Desc = Utils.StringToBytes(land.Description); 3138 if (land != null && land.Description != null && land.Description != String.Empty)
3139 reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length));
3140 else
3141 reply.Data.Desc = new Byte[0];
3003 reply.Data.ActualArea = land.Area; 3142 reply.Data.ActualArea = land.Area;
3004 reply.Data.BillableArea = land.Area; // TODO: what is this? 3143 reply.Data.BillableArea = land.Area; // TODO: what is this?
3005 3144
@@ -3706,24 +3845,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3706 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; 3845 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count];
3707 AgentWearablesUpdatePacket.WearableDataBlock awb; 3846 AgentWearablesUpdatePacket.WearableDataBlock awb;
3708 int idx = 0; 3847 int idx = 0;
3709 for (int i = 0; i < wearables.Length; i++) 3848
3710 { 3849 for (int i = 0; i < wearables.Length; i++)
3711 for (int j = 0; j < wearables[i].Count; j++) 3850 {
3712 { 3851 for (int j = 0; j < wearables[i].Count; j++)
3713 awb = new AgentWearablesUpdatePacket.WearableDataBlock(); 3852 {
3714 awb.WearableType = (byte)i; 3853 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
3715 awb.AssetID = wearables[i][j].AssetID; 3854 awb.WearableType = (byte) i;
3716 awb.ItemID = wearables[i][j].ItemID; 3855 awb.AssetID = wearables[i][j].AssetID;
3717 aw.WearableData[idx] = awb; 3856 awb.ItemID = wearables[i][j].ItemID;
3718 idx++; 3857 aw.WearableData[idx] = awb;
3719 3858 idx++;
3720// m_log.DebugFormat( 3859
3721// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", 3860 // m_log.DebugFormat(
3722// awb.ItemID, awb.AssetID, i, Name); 3861 // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}",
3723 } 3862 // awb.ItemID, awb.AssetID, i, Name);
3724 } 3863 }
3864 }
3725 3865
3726 OutPacket(aw, ThrottleOutPacketType.Task); 3866 OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
3727 } 3867 }
3728 3868
3729 public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) 3869 public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)
@@ -3748,9 +3888,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3748 avp.Sender.IsTrial = false; 3888 avp.Sender.IsTrial = false;
3749 avp.Sender.ID = agentID; 3889 avp.Sender.ID = agentID;
3750 avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0]; 3890 avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0];
3891<<<<<<< HEAD
3751 avp.AppearanceHover = new AvatarAppearancePacket.AppearanceHoverBlock[0]; 3892 avp.AppearanceHover = new AvatarAppearancePacket.AppearanceHoverBlock[0];
3893=======
3894
3895 // this need be use in future
3896 // avp.AppearanceData[0].AppearanceVersion = 0;
3897 // avp.AppearanceData[0].CofVersion = 0;
3898
3899>>>>>>> avn/ubitvar
3752 //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); 3900 //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString());
3753 OutPacket(avp, ThrottleOutPacketType.Task); 3901 OutPacket(avp, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
3754 } 3902 }
3755 3903
3756 public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) 3904 public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
@@ -3778,7 +3926,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3778 ani.AnimationSourceList[i].ObjectID = objectIDs[i]; 3926 ani.AnimationSourceList[i].ObjectID = objectIDs[i];
3779 } 3927 }
3780 ani.Header.Reliable = false; 3928 ani.Header.Reliable = false;
3781 OutPacket(ani, ThrottleOutPacketType.Task); 3929 OutPacket(ani, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
3782 } 3930 }
3783 3931
3784 #endregion 3932 #endregion
@@ -3807,7 +3955,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3807 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; 3955 objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
3808 objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence); 3956 objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
3809 3957
3810 OutPacket(objupdate, ThrottleOutPacketType.Task); 3958 OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
3811 3959
3812 // We need to record the avatar local id since the root prim of an attachment points to this. 3960 // We need to record the avatar local id since the root prim of an attachment points to this.
3813// m_attachmentsSent.Add(avatar.LocalId); 3961// m_attachmentsSent.Add(avatar.LocalId);
@@ -3866,10 +4014,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3866 /// </summary> 4014 /// </summary>
3867 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) 4015 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
3868 { 4016 {
4017<<<<<<< HEAD
3869 if (entity.UUID == m_agentId && !updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) 4018 if (entity.UUID == m_agentId && !updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
3870 { 4019 {
3871 ImprovedTerseObjectUpdatePacket packet 4020 ImprovedTerseObjectUpdatePacket packet
3872 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); 4021 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
4022=======
4023 if (entity is SceneObjectPart)
4024 {
4025 SceneObjectPart e = (SceneObjectPart)entity;
4026 SceneObjectGroup g = e.ParentGroup;
4027 if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId)
4028 return; // Don't send updates for other people's HUDs
4029 }
4030
4031 uint priority = m_prioritizer.GetUpdatePriority(this, entity);
4032>>>>>>> avn/ubitvar
3873 4033
3874 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 4034 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3875 packet.RegionData.TimeDilation = Utils.FloatToUInt16(1, 0.0f, 1.0f); 4035 packet.RegionData.TimeDilation = Utils.FloatToUInt16(1, 0.0f, 1.0f);
@@ -3887,6 +4047,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3887 } 4047 }
3888 } 4048 }
3889 4049
4050
3890 /// <summary> 4051 /// <summary>
3891 /// Requeue an EntityUpdate when it was not acknowledged by the client. 4052 /// Requeue an EntityUpdate when it was not acknowledged by the client.
3892 /// We will update the priority and put it in the correct queue, merging update flags 4053 /// We will update the priority and put it in the correct queue, merging update flags
@@ -3894,8 +4055,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3894 /// The original update time is used for the merged update. 4055 /// The original update time is used for the merged update.
3895 /// </summary> 4056 /// </summary>
3896 private void ResendPrimUpdate(EntityUpdate update) 4057 private void ResendPrimUpdate(EntityUpdate update)
3897 { 4058 {
3898 // If the update exists in priority queue, it will be updated. 4059 // If the update exists in priority queue, it will be updated.
3899 // If it does not exist then it will be added with the current (rather than its original) priority 4060 // If it does not exist then it will be added with the current (rather than its original) priority
3900 uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); 4061 uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity);
3901 4062
@@ -3919,7 +4080,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3919 m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber); 4080 m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber);
3920 4081
3921 // Count this as a resent packet since we are going to requeue all of the updates contained in it 4082 // Count this as a resent packet since we are going to requeue all of the updates contained in it
3922 Interlocked.Increment(ref m_udpClient.PacketsResent); 4083 Interlocked.Increment(ref m_udpClient.PacketsResent);
3923 4084
3924 // We're not going to worry about interlock yet since its not currently critical that this total count 4085 // We're not going to worry about interlock yet since its not currently critical that this total count
3925 // is 100% correct 4086 // is 100% correct
@@ -3928,18 +4089,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3928 foreach (EntityUpdate update in updates) 4089 foreach (EntityUpdate update in updates)
3929 ResendPrimUpdate(update); 4090 ResendPrimUpdate(update);
3930 } 4091 }
3931 4092
3932// OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
3933// OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>();
3934// OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
3935// OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
3936//
3937// OpenSim.Framework.Lazy<List<EntityUpdate>> objectUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>();
3938// OpenSim.Framework.Lazy<List<EntityUpdate>> compressedUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>();
3939// OpenSim.Framework.Lazy<List<EntityUpdate>> terseUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>();
3940// OpenSim.Framework.Lazy<List<EntityUpdate>> terseAgentUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>();
3941
3942
3943 private void ProcessEntityUpdates(int maxUpdates) 4093 private void ProcessEntityUpdates(int maxUpdates)
3944 { 4094 {
3945 OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); 4095 OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
@@ -3952,15 +4102,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3952 OpenSim.Framework.Lazy<List<EntityUpdate>> terseUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); 4102 OpenSim.Framework.Lazy<List<EntityUpdate>> terseUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>();
3953 OpenSim.Framework.Lazy<List<EntityUpdate>> terseAgentUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>(); 4103 OpenSim.Framework.Lazy<List<EntityUpdate>> terseAgentUpdates = new OpenSim.Framework.Lazy<List<EntityUpdate>>();
3954 4104
3955// objectUpdateBlocks.Value.Clear();
3956// compressedUpdateBlocks.Value.Clear();
3957// terseUpdateBlocks.Value.Clear();
3958// terseAgentUpdateBlocks.Value.Clear();
3959// objectUpdates.Value.Clear();
3960// compressedUpdates.Value.Clear();
3961// terseUpdates.Value.Clear();
3962// terseAgentUpdates.Value.Clear();
3963
3964 // Check to see if this is a flush 4105 // Check to see if this is a flush
3965 if (maxUpdates <= 0) 4106 if (maxUpdates <= 0)
3966 { 4107 {
@@ -3971,54 +4112,72 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3971 4112
3972 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race 4113 // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race
3973 // condition where a kill can be processed before an out-of-date update for the same object. 4114 // condition where a kill can be processed before an out-of-date update for the same object.
3974 lock (m_killRecord) 4115 float avgTimeDilation = 1.0f;
4116 IEntityUpdate iupdate;
4117 Int32 timeinqueue; // this is just debugging code & can be dropped later
4118
4119 while (updatesThisCall < maxUpdates)
3975 { 4120 {
3976 float avgTimeDilation = 1.0f; 4121 lock (m_entityUpdates.SyncRoot)
3977 IEntityUpdate iupdate; 4122 if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue))
3978 Int32 timeinqueue; // this is just debugging code & can be dropped later 4123 break;
4124
4125 EntityUpdate update = (EntityUpdate)iupdate;
4126
4127 avgTimeDilation += update.TimeDilation;
4128 avgTimeDilation *= 0.5f;
3979 4129
3980 while (updatesThisCall < maxUpdates) 4130 if (update.Entity is SceneObjectPart)
3981 { 4131 {
3982 lock (m_entityUpdates.SyncRoot) 4132 SceneObjectPart part = (SceneObjectPart)update.Entity;
3983 if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue))
3984 break;
3985 4133
3986 EntityUpdate update = (EntityUpdate)iupdate; 4134 if (part.ParentGroup.IsDeleted || part.ParentGroup.inTransit)
3987 4135 continue;
3988 avgTimeDilation += update.TimeDilation;
3989 avgTimeDilation *= 0.5f;
3990 4136
3991 if (update.Entity is SceneObjectPart) 4137 if (part.ParentGroup.IsAttachment)
3992 { 4138 { // Someone else's HUD, why are we getting these?
3993 SceneObjectPart part = (SceneObjectPart)update.Entity; 4139 if (part.ParentGroup.OwnerID != AgentId && part.ParentGroup.HasPrivateAttachmentPoint)
3994
3995 // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client
3996 // will never receive an update after a prim kill. Even then, keeping the kill record may be a good
3997 // safety measure.
3998 //
3999 // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update
4000 // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs
4001 // updates and kills on different threads with different scheduling strategies, hence this protection.
4002 //
4003 // This doesn't appear to apply to child prims - a client will happily ignore these updates
4004 // after the root prim has been deleted.
4005 if (m_killRecord.Contains(part.LocalId))
4006 {
4007 // m_log.WarnFormat(
4008 // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted",
4009 // part.LocalId, Name);
4010 continue; 4140 continue;
4011 } 4141 ScenePresence sp;
4012 4142 // Owner is not in the sim, don't update it to
4013 if (part.ParentGroup.IsAttachment && m_disableFacelights) 4143 // anyone
4144 if (!m_scene.TryGetScenePresence(part.OwnerID, out sp))
4145 continue;
4146
4147 List<SceneObjectGroup> atts = sp.GetAttachments();
4148 bool found = false;
4149 foreach (SceneObjectGroup att in atts)
4014 { 4150 {
4015 if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && 4151 if (att == part.ParentGroup)
4016 part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
4017 { 4152 {
4018 part.Shape.LightEntry = false; 4153 found = true;
4154 break;
4019 } 4155 }
4020 } 4156 }
4021 4157
4158 // It's an attachment of a valid avatar, but
4159 // doesn't seem to be attached, skip
4160 if (!found)
4161 continue;
4162
4163 // On vehicle crossing, the attachments are received
4164 // while the avatar is still a child. Don't send
4165 // updates here because the LocalId has not yet
4166 // been updated and the viewer will derender the
4167 // attachments until the avatar becomes root.
4168 if (sp.IsChildAgent)
4169 continue;
4170
4171 }
4172
4173 if (part.ParentGroup.IsAttachment && m_disableFacelights)
4174 {
4175 if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand &&
4176 part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand)
4177 {
4178 part.Shape.LightEntry = false;
4179 }
4180
4022 if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) 4181 if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
4023 { 4182 {
4024 // Ensure that mesh has at least 8 valid faces 4183 // Ensure that mesh has at least 8 valid faces
@@ -4027,233 +4186,216 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4027 part.Shape.ProfileHollow = 27500; 4186 part.Shape.ProfileHollow = 27500;
4028 } 4187 }
4029 } 4188 }
4030 4189
4031 #region UpdateFlags to packet type conversion 4190 if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
4032
4033 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
4034
4035 bool canUseCompressed = true;
4036 bool canUseImproved = true;
4037
4038 // Compressed object updates only make sense for LL primitives
4039 if (!(update.Entity is SceneObjectPart))
4040 { 4191 {
4041 canUseCompressed = false; 4192 // Ensure that mesh has at least 8 valid faces
4193 part.Shape.ProfileBegin = 12500;
4194 part.Shape.ProfileEnd = 0;
4195 part.Shape.ProfileHollow = 27500;
4042 } 4196 }
4043 4197 }
4044 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) 4198 else if (update.Entity is ScenePresence)
4199 {
4200 ScenePresence presence = (ScenePresence)update.Entity;
4201 if (presence.IsDeleted)
4202 continue;
4203 // If ParentUUID is not UUID.Zero and ParentID is 0, this
4204 // avatar is in the process of crossing regions while
4205 // sat on an object. In this state, we don't want any
4206 // updates because they will visually orbit the avatar.
4207 // Update will be forced once crossing is completed anyway.
4208 if (presence.ParentUUID != UUID.Zero && presence.ParentID == 0)
4209 continue;
4210 }
4211
4212 ++updatesThisCall;
4213
4214 #region UpdateFlags to packet type conversion
4215
4216 PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
4217
4218 bool canUseCompressed = true;
4219 bool canUseImproved = true;
4220
4221 // Compressed object updates only make sense for LL primitives
4222 if (!(update.Entity is SceneObjectPart))
4223 {
4224 canUseCompressed = false;
4225 }
4226
4227 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
4228 {
4229 canUseCompressed = false;
4230 canUseImproved = false;
4231 }
4232 else
4233 {
4234 if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) ||
4235 updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
4236 updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
4237 updateFlags.HasFlag(PrimUpdateFlags.Joint))
4045 { 4238 {
4046 canUseCompressed = false; 4239 canUseCompressed = false;
4047 canUseImproved = false;
4048 } 4240 }
4049 else 4241
4242 if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
4243 updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
4244 updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
4245 updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
4246 updateFlags.HasFlag(PrimUpdateFlags.Text) ||
4247 updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
4248 updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
4249 updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
4250 updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
4251 updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
4252 updateFlags.HasFlag(PrimUpdateFlags.Material) ||
4253 updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
4254 updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
4255 updateFlags.HasFlag(PrimUpdateFlags.Joint))
4050 { 4256 {
4051 if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || 4257 canUseImproved = false;
4052 updateFlags.HasFlag(PrimUpdateFlags.Acceleration) ||
4053 updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) ||
4054 updateFlags.HasFlag(PrimUpdateFlags.Joint))
4055 {
4056 canUseCompressed = false;
4057 }
4058
4059 if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) ||
4060 updateFlags.HasFlag(PrimUpdateFlags.ParentID) ||
4061 updateFlags.HasFlag(PrimUpdateFlags.Scale) ||
4062 updateFlags.HasFlag(PrimUpdateFlags.PrimData) ||
4063 updateFlags.HasFlag(PrimUpdateFlags.Text) ||
4064 updateFlags.HasFlag(PrimUpdateFlags.NameValue) ||
4065 updateFlags.HasFlag(PrimUpdateFlags.ExtraData) ||
4066 updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) ||
4067 updateFlags.HasFlag(PrimUpdateFlags.Sound) ||
4068 updateFlags.HasFlag(PrimUpdateFlags.Particles) ||
4069 updateFlags.HasFlag(PrimUpdateFlags.Material) ||
4070 updateFlags.HasFlag(PrimUpdateFlags.ClickAction) ||
4071 updateFlags.HasFlag(PrimUpdateFlags.MediaURL) ||
4072 updateFlags.HasFlag(PrimUpdateFlags.Joint))
4073 {
4074 canUseImproved = false;
4075 }
4076 } 4258 }
4259 }
4077 4260
4078 #endregion UpdateFlags to packet type conversion 4261 #endregion UpdateFlags to packet type conversion
4079
4080 #region Block Construction
4081
4082 // TODO: Remove this once we can build compressed updates
4083 canUseCompressed = false;
4084
4085 if (!canUseImproved && !canUseCompressed)
4086 {
4087 ObjectUpdatePacket.ObjectDataBlock updateBlock;
4088 4262
4089 if (update.Entity is ScenePresence) 4263 #region Block Construction
4090 {
4091 updateBlock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
4092 }
4093 else
4094 {
4095 SceneObjectPart part = (SceneObjectPart)update.Entity;
4096 updateBlock = CreatePrimUpdateBlock(part, AgentId);
4097
4098 // If the part has become a private hud since the update was scheduled then we do not
4099 // want to send it to other avatars.
4100 if (part.ParentGroup.IsAttachment
4101 && part.ParentGroup.HasPrivateAttachmentPoint
4102 && part.ParentGroup.AttachedAvatar != AgentId)
4103 continue;
4104
4105 // If the part has since been deleted, then drop the update. In the case of attachments,
4106 // this is to avoid spurious updates to other viewers since post-processing of attachments
4107 // has to change the IsAttachment flag for various reasons (which will end up in a pass
4108 // of the test above).
4109 //
4110 // Actual deletions (kills) happen in another method.
4111 if (part.ParentGroup.IsDeleted)
4112 continue;
4113 }
4114 4264
4115 objectUpdateBlocks.Value.Add(updateBlock); 4265 // TODO: Remove this once we can build compressed updates
4116 objectUpdates.Value.Add(update); 4266 canUseCompressed = false;
4117 }
4118 else if (!canUseImproved)
4119 {
4120 SceneObjectPart part = (SceneObjectPart)update.Entity;
4121 ObjectUpdateCompressedPacket.ObjectDataBlock compressedBlock
4122 = CreateCompressedUpdateBlock(part, updateFlags);
4123
4124 // If the part has since been deleted, then drop the update. In the case of attachments,
4125 // this is to avoid spurious updates to other viewers since post-processing of attachments
4126 // has to change the IsAttachment flag for various reasons (which will end up in a pass
4127 // of the test above).
4128 //
4129 // Actual deletions (kills) happen in another method.
4130 if (part.ParentGroup.IsDeleted)
4131 continue;
4132 4267
4133 compressedUpdateBlocks.Value.Add(compressedBlock); 4268 if (!canUseImproved && !canUseCompressed)
4134 compressedUpdates.Value.Add(update); 4269 {
4270 if (update.Entity is ScenePresence)
4271 {
4272 objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity));
4135 } 4273 }
4136 else 4274 else
4137 { 4275 {
4138 if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) 4276 objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
4139 { 4277 }
4140 // Self updates go into a special list 4278 }
4141 terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); 4279 else if (!canUseImproved)
4142 terseAgentUpdates.Value.Add(update); 4280 {
4143 } 4281 compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags));
4144 else 4282 }
4145 { 4283 else
4146 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseUpdateBlock 4284 {
4147 = CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)); 4285 if (update.Entity is ScenePresence)
4286 // ALL presence updates go into a special list
4287 terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
4288 else
4289 // Everything else goes here
4290 terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures)));
4291 }
4148 4292
4149 // Everything else goes here 4293 #endregion Block Construction
4150 if (update.Entity is SceneObjectPart) 4294 }
4151 {
4152 SceneObjectPart part = (SceneObjectPart)update.Entity;
4153
4154 // If the part has become a private hud since the update was scheduled then we do not
4155 // want to send it to other avatars.
4156 if (part.ParentGroup.IsAttachment
4157 && part.ParentGroup.HasPrivateAttachmentPoint
4158 && part.ParentGroup.AttachedAvatar != AgentId)
4159 continue;
4160
4161 // If the part has since been deleted, then drop the update. In the case of attachments,
4162 // this is to avoid spurious updates to other viewers since post-processing of attachments
4163 // has to change the IsAttachment flag for various reasons (which will end up in a pass
4164 // of the test above).
4165 //
4166 // Actual deletions (kills) happen in another method.
4167 if (part.ParentGroup.IsDeleted)
4168 continue;
4169 }
4170 4295
4171 terseUpdateBlocks.Value.Add(terseUpdateBlock); 4296 #region Packet Sending
4172 terseUpdates.Value.Add(update); 4297
4173 } 4298// const float TIME_DILATION = 1.0f;
4174 } 4299 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f);
4300
4301 if (terseAgentUpdateBlocks.IsValueCreated)
4302 {
4303 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
4304
4305 ImprovedTerseObjectUpdatePacket packet
4306 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
4307 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4308 packet.RegionData.TimeDilation = timeDilation;
4309 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
4175 4310
4176 ++updatesThisCall; 4311 for (int i = 0; i < blocks.Count; i++)
4312 packet.ObjectData[i] = blocks[i];
4313
4314 OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); });
4315 }
4316
4317 if (objectUpdateBlocks.IsValueCreated)
4318 {
4319 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value;
4177 4320
4178 #endregion Block Construction 4321 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
4179 } 4322 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4323 packet.RegionData.TimeDilation = timeDilation;
4324 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count];
4180 4325
4181 #region Packet Sending 4326 for (int i = 0; i < blocks.Count; i++)
4182 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); 4327 packet.ObjectData[i] = blocks[i];
4328
4329 OutPacket(packet, ThrottleOutPacketType.Task, true);
4330 }
4331
4332 if (compressedUpdateBlocks.IsValueCreated)
4333 {
4334 List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value;
4335
4336 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
4337 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4338 packet.RegionData.TimeDilation = timeDilation;
4339 packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
4183 4340
4184 if (terseAgentUpdateBlocks.IsValueCreated) 4341 for (int i = 0; i < blocks.Count; i++)
4185 { 4342 packet.ObjectData[i] = blocks[i];
4186 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; 4343
4344 OutPacket(packet, ThrottleOutPacketType.Task, true);
4345 }
4346
4347 if (terseUpdateBlocks.IsValueCreated)
4348 {
4349 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
4350
4351 ImprovedTerseObjectUpdatePacket packet
4352 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(
4353 PacketType.ImprovedTerseObjectUpdate);
4354 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4355 packet.RegionData.TimeDilation = timeDilation;
4356 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
4357
4358 for (int i = 0; i < blocks.Count; i++)
4359 packet.ObjectData[i] = blocks[i];
4187 4360
4188 ImprovedTerseObjectUpdatePacket packet 4361 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); });
4189 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); 4362 }
4190 4363
4191 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 4364 #endregion Packet Sending
4192 packet.RegionData.TimeDilation = timeDilation; 4365 }
4193 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
4194 4366
4195 for (int i = 0; i < blocks.Count; i++) 4367 // hack.. dont use
4196 packet.ObjectData[i] = blocks[i]; 4368 public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
4197 // If any of the packets created from this call go unacknowledged, all of the updates will be resent 4369 {
4198 OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); }); 4370 if (ent is SceneObjectPart)
4199 } 4371 {
4372 SceneObjectPart part = (SceneObjectPart)ent;
4373 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
4374 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4375 packet.RegionData.TimeDilation = 1;
4376 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
4200 4377
4201 if (objectUpdateBlocks.IsValueCreated) 4378 ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, this.m_agentId);
4379 if (parentID.HasValue)
4202 { 4380 {
4203 List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; 4381 blk.ParentID = parentID.Value;
4204
4205 ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
4206 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4207 packet.RegionData.TimeDilation = timeDilation;
4208 packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count];
4209
4210 for (int i = 0; i < blocks.Count; i++)
4211 packet.ObjectData[i] = blocks[i];
4212 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
4213 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); });
4214 }
4215
4216 if (compressedUpdateBlocks.IsValueCreated)
4217 {
4218 List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value;
4219
4220 ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed);
4221 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
4222 packet.RegionData.TimeDilation = timeDilation;
4223 packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
4224
4225 for (int i = 0; i < blocks.Count; i++)
4226 packet.ObjectData[i] = blocks[i];
4227 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
4228 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); });
4229 } 4382 }
4230 4383
4231 if (terseUpdateBlocks.IsValueCreated) 4384 packet.ObjectData[0] = blk;
4232 {
4233 List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value;
4234
4235 ImprovedTerseObjectUpdatePacket packet
4236 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(
4237 PacketType.ImprovedTerseObjectUpdate);
4238 4385
4239 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; 4386 OutPacket(packet, ThrottleOutPacketType.Task, true);
4240 packet.RegionData.TimeDilation = timeDilation;
4241 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count];
4242
4243 for (int i = 0; i < blocks.Count; i++)
4244 packet.ObjectData[i] = blocks[i];
4245 // If any of the packets created from this call go unacknowledged, all of the updates will be resent
4246 OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); });
4247 }
4248 } 4387 }
4388<<<<<<< HEAD
4249 4389
4250// m_log.DebugFormat( 4390// m_log.DebugFormat(
4251// "[LLCLIENTVIEW]: Sent {0} updates in ProcessEntityUpdates() for {1} {2} in {3}", 4391// "[LLCLIENTVIEW]: Sent {0} updates in ProcessEntityUpdates() for {1} {2} in {3}",
4252// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name); 4392// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name);
4253// 4393//
4254 #endregion Packet Sending 4394 #endregion Packet Sending
4395=======
4396>>>>>>> avn/ubitvar
4255 } 4397 }
4256 4398
4257 public void ReprioritizeUpdates() 4399 public void ReprioritizeUpdates()
4258 { 4400 {
4259 lock (m_entityUpdates.SyncRoot) 4401 lock (m_entityUpdates.SyncRoot)
@@ -4572,11 +4714,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4572 4714
4573 // Pass in the delegate so that if this packet needs to be resent, we send the current properties 4715 // Pass in the delegate so that if this packet needs to be resent, we send the current properties
4574 // of the object rather than the properties when the packet was created 4716 // of the object rather than the properties when the packet was created
4575 OutPacket(packet, ThrottleOutPacketType.Task, true, 4717 // HACK : Remove intelligent resending until it's fixed in core
4576 delegate(OutgoingPacket oPacket) 4718 //OutPacket(packet, ThrottleOutPacketType.Task, true,
4577 { 4719 // delegate(OutgoingPacket oPacket)
4578 ResendPropertyUpdates(updates, oPacket); 4720 // {
4579 }); 4721 // ResendPropertyUpdates(updates, oPacket);
4722 // });
4723 OutPacket(packet, ThrottleOutPacketType.Task, true);
4580 4724
4581 // pbcnt += blocks.Count; 4725 // pbcnt += blocks.Count;
4582 // ppcnt++; 4726 // ppcnt++;
@@ -4602,11 +4746,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4602 // of the object rather than the properties when the packet was created 4746 // of the object rather than the properties when the packet was created
4603 List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); 4747 List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>();
4604 updates.Add(familyUpdates.Value[i]); 4748 updates.Add(familyUpdates.Value[i]);
4605 OutPacket(packet, ThrottleOutPacketType.Task, true, 4749 // HACK : Remove intelligent resending until it's fixed in core
4606 delegate(OutgoingPacket oPacket) 4750 //OutPacket(packet, ThrottleOutPacketType.Task, true,
4607 { 4751 // delegate(OutgoingPacket oPacket)
4608 ResendPropertyUpdates(updates, oPacket); 4752 // {
4609 }); 4753 // ResendPropertyUpdates(updates, oPacket);
4754 // });
4755 OutPacket(packet, ThrottleOutPacketType.Task, true);
4610 4756
4611 // fpcnt++; 4757 // fpcnt++;
4612 // fbcnt++; 4758 // fbcnt++;
@@ -4939,7 +5085,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4939 packet.ParcelData.Data = data; 5085 packet.ParcelData.Data = data;
4940 packet.ParcelData.SequenceID = sequence_id; 5086 packet.ParcelData.SequenceID = sequence_id;
4941 packet.Header.Zerocoded = true; 5087 packet.Header.Zerocoded = true;
4942 OutPacket(packet, ThrottleOutPacketType.Task); 5088// OutPacket(packet, ThrottleOutPacketType.Task);
5089 OutPacket(packet, ThrottleOutPacketType.Land);
4943 } 5090 }
4944 5091
4945 public void SendLandProperties( 5092 public void SendLandProperties(
@@ -5004,7 +5151,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5004 5151
5005 if (landData.SimwideArea > 0) 5152 if (landData.SimwideArea > 0)
5006 { 5153 {
5007 int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); 5154 int simulatorCapacity = (int)((long)landData.SimwideArea * (long)m_scene.RegionInfo.ObjectCapacity * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus / 65536L);
5155 // Never report more than sim total capacity
5156 if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity)
5157 simulatorCapacity = m_scene.RegionInfo.ObjectCapacity;
5008 updateMessage.SimWideMaxPrims = simulatorCapacity; 5158 updateMessage.SimWideMaxPrims = simulatorCapacity;
5009 } 5159 }
5010 else 5160 else
@@ -5039,7 +5189,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5039 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); 5189 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
5040 if (eq != null) 5190 if (eq != null)
5041 { 5191 {
5042 eq.ParcelProperties(updateMessage, this.AgentId); 5192
5193 OSD message_body = updateMessage.Serialize();
5194 // Add new fields here until OMV has them
5195 OSDMap bodyMap = (OSDMap)message_body;
5196 OSDArray parcelDataArray = (OSDArray)bodyMap["ParcelData"];
5197 OSDMap parcelData = (OSDMap)parcelDataArray[0];
5198 parcelData["SeeAVs"] = OSD.FromBoolean(landData.SeeAVs);
5199 parcelData["AnyAVSounds"] = OSD.FromBoolean(landData.AnyAVSounds);
5200 parcelData["GroupAVSounds"] = OSD.FromBoolean(landData.GroupAVSounds);
5201 OSDMap message = new OSDMap();
5202 message.Add("message", OSD.FromString("ParcelProperties"));
5203 message.Add("body", message_body);
5204
5205 eq.Enqueue (message, this.AgentId);
5206
5207// eq.ParcelProperties(updateMessage, this.AgentId);
5043 } 5208 }
5044 else 5209 else
5045 { 5210 {
@@ -5133,14 +5298,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5133 5298
5134 if (notifyCount > 0) 5299 if (notifyCount > 0)
5135 { 5300 {
5136 if (notifyCount > 32) 5301// if (notifyCount > 32)
5137 { 5302// {
5138 m_log.InfoFormat( 5303// m_log.InfoFormat(
5139 "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" 5304// "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}"
5140 + " - a developer might want to investigate whether this is a hard limit", 32); 5305// + " - a developer might want to investigate whether this is a hard limit", 32);
5141 5306//
5142 notifyCount = 32; 5307// notifyCount = 32;
5143 } 5308// }
5144 5309
5145 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock 5310 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock
5146 = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; 5311 = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount];
@@ -5195,41 +5360,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5195 { 5360 {
5196 ScenePresence presence = (ScenePresence)entity; 5361 ScenePresence presence = (ScenePresence)entity;
5197 5362
5363<<<<<<< HEAD
5198// m_log.DebugFormat( 5364// m_log.DebugFormat(
5199// "[LLCLIENTVIEW]: Sending terse update to {0} with pos {1}, vel {2} in {3}", 5365// "[LLCLIENTVIEW]: Sending terse update to {0} with pos {1}, vel {2} in {3}",
5200// Name, presence.OffsetPosition, presence.Velocity, m_scene.Name); 5366// Name, presence.OffsetPosition, presence.Velocity, m_scene.Name);
5201 5367=======
5202 attachPoint = presence.State;
5203 collisionPlane = presence.CollisionPlane;
5204 position = presence.OffsetPosition; 5368 position = presence.OffsetPosition;
5205 velocity = presence.Velocity; 5369 rotation = presence.Rotation;
5206 acceleration = Vector3.Zero;
5207
5208 // Interestingly, sending this to non-zero will cause the client's avatar to start moving & accelerating
5209 // in that direction, even though we don't model this on the server. Implementing this in the future
5210 // may improve movement smoothness.
5211// acceleration = new Vector3(1, 0, 0);
5212
5213 angularVelocity = presence.AngularVelocity; 5370 angularVelocity = presence.AngularVelocity;
5214
5215 // Whilst not in mouselook, an avatar will transmit only the Z rotation as this is the only axis
5216 // it rotates around.
5217 // In mouselook, X and Y co-ordinate will also be sent but when used in Rotation, these cause unwanted
5218 // excessive up and down movements of the camera when looking up and down.
5219 // See http://opensimulator.org/mantis/view.php?id=3274
5220 // This does not affect head movement, since this is controlled entirely by camera movement rather than
5221 // body rotation. We still need to transmit X and Y for sitting avatars but mouselook does not change
5222 // the rotation in this case.
5223 rotation = presence.Rotation; 5371 rotation = presence.Rotation;
5224 5372
5225 if (!presence.IsSatOnObject) 5373 attachPoint = 0;
5226 { 5374// m_log.DebugFormat(
5227 rotation.X = 0; 5375// "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name);
5228 rotation.Y = 0; 5376>>>>>>> avn/ubitvar
5229 } 5377
5378 // attachPoint = presence.State; // Core: commented
5379 collisionPlane = presence.CollisionPlane;
5380 velocity = presence.Velocity;
5381 acceleration = Vector3.Zero;
5230 5382
5231 if (sendTexture) 5383 if (sendTexture)
5384 {
5232 textureEntry = presence.Appearance.Texture.GetBytes(); 5385 textureEntry = presence.Appearance.Texture.GetBytes();
5386 }
5233 else 5387 else
5234 textureEntry = null; 5388 textureEntry = null;
5235 } 5389 }
@@ -5333,10 +5487,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5333 5487
5334 protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) 5488 protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data)
5335 { 5489 {
5490 Vector3 offsetPosition = data.OffsetPosition;
5491 Quaternion rotation = data.Rotation;
5492 uint parentID = data.ParentID;
5493
5336// m_log.DebugFormat( 5494// m_log.DebugFormat(
5337// "[LLCLIENTVIEW]: Sending full update to {0} with pos {1}, vel {2} in {3}", Name, data.OffsetPosition, data.Velocity, m_scene.Name); 5495// "[LLCLIENTVIEW]: Sending full update to {0} with pos {1}, vel {2} in {3}", Name, data.OffsetPosition, data.Velocity, m_scene.Name);
5338 5496
5339 byte[] objectData = new byte[76]; 5497 byte[] objectData = new byte[76];
5498<<<<<<< HEAD
5340 5499
5341 data.CollisionPlane.ToBytes(objectData, 0); 5500 data.CollisionPlane.ToBytes(objectData, 0);
5342 data.OffsetPosition.ToBytes(objectData, 16); 5501 data.OffsetPosition.ToBytes(objectData, 16);
@@ -5352,15 +5511,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5352 // body rotation. We still need to transmit X and Y for sitting avatars but mouselook does not change 5511 // body rotation. We still need to transmit X and Y for sitting avatars but mouselook does not change
5353 // the rotation in this case. 5512 // the rotation in this case.
5354 Quaternion rot = data.Rotation; 5513 Quaternion rot = data.Rotation;
5514=======
5515>>>>>>> avn/ubitvar
5355 5516
5356 if (!data.IsSatOnObject) 5517 Vector3 velocity = new Vector3(0, 0, 0);
5357 { 5518 Vector3 acceleration = new Vector3(0, 0, 0);
5358 rot.X = 0; 5519 rotation.Normalize();
5359 rot.Y = 0;
5360 }
5361 5520
5362 rot.ToBytes(objectData, 52); 5521 data.CollisionPlane.ToBytes(objectData, 0);
5363 //data.AngularVelocity.ToBytes(objectData, 64); 5522 offsetPosition.ToBytes(objectData, 16);
5523 velocity.ToBytes(objectData, 28);
5524 acceleration.ToBytes(objectData, 40);
5525 rotation.ToBytes(objectData, 52);
5526 data.AngularVelocity.ToBytes(objectData, 64);
5364 5527
5365 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); 5528 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
5366 5529
@@ -5386,7 +5549,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5386 update.PCode = (byte)PCode.Avatar; 5549 update.PCode = (byte)PCode.Avatar;
5387 update.ProfileCurve = 1; 5550 update.ProfileCurve = 1;
5388 update.PSBlock = Utils.EmptyBytes; 5551 update.PSBlock = Utils.EmptyBytes;
5389 update.Scale = new Vector3(0.45f, 0.6f, 1.9f); 5552 update.Scale = data.Appearance.AvatarSize;
5553// update.Scale.Z -= 0.2f;
5554
5390 update.Text = Utils.EmptyBytes; 5555 update.Text = Utils.EmptyBytes;
5391 update.TextColor = new byte[4]; 5556 update.TextColor = new byte[4];
5392 5557
@@ -5397,10 +5562,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5397 update.TextureEntry = Utils.EmptyBytes; 5562 update.TextureEntry = Utils.EmptyBytes;
5398// update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; 5563// update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes;
5399 5564
5565/* all this flags seem related to prims and not avatars. This allow for wrong viewer side move of a avatar in prim edition mode (anv mantis 854)
5400 update.UpdateFlags = (uint)( 5566 update.UpdateFlags = (uint)(
5401 PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | 5567 PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner |
5402 PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | 5568 PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer |
5403 PrimFlags.ObjectOwnerModify); 5569 PrimFlags.ObjectOwnerModify);
5570*/
5571 update.UpdateFlags = 0;
5404 5572
5405 return update; 5573 return update;
5406 } 5574 }
@@ -5411,15 +5579,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5411 data.RelativePosition.ToBytes(objectData, 0); 5579 data.RelativePosition.ToBytes(objectData, 0);
5412 data.Velocity.ToBytes(objectData, 12); 5580 data.Velocity.ToBytes(objectData, 12);
5413 data.Acceleration.ToBytes(objectData, 24); 5581 data.Acceleration.ToBytes(objectData, 24);
5414 try 5582
5415 { 5583 Quaternion rotation = data.RotationOffset;
5416 data.RotationOffset.ToBytes(objectData, 36); 5584 rotation.Normalize();
5417 } 5585 rotation.ToBytes(objectData, 36);
5418 catch (Exception e)
5419 {
5420 m_log.Warn("[LLClientView]: exception converting quaternion to bytes, using Quaternion.Identity. Exception: " + e.ToString());
5421 OpenMetaverse.Quaternion.Identity.ToBytes(objectData, 36);
5422 }
5423 data.AngularVelocity.ToBytes(objectData, 48); 5586 data.AngularVelocity.ToBytes(objectData, 48);
5424 5587
5425 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); 5588 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
@@ -5433,7 +5596,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5433 //update.JointType = 0; 5596 //update.JointType = 0;
5434 update.Material = data.Material; 5597 update.Material = data.Material;
5435 update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim 5598 update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
5599<<<<<<< HEAD
5436 5600
5601=======
5602/*
5603>>>>>>> avn/ubitvar
5437 if (data.ParentGroup.IsAttachment) 5604 if (data.ParentGroup.IsAttachment)
5438 { 5605 {
5439 update.NameValue 5606 update.NameValue
@@ -5458,6 +5625,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5458 // case for attachments may contain conflicting values that can end up crashing the viewer. 5625 // case for attachments may contain conflicting values that can end up crashing the viewer.
5459 update.State = data.ParentGroup.RootPart.Shape.State; 5626 update.State = data.ParentGroup.RootPart.Shape.State;
5460 } 5627 }
5628 */
5629
5630 if (data.ParentGroup.IsAttachment)
5631 {
5632 if (data.IsRoot)
5633 {
5634 update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID);
5635 }
5636 else
5637 update.NameValue = Utils.EmptyBytes;
5638
5639 int st = (int)data.ParentGroup.AttachmentPoint;
5640 update.State = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ;
5641 }
5642 else
5643 {
5644 update.NameValue = Utils.EmptyBytes;
5645 update.State = data.Shape.State; // not sure about this
5646 }
5647
5461 5648
5462 update.ObjectData = objectData; 5649 update.ObjectData = objectData;
5463 update.ParentID = data.ParentID; 5650 update.ParentID = data.ParentID;
@@ -5579,8 +5766,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5579 // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs 5766 // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs
5580 // for each AgentUpdate packet. 5767 // for each AgentUpdate packet.
5581 AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false); 5768 AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false);
5582 5769
5583 AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false); 5770 AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false);
5771 AddLocalPacketHandler(PacketType.VelocityInterpolateOff, HandleVelocityInterpolateOff, false);
5772 AddLocalPacketHandler(PacketType.VelocityInterpolateOn, HandleVelocityInterpolateOn, false);
5584 AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false); 5773 AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false);
5585 AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); 5774 AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false);
5586 AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); 5775 AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false);
@@ -5732,6 +5921,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5732 AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); 5921 AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false);
5733 AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); 5922 AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false);
5734 AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); 5923 AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode);
5924 AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments);
5735 AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); 5925 AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false);
5736 AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); 5926 AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents);
5737 AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); 5927 AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery);
@@ -5798,6 +5988,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5798 AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); 5988 AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest);
5799 AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); 5989 AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes);
5800 AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); 5990 AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard);
5991 AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags);
5801 5992
5802 AddGenericPacketHandler("autopilot", HandleAutopilot); 5993 AddGenericPacketHandler("autopilot", HandleAutopilot);
5803 } 5994 }
@@ -5809,7 +6000,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5809 #region Scene/Avatar 6000 #region Scene/Avatar
5810 6001
5811 // Threshold for body rotation to be a significant agent update 6002 // Threshold for body rotation to be a significant agent update
5812 private const float QDELTA = 0.000001f; 6003 // use the abs of cos
6004 private const float QDELTABody = 1.0f - 0.0001f;
6005 private const float QDELTAHead = 1.0f - 0.0001f;
5813 // Threshold for camera rotation to be a significant agent update 6006 // Threshold for camera rotation to be a significant agent update
5814 private const float VDELTA = 0.01f; 6007 private const float VDELTA = 0.01f;
5815 6008
@@ -5832,18 +6025,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5832 /// <param name='x'></param> 6025 /// <param name='x'></param>
5833 private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) 6026 private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
5834 { 6027 {
5835 float qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2); 6028 float qdelta1 = Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation));
5836 //qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2); 6029 //qdelta2 = Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation));
5837 6030
5838 bool movementSignificant = 6031 bool movementSignificant =
5839 (qdelta1 > QDELTA) // significant if body rotation above threshold 6032 (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed
5840 // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack
5841 // || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold
5842 || (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed
5843 || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands 6033 || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands
5844 || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed
5845 || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed 6034 || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed
5846 || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed 6035 || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed
6036 || (qdelta1 < QDELTABody) // significant if body rotation above(below cos) threshold
6037 // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack
6038 // || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold
6039 || (Math.Abs(x.Far - m_thisAgentUpdateArgs.Far) >= 32) // significant if far distance changed
5847 ; 6040 ;
5848 //if (movementSignificant) 6041 //if (movementSignificant)
5849 //{ 6042 //{
@@ -5886,55 +6079,63 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5886 return cameraSignificant; 6079 return cameraSignificant;
5887 } 6080 }
5888 6081
5889 private bool HandleAgentUpdate(IClientAPI sener, Packet packet) 6082 private bool HandleAgentUpdate(IClientAPI sender, Packet packet)
5890 { 6083 {
5891 // We got here, which means that something in agent update was significant 6084 // We got here, which means that something in agent update was significant
5892 6085
5893 AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; 6086 AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet;
5894 AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData; 6087 AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData;
5895 6088
5896 if (x.AgentID != AgentId || x.SessionID != SessionId) 6089 if (x.AgentID != AgentId || x.SessionID != SessionId)
6090 {
6091 PacketPool.Instance.ReturnPacket(packet);
5897 return false; 6092 return false;
6093 }
6094
6095 TotalAgentUpdates++;
5898 6096
5899 // Before we update the current m_thisAgentUpdateArgs, let's check this again
5900 // to see what exactly changed
5901 bool movement = CheckAgentMovementUpdateSignificance(x); 6097 bool movement = CheckAgentMovementUpdateSignificance(x);
5902 bool camera = CheckAgentCameraUpdateSignificance(x); 6098 bool camera = CheckAgentCameraUpdateSignificance(x);
5903 6099
5904 m_thisAgentUpdateArgs.AgentID = x.AgentID;
5905 m_thisAgentUpdateArgs.BodyRotation = x.BodyRotation;
5906 m_thisAgentUpdateArgs.CameraAtAxis = x.CameraAtAxis;
5907 m_thisAgentUpdateArgs.CameraCenter = x.CameraCenter;
5908 m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis;
5909 m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis;
5910 m_thisAgentUpdateArgs.ControlFlags = x.ControlFlags;
5911 m_thisAgentUpdateArgs.Far = x.Far;
5912 m_thisAgentUpdateArgs.Flags = x.Flags;
5913 m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation;
5914 m_thisAgentUpdateArgs.SessionID = x.SessionID;
5915 m_thisAgentUpdateArgs.State = x.State;
5916
5917 UpdateAgent handlerAgentUpdate = OnAgentUpdate;
5918 UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate;
5919 UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate;
5920
5921 // Was there a significant movement/state change? 6100 // Was there a significant movement/state change?
5922 if (movement) 6101 if (movement)
5923 { 6102 {
6103 m_thisAgentUpdateArgs.BodyRotation = x.BodyRotation;
6104 m_thisAgentUpdateArgs.ControlFlags = x.ControlFlags;
6105 m_thisAgentUpdateArgs.Far = x.Far;
6106 m_thisAgentUpdateArgs.Flags = x.Flags;
6107 m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation;
6108// m_thisAgentUpdateArgs.SessionID = x.SessionID;
6109 m_thisAgentUpdateArgs.State = x.State;
6110
6111 UpdateAgent handlerAgentUpdate = OnAgentUpdate;
6112 UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate;
6113
5924 if (handlerPreAgentUpdate != null) 6114 if (handlerPreAgentUpdate != null)
5925 OnPreAgentUpdate(this, m_thisAgentUpdateArgs); 6115 OnPreAgentUpdate(this, m_thisAgentUpdateArgs);
5926 6116
5927 if (handlerAgentUpdate != null) 6117 if (handlerAgentUpdate != null)
5928 OnAgentUpdate(this, m_thisAgentUpdateArgs); 6118 OnAgentUpdate(this, m_thisAgentUpdateArgs);
6119
6120 handlerAgentUpdate = null;
6121 handlerPreAgentUpdate = null;
5929 } 6122 }
6123
5930 // Was there a significant camera(s) change? 6124 // Was there a significant camera(s) change?
5931 if (camera) 6125 if (camera)
6126 {
6127 m_thisAgentUpdateArgs.CameraAtAxis = x.CameraAtAxis;
6128 m_thisAgentUpdateArgs.CameraCenter = x.CameraCenter;
6129 m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis;
6130 m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis;
6131
6132 UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate;
6133
5932 if (handlerAgentCameraUpdate != null) 6134 if (handlerAgentCameraUpdate != null)
5933 handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs); 6135 handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs);
5934 6136
5935 handlerAgentUpdate = null; 6137 handlerAgentCameraUpdate = null;
5936 handlerPreAgentUpdate = null; 6138 }
5937 handlerAgentCameraUpdate = null;
5938 6139
5939 PacketPool.Instance.ReturnPacket(packet); 6140 PacketPool.Instance.ReturnPacket(packet);
5940 6141
@@ -6150,6 +6351,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6150 return true; 6351 return true;
6151 } 6352 }
6152 6353
6354 private bool HandleVelocityInterpolateOff(IClientAPI sender, Packet Pack)
6355 {
6356 VelocityInterpolateOffPacket p = (VelocityInterpolateOffPacket)Pack;
6357 if (p.AgentData.SessionID != SessionId ||
6358 p.AgentData.AgentID != AgentId)
6359 return true;
6360
6361 m_VelocityInterpolate = false;
6362 return true;
6363 }
6364
6365 private bool HandleVelocityInterpolateOn(IClientAPI sender, Packet Pack)
6366 {
6367 VelocityInterpolateOnPacket p = (VelocityInterpolateOnPacket)Pack;
6368 if (p.AgentData.SessionID != SessionId ||
6369 p.AgentData.AgentID != AgentId)
6370 return true;
6371
6372 m_VelocityInterpolate = true;
6373 return true;
6374 }
6375
6376
6153 private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack) 6377 private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack)
6154 { 6378 {
6155 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; 6379 AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
@@ -6503,7 +6727,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6503 { 6727 {
6504 // Note: the ModifyTerrain event handler sends out updated packets before the end of this event. Therefore, 6728 // Note: the ModifyTerrain event handler sends out updated packets before the end of this event. Therefore,
6505 // a simple boolean value should work and perhaps queue up just a few terrain patch packets at the end of the edit. 6729 // a simple boolean value should work and perhaps queue up just a few terrain patch packets at the end of the edit.
6506 m_justEditedTerrain = true; // Prevent terrain packet (Land layer) from being queued, make it unreliable
6507 if (OnModifyTerrain != null) 6730 if (OnModifyTerrain != null)
6508 { 6731 {
6509 for (int i = 0; i < modify.ParcelData.Length; i++) 6732 for (int i = 0; i < modify.ParcelData.Length; i++)
@@ -6519,7 +6742,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6519 } 6742 }
6520 } 6743 }
6521 } 6744 }
6522 m_justEditedTerrain = false; // Queue terrain packet (Land layer) if necessary, make it reliable again
6523 } 6745 }
6524 6746
6525 return true; 6747 return true;
@@ -6581,16 +6803,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6581 for (int i = 0; i < appear.VisualParam.Length; i++) 6803 for (int i = 0; i < appear.VisualParam.Length; i++)
6582 visualparams[i] = appear.VisualParam[i].ParamValue; 6804 visualparams[i] = appear.VisualParam[i].ParamValue;
6583 //var b = appear.WearableData[0]; 6805 //var b = appear.WearableData[0];
6584 6806
6585 Primitive.TextureEntry te = null; 6807 Primitive.TextureEntry te = null;
6586 if (appear.ObjectData.TextureEntry.Length > 1) 6808 if (appear.ObjectData.TextureEntry.Length > 1)
6587 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); 6809 te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length);
6588 6810
6589 WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length]; 6811 WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length];
6590 for (int i=0; i<appear.WearableData.Length;i++) 6812 for (int i=0; i<appear.WearableData.Length;i++)
6591 cacheitems[i] = new WearableCacheItem(){CacheId = appear.WearableData[i].CacheID,TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex)}; 6813 cacheitems[i] = new WearableCacheItem(){
6592 6814 CacheId = appear.WearableData[i].CacheID,
6815 TextureIndex=Convert.ToUInt32(appear.WearableData[i].TextureIndex)
6816 };
6593 6817
6818
6594 6819
6595 handlerSetAppearance(sender, te, visualparams,avSize, cacheitems); 6820 handlerSetAppearance(sender, te, visualparams,avSize, cacheitems);
6596 } 6821 }
@@ -6794,13 +7019,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6794 return true; 7019 return true;
6795 } 7020 }
6796 7021
6797 private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) 7022 private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack)
6798 { 7023 {
7024 m_log.DebugFormat("[LLClientView] HandleCompleteAgentMovement");
7025
6799 Action<IClientAPI, bool> handlerCompleteMovementToRegion = OnCompleteMovementToRegion; 7026 Action<IClientAPI, bool> handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
6800 if (handlerCompleteMovementToRegion != null) 7027 if (handlerCompleteMovementToRegion != null)
6801 { 7028 {
6802 handlerCompleteMovementToRegion(sender, true); 7029 handlerCompleteMovementToRegion(sender, true);
6803 } 7030 }
7031 else
7032 m_log.Debug("HandleCompleteAgentMovement NULL handler");
7033
6804 handlerCompleteMovementToRegion = null; 7034 handlerCompleteMovementToRegion = null;
6805 7035
6806 return true; 7036 return true;
@@ -6818,7 +7048,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6818 return true; 7048 return true;
6819 } 7049 }
6820 #endregion 7050 #endregion
6821 7051/*
6822 StartAnim handlerStartAnim = null; 7052 StartAnim handlerStartAnim = null;
6823 StopAnim handlerStopAnim = null; 7053 StopAnim handlerStopAnim = null;
6824 7054
@@ -6842,6 +7072,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6842 } 7072 }
6843 } 7073 }
6844 return true; 7074 return true;
7075*/
7076 ChangeAnim handlerChangeAnim = null;
7077
7078 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
7079 {
7080 handlerChangeAnim = OnChangeAnim;
7081 if (handlerChangeAnim != null)
7082 {
7083 handlerChangeAnim(AgentAni.AnimationList[i].AnimID, AgentAni.AnimationList[i].StartAnim, false);
7084 }
7085 }
7086
7087 handlerChangeAnim = OnChangeAnim;
7088 if (handlerChangeAnim != null)
7089 {
7090 handlerChangeAnim(UUID.Zero, false, true);
7091 }
7092
7093 return true;
6845 } 7094 }
6846 7095
6847 private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) 7096 private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack)
@@ -7087,6 +7336,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7087 #endregion 7336 #endregion
7088 7337
7089 m_udpClient.SetThrottles(atpack.Throttle.Throttles); 7338 m_udpClient.SetThrottles(atpack.Throttle.Throttles);
7339 GenericCall2 handler = OnUpdateThrottles;
7340 if (handler != null)
7341 {
7342 handler();
7343 }
7090 return true; 7344 return true;
7091 } 7345 }
7092 7346
@@ -7359,6 +7613,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7359 7613
7360 for (int i = 0; i < incomingselect.ObjectData.Length; i++) 7614 for (int i = 0; i < incomingselect.ObjectData.Length; i++)
7361 { 7615 {
7616 if (!SelectedObjects.Contains(incomingselect.ObjectData[i].ObjectLocalID))
7617 SelectedObjects.Add(incomingselect.ObjectData[i].ObjectLocalID);
7362 handlerObjectSelect = OnObjectSelect; 7618 handlerObjectSelect = OnObjectSelect;
7363 if (handlerObjectSelect != null) 7619 if (handlerObjectSelect != null)
7364 { 7620 {
@@ -7385,6 +7641,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7385 7641
7386 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) 7642 for (int i = 0; i < incomingdeselect.ObjectData.Length; i++)
7387 { 7643 {
7644 if (!SelectedObjects.Contains(incomingdeselect.ObjectData[i].ObjectLocalID))
7645 SelectedObjects.Add(incomingdeselect.ObjectData[i].ObjectLocalID);
7388 handlerObjectDeselect = OnObjectDeselect; 7646 handlerObjectDeselect = OnObjectDeselect;
7389 if (handlerObjectDeselect != null) 7647 if (handlerObjectDeselect != null)
7390 { 7648 {
@@ -7511,7 +7769,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7511 physdata.Bounce = phsblock.Restitution; 7769 physdata.Bounce = phsblock.Restitution;
7512 physdata.Density = phsblock.Density; 7770 physdata.Density = phsblock.Density;
7513 physdata.Friction = phsblock.Friction; 7771 physdata.Friction = phsblock.Friction;
7514 physdata.GravitationModifier = phsblock.GravityMultiplier; 7772 physdata.GravitationModifier = phsblock.GravityMultiplier;
7515 } 7773 }
7516 7774
7517 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); 7775 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this);
@@ -8097,6 +8355,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8097 // surrounding scene 8355 // surrounding scene
8098 if ((ImageType)block.Type == ImageType.Baked) 8356 if ((ImageType)block.Type == ImageType.Baked)
8099 args.Priority *= 2.0f; 8357 args.Priority *= 2.0f;
8358 int wearableout = 0;
8100 8359
8101 ImageManager.EnqueueReq(args); 8360 ImageManager.EnqueueReq(args);
8102 } 8361 }
@@ -9106,7 +9365,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9106 if ((locX >= m_scene.RegionInfo.WorldLocX) 9365 if ((locX >= m_scene.RegionInfo.WorldLocX)
9107 && (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX)) 9366 && (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX))
9108 && (locY >= m_scene.RegionInfo.WorldLocY) 9367 && (locY >= m_scene.RegionInfo.WorldLocY)
9368<<<<<<< HEAD
9109 && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)) ) 9369 && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)) )
9370=======
9371 && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)))
9372>>>>>>> avn/ubitvar
9110 { 9373 {
9111 tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle; 9374 tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle;
9112 tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX; 9375 tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX;
@@ -9146,16 +9409,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9146 9409
9147 #region Parcel related packets 9410 #region Parcel related packets
9148 9411
9412 // acumulate several HandleRegionHandleRequest consecutive overlaping requests
9413 // to be done with minimal resources as possible
9414 // variables temporary here while in test
9415
9416 Queue<UUID> RegionHandleRequests = new Queue<UUID>();
9417 bool RegionHandleRequestsInService = false;
9418
9149 private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) 9419 private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack)
9150 { 9420 {
9151 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; 9421 UUID currentUUID;
9152 9422
9153 RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; 9423 RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest;
9154 if (handlerRegionHandleRequest != null) 9424
9425 if (handlerRegionHandleRequest == null)
9426 return true;
9427
9428 RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack;
9429
9430 lock (RegionHandleRequests)
9431 {
9432 if (RegionHandleRequestsInService)
9433 {
9434 // we are already busy doing a previus request
9435 // so enqueue it
9436 RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID);
9437 return true;
9438 }
9439
9440 // else do it
9441 currentUUID = rhrPack.RequestBlock.RegionID;
9442 RegionHandleRequestsInService = true;
9443 }
9444
9445 while (true)
9155 { 9446 {
9156 handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); 9447 handlerRegionHandleRequest(this, currentUUID);
9448
9449 lock (RegionHandleRequests)
9450 {
9451 // exit condition, nothing to do or closed
9452 // current code seems to assume we may loose the handler at anytime,
9453 // so keep checking it
9454 handlerRegionHandleRequest = OnRegionHandleRequest;
9455
9456 if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null)
9457 {
9458 RegionHandleRequests.Clear();
9459 RegionHandleRequestsInService = false;
9460 return true;
9461 }
9462 currentUUID = RegionHandleRequests.Dequeue();
9463 }
9157 } 9464 }
9158 return true; 9465
9466 return true; // actually unreached
9159 } 9467 }
9160 9468
9161 private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) 9469 private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack)
@@ -10425,7 +10733,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10425 handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, 10733 handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID,
10426 Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), 10734 Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName),
10427 UpdateMuteListEntry.MuteData.MuteType, 10735 UpdateMuteListEntry.MuteData.MuteType,
10428 UpdateMuteListEntry.AgentData.AgentID); 10736 UpdateMuteListEntry.MuteData.MuteFlags);
10429 return true; 10737 return true;
10430 } 10738 }
10431 return false; 10739 return false;
@@ -10440,8 +10748,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10440 { 10748 {
10441 handlerRemoveMuteListEntry(this, 10749 handlerRemoveMuteListEntry(this,
10442 RemoveMuteListEntry.MuteData.MuteID, 10750 RemoveMuteListEntry.MuteData.MuteID,
10443 Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName), 10751 Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName));
10444 RemoveMuteListEntry.AgentData.AgentID);
10445 return true; 10752 return true;
10446 } 10753 }
10447 return false; 10754 return false;
@@ -10485,10 +10792,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10485 return false; 10792 return false;
10486 } 10793 }
10487 10794
10795 private bool HandleChangeInventoryItemFlags(IClientAPI client, Packet packet)
10796 {
10797 ChangeInventoryItemFlagsPacket ChangeInventoryItemFlags =
10798 (ChangeInventoryItemFlagsPacket)packet;
10799 ChangeInventoryItemFlags handlerChangeInventoryItemFlags = OnChangeInventoryItemFlags;
10800 if (handlerChangeInventoryItemFlags != null)
10801 {
10802 foreach(ChangeInventoryItemFlagsPacket.InventoryDataBlock b in ChangeInventoryItemFlags.InventoryData)
10803 handlerChangeInventoryItemFlags(this, b.ItemID, b.Flags);
10804 return true;
10805 }
10806 return false;
10807 }
10808
10488 private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) 10809 private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack)
10489 { 10810 {
10490 return true; 10811 return true;
10491 } 10812 }
10813
10814 private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack)
10815 {
10816 CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack;
10817
10818 #region Packet Session and User Check
10819 if (m_checkPackets)
10820 {
10821 if (packet.AgentData.SessionID != SessionId ||
10822 packet.AgentData.AgentID != AgentId)
10823 return true;
10824 }
10825 #endregion
10826 MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null;
10827 List<InventoryItemBase> items = new List<InventoryItemBase>();
10828 foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData)
10829 {
10830 InventoryItemBase b = new InventoryItemBase();
10831 b.ID = n.OldItemID;
10832 b.Folder = n.OldFolderID;
10833 items.Add(b);
10834 }
10835
10836 handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy;
10837 if (handlerMoveItemsAndLeaveCopy != null)
10838 {
10839 handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID);
10840 }
10841
10842 return true;
10843 }
10492 10844
10493 private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) 10845 private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack)
10494 { 10846 {
@@ -10915,6 +11267,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10915 groupProfileReply.GroupData.MaturePublish = d.MaturePublish; 11267 groupProfileReply.GroupData.MaturePublish = d.MaturePublish;
10916 groupProfileReply.GroupData.OwnerRole = d.OwnerRole; 11268 groupProfileReply.GroupData.OwnerRole = d.OwnerRole;
10917 11269
11270 Scene scene = (Scene)m_scene;
11271 if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID)))
11272 {
11273 ScenePresence p;
11274 if (scene.TryGetScenePresence(sender.AgentId, out p))
11275 {
11276 if (p.GodLevel >= 200)
11277 {
11278 groupProfileReply.GroupData.OpenEnrollment = true;
11279 groupProfileReply.GroupData.MembershipFee = 0;
11280 }
11281 }
11282 }
11283
10918 OutPacket(groupProfileReply, ThrottleOutPacketType.Task); 11284 OutPacket(groupProfileReply, ThrottleOutPacketType.Task);
10919 } 11285 }
10920 return true; 11286 return true;
@@ -11488,11 +11854,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11488 11854
11489 StartLure handlerStartLure = OnStartLure; 11855 StartLure handlerStartLure = OnStartLure;
11490 if (handlerStartLure != null) 11856 if (handlerStartLure != null)
11491 handlerStartLure(startLureRequest.Info.LureType, 11857 {
11492 Utils.BytesToString( 11858 for (int i = 0 ; i < startLureRequest.TargetData.Length ; i++)
11493 startLureRequest.Info.Message), 11859 {
11494 startLureRequest.TargetData[0].TargetID, 11860 handlerStartLure(startLureRequest.Info.LureType,
11495 this); 11861 Utils.BytesToString(
11862 startLureRequest.Info.Message),
11863 startLureRequest.TargetData[i].TargetID,
11864 this);
11865 }
11866 }
11496 return true; 11867 return true;
11497 } 11868 }
11498 private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) 11869 private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack)
@@ -11606,10 +11977,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11606 } 11977 }
11607 #endregion 11978 #endregion
11608 11979
11609 ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; 11980 ClassifiedGodDelete handlerClassifiedGodDelete = OnClassifiedGodDelete;
11610 if (handlerClassifiedGodDelete != null) 11981 if (handlerClassifiedGodDelete != null)
11611 handlerClassifiedGodDelete( 11982 handlerClassifiedGodDelete(
11612 classifiedGodDelete.Data.ClassifiedID, 11983 classifiedGodDelete.Data.ClassifiedID,
11984 classifiedGodDelete.Data.QueryID,
11613 this); 11985 this);
11614 return true; 11986 return true;
11615 } 11987 }
@@ -11912,13 +12284,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11912 /// <param name="simclient"></param> 12284 /// <param name="simclient"></param>
11913 /// <param name="packet"></param> 12285 /// <param name="packet"></param>
11914 /// <returns></returns> 12286 /// <returns></returns>
11915 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) 12287 // TODO: Convert old handler to use new method
12288 /*protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
11916 { 12289 {
11917 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; 12290 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
11918 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); 12291 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
11919 12292
11920 if (cachedtex.AgentData.SessionID != SessionId) 12293 if (cachedtex.AgentData.SessionID != SessionId)
11921 return false; 12294 return false;
12295
11922 12296
11923 12297
11924 // TODO: don't create new blocks if recycling an old packet 12298 // TODO: don't create new blocks if recycling an old packet
@@ -11966,6 +12340,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11966 } 12340 }
11967 } 12341 }
11968 12342
12343<<<<<<< HEAD
11969 if (cacheItems != null) 12344 if (cacheItems != null)
11970 { 12345 {
11971 // We need to make sure the asset stored in the bake is available on this server also by its assetid before we map it to a Cacheid. 12346 // We need to make sure the asset stored in the bake is available on this server also by its assetid before we map it to a Cacheid.
@@ -11985,13 +12360,69 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11985 { 12360 {
11986 WearableCacheItem item = 12361 WearableCacheItem item =
11987 WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex, cacheItems); 12362 WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex, cacheItems);
12363=======
12364 CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest;
12365 if (handlerCachedTextureRequest != null)
12366 {
12367 handlerCachedTextureRequest(simclient,cachedtex.AgentData.SerialNum,requestArgs);
12368 }
12369
12370 return true;
12371 }*/
12372
12373 protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
12374 {
12375 //m_log.Debug("texture cached: " + packet.ToString());
12376 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
12377 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
12378
12379 if (cachedtex.AgentData.SessionID != SessionId)
12380 return false;
12381
12382 // TODO: don't create new blocks if recycling an old packet
12383 cachedresp.AgentData.AgentID = AgentId;
12384 cachedresp.AgentData.SessionID = m_sessionId;
12385 cachedresp.AgentData.SerialNum = cachedtex.AgentData.SerialNum;
12386 cachedresp.WearableData =
12387 new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length];
12388
12389 int maxWearablesLoop = cachedtex.WearableData.Length;
12390 if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES)
12391 maxWearablesLoop = AvatarWearable.MAX_WEARABLES;
12392
12393 int cacheHits = 0;
12394
12395 // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid
12396
12397 WearableCacheItem[] cacheItems = null;
12398
12399 ScenePresence p = m_scene.GetScenePresence(AgentId);
12400
12401 if (p != null && p.Appearance != null)
12402 {
12403 cacheItems = p.Appearance.WearableCacheItems;
12404 }
12405
12406 if (cacheItems != null)
12407 {
12408 for (int i = 0; i < maxWearablesLoop; i++)
12409 {
12410 int idx = cachedtex.WearableData[i].TextureIndex;
12411>>>>>>> avn/ubitvar
11988 12412
11989 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); 12413 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11990 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; 12414 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11991 cachedresp.WearableData[i].HostName = new byte[0]; 12415 cachedresp.WearableData[i].HostName = new byte[0];
12416<<<<<<< HEAD
11992 if (item != null && cachedtex.WearableData[i].ID == item.CacheId) 12417 if (item != null && cachedtex.WearableData[i].ID == item.CacheId)
11993 { 12418 {
11994 cachedresp.WearableData[i].TextureID = item.TextureID; 12419 cachedresp.WearableData[i].TextureID = item.TextureID;
12420=======
12421 if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId)
12422 {
12423 cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID;
12424 cacheHits++;
12425>>>>>>> avn/ubitvar
11995 } 12426 }
11996 else 12427 else
11997 { 12428 {
@@ -12001,22 +12432,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12001 } 12432 }
12002 else 12433 else
12003 { 12434 {
12435<<<<<<< HEAD
12004 // Cached textures not available 12436 // Cached textures not available
12437=======
12438>>>>>>> avn/ubitvar
12005 for (int i = 0; i < maxWearablesLoop; i++) 12439 for (int i = 0; i < maxWearablesLoop; i++)
12006 { 12440 {
12007 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); 12441 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
12008 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; 12442 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
12009 cachedresp.WearableData[i].TextureID = UUID.Zero; 12443 cachedresp.WearableData[i].TextureID = UUID.Zero;
12444<<<<<<< HEAD
12010 cachedresp.WearableData[i].HostName = new byte[0]; 12445 cachedresp.WearableData[i].HostName = new byte[0];
12011 } 12446 }
12012 } 12447 }
12013 12448
12449=======
12450 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
12451 cachedresp.WearableData[i].HostName = new byte[0];
12452 }
12453 }
12454
12455 m_log.DebugFormat("texture cached: hits {0}", cacheHits);
12456
12457>>>>>>> avn/ubitvar
12014 cachedresp.Header.Zerocoded = true; 12458 cachedresp.Header.Zerocoded = true;
12015 OutPacket(cachedresp, ThrottleOutPacketType.Task); 12459 OutPacket(cachedresp, ThrottleOutPacketType.Task);
12016 12460
12017 return true; 12461 return true;
12018 } 12462 }
12019 12463
12020 /// <summary> 12464 /// <summary>
12021 /// Send a response back to a client when it asks the asset server (via the region server) if it has 12465 /// Send a response back to a client when it asks the asset server (via the region server) if it has
12022 /// its appearance texture cached. 12466 /// its appearance texture cached.
@@ -12080,209 +12524,147 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12080 } 12524 }
12081 else 12525 else
12082 { 12526 {
12083// m_log.DebugFormat( 12527 ClientChangeObject updatehandler = onClientChangeObject;
12084// "[CLIENT]: Processing block {0} type {1} for {2} {3}",
12085// i, block.Type, part.Name, part.LocalId);
12086 12528
12087// // Do this once since fetch parts creates a new array. 12529 if (updatehandler != null)
12088// SceneObjectPart[] parts = part.ParentGroup.Parts; 12530 {
12089// for (int j = 0; j < parts.Length; j++) 12531 ObjectChangeData udata = new ObjectChangeData();
12090// {
12091// part.StoreUndoState();
12092// parts[j].IgnoreUndoUpdate = true;
12093// }
12094 12532
12095 UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; 12533 /*ubit from ll JIRA:
12534 * 0x01 position
12535 * 0x02 rotation
12536 * 0x04 scale
12537
12538 * 0x08 LINK_SET
12539 * 0x10 UNIFORM for scale
12540 */
12096 12541
12097 switch (block.Type) 12542 // translate to internal changes
12098 { 12543 // not all cases .. just the ones older code did
12099 case 1:
12100 Vector3 pos1 = new Vector3(block.Data, 0);
12101 12544
12102 UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 12545 switch (block.Type)
12103 if (handlerUpdatePrimSinglePosition != null) 12546 {
12104 { 12547 case 1: //change position sp
12105 // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 12548 udata.position = new Vector3(block.Data, 0);
12106 handlerUpdatePrimSinglePosition(localId, pos1, this);
12107 }
12108 break;
12109 12549
12110 case 2: 12550 udata.change = ObjectChangeType.primP;
12111 Quaternion rot1 = new Quaternion(block.Data, 0, true); 12551 updatehandler(localId, udata, this);
12552 break;
12112 12553
12113 UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; 12554 case 2: // rotation sp
12114 if (handlerUpdatePrimSingleRotation != null) 12555 udata.rotation = new Quaternion(block.Data, 0, true);
12115 {
12116 // m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W);
12117 handlerUpdatePrimSingleRotation(localId, rot1, this);
12118 }
12119 break;
12120 12556
12121 case 3: 12557 udata.change = ObjectChangeType.primR;
12122 Vector3 rotPos = new Vector3(block.Data, 0); 12558 updatehandler(localId, udata, this);
12123 Quaternion rot2 = new Quaternion(block.Data, 12, true); 12559 break;
12124 12560
12125 UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition; 12561 case 3: // position plus rotation
12126 if (handlerUpdatePrimSingleRotationPosition != null) 12562 udata.position = new Vector3(block.Data, 0);
12127 { 12563 udata.rotation = new Quaternion(block.Data, 12, true);
12128 // m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z);
12129 // m_log.Info("new mouse rotation is " + rot2.X + " , " + rot2.Y + " , " + rot2.Z + " , " + rot2.W);
12130 handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this);
12131 }
12132 break;
12133 12564
12134 case 4: 12565 udata.change = ObjectChangeType.primPR;
12135 case 20: 12566 updatehandler(localId, udata, this);
12136 Vector3 scale4 = new Vector3(block.Data, 0); 12567 break;
12137 12568
12138 UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale; 12569 case 4: // scale sp
12139 if (handlerUpdatePrimScale != null) 12570 udata.scale = new Vector3(block.Data, 0);
12140 { 12571 udata.change = ObjectChangeType.primS;
12141 // m_log.Debug("new scale is " + scale4.X + " , " + scale4.Y + " , " + scale4.Z);
12142 handlerUpdatePrimScale(localId, scale4, this);
12143 }
12144 break;
12145 12572
12146 case 5: 12573 updatehandler(localId, udata, this);
12147 Vector3 scale1 = new Vector3(block.Data, 12); 12574 break;
12148 Vector3 pos11 = new Vector3(block.Data, 0);
12149 12575
12150 handlerUpdatePrimScale = OnUpdatePrimScale; 12576 case 0x14: // uniform scale sp
12151 if (handlerUpdatePrimScale != null) 12577 udata.scale = new Vector3(block.Data, 0);
12152 {
12153 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
12154 handlerUpdatePrimScale(localId, scale1, this);
12155 12578
12156 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 12579 udata.change = ObjectChangeType.primUS;
12157 if (handlerUpdatePrimSinglePosition != null) 12580 updatehandler(localId, udata, this);
12158 { 12581 break;
12159 handlerUpdatePrimSinglePosition(localId, pos11, this);
12160 }
12161 }
12162 break;
12163 12582
12164 case 9: 12583 case 5: // scale and position sp
12165 Vector3 pos2 = new Vector3(block.Data, 0); 12584 udata.position = new Vector3(block.Data, 0);
12585 udata.scale = new Vector3(block.Data, 12);
12166 12586
12167 UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; 12587 udata.change = ObjectChangeType.primPS;
12588 updatehandler(localId, udata, this);
12589 break;
12168 12590
12169 if (handlerUpdateVector != null) 12591 case 0x15: //uniform scale and position
12170 { 12592 udata.position = new Vector3(block.Data, 0);
12171 handlerUpdateVector(localId, pos2, this); 12593 udata.scale = new Vector3(block.Data, 12);
12172 }
12173 break;
12174 12594
12175 case 10: 12595 udata.change = ObjectChangeType.primPUS;
12176 Quaternion rot3 = new Quaternion(block.Data, 0, true); 12596 updatehandler(localId, udata, this);
12597 break;
12177 12598
12178 UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; 12599 // now group related (bit 4)
12179 if (handlerUpdatePrimRotation != null) 12600 case 9: //( 8 + 1 )group position
12180 { 12601 udata.position = new Vector3(block.Data, 0);
12181 // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W);
12182 handlerUpdatePrimRotation(localId, rot3, this);
12183 }
12184 break;
12185 12602
12186 case 11: 12603 udata.change = ObjectChangeType.groupP;
12187 Vector3 pos3 = new Vector3(block.Data, 0); 12604 updatehandler(localId, udata, this);
12188 Quaternion rot4 = new Quaternion(block.Data, 12, true); 12605 break;
12189 12606
12190 handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; 12607 case 0x0A: // (8 + 2) group rotation
12191 if (handlerUpdatePrimGroupRotation != null) 12608 udata.rotation = new Quaternion(block.Data, 0, true);
12192 {
12193 // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
12194 // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W);
12195 handlerUpdatePrimGroupRotation(localId, pos3, rot4, this);
12196 }
12197 break;
12198 case 12:
12199 case 28:
12200 Vector3 scale7 = new Vector3(block.Data, 0);
12201 12609
12202 UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; 12610 udata.change = ObjectChangeType.groupR;
12203 if (handlerUpdatePrimGroupScale != null) 12611 updatehandler(localId, udata, this);
12204 { 12612 break;
12205 // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z);
12206 handlerUpdatePrimGroupScale(localId, scale7, this);
12207 }
12208 break;
12209 12613
12210 case 13: 12614 case 0x0B: //( 8 + 2 + 1) group rotation and position
12211 Vector3 scale2 = new Vector3(block.Data, 12); 12615 udata.position = new Vector3(block.Data, 0);
12212 Vector3 pos4 = new Vector3(block.Data, 0); 12616 udata.rotation = new Quaternion(block.Data, 12, true);
12213 12617
12214 handlerUpdatePrimScale = OnUpdatePrimScale; 12618 udata.change = ObjectChangeType.groupPR;
12215 if (handlerUpdatePrimScale != null) 12619 updatehandler(localId, udata, this);
12216 { 12620 break;
12217 //m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
12218 handlerUpdatePrimScale(localId, scale2, this);
12219 12621
12220 // Change the position based on scale (for bug number 246) 12622 case 0x0C: // (8 + 4) group scale
12221 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 12623 // only afects root prim and only sent by viewer editor object tab scaling
12222 // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 12624 // mouse edition only allows uniform scaling
12223 if (handlerUpdatePrimSinglePosition != null) 12625 // SL MAY CHANGE THIS in viewers
12224 {
12225 handlerUpdatePrimSinglePosition(localId, pos4, this);
12226 }
12227 }
12228 break;
12229 12626
12230 case 29: 12627 udata.scale = new Vector3(block.Data, 0);
12231 Vector3 scale5 = new Vector3(block.Data, 12);
12232 Vector3 pos5 = new Vector3(block.Data, 0);
12233 12628
12234 handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; 12629 udata.change = ObjectChangeType.groupS;
12235 if (handlerUpdatePrimGroupScale != null) 12630 updatehandler(localId, udata, this);
12236 {
12237 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
12238 part.StoreUndoState(true);
12239 part.IgnoreUndoUpdate = true;
12240 handlerUpdatePrimGroupScale(localId, scale5, this);
12241 handlerUpdateVector = OnUpdatePrimGroupPosition;
12242 12631
12243 if (handlerUpdateVector != null) 12632 break;
12244 {
12245 handlerUpdateVector(localId, pos5, this);
12246 }
12247 12633
12248 part.IgnoreUndoUpdate = false; 12634 case 0x0D: //(8 + 4 + 1) group scale and position
12249 } 12635 // exception as above
12250 12636
12251 break; 12637 udata.position = new Vector3(block.Data, 0);
12638 udata.scale = new Vector3(block.Data, 12);
12252 12639
12253 case 21: 12640 udata.change = ObjectChangeType.groupPS;
12254 Vector3 scale6 = new Vector3(block.Data, 12); 12641 updatehandler(localId, udata, this);
12255 Vector3 pos6 = new Vector3(block.Data, 0); 12642 break;
12256 12643
12257 handlerUpdatePrimScale = OnUpdatePrimScale; 12644 case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM
12258 if (handlerUpdatePrimScale != null) 12645 udata.scale = new Vector3(block.Data, 0);
12259 {
12260 part.StoreUndoState(false);
12261 part.IgnoreUndoUpdate = true;
12262 12646
12263 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); 12647 udata.change = ObjectChangeType.groupUS;
12264 handlerUpdatePrimScale(localId, scale6, this); 12648 updatehandler(localId, udata, this);
12265 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; 12649 break;
12266 if (handlerUpdatePrimSinglePosition != null)
12267 {
12268 handlerUpdatePrimSinglePosition(localId, pos6, this);
12269 }
12270 12650
12271 part.IgnoreUndoUpdate = false; 12651 case 0x1D: // (UNIFORM + GROUP + SCALE + POS)
12272 } 12652 udata.position = new Vector3(block.Data, 0);
12273 break; 12653 udata.scale = new Vector3(block.Data, 12);
12274 12654
12275 default: 12655 udata.change = ObjectChangeType.groupPUS;
12276 m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); 12656 updatehandler(localId, udata, this);
12277 break; 12657 break;
12658
12659 default:
12660 m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type));
12661 break;
12662 }
12278 } 12663 }
12279 12664
12280// for (int j = 0; j < parts.Length; j++)
12281// parts[j].IgnoreUndoUpdate = false;
12282 } 12665 }
12283 } 12666 }
12284 } 12667 }
12285
12286 return true; 12668 return true;
12287 } 12669 }
12288 12670
@@ -12342,7 +12724,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12342 /// <param name="throttles"></param> 12724 /// <param name="throttles"></param>
12343 public void SetChildAgentThrottle(byte[] throttles) 12725 public void SetChildAgentThrottle(byte[] throttles)
12344 { 12726 {
12345 m_udpClient.SetThrottles(throttles); 12727 SetChildAgentThrottle(throttles, 1.0f);
12728 }
12729
12730 public void SetChildAgentThrottle(byte[] throttles,float factor)
12731 {
12732 m_udpClient.SetThrottles(throttles, factor);
12733 GenericCall2 handler = OnUpdateThrottles;
12734 if (handler != null)
12735 {
12736 handler();
12737 }
12738 }
12739
12740 /// <summary>
12741 /// Sets the throttles from values supplied caller
12742 /// </summary>
12743 /// <param name="throttles"></param>
12744 public void SetAgentThrottleSilent(int throttle, int setting)
12745 {
12746 m_udpClient.ForceThrottleSetting(throttle,setting);
12747 }
12748
12749 public int GetAgentThrottleSilent(int throttle)
12750 {
12751 return m_udpClient.GetThrottleSetting(throttle);
12346 } 12752 }
12347 12753
12348 /// <summary> 12754 /// <summary>
@@ -12450,8 +12856,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12450 uint regionY = 0; 12856 uint regionY = 0;
12451 12857
12452 Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out regionX, out regionY); 12858 Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out regionX, out regionY);
12453 locx = Convert.ToSingle(args[0]) - (float)regionX; 12859 locx = (float)(Convert.ToDouble(args[0]) - (double)regionX);
12454 locy = Convert.ToSingle(args[1]) - (float)regionY; 12860 locy = (float)(Convert.ToDouble(args[1]) - (double)regionY);
12455 locz = Convert.ToSingle(args[2]); 12861 locz = Convert.ToSingle(args[2]);
12456 12862
12457 Action<Vector3, bool, bool> handlerAutoPilotGo = OnAutoPilotGo; 12863 Action<Vector3, bool, bool> handlerAutoPilotGo = OnAutoPilotGo;
@@ -12736,7 +13142,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12736// "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}", 13142// "[LLCLIENTVIEW]: Received transfer request for {0} in {1} type {2} by {3}",
12737// requestID, taskID, (SourceType)sourceType, Name); 13143// requestID, taskID, (SourceType)sourceType, Name);
12738 13144
13145
13146 //Note, the bool returned from the below function is useless since it is always false.
12739 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); 13147 m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
13148
12740 } 13149 }
12741 13150
12742 /// <summary> 13151 /// <summary>
@@ -12819,7 +13228,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12819 /// <returns></returns> 13228 /// <returns></returns>
12820 private static int CalculateNumPackets(byte[] data) 13229 private static int CalculateNumPackets(byte[] data)
12821 { 13230 {
12822 const uint m_maxPacketSize = 600; 13231// const uint m_maxPacketSize = 600;
13232 uint m_maxPacketSize = MaxTransferBytesPerPacket;
12823 int numPackets = 1; 13233 int numPackets = 1;
12824 13234
12825 if (data == null) 13235 if (data == null)