aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs52
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs29
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs41
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs3
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs2
-rwxr-xr-xOpenSim/Region/Framework/Scenes/SceneGraph.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs2
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs10
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs23
13 files changed, 122 insertions, 105 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 1091078..54359eb 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -325,6 +325,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
325 /// </summary> 325 /// </summary>
326 public LLImageManager ImageManager { get; private set; } 326 public LLImageManager ImageManager { get; private set; }
327 327
328 public JobEngine m_asyncPacketProcess;
328 private readonly LLUDPServer m_udpServer; 329 private readonly LLUDPServer m_udpServer;
329 private readonly LLUDPClient m_udpClient; 330 private readonly LLUDPClient m_udpClient;
330 private readonly UUID m_sessionId; 331 private readonly UUID m_sessionId;
@@ -378,7 +379,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
378 protected Scene m_scene; 379 protected Scene m_scene;
379 protected string m_firstName; 380 protected string m_firstName;
380 protected string m_lastName; 381 protected string m_lastName;
381 protected Thread m_clientThread;
382 protected Vector3 m_startpos; 382 protected Vector3 m_startpos;
383 protected UUID m_activeGroupID; 383 protected UUID m_activeGroupID;
384 protected string m_activeGroupName = String.Empty; 384 protected string m_activeGroupName = String.Empty;
@@ -529,7 +529,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
529 m_prioritizer = new Prioritizer(m_scene); 529 m_prioritizer = new Prioritizer(m_scene);
530 530
531 RegisterLocalPacketHandlers(); 531 RegisterLocalPacketHandlers();
532 532 string name = string.Format("AsyncInUDP-{0}",m_agentId.ToString());
533 m_asyncPacketProcess = new JobEngine(name, name, 10000);
533 IsActive = true; 534 IsActive = true;
534 } 535 }
535 536
@@ -592,6 +593,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
592 if (OnConnectionClosed != null) 593 if (OnConnectionClosed != null)
593 OnConnectionClosed(this); 594 OnConnectionClosed(this);
594 595
596 m_asyncPacketProcess.Stop();
595 597
596 // Flush all of the packets out of the UDP server for this client 598 // Flush all of the packets out of the UDP server for this client
597 if (m_udpServer != null) 599 if (m_udpServer != null)
@@ -778,12 +780,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
778 cinfo.AsyncRequests[packet.Type.ToString()]++; 780 cinfo.AsyncRequests[packet.Type.ToString()]++;
779 781
780 object obj = new AsyncPacketProcess(this, pprocessor.method, packet); 782 object obj = new AsyncPacketProcess(this, pprocessor.method, packet);
781 783/*
782 if (pprocessor.InEngine) 784 if (pprocessor.InEngine)
783 m_udpServer.IpahEngine.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj)); 785 m_udpServer.IpahEngine.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj));
784 else 786 else
785 Util.FireAndForget(ProcessSpecificPacketAsync, obj, packet.Type.ToString()); 787 Util.FireAndForget(ProcessSpecificPacketAsync, obj, packet.Type.ToString());
786 788*/
789 m_asyncPacketProcess.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj));
787 result = true; 790 result = true;
788 } 791 }
789 else 792 else
@@ -841,6 +844,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
841 844
842 public virtual void Start() 845 public virtual void Start()
843 { 846 {
847 m_asyncPacketProcess.Start();
844 m_scene.AddNewAgent(this, PresenceType.User); 848 m_scene.AddNewAgent(this, PresenceType.User);
845 849
846// RefreshGroupMembership(); 850// RefreshGroupMembership();
@@ -6036,8 +6040,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6036 AddLocalPacketHandler(PacketType.ObjectExtraParams, HandleObjectExtraParams); 6040 AddLocalPacketHandler(PacketType.ObjectExtraParams, HandleObjectExtraParams);
6037 AddLocalPacketHandler(PacketType.ObjectDuplicate, HandleObjectDuplicate); 6041 AddLocalPacketHandler(PacketType.ObjectDuplicate, HandleObjectDuplicate);
6038 AddLocalPacketHandler(PacketType.RequestMultipleObjects, HandleRequestMultipleObjects); 6042 AddLocalPacketHandler(PacketType.RequestMultipleObjects, HandleRequestMultipleObjects);
6039 AddLocalPacketHandler(PacketType.ObjectSelect, HandleObjectSelect); 6043 AddLocalPacketHandler(PacketType.ObjectSelect, HandleObjectSelect, true, true);
6040 AddLocalPacketHandler(PacketType.ObjectDeselect, HandleObjectDeselect); 6044 AddLocalPacketHandler(PacketType.ObjectDeselect, HandleObjectDeselect, true, true);
6041 AddLocalPacketHandler(PacketType.ObjectPosition, HandleObjectPosition); 6045 AddLocalPacketHandler(PacketType.ObjectPosition, HandleObjectPosition);
6042 AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale); 6046 AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale);
6043 AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation); 6047 AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation);
@@ -8030,19 +8034,41 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8030 return true; 8034 return true;
8031 } 8035 }
8032 8036
8037 Dictionary<uint, uint> objImageSeqs = null;
8038 double lastobjImageSeqsMS = 0.0;
8039
8033 private bool HandleObjectImage(IClientAPI sender, Packet Pack) 8040 private bool HandleObjectImage(IClientAPI sender, Packet Pack)
8034 { 8041 {
8035 ObjectImagePacket imagePack = (ObjectImagePacket)Pack; 8042 ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
8036 8043
8037 UpdatePrimTexture handlerUpdatePrimTexture = null; 8044 UpdatePrimTexture handlerUpdatePrimTexture = OnUpdatePrimTexture;
8045 if (handlerUpdatePrimTexture == null)
8046 return true;
8047
8048 double now = Util.GetTimeStampMS();
8049 if(objImageSeqs == null || ( now - lastobjImageSeqsMS > 30000.0))
8050 {
8051 objImageSeqs = null; // yeah i know superstition...
8052 objImageSeqs = new Dictionary<uint, uint>(16);
8053 }
8054
8055 lastobjImageSeqsMS = now;
8056 uint seq = Pack.Header.Sequence;
8057 uint id;
8058 uint lastseq;
8059
8060 ObjectImagePacket.ObjectDataBlock o;
8038 for (int i = 0; i < imagePack.ObjectData.Length; i++) 8061 for (int i = 0; i < imagePack.ObjectData.Length; i++)
8039 { 8062 {
8040 handlerUpdatePrimTexture = OnUpdatePrimTexture; 8063 o = imagePack.ObjectData[i];
8041 if (handlerUpdatePrimTexture != null) 8064 id = o.ObjectLocalID;
8042 { 8065 if(objImageSeqs.TryGetValue(id, out lastseq))
8043 handlerUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, 8066 {
8044 imagePack.ObjectData[i].TextureEntry, this); 8067 if(seq <= lastseq)
8045 } 8068 continue;
8069 }
8070 objImageSeqs[id] = seq;
8071 handlerUpdatePrimTexture(id, o.TextureEntry, this);
8046 } 8072 }
8047 return true; 8073 return true;
8048 } 8074 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index ec51e28..b575ed9 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -312,9 +312,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
312 /// stack. Use zero to leave this value as the default</summary> 312 /// stack. Use zero to leave this value as the default</summary>
313 protected int m_recvBufferSize; 313 protected int m_recvBufferSize;
314 314
315 /// <summary>Flag to process packets asynchronously or synchronously</summary>
316 protected bool m_asyncPacketHandling;
317
318 /// <summary>Tracks whether or not a packet was sent each round so we know 315 /// <summary>Tracks whether or not a packet was sent each round so we know
319 /// whether or not to sleep</summary> 316 /// whether or not to sleep</summary>
320 protected bool m_packetSent; 317 protected bool m_packetSent;
@@ -417,7 +414,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
417 /// Queue some low priority but potentially high volume async requests so that they don't overwhelm available 414 /// Queue some low priority but potentially high volume async requests so that they don't overwhelm available
418 /// threadpool threads. 415 /// threadpool threads.
419 /// </summary> 416 /// </summary>
420 public JobEngine IpahEngine { get; protected set; } 417// public JobEngine IpahEngine { get; protected set; }
421 418
422 /// <summary> 419 /// <summary>
423 /// Run queue empty processing within a single persistent thread. 420 /// Run queue empty processing within a single persistent thread.
@@ -473,7 +470,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
473 IConfig config = configSource.Configs["ClientStack.LindenUDP"]; 470 IConfig config = configSource.Configs["ClientStack.LindenUDP"];
474 if (config != null) 471 if (config != null)
475 { 472 {
476 m_asyncPacketHandling = config.GetBoolean("async_packet_handling", true);
477 m_recvBufferSize = config.GetInt("client_socket_rcvbuf_size", 0); 473 m_recvBufferSize = config.GetInt("client_socket_rcvbuf_size", 0);
478 sceneThrottleBps = config.GetInt("scene_throttle_max_bps", 0); 474 sceneThrottleBps = config.GetInt("scene_throttle_max_bps", 0);
479 475
@@ -531,7 +527,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
531 { 527 {
532 StartInbound(); 528 StartInbound();
533 StartOutbound(); 529 StartOutbound();
534 IpahEngine.Start(); 530// IpahEngine.Start();
535 OqrEngine.Start(); 531 OqrEngine.Start();
536 532
537 m_elapsedMSSinceLastStatReport = Environment.TickCount; 533 m_elapsedMSSinceLastStatReport = Environment.TickCount;
@@ -540,10 +536,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
540 public void StartInbound() 536 public void StartInbound()
541 { 537 {
542 m_log.InfoFormat( 538 m_log.InfoFormat(
543 "[LLUDPSERVER]: Starting inbound packet processing for the LLUDP server in {0} mode with UsePools = {1}", 539 "[LLUDPSERVER]: Starting inbound packet processing for the LLUDP server");
544 m_asyncPacketHandling ? "asynchronous" : "synchronous", UsePools);
545 540
546 base.StartInbound(m_recvBufferSize, m_asyncPacketHandling); 541 base.StartInbound(m_recvBufferSize);
547 542
548 // This thread will process the packets received that are placed on the packetInbox 543 // This thread will process the packets received that are placed on the packetInbox
549 WorkManager.StartThread( 544 WorkManager.StartThread(
@@ -577,7 +572,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
577 m_log.Info("[LLUDPSERVER]: Shutting down the LLUDP server for " + Scene.Name); 572 m_log.Info("[LLUDPSERVER]: Shutting down the LLUDP server for " + Scene.Name);
578 base.StopOutbound(); 573 base.StopOutbound();
579 base.StopInbound(); 574 base.StopInbound();
580 IpahEngine.Stop(); 575// IpahEngine.Stop();
581 OqrEngine.Stop(); 576 OqrEngine.Stop();
582 } 577 }
583 578
@@ -696,12 +691,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
696 691
697 Scene = (Scene)scene; 692 Scene = (Scene)scene;
698 m_location = new Location(Scene.RegionInfo.RegionHandle); 693 m_location = new Location(Scene.RegionInfo.RegionHandle);
699 694/*
700 IpahEngine 695 IpahEngine
701 = new JobEngine( 696 = new JobEngine(
702 string.Format("Incoming Packet Async Handling Engine ({0})", Scene.Name), 697 string.Format("Incoming Packet Async Handling Engine ({0})", Scene.Name),
703 "INCOMING PACKET ASYNC HANDLING ENGINE"); 698 "INCOMING PACKET ASYNC HANDLING ENGINE");
704 699*/
705 OqrEngine 700 OqrEngine
706 = new JobEngine( 701 = new JobEngine(
707 string.Format("Outgoing Queue Refill Engine ({0})", Scene.Name), 702 string.Format("Outgoing Queue Refill Engine ({0})", Scene.Name),
@@ -786,7 +781,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
786 MeasuresOfInterest.AverageChangeOverTime, 781 MeasuresOfInterest.AverageChangeOverTime,
787 stat => stat.Value = GetTotalQueuedOutgoingPackets(), 782 stat => stat.Value = GetTotalQueuedOutgoingPackets(),
788 StatVerbosity.Info)); 783 StatVerbosity.Info));
789 784/*
790 StatsManager.RegisterStat( 785 StatsManager.RegisterStat(
791 new Stat( 786 new Stat(
792 "IncomingPacketAsyncRequestsWaiting", 787 "IncomingPacketAsyncRequestsWaiting",
@@ -799,7 +794,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
799 MeasuresOfInterest.None, 794 MeasuresOfInterest.None,
800 stat => stat.Value = IpahEngine.JobsWaiting, 795 stat => stat.Value = IpahEngine.JobsWaiting,
801 StatVerbosity.Debug)); 796 StatVerbosity.Debug));
802 797*/
803 StatsManager.RegisterStat( 798 StatsManager.RegisterStat(
804 new Stat( 799 new Stat(
805 "OQRERequestsWaiting", 800 "OQRERequestsWaiting",
@@ -1227,7 +1222,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1227 outgoingPacket.SequenceNumber, isReliable, isResend, udpClient.AgentID, Scene.Name); 1222 outgoingPacket.SequenceNumber, isReliable, isResend, udpClient.AgentID, Scene.Name);
1228 1223
1229 // Put the UDP payload on the wire 1224 // Put the UDP payload on the wire
1230 AsyncBeginSend(buffer); 1225// AsyncBeginSend(buffer);
1226 SyncSend(buffer);
1231 1227
1232 // Keep track of when this packet was sent out (right now) 1228 // Keep track of when this packet was sent out (right now)
1233 outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; 1229 outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue;
@@ -1912,7 +1908,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1912 1908
1913 Buffer.BlockCopy(packetData, 0, buffer.Data, 0, length); 1909 Buffer.BlockCopy(packetData, 0, buffer.Data, 0, length);
1914 1910
1915 AsyncBeginSend(buffer); 1911// AsyncBeginSend(buffer);
1912 SyncSend(buffer);
1916 } 1913 }
1917 1914
1918 protected bool IsClientAuthorized(UseCircuitCodePacket useCircuitCode, out AuthenticateResponse sessionInfo) 1915 protected bool IsClientAuthorized(UseCircuitCodePacket useCircuitCode, out AuthenticateResponse sessionInfo)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
index 35a0711..8dd96d6 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
@@ -57,9 +57,6 @@ namespace OpenMetaverse
57 /// <summary>UDP socket, used in either client or server mode</summary> 57 /// <summary>UDP socket, used in either client or server mode</summary>
58 private Socket m_udpSocket; 58 private Socket m_udpSocket;
59 59
60 /// <summary>Flag to process packets asynchronously or synchronously</summary>
61 private bool m_asyncPacketHandling;
62
63 /// <summary> 60 /// <summary>
64 /// Are we to use object pool(s) to reduce memory churn when receiving data? 61 /// Are we to use object pool(s) to reduce memory churn when receiving data?
65 /// </summary> 62 /// </summary>
@@ -205,10 +202,8 @@ namespace OpenMetaverse
205 /// manner (not throwing an exception when the remote side resets the 202 /// manner (not throwing an exception when the remote side resets the
206 /// connection). This call is ignored on Mono where the flag is not 203 /// connection). This call is ignored on Mono where the flag is not
207 /// necessary</remarks> 204 /// necessary</remarks>
208 public virtual void StartInbound(int recvBufferSize, bool asyncPacketHandling) 205 public virtual void StartInbound(int recvBufferSize)
209 { 206 {
210 m_asyncPacketHandling = asyncPacketHandling;
211
212 if (!IsRunningInbound) 207 if (!IsRunningInbound)
213 { 208 {
214 m_log.DebugFormat("[UDPBASE]: Starting inbound UDP loop"); 209 m_log.DebugFormat("[UDPBASE]: Starting inbound UDP loop");
@@ -407,12 +402,7 @@ namespace OpenMetaverse
407 if (IsRunningInbound) 402 if (IsRunningInbound)
408 { 403 {
409 UdpReceives++; 404 UdpReceives++;
410 405
411 // Asynchronous mode will start another receive before the
412 // callback for this packet is even fired. Very parallel :-)
413 if (m_asyncPacketHandling)
414 AsyncBeginReceive();
415
416 try 406 try
417 { 407 {
418 // get the buffer that was created in AsyncBeginReceive 408 // get the buffer that was created in AsyncBeginReceive
@@ -469,10 +459,7 @@ namespace OpenMetaverse
469// if (UsePools) 459// if (UsePools)
470// Pool.ReturnObject(buffer); 460// Pool.ReturnObject(buffer);
471 461
472 // Synchronous mode waits until the packet callback completes 462 AsyncBeginReceive();
473 // before starting the receive to fetch another packet
474 if (!m_asyncPacketHandling)
475 AsyncBeginReceive();
476 } 463 }
477 } 464 }
478 } 465 }
@@ -500,7 +487,7 @@ namespace OpenMetaverse
500 } 487 }
501 catch (SocketException) { } 488 catch (SocketException) { }
502 catch (ObjectDisposedException) { } 489 catch (ObjectDisposedException) { }
503// } 490 // }
504 } 491 }
505 492
506 void AsyncEndSend(IAsyncResult result) 493 void AsyncEndSend(IAsyncResult result)
@@ -515,5 +502,25 @@ namespace OpenMetaverse
515 catch (SocketException) { } 502 catch (SocketException) { }
516 catch (ObjectDisposedException) { } 503 catch (ObjectDisposedException) { }
517 } 504 }
505
506 public void SyncSend(UDPPacketBuffer buf)
507 {
508 try
509 {
510 m_udpSocket.SendTo(
511 buf.Data,
512 0,
513 buf.DataLength,
514 SocketFlags.None,
515 buf.RemoteEndPoint
516 );
517 UdpSends++;
518 }
519 catch (SocketException e)
520 {
521 m_log.Warn("[UDPBASE]: sync send SocketException {0} " + e.Message);
522 }
523 catch (ObjectDisposedException) { }
524 }
518 } 525 }
519} 526}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
index 0e1a9e3..eb262d2 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
@@ -91,6 +91,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
91 /// <summary> 91 /// <summary>
92 /// Test adding a client to the stack 92 /// Test adding a client to the stack
93 /// </summary> 93 /// </summary>
94/*
94 [Test] 95 [Test]
95 public void TestAddClient() 96 public void TestAddClient()
96 { 97 {
@@ -165,7 +166,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
165 ScenePresence spAfterAckTimeout = m_scene.GetScenePresence(sp.UUID); 166 ScenePresence spAfterAckTimeout = m_scene.GetScenePresence(sp.UUID);
166 Assert.That(spAfterAckTimeout, Is.Null); 167 Assert.That(spAfterAckTimeout, Is.Null);
167 } 168 }
168 169*/
169// /// <summary> 170// /// <summary>
170// /// Test removing a client from the stack 171// /// Test removing a client from the stack
171// /// </summary> 172// /// </summary>
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 1ce6927..56c654f 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -163,7 +163,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
163 m_incomingSceneObjectEngine 163 m_incomingSceneObjectEngine
164 = new JobEngine( 164 = new JobEngine(
165 string.Format("HG Incoming Scene Object Engine ({0})", scene.Name), 165 string.Format("HG Incoming Scene Object Engine ({0})", scene.Name),
166 "HG INCOMING SCENE OBJECT ENGINE"); 166 "HG INCOMING SCENE OBJECT ENGINE", 30000);
167 167
168 StatsManager.RegisterStat( 168 StatsManager.RegisterStat(
169 new Stat( 169 new Stat(
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index bba7a96..057ca17 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2865,7 +2865,7 @@ namespace OpenSim.Region.Framework.Scenes
2865 root.SendPropertiesToClient(sp.ControllingClient); 2865 root.SendPropertiesToClient(sp.ControllingClient);
2866 if (oldUsePhysics && (root.Flags & PrimFlags.Physics) == 0) 2866 if (oldUsePhysics && (root.Flags & PrimFlags.Physics) == 0)
2867 { 2867 {
2868 sp.ControllingClient.SendAlertMessage("Object physics canceled"); 2868 sp.ControllingClient.SendAlertMessage("Object physics cancelled");
2869 } 2869 }
2870 } 2870 }
2871 } 2871 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 96b8c8b..ae827f4 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1604,13 +1604,16 @@ namespace OpenSim.Region.Framework.Scenes
1604 /// <param name="remoteClient"></param> 1604 /// <param name="remoteClient"></param>
1605 protected internal void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) 1605 protected internal void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
1606 { 1606 {
1607 SceneObjectGroup group = GetGroupByPrim(localID); 1607 SceneObjectPart part = GetSceneObjectPart(localID);
1608 if(part == null)
1609 return;
1608 1610
1609 if (group != null) 1611 SceneObjectGroup group = part.ParentGroup;
1612 if (group != null && !group.IsDeleted)
1610 { 1613 {
1611 if (m_parentScene.Permissions.CanEditObject(group, remoteClient)) 1614 if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
1612 { 1615 {
1613 group.UpdateTextureEntry(localID, texture); 1616 part.UpdateTextureEntry(texture);
1614 } 1617 }
1615 } 1618 }
1616 } 1619 }
@@ -1661,8 +1664,11 @@ namespace OpenSim.Region.Framework.Scenes
1661 1664
1662 if (wantedPhys != group.UsesPhysics && remoteClient != null) 1665 if (wantedPhys != group.UsesPhysics && remoteClient != null)
1663 { 1666 {
1664 remoteClient.SendAlertMessage("Object physics canceled because exceeds the limit of " + 1667 if(m_parentScene.m_linksetPhysCapacity != 0)
1665 m_parentScene.m_linksetPhysCapacity + " physical prims with shape type not set to None"); 1668 remoteClient.SendAlertMessage("Object physics cancelled because it exceeds limits for physical prims, either size or number of primswith shape type not set to None");
1669 else
1670 remoteClient.SendAlertMessage("Object physics cancelled because it exceeds size limits for physical prims");
1671
1666 group.RootPart.ScheduleFullUpdate(); 1672 group.RootPart.ScheduleFullUpdate();
1667 } 1673 }
1668 } 1674 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 1695d9b..fdfe8ae 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -4129,20 +4129,6 @@ namespace OpenSim.Region.Framework.Scenes
4129 return Parts.Count(); 4129 return Parts.Count();
4130 } 4130 }
4131 4131
4132 /// <summary>
4133 /// Update the texture entry for this part
4134 /// </summary>
4135 /// <param name="localID"></param>
4136 /// <param name="textureEntry"></param>
4137 public void UpdateTextureEntry(uint localID, byte[] textureEntry)
4138 {
4139 SceneObjectPart part = GetPart(localID);
4140 if (part != null)
4141 {
4142 part.UpdateTextureEntry(textureEntry);
4143 }
4144 }
4145
4146 public void AdjustChildPrimPermissions(bool forceTaskInventoryPermissive) 4132 public void AdjustChildPrimPermissions(bool forceTaskInventoryPermissive)
4147 { 4133 {
4148 uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff0; // Mask folded bits 4134 uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff0; // Mask folded bits
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 61aa915..c2eac24 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -5016,6 +5016,9 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5016 if (newTex.FaceTextures[i] != null) 5016 if (newTex.FaceTextures[i] != null)
5017 newFace = newTex.FaceTextures[i]; 5017 newFace = newTex.FaceTextures[i];
5018 5018
5019 if (oldFace.TextureID != newFace.TextureID)
5020 changeFlags |= Changed.TEXTURE;
5021
5019 Color4 oldRGBA = oldFace.RGBA; 5022 Color4 oldRGBA = oldFace.RGBA;
5020 Color4 newRGBA = newFace.RGBA; 5023 Color4 newRGBA = newFace.RGBA;
5021 5024
@@ -5025,9 +5028,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5025 oldRGBA.A != newRGBA.A) 5028 oldRGBA.A != newRGBA.A)
5026 changeFlags |= Changed.COLOR; 5029 changeFlags |= Changed.COLOR;
5027 5030
5028 if (oldFace.TextureID != newFace.TextureID)
5029 changeFlags |= Changed.TEXTURE;
5030
5031 // Max change, skip the rest of testing 5031 // Max change, skip the rest of testing
5032 if (changeFlags == (Changed.TEXTURE | Changed.COLOR)) 5032 if (changeFlags == (Changed.TEXTURE | Changed.COLOR))
5033 break; 5033 break;
@@ -5053,17 +5053,11 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5053 m_shape.TextureEntry = newTex.GetBytes(); 5053 m_shape.TextureEntry = newTex.GetBytes();
5054 if (changeFlags != 0) 5054 if (changeFlags != 0)
5055 TriggerScriptChangedEvent(changeFlags); 5055 TriggerScriptChangedEvent(changeFlags);
5056 UpdateFlag = UpdateRequired.FULL;
5057 ParentGroup.HasGroupChanged = true; 5056 ParentGroup.HasGroupChanged = true;
5058
5059 //This is madness..
5060 //ParentGroup.ScheduleGroupForFullUpdate();
5061 //This is sparta
5062 ScheduleFullUpdate(); 5057 ScheduleFullUpdate();
5063 } 5058 }
5064 } 5059 }
5065 5060
5066
5067 internal void UpdatePhysicsSubscribedEvents() 5061 internal void UpdatePhysicsSubscribedEvents()
5068 { 5062 {
5069 PhysicsActor pa = PhysActor; 5063 PhysicsActor pa = PhysActor;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 47af3b8..7e3adb9 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2280,18 +2280,13 @@ namespace OpenSim.Region.Framework.Scenes
2280 m_lastChildAgentUpdateDrawDistance = DrawDistance; 2280 m_lastChildAgentUpdateDrawDistance = DrawDistance;
2281 m_lastChildAgentUpdatePosition = AbsolutePosition; 2281 m_lastChildAgentUpdatePosition = AbsolutePosition;
2282 m_childUpdatesBusy = false; // allow them 2282 m_childUpdatesBusy = false; // allow them
2283
2284
2285 } 2283 }
2286 2284
2287 m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2285 m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2288 2286
2289
2290
2291 // send the rest of the world 2287 // send the rest of the world
2292 if (m_teleportFlags > 0 && !IsNPC || m_currentParcelHide) 2288 if (m_teleportFlags > 0 && !IsNPC || m_currentParcelHide)
2293 SendInitialDataToMe(); 2289 SendInitialDataToMe();
2294
2295 2290
2296 // priority uses avatar position only 2291 // priority uses avatar position only
2297// m_reprioritizationLastPosition = AbsolutePosition; 2292// m_reprioritizationLastPosition = AbsolutePosition;
@@ -2958,31 +2953,32 @@ namespace OpenSim.Region.Framework.Scenes
2958 Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN)); 2953 Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN));
2959 2954
2960 MovementFlag &= noMovFlagsMask; 2955 MovementFlag &= noMovFlagsMask;
2961 AgentControlFlags &= noMovFlagsMask; 2956 uint tmpAgentControlFlags = (uint)m_AgentControlFlags;
2957 tmpAgentControlFlags &= noMovFlagsMask;
2962 2958
2963 if (LocalVectorToTarget3D.X < 0) //MoveBack 2959 if (LocalVectorToTarget3D.X < 0) //MoveBack
2964 { 2960 {
2965 MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; 2961 MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
2966 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; 2962 tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
2967 updated = true; 2963 updated = true;
2968 } 2964 }
2969 else if (LocalVectorToTarget3D.X > 0) //Move Forward 2965 else if (LocalVectorToTarget3D.X > 0) //Move Forward
2970 { 2966 {
2971 MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; 2967 MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
2972 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; 2968 tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
2973 updated = true; 2969 updated = true;
2974 } 2970 }
2975 2971
2976 if (LocalVectorToTarget3D.Y > 0) //MoveLeft 2972 if (LocalVectorToTarget3D.Y > 0) //MoveLeft
2977 { 2973 {
2978 MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; 2974 MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
2979 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; 2975 tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
2980 updated = true; 2976 updated = true;
2981 } 2977 }
2982 else if (LocalVectorToTarget3D.Y < 0) //MoveRight 2978 else if (LocalVectorToTarget3D.Y < 0) //MoveRight
2983 { 2979 {
2984 MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; 2980 MovementFlag |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
2985 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; 2981 tmpAgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
2986 updated = true; 2982 updated = true;
2987 } 2983 }
2988 2984
@@ -3006,6 +3002,7 @@ namespace OpenSim.Region.Framework.Scenes
3006// "[SCENE PRESENCE]: HandleMoveToTargetUpdate adding {0} to move vector {1} for {2}", 3002// "[SCENE PRESENCE]: HandleMoveToTargetUpdate adding {0} to move vector {1} for {2}",
3007// LocalVectorToTarget3D, agent_control_v3, Name); 3003// LocalVectorToTarget3D, agent_control_v3, Name);
3008 3004
3005 m_AgentControlFlags = (AgentManager.ControlFlags) tmpAgentControlFlags;
3009 agent_control_v3 += LocalVectorToTarget3D; 3006 agent_control_v3 += LocalVectorToTarget3D;
3010 } 3007 }
3011 catch (Exception e) 3008 catch (Exception e)
@@ -4970,8 +4967,8 @@ namespace OpenSim.Region.Framework.Scenes
4970 4967
4971// if (m_updateCount > 0) 4968// if (m_updateCount > 0)
4972// { 4969// {
4973 if (Animator != null && Animator.UpdateMovementAnimations()) 4970// if (Animator != null && Animator.UpdateMovementAnimations())
4974 TriggerScenePresenceUpdated(); 4971// TriggerScenePresenceUpdated();
4975// m_updateCount--; 4972// m_updateCount--;
4976// } 4973// }
4977 4974
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
index 42d91b9..d650c43 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
60 TestScene scene = new SceneHelpers().SetupScene(); 60 TestScene scene = new SceneHelpers().SetupScene();
61 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); 61 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
62 sp.Flying = true; 62 sp.Flying = true;
63 sp.PhysicsCollisionUpdate(new CollisionEventUpdate()); 63 sp.Animator.UpdateMovementAnimations();
64 64
65 Assert.That(sp.Animator.CurrentMovementAnimation, Is.EqualTo("HOVER")); 65 Assert.That(sp.Animator.CurrentMovementAnimation, Is.EqualTo("HOVER"));
66 } 66 }
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs
index a5ee2c9..dc87a78 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
80 public float MeshSculptphysicalLOD = 32; 80 public float MeshSculptphysicalLOD = 32;
81 81
82 82
83 private OpenSim.Framework.BlockingQueue<ODEPhysRepData> createqueue = new OpenSim.Framework.BlockingQueue<ODEPhysRepData>(); 83 private OpenSim.Framework.BlockingQueue<ODEPhysRepData> workQueue = new OpenSim.Framework.BlockingQueue<ODEPhysRepData>();
84 private bool m_running; 84 private bool m_running;
85 85
86 private Thread m_thread; 86 private Thread m_thread;
@@ -110,7 +110,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
110 110
111 while(m_running) 111 while(m_running)
112 { 112 {
113 ODEPhysRepData nextRep = createqueue.Dequeue(); 113 ODEPhysRepData nextRep = workQueue.Dequeue();
114 if(!m_running) 114 if(!m_running)
115 return; 115 return;
116 if (nextRep == null) 116 if (nextRep == null)
@@ -139,7 +139,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
139 try 139 try
140 { 140 {
141 m_thread.Abort(); 141 m_thread.Abort();
142 createqueue.Clear(); 142 workQueue.Clear();
143 } 143 }
144 catch 144 catch
145 { 145 {
@@ -196,7 +196,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
196 repData.meshState = MeshState.loadingAsset; 196 repData.meshState = MeshState.loadingAsset;
197 197
198 repData.comand = meshWorkerCmnds.getmesh; 198 repData.comand = meshWorkerCmnds.getmesh;
199 createqueue.Enqueue(repData); 199 workQueue.Enqueue(repData);
200 } 200 }
201 } 201 }
202 202
@@ -242,7 +242,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
242 if (needsMeshing(repData)) // no need for pbs now? 242 if (needsMeshing(repData)) // no need for pbs now?
243 { 243 {
244 repData.comand = meshWorkerCmnds.changefull; 244 repData.comand = meshWorkerCmnds.changefull;
245 createqueue.Enqueue(repData); 245 workQueue.Enqueue(repData);
246 } 246 }
247 } 247 }
248 else 248 else
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index 9bf71f7..4bed0d2 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -165,6 +165,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
165 165
166 private float m_density; 166 private float m_density;
167 private byte m_shapetype; 167 private byte m_shapetype;
168 private byte m_fakeShapetype;
168 public bool _zeroFlag; 169 public bool _zeroFlag;
169 private bool m_lastUpdateSent; 170 private bool m_lastUpdateSent;
170 171
@@ -420,7 +421,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
420 { 421 {
421 if (value.IsFinite()) 422 if (value.IsFinite())
422 { 423 {
423 _parent_scene.m_meshWorker.ChangeActorPhysRep(this, _pbs, value, m_shapetype); 424 _parent_scene.m_meshWorker.ChangeActorPhysRep(this, _pbs, value, m_fakeShapetype);
424 } 425 }
425 else 426 else
426 { 427 {
@@ -630,7 +631,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
630 set 631 set
631 { 632 {
632// AddChange(changes.Shape, value); 633// AddChange(changes.Shape, value);
633 _parent_scene.m_meshWorker.ChangeActorPhysRep(this, value, _size, m_shapetype); 634 _parent_scene.m_meshWorker.ChangeActorPhysRep(this, value, _size, m_fakeShapetype);
634 } 635 }
635 } 636 }
636 637
@@ -638,11 +639,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
638 { 639 {
639 get 640 get
640 { 641 {
641 return m_shapetype; 642 return m_fakeShapetype;
642 } 643 }
643 set 644 set
644 { 645 {
645 m_shapetype = value; 646 m_fakeShapetype = value;
646 _parent_scene.m_meshWorker.ChangeActorPhysRep(this, _pbs, _size, value); 647 _parent_scene.m_meshWorker.ChangeActorPhysRep(this, _pbs, _size, value);
647 } 648 }
648 } 649 }
@@ -1329,7 +1330,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1329 1330
1330 _triMeshData = IntPtr.Zero; 1331 _triMeshData = IntPtr.Zero;
1331 1332
1332 m_shapetype = _shapeType; 1333 m_fakeShapetype = _shapeType;
1333 1334
1334 m_lastdoneSelected = false; 1335 m_lastdoneSelected = false;
1335 m_isSelected = false; 1336 m_isSelected = false;
@@ -1346,7 +1347,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1346 AddChange(changes.Add, null); 1347 AddChange(changes.Add, null);
1347 1348
1348 // get basic mass parameters 1349 // get basic mass parameters
1349 ODEPhysRepData repData = _parent_scene.m_meshWorker.NewActorPhysRep(this, _pbs, _size, m_shapetype); 1350 ODEPhysRepData repData = _parent_scene.m_meshWorker.NewActorPhysRep(this, _pbs, _size, _shapeType);
1350 1351
1351 primVolume = repData.volume; 1352 primVolume = repData.volume;
1352 m_OBB = repData.OBB; 1353 m_OBB = repData.OBB;
@@ -3161,7 +3162,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3161 { 3162 {
3162 _size = repData.size; //?? 3163 _size = repData.size; //??
3163 _pbs = repData.pbs; 3164 _pbs = repData.pbs;
3164 m_shapetype = repData.shapetype;
3165 3165
3166 m_mesh = repData.mesh; 3166 m_mesh = repData.mesh;
3167 3167
@@ -3200,9 +3200,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3200 { 3200 {
3201 repData.size = _size; 3201 repData.size = _size;
3202 repData.pbs = _pbs; 3202 repData.pbs = _pbs;
3203 repData.shapetype = m_shapetype; 3203 repData.shapetype = m_fakeShapetype;
3204 _parent_scene.m_meshWorker.RequestMesh(repData); 3204 _parent_scene.m_meshWorker.RequestMesh(repData);
3205 } 3205 }
3206 else
3207 m_shapetype = repData.shapetype;
3206 } 3208 }
3207 3209
3208 private void changePhysRepData(ODEPhysRepData repData) 3210 private void changePhysRepData(ODEPhysRepData repData)
@@ -3236,7 +3238,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3236 3238
3237 _size = repData.size; 3239 _size = repData.size;
3238 _pbs = repData.pbs; 3240 _pbs = repData.pbs;
3239 m_shapetype = repData.shapetype;
3240 3241
3241 m_mesh = repData.mesh; 3242 m_mesh = repData.mesh;
3242 3243
@@ -3287,9 +3288,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3287 { 3288 {
3288 repData.size = _size; 3289 repData.size = _size;
3289 repData.pbs = _pbs; 3290 repData.pbs = _pbs;
3290 repData.shapetype = m_shapetype; 3291 repData.shapetype = m_fakeShapetype;
3291 _parent_scene.m_meshWorker.RequestMesh(repData); 3292 _parent_scene.m_meshWorker.RequestMesh(repData);
3292 } 3293 }
3294 else
3295 m_shapetype = repData.shapetype;
3293 } 3296 }
3294 3297
3295 private void changeFloatOnWater(bool newval) 3298 private void changeFloatOnWater(bool newval)