From 90ea00a1098c918d5eb5a2be2793b109c6622a35 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 23 Feb 2012 22:56:42 +0000 Subject: Try to resolve some problems with viewers crashing after hitting parcel banlines or freezing on the banline. This involves 1) On forcible teleport, call m_scene.RequestTeleportLocation() rather than ScenePresence.Teleport() - only EntityTransferModule now should call SP.Teleport() 2) When avatar is being forcibly moved due to banlines, use a 'stop movement' tolerance of 0.2 to requested position rather than 1 This prevents the avatar sometimes being stuck to banlines until they teleport somewhere else. This aims to fix some problems in http://opensimulator.org/mantis/view.php?id=5822 --- .../CoreModules/World/Land/LandManagementModule.cs | 27 +++++++++++++++++----- OpenSim/Region/Framework/Scenes/Scene.cs | 17 ++++++++++---- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 13 +++++++---- 3 files changed, 41 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 1c503aa..f6d4b40 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -94,8 +94,11 @@ namespace OpenSim.Region.CoreModules.World.Land // caches ExtendedLandData private Cache parcelInfoCache; - private Dictionary forcedPosition = - new Dictionary(); + + /// + /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. + /// + private Dictionary forcedPosition = new Dictionary(); #region INonSharedRegionModule Members @@ -224,22 +227,34 @@ namespace OpenSim.Region.CoreModules.World.Land //When the avatar walks into a ban line on the ground, it prevents getting stuck agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; - //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2) { - Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); +// m_log.DebugFormat( +// "[LAND MANAGEMENT MODULE]: Stopping force position of {0} because {1} is close enough to {2}", +// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]); + forcedPosition.Remove(remoteClient.AgentId); } //if we are far away, teleport else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3) { - Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); - clientAvatar.Teleport(forcedPosition[remoteClient.AgentId]); + Vector3 forcePosition = forcedPosition[remoteClient.AgentId]; +// m_log.DebugFormat( +// "[LAND MANAGEMENT MODULE]: Teleporting out {0} because {1} is too far from avatar position {2}", +// clientAvatar.Name, clientAvatar.AbsolutePosition, forcePosition); + + m_scene.RequestTeleportLocation(remoteClient, m_scene.RegionInfo.RegionHandle, + forcePosition, clientAvatar.Lookat, (uint)Constants.TeleportFlags.ForceRedirect); + forcedPosition.Remove(remoteClient.AgentId); } else { +// m_log.DebugFormat( +// "[LAND MANAGEMENT MODULE]: Forcing {0} from {1} to {2}", +// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]); + //Forces them toward the forced position we want if they aren't there yet agentData.UseClientAgentPosition = true; agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId]; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6187803..cf6e6af 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4699,7 +4699,10 @@ namespace OpenSim.Region.Framework.Scenes Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); if (nearestPoint != null) { - Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); +// m_log.DebugFormat( +// "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", +// avatar.Name, nearestPoint, nearestParcel.LandData.Name); + return nearestPoint.Value; } @@ -4709,12 +4712,16 @@ namespace OpenSim.Region.Framework.Scenes nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); if (nearestPoint != null) { - Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); +// m_log.DebugFormat( +// "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); + return nearestPoint.Value; } - //Ultimate backup if we have no idea where they are - Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); + //Ultimate backup if we have no idea where they are +// m_log.DebugFormat( +// "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); + return avatar.lastKnownAllowedPosition; } @@ -5120,7 +5127,7 @@ namespace OpenSim.Region.Framework.Scenes // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); Vector3 agent_control_v3 = new Vector3(); - presence.HandleMoveToTargetUpdate(ref agent_control_v3); + presence.HandleMoveToTargetUpdate(1, ref agent_control_v3); presence.AddNewMovement(agent_control_v3); } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9cfdf9f..40c8d06 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1048,7 +1048,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// + /// Do not call this directly. Call Scene.RequestTeleportLocation() instead. /// /// public void Teleport(Vector3 pos) @@ -1522,7 +1522,10 @@ namespace OpenSim.Region.Framework.Scenes } else if (bAllowUpdateMoveToPosition) { - if (HandleMoveToTargetUpdate(ref agent_control_v3)) + // The UseClientAgentPosition is set if parcel ban is forcing the avatar to move to a + // certain position. It's only check for tolerance on returning to that position is 0.2 + // rather than 1, at which point it removes its force target. + if (HandleMoveToTargetUpdate(agentData.UseClientAgentPosition ? 0.2 : 1, ref agent_control_v3)) update_movementflag = true; } } @@ -1584,7 +1587,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Cumulative agent movement that this method will update. /// True if movement has been updated in some way. False otherwise. - public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3) + public bool HandleMoveToTargetUpdate(double tolerance, ref Vector3 agent_control_v3) { // m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); @@ -1601,7 +1604,7 @@ namespace OpenSim.Region.Framework.Scenes // Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget); // Check the error term of the current position in relation to the target position - if (distanceToTarget <= 1) + if (distanceToTarget <= tolerance) { // We are close enough to the target AbsolutePosition = MoveToPositionTarget; @@ -1777,7 +1780,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation); Vector3 agent_control_v3 = new Vector3(); - HandleMoveToTargetUpdate(ref agent_control_v3); + HandleMoveToTargetUpdate(1, ref agent_control_v3); AddNewMovement(agent_control_v3); } -- cgit v1.1 From f034958bdca00cdec77f05b7cbddd07ea2584b02 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 23 Feb 2012 23:11:47 +0000 Subject: Load appropriate 32-bit/64-bit Windows sqlite dll if using WebStatsModule. This should resolve http://opensimulator.org/mantis/view.php?id=5901 --- OpenSim/Region/UserStatistics/WebStatsModule.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index f627e37..ad272f7 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs @@ -83,6 +83,9 @@ namespace OpenSim.Region.UserStatistics { if (m_scenes.Count == 0) { + if (Util.IsWindows()) + Util.LoadArchSpecificWindowsDll("sqlite3.dll"); + //IConfig startupConfig = config.Configs["Startup"]; dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3"); -- cgit v1.1 From 0b9f4d7e749a14c556d7f8a4ea64c54625cf58dc Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Wed, 22 Feb 2012 20:15:42 +0100 Subject: llLinkSitTarget implementation http://wiki.secondlife.com/wiki/LlLinkSitTarget --- .../Shared/Api/Implementation/LSL_Api.cs | 32 ++++++++++++++++++---- .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 ++++ 3 files changed, 33 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 61a6907..2eba2b1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6376,16 +6376,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) + protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot) { - m_host.AddScriptLPS(1); // LSL quaternions can normalize to 0, normal Quaternions can't. if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) rot.z = 1; // ZERO_ROTATION = 0,0,0,1 - m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); - m_host.SitTargetOrientation = Rot2Quaternion(rot); - m_host.ParentGroup.HasGroupChanged = true; + part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); + part.SitTargetOrientation = Rot2Quaternion(rot); + part.ParentGroup.HasGroupChanged = true; + } + + public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) + { + m_host.AddScriptLPS(1); + SitTarget(m_host, offset, rot); + } + + public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot) + { + m_host.AddScriptLPS(1); + if (link == ScriptBaseClass.LINK_ROOT) + SitTarget(m_host.ParentGroup.RootPart, offset, rot); + else if (link == ScriptBaseClass.LINK_THIS) + SitTarget(m_host, offset, rot); + else + { + SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); + if (null != part) + { + SitTarget(part, offset, rot); + } + } } public LSL_String llAvatarOnSitTarget() diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 6106a65..7d39ccc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -218,6 +218,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String llGetDisplayName(string id); LSL_String llRequestDisplayName(string id); void llLinkParticleSystem(int linknum, LSL_List rules); + void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot); LSL_String llList2CSV(LSL_List src); LSL_Float llList2Float(LSL_List src, int index); LSL_Integer llList2Integer(LSL_List src, int index); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 83550a5..24c3d95 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -1688,6 +1688,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llSitTarget(offset, rot); } + public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot) + { + m_LSL_Functions.llLinkSitTarget(link, offset, rot); + } + public void llSleep(double sec) { m_LSL_Functions.llSleep(sec); -- cgit v1.1 From fe229f10e65ca979a127b316f75bb48fc7d19aa2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 04:08:59 +0000 Subject: In osSetSpeed(), if no avatar for a uuid is found then don't attempt to set speed. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c55e2ae..ff1f5fd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2740,7 +2740,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); m_host.AddScriptLPS(1); ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); - avatar.SpeedModifier = (float)SpeedModifier; + + if (avatar != null) + avatar.SpeedModifier = (float)SpeedModifier; } public void osKickAvatar(string FirstName,string SurName,string alert) -- cgit v1.1 From f67f37074f3f7e0602b66aa66a044dd9fd107f6a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 05:02:33 +0000 Subject: Stop spurious scene loop startup timeout alarms for scenes with many prims. On the first frame, all startup scene objects are added to the physics scene. This can cause a considerable delay, so we don't start raising the alarm on scene loop timeouts until the second frame. This commit also slightly changes the behaviour of timeout reporting. Previously, a report was made for the very first timed out thread, ignoring all others until the next watchdog check. Instead, we now report every timed out thread, though we still only do this once no matter how long the timeout. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 7 +++++-- .../Region/CoreModules/InterGrid/OpenGridProtocolModule.cs | 2 +- OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 1 + OpenSim/Region/Framework/Scenes/Scene.cs | 12 +++++++++--- .../Agent/InternetRelayClientView/Server/IRCClientView.cs | 2 +- .../Agent/InternetRelayClientView/Server/IRCServer.cs | 2 +- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 2 ++ .../Shared/Api/Implementation/AsyncCommandManager.cs | 4 +++- 8 files changed, 23 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 1e22fcc..fb6b11e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -244,8 +244,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP base.Start(m_recvBufferSize, m_asyncPacketHandling); // Start the packet processing threads - Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); - Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); + Watchdog.StartThread( + IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true); + Watchdog.StartThread( + OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true); + m_elapsedMSSinceLastStatReport = Environment.TickCount; } diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index f367739..a6e2548 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -1210,7 +1210,7 @@ namespace OpenSim.Region.CoreModules.InterGrid if (homeScene.TryGetScenePresence(avatarId,out avatar)) { KillAUser ku = new KillAUser(avatar,mod); - Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true); + Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true, true); } } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index b315d2c..74b047b 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -351,6 +351,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap process, string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName), ThreadPriority.BelowNormal, + true, true); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index cf6e6af..19d4bad 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1140,7 +1140,7 @@ namespace OpenSim.Region.Framework.Scenes HeartbeatThread = Watchdog.StartThread( - Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false); + Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); } /// @@ -1178,6 +1178,13 @@ namespace OpenSim.Region.Framework.Scenes try { m_eventManager.TriggerOnRegionStarted(this); + + // The first frame can take a very long time due to physics actors being added on startup. Therefore, + // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false + // alarms for scenes with many objects. + Update(); + Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; + while (!shuttingdown) Update(); @@ -1206,7 +1213,7 @@ namespace OpenSim.Region.Framework.Scenes ++Frame; -// m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame); +// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); try { @@ -1418,7 +1425,6 @@ namespace OpenSim.Region.Framework.Scenes entry.checkAtTargets(); } - /// /// Send out simstats data to all clients /// diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index c928af7..d3c96e2 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server m_client = client; m_scene = scene; - Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false); + Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true); } private void SendServerCommand(string command) diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index eb39026..a7c5020 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server m_listener.Start(50); - Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false); + Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true); m_baseScene = baseScene; } diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 75364b7..97890ee 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -1474,6 +1474,8 @@ Console.WriteLine("CreateGeom:"); /// private void changeadd() { +// m_log.DebugFormat("[ODE PRIM]: Adding prim {0}", Name); + int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index ee32755..14edde4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs @@ -137,7 +137,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (cmdHandlerThread == null) { // Start the thread that will be doing the work - cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true); + cmdHandlerThread + = Watchdog.StartThread( + CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true); } } -- cgit v1.1 From 84735b644cbd8902dd749fadb4056d26044fd564 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 05:12:56 +0000 Subject: Get rid of some of the identical exception catching in Scene.Update(). --- OpenSim/Region/Framework/Scenes/Scene.cs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 19d4bad..9bca654 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1368,26 +1368,10 @@ namespace OpenSim.Region.Framework.Scenes { throw; } - catch (AccessViolationException e) - { - m_log.ErrorFormat( - "[REGION]: Failed on region {0} with exception {1}{2}", - RegionInfo.RegionName, e.Message, e.StackTrace); - } - //catch (NullReferenceException e) - //{ - // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); - //} - catch (InvalidOperationException e) - { - m_log.ErrorFormat( - "[REGION]: Failed on region {0} with exception {1}{2}", - RegionInfo.RegionName, e.Message, e.StackTrace); - } catch (Exception e) { m_log.ErrorFormat( - "[REGION]: Failed on region {0} with exception {1}{2}", + "[SCENE]: Failed on region {0} with exception {1}{2}", RegionInfo.RegionName, e.Message, e.StackTrace); } -- cgit v1.1 From bafef292f4d41df14a1edeafc7ba5f9d623d7822 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 05:25:18 +0000 Subject: Take watchdog alarm calling back outside the m_threads lock. This is how it was originally. This stops a very long running alarm callback from causing a problem. --- OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 19c9745..4d98f00 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -156,8 +156,8 @@ namespace OpenSim.Region.Framework.Scenes // that the region position is cached or performance will degrade Utils.LongToUInts(regionHandle, out x, out y); GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); - bool v = true; - if (! simulatorList.Contains(dest.ServerURI)) +// bool v = true; + if (!simulatorList.Contains(dest.ServerURI)) { // we havent seen this simulator before, add it to the list // and send it an update -- cgit v1.1 From 7b5e42c744ceeee739f1fbdb2c96552dfd4add52 Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Fri, 24 Feb 2012 20:46:14 +0100 Subject: llGetLinkMedia, llSetLinkMedia, llClearLinkMedia implementation mantis: http://opensimulator.org/mantis/view.php?id=5756 http://opensimulator.org/mantis/view.php?id=5755 http://opensimulator.org/mantis/view.php?id=5754 --- .../Shared/Api/Implementation/LSL_Api.cs | 106 ++++++++++++++++----- .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 7 +- .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 19 +++- 3 files changed, 105 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2eba2b1..525c3c3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8173,23 +8173,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); ScriptSleep(1000); + return GetPrimMediaParams(m_host, face, rules); + } + + public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) + { + m_host.AddScriptLPS(1); + ScriptSleep(1000); + if (link == ScriptBaseClass.LINK_ROOT) + return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); + else if (link == ScriptBaseClass.LINK_THIS) + return GetPrimMediaParams(m_host, face, rules); + else + { + SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); + if (null != part) + return GetPrimMediaParams(part, face, rules); + } + + return new LSL_List(); + } + private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules) + { // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). // Assuming silently fail means give back an empty list. Ideally, need to check this. - if (face < 0 || face > m_host.GetNumberOfSides() - 1) + if (face < 0 || face > part.GetNumberOfSides() - 1) return new LSL_List(); - return GetPrimMediaParams(face, rules); - } - - private LSL_List GetPrimMediaParams(int face, LSL_List rules) - { IMoapModule module = m_ScriptEngine.World.RequestModuleInterface(); if (null == module) - throw new Exception("Media on a prim functions not available"); + return new LSL_List(); - MediaEntry me = module.GetMediaEntry(m_host, face); + MediaEntry me = module.GetMediaEntry(part, face); // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams if (null == me) @@ -8271,33 +8288,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: res.Add(new LSL_Integer((int)me.ControlPermissions)); break; + + default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS; } } return res; } - public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) + public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules) { m_host.AddScriptLPS(1); ScriptSleep(1000); + return SetPrimMediaParams(m_host, face, rules); + } - // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid - // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. - // Don't perform the media check directly - if (face < 0 || face > m_host.GetNumberOfSides() - 1) - return ScriptBaseClass.LSL_STATUS_OK; + public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) + { + m_host.AddScriptLPS(1); + ScriptSleep(1000); + if (link == ScriptBaseClass.LINK_ROOT) + return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); + else if (link == ScriptBaseClass.LINK_THIS) + return SetPrimMediaParams(m_host, face, rules); + else + { + SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); + if (null != part) + return SetPrimMediaParams(part, face, rules); + } - return SetPrimMediaParams(face, rules); + return ScriptBaseClass.LSL_STATUS_NOT_FOUND; } - private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) + private LSL_Integer SetPrimMediaParams(SceneObjectPart part, LSL_Integer face, LSL_List rules) { + // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid + // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. + // Don't perform the media check directly + if (face < 0 || face > part.GetNumberOfSides() - 1) + return ScriptBaseClass.LSL_STATUS_NOT_FOUND; + IMoapModule module = m_ScriptEngine.World.RequestModuleInterface(); if (null == module) - throw new Exception("Media on a prim functions not available"); + return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED; - MediaEntry me = module.GetMediaEntry(m_host, face); + MediaEntry me = module.GetMediaEntry(part, face); if (null == me) me = new MediaEntry(); @@ -8376,10 +8412,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); break; + + default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS; } } - module.SetMediaEntry(m_host, face, me); + module.SetMediaEntry(part, face, me); return ScriptBaseClass.LSL_STATUS_OK; } @@ -8388,18 +8426,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); ScriptSleep(1000); + return ClearPrimMedia(m_host, face); + } + public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face) + { + m_host.AddScriptLPS(1); + ScriptSleep(1000); + if (link == ScriptBaseClass.LINK_ROOT) + return ClearPrimMedia(m_host.ParentGroup.RootPart, face); + else if (link == ScriptBaseClass.LINK_THIS) + return ClearPrimMedia(m_host, face); + else + { + SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); + if (null != part) + return ClearPrimMedia(part, face); + } + + return ScriptBaseClass.LSL_STATUS_NOT_FOUND; + } + + private LSL_Integer ClearPrimMedia(SceneObjectPart part, LSL_Integer face) + { // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. // FIXME: Don't perform the media check directly - if (face < 0 || face > m_host.GetNumberOfSides() - 1) - return ScriptBaseClass.LSL_STATUS_OK; + if (face < 0 || face > part.GetNumberOfSides() - 1) + return ScriptBaseClass.LSL_STATUS_NOT_FOUND; IMoapModule module = m_ScriptEngine.World.RequestModuleInterface(); if (null == module) - throw new Exception("Media on a prim functions not available"); + return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED; - module.ClearMediaEntry(m_host, face); + module.ClearMediaEntry(part, face); return ScriptBaseClass.LSL_STATUS_OK; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 7d39ccc..0f53bc3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -64,6 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options); LSL_Integer llCeil(double f); void llClearCameraParams(); + LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face); LSL_Integer llClearPrimMedia(LSL_Integer face); void llCloseRemoteDataChannel(string channel); LSL_Float llCloud(LSL_Vector offset); @@ -139,7 +140,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String llGetLinkName(int linknum); LSL_Integer llGetLinkNumber(); LSL_Integer llGetLinkNumberOfSides(int link); - LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); + LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules); + LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); LSL_Integer llGetListEntryType(LSL_List src, int index); LSL_Integer llGetListLength(LSL_List src); LSL_Vector llGetLocalPos(); @@ -335,6 +337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llSetInventoryPermMask(string item, int mask, int value); void llSetLinkAlpha(int linknumber, double alpha, int face); void llSetLinkColor(int linknumber, LSL_Vector color, int face); + LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules); void llSetLinkPrimitiveParams(int linknumber, LSL_List rules); void llSetLinkTexture(int linknumber, string texture, int face); void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); @@ -345,7 +348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llSetParcelMusicURL(string url); void llSetPayPrice(int price, LSL_List quick_pay_buttons); void llSetPos(LSL_Vector pos); - LSL_Integer llSetPrimMediaParams(int face, LSL_List rules); + LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules); void llSetPrimitiveParams(LSL_List rules); void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); void llSetPrimURL(string url); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 24c3d95..f8e3c36 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -1887,17 +1887,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_LSL_Functions.llGetPrimMediaParams(face, rules); } - + + public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) + { + return m_LSL_Functions.llGetLinkMedia(link, face, rules); + } + public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) { return m_LSL_Functions.llSetPrimMediaParams(face, rules); } - + + public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) + { + return m_LSL_Functions.llSetLinkMedia(link, face, rules); + } + public LSL_Integer llClearPrimMedia(LSL_Integer face) { return m_LSL_Functions.llClearPrimMedia(face); } + public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face) + { + return m_LSL_Functions.llClearLinkMedia(link, face); + } + public void print(string str) { m_LSL_Functions.print(str); -- cgit v1.1 From b48b0b1e5861810b4d77e4ade1a44b8a9db79f90 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 25 Feb 2012 00:48:41 +0000 Subject: Remove EXPERIMENTAL tags from load iar/save iar commands. --- .../CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index a81f36c..650069a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -349,8 +349,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { try { - m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); - Dictionary options = new Dictionary(); OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); @@ -412,7 +410,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver return; } - m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); if (options.ContainsKey("home")) m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR"); -- cgit v1.1 From 01f454242d20dd513e82eae1eb79db7842e597ea Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Sat, 25 Feb 2012 16:39:14 +0100 Subject: PRIM_SCULPT_FLAG_INVERT, PRIM_SCULPT_FLAG_MIRROR implemented http://opensimulator.org/mantis/view.php?id=5763 --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 ++++++---- .../Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 525c3c3..c5392b5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7069,10 +7069,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api shapeBlock.PathScaleX = 100; shapeBlock.PathScaleY = 150; - if (type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER && - type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE && - type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE && - type != (int)ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS) + int flag = type & (ScriptBaseClass.PRIM_SCULPT_FLAG_INVERT | ScriptBaseClass.PRIM_SCULPT_FLAG_MIRROR); + + if (type != (ScriptBaseClass.PRIM_SCULPT_TYPE_CYLINDER | flag) && + type != (ScriptBaseClass.PRIM_SCULPT_TYPE_PLANE | flag) && + type != (ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE | flag) && + type != (ScriptBaseClass.PRIM_SCULPT_TYPE_TORUS | flag)) { // default type = (int)ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index bb498b5..5a53e15 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -378,6 +378,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_SCULPT_TYPE_TORUS = 2; public const int PRIM_SCULPT_TYPE_PLANE = 3; public const int PRIM_SCULPT_TYPE_CYLINDER = 4; + public const int PRIM_SCULPT_FLAG_INVERT = 64; + public const int PRIM_SCULPT_FLAG_MIRROR = 128; public const int MASK_BASE = 0; public const int MASK_OWNER = 1; -- cgit v1.1 From 142f8a4aeca211ff6f88c7227f8654cd43a0dbaf Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 25 Feb 2012 21:00:19 -0800 Subject: HG: Remove async in posting assets to foreign grid. Mono hates concurrency there. --- .../CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 0c4ff7f..d2fe388 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess string userAssetServer = string.Empty; if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission) { - Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); }); + m_assMapper.Post(assetID, avatarID, userAssetServer); } } -- cgit v1.1 From a813e7ffdd811979a0b326fd73f2199b528e95a6 Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Tue, 28 Feb 2012 15:45:07 -0500 Subject: Fixed two typos. White space cleanups. Signed-off-by: nebadon --- .../CoreModules/World/WorldMap/WorldMapModule.cs | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 74b047b..fd122da 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { } - public Type ReplaceableInterface + public Type ReplaceableInterface { get { return null; } } @@ -220,7 +220,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // There is a major hack going on in this method. The viewer doesn't request // map blocks (RequestMapBlocks) above 2048. That means that if we don't hack, // grids above that cell don't have a map at all. So, here's the hack: we wait - // for this CAP request to come, and we inject the map blocks at this point. + // for this CAP request to come, and we inject the map blocks at this point. // In a normal scenario, this request simply sends back the MapLayer (the blue color). // In the hacked scenario, it also sends the map blocks via UDP. // @@ -751,7 +751,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { uint x = 0, y = 0; Utils.LongToUInts(regionhandle, out x, out y); - GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); + GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); if (mreg != null) { @@ -857,7 +857,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap finally { if (os != null) - os.Close(); + os.Close(); } string response_mapItems_reply = null; @@ -960,16 +960,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // on an unloaded square. // But make sure: Look whether the one we requested is in there List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, - minX * (int)Constants.RegionSize, - maxX * (int)Constants.RegionSize, - minY * (int)Constants.RegionSize, + minX * (int)Constants.RegionSize, + maxX * (int)Constants.RegionSize, + minY * (int)Constants.RegionSize, maxY * (int)Constants.RegionSize); if (regions != null) { foreach (GridRegion r in regions) { - if ((r.RegionLocX == minX * (int)Constants.RegionSize) && + if ((r.RegionLocX == minX * (int)Constants.RegionSize) && (r.RegionLocY == minY * (int)Constants.RegionSize)) { // found it => add it to response @@ -1004,7 +1004,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap { List mapBlocks = new List(); List regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, - (minX - 4) * (int)Constants.RegionSize, + (minX - 4) * (int)Constants.RegionSize, (maxX + 4) * (int)Constants.RegionSize, (minY - 4) * (int)Constants.RegionSize, (maxY + 4) * (int)Constants.RegionSize); @@ -1336,7 +1336,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // Cannot create a map for a nonexistant heightmap if (m_scene.Heightmap == null) return; - + //create a texture asset of the terrain IMapImageGenerator terrain = m_scene.RequestModuleInterface(); if (terrain == null) @@ -1345,7 +1345,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap byte[] data = terrain.WriteJpeg2000Image(); if (data == null) return; - + byte[] overlay = GenerateOverlay(); m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE"); @@ -1366,7 +1366,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // Store the new one m_log.DebugFormat("[WORLDMAP]: Storing map tile {0}", asset.ID); m_scene.AssetService.Store(asset); - + if (overlay != null) { parcelImageID = UUID.Random(); @@ -1390,7 +1390,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap m_scene.RegionInfo.RegionSettings.TerrainImageID = terrainImageID; m_scene.RegionInfo.RegionSettings.ParcelImageID = parcelImageID; m_scene.RegionInfo.RegionSettings.Save(); - + // Delete the old one // m_log.DebugFormat("[WORLDMAP]: Deleting old map tile {0}", lastTerrainImageID); m_scene.AssetService.Delete(lastTerrainImageID.ToString()); @@ -1469,18 +1469,18 @@ namespace OpenSim.Region.CoreModules.World.WorldMap if ((land.LandData.Flags & (uint)ParcelFlags.ForSale) != 0) { landForSale = true; - + saleBitmap = land.MergeLandBitmaps(saleBitmap, land.GetLandBitmap()); } } if (!landForSale) { - m_log.DebugFormat("[WORLD MAP]: Region {0} has no parcels for sale, not geenrating overlay", m_scene.RegionInfo.RegionName); + m_log.DebugFormat("[WORLD MAP]: Region {0} has no parcels for sale, not generating overlay", m_scene.RegionInfo.RegionName); return null; } - m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, genrating overlay", m_scene.RegionInfo.RegionName); + m_log.DebugFormat("[WORLD MAP]: Region {0} has parcels for sale, generating overlay", m_scene.RegionInfo.RegionName); for (int x = 0 ; x < 64 ; x++) { -- cgit v1.1 From 2fce7dd593571986cc08122a4fe015800fa765a6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 28 Feb 2012 22:54:21 +0000 Subject: Call Dispose() via using() on SqliteCommands in WebStatsModule after use. --- OpenSim/Region/UserStatistics/WebStatsModule.cs | 197 ++++++++++++------------ 1 file changed, 98 insertions(+), 99 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index ad272f7..b9ba4bc 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs @@ -224,13 +224,11 @@ namespace OpenSim.Region.UserStatistics concurrencyCounter--; response_code = 200; - } else { strOut = MainServer.Instance.GetHTTP404(""); } - responsedata["int_response_code"] = response_code; responsedata["content_type"] = contenttype; @@ -247,43 +245,44 @@ namespace OpenSim.Region.UserStatistics // TODO: FIXME: implement stats migrations const string SQL = @"SELECT * FROM migrations LIMIT 1"; - SqliteCommand cmd = new SqliteCommand(SQL, db); - - try - { - cmd.ExecuteNonQuery(); - } - catch (SqliteSyntaxException) + using (SqliteCommand cmd = new SqliteCommand(SQL, db)) { - CreateTables(db); + try + { + cmd.ExecuteNonQuery(); + } + catch (SqliteSyntaxException) + { + CreateTables(db); + } } } } public void CreateTables(SqliteConnection db) { - SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db); - createcmd.ExecuteNonQuery(); + using (SqliteCommand createcmd = new SqliteCommand(SQL_STATS_TABLE_CREATE, db)) + { + createcmd.ExecuteNonQuery(); - createcmd.CommandText = SQL_MIGRA_TABLE_CREATE; - createcmd.ExecuteNonQuery(); + createcmd.CommandText = SQL_MIGRA_TABLE_CREATE; + createcmd.ExecuteNonQuery(); + } } public virtual void PostInitialise() { if (!enabled) - { return; - } + AddHandlers(); } public virtual void Close() { if (!enabled) - { return; - } + dbConn.Close(); dbConn.Dispose(); m_sessions.Clear(); @@ -304,7 +303,8 @@ namespace OpenSim.Region.UserStatistics public void OnRegisterCaps(UUID agentID, Caps caps) { - m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); +// m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); + string capsPath = "/CAPS/VS/" + UUID.Random(); caps.RegisterHandler("ViewerStats", new RestStreamHandler("POST", capsPath, @@ -318,7 +318,6 @@ namespace OpenSim.Region.UserStatistics public void OnDeRegisterCaps(UUID agentID, Caps caps) { - } protected virtual void AddHandlers() @@ -368,7 +367,6 @@ namespace OpenSim.Region.UserStatistics public void OnMakeChildAgent(ScenePresence agent) { - } public void OnClientClosed(UUID agentID, Scene scene) @@ -430,6 +428,7 @@ namespace OpenSim.Region.UserStatistics return scene.RegionInfo.RegionID; } } + return UUID.Zero; } @@ -458,14 +457,14 @@ namespace OpenSim.Region.UserStatistics UserSessionData usd; OSD message = OSDParser.DeserializeLLSDXml(request); OSDMap mmap; + lock (m_sessions) { if (agentID != UUID.Zero) { - if (!m_sessions.ContainsKey(agentID)) { - m_log.Warn("[WEB STATS MODULE]: no session for stat disclosure"); + m_log.WarnFormat("[WEB STATS MODULE]: no session for stat disclosure for agent {0}", agentID); return new UserSessionID(); } uid = m_sessions[agentID]; @@ -585,8 +584,6 @@ namespace OpenSim.Region.UserStatistics usd.n_out_kb = (float)net_out["kbytes"].AsReal(); usd.n_out_pk = net_out["packets"].AsInteger(); } - - } } @@ -602,83 +599,85 @@ namespace OpenSim.Region.UserStatistics lock (db) { - SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db); - updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString())); - updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString())); - updatecmd.Parameters.Add(new SqliteParameter(":region_id", uid.session_data.region_id.ToString())); - updatecmd.Parameters.Add(new SqliteParameter(":last_updated", (int) uid.session_data.last_updated)); - updatecmd.Parameters.Add(new SqliteParameter(":remote_ip", uid.session_data.remote_ip)); - updatecmd.Parameters.Add(new SqliteParameter(":name_f", uid.session_data.name_f)); - updatecmd.Parameters.Add(new SqliteParameter(":name_l", uid.session_data.name_l)); - updatecmd.Parameters.Add(new SqliteParameter(":avg_agents_in_view", uid.session_data.avg_agents_in_view)); - updatecmd.Parameters.Add(new SqliteParameter(":min_agents_in_view", - (int) uid.session_data.min_agents_in_view)); - updatecmd.Parameters.Add(new SqliteParameter(":max_agents_in_view", - (int) uid.session_data.max_agents_in_view)); - updatecmd.Parameters.Add(new SqliteParameter(":mode_agents_in_view", - (int) uid.session_data.mode_agents_in_view)); - updatecmd.Parameters.Add(new SqliteParameter(":avg_fps", uid.session_data.avg_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":min_fps", uid.session_data.min_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":max_fps", uid.session_data.max_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":mode_fps", uid.session_data.mode_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":a_language", uid.session_data.a_language)); - updatecmd.Parameters.Add(new SqliteParameter(":mem_use", uid.session_data.mem_use)); - updatecmd.Parameters.Add(new SqliteParameter(":meters_traveled", uid.session_data.meters_traveled)); - updatecmd.Parameters.Add(new SqliteParameter(":avg_ping", uid.session_data.avg_ping)); - updatecmd.Parameters.Add(new SqliteParameter(":min_ping", uid.session_data.min_ping)); - updatecmd.Parameters.Add(new SqliteParameter(":max_ping", uid.session_data.max_ping)); - updatecmd.Parameters.Add(new SqliteParameter(":mode_ping", uid.session_data.mode_ping)); - updatecmd.Parameters.Add(new SqliteParameter(":regions_visited", uid.session_data.regions_visited)); - updatecmd.Parameters.Add(new SqliteParameter(":run_time", uid.session_data.run_time)); - updatecmd.Parameters.Add(new SqliteParameter(":avg_sim_fps", uid.session_data.avg_sim_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":min_sim_fps", uid.session_data.min_sim_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":max_sim_fps", uid.session_data.max_sim_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":mode_sim_fps", uid.session_data.mode_sim_fps)); - updatecmd.Parameters.Add(new SqliteParameter(":start_time", uid.session_data.start_time)); - updatecmd.Parameters.Add(new SqliteParameter(":client_version", uid.session_data.client_version)); - updatecmd.Parameters.Add(new SqliteParameter(":s_cpu", uid.session_data.s_cpu)); - updatecmd.Parameters.Add(new SqliteParameter(":s_gpu", uid.session_data.s_gpu)); - updatecmd.Parameters.Add(new SqliteParameter(":s_os", uid.session_data.s_os)); - updatecmd.Parameters.Add(new SqliteParameter(":s_ram", uid.session_data.s_ram)); - updatecmd.Parameters.Add(new SqliteParameter(":d_object_kb", uid.session_data.d_object_kb)); - updatecmd.Parameters.Add(new SqliteParameter(":d_texture_kb", uid.session_data.d_texture_kb)); - updatecmd.Parameters.Add(new SqliteParameter(":d_world_kb", uid.session_data.d_world_kb)); - updatecmd.Parameters.Add(new SqliteParameter(":n_in_kb", uid.session_data.n_in_kb)); - updatecmd.Parameters.Add(new SqliteParameter(":n_in_pk", uid.session_data.n_in_pk)); - updatecmd.Parameters.Add(new SqliteParameter(":n_out_kb", uid.session_data.n_out_kb)); - updatecmd.Parameters.Add(new SqliteParameter(":n_out_pk", uid.session_data.n_out_pk)); - updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped)); - updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends)); - updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid)); - - updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit)); - updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent)); - updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet)); - - updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString())); - updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString())); - updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString())); -// m_log.Debug("UPDATE"); - - int result = updatecmd.ExecuteNonQuery(); - - if (result == 0) + using (SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db)) { -// m_log.Debug("INSERT"); - updatecmd.CommandText = SQL_STATS_TABLE_INSERT; - try - { - updatecmd.ExecuteNonQuery(); - } - catch (SqliteExecutionException) + updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString())); + updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString())); + updatecmd.Parameters.Add(new SqliteParameter(":region_id", uid.session_data.region_id.ToString())); + updatecmd.Parameters.Add(new SqliteParameter(":last_updated", (int) uid.session_data.last_updated)); + updatecmd.Parameters.Add(new SqliteParameter(":remote_ip", uid.session_data.remote_ip)); + updatecmd.Parameters.Add(new SqliteParameter(":name_f", uid.session_data.name_f)); + updatecmd.Parameters.Add(new SqliteParameter(":name_l", uid.session_data.name_l)); + updatecmd.Parameters.Add(new SqliteParameter(":avg_agents_in_view", uid.session_data.avg_agents_in_view)); + updatecmd.Parameters.Add(new SqliteParameter(":min_agents_in_view", + (int) uid.session_data.min_agents_in_view)); + updatecmd.Parameters.Add(new SqliteParameter(":max_agents_in_view", + (int) uid.session_data.max_agents_in_view)); + updatecmd.Parameters.Add(new SqliteParameter(":mode_agents_in_view", + (int) uid.session_data.mode_agents_in_view)); + updatecmd.Parameters.Add(new SqliteParameter(":avg_fps", uid.session_data.avg_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":min_fps", uid.session_data.min_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":max_fps", uid.session_data.max_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":mode_fps", uid.session_data.mode_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":a_language", uid.session_data.a_language)); + updatecmd.Parameters.Add(new SqliteParameter(":mem_use", uid.session_data.mem_use)); + updatecmd.Parameters.Add(new SqliteParameter(":meters_traveled", uid.session_data.meters_traveled)); + updatecmd.Parameters.Add(new SqliteParameter(":avg_ping", uid.session_data.avg_ping)); + updatecmd.Parameters.Add(new SqliteParameter(":min_ping", uid.session_data.min_ping)); + updatecmd.Parameters.Add(new SqliteParameter(":max_ping", uid.session_data.max_ping)); + updatecmd.Parameters.Add(new SqliteParameter(":mode_ping", uid.session_data.mode_ping)); + updatecmd.Parameters.Add(new SqliteParameter(":regions_visited", uid.session_data.regions_visited)); + updatecmd.Parameters.Add(new SqliteParameter(":run_time", uid.session_data.run_time)); + updatecmd.Parameters.Add(new SqliteParameter(":avg_sim_fps", uid.session_data.avg_sim_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":min_sim_fps", uid.session_data.min_sim_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":max_sim_fps", uid.session_data.max_sim_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":mode_sim_fps", uid.session_data.mode_sim_fps)); + updatecmd.Parameters.Add(new SqliteParameter(":start_time", uid.session_data.start_time)); + updatecmd.Parameters.Add(new SqliteParameter(":client_version", uid.session_data.client_version)); + updatecmd.Parameters.Add(new SqliteParameter(":s_cpu", uid.session_data.s_cpu)); + updatecmd.Parameters.Add(new SqliteParameter(":s_gpu", uid.session_data.s_gpu)); + updatecmd.Parameters.Add(new SqliteParameter(":s_os", uid.session_data.s_os)); + updatecmd.Parameters.Add(new SqliteParameter(":s_ram", uid.session_data.s_ram)); + updatecmd.Parameters.Add(new SqliteParameter(":d_object_kb", uid.session_data.d_object_kb)); + updatecmd.Parameters.Add(new SqliteParameter(":d_texture_kb", uid.session_data.d_texture_kb)); + updatecmd.Parameters.Add(new SqliteParameter(":d_world_kb", uid.session_data.d_world_kb)); + updatecmd.Parameters.Add(new SqliteParameter(":n_in_kb", uid.session_data.n_in_kb)); + updatecmd.Parameters.Add(new SqliteParameter(":n_in_pk", uid.session_data.n_in_pk)); + updatecmd.Parameters.Add(new SqliteParameter(":n_out_kb", uid.session_data.n_out_kb)); + updatecmd.Parameters.Add(new SqliteParameter(":n_out_pk", uid.session_data.n_out_pk)); + updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped)); + updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends)); + updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid)); + + updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit)); + updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent)); + updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet)); + + updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString())); + updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString())); + updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString())); + +// m_log.DebugFormat("[WEB STATS MODULE]: Database stats update for {0}", uid.session_data.agent_id); + + int result = updatecmd.ExecuteNonQuery(); + + if (result == 0) { - m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage Execution Exception"); - } - catch (SqliteSyntaxException) - { - m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage SQL Syntax Exception"); - } +// m_log.DebugFormat("[WEB STATS MODULE]: Database stats insert for {0}", uid.session_data.agent_id); + + updatecmd.CommandText = SQL_STATS_TABLE_INSERT; + try + { + updatecmd.ExecuteNonQuery(); + } + catch (Exception e) + { + m_log.WarnFormat( + "[WEB STATS MODULE]: failed to write stats for {0}, storage Execution Exception {1}{2}", + uid.session_data.agent_id, e.Message, e.StackTrace); + } + } } } } -- cgit v1.1 From a2b0ed537ebb539e17491ea368903a346b1bed56 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Thu, 1 Mar 2012 14:18:48 -0500 Subject: Fix indexing on string trim Thanks to zadark for pointing this out, smxy for deciphering the ?: operator and Plugh for the fix \o/ yay for IRC --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c5392b5..0003515 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4039,7 +4039,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f), Util.Clip((float)color.y, 0.0f, 1.0f), Util.Clip((float)color.z, 0.0f, 1.0f)); - m_host.SetText(text.Length > 254 ? text.Remove(255) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); + m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); //m_host.ParentGroup.HasGroupChanged = true; //m_host.ParentGroup.ScheduleGroupForFullUpdate(); } -- cgit v1.1 From 8a375f3c30302c4a7ace1afb05a8b49fbb415640 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Thu, 1 Mar 2012 14:49:49 -0800 Subject: Adds an OSSL command for regular expression-based string replacement. Parameters are osReplaceString(string source, string patter, string replace, integer count, integer start) The count parameter specifies the total number of replacements to make, -1 makes all replacements. --- .../Shared/Api/Implementation/OSSL_Api.cs | 25 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 6 ++++++ 3 files changed, 32 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ff1f5fd..8edd146 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2160,6 +2160,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return result; } + public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start) + { + CheckThreatLevel(ThreatLevel.High, "osReplaceString"); + m_host.AddScriptLPS(1); + + // Normalize indices (if negative). + // After normlaization they may still be + // negative, but that is now relative to + // the start, rather than the end, of the + // sequence. + if (start < 0) + { + start = src.Length + start; + } + + if (start < 0 || start >= src.Length) + { + return src; + } + + // Find matches beginning at start position + Regex matcher = new Regex(pattern); + return matcher.Replace(src,replace,count,start); + } + public string osLoadedCreationDate() { CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationDate"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index dbc1dfc..82a6caf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -165,6 +165,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String osFormatString(string str, LSL_List strings); LSL_List osMatchString(string src, string pattern, int start); + LSL_String osReplaceString(string src, string pattern, string replace, int count, int start); // Information about data loaded into the region string osLoadedCreationDate(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index cc8d417..4341246 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -472,6 +472,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osMatchString(src, pattern, start); } + public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start) + { + return m_OSSL_Functions.osReplaceString(src,pattern,replace,count,start); + } + + // Information about data loaded into the region public string osLoadedCreationDate() { -- cgit v1.1 From dcfd05c8eaa4550d9be4c673d660497da1e035c8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 00:22:23 +0000 Subject: lock SenseRepeatListLock when added a new sensor during script reconstitution. This is already being done in the other place where a sensor is added. Adding a sensor whilst another thread is iterating over the sensor list can cause a concurrency exception. --- .../ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 5c1bdff..8383c7f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -635,7 +635,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); - SenseRepeaters.Add(ts); + lock (SenseRepeatListLock) + SenseRepeaters.Add(ts); + idx += 6; } } -- cgit v1.1 From d8c4985527f1ffdea0f21714808522a350d85013 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 00:28:37 +0000 Subject: Move SenseRepeaters.Count check inside the SenseRepeatListLock. No methods in the List class are thread safe in the MS specification/documentation --- .../Shared/Api/Implementation/Plugins/SensorRepeat.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 8383c7f..fbb7c39 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -157,12 +157,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins public void CheckSenseRepeaterEvents() { - // Nothing to do here? - if (SenseRepeaters.Count == 0) - return; - lock (SenseRepeatListLock) { + // Nothing to do here? + if (SenseRepeaters.Count == 0) + return; + // Go through all timers foreach (SenseRepeatClass ts in SenseRepeaters) { -- cgit v1.1 From dd63cd165631886806233958526f994baf60e855 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 02:23:35 +0000 Subject: Start by adding XAssetService as a copy of the existing AssetService. This is the start of exploring the creation of a bundled OpenSimulator asset service that does de-duplication and possibly file storage of assets. Along the lines of coyled's SRAS, but not intended to replace, merely to act as a more performant bundled default. Might end up nicking stuff from kcozen's patch at http://opensimulator.org/mantis/view.php?id=5429 More details at http://opensimulator.org/wiki/Feature_Proposals/Deduplicating_Asset_Service Feedback and discussion welcome as commits are made. --- .../ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 2e6ec90..c78915f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs @@ -73,14 +73,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset return; } - string serviceDll = assetConfig.GetString("LocalServiceModule", - String.Empty); + string serviceDll = assetConfig.GetString("LocalServiceModule", String.Empty); if (serviceDll == String.Empty) { m_log.Error("[LOCAL ASSET SERVICES CONNECTOR]: No LocalServiceModule named in section AssetService"); return; } + else + { + m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Loading asset service at {0}", serviceDll); + } Object[] args = new Object[] { source }; m_AssetService = ServerUtils.LoadPlugin(serviceDll, args); -- cgit v1.1 From e8779cd9e54416349e67d9e5c48b35bab43b69e9 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Thu, 1 Mar 2012 19:22:05 -0800 Subject: In ScenePresence, removed several private variables used to store public parameters. They were only used by the get/set and make code harder to refactor. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 152 +++++++---------------- 1 file changed, 44 insertions(+), 108 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 40c8d06..e982bfe 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -341,15 +341,9 @@ namespace OpenSim.Region.Framework.Scenes /// /// Position of agent's camera in world (region cordinates) /// - protected Vector3 m_lastCameraPosition; - - protected Vector3 m_CameraPosition; - - public Vector3 CameraPosition - { - get { return m_CameraPosition; } - private set { m_CameraPosition = value; } - } + protected Vector3 m_lastCameraPosition; + + public Vector3 CameraPosition { get; set; } public Quaternion CameraRotation { @@ -358,29 +352,10 @@ namespace OpenSim.Region.Framework.Scenes // Use these three vectors to figure out what the agent is looking at // Convert it to a Matrix and/or Quaternion - // - protected Vector3 m_CameraAtAxis; - protected Vector3 m_CameraLeftAxis; - protected Vector3 m_CameraUpAxis; - - public Vector3 CameraAtAxis - { - get { return m_CameraAtAxis; } - private set { m_CameraAtAxis = value; } - } - - - public Vector3 CameraLeftAxis - { - get { return m_CameraLeftAxis; } - private set { m_CameraLeftAxis = value; } - } - - public Vector3 CameraUpAxis - { - get { return m_CameraUpAxis; } - private set { m_CameraUpAxis = value; } - } + // + public Vector3 CameraAtAxis { get; set; } + public Vector3 CameraLeftAxis { get; set; } + public Vector3 CameraUpAxis { get; set; } public Vector3 Lookat { @@ -396,33 +371,15 @@ namespace OpenSim.Region.Framework.Scenes } #endregion - public readonly string Firstname; - public readonly string Lastname; - - private string m_grouptitle; - - public string Grouptitle - { - get { return m_grouptitle; } - set { m_grouptitle = value; } - } - - // Agent's Draw distance. - protected float m_DrawDistance; - - public float DrawDistance - { - get { return m_DrawDistance; } - private set { m_DrawDistance = value; } - } - - protected bool m_allowMovement = true; + public string Firstname { get; private set; } + public string Lastname { get; private set; } + + public string Grouptitle { get; set; } - public bool AllowMovement - { - get { return m_allowMovement; } - set { m_allowMovement = value; } - } + // Agent's Draw distance. + public float DrawDistance { get; set; } + + public bool AllowMovement { get; set; } private bool m_setAlwaysRun; @@ -447,15 +404,9 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor.SetAlwaysRun = value; } } - } - - private byte m_state; - - public byte State - { - get { return m_state; } - set { m_state = value; } - } + } + + public byte State { get; set; } private AgentManager.ControlFlags m_AgentControlFlags; @@ -463,31 +414,16 @@ namespace OpenSim.Region.Framework.Scenes { get { return (uint)m_AgentControlFlags; } set { m_AgentControlFlags = (AgentManager.ControlFlags)value; } - } - - /// - /// This works out to be the ClientView object associated with this avatar, or it's client connection manager - /// - private IClientAPI m_controllingClient; - - public IClientAPI ControllingClient - { - get { return m_controllingClient; } - private set { m_controllingClient = value; } - } + } + + public IClientAPI ControllingClient { get; set; } public IClientCore ClientView - { - get { return (IClientCore) m_controllingClient; } - } - - protected Vector3 m_parentPosition; - - public Vector3 ParentPosition - { - get { return m_parentPosition; } - set { m_parentPosition = value; } - } + { + get { return (IClientCore)ControllingClient; } + } + + public Vector3 ParentPosition { get; set; } /// /// Position of this avatar relative to the region the avatar is in @@ -825,18 +761,18 @@ namespace OpenSim.Region.Framework.Scenes private Vector3[] GetWalkDirectionVectors() { - Vector3[] vector = new Vector3[11]; - vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD - vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK + Vector3[] vector = new Vector3[11]; + vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD + vector[1] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK vector[2] = Vector3.UnitY; //LEFT - vector[3] = -Vector3.UnitY; //RIGHT - vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP - vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN - vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE - vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE + vector[3] = -Vector3.UnitY; //RIGHT + vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP + vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN + vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE + vector[7] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK_NUDGE vector[8] = Vector3.UnitY; //LEFT_NUDGE - vector[9] = -Vector3.UnitY; //RIGHT_NUDGE - vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_NUDGE + vector[9] = -Vector3.UnitY; //RIGHT_NUDGE + vector[10] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN_NUDGE return vector; } @@ -1333,7 +1269,7 @@ namespace OpenSim.Region.Framework.Scenes // Convert it to a Matrix and/or Quaternion CameraAtAxis = agentData.CameraAtAxis; CameraLeftAxis = agentData.CameraLeftAxis; - m_CameraUpAxis = agentData.CameraUpAxis; + CameraUpAxis = agentData.CameraUpAxis; // The Agent's Draw distance setting // When we get to the point of re-computing neighbors everytime this @@ -1343,9 +1279,9 @@ namespace OpenSim.Region.Framework.Scenes DrawDistance = Scene.DefaultDrawDistance; // Check if Client has camera in 'follow cam' or 'build' mode. - Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); - - m_followCamAuto = ((m_CameraUpAxis.Z > 0.959f && m_CameraUpAxis.Z < 0.98f) + Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); + + m_followCamAuto = ((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f) && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; @@ -3077,8 +3013,8 @@ namespace OpenSim.Region.Framework.Scenes cAgent.Velocity = m_velocity; cAgent.Center = CameraPosition; cAgent.AtAxis = CameraAtAxis; - cAgent.LeftAxis = CameraLeftAxis; - cAgent.UpAxis = m_CameraUpAxis; + cAgent.LeftAxis = CameraLeftAxis; + cAgent.UpAxis = CameraUpAxis; cAgent.Far = DrawDistance; @@ -3163,8 +3099,8 @@ namespace OpenSim.Region.Framework.Scenes m_velocity = cAgent.Velocity; CameraPosition = cAgent.Center; CameraAtAxis = cAgent.AtAxis; - CameraLeftAxis = cAgent.LeftAxis; - m_CameraUpAxis = cAgent.UpAxis; + CameraLeftAxis = cAgent.LeftAxis; + CameraUpAxis = cAgent.UpAxis; // When we get to the point of re-computing neighbors everytime this // changes, then start using the agent's drawdistance rather than the -- cgit v1.1 From 8fccd2b55514a373bf127b49a729d047240c9701 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 1 Mar 2012 19:55:51 -0800 Subject: Send the right name and creation date on the BasicProfileModule. --- .../Region/CoreModules/Avatar/Profile/BasicProfileModule.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs index eb1e4b5..8101ca2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs @@ -150,7 +150,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile string skillsText = String.Empty; string languages = String.Empty; - Byte[] charterMember = Utils.StringToBytes("Avatar"); + UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, avatarID); + + string name = "Avatar"; + int created = 0; + if (account != null) + { + name = account.FirstName + " " + account.LastName; + created = account.Created; + } + Byte[] charterMember = Utils.StringToBytes(name); profileUrl = "No profile data"; aboutText = string.Empty; @@ -160,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile partner = UUID.Zero; remoteClient.SendAvatarProperties(avatarID, aboutText, - Util.ToDateTime(0).ToString( + Util.ToDateTime(created).ToString( "M/d/yyyy", CultureInfo.InvariantCulture), charterMember, firstLifeAboutText, (uint)(0 & 0xff), -- cgit v1.1 From 6e3523e25e8d5538ed63984241093c1cfb6f2388 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 04:08:07 +0000 Subject: minor: remove mono compiler warning --- OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index e4b607d..e16903c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -65,8 +65,7 @@ namespace OpenSim.Region.Framework.Tests // Create an object embedded inside the first UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); - TaskInventoryItem taskSceneObjectItem - = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); + TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId); Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId)); -- cgit v1.1 From 8d249f8456f6bf70f4d81098007a02b1ede5587e Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 2 Mar 2012 09:19:13 -0800 Subject: ScenePresence line endings and fix AllowMovement default to true. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 60 ++++++++++++------------ 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e982bfe..ec6bb89 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -341,8 +341,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// Position of agent's camera in world (region cordinates) /// - protected Vector3 m_lastCameraPosition; - + protected Vector3 m_lastCameraPosition; + public Vector3 CameraPosition { get; set; } public Quaternion CameraRotation @@ -352,9 +352,9 @@ namespace OpenSim.Region.Framework.Scenes // Use these three vectors to figure out what the agent is looking at // Convert it to a Matrix and/or Quaternion - // - public Vector3 CameraAtAxis { get; set; } - public Vector3 CameraLeftAxis { get; set; } + // + public Vector3 CameraAtAxis { get; set; } + public Vector3 CameraLeftAxis { get; set; } public Vector3 CameraUpAxis { get; set; } public Vector3 Lookat @@ -371,14 +371,14 @@ namespace OpenSim.Region.Framework.Scenes } #endregion - public string Firstname { get; private set; } - public string Lastname { get; private set; } - + public string Firstname { get; private set; } + public string Lastname { get; private set; } + public string Grouptitle { get; set; } - // Agent's Draw distance. - public float DrawDistance { get; set; } - + // Agent's Draw distance. + public float DrawDistance { get; set; } + public bool AllowMovement { get; set; } private bool m_setAlwaysRun; @@ -404,8 +404,8 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor.SetAlwaysRun = value; } } - } - + } + public byte State { get; set; } private AgentManager.ControlFlags m_AgentControlFlags; @@ -414,15 +414,15 @@ namespace OpenSim.Region.Framework.Scenes { get { return (uint)m_AgentControlFlags; } set { m_AgentControlFlags = (AgentManager.ControlFlags)value; } - } - + } + public IClientAPI ControllingClient { get; set; } public IClientCore ClientView - { + { get { return (IClientCore)ControllingClient; } - } - + } + public Vector3 ParentPosition { get; set; } /// @@ -683,7 +683,7 @@ namespace OpenSim.Region.Framework.Scenes IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type) { AttachmentsSyncLock = new Object(); - + AllowMovement = true; IsChildAgent = true; m_sendCourseLocationsMethod = SendCoarseLocationsDefault; Animator = new ScenePresenceAnimator(this); @@ -761,17 +761,17 @@ namespace OpenSim.Region.Framework.Scenes private Vector3[] GetWalkDirectionVectors() { - Vector3[] vector = new Vector3[11]; - vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD + Vector3[] vector = new Vector3[11]; + vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD vector[1] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK vector[2] = Vector3.UnitY; //LEFT - vector[3] = -Vector3.UnitY; //RIGHT - vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP - vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN - vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE + vector[3] = -Vector3.UnitY; //RIGHT + vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP + vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN + vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE vector[7] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK_NUDGE vector[8] = Vector3.UnitY; //LEFT_NUDGE - vector[9] = -Vector3.UnitY; //RIGHT_NUDGE + vector[9] = -Vector3.UnitY; //RIGHT_NUDGE vector[10] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN_NUDGE return vector; } @@ -1279,8 +1279,8 @@ namespace OpenSim.Region.Framework.Scenes DrawDistance = Scene.DefaultDrawDistance; // Check if Client has camera in 'follow cam' or 'build' mode. - Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); - + Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); + m_followCamAuto = ((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f) && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; @@ -3013,7 +3013,7 @@ namespace OpenSim.Region.Framework.Scenes cAgent.Velocity = m_velocity; cAgent.Center = CameraPosition; cAgent.AtAxis = CameraAtAxis; - cAgent.LeftAxis = CameraLeftAxis; + cAgent.LeftAxis = CameraLeftAxis; cAgent.UpAxis = CameraUpAxis; cAgent.Far = DrawDistance; @@ -3099,7 +3099,7 @@ namespace OpenSim.Region.Framework.Scenes m_velocity = cAgent.Velocity; CameraPosition = cAgent.Center; CameraAtAxis = cAgent.AtAxis; - CameraLeftAxis = cAgent.LeftAxis; + CameraLeftAxis = cAgent.LeftAxis; CameraUpAxis = cAgent.UpAxis; // When we get to the point of re-computing neighbors everytime this -- cgit v1.1 From 089fd61a3b27faa2479f6b56c6d0dc1cf14774a2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 22:43:24 +0000 Subject: Allow a script to receive events if its root prim is in an area where it's allowed to run rather than checking its own prim. This allows scripts to run in child prims that are outside region boundaries. This is an interim patch applied from http://opensimulator.org/mantis/view.php?id=5899 though it does not resolve that bug Thanks tglion! --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9bca654..f45a08c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4162,10 +4162,7 @@ namespace OpenSim.Region.Framework.Scenes // their scripts will actually run. // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 SceneObjectPart parent = part.ParentGroup.RootPart; - if (part.ParentGroup.IsAttachment) - return ScriptDanger(parent, parent.GetWorldPosition()); - else - return ScriptDanger(part, part.GetWorldPosition()); + return ScriptDanger(parent, parent.GetWorldPosition()); } else { -- cgit v1.1 From c2c102d33e46d0ed651198e0e9b7459423516660 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 22:52:26 +0000 Subject: Remove outdated comment about checking attachment prims in Scene.PipeEventsForScript() --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f45a08c..a01b851 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4156,11 +4156,9 @@ namespace OpenSim.Region.Framework.Scenes public bool PipeEventsForScript(uint localID) { SceneObjectPart part = GetSceneObjectPart(localID); + if (part != null) { - // Changed so that child prims of attachments return ScriptDanger for their parent, so that - // their scripts will actually run. - // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 SceneObjectPart parent = part.ParentGroup.RootPart; return ScriptDanger(parent, parent.GetWorldPosition()); } -- cgit v1.1 From 98ad6ed255e1b1e55b58c633263480fb12ed3f7a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Mar 2012 23:29:35 +0000 Subject: comment out "[CAPS]: ScriptTaskInventory Request" log spam --- OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index be699db..35cb575 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -262,7 +262,7 @@ namespace OpenSim.Region.ClientStack.Linden { try { - m_log.Debug("[CAPS]: ScriptTaskInventory Request in region: " + m_regionName); +// m_log.Debug("[CAPS]: ScriptTaskInventory Request in region: " + m_regionName); //m_log.DebugFormat("[CAPS]: request: {0}, path: {1}, param: {2}", request, path, param); Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Utils.StringToBytes(request)); -- cgit v1.1 From d44b7c486a5b51bbfbea2c3d2efd2c9dc0f99d0e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 01:27:30 +0000 Subject: Go back to setting appearance directly in NPCModule.SetAppearance() to fix mantis 5914 The part reverted is from commit 2ebb421. Unfortunately, IAvatarFactoryModule.SetAppearance() does not transfer attachments. I'm not sure how to do this separately, unfortunately I'll need to leave it to Dan :) Regression test added for this case. Mantis ref: http://opensimulator.org/mantis/view.php?id=5914 --- .../Region/OptionalModules/World/NPC/NPCModule.cs | 20 ++++++---- .../World/NPC/Tests/NPCModuleTests.cs | 46 +++++++++++++++++++++- 2 files changed, 57 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 2052cdb..2b8379d 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -88,22 +88,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene) { - ScenePresence sp = scene.GetScenePresence(agentId); - if (sp == null || sp.IsChildAgent) + ScenePresence npc = scene.GetScenePresence(agentId); + if (npc == null || npc.IsChildAgent) return false; lock (m_avatars) if (!m_avatars.ContainsKey(agentId)) return false; - // Delete existing sp attachments - scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false); + // Delete existing npc attachments + scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false); - // Set new sp appearance. Also sends to clients. - scene.RequestModuleInterface().SetAppearance(sp, new AvatarAppearance(appearance, true)); + // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments + AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); + npc.Appearance = npcAppearance; - // Rez needed sp attachments - scene.AttachmentsModule.RezAttachments(sp); + // Rez needed npc attachments + scene.AttachmentsModule.RezAttachments(npc); + + IAvatarFactoryModule module = scene.RequestModuleInterface(); + module.SendAppearance(npc.UUID); return true; } diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index d507822..36e2d4a 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -139,7 +139,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests } [Test] - public void TestAttachments() + public void TestCreateWithAttachments() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -179,6 +179,50 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests } [Test] + public void TestLoadAppearance() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID userId = TestHelpers.ParseTail(0x1); + UserAccountHelpers.CreateUserWithInventory(scene, userId); + ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); + + INPCModule npcModule = scene.RequestModuleInterface(); + UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance); + + // Now add the attachment to the original avatar and use that to load a new appearance + // TODO: Could also run tests loading from a notecard though this isn't much different for our purposes here + UUID attItemId = TestHelpers.ParseTail(0x2); + UUID attAssetId = TestHelpers.ParseTail(0x3); + string attName = "att"; + + UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); + + am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); + + npcModule.SetNPCAppearance(npcId, sp.Appearance, scene); + + ScenePresence npc = scene.GetScenePresence(npcId); + + // Check scene presence status + Assert.That(npc.HasAttachments(), Is.True); + List attachments = npc.GetAttachments(); + Assert.That(attachments.Count, Is.EqualTo(1)); + SceneObjectGroup attSo = attachments[0]; + + // Just for now, we won't test the name since this is (wrongly) the asset part name rather than the item + // name. TODO: Do need to fix ultimately since the item may be renamed before being passed on to an NPC. +// Assert.That(attSo.Name, Is.EqualTo(attName)); + + Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest)); + Assert.That(attSo.IsAttachment); + Assert.That(attSo.UsesPhysics, Is.False); + Assert.That(attSo.IsTemporary, Is.False); + Assert.That(attSo.OwnerID, Is.EqualTo(npc.UUID)); + } + + [Test] public void TestMove() { TestHelpers.InMethod(); -- cgit v1.1 From 1dc03e5c4f76064fc193dab3c8f3e1f3783ec227 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 01:47:43 +0000 Subject: Simplify NPCModuleTests code by putting the NPCModule in an instance variable rather than making each test fetch it seperately. Also rename instance variables in the test to conform to naming standards and for understandability --- .../World/NPC/Tests/NPCModuleTests.cs | 117 ++++++++++----------- 1 file changed, 56 insertions(+), 61 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 36e2d4a..9a7e9e8 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -50,10 +50,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests [TestFixture] public class NPCModuleTests { - private TestScene scene; - private AvatarFactoryModule afm; - private UserManagementModule umm; - private AttachmentsModule am; + private TestScene m_scene; + private AvatarFactoryModule m_afMod; + private UserManagementModule m_umMod; + private AttachmentsModule m_attMod; + private NPCModule m_npcMod; [TestFixtureSetUp] public void FixtureInit() @@ -79,12 +80,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests config.AddConfig("Modules"); config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); - afm = new AvatarFactoryModule(); - umm = new UserManagementModule(); - am = new AttachmentsModule(); + m_afMod = new AvatarFactoryModule(); + m_umMod = new UserManagementModule(); + m_attMod = new AttachmentsModule(); + m_npcMod = new NPCModule(); - scene = SceneHelpers.SetupScene(); - SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule()); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule()); } [Test] @@ -93,7 +95,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); // 8 is the index of the first baked texture in AvatarAppearance @@ -104,18 +106,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell // ScenePresence.SendInitialData() to reset our entire appearance. - scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); + m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); - afm.SetAppearance(sp, originalTe, null); + m_afMod.SetAppearance(sp, originalTe, null); - INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance); + UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); - ScenePresence npc = scene.GetScenePresence(npcId); + ScenePresence npc = m_scene.GetScenePresence(npcId); Assert.That(npc, Is.Not.Null); Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId)); - Assert.That(umm.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname))); + Assert.That(m_umMod.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname))); } [Test] @@ -124,16 +125,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); Vector3 startPos = new Vector3(128, 128, 30); - INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); + UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); - npcModule.DeleteNPC(npcId, scene); + m_npcMod.DeleteNPC(npcId, m_scene); - ScenePresence deletedNpc = scene.GetScenePresence(npcId); + ScenePresence deletedNpc = m_scene.GetScenePresence(npcId); Assert.That(deletedNpc, Is.Null); } @@ -145,21 +145,20 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // log4net.Config.XmlConfigurator.Configure(); UUID userId = TestHelpers.ParseTail(0x1); - UserAccountHelpers.CreateUserWithInventory(scene, userId); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); + UserAccountHelpers.CreateUserWithInventory(m_scene, userId); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); UUID attItemId = TestHelpers.ParseTail(0x2); UUID attAssetId = TestHelpers.ParseTail(0x3); string attName = "att"; - UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); + UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); - am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); + m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); - INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance); + UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); - ScenePresence npc = scene.GetScenePresence(npcId); + ScenePresence npc = m_scene.GetScenePresence(npcId); // Check scene presence status Assert.That(npc.HasAttachments(), Is.True); @@ -185,11 +184,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // log4net.Config.XmlConfigurator.Configure(); UUID userId = TestHelpers.ParseTail(0x1); - UserAccountHelpers.CreateUserWithInventory(scene, userId); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); + UserAccountHelpers.CreateUserWithInventory(m_scene, userId); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); - INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance); + UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); // Now add the attachment to the original avatar and use that to load a new appearance // TODO: Could also run tests loading from a notecard though this isn't much different for our purposes here @@ -197,13 +195,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests UUID attAssetId = TestHelpers.ParseTail(0x3); string attName = "att"; - UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); + UserInventoryHelpers.CreateInventoryItem(m_scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); - am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); + m_attMod.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); - npcModule.SetNPCAppearance(npcId, sp.Appearance, scene); + m_npcMod.SetNPCAppearance(npcId, sp.Appearance, m_scene); - ScenePresence npc = scene.GetScenePresence(npcId); + ScenePresence npc = m_scene.GetScenePresence(npcId); // Check scene presence status Assert.That(npc.HasAttachments(), Is.True); @@ -228,31 +226,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); Vector3 startPos = new Vector3(128, 128, 30); - INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); + UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); - ScenePresence npc = scene.GetScenePresence(npcId); + ScenePresence npc = m_scene.GetScenePresence(npcId); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); // For now, we'll make the scene presence fly to simplify this test, but this needs to change. npc.Flying = true; - scene.Update(); + m_scene.Update(); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); Vector3 targetPos = startPos + new Vector3(0, 10, 0); - npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); + m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); //Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f))); Assert.That( npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001)); - scene.Update(); + m_scene.Update(); // We should really check the exact figure. Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X)); @@ -261,7 +258,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X)); for (int i = 0; i < 10; i++) - scene.Update(); + m_scene.Update(); double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); @@ -271,14 +268,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // Try a second movement startPos = npc.AbsolutePosition; targetPos = startPos + new Vector3(10, 0, 0); - npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); + m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); // Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1))); Assert.That( npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0, 1), 0.000001)); - scene.Update(); + m_scene.Update(); // We should really check the exact figure. Assert.That(npc.AbsolutePosition.X, Is.GreaterThan(startPos.X)); @@ -287,7 +284,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); for (int i = 0; i < 10; i++) - scene.Update(); + m_scene.Update(); distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move"); @@ -300,17 +297,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); Vector3 startPos = new Vector3(128, 128, 30); - INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); + UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); - ScenePresence npc = scene.GetScenePresence(npcId); - SceneObjectPart part = SceneHelpers.AddSceneObject(scene); + ScenePresence npc = m_scene.GetScenePresence(npcId); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); part.SitTargetPosition = new Vector3(0, 0, 1); - npcModule.Sit(npc.UUID, part.UUID, scene); + m_npcMod.Sit(npc.UUID, part.UUID, m_scene); Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId)); Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); @@ -318,7 +314,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests npc.AbsolutePosition, Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); - npcModule.Stand(npc.UUID, scene); + m_npcMod.Stand(npc.UUID, m_scene); Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); Assert.That(npc.ParentID, Is.EqualTo(0)); @@ -330,19 +326,18 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); // FIXME: To get this to work for now, we are going to place the npc right next to the target so that // the autopilot doesn't trigger Vector3 startPos = new Vector3(1, 1, 1); - INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, UUID.Zero, true, scene, sp.Appearance); + UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); - ScenePresence npc = scene.GetScenePresence(npcId); - SceneObjectPart part = SceneHelpers.AddSceneObject(scene); + ScenePresence npc = m_scene.GetScenePresence(npcId); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); - npcModule.Sit(npc.UUID, part.UUID, scene); + m_npcMod.Sit(npc.UUID, part.UUID, m_scene); Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); Assert.That(npc.ParentID, Is.EqualTo(part.LocalId)); @@ -355,7 +350,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests npc.AbsolutePosition, Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f))); - npcModule.Stand(npc.UUID, scene); + m_npcMod.Stand(npc.UUID, m_scene); Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); Assert.That(npc.ParentID, Is.EqualTo(0)); -- cgit v1.1 From 85198a45cb944a3de7402d7fccc75ec499002f01 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 02:01:47 +0000 Subject: Fix off by one error in script error reporting. --- OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index 8b88588..65d3b9b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs @@ -118,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools emessage = emessage.Substring(slinfo.Length+2); message = String.Format("({0},{1}) {2}", - e.slInfo.lineNumber - 2, + e.slInfo.lineNumber - 1, e.slInfo.charPosition - 1, emessage); throw new Exception(message); -- cgit v1.1 From a92153ed88859af9d68b206ec320fc993fe5cdc7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 02:21:19 +0000 Subject: Get all test methods in OpenSim.Region.ScriptEngine.Tests.dll to report that they're running --- .../Shared/CodeTools/Tests/CSCodeGeneratorTest.cs | 95 ++++++++++++++++++++++ .../Shared/CodeTools/Tests/CompilerTest.cs | 7 +- .../ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 11 ++- .../Shared/Tests/LSL_TypesTestLSLFloat.cs | 74 ++++++++++++++--- .../Shared/Tests/LSL_TypesTestLSLInteger.cs | 8 ++ .../Shared/Tests/LSL_TypesTestLSLString.cs | 8 ++ .../ScriptEngine/Shared/Tests/LSL_TypesTestList.cs | 42 ++++++++-- .../Shared/Tests/LSL_TypesTestVector3.cs | 9 +- 8 files changed, 228 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs index 63afb0b..2add011 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs @@ -29,6 +29,7 @@ using System.Collections.Generic; using System.Text.RegularExpressions; using NUnit.Framework; using OpenSim.Region.ScriptEngine.Shared.CodeTools; +using OpenSim.Tests.Common; namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests { @@ -43,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests [Test] public void TestDefaultState() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -63,6 +66,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests [Test] public void TestCustomState() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -93,6 +98,8 @@ state another_state [Test] public void TestEventWithArguments() { + TestHelpers.InMethod(); + string input = @"default { at_rot_target(integer tnum, rotation targetrot, rotation ourrot) @@ -113,6 +120,8 @@ state another_state [Test] public void TestIntegerDeclaration() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -135,6 +144,8 @@ state another_state [Test] public void TestLoneIdent() { + TestHelpers.InMethod(); + // A lone ident should be removed completely as it's an error in C# // (MONO at least). string input = @"default @@ -161,6 +172,8 @@ state another_state [Test] public void TestAssignments() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -187,6 +200,8 @@ state another_state [Test] public void TestAdditionSubtractionOperator() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -215,6 +230,8 @@ state another_state [Test] public void TestStrings() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -242,6 +259,8 @@ state another_state [Test] public void TestBinaryExpression() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -284,6 +303,8 @@ state another_state [Test] public void TestFloatConstants() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -336,6 +357,8 @@ state another_state [Test] public void TestComments() { + TestHelpers.InMethod(); + string input = @"// this test tests comments default { @@ -358,6 +381,8 @@ default [Test] public void TestStringsWithEscapedQuotesAndComments() { + TestHelpers.InMethod(); + string input = @"// this test tests strings, with escaped quotes and comments in strings default { @@ -397,6 +422,8 @@ default [Test] public void TestCStyleComments() { + TestHelpers.InMethod(); + string input = @"/* this test tests comments of the C variety */ @@ -426,6 +453,8 @@ default [Test] public void TestGlobalDefinedFunctions() { + TestHelpers.InMethod(); + string input = @"// this test tests custom defined functions string onefunc() @@ -470,6 +499,8 @@ default [Test] public void TestGlobalDeclaredVariables() { + TestHelpers.InMethod(); + string input = @"// this test tests custom defined functions and global variables string globalString; @@ -525,6 +556,8 @@ default [Test] public void TestMoreAssignments() { + TestHelpers.InMethod(); + string input = @"// this test tests +=, -=, *=, /=, %= string globalString; @@ -579,6 +612,8 @@ default [Test] public void TestVectorConstantNotation() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -606,6 +641,8 @@ default [Test] public void TestVectorMemberAccess() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -632,6 +669,8 @@ default [Test] public void TestExpressionInParentheses() { + TestHelpers.InMethod(); + string input = @"default { touch_start(integer num_detected) @@ -660,6 +699,8 @@ default [Test] public void TestIncrementDecrementOperator() { + TestHelpers.InMethod(); + string input = @"// here we'll test the ++ and -- operators default @@ -690,6 +731,8 @@ default [Test] public void TestLists() { + TestHelpers.InMethod(); + string input = @"// testing lists default @@ -718,6 +761,8 @@ default [Test] public void TestIfStatement() { + TestHelpers.InMethod(); + string input = @"// let's test if statements default @@ -822,6 +867,8 @@ default [Test] public void TestIfElseStatement() { + TestHelpers.InMethod(); + string input = @"// let's test complex logical expressions default @@ -928,6 +975,8 @@ default [Test] public void TestWhileLoop() { + TestHelpers.InMethod(); + string input = @"// let's test while loops default @@ -968,6 +1017,8 @@ default [Test] public void TestDoWhileLoop() { + TestHelpers.InMethod(); + string input = @"// let's test do-while loops default @@ -1012,6 +1063,8 @@ default [Test] public void TestForLoop() { + TestHelpers.InMethod(); + string input = @"// let's test for loops default @@ -1056,6 +1109,8 @@ default [Test] public void TestFloatsWithTrailingDecimal() { + TestHelpers.InMethod(); + string input = @"// a curious feature of LSL that allows floats to be defined with a trailing dot default @@ -1108,6 +1163,8 @@ default [Test] public void TestUnaryAndBinaryOperators() { + TestHelpers.InMethod(); + string input = @"// let's test a few more operators default @@ -1144,6 +1201,8 @@ default [Test] public void TestTypecasts() { + TestHelpers.InMethod(); + string input = @"// let's test typecasts default @@ -1189,6 +1248,8 @@ default [Test] public void TestStates() { + TestHelpers.InMethod(); + string input = @"// let's test states default @@ -1229,6 +1290,8 @@ state statetwo [Test] public void TestHexIntegerConstants() { + TestHelpers.InMethod(); + string input = @"// let's test hex integers default @@ -1261,6 +1324,8 @@ default [Test] public void TestJumps() { + TestHelpers.InMethod(); + string input = @"// let's test jumps default @@ -1291,6 +1356,8 @@ default [Test] public void TestImplicitVariableInitialization() { + TestHelpers.InMethod(); + string input = @"// let's test implicitly initializing variables default @@ -1334,6 +1401,8 @@ default [Test] public void TestMultipleEqualsExpression() { + TestHelpers.InMethod(); + string input = @"// let's test x = y = 5 type expressions default @@ -1366,6 +1435,8 @@ default [Test] public void TestUnaryExpressionLastInVectorConstant() { + TestHelpers.InMethod(); + string input = @"// let's test unary expressions some more default @@ -1390,6 +1461,8 @@ default [Test] public void TestVectorMemberPlusEquals() { + TestHelpers.InMethod(); + string input = @"// let's test unary expressions some more default @@ -1424,6 +1497,8 @@ default [Test] public void TestWhileLoopWithNoBody() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1447,6 +1522,8 @@ default [Test] public void TestDoWhileLoopWithNoBody() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1472,6 +1549,8 @@ default [Test] public void TestIfWithNoBody() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1495,6 +1574,8 @@ default [Test] public void TestIfElseWithNoBody() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1521,6 +1602,8 @@ default [Test] public void TestForLoopWithNoBody() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1544,6 +1627,8 @@ default [Test] public void TestForLoopWithNoAssignment() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1569,6 +1654,8 @@ default [Test] public void TestForLoopWithOnlyIdentInAssignment() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1594,6 +1681,8 @@ default [Test] public void TestAssignmentInIfWhileDoWhile() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1631,6 +1720,8 @@ default [Test] public void TestLSLListHack() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1656,6 +1747,8 @@ default [ExpectedException(typeof(System.Exception))] public void TestSyntaxError() { + TestHelpers.InMethod(); + string input = @"default { state_entry() @@ -1682,6 +1775,8 @@ default [ExpectedException(typeof(System.Exception))] public void TestSyntaxErrorDeclaringVariableInForLoop() { + TestHelpers.InMethod(); + string input = @"default { state_entry() diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs index c5483c8..1fa6954 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using Microsoft.CSharp; using NUnit.Framework; using OpenSim.Region.ScriptEngine.Shared.CodeTools; +using OpenSim.Tests.Common; namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests { @@ -92,6 +93,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests //[Test] public void TestUseUndeclaredVariable() { + TestHelpers.InMethod(); + m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); string input = @"default @@ -124,6 +127,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests //[Test] public void TestCastAndConcatString() { + TestHelpers.InMethod(); + m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); string input = @"string s = "" a string""; @@ -150,4 +155,4 @@ default Assert.AreEqual(0, m_compilerResults.Errors.Count); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 3baa723..9cf9258 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs @@ -46,7 +46,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [TestFixture, LongRunning] public class LSL_ApiTest { - private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d; private const float FLOAT_ACCURACY = 0.00005f; @@ -55,7 +54,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [SetUp] public void SetUp() { - IConfigSource initConfigSource = new IniConfigSource(); IConfig config = initConfigSource.AddConfig("XEngine"); config.Set("Enabled", "true"); @@ -75,6 +73,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestllAngleBetween() { + TestHelpers.InMethod(); + CheckllAngleBetween(new Vector3(1, 0, 0), 0, 1, 1); CheckllAngleBetween(new Vector3(1, 0, 0), 90, 1, 1); CheckllAngleBetween(new Vector3(1, 0, 0), 180, 1, 1); @@ -158,6 +158,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // llRot2Euler test. public void TestllRot2Euler() { + TestHelpers.InMethod(); + // 180, 90 and zero degree rotations. CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f)); CheckllRot2Euler(new LSL_Types.Quaternion(0.0f, 0.0f, 0.707107f, 0.707107f)); @@ -256,6 +258,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // llSetPrimitiveParams and llGetPrimitiveParams test. public void TestllSetPrimitiveParams() { + TestHelpers.InMethod(); + // Create Prim1. Scene scene = SceneHelpers.SetupScene(); string obj1Name = "Prim1"; @@ -486,9 +490,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests } [Test] - // llVecNorm test. public void TestllVecNorm() { + TestHelpers.InMethod(); + // Check special case for normalizing zero vector. CheckllVecNorm(new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Check various vectors. diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs index 10b52cf..3ed2562 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs @@ -213,6 +213,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestConstructFromInt() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (KeyValuePair number in m_intDoubleSet) @@ -228,6 +230,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestConstructFromDouble() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (KeyValuePair number in m_doubleDoubleSet) @@ -243,6 +247,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLFloatToInt() { + TestHelpers.InMethod(); + int testNumber; foreach (KeyValuePair number in m_doubleIntSet) @@ -258,6 +264,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLFloatToUint() { + TestHelpers.InMethod(); + uint testNumber; foreach (KeyValuePair number in m_doubleUintSet) @@ -273,6 +281,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastLSLFloatToBooleanTrue() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; bool testBool; @@ -291,6 +301,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastLSLFloatToBooleanFalse() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat = new LSL_Types.LSLFloat(0.0); bool testBool = testFloat; @@ -303,6 +315,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastIntToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (int number in m_intList) @@ -318,6 +332,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastLSLIntegerToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (int number in m_intList) @@ -333,6 +349,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLIntegerToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (int number in m_intList) @@ -348,6 +366,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastStringToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (KeyValuePair number in m_stringDoubleSet) @@ -363,6 +383,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLStringToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (KeyValuePair number in m_stringDoubleSet) @@ -378,6 +400,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastDoubleToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (double number in m_doubleList) @@ -393,6 +417,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastLSLFloatToDouble() { + TestHelpers.InMethod(); + double testNumber; LSL_Types.LSLFloat testFloat; @@ -411,19 +437,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLFloatToFloat() { - float testFloat; - float numberAsFloat; - LSL_Types.LSLFloat testLSLFloat; - foreach (double number in m_doubleList) - { - testLSLFloat = new LSL_Types.LSLFloat(number); - numberAsFloat = (float)number; - testFloat = (float)testLSLFloat; - - Assert.That((double)testFloat, new DoubleToleranceConstraint((double)numberAsFloat, _lowPrecisionTolerance)); - } - } + TestHelpers.InMethod(); + + float testFloat; + float numberAsFloat; + LSL_Types.LSLFloat testLSLFloat; + foreach (double number in m_doubleList) + { + testLSLFloat = new LSL_Types.LSLFloat(number); + numberAsFloat = (float)number; + testFloat = (float)testLSLFloat; + + Assert.That((double)testFloat, new DoubleToleranceConstraint((double)numberAsFloat, _lowPrecisionTolerance)); + } + } /// /// Tests the equality (==) operator. @@ -431,6 +459,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestEqualsOperator() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloatA, testFloatB; foreach (double number in m_doubleList) @@ -450,6 +480,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestNotEqualOperator() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloatA, testFloatB; foreach (double number in m_doubleList) @@ -469,6 +501,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestIncrementOperator() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; double testNumber; @@ -493,6 +527,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestDecrementOperator() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; double testNumber; @@ -517,6 +553,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestToString() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; foreach (KeyValuePair number in m_doubleStringSet) @@ -532,6 +570,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestAddTwoLSLFloats() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testResult; foreach (KeyValuePair number in m_doubleDoubleSet) @@ -547,6 +587,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestSubtractTwoLSLFloats() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testResult; foreach (KeyValuePair number in m_doubleDoubleSet) @@ -562,6 +604,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestMultiplyTwoLSLFloats() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testResult; foreach (KeyValuePair number in m_doubleDoubleSet) @@ -577,6 +621,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestDivideTwoLSLFloats() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testResult; foreach (KeyValuePair number in m_doubleDoubleSet) @@ -595,6 +641,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastBooleanToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testFloat; testFloat = (1 == 0); @@ -610,4 +658,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Assert.That(testFloat.value, new DoubleToleranceConstraint(1.0, _lowPrecisionTolerance)); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs index 3ad673b..8d1169a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLInteger.cs @@ -79,6 +79,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLFloatToLSLInteger() { + TestHelpers.InMethod(); + LSL_Types.LSLInteger testInteger; foreach (KeyValuePair number in m_doubleIntSet) @@ -94,6 +96,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastStringToLSLInteger() { + TestHelpers.InMethod(); + LSL_Types.LSLInteger testInteger; foreach (KeyValuePair number in m_stringIntSet) @@ -109,6 +113,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLStringToLSLInteger() { + TestHelpers.InMethod(); + LSL_Types.LSLInteger testInteger; foreach (KeyValuePair number in m_stringIntSet) @@ -124,6 +130,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastBooleanToLSLInteger() { + TestHelpers.InMethod(); + LSL_Types.LSLInteger testInteger; testInteger = (1 == 0); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs index fa976ed..c4ca1a8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLString.cs @@ -71,6 +71,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestConstructFromLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLString testString; foreach (KeyValuePair number in m_doubleStringSet) @@ -86,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLFloatToLSLString() { + TestHelpers.InMethod(); + LSL_Types.LSLString testString; foreach (KeyValuePair number in m_doubleStringSet) @@ -101,6 +105,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestExplicitCastLSLStringToQuaternion() { + TestHelpers.InMethod(); + string quaternionString = "<0.00000, 0.70711, 0.00000, 0.70711>"; LSL_Types.LSLString quaternionLSLString = new LSL_Types.LSLString(quaternionString); @@ -118,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestImplicitCastBooleanToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLString testString; testString = (LSL_Types.LSLString) (1 == 0); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs index 66a7329..b81225f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestList.cs @@ -44,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestConcatenateString() { + TestHelpers.InMethod(); + LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); testList += new LSL_Types.LSLString("addition"); @@ -64,6 +66,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestConcatenateInteger() { + TestHelpers.InMethod(); + LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); testList += new LSL_Types.LSLInteger(20); @@ -84,6 +88,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestConcatenateDouble() { + TestHelpers.InMethod(); + LSL_Types.list testList = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger('a'), new LSL_Types.LSLString("test")); testList += new LSL_Types.LSLFloat(2.0f); @@ -104,6 +110,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestCastLSLIntegerItemToLSLInteger() { + TestHelpers.InMethod(); + LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(123); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -116,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestCastLSLFloatItemToLSLFloat() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(123.45678987); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -128,6 +138,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestCastLSLStringItemToLSLString() { + TestHelpers.InMethod(); + LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello there"); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -140,6 +152,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestCastVector3ItemToVector3() { + TestHelpers.InMethod(); + LSL_Types.Vector3 testValue = new LSL_Types.Vector3(12.34, 56.987654, 0.00987); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -151,6 +165,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestCastQuaternionItemToQuaternion() { + TestHelpers.InMethod(); + LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.34, 56.44323, 765.983421, 0.00987); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -165,6 +181,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetLSLIntegerItemForLSLIntegerItem() { + TestHelpers.InMethod(); + LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(999911); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -177,6 +195,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetLSLFloatItemForLSLFloatItem() { + TestHelpers.InMethod(); + LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(321.45687876); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -189,11 +209,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetLSLFloatItemForLSLIntegerItem() { - LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(3060987); - LSL_Types.LSLFloat testFloatValue = new LSL_Types.LSLFloat(testValue); - LSL_Types.list testList = new LSL_Types.list(testValue); + TestHelpers.InMethod(); + + LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(3060987); + LSL_Types.LSLFloat testFloatValue = new LSL_Types.LSLFloat(testValue); + LSL_Types.list testList = new LSL_Types.list(testValue); - Assert.AreEqual(testFloatValue, testList.GetLSLFloatItem(0)); + Assert.AreEqual(testFloatValue, testList.GetLSLFloatItem(0)); } /// @@ -202,6 +224,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetLSLStringItemForLSLStringItem() { + TestHelpers.InMethod(); + LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello all"); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -214,6 +238,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetLSLStringItemForKeyItem() { + TestHelpers.InMethod(); + LSL_Types.key testValue = new LSL_Types.key("98000000-0000-2222-3333-100000001000"); LSL_Types.LSLString testStringValue = new LSL_Types.LSLString(testValue); @@ -228,6 +254,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetVector3ItemForVector3Item() { + TestHelpers.InMethod(); + LSL_Types.Vector3 testValue = new LSL_Types.Vector3(92.34, 58.98754, -0.10987); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -239,6 +267,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetQuaternionItemForQuaternionItem() { + TestHelpers.InMethod(); + LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -251,6 +281,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [Test] public void TestGetKeyItemForKeyItem() { + TestHelpers.InMethod(); + LSL_Types.key testValue = new LSL_Types.key("00000000-0000-2222-3333-100000001012"); LSL_Types.list testList = new LSL_Types.list(testValue); @@ -258,4 +290,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Assert.AreEqual(testValue, testList.GetKeyItem(0)); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs index 195af7f..ebf8001 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestVector3.cs @@ -32,16 +32,17 @@ using OpenSim.Region.ScriptEngine.Shared; namespace OpenSim.Region.ScriptEngine.Shared.Tests { + /// + /// Tests for Vector3 + /// [TestFixture] public class LSL_TypesTestVector3 { - /// - /// Tests for Vector3 - /// [Test] - public void TestDotProduct() { + TestHelpers.InMethod(); + // The numbers we test for. Dictionary expectsSet = new Dictionary(); expectsSet.Add("<1, 2, 3> * <2, 3, 4>", 20.0); -- cgit v1.1 From b3449e998ab7fc9a952559821caea6484fc57e6e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 02:30:22 +0000 Subject: Fix TestSyntaxError() and TestSyntaxErrorDeclaringVariableInForLoop() They were all failing assertions but the exceptions these threw were caught as expected Exceptions. I don't think we can easily distinguish these from the Exceptions that we're expecting. So for now we'll do some messy manually checking with boolean setting instead. This patch also corrects the assertions themselves. --- .../Shared/CodeTools/Tests/CSCodeGeneratorTest.cs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs index 2add011..7763619 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs @@ -1744,11 +1744,12 @@ default } [Test] - [ExpectedException(typeof(System.Exception))] public void TestSyntaxError() { TestHelpers.InMethod(); + bool gotException = false; + string input = @"default { state_entry() @@ -1764,19 +1765,22 @@ default } catch (System.Exception e) { - // The syntax error is on line 6, char 5 (expected ';', found + // The syntax error is on line 5, char 4 (expected ';', found // '}'). - Assert.AreEqual("(4,4) syntax error", e.Message); - throw; + Assert.AreEqual("(5,4) syntax error", e.Message); + gotException = true; } + + Assert.That(gotException, Is.True); } [Test] - [ExpectedException(typeof(System.Exception))] public void TestSyntaxErrorDeclaringVariableInForLoop() { TestHelpers.InMethod(); + bool gotException = false; + string input = @"default { state_entry() @@ -1792,11 +1796,13 @@ default } catch (System.Exception e) { - // The syntax error is on line 5, char 14 (Syntax error) - Assert.AreEqual("(3,13) syntax error", e.Message); + // The syntax error is on line 4, char 13 (Syntax error) + Assert.AreEqual("(4,13) syntax error", e.Message); - throw; + gotException = true; } + + Assert.That(gotException, Is.True); } } } -- cgit v1.1 From 0f4cdc0c5bb750ec4ab7b100dc82d3ff08c9e427 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 19:05:32 +0000 Subject: Explictly close down the StatsReporter so that we can shutdown its timer This is another step necessary for the scene to be garbage collected between performance tests --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 ++ OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a01b851..6b28581 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1076,6 +1076,8 @@ namespace OpenSim.Region.Framework.Scenes { m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); + StatsReporter.Close(); + m_restartTimer.Stop(); m_restartTimer.Close(); diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 35cd025..210f48d 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -185,6 +185,12 @@ namespace OpenSim.Region.Framework.Scenes OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket; } + public void Close() + { + m_report.Elapsed -= statsHeartBeat; + m_report.Close(); + } + public void SetUpdateMS(int ms) { statsUpdatesEveryMS = ms; -- cgit v1.1 From e9d8eb5a270645ece83c864dbd3c84bf226a57f7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 22:31:25 +0000 Subject: Remove unnecessary explicit ElapsedEventHandler in SimReporter --- OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 210f48d..5c56264 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -178,7 +178,7 @@ namespace OpenSim.Region.Framework.Scenes m_objectCapacity = scene.RegionInfo.ObjectCapacity; m_report.AutoReset = true; m_report.Interval = statsUpdatesEveryMS; - m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat); + m_report.Elapsed += statsHeartBeat; m_report.Enabled = true; if (StatsManager.SimExtraStats != null) -- cgit v1.1 From 98251cdab364baf20537a1b5a6260c68e6630ccf Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 23:21:17 +0000 Subject: Add sensor, dataserver requests, timer and listener counts to "xengine status" command. This is for diagnostic purposes. --- .../Scripting/WorldComm/WorldCommModule.cs | 20 ++++++++ OpenSim/Region/Framework/Interfaces/IWorldComm.cs | 5 ++ .../Api/Implementation/AsyncCommandManager.cs | 53 +++++++++++++++++++++- .../Api/Implementation/Plugins/Dataserver.cs | 9 ++++ .../Shared/Api/Implementation/Plugins/Listener.cs | 25 +++++----- .../Api/Implementation/Plugins/SensorRepeat.cs | 12 +++++ .../Shared/Api/Implementation/Plugins/Timer.cs | 9 ++++ OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 15 ++++++ 8 files changed, 136 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 640a60b..ef9b4e0 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs @@ -151,6 +151,14 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm #region IWorldComm Members + public int ListenerCount + { + get + { + return m_listenerManager.ListenerCount; + } + } + /// /// Create a listen event callback with the specified filters. /// The parameters localID,itemID are needed to uniquely identify @@ -438,6 +446,18 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm private int m_maxhandles; private int m_curlisteners; + /// + /// Total number of listeners + /// + public int ListenerCount + { + get + { + lock (m_listeners) + return m_listeners.Count; + } + } + public ListenerManager(int maxlisteners, int maxhandles) { m_maxlisteners = maxlisteners; diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs index dafbf30..e8e375e 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs @@ -50,6 +50,11 @@ namespace OpenSim.Region.Framework.Interfaces public interface IWorldComm { /// + /// Total number of listeners + /// + int ListenerCount { get; } + + /// /// Create a listen event callback with the specified filters. /// The parameters localID,itemID are needed to uniquely identify /// the script during 'peek' time. Parameter hostID is needed to diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 14edde4..993d10f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs @@ -247,7 +247,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Remove Sensors m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID); + } + + /// + /// Get the sensor repeat plugin for this script engine. + /// + /// + /// + public static SensorRepeat GetSensorRepeatPlugin(IScriptEngine engine) + { + if (m_SensorRepeat.ContainsKey(engine)) + return m_SensorRepeat[engine]; + else + return null; + } + /// + /// Get the dataserver plugin for this script engine. + /// + /// + /// + public static Dataserver GetDataserverPlugin(IScriptEngine engine) + { + if (m_Dataserver.ContainsKey(engine)) + return m_Dataserver[engine]; + else + return null; + } + + /// + /// Get the timer plugin for this script engine. + /// + /// + /// + public static Timer GetTimerPlugin(IScriptEngine engine) + { + if (m_Timer.ContainsKey(engine)) + return m_Timer[engine]; + else + return null; + } + + /// + /// Get the listener plugin for this script engine. + /// + /// + /// + public static Listener GetListenerPlugin(IScriptEngine engine) + { + if (m_Listener.ContainsKey(engine)) + return m_Listener[engine]; + else + return null; } public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID) @@ -270,7 +321,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api data.AddRange(timers); } - Object[] sensors=m_SensorRepeat[engine].GetSerializationData(itemID); + Object[] sensors = m_SensorRepeat[engine].GetSerializationData(itemID); if (sensors.Length > 0) { data.Add("sensor"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs index 7fa19b1..9f78a49 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs @@ -38,6 +38,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins { public AsyncCommandManager m_CmdManager; + public int DataserverRequestsCount + { + get + { + lock (DataserverRequests) + return DataserverRequests.Count; + } + } + private Dictionary DataserverRequests = new Dictionary(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs index 740816f..93e0261 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs @@ -42,22 +42,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins public AsyncCommandManager m_CmdManager; + private IWorldComm m_commsPlugin; + + public int ListenerCount + { + get { return m_commsPlugin.ListenerCount; } + } + public Listener(AsyncCommandManager CmdManager) { m_CmdManager = CmdManager; + m_commsPlugin = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface(); } public void CheckListeners() { if (m_CmdManager.m_ScriptEngine.World == null) return; - IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface(); - if (comms != null) + if (m_commsPlugin != null) { - while (comms.HasMessages()) + while (m_commsPlugin.HasMessages()) { - ListenerInfo lInfo = (ListenerInfo)comms.GetNextMessage(); + ListenerInfo lInfo = (ListenerInfo)m_commsPlugin.GetNextMessage(); //Deliver data to prim's listen handler object[] resobj = new object[] @@ -81,17 +88,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins public Object[] GetSerializationData(UUID itemID) { - IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface(); - - return comms.GetSerializationData(itemID); + return m_commsPlugin.GetSerializationData(itemID); } public void CreateFromData(uint localID, UUID itemID, UUID hostID, Object[] data) { - IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface(); - - comms.CreateFromData(localID, itemID, hostID, data); + m_commsPlugin.CreateFromData(localID, itemID, hostID, data); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index fbb7c39..1c272f8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -44,6 +44,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins public AsyncCommandManager m_CmdManager; + /// + /// Number of sensors active. + /// + public int SensorsCount + { + get + { + lock (SenseRepeatListLock) + return SenseRepeaters.Count; + } + } + public SensorRepeat(AsyncCommandManager CmdManager) { m_CmdManager = CmdManager; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs index eeb59d9..bc63030 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs @@ -37,6 +37,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins { public AsyncCommandManager m_CmdManager; + public int TimersCount + { + get + { + lock (TimerListLock) + return Timers.Count; + } + } + public Timer(AsyncCommandManager CmdManager) { m_CmdManager = CmdManager; diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index c68f03f..d1cac9c 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -49,7 +49,10 @@ using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared.ScriptBase; using OpenSim.Region.ScriptEngine.Shared.CodeTools; using OpenSim.Region.ScriptEngine.Shared.Instance; +using OpenSim.Region.ScriptEngine.Shared.Api; +using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; using OpenSim.Region.ScriptEngine.Interfaces; +using Timer = OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer; using ScriptCompileQueue = OpenSim.Framework.LocklessQueue; @@ -386,6 +389,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); // sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count); + SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(this); + sb.AppendFormat("Sensors : {0}\n", sr.SensorsCount); + + Dataserver ds = AsyncCommandManager.GetDataserverPlugin(this); + sb.AppendFormat("Dataserver requests : {0}\n", ds.DataserverRequestsCount); + + Timer t = AsyncCommandManager.GetTimerPlugin(this); + sb.AppendFormat("Timers : {0}\n", t.TimersCount); + + Listener l = AsyncCommandManager.GetListenerPlugin(this); + sb.AppendFormat("Listeners : {0}\n", l.ListenerCount); + MainConsole.Instance.OutputFormat(sb.ToString()); } -- cgit v1.1 From 33769799233c144a4971efecf25afe1f6ab1d66f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 23:51:50 +0000 Subject: Remove static m_MainInstance in LocalGridServiceConnector. I believe this was originally required back when there could be two LocalGridServiceConnectors but this is no longer the case. Having such statics makes performance testing much more difficult since they prevent GC of objects unless static references are explicitly nulled. --- .../Grid/LocalGridServiceConnector.cs | 34 +++++++--------------- 1 file changed, 10 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 3c36799..4f0363a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -48,8 +48,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - private static LocalGridServicesConnector m_MainInstance; - private IGridService m_GridService; private Dictionary m_LocalCache = new Dictionary(); @@ -62,7 +60,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public LocalGridServicesConnector(IConfigSource source) { m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated"); - m_MainInstance = this; InitialiseService(source); } @@ -87,7 +84,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if (name == Name) { InitialiseService(source); - m_MainInstance = this; m_Enabled = true; m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled"); } @@ -126,12 +122,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public void PostInitialise() { - if (m_MainInstance == this) - { - MainConsole.Instance.Commands.AddCommand("LocalGridConnector", false, "show neighbours", - "show neighbours", - "Shows the local regions' neighbours", NeighboursCommand); - } + MainConsole.Instance.Commands.AddCommand("LocalGridConnector", false, "show neighbours", + "show neighbours", + "Shows the local regions' neighbours", NeighboursCommand); } public void Close() @@ -143,22 +136,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid if (m_Enabled) scene.RegisterModuleInterface(this); - if (m_MainInstance == this) - { - if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID)) - m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); - else - m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene)); - } + if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID)) + m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); + else + m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene)); } public void RemoveRegion(Scene scene) { - if (m_MainInstance == this) - { - m_LocalCache[scene.RegionInfo.RegionID].Clear(); - m_LocalCache.Remove(scene.RegionInfo.RegionID); - } + m_LocalCache[scene.RegionInfo.RegionID].Clear(); + m_LocalCache.Remove(scene.RegionInfo.RegionID); } public void RegionLoaded(Scene scene) @@ -259,6 +246,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid MainConsole.Instance.Output(caps.ToString()); } - } -} +} \ No newline at end of file -- cgit v1.1 From 23aba007dd0c6e8983feef6fc078b3d5b674ed3a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 7 Mar 2012 00:04:24 +0000 Subject: Add documentation to make more explicit the difference between OnRezScript and OnNewScript in the event manager OnNewScript fires when a script is added to a scene OnRezScript fires when the script actually runs (i.e. after permission checks, state retrieval, etc.) --- OpenSim/Region/Framework/Scenes/EventManager.cs | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 569c235..6ff2a6f 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -138,8 +138,11 @@ namespace OpenSim.Region.Framework.Scenes public event OnPermissionErrorDelegate OnPermissionError; /// - /// Fired when a new script is created. + /// Fired when a script is run. /// + /// + /// Occurs after OnNewScript. + /// public event NewRezScript OnRezScript; public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); @@ -187,10 +190,16 @@ namespace OpenSim.Region.Framework.Scenes public event ClientClosed OnClientClosed; - // Fired when a script is created - // The indication that a new script exists in this region. public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID); + + /// + /// Fired when a script is created. + /// + /// + /// Occurs before OnRezScript + /// public event NewScript OnNewScript; + public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID) { NewScript handlerNewScript = OnNewScript; @@ -212,10 +221,16 @@ namespace OpenSim.Region.Framework.Scenes } } - //TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset - // An indication that the script has changed. public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID); + + /// + /// An indication that the script has changed. + /// + /// + /// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset. + /// public event UpdateScript OnUpdateScript; + public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID) { UpdateScript handlerUpdateScript = OnUpdateScript; -- cgit v1.1 From f3678d217f7b1d69faf4aaeb0097348f3d7f91b6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 7 Mar 2012 00:31:18 +0000 Subject: Stop individually deleting objects at the end of each ObjectTortureTest. We can now do this since the entire scene and all objects within it are now successfully gc'd at the end of these tests. This greatly improves the time taken to run each test (by reducing teardown time, not the time to actually do the test work that we're interested in). Slightly simplifies config read in Scene constructor to help facilitate this. --- OpenSim/Region/Framework/Scenes/Scene.cs | 49 ++++++++++++++------------------ 1 file changed, 21 insertions(+), 28 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6b28581..11e5ce3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -628,10 +628,10 @@ namespace OpenSim.Region.Framework.Scenes #region Region Config - try + // Region config overrides global config + // + if (m_config.Configs["Startup"] != null) { - // Region config overrides global config - // IConfig startupConfig = m_config.Configs["Startup"]; m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); @@ -721,46 +721,39 @@ namespace OpenSim.Region.Framework.Scenes m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); } - catch - { - m_log.Warn("[SCENE]: Failed to load StartupConfig"); - } #endregion Region Config #region Interest Management - if (m_config != null) + IConfig interestConfig = m_config.Configs["InterestManagement"]; + if (interestConfig != null) { - IConfig interestConfig = m_config.Configs["InterestManagement"]; - if (interestConfig != null) - { - string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower(); - - try - { - m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true); - } - catch (Exception) - { - m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time"); - m_priorityScheme = UpdatePrioritizationSchemes.Time; - } + string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower(); - m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true); - m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0); - m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0); - m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0); + try + { + m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true); } + catch (Exception) + { + m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time"); + m_priorityScheme = UpdatePrioritizationSchemes.Time; + } + + m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true); + m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0); + m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0); + m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0); } - m_log.InfoFormat("[SCENE]: Using the {0} prioritization scheme", m_priorityScheme); + m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", m_priorityScheme); #endregion Interest Management StatsReporter = new SimStatsReporter(this); StatsReporter.OnSendStatsResult += SendSimStatsPackets; - StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; + StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; } /// -- cgit v1.1 From 5884d080623fddb3ee50b8215d896bdee3fa31a4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 7 Mar 2012 00:58:01 +0000 Subject: Fix merge issue --- OpenSim/Region/Framework/Scenes/Scene.cs | 155 ++++++++++++++++--------------- 1 file changed, 79 insertions(+), 76 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index fc72946..d016887 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -653,99 +653,102 @@ namespace OpenSim.Region.Framework.Scenes // Region config overrides global config // - if (m_config.Configs["Startup"] != null) + try { - IConfig startupConfig = m_config.Configs["Startup"]; + if (m_config.Configs["Startup"] != null) + { + IConfig startupConfig = m_config.Configs["Startup"]; - m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); - m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); - if (!m_useBackup) - m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); - - //Animation states - m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); + m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); + m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); + if (!m_useBackup) + m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); + + //Animation states + m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); - PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); - CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); + PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); + CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); - m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); - if (RegionInfo.NonphysPrimMax > 0) - { - m_maxNonphys = RegionInfo.NonphysPrimMax; - } + m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); + if (RegionInfo.NonphysPrimMax > 0) + { + m_maxNonphys = RegionInfo.NonphysPrimMax; + } - m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); + m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); - if (RegionInfo.PhysPrimMax > 0) - { - m_maxPhys = RegionInfo.PhysPrimMax; - } + if (RegionInfo.PhysPrimMax > 0) + { + m_maxPhys = RegionInfo.PhysPrimMax; + } - // Here, if clamping is requested in either global or - // local config, it will be used - // - m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); - if (RegionInfo.ClampPrimSize) - { - m_clampPrimSize = true; - } + // Here, if clamping is requested in either global or + // local config, it will be used + // + m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); + if (RegionInfo.ClampPrimSize) + { + m_clampPrimSize = true; + } - m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); - m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); - m_dontPersistBefore = - startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); - m_dontPersistBefore *= 10000000; - m_persistAfter = - startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); - m_persistAfter *= 10000000; + m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); + m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); + m_dontPersistBefore = + startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); + m_dontPersistBefore *= 10000000; + m_persistAfter = + startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); + m_persistAfter *= 10000000; - m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); - m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); + m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); + m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); - IConfig packetConfig = m_config.Configs["PacketPool"]; - if (packetConfig != null) - { - PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); - PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); - } + IConfig packetConfig = m_config.Configs["PacketPool"]; + if (packetConfig != null) + { + PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); + PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); + } - m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); - m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); - CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); + m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); + m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); + CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); - m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); - if (m_generateMaptiles) - { - int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); - if (maptileRefresh != 0) + m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); + if (m_generateMaptiles) { - m_mapGenerationTimer.Interval = maptileRefresh * 1000; - m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; - m_mapGenerationTimer.AutoReset = true; - m_mapGenerationTimer.Start(); + int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); + if (maptileRefresh != 0) + { + m_mapGenerationTimer.Interval = maptileRefresh * 1000; + m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; + m_mapGenerationTimer.AutoReset = true; + m_mapGenerationTimer.Start(); + } } - } - else - { - string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); - UUID tileID; - - if (UUID.TryParse(tile, out tileID)) + else { - RegionInfo.RegionSettings.TerrainImageID = tileID; + string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); + UUID tileID; + + if (UUID.TryParse(tile, out tileID)) + { + RegionInfo.RegionSettings.TerrainImageID = tileID; + } } - } - MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); - m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); - m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); - m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); - m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); - m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); - m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); - m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); - m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); - m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); + MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); + m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); + m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); + m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); + m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); + m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); + m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); + m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); + m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); + m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); + } } catch (Exception e) { -- cgit v1.1 From 776936268705940bfb13d10d6b6824ef20eb99cb Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 7 Mar 2012 01:03:26 +0000 Subject: Always zero the PhysActor on dupes to prevent side effects on the orignal prim --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 65905a0..439b718 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1546,10 +1546,7 @@ namespace OpenSim.Region.Framework.Scenes if (userExposed) dupe.UUID = UUID.Random(); - //memberwiseclone means it also clones the physics actor reference - // This will make physical prim 'bounce' if not set to null. - if (!userExposed) - dupe.PhysActor = null; + dupe.PhysActor = null; dupe.OwnerID = AgentID; dupe.GroupID = GroupID; -- cgit v1.1 From 749c3fef8ad2d3af97fcd9ab9c72740675e46715 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 8 Mar 2012 01:51:37 +0000 Subject: Change "help" to display categories/module list then "help " to display commands in a category. This is to deal with the hundred lines of command splurge when one previously typed "help" Modelled somewhat on the mysql console One can still type help to get per command help at any point. Categories capitalized to avoid conflict with the all-lowercase commands (except for commander system, as of yet). Does not affect command parsing or any other aspects of the console apart from the help system. Backwards compatible with existing modules. --- OpenSim/Region/Application/OpenSim.cs | 87 +++++++++------------- OpenSim/Region/Application/OpenSimBase.cs | 12 +-- .../Linden/Caps/EventQueue/EventQueueGetModule.cs | 2 +- .../Region/CoreModules/Asset/FlotsamAssetCache.cs | 8 +- .../CoreModules/Avatar/Dialog/DialogModule.cs | 4 +- .../Inventory/Archiver/InventoryArchiverModule.cs | 4 +- .../Framework/Caps/CapabilitiesModule.cs | 5 +- .../Framework/Monitoring/MonitorModule.cs | 2 +- .../UserManagement/UserManagementModule.cs | 2 +- .../Grid/LocalGridServiceConnector.cs | 2 +- .../CoreModules/World/Access/AccessModule.cs | 6 +- .../World/Estate/EstateManagementCommands.cs | 4 +- .../World/Objects/Commands/ObjectCommandsModule.cs | 18 ++--- .../World/Permissions/PermissionsModule.cs | 6 +- .../CoreModules/World/Region/RestartModule.cs | 6 +- OpenSim/Region/CoreModules/World/Sun/SunModule.cs | 9 ++- .../Region/CoreModules/World/Wind/WindModule.cs | 19 +++-- .../CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneBase.cs | 71 ++++++++++++++++-- .../Agent/TextureSender/J2KDecoderCommandModule.cs | 2 +- .../Agent/UDP/Linden/LindenUDPInfoModule.cs | 14 ++-- .../OptionalModules/Asset/AssetInfoModule.cs | 4 +- .../Avatar/Appearance/AppearanceInfoModule.cs | 10 +-- .../PhysicsParameters/PhysicsParameters.cs | 24 +++--- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 14 ++-- 26 files changed, 196 insertions(+), 143 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 145875b..a46ce7f 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -225,12 +225,12 @@ namespace OpenSim /// private void RegisterConsoleCommands() { - m_console.Commands.AddCommand("region", false, "force update", + m_console.Commands.AddCommand("Regions", false, "force update", "force update", "Force the update of all objects on clients", HandleForceUpdate); - m_console.Commands.AddCommand("region", false, "debug packet", + m_console.Commands.AddCommand("Comms", false, "debug packet", "debug packet [ ]", "Turn on packet debugging", "If level > 255 then all incoming and outgoing packets are logged.\n" @@ -242,7 +242,7 @@ namespace OpenSim + "If an avatar name is given then only packets from that avatar are logged", Debug); - m_console.Commands.AddCommand("region", false, "debug http", + m_console.Commands.AddCommand("Comms", false, "debug http", "debug http ", "Turn on inbound http request debugging for everything except the event queue (see debug eq).", "If level >= 2 then the handler used to service the request is logged.\n" @@ -250,37 +250,37 @@ namespace OpenSim + "If level <= 0 then no extra http logging is done.\n", Debug); - m_console.Commands.AddCommand("region", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug); + m_console.Commands.AddCommand("Comms", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug); - m_console.Commands.AddCommand("region", false, "debug scene", + m_console.Commands.AddCommand("Regions", false, "debug scene", "debug scene ", "Turn on scene debugging", Debug); - m_console.Commands.AddCommand("region", false, "change region", + m_console.Commands.AddCommand("Regions", false, "change region", "change region ", "Change current console region", ChangeSelectedRegion); - m_console.Commands.AddCommand("region", false, "save xml", + m_console.Commands.AddCommand("Archiving", false, "save xml", "save xml", "Save a region's data in XML format", SaveXml); - m_console.Commands.AddCommand("region", false, "save xml2", + m_console.Commands.AddCommand("Archiving", false, "save xml2", "save xml2", "Save a region's data in XML2 format", SaveXml2); - m_console.Commands.AddCommand("region", false, "load xml", + m_console.Commands.AddCommand("Archiving", false, "load xml", "load xml [-newIDs [ ]]", "Load a region's data from XML format", LoadXml); - m_console.Commands.AddCommand("region", false, "load xml2", + m_console.Commands.AddCommand("Archiving", false, "load xml2", "load xml2", "Load a region's data from XML2 format", LoadXml2); - m_console.Commands.AddCommand("region", false, "save prims xml2", + m_console.Commands.AddCommand("Archiving", false, "save prims xml2", "save prims xml2 [ ]", "Save named prim to XML2", SavePrimsXml2); - m_console.Commands.AddCommand("region", false, "load oar", + m_console.Commands.AddCommand("Archiving", false, "load oar", "load oar [--merge] [--skip-assets] []", "Load a region's data from an OAR archive.", "--merge will merge the OAR with the existing scene." + Environment.NewLine @@ -289,7 +289,7 @@ namespace OpenSim + " If this is not given then the command looks for an OAR named region.oar in the current directory.", LoadOar); - m_console.Commands.AddCommand("region", false, "save oar", + m_console.Commands.AddCommand("Archiving", false, "save oar", //"save oar [-v|--version=] [-p|--profile=] []", "save oar [-h|--home=] [--noassets] [--publish] [--perm=] []", "Save a region's data to an OAR archive.", @@ -306,54 +306,54 @@ namespace OpenSim + " If this is not given then the oar is saved to region.oar in the current directory.", SaveOar); - m_console.Commands.AddCommand("region", false, "edit scale", + m_console.Commands.AddCommand("Regions", false, "edit scale", "edit scale ", "Change the scale of a named prim", HandleEditScale); - m_console.Commands.AddCommand("region", false, "kick user", + m_console.Commands.AddCommand("Users", false, "kick user", "kick user [message]", "Kick a user off the simulator", KickUserCommand); - m_console.Commands.AddCommand("region", false, "show users", + m_console.Commands.AddCommand("Users", false, "show users", "show users [full]", "Show user data for users currently on the region", "Without the 'full' option, only users actually on the region are shown." + " With the 'full' option child agents of users in neighbouring regions are also shown.", HandleShow); - m_console.Commands.AddCommand("region", false, "show connections", + m_console.Commands.AddCommand("Comms", false, "show connections", "show connections", "Show connection data", HandleShow); - m_console.Commands.AddCommand("region", false, "show circuits", + m_console.Commands.AddCommand("Comms", false, "show circuits", "show circuits", "Show agent circuit data", HandleShow); - m_console.Commands.AddCommand("region", false, "show http-handlers", + m_console.Commands.AddCommand("Comms", false, "show http-handlers", "show http-handlers", "Show all registered http handlers", HandleShow); - m_console.Commands.AddCommand("region", false, "show pending-objects", + m_console.Commands.AddCommand("Comms", false, "show pending-objects", "show pending-objects", "Show # of objects on the pending queues of all scene viewers", HandleShow); - m_console.Commands.AddCommand("region", false, "show modules", + m_console.Commands.AddCommand("General", false, "show modules", "show modules", "Show module data", HandleShow); - m_console.Commands.AddCommand("region", false, "show regions", + m_console.Commands.AddCommand("Regions", false, "show regions", "show regions", "Show region data", HandleShow); - m_console.Commands.AddCommand("region", false, "show ratings", + m_console.Commands.AddCommand("Regions", false, "show ratings", "show ratings", "Show rating data", HandleShow); - m_console.Commands.AddCommand("region", false, "backup", + m_console.Commands.AddCommand("Regions", false, "backup", "backup", "Persist currently unsaved object changes immediately instead of waiting for the normal persistence call.", RunCommand); - m_console.Commands.AddCommand("region", false, "create region", + m_console.Commands.AddCommand("Regions", false, "create region", "create region [\"region name\"] ", "Create a new region.", "The settings for \"region name\" are read from . Paths specified with are relative to your Regions directory, unless an absolute path is given." @@ -362,62 +362,57 @@ namespace OpenSim + "If does not exist, it will be created.", HandleCreateRegion); - m_console.Commands.AddCommand("region", false, "restart", + m_console.Commands.AddCommand("Regions", false, "restart", "restart", "Restart all sims in this instance", RunCommand); - m_console.Commands.AddCommand("region", false, "config set", + m_console.Commands.AddCommand("General", false, "config set", "config set
", "Set a config option. In most cases this is not useful since changed parameters are not dynamically reloaded. Neither do changed parameters persist - you will have to change a config file manually and restart.", HandleConfig); - m_console.Commands.AddCommand("region", false, "config get", + m_console.Commands.AddCommand("General", false, "config get", "config get [
] []", "Synonym for config show", HandleConfig); - m_console.Commands.AddCommand("region", false, "config show", + m_console.Commands.AddCommand("General", false, "config show", "config show [
] []", "Show config information", "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine + "If a section is given but not a field, then all fields in that section are printed.", HandleConfig); - m_console.Commands.AddCommand("region", false, "config save", + m_console.Commands.AddCommand("General", false, "config save", "config save ", "Save current configuration to a file at the given path", HandleConfig); - m_console.Commands.AddCommand("region", false, "command-script", + m_console.Commands.AddCommand("General", false, "command-script", "command-script