aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDan Lake2011-12-20 14:46:44 -0800
committerDan Lake2011-12-20 14:46:44 -0800
commit7693e6a3a8d811a75ee3773f0c9ae0b0150dc5cd (patch)
tree3de2f42376d23ead500098d98e6d2bbd6e21feda /OpenSim/Region
parentRemove unused SetAcceleration and add set on Acceleration parameter (diff)
parentRemove unused SetAcceleration and add set on Acceleration parameter (diff)
downloadopensim-SC_OLD-7693e6a3a8d811a75ee3773f0c9ae0b0150dc5cd.zip
opensim-SC_OLD-7693e6a3a8d811a75ee3773f0c9ae0b0150dc5cd.tar.gz
opensim-SC_OLD-7693e6a3a8d811a75ee3773f0c9ae0b0150dc5cd.tar.bz2
opensim-SC_OLD-7693e6a3a8d811a75ee3773f0c9ae0b0150dc5cd.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs27
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs26
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs66
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs12
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs246
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs27
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs31
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs98
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs34
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs11
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs12
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs3
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs47
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs109
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs2
23 files changed, 417 insertions, 415 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 8d98cc9..3a1a8c7 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -188,6 +188,18 @@ namespace OpenSim
188 } 188 }
189 } 189 }
190 190
191 // Hook up to the watchdog timer
192 Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler;
193
194 PrintFileToConsole("startuplogo.txt");
195
196 // For now, start at the 'root' level by default
197 if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
198 ChangeSelectedRegion("region",
199 new string[] {"change", "region", m_sceneManager.Scenes[0].RegionInfo.RegionName});
200 else
201 ChangeSelectedRegion("region", new string[] {"change", "region", "root"});
202
191 //Run Startup Commands 203 //Run Startup Commands
192 if (String.IsNullOrEmpty(m_startupCommandsFile)) 204 if (String.IsNullOrEmpty(m_startupCommandsFile))
193 { 205 {
@@ -206,18 +218,6 @@ namespace OpenSim
206 m_scriptTimer.Interval = 1200*1000; 218 m_scriptTimer.Interval = 1200*1000;
207 m_scriptTimer.Elapsed += RunAutoTimerScript; 219 m_scriptTimer.Elapsed += RunAutoTimerScript;
208 } 220 }
209
210 // Hook up to the watchdog timer
211 Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler;
212
213 PrintFileToConsole("startuplogo.txt");
214
215 // For now, start at the 'root' level by default
216 if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
217 ChangeSelectedRegion("region",
218 new string[] {"change", "region", m_sceneManager.Scenes[0].RegionInfo.RegionName});
219 else
220 ChangeSelectedRegion("region", new string[] {"change", "region", "root"});
221 } 221 }
222 222
223 /// <summary> 223 /// <summary>
@@ -796,6 +796,7 @@ namespace OpenSim
796 break; 796 break;
797 797
798 case "backup": 798 case "backup":
799 MainConsole.Instance.Output("Triggering save of pending object updates to persistent store");
799 m_sceneManager.BackupCurrentScene(); 800 m_sceneManager.BackupCurrentScene();
800 break; 801 break;
801 802
@@ -806,7 +807,7 @@ namespace OpenSim
806 if (m_sceneManager.TryGetScene(regRemoveName, out removeScene)) 807 if (m_sceneManager.TryGetScene(regRemoveName, out removeScene))
807 RemoveRegion(removeScene, false); 808 RemoveRegion(removeScene, false);
808 else 809 else
809 MainConsole.Instance.Output("no region with that name"); 810 MainConsole.Instance.Output("No region with that name");
810 break; 811 break;
811 812
812 case "delete-region": 813 case "delete-region":
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 9c86c74..b37fd54 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -441,6 +441,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
441 public LLClientView(EndPoint remoteEP, Scene scene, LLUDPServer udpServer, LLUDPClient udpClient, AuthenticateResponse sessionInfo, 441 public LLClientView(EndPoint remoteEP, Scene scene, LLUDPServer udpServer, LLUDPClient udpClient, AuthenticateResponse sessionInfo,
442 UUID agentId, UUID sessionId, uint circuitCode) 442 UUID agentId, UUID sessionId, uint circuitCode)
443 { 443 {
444// DebugPacketLevel = 1;
445
444 RegisterInterface<IClientIM>(this); 446 RegisterInterface<IClientIM>(this);
445 RegisterInterface<IClientChat>(this); 447 RegisterInterface<IClientChat>(this);
446 RegisterInterface<IClientIPEndpoint>(this); 448 RegisterInterface<IClientIPEndpoint>(this);
@@ -4893,8 +4895,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4893 update.Scale = new Vector3(0.45f, 0.6f, 1.9f); 4895 update.Scale = new Vector3(0.45f, 0.6f, 1.9f);
4894 update.Text = Utils.EmptyBytes; 4896 update.Text = Utils.EmptyBytes;
4895 update.TextColor = new byte[4]; 4897 update.TextColor = new byte[4];
4898
4899 // Don't send texture anim for avatars - this has no meaning for them.
4896 update.TextureAnim = Utils.EmptyBytes; 4900 update.TextureAnim = Utils.EmptyBytes;
4897 update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; 4901
4902 // Don't send texture entry for avatars here - this is accomplished via the AvatarAppearance packet
4903 update.TextureEntry = Utils.EmptyBytes;
4904// update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes;
4905
4898 update.UpdateFlags = (uint)( 4906 update.UpdateFlags = (uint)(
4899 PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | 4907 PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner |
4900 PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | 4908 PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer |
@@ -6001,7 +6009,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6001 // for the client session anyway, in order to protect ourselves against bad code in plugins 6009 // for the client session anyway, in order to protect ourselves against bad code in plugins
6002 try 6010 try
6003 { 6011 {
6004
6005 byte[] visualparams = new byte[appear.VisualParam.Length]; 6012 byte[] visualparams = new byte[appear.VisualParam.Length];
6006 for (int i = 0; i < appear.VisualParam.Length; i++) 6013 for (int i = 0; i < appear.VisualParam.Length; i++)
6007 visualparams[i] = appear.VisualParam[i].ParamValue; 6014 visualparams[i] = appear.VisualParam[i].ParamValue;
@@ -10345,6 +10352,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10345 } 10352 }
10346 return true; 10353 return true;
10347 } 10354 }
10355
10348 private bool HandleGroupRoleMembersRequest(IClientAPI sender, Packet Pack) 10356 private bool HandleGroupRoleMembersRequest(IClientAPI sender, Packet Pack)
10349 { 10357 {
10350 GroupRoleMembersRequestPacket groupRoleMembersRequest = 10358 GroupRoleMembersRequestPacket groupRoleMembersRequest =
@@ -11218,9 +11226,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11218 /// <summary> 11226 /// <summary>
11219 /// Send a response back to a client when it asks the asset server (via the region server) if it has 11227 /// Send a response back to a client when it asks the asset server (via the region server) if it has
11220 /// its appearance texture cached. 11228 /// its appearance texture cached.
11221 ///
11222 /// At the moment, we always reply that there is no cached texture.
11223 /// </summary> 11229 /// </summary>
11230 /// <remarks>
11231 /// At the moment, we always reply that there is no cached texture.
11232 /// </remarks>
11224 /// <param name="simclient"></param> 11233 /// <param name="simclient"></param>
11225 /// <param name="packet"></param> 11234 /// <param name="packet"></param>
11226 /// <returns></returns> 11235 /// <returns></returns>
@@ -11230,7 +11239,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11230 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; 11239 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
11231 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); 11240 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
11232 11241
11233 if (cachedtex.AgentData.SessionID != SessionId) return false; 11242 if (cachedtex.AgentData.SessionID != SessionId)
11243 return false;
11234 11244
11235 // TODO: don't create new blocks if recycling an old packet 11245 // TODO: don't create new blocks if recycling an old packet
11236 cachedresp.AgentData.AgentID = AgentId; 11246 cachedresp.AgentData.AgentID = AgentId;
@@ -11628,6 +11638,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11628 if (DebugPacketLevel <= 50 && packet.Type == PacketType.ImprovedTerseObjectUpdate) 11638 if (DebugPacketLevel <= 50 && packet.Type == PacketType.ImprovedTerseObjectUpdate)
11629 logPacket = false; 11639 logPacket = false;
11630 11640
11641 if (DebugPacketLevel <= 25 && packet.Type == PacketType.ObjectPropertiesFamily)
11642 logPacket = false;
11643
11631 if (logPacket) 11644 if (logPacket)
11632 m_log.DebugFormat( 11645 m_log.DebugFormat(
11633 "[CLIENT]: PACKET OUT to {0} ({1}) in {2} - {3}", 11646 "[CLIENT]: PACKET OUT to {0} ({1}) in {2} - {3}",
@@ -11685,6 +11698,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11685 if (DebugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation)) 11698 if (DebugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation))
11686 logPacket = false; 11699 logPacket = false;
11687 11700
11701 if (DebugPacketLevel <= 25 && packet.Type == PacketType.RequestObjectPropertiesFamily)
11702 logPacket = false;
11703
11688 if (logPacket) 11704 if (logPacket)
11689 m_log.DebugFormat( 11705 m_log.DebugFormat(
11690 "[CLIENT]: PACKET IN from {0} ({1}) in {2} - {3}", 11706 "[CLIENT]: PACKET IN from {0} ({1}) in {2} - {3}",
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 29e3580..e8aee3e 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -26,16 +26,15 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
31using System.Threading;
32using System.Text;
33using System.Timers;
30using log4net; 34using log4net;
31using Nini.Config; 35using Nini.Config;
32using OpenMetaverse; 36using OpenMetaverse;
33using OpenSim.Framework; 37using OpenSim.Framework;
34
35using System.Threading;
36using System.Timers;
37using System.Collections.Generic;
38
39using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
41using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
@@ -45,6 +44,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
45 public class AvatarFactoryModule : IAvatarFactoryModule, IRegionModule 44 public class AvatarFactoryModule : IAvatarFactoryModule, IRegionModule
46 { 45 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 public const string BAKED_TEXTURES_REPORT_FORMAT = "{0,-9} {1}";
49
48 private Scene m_scene = null; 50 private Scene m_scene = null;
49 51
50 private int m_savetime = 5; // seconds to wait before saving changed appearance 52 private int m_savetime = 5; // seconds to wait before saving changed appearance
@@ -147,9 +149,13 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
147 // Process the baked texture array 149 // Process the baked texture array
148 if (textureEntry != null) 150 if (textureEntry != null)
149 { 151 {
152 m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", sp.UUID);
153
154// WriteBakedTexturesReport(sp, m_log.DebugFormat);
155
150 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; 156 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
151 157
152 m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", sp.UUID); 158// WriteBakedTexturesReport(sp, m_log.DebugFormat);
153 ValidateBakedTextureCache(sp, false); 159 ValidateBakedTextureCache(sp, false);
154 160
155 // This appears to be set only in the final stage of the appearance 161 // This appears to be set only in the final stage of the appearance
@@ -254,9 +260,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
254 } 260 }
255 261
256 /// <summary> 262 /// <summary>
257 /// Queue up a request to send appearance, makes it possible to 263 /// Queue up a request to send appearance.
258 /// accumulate changes without sending out each one separately.
259 /// </summary> 264 /// </summary>
265 /// <remarks>
266 /// Makes it possible to accumulate changes without sending out each one separately.
267 /// </remarks>
268 /// <param name="agentId"></param>
260 public void QueueAppearanceSend(UUID agentid) 269 public void QueueAppearanceSend(UUID agentid)
261 { 270 {
262// m_log.DebugFormat("[AVFACTORY]: Queue appearance send for {0}", agentid); 271// m_log.DebugFormat("[AVFACTORY]: Queue appearance send for {0}", agentid);
@@ -408,10 +417,13 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
408 m_savequeue.Remove(avatarID); 417 m_savequeue.Remove(avatarID);
409 } 418 }
410 } 419 }
411 }
412 420
413 if (m_savequeue.Count == 0 && m_sendqueue.Count == 0) 421 // We must lock both queues here so that QueueAppearanceSave() or *Send() don't m_updateTimer.Start() on
414 m_updateTimer.Stop(); 422 // another thread inbetween the first count calls and m_updateTimer.Stop() on this thread.
423 lock (m_sendqueue)
424 if (m_savequeue.Count == 0 && m_sendqueue.Count == 0)
425 m_updateTimer.Stop();
426 }
415 } 427 }
416 428
417 private void SaveAppearance(UUID agentid) 429 private void SaveAppearance(UUID agentid)
@@ -557,5 +569,37 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
557 } 569 }
558 } 570 }
559 #endregion 571 #endregion
572
573 public void WriteBakedTexturesReport(IScenePresence sp, ReportOutputAction outputAction)
574 {
575 outputAction("For {0} in {1}", sp.Name, m_scene.RegionInfo.RegionName);
576 outputAction(BAKED_TEXTURES_REPORT_FORMAT, "Bake Type", "UUID");
577
578 Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = GetBakedTextureFaces(sp.UUID);
579
580 foreach (BakeType bt in bakedTextures.Keys)
581 {
582 string rawTextureID;
583
584 if (bakedTextures[bt] == null)
585 {
586 rawTextureID = "not set";
587 }
588 else
589 {
590 rawTextureID = bakedTextures[bt].TextureID.ToString();
591
592 if (m_scene.AssetService.Get(rawTextureID) == null)
593 rawTextureID += " (not found)";
594 else
595 rawTextureID += " (uploaded)";
596 }
597
598 outputAction(BAKED_TEXTURES_REPORT_FORMAT, bt, rawTextureID);
599 }
600
601 bool bakedTextureValid = m_scene.AvatarFactory.ValidateBakedTextureCache(sp);
602 outputAction("{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt");
603 }
560 } 604 }
561} 605}
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 2f947fd..87f292c 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1213,7 +1213,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1213 AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); 1213 AgentCircuitData agent = sp.ControllingClient.RequestClientInfo();
1214 agent.BaseFolder = UUID.Zero; 1214 agent.BaseFolder = UUID.Zero;
1215 agent.InventoryFolder = UUID.Zero; 1215 agent.InventoryFolder = UUID.Zero;
1216 agent.startpos = new Vector3(128, 128, 70); 1216 agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour);
1217 agent.child = true; 1217 agent.child = true;
1218 agent.Appearance = sp.Appearance; 1218 agent.Appearance = sp.Appearance;
1219 if (currentAgentCircuit != null) 1219 if (currentAgentCircuit != null)
@@ -1305,6 +1305,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1305 } 1305 }
1306 } 1306 }
1307 1307
1308 Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour)
1309 {
1310 int rRegionX = (int)sp.Scene.RegionInfo.RegionLocX;
1311 int rRegionY = (int)sp.Scene.RegionInfo.RegionLocY;
1312 int tRegionX = neighbour.RegionLocX / (int)Constants.RegionSize;
1313 int tRegionY = neighbour.RegionLocY / (int)Constants.RegionSize;
1314 int shiftx = (rRegionX - tRegionX) * (int)Constants.RegionSize;
1315 int shifty = (rRegionY - tRegionY) * (int)Constants.RegionSize;
1316 return new Vector3(shiftx, shifty, 0f);
1317 }
1318
1308 private void InformClientOfNeighbourCompleted(IAsyncResult iar) 1319 private void InformClientOfNeighbourCompleted(IAsyncResult iar)
1309 { 1320 {
1310 InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate)iar.AsyncState; 1321 InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate)iar.AsyncState;
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index a87279a..cc9ba97 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -123,7 +123,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
123 { 123 {
124 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); 124 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID);
125 GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); 125 GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID);
126 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: GetFinalDestination serveruri -> {0}", real_destination.ServerURI); 126 if (real_destination != null)
127 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: GetFinalDestination serveruri -> {0}", real_destination.ServerURI);
128 else
129 m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: GetHyperlinkRegion to Gatekeeper {0} failed", region.ServerURI);
127 return real_destination; 130 return real_destination;
128 } 131 }
129 return region; 132 return region;
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 7760382..cdecd2f 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -384,9 +384,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
384 if (m_debugPermissions) 384 if (m_debugPermissions)
385 m_log.Debug("[PERMISSIONS]: " + permissionCalled + " was called from " + m_scene.RegionInfo.RegionName); 385 m_log.Debug("[PERMISSIONS]: " + permissionCalled + " was called from " + m_scene.RegionInfo.RegionName);
386 } 386 }
387 387
388 // Checks if the given group is active and if the user is a group member 388 /// <summary>
389 // with the powers requested (powers = 0 for no powers check) 389 /// Checks if the given group is active and if the user is a group member
390 /// with the powers requested (powers = 0 for no powers check)
391 /// </summary>
392 /// <param name="groupID"></param>
393 /// <param name="userID"></param>
394 /// <param name="powers"></param>
395 /// <returns></returns>
390 protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) 396 protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers)
391 { 397 {
392 if (null == m_groupsModule) 398 if (null == m_groupsModule)
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
index 26bc922..8670229 100644
--- a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
@@ -31,9 +31,10 @@ using OpenSim.Framework;
31 31
32namespace OpenSim.Region.Framework.Interfaces 32namespace OpenSim.Region.Framework.Interfaces
33{ 33{
34 public delegate void ReportOutputAction(string format, params object[] args);
35
34 public interface IAvatarFactoryModule 36 public interface IAvatarFactoryModule
35 { 37 {
36
37 void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams); 38 void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams);
38 39
39 /// <summary> 40 /// <summary>
@@ -63,5 +64,13 @@ namespace OpenSim.Region.Framework.Interfaces
63 bool ValidateBakedTextureCache(IScenePresence sp); 64 bool ValidateBakedTextureCache(IScenePresence sp);
64 void QueueAppearanceSend(UUID agentid); 65 void QueueAppearanceSend(UUID agentid);
65 void QueueAppearanceSave(UUID agentid); 66 void QueueAppearanceSave(UUID agentid);
67
68 /// <summary>
69 /// Get a report about the current state of a scene presence's baked appearance textures.
70 /// </summary>
71 /// <param name="sp"></param>
72 /// <param name="reportOutputAction"></param>
73 /// <returns></returns>
74 void WriteBakedTexturesReport(IScenePresence sp, ReportOutputAction reportOutputAction);
66 } 75 }
67} \ No newline at end of file 76} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 4a4d98f..4f71915 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -1564,6 +1564,12 @@ namespace OpenSim.Region.Framework.Scenes
1564 1564
1565 public void TriggerRequestChangeWaterHeight(float height) 1565 public void TriggerRequestChangeWaterHeight(float height)
1566 { 1566 {
1567 if (height < 0)
1568 {
1569 // ignore negative water height
1570 return;
1571 }
1572
1567 RequestChangeWaterHeight handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight; 1573 RequestChangeWaterHeight handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight;
1568 if (handlerRequestChangeWaterHeight != null) 1574 if (handlerRequestChangeWaterHeight != null)
1569 { 1575 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 6ba74c7..3355ebe 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -116,66 +116,78 @@ namespace OpenSim.Region.Framework.Scenes
116 /// <param name="remoteClient"></param> 116 /// <param name="remoteClient"></param>
117 public void RequestPrim(uint primLocalID, IClientAPI remoteClient) 117 public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
118 { 118 {
119 EntityBase[] entityList = GetEntities(); 119 SceneObjectGroup sog = GetGroupByPrim(primLocalID);
120 foreach (EntityBase ent in entityList) 120
121 if (sog != null)
122 sog.SendFullUpdateToClient(remoteClient);
123 }
124
125 /// <summary>
126 /// Invoked when the client selects a prim.
127 /// </summary>
128 /// <param name="primLocalID"></param>
129 /// <param name="remoteClient"></param>
130 public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
131 {
132 SceneObjectPart part = GetSceneObjectPart(primLocalID);
133
134 if (null == part)
135 return;
136
137 if (part.IsRoot)
121 { 138 {
122 if (ent is SceneObjectGroup) 139 SceneObjectGroup sog = part.ParentGroup;
140 sog.SendPropertiesToClient(remoteClient);
141 sog.IsSelected = true;
142
143 // A prim is only tainted if it's allowed to be edited by the person clicking it.
144 if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)
145 || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId))
123 { 146 {
124 if (((SceneObjectGroup)ent).LocalId == primLocalID) 147 EventManager.TriggerParcelPrimCountTainted();
125 {
126 ((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient);
127 return;
128 }
129 } 148 }
130 } 149 }
150 else
151 {
152 part.SendPropertiesToClient(remoteClient);
153 }
131 } 154 }
132 155
133 /// <summary> 156 /// <summary>
134 /// Invoked when the client selects a prim. 157 /// Handle the update of an object's user group.
135 /// </summary> 158 /// </summary>
136 /// <param name="primLocalID"></param>
137 /// <param name="remoteClient"></param> 159 /// <param name="remoteClient"></param>
138 public void SelectPrim(uint primLocalID, IClientAPI remoteClient) 160 /// <param name="groupID"></param>
161 /// <param name="objectLocalID"></param>
162 /// <param name="Garbage"></param>
163 private void HandleObjectGroupUpdate(
164 IClientAPI remoteClient, UUID groupID, uint objectLocalID, UUID Garbage)
139 { 165 {
140 EntityBase[] entityList = GetEntities(); 166 if (m_groupsModule == null)
141 foreach (EntityBase ent in entityList) 167 return;
168
169 // XXX: Might be better to get rid of this special casing and have GetMembershipData return something
170 // reasonable for a UUID.Zero group.
171 if (groupID != UUID.Zero)
142 { 172 {
143 if (ent is SceneObjectGroup) 173 GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, remoteClient.AgentId);
174
175 if (gmd == null)
144 { 176 {
145 if (((SceneObjectGroup) ent).LocalId == primLocalID) 177// m_log.WarnFormat(
146 { 178// "[GROUPS]: User {0} is not a member of group {1} so they can't update {2} to this group",
147 ((SceneObjectGroup) ent).SendPropertiesToClient(remoteClient); 179// remoteClient.Name, GroupID, objectLocalID);
148 ((SceneObjectGroup) ent).IsSelected = true; 180
149 // A prim is only tainted if it's allowed to be edited by the person clicking it. 181 return;
150 if (Permissions.CanEditObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId) 182 }
151 || Permissions.CanMoveObject(((SceneObjectGroup)ent).UUID, remoteClient.AgentId)) 183 }
152 { 184
153 EventManager.TriggerParcelPrimCountTainted(); 185 SceneObjectGroup so = ((Scene)remoteClient.Scene).GetGroupByPrim(objectLocalID);
154 } 186 if (so != null)
155 break; 187 {
156 } 188 if (so.OwnerID == remoteClient.AgentId)
157 else 189 {
158 { 190 so.SetGroup(groupID, remoteClient);
159 // We also need to check the children of this prim as they
160 // can be selected as well and send property information
161 bool foundPrim = false;
162
163 SceneObjectGroup sog = ent as SceneObjectGroup;
164
165 SceneObjectPart[] partList = sog.Parts;
166 foreach (SceneObjectPart part in partList)
167 {
168 if (part.LocalId == primLocalID)
169 {
170 part.SendPropertiesToClient(remoteClient);
171 foundPrim = true;
172 break;
173 }
174 }
175
176 if (foundPrim)
177 break;
178 }
179 } 191 }
180 } 192 }
181 } 193 }
@@ -250,121 +262,81 @@ namespace OpenSim.Region.Framework.Scenes
250 262
251 public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 263 public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
252 { 264 {
253 EntityBase[] EntityList = GetEntities(); 265 SceneObjectPart part = GetSceneObjectPart(localID);
266
267 if (part == null)
268 return;
269
270 SceneObjectGroup obj = part.ParentGroup;
254 271
255 SurfaceTouchEventArgs surfaceArg = null; 272 SurfaceTouchEventArgs surfaceArg = null;
256 if (surfaceArgs != null && surfaceArgs.Count > 0) 273 if (surfaceArgs != null && surfaceArgs.Count > 0)
257 surfaceArg = surfaceArgs[0]; 274 surfaceArg = surfaceArgs[0];
258 275
259 foreach (EntityBase ent in EntityList) 276 // Currently only grab/touch for the single prim
277 // the client handles rez correctly
278 obj.ObjectGrabHandler(localID, offsetPos, remoteClient);
279
280 // If the touched prim handles touches, deliver it
281 // If not, deliver to root prim
282 if ((part.ScriptEvents & scriptEvents.touch_start) != 0)
283 EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
284
285 // Deliver to the root prim if the touched prim doesn't handle touches
286 // or if we're meant to pass on touches anyway. Don't send to root prim
287 // if prim touched is the root prim as we just did it
288 if (((part.ScriptEvents & scriptEvents.touch_start) == 0) ||
289 (part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
260 { 290 {
261 if (ent is SceneObjectGroup) 291 EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
262 {
263 SceneObjectGroup obj = ent as SceneObjectGroup;
264 if (obj != null)
265 {
266 // Is this prim part of the group
267 if (obj.HasChildPrim(localID))
268 {
269 // Currently only grab/touch for the single prim
270 // the client handles rez correctly
271 obj.ObjectGrabHandler(localID, offsetPos, remoteClient);
272
273 SceneObjectPart part = obj.GetChildPart(localID);
274
275 // If the touched prim handles touches, deliver it
276 // If not, deliver to root prim
277 if ((part.ScriptEvents & scriptEvents.touch_start) != 0)
278 EventManager.TriggerObjectGrab(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
279 // Deliver to the root prim if the touched prim doesn't handle touches
280 // or if we're meant to pass on touches anyway. Don't send to root prim
281 // if prim touched is the root prim as we just did it
282 if (((part.ScriptEvents & scriptEvents.touch_start) == 0) ||
283 (part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
284 {
285 EventManager.TriggerObjectGrab(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
286 }
287
288 return;
289 }
290 }
291 }
292 } 292 }
293 } 293 }
294 294
295 public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 295 public virtual void ProcessObjectGrabUpdate(
296 UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
296 { 297 {
297 EntityBase[] EntityList = GetEntities(); 298 SceneObjectPart part = GetSceneObjectPart(objectID);
299 if (part == null)
300 return;
301
302 SceneObjectGroup obj = part.ParentGroup;
298 303
299 SurfaceTouchEventArgs surfaceArg = null; 304 SurfaceTouchEventArgs surfaceArg = null;
300 if (surfaceArgs != null && surfaceArgs.Count > 0) 305 if (surfaceArgs != null && surfaceArgs.Count > 0)
301 surfaceArg = surfaceArgs[0]; 306 surfaceArg = surfaceArgs[0];
302 307
303 foreach (EntityBase ent in EntityList) 308 // If the touched prim handles touches, deliver it
309 // If not, deliver to root prim
310 if ((part.ScriptEvents & scriptEvents.touch) != 0)
311 EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
312 // Deliver to the root prim if the touched prim doesn't handle touches
313 // or if we're meant to pass on touches anyway. Don't send to root prim
314 // if prim touched is the root prim as we just did it
315 if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
316 (part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
304 { 317 {
305 if (ent is SceneObjectGroup) 318 EventManager.TriggerObjectGrabbing(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
306 {
307 SceneObjectGroup obj = ent as SceneObjectGroup;
308 if (obj != null)
309 {
310 // Is this prim part of the group
311 if (obj.HasChildPrim(objectID))
312 {
313 SceneObjectPart part = obj.GetChildPart(objectID);
314
315 // If the touched prim handles touches, deliver it
316 // If not, deliver to root prim
317 if ((part.ScriptEvents & scriptEvents.touch) != 0)
318 EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
319 // Deliver to the root prim if the touched prim doesn't handle touches
320 // or if we're meant to pass on touches anyway. Don't send to root prim
321 // if prim touched is the root prim as we just did it
322 if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
323 (part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
324 {
325 EventManager.TriggerObjectGrabbing(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
326 }
327
328 return;
329 }
330 }
331 }
332 } 319 }
333 } 320 }
334 321
335 public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 322 public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
336 { 323 {
337 EntityBase[] EntityList = GetEntities(); 324 SceneObjectPart part = GetSceneObjectPart(localID);
325 if (part == null)
326 return;
327
328 SceneObjectGroup obj = part.ParentGroup;
338 329
339 SurfaceTouchEventArgs surfaceArg = null; 330 SurfaceTouchEventArgs surfaceArg = null;
340 if (surfaceArgs != null && surfaceArgs.Count > 0) 331 if (surfaceArgs != null && surfaceArgs.Count > 0)
341 surfaceArg = surfaceArgs[0]; 332 surfaceArg = surfaceArgs[0];
342 333
343 foreach (EntityBase ent in EntityList) 334 // If the touched prim handles touches, deliver it
344 { 335 // If not, deliver to root prim
345 if (ent is SceneObjectGroup) 336 if ((part.ScriptEvents & scriptEvents.touch_end) != 0)
346 { 337 EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient, surfaceArg);
347 SceneObjectGroup obj = ent as SceneObjectGroup; 338 else
348 339 EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg);
349 // Is this prim part of the group
350 if (obj.HasChildPrim(localID))
351 {
352 SceneObjectPart part=obj.GetChildPart(localID);
353 if (part != null)
354 {
355 // If the touched prim handles touches, deliver it
356 // If not, deliver to root prim
357 if ((part.ScriptEvents & scriptEvents.touch_end) != 0)
358 EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient, surfaceArg);
359 else
360 EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg);
361
362 return;
363 }
364 return;
365 }
366 }
367 }
368 } 340 }
369 341
370 public void ProcessAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query) 342 public void ProcessAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4ab6fe4..6666328 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -139,6 +139,7 @@ namespace OpenSim.Region.Framework.Scenes
139 protected IDialogModule m_dialogModule; 139 protected IDialogModule m_dialogModule;
140 protected IEntityTransferModule m_teleportModule; 140 protected IEntityTransferModule m_teleportModule;
141 protected ICapabilitiesModule m_capsModule; 141 protected ICapabilitiesModule m_capsModule;
142 protected IGroupsModule m_groupsModule;
142 143
143 /// <summary> 144 /// <summary>
144 /// Current scene frame number 145 /// Current scene frame number
@@ -1164,6 +1165,7 @@ namespace OpenSim.Region.Framework.Scenes
1164 m_dialogModule = RequestModuleInterface<IDialogModule>(); 1165 m_dialogModule = RequestModuleInterface<IDialogModule>();
1165 m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); 1166 m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
1166 m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); 1167 m_teleportModule = RequestModuleInterface<IEntityTransferModule>();
1168 m_groupsModule = RequestModuleInterface<IGroupsModule>();
1167 } 1169 }
1168 1170
1169 #endregion 1171 #endregion
@@ -2512,7 +2514,7 @@ namespace OpenSim.Region.Framework.Scenes
2512 if (sp == null) 2514 if (sp == null)
2513 { 2515 {
2514 m_log.DebugFormat( 2516 m_log.DebugFormat(
2515 "[SCENE]: Adding new child scene presence {0} to scene {1}", client.Name, RegionInfo.RegionName); 2517 "[SCENE]: Adding new child scene presence {0} to scene {1} at pos {2}", client.Name, RegionInfo.RegionName, client.StartPos);
2516 2518
2517 m_clientManager.Add(client); 2519 m_clientManager.Add(client);
2518 SubscribeToClientEvents(client); 2520 SubscribeToClientEvents(client);
@@ -2733,6 +2735,7 @@ namespace OpenSim.Region.Framework.Scenes
2733 client.OnObjectDescription += m_sceneGraph.PrimDescription; 2735 client.OnObjectDescription += m_sceneGraph.PrimDescription;
2734 client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; 2736 client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable;
2735 client.OnObjectOwner += ObjectOwner; 2737 client.OnObjectOwner += ObjectOwner;
2738 client.OnObjectGroupRequest += HandleObjectGroupUpdate;
2736 } 2739 }
2737 2740
2738 public virtual void SubscribeToClientPrimRezEvents(IClientAPI client) 2741 public virtual void SubscribeToClientPrimRezEvents(IClientAPI client)
@@ -2776,7 +2779,6 @@ namespace OpenSim.Region.Framework.Scenes
2776 2779
2777 public virtual void SubscribeToClientParcelEvents(IClientAPI client) 2780 public virtual void SubscribeToClientParcelEvents(IClientAPI client)
2778 { 2781 {
2779 client.OnObjectGroupRequest += m_sceneGraph.HandleObjectGroupUpdate;
2780 client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel; 2782 client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel;
2781 client.OnParcelSetOtherCleanTime += LandChannel.SetParcelOtherCleanTime; 2783 client.OnParcelSetOtherCleanTime += LandChannel.SetParcelOtherCleanTime;
2782 client.OnParcelBuy += ProcessParcelBuy; 2784 client.OnParcelBuy += ProcessParcelBuy;
@@ -2903,7 +2905,6 @@ namespace OpenSim.Region.Framework.Scenes
2903 2905
2904 public virtual void UnSubscribeToClientParcelEvents(IClientAPI client) 2906 public virtual void UnSubscribeToClientParcelEvents(IClientAPI client)
2905 { 2907 {
2906 client.OnObjectGroupRequest -= m_sceneGraph.HandleObjectGroupUpdate;
2907 client.OnParcelReturnObjectsRequest -= LandChannel.ReturnObjectsInParcel; 2908 client.OnParcelReturnObjectsRequest -= LandChannel.ReturnObjectsInParcel;
2908 client.OnParcelSetOtherCleanTime -= LandChannel.SetParcelOtherCleanTime; 2909 client.OnParcelSetOtherCleanTime -= LandChannel.SetParcelOtherCleanTime;
2909 client.OnParcelBuy -= ProcessParcelBuy; 2910 client.OnParcelBuy -= ProcessParcelBuy;
@@ -3249,9 +3250,9 @@ namespace OpenSim.Region.Framework.Scenes
3249 3250
3250 // Don't disable this log message - it's too helpful 3251 // Don't disable this log message - it's too helpful
3251 m_log.DebugFormat( 3252 m_log.DebugFormat(
3252 "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})", 3253 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6}, position {7})",
3253 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, 3254 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
3254 agent.AgentID, agent.circuitcode, teleportFlags); 3255 agent.AgentID, agent.circuitcode, teleportFlags, agent.startpos);
3255 3256
3256 if (LoginsDisabled) 3257 if (LoginsDisabled)
3257 { 3258 {
@@ -3294,7 +3295,7 @@ namespace OpenSim.Region.Framework.Scenes
3294 catch (Exception e) 3295 catch (Exception e)
3295 { 3296 {
3296 m_log.ErrorFormat( 3297 m_log.ErrorFormat(
3297 "[CONNECTION BEGIN]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); 3298 "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace);
3298 return false; 3299 return false;
3299 } 3300 }
3300 } 3301 }
@@ -3307,12 +3308,12 @@ namespace OpenSim.Region.Framework.Scenes
3307 catch (Exception e) 3308 catch (Exception e)
3308 { 3309 {
3309 m_log.ErrorFormat( 3310 m_log.ErrorFormat(
3310 "[CONNECTION BEGIN]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); 3311 "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace);
3311 return false; 3312 return false;
3312 } 3313 }
3313 3314
3314 m_log.InfoFormat( 3315 m_log.InfoFormat(
3315 "[CONNECTION BEGIN]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", 3316 "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})",
3316 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, 3317 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
3317 agent.AgentID, agent.circuitcode); 3318 agent.AgentID, agent.circuitcode);
3318 3319
@@ -3522,15 +3523,11 @@ namespace OpenSim.Region.Framework.Scenes
3522 m_log.ErrorFormat("[CONNECTION BEGIN]: Estate Settings is null!"); 3523 m_log.ErrorFormat("[CONNECTION BEGIN]: Estate Settings is null!");
3523 } 3524 }
3524 3525
3525 IGroupsModule groupsModule =
3526 RequestModuleInterface<IGroupsModule>();
3527
3528 List<UUID> agentGroups = new List<UUID>(); 3526 List<UUID> agentGroups = new List<UUID>();
3529 3527
3530 if (groupsModule != null) 3528 if (m_groupsModule != null)
3531 { 3529 {
3532 GroupMembershipData[] GroupMembership = 3530 GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID);
3533 groupsModule.GetMembershipData(agent.AgentID);
3534 3531
3535 if (GroupMembership != null) 3532 if (GroupMembership != null)
3536 { 3533 {
@@ -4287,7 +4284,7 @@ namespace OpenSim.Region.Framework.Scenes
4287 /// Get a scene object group that contains the prim with the given local id 4284 /// Get a scene object group that contains the prim with the given local id
4288 /// </summary> 4285 /// </summary>
4289 /// <param name="localID"></param> 4286 /// <param name="localID"></param>
4290 /// <returns>null if no scene object group containing that prim is found</returns> 4287 /// <returns>null if no scene object group containing that prim is found</returns>
4291 public SceneObjectGroup GetGroupByPrim(uint localID) 4288 public SceneObjectGroup GetGroupByPrim(uint localID)
4292 { 4289 {
4293 return m_sceneGraph.GetGroupByPrim(localID); 4290 return m_sceneGraph.GetGroupByPrim(localID);
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index d76ed3e..58a7b20 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -204,13 +204,10 @@ namespace OpenSim.Region.Framework.Scenes
204 /// <param name="regionslst"></param> 204 /// <param name="regionslst"></param>
205 public void SendCloseChildAgentConnections(UUID agentID, List<ulong> regionslst) 205 public void SendCloseChildAgentConnections(UUID agentID, List<ulong> regionslst)
206 { 206 {
207 Util.FireAndForget(delegate 207 foreach (ulong handle in regionslst)
208 { 208 {
209 foreach (ulong handle in regionslst) 209 SendCloseChildAgent(agentID, handle);
210 { 210 }
211 SendCloseChildAgent(agentID, handle);
212 }
213 });
214 } 211 }
215 212
216 public List<GridRegion> RequestNamedRegions(string name, int maxNumber) 213 public List<GridRegion> RequestNamedRegions(string name, int maxNumber)
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index af95c28..a3e4b46 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -575,20 +575,6 @@ namespace OpenSim.Region.Framework.Scenes
575 } 575 }
576 } 576 }
577 577
578 protected internal void HandleObjectGroupUpdate(
579 IClientAPI remoteClient, UUID GroupID, uint objectLocalID, UUID Garbage)
580 {
581 if (!remoteClient.IsGroupMember(GroupID))
582 return;
583
584 SceneObjectGroup group = GetGroupByPrim(objectLocalID);
585 if (group != null)
586 {
587 if (group.OwnerID == remoteClient.AgentId)
588 group.SetGroup(GroupID, remoteClient);
589 }
590 }
591
592 protected internal ScenePresence CreateAndAddChildScenePresence( 578 protected internal ScenePresence CreateAndAddChildScenePresence(
593 IClientAPI client, AvatarAppearance appearance, PresenceType type) 579 IClientAPI client, AvatarAppearance appearance, PresenceType type)
594 { 580 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index f9e0b83..abea788 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1373,19 +1373,23 @@ namespace OpenSim.Region.Framework.Scenes
1373 1373
1374 #endregion 1374 #endregion
1375 1375
1376 // Send the parts of this SOG to a single client 1376 /// <summary>
1377 // Used when the client initially connects and when client sends RequestPrim packet 1377 /// Send the parts of this SOG to a single client
1378 /// </summary>
1379 /// <remarks>
1380 /// Used when the client initially connects and when client sends RequestPrim packet
1381 /// </remarks>
1382 /// <param name="remoteClient"></param>
1378 public void SendFullUpdateToClient(IClientAPI remoteClient) 1383 public void SendFullUpdateToClient(IClientAPI remoteClient)
1379 { 1384 {
1380 RootPart.SendFullUpdate( 1385 RootPart.SendFullUpdate(remoteClient);
1381 remoteClient, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID));
1382 1386
1383 SceneObjectPart[] parts = m_parts.GetArray(); 1387 SceneObjectPart[] parts = m_parts.GetArray();
1384 for (int i = 0; i < parts.Length; i++) 1388 for (int i = 0; i < parts.Length; i++)
1385 { 1389 {
1386 SceneObjectPart part = parts[i]; 1390 SceneObjectPart part = parts[i];
1387 if (part != RootPart) 1391 if (part != RootPart)
1388 part.SendFullUpdate(remoteClient, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, part.UUID)); 1392 part.SendFullUpdate(remoteClient);
1389 } 1393 }
1390 } 1394 }
1391 1395
@@ -1679,10 +1683,11 @@ namespace OpenSim.Region.Framework.Scenes
1679 1683
1680 /// <summary> 1684 /// <summary>
1681 /// Reset the UUIDs for all the prims that make up this group. 1685 /// Reset the UUIDs for all the prims that make up this group.
1682 /// 1686 /// </summary>
1687 /// <remarks>
1683 /// This is called by methods which want to add a new group to an existing scene, in order 1688 /// This is called by methods which want to add a new group to an existing scene, in order
1684 /// to ensure that there are no clashes with groups already present. 1689 /// to ensure that there are no clashes with groups already present.
1685 /// </summary> 1690 /// </remarks>
1686 public void ResetIDs() 1691 public void ResetIDs()
1687 { 1692 {
1688 lock (m_parts.SyncRoot) 1693 lock (m_parts.SyncRoot)
@@ -3206,6 +3211,8 @@ namespace OpenSim.Region.Framework.Scenes
3206 part.Inventory.ChangeInventoryGroup(GroupID); 3211 part.Inventory.ChangeInventoryGroup(GroupID);
3207 } 3212 }
3208 3213
3214 HasGroupChanged = true;
3215
3209 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled 3216 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled
3210 // for the same object with very different properties. The caller must schedule the update. 3217 // for the same object with very different properties. The caller must schedule the update.
3211 //ScheduleGroupForFullUpdate(); 3218 //ScheduleGroupForFullUpdate();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index f5a00d7..b29ecc6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2836,8 +2836,7 @@ namespace OpenSim.Region.Framework.Scenes
2836 /// Send a full update to the client for the given part 2836 /// Send a full update to the client for the given part
2837 /// </summary> 2837 /// </summary>
2838 /// <param name="remoteClient"></param> 2838 /// <param name="remoteClient"></param>
2839 /// <param name="clientFlags"></param> 2839 protected internal void SendFullUpdate(IClientAPI remoteClient)
2840 protected internal void SendFullUpdate(IClientAPI remoteClient, uint clientFlags)
2841 { 2840 {
2842 if (ParentGroup == null) 2841 if (ParentGroup == null)
2843 return; 2842 return;
@@ -2849,16 +2848,16 @@ namespace OpenSim.Region.Framework.Scenes
2849 { 2848 {
2850 if (ParentGroup.IsAttachment) 2849 if (ParentGroup.IsAttachment)
2851 { 2850 {
2852 SendFullUpdateToClient(remoteClient, AttachedPos, clientFlags); 2851 SendFullUpdateToClient(remoteClient, AttachedPos);
2853 } 2852 }
2854 else 2853 else
2855 { 2854 {
2856 SendFullUpdateToClient(remoteClient, AbsolutePosition, clientFlags); 2855 SendFullUpdateToClient(remoteClient, AbsolutePosition);
2857 } 2856 }
2858 } 2857 }
2859 else 2858 else
2860 { 2859 {
2861 SendFullUpdateToClient(remoteClient, clientFlags); 2860 SendFullUpdateToClient(remoteClient);
2862 } 2861 }
2863 } 2862 }
2864 2863
@@ -2872,7 +2871,7 @@ namespace OpenSim.Region.Framework.Scenes
2872 2871
2873 ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 2872 ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
2874 { 2873 {
2875 SendFullUpdate(avatar.ControllingClient, avatar.GenerateClientFlags(UUID)); 2874 SendFullUpdate(avatar.ControllingClient);
2876 }); 2875 });
2877 } 2876 }
2878 2877
@@ -2880,12 +2879,9 @@ namespace OpenSim.Region.Framework.Scenes
2880 /// Sends a full update to the client 2879 /// Sends a full update to the client
2881 /// </summary> 2880 /// </summary>
2882 /// <param name="remoteClient"></param> 2881 /// <param name="remoteClient"></param>
2883 /// <param name="clientFlags"></param> 2882 public void SendFullUpdateToClient(IClientAPI remoteClient)
2884 public void SendFullUpdateToClient(IClientAPI remoteClient, uint clientflags)
2885 { 2883 {
2886 Vector3 lPos; 2884 SendFullUpdateToClient(remoteClient, OffsetPosition);
2887 lPos = OffsetPosition;
2888 SendFullUpdateToClient(remoteClient, lPos, clientflags);
2889 } 2885 }
2890 2886
2891 /// <summary> 2887 /// <summary>
@@ -2893,8 +2889,7 @@ namespace OpenSim.Region.Framework.Scenes
2893 /// </summary> 2889 /// </summary>
2894 /// <param name="remoteClient"></param> 2890 /// <param name="remoteClient"></param>
2895 /// <param name="lPos"></param> 2891 /// <param name="lPos"></param>
2896 /// <param name="clientFlags"></param> 2892 public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos)
2897 public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos, uint clientFlags)
2898 { 2893 {
2899 if (ParentGroup == null) 2894 if (ParentGroup == null)
2900 return; 2895 return;
@@ -2911,15 +2906,10 @@ namespace OpenSim.Region.Framework.Scenes
2911 (ParentGroup.AttachmentPoint >= 31) && (ParentGroup.AttachmentPoint <= 38)) 2906 (ParentGroup.AttachmentPoint >= 31) && (ParentGroup.AttachmentPoint <= 38))
2912 return; 2907 return;
2913 2908
2914 clientFlags &= ~(uint) PrimFlags.CreateSelected;
2915
2916 if (remoteClient.AgentId == OwnerID) 2909 if (remoteClient.AgentId == OwnerID)
2917 { 2910 {
2918 if ((Flags & PrimFlags.CreateSelected) != 0) 2911 if ((Flags & PrimFlags.CreateSelected) != 0)
2919 {
2920 clientFlags |= (uint) PrimFlags.CreateSelected;
2921 Flags &= ~PrimFlags.CreateSelected; 2912 Flags &= ~PrimFlags.CreateSelected;
2922 }
2923 } 2913 }
2924 //bool isattachment = IsAttachment; 2914 //bool isattachment = IsAttachment;
2925 //if (LocalId != ParentGroup.RootPart.LocalId) 2915 //if (LocalId != ParentGroup.RootPart.LocalId)
@@ -3354,6 +3344,11 @@ namespace OpenSim.Region.Framework.Scenes
3354 3344
3355 public void SetGroup(UUID groupID, IClientAPI client) 3345 public void SetGroup(UUID groupID, IClientAPI client)
3356 { 3346 {
3347 // Scene.AddNewPrims() calls with client == null so can't use this.
3348// m_log.DebugFormat(
3349// "[SCENE OBJECT PART]: Setting group for {0} to {1} for {2}",
3350// Name, groupID, OwnerID);
3351
3357 GroupID = groupID; 3352 GroupID = groupID;
3358 if (client != null) 3353 if (client != null)
3359 SendPropertiesToClient(client); 3354 SendPropertiesToClient(client);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index beff239..b8ae553 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -285,16 +285,10 @@ namespace OpenSim.Region.Framework.Scenes
285 285
286 #region Properties 286 #region Properties
287 287
288 protected PhysicsActor m_physicsActor;
289
290 /// <summary> 288 /// <summary>
291 /// Physical scene representation of this Avatar. 289 /// Physical scene representation of this Avatar.
292 /// </summary> 290 /// </summary>
293 public PhysicsActor PhysicsActor 291 public PhysicsActor PhysicsActor { get; private set; }
294 {
295 set { m_physicsActor = value; }
296 get { return m_physicsActor; }
297 }
298 292
299 private byte m_movementflag; 293 private byte m_movementflag;
300 294
@@ -508,9 +502,9 @@ namespace OpenSim.Region.Framework.Scenes
508 { 502 {
509 m_pos = PhysicsActor.Position; 503 m_pos = PhysicsActor.Position;
510 504
511// m_log.DebugFormat( 505 //m_log.DebugFormat(
512// "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!", 506 // "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!",
513// m_pos, Name, Scene.RegionInfo.RegionName); 507 // m_pos, Name, Scene.RegionInfo.RegionName);
514 } 508 }
515 else 509 else
516 { 510 {
@@ -540,7 +534,6 @@ namespace OpenSim.Region.Framework.Scenes
540 } 534 }
541 } 535 }
542 } 536 }
543
544 return m_pos; 537 return m_pos;
545 } 538 }
546 set 539 set
@@ -560,9 +553,9 @@ namespace OpenSim.Region.Framework.Scenes
560 m_pos = value; 553 m_pos = value;
561 ParentPosition = Vector3.Zero; 554 ParentPosition = Vector3.Zero;
562 555
563// m_log.DebugFormat( 556 //m_log.DebugFormat(
564// "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", 557 // "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}",
565// Scene.RegionInfo.RegionName, Name, m_pos); 558 // Scene.RegionInfo.RegionName, Name, m_pos);
566 } 559 }
567 } 560 }
568 561
@@ -791,7 +784,6 @@ namespace OpenSim.Region.Framework.Scenes
791 public void RegisterToEvents() 784 public void RegisterToEvents()
792 { 785 {
793 ControllingClient.OnCompleteMovementToRegion += CompleteMovement; 786 ControllingClient.OnCompleteMovementToRegion += CompleteMovement;
794 //ControllingClient.OnCompleteMovementToRegion += SendInitialData;
795 ControllingClient.OnAgentUpdate += HandleAgentUpdate; 787 ControllingClient.OnAgentUpdate += HandleAgentUpdate;
796 ControllingClient.OnAgentRequestSit += HandleAgentRequestSit; 788 ControllingClient.OnAgentRequestSit += HandleAgentRequestSit;
797 ControllingClient.OnAgentSit += HandleAgentSit; 789 ControllingClient.OnAgentSit += HandleAgentSit;
@@ -839,11 +831,6 @@ namespace OpenSim.Region.Framework.Scenes
839 831
840 #endregion 832 #endregion
841 833
842 public uint GenerateClientFlags(UUID ObjectID)
843 {
844 return m_scene.Permissions.GenerateClientFlags(m_uuid, ObjectID);
845 }
846
847 #region Status Methods 834 #region Status Methods
848 835
849 /// <summary> 836 /// <summary>
@@ -1032,18 +1019,19 @@ namespace OpenSim.Region.Framework.Scenes
1032 { 1019 {
1033 if (PhysicsActor != null) 1020 if (PhysicsActor != null)
1034 { 1021 {
1035 try 1022// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
1036 { 1023 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall;
1037 PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; 1024 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
1038 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; 1025 PhysicsActor.UnSubscribeEvents();
1039 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); 1026 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
1040 PhysicsActor.UnSubscribeEvents(); 1027 PhysicsActor = null;
1041 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
1042 PhysicsActor = null;
1043 }
1044 catch
1045 { }
1046 } 1028 }
1029// else
1030// {
1031// m_log.ErrorFormat(
1032// "[SCENE PRESENCE]: Attempt to remove physics actor for {0} on {1} but this scene presence has no physics actor",
1033// Name, Scene.RegionInfo.RegionName);
1034// }
1047 } 1035 }
1048 1036
1049 /// <summary> 1037 /// <summary>
@@ -1154,13 +1142,11 @@ namespace OpenSim.Region.Framework.Scenes
1154 /// <summary> 1142 /// <summary>
1155 /// Sets avatar height in the physics plugin 1143 /// Sets avatar height in the physics plugin
1156 /// </summary> 1144 /// </summary>
1145 /// <param name="height">New height of avatar</param>
1157 public void SetHeight(float height) 1146 public void SetHeight(float height)
1158 { 1147 {
1159 if (PhysicsActor != null && !IsChildAgent) 1148 if (PhysicsActor != null && !IsChildAgent)
1160 { 1149 PhysicsActor.Size = new Vector3(0.45f, 0.6f, height);
1161 Vector3 SetSize = new Vector3(0.45f, 0.6f, height);
1162 PhysicsActor.Size = SetSize;
1163 }
1164 } 1150 }
1165 1151
1166 /// <summary> 1152 /// <summary>
@@ -1925,7 +1911,7 @@ namespace OpenSim.Region.Framework.Scenes
1925// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied); 1911// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied);
1926 1912
1927 if (PhysicsActor != null) 1913 if (PhysicsActor != null)
1928 m_sitAvatarHeight = m_physicsActor.Size.Z; 1914 m_sitAvatarHeight = PhysicsActor.Size.Z;
1929 1915
1930 bool canSit = false; 1916 bool canSit = false;
1931 pos = part.AbsolutePosition + offset; 1917 pos = part.AbsolutePosition + offset;
@@ -2570,7 +2556,10 @@ namespace OpenSim.Region.Framework.Scenes
2570 // only send update from root agents to other clients; children are only "listening posts" 2556 // only send update from root agents to other clients; children are only "listening posts"
2571 if (IsChildAgent) 2557 if (IsChildAgent)
2572 { 2558 {
2573 m_log.Warn("[SCENE PRESENCE]: Attempt to send avatar data from a child agent"); 2559 m_log.WarnFormat(
2560 "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}",
2561 Name, Scene.RegionInfo.RegionName);
2562
2574 return; 2563 return;
2575 } 2564 }
2576 2565
@@ -2628,7 +2617,10 @@ namespace OpenSim.Region.Framework.Scenes
2628 // only send update from root agents to other clients; children are only "listening posts" 2617 // only send update from root agents to other clients; children are only "listening posts"
2629 if (IsChildAgent) 2618 if (IsChildAgent)
2630 { 2619 {
2631 m_log.Warn("[SCENE PRESENCE]: Attempt to send avatar data from a child agent"); 2620 m_log.WarnFormat(
2621 "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}",
2622 Name, Scene.RegionInfo.RegionName);
2623
2632 return; 2624 return;
2633 } 2625 }
2634 2626
@@ -2675,7 +2667,7 @@ namespace OpenSim.Region.Framework.Scenes
2675 public void SendAppearanceToAgent(ScenePresence avatar) 2667 public void SendAppearanceToAgent(ScenePresence avatar)
2676 { 2668 {
2677// m_log.DebugFormat( 2669// m_log.DebugFormat(
2678// "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); 2670// "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);
2679 2671
2680 avatar.ControllingClient.SendAppearance( 2672 avatar.ControllingClient.SendAppearance(
2681 UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); 2673 UUID, Appearance.VisualParams, Appearance.Texture.GetBytes());
@@ -2957,7 +2949,10 @@ namespace OpenSim.Region.Framework.Scenes
2957 if (byebyeRegions.Count > 0) 2949 if (byebyeRegions.Count > 0)
2958 { 2950 {
2959 m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); 2951 m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents");
2960 m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions); 2952 Util.FireAndForget(delegate
2953 {
2954 m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions);
2955 });
2961 } 2956 }
2962 2957
2963 foreach (ulong handle in byebyeRegions) 2958 foreach (ulong handle in byebyeRegions)
@@ -3007,6 +3002,7 @@ namespace OpenSim.Region.Framework.Scenes
3007 CopyFrom(cAgentData); 3002 CopyFrom(cAgentData);
3008 } 3003 }
3009 3004
3005 private static Vector3 marker = new Vector3(-1f, -1f, -1f);
3010 /// <summary> 3006 /// <summary>
3011 /// This updates important decision making data about a child agent 3007 /// This updates important decision making data about a child agent
3012 /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region 3008 /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region
@@ -3027,8 +3023,8 @@ namespace OpenSim.Region.Framework.Scenes
3027 // region's draw distance. 3023 // region's draw distance.
3028 // DrawDistance = cAgentData.Far; 3024 // DrawDistance = cAgentData.Far;
3029 DrawDistance = Scene.DefaultDrawDistance; 3025 DrawDistance = Scene.DefaultDrawDistance;
3030 3026
3031 if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! 3027 if (cAgentData.Position != marker) // UGH!!
3032 m_pos = cAgentData.Position + offset; 3028 m_pos = cAgentData.Position + offset;
3033 3029
3034 if (Vector3.Distance(AbsolutePosition, posLastSignificantMove) >= Scene.ChildReprioritizationDistance) 3030 if (Vector3.Distance(AbsolutePosition, posLastSignificantMove) >= Scene.ChildReprioritizationDistance)
@@ -3039,8 +3035,6 @@ namespace OpenSim.Region.Framework.Scenes
3039 3035
3040 CameraPosition = cAgentData.Center + offset; 3036 CameraPosition = cAgentData.Center + offset;
3041 3037
3042 //SetHeight(cAgentData.AVHeight);
3043
3044 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) 3038 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
3045 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); 3039 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
3046 3040
@@ -3251,6 +3245,13 @@ namespace OpenSim.Region.Framework.Scenes
3251// "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}", 3245// "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}",
3252// Name, isFlying, Scene.RegionInfo.RegionName); 3246// Name, isFlying, Scene.RegionInfo.RegionName);
3253 3247
3248 if (PhysicsActor != null)
3249 {
3250 m_log.ErrorFormat(
3251 "[SCENE PRESENCE]: Adding physics actor for {0} to {1} but this scene presence already has a physics actor",
3252 Name, Scene.RegionInfo.RegionName);
3253 }
3254
3254 if (Appearance.AvatarHeight == 0) 3255 if (Appearance.AvatarHeight == 0)
3255 Appearance.SetHeight(); 3256 Appearance.SetHeight();
3256 3257
@@ -3258,18 +3259,15 @@ namespace OpenSim.Region.Framework.Scenes
3258 3259
3259 Vector3 pVec = AbsolutePosition; 3260 Vector3 pVec = AbsolutePosition;
3260 3261
3261 // Old bug where the height was in centimeters instead of meters 3262 PhysicsActor = scene.AddAvatar(
3262 PhysicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec, 3263 LocalId, Firstname + "." + Lastname, pVec,
3263 new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying); 3264 new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying);
3264 3265
3265 scene.AddPhysicsActorTaint(PhysicsActor);
3266 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 3266 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
3267 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 3267 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3268 PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong 3268 PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
3269 PhysicsActor.SubscribeEvents(500); 3269 PhysicsActor.SubscribeEvents(500);
3270 PhysicsActor.LocalID = LocalId; 3270 PhysicsActor.LocalID = LocalId;
3271
3272 SetHeight(Appearance.AvatarHeight);
3273 } 3271 }
3274 3272
3275 private void OutOfBoundsCall(Vector3 pos) 3273 private void OutOfBoundsCall(Vector3 pos)
diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
index 40cbc60..1ce24f1 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
@@ -50,8 +50,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
50 { 50 {
51// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 public const string SHOW_APPEARANCE_FORMAT = "{0,-9} {1}";
54
55 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); 53 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
56// private IAvatarFactoryModule m_avatarFactory; 54// private IAvatarFactoryModule m_avatarFactory;
57 55
@@ -197,37 +195,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
197 { 195 {
198 ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName); 196 ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName);
199 if (sp != null && !sp.IsChildAgent) 197 if (sp != null && !sp.IsChildAgent)
200 { 198 scene.AvatarFactory.WriteBakedTexturesReport(sp, MainConsole.Instance.OutputFormat);
201 MainConsole.Instance.OutputFormat("For {0} in {1}", sp.Name, scene.RegionInfo.RegionName);
202 MainConsole.Instance.OutputFormat(SHOW_APPEARANCE_FORMAT, "Bake Type", "UUID");
203
204 Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures
205 = scene.AvatarFactory.GetBakedTextureFaces(sp.UUID);
206 foreach (BakeType bt in bakedTextures.Keys)
207 {
208 string rawTextureID;
209
210 if (bakedTextures[bt] == null)
211 {
212 rawTextureID = "not set";
213 }
214 else
215 {
216 rawTextureID = bakedTextures[bt].TextureID.ToString();
217
218 if (scene.AssetService.Get(rawTextureID) == null)
219 rawTextureID += " (not found)";
220 else
221 rawTextureID += " (uploaded)";
222 }
223
224 MainConsole.Instance.OutputFormat(SHOW_APPEARANCE_FORMAT, bt, rawTextureID);
225 }
226
227 bool bakedTextureValid = scene.AvatarFactory.ValidateBakedTextureCache(sp);
228 MainConsole.Instance.OutputFormat(
229 "{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt");
230 }
231 } 199 }
232 else 200 else
233 { 201 {
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index d452905..740dbdd 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -29,25 +29,18 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Timers; 31using System.Timers;
32
33using log4net; 32using log4net;
34using Mono.Addins; 33using Mono.Addins;
35using Nini.Config; 34using Nini.Config;
36
37using OpenMetaverse; 35using OpenMetaverse;
38using OpenMetaverse.StructuredData; 36using OpenMetaverse.StructuredData;
39
40using OpenSim.Framework; 37using OpenSim.Framework;
41using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
42using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
44
45using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
46
47using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags; 42using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags;
48 43
49
50
51namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups 44namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
52{ 45{
53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
@@ -90,7 +83,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
90 // Configuration settings 83 // Configuration settings
91 private bool m_groupsEnabled = false; 84 private bool m_groupsEnabled = false;
92 private bool m_groupNoticesEnabled = true; 85 private bool m_groupNoticesEnabled = true;
93 private bool m_debugEnabled = true; 86 private bool m_debugEnabled = false;
94 87
95 #region IRegionModuleBase Members 88 #region IRegionModuleBase Members
96 89
@@ -232,7 +225,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
232 // Used for Notices and Group Invites/Accept/Reject 225 // Used for Notices and Group Invites/Accept/Reject
233 client.OnInstantMessage += OnInstantMessage; 226 client.OnInstantMessage += OnInstantMessage;
234 227
235 // Send client thier groups information. 228 // Send client their groups information.
236 SendAgentGroupDataUpdate(client, client.AgentId); 229 SendAgentGroupDataUpdate(client, client.AgentId);
237 } 230 }
238 231
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index a08bcd0..52fc27d 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -52,6 +52,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
52 { 52 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 54
55 private bool m_debugEnabled = false;
56
55 public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | 57 public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome |
56 GroupPowers.Accountable | 58 GroupPowers.Accountable |
57 GroupPowers.JoinChat | 59 GroupPowers.JoinChat |
@@ -81,7 +83,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
81 private Dictionary<UUID, List<UUID>> m_groupsAgentsDroppedFromChatSession = new Dictionary<UUID, List<UUID>>(); 83 private Dictionary<UUID, List<UUID>> m_groupsAgentsDroppedFromChatSession = new Dictionary<UUID, List<UUID>>();
82 private Dictionary<UUID, List<UUID>> m_groupsAgentsInvitedToChatSession = new Dictionary<UUID, List<UUID>>(); 84 private Dictionary<UUID, List<UUID>> m_groupsAgentsInvitedToChatSession = new Dictionary<UUID, List<UUID>>();
83 85
84
85 #region IRegionModuleBase Members 86 #region IRegionModuleBase Members
86 87
87 public string Name 88 public string Name
@@ -115,7 +116,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
115 return; 116 return;
116 } 117 }
117 118
118 m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Initializing {0}", this.Name); 119 m_log.DebugFormat("[XMLRPC-GROUPS-CONNECTOR]: Initializing {0}", this.Name);
119 120
120 m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty); 121 m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty);
121 if ((m_groupsServerURI == null) || 122 if ((m_groupsServerURI == null) ||
@@ -142,6 +143,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
142 m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Timeout set to {0}.", m_cacheTimeout); 143 m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Timeout set to {0}.", m_cacheTimeout);
143 } 144 }
144 145
146 m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", false);
147
145 // If we got all the config options we need, lets start'er'up 148 // If we got all the config options we need, lets start'er'up
146 m_memoryCache = new ExpiringCache<string, XmlRpcResponse>(); 149 m_memoryCache = new ExpiringCache<string, XmlRpcResponse>();
147 m_connectorEnabled = true; 150 m_connectorEnabled = true;
@@ -150,7 +153,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
150 153
151 public void Close() 154 public void Close()
152 { 155 {
153 m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Closing {0}", this.Name); 156 m_log.DebugFormat("[XMLRPC-GROUPS-CONNECTOR]: Closing {0}", this.Name);
154 } 157 }
155 158
156 public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) 159 public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene)
@@ -958,6 +961,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
958 961
959 if (resp == null) 962 if (resp == null)
960 { 963 {
964 if (m_debugEnabled)
965 m_log.DebugFormat("[XMLRPC-GROUPS-CONNECTOR]: Cache miss for key {0}", CacheKey);
966
961 string UserService; 967 string UserService;
962 UUID SessionID; 968 UUID SessionID;
963 GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); 969 GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
index 9964edc..b1a3ff9 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
@@ -44,8 +44,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
44 private bool flying; 44 private bool flying;
45 private bool iscolliding; 45 private bool iscolliding;
46 46
47 public BasicActor() 47 public BasicActor(Vector3 size)
48 { 48 {
49 Size = size;
49 } 50 }
50 51
51 public override int PhysicsActorType 52 public override int PhysicsActorType
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
index 1ceed1a..2e14216 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
56 } 56 }
57 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) 57 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
58 { 58 {
59 BasicActor act = new BasicActor(); 59 BasicActor act = new BasicActor(size);
60 act.Position = position; 60 act.Position = position;
61 act.Flying = isFlying; 61 act.Flying = isFlying;
62 _actors.Add(act); 62 _actors.Add(act);
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 1363cfd..68999fc 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Physics.OdePlugin
137 internal IntPtr Body = IntPtr.Zero; 137 internal IntPtr Body = IntPtr.Zero;
138 private OdeScene _parent_scene; 138 private OdeScene _parent_scene;
139 internal IntPtr Shell = IntPtr.Zero; 139 internal IntPtr Shell = IntPtr.Zero;
140 internal IntPtr Amotor = IntPtr.Zero; 140 private IntPtr Amotor = IntPtr.Zero;
141 private d.Mass ShellMass; 141 private d.Mass ShellMass;
142 142
143 private int m_eventsubscription = 0; 143 private int m_eventsubscription = 0;
@@ -195,13 +195,10 @@ namespace OpenSim.Region.Physics.OdePlugin
195 // new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f, 195 // new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f,
196 // 0.5f); 196 // 0.5f);
197 197
198 for (int i = 0; i < 11; i++) 198 // We can set taint and actual to be the same here, since the entire character will be set up when the
199 { 199 // m_tainted_isPhysical is processed.
200 m_colliderarr[i] = false; 200 SetTaintedCapsuleLength(size);
201 } 201 CAPSULE_LENGTH = m_tainted_CAPSULE_LENGTH;
202 CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
203 //m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH.ToString());
204 m_tainted_CAPSULE_LENGTH = CAPSULE_LENGTH;
205 202
206 m_isPhysical = false; // current status: no ODE information exists 203 m_isPhysical = false; // current status: no ODE information exists
207 m_tainted_isPhysical = true; // new tainted status: need to create ODE information 204 m_tainted_isPhysical = true; // new tainted status: need to create ODE information
@@ -457,24 +454,28 @@ namespace OpenSim.Region.Physics.OdePlugin
457 get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); } 454 get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
458 set 455 set
459 { 456 {
460 if (value.IsFinite()) 457 SetTaintedCapsuleLength(value);
461 {
462 m_pidControllerActive = true;
463
464 Vector3 SetSize = value;
465 m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
466// m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH);
467 458
468 // If we reset velocity here, then an avatar stalls when it crosses a border for the first time 459 // If we reset velocity here, then an avatar stalls when it crosses a border for the first time
469 // (as the height of the new root agent is set). 460 // (as the height of the new root agent is set).
470// Velocity = Vector3.Zero; 461// Velocity = Vector3.Zero;
471 462
472 _parent_scene.AddPhysicsActorTaint(this); 463 _parent_scene.AddPhysicsActorTaint(this);
473 } 464 }
474 else 465 }
475 { 466
476 m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size from Scene on {0}", Name); 467 private void SetTaintedCapsuleLength(Vector3 size)
477 } 468 {
469 if (size.IsFinite())
470 {
471 m_pidControllerActive = true;
472
473 m_tainted_CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
474// m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH);
475 }
476 else
477 {
478 m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size for {0} in {1}", Name, _parent_scene.Name);
478 } 479 }
479 } 480 }
480 481
@@ -549,8 +550,8 @@ namespace OpenSim.Region.Physics.OdePlugin
549 { 550 {
550 get 551 get
551 { 552 {
552 float AVvolume = (float) (Math.PI*Math.Pow(CAPSULE_RADIUS, 2)*CAPSULE_LENGTH); 553 float AVvolume = (float)(Math.PI * Math.Pow(CAPSULE_RADIUS, 2) * CAPSULE_LENGTH);
553 return m_density*AVvolume; 554 return m_density * AVvolume;
554 } 555 }
555 } 556 }
556 557
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index c1a3e61..04ba738 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -205,27 +205,9 @@ namespace OpenSim.Region.Physics.OdePlugin
205 private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); 205 private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>();
206 206
207 /// <summary> 207 /// <summary>
208 /// Used to lock on manipulation of _taintedPrimL and _taintedPrimH 208 /// Prims that the simulator has created/deleted/updated and so need updating in ODE.
209 /// </summary> 209 /// </summary>
210 private readonly Object _taintedPrimLock = new Object(); 210 private readonly HashSet<OdePrim> _taintedPrims = new HashSet<OdePrim>();
211
212 /// <summary>
213 /// List of tainted prims.
214 /// </summary>
215 /// <remarks>
216 /// A tainted prim is one that has taints to process before performing any other operations. The list is
217 /// cleared after processing.
218 /// </remarks>
219 private readonly List<OdePrim> _taintedPrimL = new List<OdePrim>();
220
221 /// <summary>
222 /// HashSet of tainted prims.
223 /// </summary>
224 /// <remarks>
225 /// A tainted prim is one that has taints to process before performing any other operations. The hashset is
226 /// cleared after processing.
227 /// </remarks>
228 private readonly HashSet<OdePrim> _taintedPrimH = new HashSet<OdePrim>();
229 211
230 /// <summary> 212 /// <summary>
231 /// Record a character that has taints to be processed. 213 /// Record a character that has taints to be processed.
@@ -767,7 +749,7 @@ namespace OpenSim.Region.Physics.OdePlugin
767 } 749 }
768 catch (AccessViolationException) 750 catch (AccessViolationException)
769 { 751 {
770 m_log.Warn("[ODE SCENE]: Unable to collide test a space"); 752 m_log.Error("[ODE SCENE]: Unable to collide test a space");
771 return; 753 return;
772 } 754 }
773 //Colliding a space or a geom with a space or a geom. so drill down 755 //Colliding a space or a geom with a space or a geom. so drill down
@@ -829,7 +811,7 @@ namespace OpenSim.Region.Physics.OdePlugin
829 } 811 }
830 catch (Exception e) 812 catch (Exception e)
831 { 813 {
832 m_log.WarnFormat("[ODE SCENE]: Unable to collide test an object: {0}", e.Message); 814 m_log.ErrorFormat("[ODE SCENE]: Unable to collide test an object: {0}", e.Message);
833 return; 815 return;
834 } 816 }
835 817
@@ -1554,7 +1536,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1554 } 1536 }
1555 catch (AccessViolationException) 1537 catch (AccessViolationException)
1556 { 1538 {
1557 m_log.WarnFormat("[ODE SCENE]: Unable to space collide {0}", Name); 1539 m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", Name);
1558 } 1540 }
1559 1541
1560 //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); 1542 //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y);
@@ -1585,13 +1567,14 @@ namespace OpenSim.Region.Physics.OdePlugin
1585 removeprims = new List<OdePrim>(); 1567 removeprims = new List<OdePrim>();
1586 } 1568 }
1587 removeprims.Add(chr); 1569 removeprims.Add(chr);
1588 m_log.Debug("[ODE SCENE]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!"); 1570 m_log.Error(
1571 "[ODE SCENE]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!");
1589 } 1572 }
1590 } 1573 }
1591 } 1574 }
1592 catch (AccessViolationException) 1575 catch (AccessViolationException)
1593 { 1576 {
1594 m_log.Warn("[ODE SCENE]: Unable to space collide"); 1577 m_log.Error("[ODE SCENE]: Unable to space collide");
1595 } 1578 }
1596 } 1579 }
1597 } 1580 }
@@ -1716,7 +1699,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1716 1699
1717 public override void RemoveAvatar(PhysicsActor actor) 1700 public override void RemoveAvatar(PhysicsActor actor)
1718 { 1701 {
1719 //m_log.Debug("[PHYSICS]:ODELOCK"); 1702// m_log.DebugFormat(
1703// "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2}",
1704// actor.Name, actor.LocalID, Name);
1705
1720 ((OdeCharacter) actor).Destroy(); 1706 ((OdeCharacter) actor).Destroy();
1721 } 1707 }
1722 1708
@@ -1726,6 +1712,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1726 { 1712 {
1727 _characters.Add(chr); 1713 _characters.Add(chr);
1728 1714
1715// m_log.DebugFormat(
1716// "[ODE SCENE]: Adding physics character {0} {1} to physics scene {2}. Count now {3}",
1717// chr.Name, chr.LocalID, Name, _characters.Count);
1718
1729 if (chr.bad) 1719 if (chr.bad)
1730 m_log.ErrorFormat("[ODE SCENE]: Added BAD actor {0} to characters list", chr.m_uuid); 1720 m_log.ErrorFormat("[ODE SCENE]: Added BAD actor {0} to characters list", chr.m_uuid);
1731 } 1721 }
@@ -1740,11 +1730,19 @@ namespace OpenSim.Region.Physics.OdePlugin
1740 internal void RemoveCharacter(OdeCharacter chr) 1730 internal void RemoveCharacter(OdeCharacter chr)
1741 { 1731 {
1742 if (_characters.Contains(chr)) 1732 if (_characters.Contains(chr))
1733 {
1743 _characters.Remove(chr); 1734 _characters.Remove(chr);
1735
1736// m_log.DebugFormat(
1737// "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2}. Count now {3}",
1738// chr.Name, chr.LocalID, Name, _characters.Count);
1739 }
1744 else 1740 else
1741 {
1745 m_log.ErrorFormat( 1742 m_log.ErrorFormat(
1746 "[ODE SCENE]: Tried to remove character {0} {1} but they are not in the list!", 1743 "[ODE SCENE]: Tried to remove character {0} {1} but they are not in the list!",
1747 chr.Name, chr.LocalID); 1744 chr.Name, chr.LocalID);
1745 }
1748 } 1746 }
1749 1747
1750 private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, 1748 private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
@@ -1782,7 +1780,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1782 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, 1780 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
1783 Vector3 size, Quaternion rotation, bool isPhysical, uint localid) 1781 Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
1784 { 1782 {
1785// m_log.DebugFormat("[ODE SCENE]: Adding physics actor to {0} {1}", primName, localid); 1783// m_log.DebugFormat("[ODE SCENE]: Adding physics prim {0} {1} to physics scene {2}", primName, localid, Name);
1786 1784
1787 return AddPrim(primName, position, size, rotation, pbs, isPhysical, localid); 1785 return AddPrim(primName, position, size, rotation, pbs, isPhysical, localid);
1788 } 1786 }
@@ -2621,29 +2619,17 @@ namespace OpenSim.Region.Physics.OdePlugin
2621 if (actor is OdePrim) 2619 if (actor is OdePrim)
2622 { 2620 {
2623 OdePrim taintedprim = ((OdePrim)actor); 2621 OdePrim taintedprim = ((OdePrim)actor);
2624 lock (_taintedPrimLock) 2622 lock (_taintedPrims)
2625 { 2623 _taintedPrims.Add(taintedprim);
2626 if (!(_taintedPrimH.Contains(taintedprim)))
2627 {
2628#if SPAM
2629Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2630#endif
2631 _taintedPrimH.Add(taintedprim); // HashSet for searching
2632 _taintedPrimL.Add(taintedprim); // List for ordered readout
2633 }
2634 }
2635 } 2624 }
2636 else if (actor is OdeCharacter) 2625 else if (actor is OdeCharacter)
2637 { 2626 {
2638 OdeCharacter taintedchar = ((OdeCharacter)actor); 2627 OdeCharacter taintedchar = ((OdeCharacter)actor);
2639 lock (_taintedActors) 2628 lock (_taintedActors)
2640 { 2629 {
2641 if (!(_taintedActors.Contains(taintedchar))) 2630 _taintedActors.Add(taintedchar);
2642 { 2631 if (taintedchar.bad)
2643 _taintedActors.Add(taintedchar); 2632 m_log.ErrorFormat("[ODE SCENE]: Added BAD actor {0} to tainted actors", taintedchar.m_uuid);
2644 if (taintedchar.bad)
2645 m_log.DebugFormat("[ODE SCENE]: Added BAD actor {0} to tainted actors", taintedchar.m_uuid);
2646 }
2647 } 2633 }
2648 } 2634 }
2649 } 2635 }
@@ -2740,19 +2726,15 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2740 { 2726 {
2741 lock (_taintedActors) 2727 lock (_taintedActors)
2742 { 2728 {
2743 if (_taintedActors.Count > 0) 2729 foreach (OdeCharacter character in _taintedActors)
2744 { 2730 character.ProcessTaints();
2745 foreach (OdeCharacter character in _taintedActors)
2746 character.ProcessTaints();
2747 2731
2748 if (_taintedActors.Count > 0) 2732 _taintedActors.Clear();
2749 _taintedActors.Clear();
2750 }
2751 } 2733 }
2752 2734
2753 lock (_taintedPrimLock) 2735 lock (_taintedPrims)
2754 { 2736 {
2755 foreach (OdePrim prim in _taintedPrimL) 2737 foreach (OdePrim prim in _taintedPrims)
2756 { 2738 {
2757 if (prim.m_taintremove) 2739 if (prim.m_taintremove)
2758 { 2740 {
@@ -2777,12 +2759,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2777 if (SupportsNINJAJoints) 2759 if (SupportsNINJAJoints)
2778 SimulatePendingNINJAJoints(); 2760 SimulatePendingNINJAJoints();
2779 2761
2780 if (_taintedPrimL.Count > 0) 2762 _taintedPrims.Clear();
2781 {
2782//Console.WriteLine("Simulate calls Clear of _taintedPrim list");
2783 _taintedPrimH.Clear();
2784 _taintedPrimL.Clear();
2785 }
2786 } 2763 }
2787 2764
2788 // Move characters 2765 // Move characters
@@ -2793,6 +2770,10 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2793 { 2770 {
2794 foreach (OdeCharacter actor in defects) 2771 foreach (OdeCharacter actor in defects)
2795 { 2772 {
2773 m_log.ErrorFormat(
2774 "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when moving",
2775 actor.Name, actor.LocalID, Name);
2776
2796 RemoveCharacter(actor); 2777 RemoveCharacter(actor);
2797 actor.DestroyOdeStructures(); 2778 actor.DestroyOdeStructures();
2798 } 2779 }
@@ -2854,7 +2835,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2854 foreach (OdeCharacter actor in _characters) 2835 foreach (OdeCharacter actor in _characters)
2855 { 2836 {
2856 if (actor.bad) 2837 if (actor.bad)
2857 m_log.WarnFormat("[ODE SCENE]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid); 2838 m_log.ErrorFormat("[ODE SCENE]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid);
2858 2839
2859 actor.UpdatePositionAndVelocity(defects); 2840 actor.UpdatePositionAndVelocity(defects);
2860 } 2841 }
@@ -2863,6 +2844,10 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
2863 { 2844 {
2864 foreach (OdeCharacter actor in defects) 2845 foreach (OdeCharacter actor in defects)
2865 { 2846 {
2847 m_log.ErrorFormat(
2848 "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when updating position and velocity",
2849 actor.Name, actor.LocalID, Name);
2850
2866 RemoveCharacter(actor); 2851 RemoveCharacter(actor);
2867 actor.DestroyOdeStructures(); 2852 actor.DestroyOdeStructures();
2868 } 2853 }
@@ -3445,7 +3430,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
3445 private void SetTerrain(float[] heightMap, Vector3 pOffset) 3430 private void SetTerrain(float[] heightMap, Vector3 pOffset)
3446 { 3431 {
3447 int startTime = Util.EnvironmentTickCount(); 3432 int startTime = Util.EnvironmentTickCount();
3448 m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0}", Name); 3433 m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", Name, pOffset);
3449 3434
3450 // this._heightmap[i] = (double)heightMap[i]; 3435 // this._heightmap[i] = (double)heightMap[i];
3451 // dbm (danx0r) -- creating a buffer zone of one extra sample all around 3436 // dbm (danx0r) -- creating a buffer zone of one extra sample all around
@@ -3559,7 +3544,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name);
3559 3544
3560 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); 3545 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
3561 d.GeomSetRotation(GroundGeom, ref R); 3546 d.GeomSetRotation(GroundGeom, ref R);
3562 d.GeomSetPosition(GroundGeom, (pOffset.X + ((int)Constants.RegionSize * 0.5f)) - 1, (pOffset.Y + ((int)Constants.RegionSize * 0.5f)) - 1, 0); 3547 d.GeomSetPosition(GroundGeom, (pOffset.X + ((int)Constants.RegionSize * 0.5f)), (pOffset.Y + ((int)Constants.RegionSize * 0.5f)), 0);
3563 IntPtr testGround = IntPtr.Zero; 3548 IntPtr testGround = IntPtr.Zero;
3564 if (RegionTerrain.TryGetValue(pOffset, out testGround)) 3549 if (RegionTerrain.TryGetValue(pOffset, out testGround))
3565 { 3550 {
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
index 9b468dd..09da97a 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -415,7 +415,7 @@ namespace OpenSim.Region.RegionCombinerModule
415 //xxy 415 //xxy
416 //xxx 416 //xxx
417 //xxx 417 //xxx
418 if ((((int)conn.X * (int)Constants.RegionSize) + conn.YEnd 418 if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd
419 >= (regionConnections.X * (int)Constants.RegionSize)) 419 >= (regionConnections.X * (int)Constants.RegionSize))
420 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd 420 && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd
421 >= (regionConnections.Y * (int)Constants.RegionSize))) 421 >= (regionConnections.Y * (int)Constants.RegionSize)))