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/Framework/Scenes') 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/Framework/Scenes') 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 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/Framework/Scenes') 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/Framework/Scenes') 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 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/Framework/Scenes') 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/Framework/Scenes') 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 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/Framework/Scenes') 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/Framework/Scenes/Scene.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneBase.cs | 71 +++++++++++++++++++++++++--- 2 files changed, 65 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 11e5ce3..ecadd24 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -596,7 +596,7 @@ namespace OpenSim.Region.Framework.Scenes #endregion Region Settings - MainConsole.Instance.Commands.AddCommand("region", false, "reload estate", + MainConsole.Instance.Commands.AddCommand("estate", false, "reload estate", "reload estate", "Reload the estate data", HandleReloadEstate); diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 712e094..495cede 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -472,6 +472,63 @@ namespace OpenSim.Region.Framework.Scenes /// /// Call this from a region module to add a command to the OpenSim console. /// + /// + /// The use of IRegionModuleBase is a cheap trick to get a different method signature, + /// though all new modules should be using interfaces descended from IRegionModuleBase anyway. + /// + /// + /// Category of the command. This is the section under which it will appear when the user asks for help + /// + /// + /// + /// + /// + public void AddCommand( + string category, object mod, string command, string shorthelp, string longhelp, CommandDelegate callback) + { + AddCommand(category, mod, command, shorthelp, longhelp, string.Empty, callback); + } + + /// + /// Call this from a region module to add a command to the OpenSim console. + /// + /// + /// + /// + /// + /// + /// + public void AddCommand(object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) + { + string moduleName = ""; + + if (mod != null) + { + if (mod is IRegionModule) + { + IRegionModule module = (IRegionModule)mod; + moduleName = module.Name; + } + else if (mod is IRegionModuleBase) + { + IRegionModuleBase module = (IRegionModuleBase)mod; + moduleName = module.Name; + } + else + { + throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); + } + } + + AddCommand(moduleName, mod, command, shorthelp, longhelp, descriptivehelp, callback); + } + + /// + /// Call this from a region module to add a command to the OpenSim console. + /// + /// + /// Category of the command. This is the section under which it will appear when the user asks for help + /// /// /// /// @@ -479,12 +536,12 @@ namespace OpenSim.Region.Framework.Scenes /// /// public void AddCommand( - object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) + string category, object mod, string command, + string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) { if (MainConsole.Instance == null) return; - string modulename = String.Empty; bool shared = false; if (mod != null) @@ -492,20 +549,20 @@ namespace OpenSim.Region.Framework.Scenes if (mod is IRegionModule) { IRegionModule module = (IRegionModule)mod; - modulename = module.Name; shared = module.IsSharedModule; } else if (mod is IRegionModuleBase) { - IRegionModuleBase module = (IRegionModuleBase)mod; - modulename = module.Name; shared = mod is ISharedRegionModule; } - else throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); + else + { + throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); + } } MainConsole.Instance.Commands.AddCommand( - modulename, shared, command, shorthelp, longhelp, descriptivehelp, callback); + category, shared, command, shorthelp, longhelp, descriptivehelp, callback); } public virtual ISceneObject DeserializeObject(string representation) -- cgit v1.1 From 650d761c06149b59148e57e90cb47dcfa8d65f6a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 8 Mar 2012 02:17:45 +0000 Subject: Display help commander topics in capitalized form - the commands themselves are still lowercase. Also convert the estate commands to simply AddCommand() calls so that commands from two different modules can be placed in the same category --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ecadd24..9e59d50 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -596,7 +596,7 @@ namespace OpenSim.Region.Framework.Scenes #endregion Region Settings - MainConsole.Instance.Commands.AddCommand("estate", false, "reload estate", + MainConsole.Instance.Commands.AddCommand("Estates", false, "reload estate", "reload estate", "Reload the estate data", HandleReloadEstate); -- cgit v1.1 From 675d40357c2ba0bf2d268cc35874dabe7dbb724d Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 8 Mar 2012 18:31:58 +0100 Subject: Hold a ref to the prim we're sat on rather than querying scene each time the check for significant is carried out. Prevents a deadlock condition. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 56 ++++++++++++------------ 1 file changed, 29 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index ec6bb89..9d5cdfa 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -457,15 +457,8 @@ namespace OpenSim.Region.Framework.Scenes // without the parent rotation applied. if (ParentID != 0) { - SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID); - if (part != null) - { - return part.AbsolutePosition + (m_pos * part.GetWorldRotation()); - } - else - { - return ParentPosition + m_pos; - } + SceneObjectPart part = ParentPart; + return part.AbsolutePosition + (m_pos * part.GetWorldRotation()); } } return m_pos; @@ -576,6 +569,13 @@ namespace OpenSim.Region.Framework.Scenes } private uint m_parentID; + public SceneObjectPart ParentPart + { + get { return m_parentPart; } + set { m_parentPart = value; } + } + private SceneObjectPart m_parentPart = null; + public float Health { get { return m_health; } @@ -1751,36 +1751,34 @@ namespace OpenSim.Region.Framework.Scenes if (ParentID != 0) { - SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID); - if (part != null) + SceneObjectPart part = ParentPart; + TaskInventoryDictionary taskIDict = part.TaskInventory; + if (taskIDict != null) { - TaskInventoryDictionary taskIDict = part.TaskInventory; - if (taskIDict != null) + lock (taskIDict) { - lock (taskIDict) + foreach (UUID taskID in taskIDict.Keys) { - foreach (UUID taskID in taskIDict.Keys) - { - UnRegisterControlEventsToScript(LocalId, taskID); - taskIDict[taskID].PermsMask &= ~( - 2048 | //PERMISSION_CONTROL_CAMERA - 4); // PERMISSION_TAKE_CONTROLS - } + UnRegisterControlEventsToScript(LocalId, taskID); + taskIDict[taskID].PermsMask &= ~( + 2048 | //PERMISSION_CONTROL_CAMERA + 4); // PERMISSION_TAKE_CONTROLS } } + } - // Reset sit target. - if (part.SitTargetAvatar == UUID) - part.SitTargetAvatar = UUID.Zero; + // Reset sit target. + if (part.SitTargetAvatar == UUID) + part.SitTargetAvatar = UUID.Zero; - ParentPosition = part.GetWorldPosition(); - ControllingClient.SendClearFollowCamProperties(part.ParentUUID); - } + ParentPosition = part.GetWorldPosition(); + ControllingClient.SendClearFollowCamProperties(part.ParentUUID); m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); ParentPosition = Vector3.Zero; ParentID = 0; + ParentPart = null; SendAvatarDataToAllAgents(); m_requestedSitTargetID = 0; @@ -2212,6 +2210,10 @@ namespace OpenSim.Region.Framework.Scenes return; } + ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); + if (ParentPart == null) + return; + ParentID = m_requestedSitTargetID; Velocity = Vector3.Zero; -- cgit v1.1 From 73c47f720583da40496d5c8fe94f35ed0aec640f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 9 Mar 2012 02:22:22 +0000 Subject: Remove a race condition from SP.Set_AbsolutePosition where we assume the ParentPart is still not null if the ParentID != 0 Another thread could come in and stand the avatar between those two instructions. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9d5cdfa..be56fe1 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -455,12 +455,12 @@ namespace OpenSim.Region.Framework.Scenes // in the sim unless the avatar is on a sit target. While // on a sit target, m_pos will contain the desired offset // without the parent rotation applied. - if (ParentID != 0) - { - SceneObjectPart part = ParentPart; - return part.AbsolutePosition + (m_pos * part.GetWorldRotation()); - } + SceneObjectPart sitPart = ParentPart; + + if (sitPart != null) + return sitPart.AbsolutePosition + (m_pos * sitPart.GetWorldRotation()); } + return m_pos; } set -- cgit v1.1 From b454326273a03420addf4d73d308f0ca773558ad Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 9 Mar 2012 02:33:48 +0000 Subject: refactor: cleanup SP.HandleAgentSit so that everything is done within one if (part != null), rather than having unnecessary multiple checks --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index be56fe1..c9dc7fd 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2204,23 +2204,16 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target", // Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); } - } - else - { - return; - } - - ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); - if (ParentPart == null) - return; - ParentID = m_requestedSitTargetID; + ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); + ParentID = m_requestedSitTargetID; - Velocity = Vector3.Zero; - RemoveFromPhysicalScene(); - - Animator.TrySetMovementAnimation(sitAnimation); - SendAvatarDataToAllAgents(); + Velocity = Vector3.Zero; + RemoveFromPhysicalScene(); + + Animator.TrySetMovementAnimation(sitAnimation); + SendAvatarDataToAllAgents(); + } } public void HandleAgentSitOnGround() -- cgit v1.1 From 94e58ff6b9368975925cea4697077a8e59162bc0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 9 Mar 2012 02:38:11 +0000 Subject: Use SP.ParentPart instead of ParentID in places where it's more efficient (saving extra null checks, etc.) However, it looks like we should retain SP.ParentID since it's much easier to use that in places where another thread could change ParentPart to null. Otherwise one has to clumsily put ParentPart in a reference, etc. to avoid a race. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 24 +++++----------------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 26 ++++++++++++------------ 2 files changed, 18 insertions(+), 32 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 66fb493..dd0ca43 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -215,27 +215,13 @@ namespace OpenSim.Region.Framework.Scenes if (sp.IsChildAgent) continue; - if (sp.ParentID != 0) - { - // sitting avatar - SceneObjectPart sop = m_parentScene.GetSceneObjectPart(sp.ParentID); - if (sop != null) - { - coarseLocations.Add(sop.AbsolutePosition + sp.OffsetPosition); - avatarUUIDs.Add(sp.UUID); - } - else - { - // we can't find the parent.. ! arg! - coarseLocations.Add(sp.AbsolutePosition); - avatarUUIDs.Add(sp.UUID); - } - } + SceneObjectPart sitPart = sp.ParentPart; + if (sitPart != null) + coarseLocations.Add(sitPart.AbsolutePosition + sp.OffsetPosition); else - { coarseLocations.Add(sp.AbsolutePosition); - avatarUUIDs.Add(sp.UUID); - } + + avatarUUIDs.Add(sp.UUID); } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c9dc7fd..aab0bf0 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -432,7 +432,7 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (PhysicsActor != null && m_parentID == 0) + if (PhysicsActor != null && ParentID == 0) { m_pos = PhysicsActor.Position; @@ -504,6 +504,7 @@ namespace OpenSim.Region.Framework.Scenes // There is no offset position when not seated if (ParentID == 0) return; + m_pos = value; } } @@ -562,19 +563,18 @@ namespace OpenSim.Region.Framework.Scenes public bool IsChildAgent { get; set; } - public uint ParentID - { - get { return m_parentID; } - set { m_parentID = value; } - } - private uint m_parentID; + /// + /// If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero. + /// + public uint ParentID { get; set; } - public SceneObjectPart ParentPart - { - get { return m_parentPart; } - set { m_parentPart = value; } - } - private SceneObjectPart m_parentPart = null; + /// + /// If the avatar is sitting, the prim that it's sitting on. If not sitting then null. + /// + /// + /// If you use this property then you must take a reference since another thread could set it to null. + /// + public SceneObjectPart ParentPart { get; set; } public float Health { -- cgit v1.1 From 205c36d3a4bb6fe0aca5027e8e7e36fc57c6de1c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 9 Mar 2012 02:44:08 +0000 Subject: Get rid of unnecessary ParentID == 0 check on SP.Get_AbsolutePosition since this is handled by the necessary ParentPart check --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index aab0bf0..b84660a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -432,7 +432,7 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (PhysicsActor != null && ParentID == 0) + if (PhysicsActor != null) { m_pos = PhysicsActor.Position; @@ -477,7 +477,7 @@ namespace OpenSim.Region.Framework.Scenes } } - // Don't update while sitting + // Don't update while sitting. The PhysicsActor above is null whilst sitting. if (ParentID == 0) { m_pos = value; -- cgit v1.1 From 06dda14505743bde237362b0e469d16548922f33 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 9 Mar 2012 02:50:57 +0000 Subject: Simplify minimap coarse location code by just reference SP.AbsolutePosition This is rather than checking whether the avatar is sitting and doing its own calculation. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index dd0ca43..bc3400a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -215,11 +215,7 @@ namespace OpenSim.Region.Framework.Scenes if (sp.IsChildAgent) continue; - SceneObjectPart sitPart = sp.ParentPart; - if (sitPart != null) - coarseLocations.Add(sitPart.AbsolutePosition + sp.OffsetPosition); - else - coarseLocations.Add(sp.AbsolutePosition); + coarseLocations.Add(sp.AbsolutePosition); avatarUUIDs.Add(sp.UUID); } -- cgit v1.1 From 81869c4a3fbb3bfbc2a767e381a0820165b461b2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 9 Mar 2012 09:48:12 -0800 Subject: More on HG inventory transfers. Move the FireAndForget higher up. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 23f39a8..6ae4adc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -633,7 +633,7 @@ namespace OpenSim.Region.Framework.Scenes { IInventoryAccessModule invAccess = RequestModuleInterface(); if (invAccess != null) - invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); + Util.FireAndForget(delegate { invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); }); } if (!Permissions.BypassPermissions()) -- cgit v1.1 From 2f81e53f63012f0ed1623dc6159da01a3807fbf6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 15 Mar 2012 00:20:47 +0000 Subject: Fix a problem where multiple near simultaneous calls to llDie() from multiple scripts in the same linkset can cause unnecessary thread aborts. The first llDie() could lock Scene.m_deleting_scene_object. The second llDie() would then wait at this lock. The first llDie() would go on to remove the second script but always abort it since the second script's WorkItem would not go away. Easiest solution here is to remove the m_deleting_scene_object since it's no longer justified - we no longer lock m_parts but take a copy instead. This also requires an adjustment in XEngine.OnRemoveScript not to use instance.ObjectID instead when firing the OnObjectRemoved event. --- OpenSim/Region/Framework/Scenes/Scene.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9e59d50..3a066d4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -219,8 +219,6 @@ namespace OpenSim.Region.Framework.Scenes private int m_lastUpdate; private bool m_firstHeartbeat = true; - - private object m_deleting_scene_object = new object(); private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; private bool m_reprioritizationEnabled = true; @@ -1994,15 +1992,8 @@ namespace OpenSim.Region.Framework.Scenes public void DeleteSceneObject(SceneObjectGroup group, bool silent) { // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); - - //SceneObjectPart rootPart = group.GetChildPart(group.UUID); - // Serialise calls to RemoveScriptInstances to avoid - // deadlocking on m_parts inside SceneObjectGroup - lock (m_deleting_scene_object) - { - group.RemoveScriptInstances(true); - } + group.RemoveScriptInstances(true); SceneObjectPart[] partList = group.Parts; -- cgit v1.1 From a4b01ef38a735ffe70b402061871a9c99f2757ed Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 16 Mar 2012 00:34:30 +0000 Subject: Replace script-lines-per-second with the script execution time scaled by its measurement period and an idealised frame time. The previous lines-per-second measurement used for top scripts report was inaccurate, since lines executed does not reflect time taken to execute. Also, every fetch of the report would reset all the numbers limiting its usefulness and we weren't even guaranteed to see the top 100. The actual measurement value should be script execution time per frame but XEngine does not work this way. Therefore, we use actual script execution time scaled by the measurement period and an idealised frame time. This is still not ideal but gives reasonable results and allows scripts to be compared. This commit moves script execution time calculations from SceneGraph into IScriptModule implementations. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 31 +--------------------- .../Region/Framework/Scenes/SceneObjectGroup.cs | 9 +------ 2 files changed, 2 insertions(+), 38 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index bc3400a..5c542d6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -733,6 +733,7 @@ namespace OpenSim.Region.Framework.Scenes #endregion #region Get Methods + /// /// Get the controlling client for the given avatar, if there is one. /// @@ -1074,36 +1075,6 @@ namespace OpenSim.Region.Framework.Scenes return Entities.GetEntities(); } - public Dictionary GetTopScripts() - { - Dictionary topScripts = new Dictionary(); - - EntityBase[] EntityList = GetEntities(); - int limit = 0; - foreach (EntityBase ent in EntityList) - { - if (ent is SceneObjectGroup) - { - SceneObjectGroup grp = (SceneObjectGroup)ent; - if ((grp.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) - { - if (grp.scriptScore >= 0.01) - { - topScripts.Add(grp.LocalId, grp.scriptScore); - limit++; - if (limit >= 100) - { - break; - } - } - grp.scriptScore = 0; - } - } - } - - return topScripts; - } - #endregion #region Other Methods diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 878476e..afb5ccf 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -229,8 +229,6 @@ namespace OpenSim.Region.Framework.Scenes get { return RootPart.VolumeDetectActive; } } - public float scriptScore; - private Vector3 lastPhysGroupPos; private Quaternion lastPhysGroupRot; @@ -1184,12 +1182,7 @@ namespace OpenSim.Region.Framework.Scenes public void AddScriptLPS(int count) { - if (scriptScore + count >= float.MaxValue - count) - scriptScore = 0; - - scriptScore += (float)count; - SceneGraph d = m_scene.SceneGraph; - d.AddToScriptLPS(count); + m_scene.SceneGraph.AddToScriptLPS(count); } public void AddActiveScriptCount(int count) -- cgit v1.1 From a2009ffe2e71afefad79471811418df8958870ab Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 16 Mar 2012 13:08:05 -0700 Subject: Terrain: added [Terrain] section with an option to load an initial flat terrain. Default is still pinhead island. I much rather have a flat land in the beginning. --- OpenSim/Region/Framework/Scenes/Scene.cs | 11 ++++- OpenSim/Region/Framework/Scenes/TerrainChannel.cs | 60 +++++++++++++++++------ 2 files changed, 53 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 3a066d4..5b1b165 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1576,8 +1576,15 @@ namespace OpenSim.Region.Framework.Scenes double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID); if (map == null) { - m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain."); - Heightmap = new TerrainChannel(); + // This should be in the Terrain module, but it isn't because + // the heightmap is needed _way_ before the modules are initialized... + IConfig terrainConfig = m_config.Configs["Terrain"]; + String m_InitialTerrain = "pinhead-island"; + if (terrainConfig != null) + m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain); + + m_log.InfoFormat("[TERRAIN]: No default terrain. Generating a new terrain {0}.", m_InitialTerrain); + Heightmap = new TerrainChannel(m_InitialTerrain); SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); } diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs index ca6210d..c0ca48e 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs @@ -46,23 +46,20 @@ namespace OpenSim.Region.Framework.Scenes public TerrainChannel() { map = new double[Constants.RegionSize, Constants.RegionSize]; - taint = new bool[Constants.RegionSize / 16,Constants.RegionSize / 16]; + taint = new bool[Constants.RegionSize / 16, Constants.RegionSize / 16]; - int x; - for (x = 0; x < Constants.RegionSize; x++) - { - int y; - for (y = 0; y < Constants.RegionSize; y++) - { - map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10; - double spherFacA = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 50) * 0.01; - double spherFacB = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 100) * 0.001; - if (map[x, y] < spherFacA) - map[x, y] = spherFacA; - if (map[x, y] < spherFacB) - map[x, y] = spherFacB; - } - } + PinHeadIsland(); + } + + public TerrainChannel(String type) + { + map = new double[Constants.RegionSize, Constants.RegionSize]; + taint = new bool[Constants.RegionSize / 16, Constants.RegionSize / 16]; + + if (type.Equals("flat")) + FlatLand(); + else + PinHeadIsland(); } public TerrainChannel(double[,] import) @@ -238,5 +235,36 @@ namespace OpenSim.Region.Framework.Scenes } } } + + private void PinHeadIsland() + { + int x; + for (x = 0; x < Constants.RegionSize; x++) + { + int y; + for (y = 0; y < Constants.RegionSize; y++) + { + map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10; + double spherFacA = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 50) * 0.01; + double spherFacB = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 100) * 0.001; + if (map[x, y] < spherFacA) + map[x, y] = spherFacA; + if (map[x, y] < spherFacB) + map[x, y] = spherFacB; + } + } + } + + private void FlatLand() + { + int x; + for (x = 0; x < Constants.RegionSize; x++) + { + int y; + for (y = 0; y < Constants.RegionSize; y++) + map[x, y] = 21; + } + } + } } -- cgit v1.1 From 33c14cb107ecb67a3e971d6adaab17d173d52747 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 17 Mar 2012 10:00:11 -0700 Subject: Region access control! Region operators can now specify things like DisallowForeigners (means what it says) and DisallowResidents (means that only admins and managers can get into the region). This puts the never-completed AuthorizationService to good use. Note that I didn't implement a grid-wide Authorization service; this service implementation is done entirely locally on the simulator. This can be changed as usual by pluging in a different AuthorizationServicesConnector. --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5b1b165..0042f7b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3533,8 +3533,8 @@ namespace OpenSim.Region.Framework.Scenes if (!AuthorizationService.IsAuthorizedForRegion( agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) { - m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", - agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); + m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because {4}", + agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason); return false; } -- cgit v1.1 From 1a4fdd26663fc6cfdcc76adb86d9babbd657a55d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 17 Mar 2012 10:48:22 -0700 Subject: Moved HandleAvatarPickerRequest from the generic Scene.PacketHandlers to the UserManagementModule where it belongs. No functional changes. --- .../Framework/Scenes/Scene.PacketHandlers.cs | 53 ---------------------- OpenSim/Region/Framework/Scenes/Scene.cs | 2 - 2 files changed, 55 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 3355ebe..87ffc74 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -339,59 +339,6 @@ namespace OpenSim.Region.Framework.Scenes EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg); } - public void ProcessAvatarPickerRequest(IClientAPI client, UUID avatarID, UUID RequestID, string query) - { - //EventManager.TriggerAvatarPickerRequest(); - - List accounts = UserAccountService.GetUserAccounts(RegionInfo.ScopeID, query); - - if (accounts == null) - return; - - AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply); - // TODO: don't create new blocks if recycling an old packet - - AvatarPickerReplyPacket.DataBlock[] searchData = - new AvatarPickerReplyPacket.DataBlock[accounts.Count]; - AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock(); - - agentData.AgentID = avatarID; - agentData.QueryID = RequestID; - replyPacket.AgentData = agentData; - //byte[] bytes = new byte[AvatarResponses.Count*32]; - - int i = 0; - foreach (UserAccount item in accounts) - { - UUID translatedIDtem = item.PrincipalID; - searchData[i] = new AvatarPickerReplyPacket.DataBlock(); - searchData[i].AvatarID = translatedIDtem; - searchData[i].FirstName = Utils.StringToBytes((string) item.FirstName); - searchData[i].LastName = Utils.StringToBytes((string) item.LastName); - i++; - } - if (accounts.Count == 0) - { - searchData = new AvatarPickerReplyPacket.DataBlock[0]; - } - replyPacket.Data = searchData; - - AvatarPickerReplyAgentDataArgs agent_data = new AvatarPickerReplyAgentDataArgs(); - agent_data.AgentID = replyPacket.AgentData.AgentID; - agent_data.QueryID = replyPacket.AgentData.QueryID; - - List data_args = new List(); - for (i = 0; i < replyPacket.Data.Length; i++) - { - AvatarPickerReplyDataArgs data_arg = new AvatarPickerReplyDataArgs(); - data_arg.AvatarID = replyPacket.Data[i].AvatarID; - data_arg.FirstName = replyPacket.Data[i].FirstName; - data_arg.LastName = replyPacket.Data[i].LastName; - data_args.Add(data_arg); - } - client.SendAvatarPickerReply(agent_data, data_args); - } - public void ProcessScriptReset(IClientAPI remoteClient, UUID objectID, UUID itemID) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0042f7b..0706905 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2767,7 +2767,6 @@ namespace OpenSim.Region.Framework.Scenes { //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; - client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; client.OnSetStartLocationRequest += SetHomeRezPoint; client.OnRegionHandleRequest += RegionHandleRequest; } @@ -2893,7 +2892,6 @@ namespace OpenSim.Region.Framework.Scenes { //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; - client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; client.OnSetStartLocationRequest -= SetHomeRezPoint; client.OnRegionHandleRequest -= RegionHandleRequest; } -- cgit v1.1 From e9271ec653f4c09d73f7950c3e4b1615c445478f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 19 Mar 2012 22:48:26 +0000 Subject: Add some doc about the EventManager.OnLoginsEnabled event. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 6ff2a6f..1e1fcb7 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -481,6 +481,13 @@ namespace OpenSim.Region.Framework.Scenes public event RegionHeartbeatEnd OnRegionHeartbeatEnd; public delegate void LoginsEnabled(string regionName); + + /// + /// This should only fire in all circumstances if the RegionReady module is active. + /// + /// + /// TODO: Fire this even when the RegionReady module is not active. + /// public event LoginsEnabled OnLoginsEnabled; public delegate void PrimsLoaded(Scene s); -- cgit v1.1 From 8c911ddaf051724af8684bf18559e8e33e0fcfb1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 20 Mar 2012 01:39:19 +0000 Subject: Remove some pointless catching/throwing in the scene loop. --- OpenSim/Region/Framework/Scenes/Scene.cs | 7 ------- 1 file changed, 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0706905..18a7ce8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1184,9 +1184,6 @@ namespace OpenSim.Region.Framework.Scenes m_lastUpdate = Util.EnvironmentTickCount(); m_firstHeartbeat = false; } - catch (ThreadAbortException) - { - } finally { Monitor.Pulse(m_heartbeatLock); @@ -1357,10 +1354,6 @@ namespace OpenSim.Region.Framework.Scenes } } } - catch (NotImplementedException) - { - throw; - } catch (Exception e) { m_log.ErrorFormat( -- cgit v1.1 From a3abd65e3de850a4516b91a017b1049ce4abe4fe Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 20 Mar 2012 01:41:32 +0000 Subject: Remove pointless ThreadAbortException catching in a test that isn't run anyway. --- .../Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index c5a76b2..bebc10c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -63,17 +63,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests Thread testThread = new Thread(testClass.run); - try - { - // Seems kind of redundant to start a thread and then join it, however.. We need to protect against - // A thread abort exception in the simulator code. - testThread.Start(); - testThread.Join(); - } - catch (ThreadAbortException) - { - - } + // Seems kind of redundant to start a thread and then join it, however.. We need to protect against + // A thread abort exception in the simulator code. + testThread.Start(); + testThread.Join(); + Assert.That(testClass.results.Result, Is.EqualTo(true), testClass.results.Message); // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); } -- cgit v1.1 From 9ed3532c1b4fdbf8283e86ba7fb6f2706a5cfb97 Mon Sep 17 00:00:00 2001 From: nebadon Date: Tue, 20 Mar 2012 13:45:38 -0700 Subject: reduce avatar verticle jump from the absurd 5 meter jump to a less absurd 3m vertical jump to better match what you would see in Second Life and be more in line with what users would expect. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b84660a..82f6486 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2293,7 +2293,7 @@ namespace OpenSim.Region.Framework.Scenes { if (direc.Z > 2.0f) { - direc.Z *= 3.0f; + direc.Z *= 2.5f; // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored. Animator.TrySetMovementAnimation("PREJUMP"); -- cgit v1.1 From bd1f848bf6194f15301fb9bcdae095dd3a67d594 Mon Sep 17 00:00:00 2001 From: nebadon Date: Tue, 20 Mar 2012 14:17:15 -0700 Subject: slight increase in jump power to make running jump slightly better. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 82f6486..704d12d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2293,7 +2293,7 @@ namespace OpenSim.Region.Framework.Scenes { if (direc.Z > 2.0f) { - direc.Z *= 2.5f; + direc.Z *= 2.6f; // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored. Animator.TrySetMovementAnimation("PREJUMP"); -- cgit v1.1 From 30b2a8c778d02926e038bc62977c4a4c9dbec5ee Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 20 Mar 2012 23:12:21 +0000 Subject: Move frame loop entirely within Scene.Update() for better future performance analysis and stat accuracy. Update() now accepts a frames parameter which can control the number of frames updated. -1 will update until shutdown. The watchdog updating moves above the maintc recalculation for any required sleep since it should be accounted for within the frame. --- OpenSim/Region/Framework/Scenes/Scene.cs | 337 +++++++++++---------- OpenSim/Region/Framework/Scenes/SceneBase.cs | 8 +- .../Scenes/Tests/ScenePresenceAutopilotTests.cs | 12 +- .../Region/Framework/Scenes/Tests/SceneTests.cs | 2 +- 4 files changed, 191 insertions(+), 168 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 18a7ce8..fe59e4d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1175,11 +1175,11 @@ namespace OpenSim.Region.Framework.Scenes // 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(); + Update(1); Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; while (!shuttingdown) - Update(); + Update(-1); m_lastUpdate = Util.EnvironmentTickCount(); m_firstHeartbeat = false; @@ -1193,184 +1193,205 @@ namespace OpenSim.Region.Framework.Scenes Watchdog.RemoveThread(); } - public override void Update() + public override void Update(int frames) { - float physicsFPS = 0f; - - int maintc = Util.EnvironmentTickCount(); - int tmpFrameMS = maintc; - agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; + long? endFrame = null; - ++Frame; + if (frames >= 0) + endFrame = Frame + frames; -// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); + float physicsFPS = 0f; + int tmpFrameMS, tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS; + int maintc; + List coarseLocations; + List avatarUUIDs; - try + while (!shuttingdown && (endFrame == null || Frame < endFrame)) { - int tmpPhysicsMS2 = Util.EnvironmentTickCount(); - if ((Frame % m_update_physics == 0) && m_physics_enabled) - m_sceneGraph.UpdatePreparePhysics(); - physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2); - - // Apply any pending avatar force input to the avatar's velocity - int tmpAgentMS = Util.EnvironmentTickCount(); - if (Frame % m_update_entitymovement == 0) - m_sceneGraph.UpdateScenePresenceMovement(); - agentMS = Util.EnvironmentTickCountSubtract(tmpAgentMS); - - // Perform the main physics update. This will do the actual work of moving objects and avatars according to their - // velocity - int tmpPhysicsMS = Util.EnvironmentTickCount(); - if (Frame % m_update_physics == 0) - { - if (m_physics_enabled) - physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); + maintc = Util.EnvironmentTickCount(); + ++Frame; - if (SynchronizeScene != null) - SynchronizeScene(this); - } - physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS); - - tmpAgentMS = Util.EnvironmentTickCount(); - - // Check if any objects have reached their targets - CheckAtTargets(); - - // Update SceneObjectGroups that have scheduled themselves for updates - // Objects queue their updates onto all scene presences - if (Frame % m_update_objects == 0) - m_sceneGraph.UpdateObjectGroups(); +// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); - // Run through all ScenePresences looking for updates - // Presence updates and queued object updates for each presence are sent to clients - if (Frame % m_update_presences == 0) - m_sceneGraph.UpdatePresences(); + tmpFrameMS = maintc; + agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; - // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) - if (Frame % m_update_coarse_locations == 0) + try { - List coarseLocations; - List avatarUUIDs; - SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); - // Send coarse locations to clients - ForEachScenePresence(delegate(ScenePresence presence) + tmpPhysicsMS2 = Util.EnvironmentTickCount(); + if ((Frame % m_update_physics == 0) && m_physics_enabled) + m_sceneGraph.UpdatePreparePhysics(); + physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2); + + // Apply any pending avatar force input to the avatar's velocity + tmpAgentMS = Util.EnvironmentTickCount(); + if (Frame % m_update_entitymovement == 0) + m_sceneGraph.UpdateScenePresenceMovement(); + agentMS = Util.EnvironmentTickCountSubtract(tmpAgentMS); + + // Perform the main physics update. This will do the actual work of moving objects and avatars according to their + // velocity + tmpPhysicsMS = Util.EnvironmentTickCount(); + if (Frame % m_update_physics == 0) { - presence.SendCoarseLocations(coarseLocations, avatarUUIDs); - }); - } - - agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS); - - // Delete temp-on-rez stuff - if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) - { - int tmpTempOnRezMS = Util.EnvironmentTickCount(); - m_cleaningTemps = true; - Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); - tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS); - } - - if (Frame % m_update_events == 0) - { - int evMS = Util.EnvironmentTickCount(); - UpdateEvents(); - eventMS = Util.EnvironmentTickCountSubtract(evMS); ; - } - - if (Frame % m_update_backup == 0) - { - int backMS = Util.EnvironmentTickCount(); - UpdateStorageBackup(); - backupMS = Util.EnvironmentTickCountSubtract(backMS); - } - - if (Frame % m_update_terrain == 0) - { - int terMS = Util.EnvironmentTickCount(); - UpdateTerrain(); - terrainMS = Util.EnvironmentTickCountSubtract(terMS); - } - - //if (Frame % m_update_land == 0) - //{ - // int ldMS = Util.EnvironmentTickCount(); - // UpdateLand(); - // landMS = Util.EnvironmentTickCountSubtract(ldMS); - //} - - frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); - otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; - lastCompletedFrame = Util.EnvironmentTickCount(); - - // if (Frame%m_update_avatars == 0) - // UpdateInWorldTime(); - StatsReporter.AddPhysicsFPS(physicsFPS); - StatsReporter.AddTimeDilation(TimeDilation); - StatsReporter.AddFPS(1); - StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); - StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount()); - StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); - StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); - StatsReporter.addFrameMS(frameMS); - StatsReporter.addAgentMS(agentMS); - StatsReporter.addPhysicsMS(physicsMS + physicsMS2); - StatsReporter.addOtherMS(otherMS); - StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); - StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); - - if (LoginsDisabled && Frame == 20) - { -// m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); - - // In 99.9% of cases it is a bad idea to manually force garbage collection. However, - // this is a rare case where we know we have just went through a long cycle of heap - // allocations, and there is no more work to be done until someone logs in - GC.Collect(); + if (m_physics_enabled) + physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); + + if (SynchronizeScene != null) + SynchronizeScene(this); + } + physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS); - IConfig startupConfig = m_config.Configs["Startup"]; - if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false)) + tmpAgentMS = Util.EnvironmentTickCount(); + + // Check if any objects have reached their targets + CheckAtTargets(); + + // Update SceneObjectGroups that have scheduled themselves for updates + // Objects queue their updates onto all scene presences + if (Frame % m_update_objects == 0) + m_sceneGraph.UpdateObjectGroups(); + + // Run through all ScenePresences looking for updates + // Presence updates and queued object updates for each presence are sent to clients + if (Frame % m_update_presences == 0) + m_sceneGraph.UpdatePresences(); + + // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) + if (Frame % m_update_coarse_locations == 0) + { + SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); + // Send coarse locations to clients + ForEachScenePresence(delegate(ScenePresence presence) + { + presence.SendCoarseLocations(coarseLocations, avatarUUIDs); + }); + } + + agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS); + + // Delete temp-on-rez stuff + if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) + { + tmpTempOnRezMS = Util.EnvironmentTickCount(); + m_cleaningTemps = true; + Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); + tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS); + } + + if (Frame % m_update_events == 0) { - // This handles a case of a region having no scripts for the RegionReady module - if (m_sceneGraph.GetActiveScriptsCount() == 0) + evMS = Util.EnvironmentTickCount(); + UpdateEvents(); + eventMS = Util.EnvironmentTickCountSubtract(evMS); + } + + if (Frame % m_update_backup == 0) + { + backMS = Util.EnvironmentTickCount(); + UpdateStorageBackup(); + backupMS = Util.EnvironmentTickCountSubtract(backMS); + } + + if (Frame % m_update_terrain == 0) + { + terMS = Util.EnvironmentTickCount(); + UpdateTerrain(); + terrainMS = Util.EnvironmentTickCountSubtract(terMS); + } + + //if (Frame % m_update_land == 0) + //{ + // int ldMS = Util.EnvironmentTickCount(); + // UpdateLand(); + // landMS = Util.EnvironmentTickCountSubtract(ldMS); + //} + + frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); + otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; + lastCompletedFrame = Util.EnvironmentTickCount(); + + // if (Frame%m_update_avatars == 0) + // UpdateInWorldTime(); + StatsReporter.AddPhysicsFPS(physicsFPS); + StatsReporter.AddTimeDilation(TimeDilation); + StatsReporter.AddFPS(1); + StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); + StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount()); + StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); + StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); + + // frameMS currently records work frame times, not total frame times (work + any required sleep to + // reach min frame time. + StatsReporter.addFrameMS(frameMS); + + StatsReporter.addAgentMS(agentMS); + StatsReporter.addPhysicsMS(physicsMS + physicsMS2); + StatsReporter.addOtherMS(otherMS); + StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); + StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); + + if (LoginsDisabled && Frame == 20) + { + // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); + + // In 99.9% of cases it is a bad idea to manually force garbage collection. However, + // this is a rare case where we know we have just went through a long cycle of heap + // allocations, and there is no more work to be done until someone logs in + GC.Collect(); + + IConfig startupConfig = m_config.Configs["Startup"]; + if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false)) { - // need to be able to tell these have changed in RegionReady - LoginLock = false; - EventManager.TriggerLoginsEnabled(RegionInfo.RegionName); + // This handles a case of a region having no scripts for the RegionReady module + if (m_sceneGraph.GetActiveScriptsCount() == 0) + { + // need to be able to tell these have changed in RegionReady + LoginLock = false; + EventManager.TriggerLoginsEnabled(RegionInfo.RegionName); + } + m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); + + // For RegionReady lockouts + if(LoginLock == false) + { + LoginsDisabled = false; + } + + m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo); } - m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); - - // For RegionReady lockouts - if(LoginLock == false) + else { - LoginsDisabled = false; + StartDisabled = true; + LoginsDisabled = true; } - - m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo); - } - else - { - StartDisabled = true; - LoginsDisabled = true; } } - } - catch (Exception e) - { - m_log.ErrorFormat( - "[SCENE]: Failed on region {0} with exception {1}{2}", - RegionInfo.RegionName, e.Message, e.StackTrace); - } + catch (Exception e) + { + m_log.ErrorFormat( + "[SCENE]: Failed on region {0} with exception {1}{2}", + RegionInfo.RegionName, e.Message, e.StackTrace); + } + + EventManager.TriggerRegionHeartbeatEnd(this); - EventManager.TriggerRegionHeartbeatEnd(this); + // Tell the watchdog that this thread is still alive + Watchdog.UpdateThread(); - maintc = Util.EnvironmentTickCountSubtract(maintc); - maintc = (int)(MinFrameTime * 1000) - maintc; + maintc = Util.EnvironmentTickCountSubtract(maintc); + maintc = (int)(MinFrameTime * 1000) - maintc; - if (maintc > 0) - Thread.Sleep(maintc); + if (maintc > 0) + Thread.Sleep(maintc); - // Tell the watchdog that this thread is still alive - Watchdog.UpdateThread(); +// if (frameMS > (int)(MinFrameTime * 1000)) +// m_log.WarnFormat( +// "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", +// frameMS, +// MinFrameTime * 1000, +// RegionInfo.RegionName); + } } public void AddGroupTarget(SceneObjectGroup grp) diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 495cede..9c6b884 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -149,9 +149,13 @@ namespace OpenSim.Region.Framework.Scenes #region Update Methods /// - /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) + /// Called to update the scene loop by a number of frames and until shutdown. /// - public abstract void Update(); + /// + /// Number of frames to update. Exits on shutdown even if there are frames remaining. + /// If -1 then updates until shutdown. + /// + public abstract void Update(int frames); #endregion diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs index 442cb8b..cfea10d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs @@ -81,7 +81,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // For now, we'll make the scene presence fly to simplify this test, but this needs to change. sp.Flying = true; - m_scene.Update(); + m_scene.Update(1); Assert.That(sp.AbsolutePosition, Is.EqualTo(startPos)); Vector3 targetPos = startPos + new Vector3(0, 10, 0); @@ -91,7 +91,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That( sp.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001)); - m_scene.Update(); + m_scene.Update(1); // We should really check the exact figure. Assert.That(sp.AbsolutePosition.X, Is.EqualTo(startPos.X)); @@ -99,8 +99,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); Assert.That(sp.AbsolutePosition.Z, Is.LessThan(targetPos.X)); - for (int i = 0; i < 10; i++) - m_scene.Update(); + m_scene.Update(10); double distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos); Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on first move"); @@ -116,7 +115,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That( sp.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0, 1), 0.000001)); - m_scene.Update(); + m_scene.Update(1); // We should really check the exact figure. Assert.That(sp.AbsolutePosition.X, Is.GreaterThan(startPos.X)); @@ -124,8 +123,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(sp.AbsolutePosition.Y, Is.EqualTo(startPos.Y)); Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); - for (int i = 0; i < 10; i++) - m_scene.Update(); + m_scene.Update(10); distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos); Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on second move"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index 8b8aea5..5c9a77d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelpers.InMethod(); Scene scene = SceneHelpers.SetupScene(); - scene.Update(); + scene.Update(1); Assert.That(scene.Frame, Is.EqualTo(1)); } -- cgit v1.1 From 3701f893d366643529429851cfac462951655683 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 20 Mar 2012 23:31:57 +0000 Subject: remove unnecessary tmpFrameMS, use maintc instead for frame time calculation --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index fe59e4d..1bea14f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1201,7 +1201,7 @@ namespace OpenSim.Region.Framework.Scenes endFrame = Frame + frames; float physicsFPS = 0f; - int tmpFrameMS, tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS; + int tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS; int maintc; List coarseLocations; List avatarUUIDs; @@ -1213,7 +1213,6 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); - tmpFrameMS = maintc; agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; try @@ -1307,7 +1306,7 @@ namespace OpenSim.Region.Framework.Scenes // landMS = Util.EnvironmentTickCountSubtract(ldMS); //} - frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); + frameMS = Util.EnvironmentTickCountSubtract(maintc); otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; lastCompletedFrame = Util.EnvironmentTickCount(); -- cgit v1.1 From 7bf628ab31028ac2118e43fbb9b9d0a77ea0f55f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Mar 2012 00:02:08 +0000 Subject: Add ability to log warn if a frame takes longer than twice the expected time. Currently commented out. --- OpenSim/Region/Framework/Scenes/Scene.cs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1bea14f..790ec63 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -190,7 +190,11 @@ namespace OpenSim.Region.Framework.Scenes private int backupMS; private int terrainMS; private int landMS; - private int lastCompletedFrame; + + /// + /// Tick at which the last frame was processed. + /// + private int m_lastFrameTick; /// /// Signals whether temporary objects are currently being cleaned up. Needed because this is launched @@ -464,7 +468,7 @@ namespace OpenSim.Region.Framework.Scenes public int MonitorBackupTime { get { return backupMS; } } public int MonitorTerrainTime { get { return terrainMS; } } public int MonitorLandTime { get { return landMS; } } - public int MonitorLastFrameTick { get { return lastCompletedFrame; } } + public int MonitorLastFrameTick { get { return m_lastFrameTick; } } public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } } public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } } @@ -1202,6 +1206,7 @@ namespace OpenSim.Region.Framework.Scenes float physicsFPS = 0f; int tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS; + int previousFrameTick; int maintc; List coarseLocations; List avatarUUIDs; @@ -1305,10 +1310,9 @@ namespace OpenSim.Region.Framework.Scenes // UpdateLand(); // landMS = Util.EnvironmentTickCountSubtract(ldMS); //} - + frameMS = Util.EnvironmentTickCountSubtract(maintc); otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; - lastCompletedFrame = Util.EnvironmentTickCount(); // if (Frame%m_update_avatars == 0) // UpdateInWorldTime(); @@ -1378,16 +1382,19 @@ namespace OpenSim.Region.Framework.Scenes // Tell the watchdog that this thread is still alive Watchdog.UpdateThread(); - maintc = Util.EnvironmentTickCountSubtract(maintc); +// previousFrameTick = m_lastFrameTick; + m_lastFrameTick = Util.EnvironmentTickCount(); + maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); maintc = (int)(MinFrameTime * 1000) - maintc; if (maintc > 0) Thread.Sleep(maintc); -// if (frameMS > (int)(MinFrameTime * 1000)) + // Optionally warn if a frame takes double the amount of time that it should. +// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) // m_log.WarnFormat( // "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", -// frameMS, +// Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), // MinFrameTime * 1000, // RegionInfo.RegionName); } -- cgit v1.1 From 9671e43497c7bc09903d0ef34a45ee9ad1665927 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Mar 2012 01:02:58 +0000 Subject: Replace "scene debug true false true" console command with "scene debug scripting true" or other parameters as appropriate. This is to allow individual switching of scene debug settings and to provide flexibiltiy for additional settings. --- OpenSim/Region/Framework/Scenes/Scene.cs | 55 +++++++++++++++++--------------- 1 file changed, 30 insertions(+), 25 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 790ec63..f2200da 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1020,44 +1020,49 @@ namespace OpenSim.Region.Framework.Scenes } } - public void SetSceneCoreDebug(bool ScriptEngine, bool CollisionEvents, bool PhysicsEngine) + public void SetSceneCoreDebug(Dictionary options) { - if (m_scripts_enabled != !ScriptEngine) + if (options.ContainsKey("scripting")) { - if (ScriptEngine) + bool enableScripts = true; + if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts) { - m_log.Info("Stopping all Scripts in Scene"); - - EntityBase[] entities = Entities.GetEntities(); - foreach (EntityBase ent in entities) + if (!enableScripts) { - if (ent is SceneObjectGroup) - ((SceneObjectGroup)ent).RemoveScriptInstances(false); + m_log.Info("Stopping all Scripts in Scene"); + + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase ent in entities) + { + if (ent is SceneObjectGroup) + ((SceneObjectGroup)ent).RemoveScriptInstances(false); + } } - } - else - { - m_log.Info("Starting all Scripts in Scene"); - - EntityBase[] entities = Entities.GetEntities(); - foreach (EntityBase ent in entities) + else { - if (ent is SceneObjectGroup) + m_log.Info("Starting all Scripts in Scene"); + + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase ent in entities) { - SceneObjectGroup sog = (SceneObjectGroup)ent; - sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); - sog.ResumeScripts(); + if (ent is SceneObjectGroup) + { + SceneObjectGroup sog = (SceneObjectGroup)ent; + sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); + sog.ResumeScripts(); + } } } - } - m_scripts_enabled = !ScriptEngine; - m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); + m_scripts_enabled = enableScripts; + } } - if (m_physics_enabled != !PhysicsEngine) + if (options.ContainsKey("physics")) { - m_physics_enabled = !PhysicsEngine; + bool enablePhysics = false; + if (bool.TryParse(options["physics"], out enablePhysics) && m_physics_enabled != enablePhysics) + m_physics_enabled = enablePhysics; } } -- cgit v1.1 From ab243f4a5794e6b7b9a414c2e1bb57d3d0abfb75 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Mar 2012 01:13:44 +0000 Subject: Incorporate scene teleporting debugging into "debug scene teleport true|false" command --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++++- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f2200da..e1e4ed5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Scenes #region Fields public bool EmergencyMonitoring = false; - public bool DEBUG = false; + public bool DebugTeleporting { get; private set; } public SynchronizeSceneHandler SynchronizeScene; public SimStatsReporter StatsReporter; @@ -1064,6 +1064,9 @@ namespace OpenSim.Region.Framework.Scenes if (bool.TryParse(options["physics"], out enablePhysics) && m_physics_enabled != enablePhysics) m_physics_enabled = enablePhysics; } + + if (options.ContainsKey("teleport")) + DebugTeleporting = true; } public int GetInaccurateNeighborCount() diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 704d12d..cf60c69 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3826,7 +3826,7 @@ namespace OpenSim.Region.Framework.Scenes ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); if (land != null) { - if (Scene.DEBUG) + if (Scene.DebugTeleporting) TeleportFlagsDebug(); // If we come in via login, landmark or map, we want to -- cgit v1.1 From de53aa32e0af4a14f6a0d0f27817b41e7befa62e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Mar 2012 01:27:09 +0000 Subject: Add Scene.DebugUpdates switch which, if turned on, will print out a warning when a frame updates takes longer than twice the desired time This is controlled via "debug scene updates true|false" on the region console. Also fix an oversight with "debug scene teleport true|false" --- OpenSim/Region/Framework/Scenes/Scene.cs | 42 ++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e1e4ed5..92c1060 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -65,8 +65,17 @@ namespace OpenSim.Region.Framework.Scenes #region Fields public bool EmergencyMonitoring = false; + + /// + /// Show debug information about teleports. + /// public bool DebugTeleporting { get; private set; } + /// + /// Show debug information about the scene loop. + /// + public bool DebugUpdates { get; private set; } + public SynchronizeSceneHandler SynchronizeScene; public SimStatsReporter StatsReporter; public List NorthBorders = new List(); @@ -1060,13 +1069,24 @@ namespace OpenSim.Region.Framework.Scenes if (options.ContainsKey("physics")) { - bool enablePhysics = false; - if (bool.TryParse(options["physics"], out enablePhysics) && m_physics_enabled != enablePhysics) + bool enablePhysics; + if (bool.TryParse(options["physics"], out enablePhysics)) m_physics_enabled = enablePhysics; } if (options.ContainsKey("teleport")) - DebugTeleporting = true; + { + bool enableTeleportDebugging; + if (bool.TryParse(options["teleport"], out enableTeleportDebugging)) + DebugTeleporting = enableTeleportDebugging; + } + + if (options.ContainsKey("updates")) + { + bool enableUpdateDebugging; + if (bool.TryParse(options["updates"], out enableUpdateDebugging)) + DebugUpdates = enableUpdateDebugging; + } } public int GetInaccurateNeighborCount() @@ -1390,7 +1410,7 @@ namespace OpenSim.Region.Framework.Scenes // Tell the watchdog that this thread is still alive Watchdog.UpdateThread(); -// previousFrameTick = m_lastFrameTick; + previousFrameTick = m_lastFrameTick; m_lastFrameTick = Util.EnvironmentTickCount(); maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); maintc = (int)(MinFrameTime * 1000) - maintc; @@ -1399,12 +1419,14 @@ namespace OpenSim.Region.Framework.Scenes Thread.Sleep(maintc); // Optionally warn if a frame takes double the amount of time that it should. -// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) -// m_log.WarnFormat( -// "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", -// Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), -// MinFrameTime * 1000, -// RegionInfo.RegionName); + if (DebugUpdates + && Util.EnvironmentTickCountSubtract( + m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) + m_log.WarnFormat( + "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", + Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), + MinFrameTime * 1000, + RegionInfo.RegionName); } } -- cgit v1.1 From 54a8a5baba4d7d3992cfe2c777c65eac812f7229 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Mar 2012 02:02:14 +0000 Subject: If "debug scene updates true" then print out to log when a garbage collection occurs. --- OpenSim/Region/Framework/Scenes/Scene.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 92c1060..76e632e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1085,7 +1085,10 @@ namespace OpenSim.Region.Framework.Scenes { bool enableUpdateDebugging; if (bool.TryParse(options["updates"], out enableUpdateDebugging)) + { DebugUpdates = enableUpdateDebugging; + GcNotify.Enabled = DebugUpdates; + } } } -- cgit v1.1 From 1a8769e6eff0eab750a528f27d127637edbd292b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Mar 2012 23:57:39 +0000 Subject: Instead of loading default avatar animations in both SLUtil and AvatarAnimations, load just in AvatarAnimations instead. This lets us remove the dependency of OpenSim.Framework.dll on data/avataranimations.xml, which is not necessary for ROBUST. This commit also takes care of the odd situation where animations are stored and used internally with uppercase names (e.g. "STAND") but scripts refer to them with lowercase names (e.g. "sit"). --- .../Framework/Scenes/Animation/AnimationSet.cs | 14 ++-- .../Framework/Scenes/Animation/AvatarAnimations.cs | 81 +++++++++++++++++----- .../Scenes/Animation/ScenePresenceAnimator.cs | 8 ++- 3 files changed, 79 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 9176d3d..240a424 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -27,8 +27,10 @@ using System; using System.Collections.Generic; -using OpenSim.Framework; +using System.Reflection; +using log4net; using OpenMetaverse; +using OpenSim.Framework; using Animation = OpenSim.Framework.Animation; @@ -37,7 +39,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation [Serializable] public class AnimationSet { - public static AvatarAnimations Animations = new AvatarAnimations(); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation(); private List m_animations = new List(); @@ -132,9 +134,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation /// public bool TrySetDefaultAnimation(string anim, int sequenceNum, UUID objectID) { - if (Animations.AnimsUUID.ContainsKey(anim)) +// m_log.DebugFormat( +// "[ANIMATION SET]: Setting default animation {0}, sequence number {1}, object id {2}", +// anim, sequenceNum, objectID); + + if (AvatarAnimations.AnimsUUID.ContainsKey(anim)) { - return SetDefaultAnimation(Animations.AnimsUUID[anim], sequenceNum, objectID); + return SetDefaultAnimation(AvatarAnimations.AnimsUUID[anim], sequenceNum, objectID); } return false; } diff --git a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs index 659c3a5..ec928f4 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs @@ -26,38 +26,83 @@ */ using System.Collections.Generic; +using System.Reflection; using System.Xml; +using log4net; using OpenMetaverse; namespace OpenSim.Region.Framework.Scenes.Animation { public class AvatarAnimations { - public Dictionary AnimsUUID = new Dictionary(); - public Dictionary AnimsNames = new Dictionary(); - public Dictionary AnimStateNames = new Dictionary(); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public AvatarAnimations() + public static readonly string DefaultAnimationsPath = "data/avataranimations.xml"; + + public static Dictionary AnimsUUID = new Dictionary(); + public static Dictionary AnimsNames = new Dictionary(); + public static Dictionary AnimStateNames = new Dictionary(); + + static AvatarAnimations() + { + LoadAnimations(DefaultAnimationsPath); + } + + /// + /// Load the default SL avatar animations. + /// + /// + private static void LoadAnimations(string path) { - using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml")) +// Dictionary animations = new Dictionary(); + + using (XmlTextReader reader = new XmlTextReader(path)) { XmlDocument doc = new XmlDocument(); doc.Load(reader); - foreach (XmlNode nod in doc.DocumentElement.ChildNodes) - { - if (nod.Attributes["name"] != null) +// if (doc.DocumentElement != null) +// { + foreach (XmlNode nod in doc.DocumentElement.ChildNodes) { - string name = (string)nod.Attributes["name"].Value; - UUID id = (UUID)nod.InnerText; - string animState = (string)nod.Attributes["state"].Value; - - AnimsUUID.Add(name, id); - AnimsNames.Add(id, name); - if (animState != "") - AnimStateNames.Add(id, animState); + if (nod.Attributes["name"] != null) + { + string name = nod.Attributes["name"].Value; + UUID id = (UUID)nod.InnerText; + string animState = (string)nod.Attributes["state"].Value; + + AnimsUUID.Add(name, id); + AnimsNames.Add(id, name); + if (animState != "") + AnimStateNames.Add(id, animState); + +// m_log.DebugFormat("[AVATAR ANIMATIONS]: Loaded {0} {1} {2}", id, name, animState); + } } - } +// } + } + +// return animations; + } + + /// + /// Get the default avatar animation with the given name. + /// + /// + /// + public static UUID GetDefaultAnimation(string name) + { +// m_log.DebugFormat( +// "[AVATAR ANIMATIONS]: Looking for default avatar animation with name {0}", name); + + if (AnimsUUID.ContainsKey(name)) + { +// m_log.DebugFormat( +// "[AVATAR ANIMATIONS]: Found {0} {1} in GetDefaultAvatarAnimation()", AnimsUUID[name], name); + + return AnimsUUID[name]; } + + return UUID.Zero; } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 3584cda..9038ebc 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -97,7 +97,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (m_scenePresence.IsChildAgent) return; - UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name); + // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations + // are referenced with lower case names! + UUID animID = AvatarAnimations.GetDefaultAnimation(name.ToUpper()); if (animID == UUID.Zero) return; @@ -121,7 +123,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (m_scenePresence.IsChildAgent) return; - UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name); + // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations + // are referenced with lower case names! + UUID animID = AvatarAnimations.GetDefaultAnimation(name); if (animID == UUID.Zero) return; -- cgit v1.1 From 9949ac2f9f448faaa873b98451c6025d687358a2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Mar 2012 00:10:41 +0000 Subject: refactor: Rename AvatarAnimations -> DefaultAvatarAnimations for code clarity since non-default animations are handled completely separately from this class --- .../Framework/Scenes/Animation/AnimationSet.cs | 4 +- .../Framework/Scenes/Animation/AvatarAnimations.cs | 108 --------------------- .../Scenes/Animation/DefaultAvatarAnimations.cs | 108 +++++++++++++++++++++ .../Scenes/Animation/ScenePresenceAnimator.cs | 4 +- 4 files changed, 112 insertions(+), 112 deletions(-) delete mode 100644 OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs create mode 100644 OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 240a424..33041e9 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -138,9 +138,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation // "[ANIMATION SET]: Setting default animation {0}, sequence number {1}, object id {2}", // anim, sequenceNum, objectID); - if (AvatarAnimations.AnimsUUID.ContainsKey(anim)) + if (DefaultAvatarAnimations.AnimsUUID.ContainsKey(anim)) { - return SetDefaultAnimation(AvatarAnimations.AnimsUUID[anim], sequenceNum, objectID); + return SetDefaultAnimation(DefaultAvatarAnimations.AnimsUUID[anim], sequenceNum, objectID); } return false; } diff --git a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs deleted file mode 100644 index ec928f4..0000000 --- a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; -using System.Reflection; -using System.Xml; -using log4net; -using OpenMetaverse; - -namespace OpenSim.Region.Framework.Scenes.Animation -{ - public class AvatarAnimations - { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public static readonly string DefaultAnimationsPath = "data/avataranimations.xml"; - - public static Dictionary AnimsUUID = new Dictionary(); - public static Dictionary AnimsNames = new Dictionary(); - public static Dictionary AnimStateNames = new Dictionary(); - - static AvatarAnimations() - { - LoadAnimations(DefaultAnimationsPath); - } - - /// - /// Load the default SL avatar animations. - /// - /// - private static void LoadAnimations(string path) - { -// Dictionary animations = new Dictionary(); - - using (XmlTextReader reader = new XmlTextReader(path)) - { - XmlDocument doc = new XmlDocument(); - doc.Load(reader); -// if (doc.DocumentElement != null) -// { - foreach (XmlNode nod in doc.DocumentElement.ChildNodes) - { - if (nod.Attributes["name"] != null) - { - string name = nod.Attributes["name"].Value; - UUID id = (UUID)nod.InnerText; - string animState = (string)nod.Attributes["state"].Value; - - AnimsUUID.Add(name, id); - AnimsNames.Add(id, name); - if (animState != "") - AnimStateNames.Add(id, animState); - -// m_log.DebugFormat("[AVATAR ANIMATIONS]: Loaded {0} {1} {2}", id, name, animState); - } - } -// } - } - -// return animations; - } - - /// - /// Get the default avatar animation with the given name. - /// - /// - /// - public static UUID GetDefaultAnimation(string name) - { -// m_log.DebugFormat( -// "[AVATAR ANIMATIONS]: Looking for default avatar animation with name {0}", name); - - if (AnimsUUID.ContainsKey(name)) - { -// m_log.DebugFormat( -// "[AVATAR ANIMATIONS]: Found {0} {1} in GetDefaultAvatarAnimation()", AnimsUUID[name], name); - - return AnimsUUID[name]; - } - - return UUID.Zero; - } - } -} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs new file mode 100644 index 0000000..c2b0468 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs @@ -0,0 +1,108 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System.Collections.Generic; +using System.Reflection; +using System.Xml; +using log4net; +using OpenMetaverse; + +namespace OpenSim.Region.Framework.Scenes.Animation +{ + public class DefaultAvatarAnimations + { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public static readonly string DefaultAnimationsPath = "data/avataranimations.xml"; + + public static Dictionary AnimsUUID = new Dictionary(); + public static Dictionary AnimsNames = new Dictionary(); + public static Dictionary AnimStateNames = new Dictionary(); + + static DefaultAvatarAnimations() + { + LoadAnimations(DefaultAnimationsPath); + } + + /// + /// Load the default SL avatar animations. + /// + /// + private static void LoadAnimations(string path) + { +// Dictionary animations = new Dictionary(); + + using (XmlTextReader reader = new XmlTextReader(path)) + { + XmlDocument doc = new XmlDocument(); + doc.Load(reader); +// if (doc.DocumentElement != null) +// { + foreach (XmlNode nod in doc.DocumentElement.ChildNodes) + { + if (nod.Attributes["name"] != null) + { + string name = nod.Attributes["name"].Value; + UUID id = (UUID)nod.InnerText; + string animState = (string)nod.Attributes["state"].Value; + + AnimsUUID.Add(name, id); + AnimsNames.Add(id, name); + if (animState != "") + AnimStateNames.Add(id, animState); + +// m_log.DebugFormat("[AVATAR ANIMATIONS]: Loaded {0} {1} {2}", id, name, animState); + } + } +// } + } + +// return animations; + } + + /// + /// Get the default avatar animation with the given name. + /// + /// + /// + public static UUID GetDefaultAnimation(string name) + { +// m_log.DebugFormat( +// "[AVATAR ANIMATIONS]: Looking for default avatar animation with name {0}", name); + + if (AnimsUUID.ContainsKey(name)) + { +// m_log.DebugFormat( +// "[AVATAR ANIMATIONS]: Found {0} {1} in GetDefaultAvatarAnimation()", AnimsUUID[name], name); + + return AnimsUUID[name]; + } + + return UUID.Zero; + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 9038ebc..cded9be 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -99,7 +99,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations // are referenced with lower case names! - UUID animID = AvatarAnimations.GetDefaultAnimation(name.ToUpper()); + UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name.ToUpper()); if (animID == UUID.Zero) return; @@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations // are referenced with lower case names! - UUID animID = AvatarAnimations.GetDefaultAnimation(name); + UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name); if (animID == UUID.Zero) return; -- cgit v1.1 From 6146e7ef258b10888ad7464b72b75cca701e02c9 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 22 Mar 2012 12:57:12 -0700 Subject: Simple build permissions feature. NOTE: EXPERIMENTAL, DISABLED BY DEFAULT. Turns out that this can't be expressed by cascading Permission modules, so I did it as per this patch. --- OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index e1fedf4..a4605c4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -90,6 +90,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate bool TeleportHandler(UUID userID, Scene scene); public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face); public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face); + public delegate void SendLandPropertiesHandler(UUID userID, ILandObject realLand, out ILandObject landToSend); #endregion public class ScenePermissions @@ -157,6 +158,7 @@ namespace OpenSim.Region.Framework.Scenes public event TeleportHandler OnTeleport; public event ControlPrimMediaHandler OnControlPrimMedia; public event InteractWithPrimMediaHandler OnInteractWithPrimMedia; + public event SendLandPropertiesHandler OnSendLandProperties; #endregion #region Object Permission Checks @@ -1098,5 +1100,20 @@ namespace OpenSim.Region.Framework.Scenes } return true; } + + public void LandObjectForClient(UUID userID, ILandObject realLand, out ILandObject landToSend) + { + landToSend = realLand; + SendLandPropertiesHandler handler = OnSendLandProperties; + if (handler != null) + { + Delegate[] list = handler.GetInvocationList(); + foreach (SendLandPropertiesHandler h in list) + { + h(userID, realLand, out landToSend); + } + } + } + } } -- cgit v1.1 From 45b588cf008c514f461bf43c168dcdc9902b7bb9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 22 Mar 2012 20:10:38 +0000 Subject: Revert "Simple build permissions feature. NOTE: EXPERIMENTAL, DISABLED BY DEFAULT. Turns out that this can't be expressed by cascading Permission modules, so I did it as per this patch." This reverts commit 6146e7ef258b10888ad7464b72b75cca701e02c9. --- OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index a4605c4..e1fedf4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -90,7 +90,6 @@ namespace OpenSim.Region.Framework.Scenes public delegate bool TeleportHandler(UUID userID, Scene scene); public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face); public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face); - public delegate void SendLandPropertiesHandler(UUID userID, ILandObject realLand, out ILandObject landToSend); #endregion public class ScenePermissions @@ -158,7 +157,6 @@ namespace OpenSim.Region.Framework.Scenes public event TeleportHandler OnTeleport; public event ControlPrimMediaHandler OnControlPrimMedia; public event InteractWithPrimMediaHandler OnInteractWithPrimMedia; - public event SendLandPropertiesHandler OnSendLandProperties; #endregion #region Object Permission Checks @@ -1100,20 +1098,5 @@ namespace OpenSim.Region.Framework.Scenes } return true; } - - public void LandObjectForClient(UUID userID, ILandObject realLand, out ILandObject landToSend) - { - landToSend = realLand; - SendLandPropertiesHandler handler = OnSendLandProperties; - if (handler != null) - { - Delegate[] list = handler.GetInvocationList(); - foreach (SendLandPropertiesHandler h in list) - { - h(userID, realLand, out landToSend); - } - } - } - } } -- cgit v1.1 From c4b2d24f337eeaf8c7d8e643c3491d491d584cde Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Mar 2012 22:17:07 +0000 Subject: Add llGiveInventory() test from object to object where both objects are owned by the same user. --- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 6 +++--- OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index f2d1915..71a9084 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -590,9 +590,9 @@ namespace OpenSim.Region.Framework.Scenes /// A list of inventory items with that name. /// If no inventory item has that name then an empty list is returned. /// - public IList GetInventoryItems(string name) + public List GetInventoryItems(string name) { - IList items = new List(); + List items = new List(); lock (m_items) { @@ -1100,7 +1100,7 @@ namespace OpenSim.Region.Framework.Scenes public List GetInventoryItems() { - List ret = new List(); + List ret = new List(); lock (m_items) ret = new List(m_items.Values); diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index e16903c..55c80f5 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -113,7 +113,7 @@ namespace OpenSim.Region.Framework.Tests } /// - /// Test MoveTaskInventoryItem where the item has no parent folder assigned. + /// Test MoveTaskInventoryItem from a part inventory to a user inventory where the item has no parent folder assigned. /// /// /// This should place it in the most suitable user folder. @@ -142,9 +142,11 @@ namespace OpenSim.Region.Framework.Tests } /// - /// Test MoveTaskInventoryItem where the item has no parent folder assigned. + /// Test MoveTaskInventoryItem from a part inventory to a user inventory where the item has no parent folder assigned. /// + /// /// This should place it in the most suitable user folder. + /// [Test] public void TestMoveTaskInventoryItemNoParent() { -- cgit v1.1 From 760010d6fb6aac313d79ce0a4d0016d3809246a0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Mar 2012 22:33:37 +0000 Subject: Fix llGiveInventory() so that it checks the destination part for AllowInventoryDrop, not the source. This allows llAllowInventoryDrop() to work. Regression test added for this case. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 6ae4adc..d10136f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1210,9 +1210,9 @@ namespace OpenSim.Region.Framework.Scenes /// /// Copy a task (prim) inventory item to another task (prim) /// - /// - /// - /// + /// ID of destination part + /// Source part + /// Source item id to transfer public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId) { TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId); @@ -1240,10 +1240,10 @@ namespace OpenSim.Region.Framework.Scenes // Can't transfer this // - if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) + if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) return; - if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) + if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) { // object cannot copy items to an object owned by a different owner // unless llAllowInventoryDrop has been called -- cgit v1.1 From 5bf45b9b98571f92715ea988ec276b36fa8d193c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 22 Mar 2012 22:40:38 +0000 Subject: refactor: simplify code for checks when part.OwnerID != destPart.OwnerID in MoveTaskInventoryItem() --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index d10136f..5abd74f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1238,24 +1238,21 @@ namespace OpenSim.Region.Framework.Scenes return; } - // Can't transfer this - // - if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) - return; - - if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) + if (part.OwnerID != destPart.OwnerID) { - // object cannot copy items to an object owned by a different owner - // unless llAllowInventoryDrop has been called + // Source must have transfer permissions + if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) + return; - return; + // Object cannot copy items to an object owned by a different owner + // unless llAllowInventoryDrop has been called on the destination + if ((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0) + return; } // must have both move and modify permission to put an item in an object if ((part.OwnerMask & ((uint)PermissionMask.Move | (uint)PermissionMask.Modify)) == 0) - { return; - } TaskInventoryItem destTaskItem = new TaskInventoryItem(); -- cgit v1.1 From 40b9b519b89f5da08e1e6b6557934bfd39b4f90b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 00:12:14 +0000 Subject: Add commented out section on collisions switch in Scene.SetSceneCoreDebug(). This was not implemented before the recent changes but should be at some point. --- OpenSim/Region/Framework/Scenes/Scene.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 76e632e..9d882c0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1074,6 +1074,12 @@ namespace OpenSim.Region.Framework.Scenes m_physics_enabled = enablePhysics; } +// if (options.ContainsKey("collisions")) +// { +// // TODO: Implement. If false, should stop objects colliding, though possibly should still allow +// // the avatar themselves to collide with the ground. +// } + if (options.ContainsKey("teleport")) { bool enableTeleportDebugging; -- cgit v1.1 From 08b8ebcc7e71038894fa47757db6d6aa5bb66d00 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 00:54:37 +0000 Subject: Use m_lastFrameTick instead of m_lastUpdate in Scene.GetHealth(). m_lastUpdate is no longer properly updated and is redundant anyway. --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9d882c0..16ce1ba 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4504,8 +4504,8 @@ namespace OpenSim.Region.Framework.Scenes // int health=1; // Start at 1, means we're up - if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000) - health+=1; + if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) + health += 1; else return health; -- cgit v1.1 From bc2963d42ab998551603b74361b26d5dfd5d0acd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 01:03:10 +0000 Subject: Comment out unused scene loop restart code. This has actually been unused since at least 0.7.2 due to earlier changes. --- OpenSim/Region/Framework/Scenes/Scene.cs | 41 +++++++++++++++++--------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 16ce1ba..d89d94d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -216,9 +216,7 @@ namespace OpenSim.Region.Framework.Scenes // TODO: Possibly stop other classes being able to manipulate this directly. private SceneGraph m_sceneGraph; private volatile int m_bordersLocked; -// private int m_RestartTimerCounter; private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing -// private int m_incrementsof15seconds; private volatile bool m_backingup; private Dictionary m_returns = new Dictionary(); private Dictionary m_groupsWithTargets = new Dictionary(); @@ -226,12 +224,17 @@ namespace OpenSim.Region.Framework.Scenes private bool m_physics_enabled = true; private bool m_scripts_enabled = true; private string m_defaultScriptEngine; + + /// + /// Tick at which the last login occurred. + /// private int m_LastLogin; + private Thread HeartbeatThread; private volatile bool shuttingdown; - private int m_lastUpdate; - private bool m_firstHeartbeat = true; +// private int m_lastUpdate; +// private bool m_firstHeartbeat = true; private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; private bool m_reprioritizationEnabled = true; @@ -801,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes m_permissions = new ScenePermissions(this); - m_lastUpdate = Util.EnvironmentTickCount(); +// m_lastUpdate = Util.EnvironmentTickCount(); } #endregion @@ -1170,7 +1173,7 @@ namespace OpenSim.Region.Framework.Scenes HeartbeatThread.Abort(); HeartbeatThread = null; } - m_lastUpdate = Util.EnvironmentTickCount(); +// m_lastUpdate = Util.EnvironmentTickCount(); HeartbeatThread = Watchdog.StartThread( @@ -1222,8 +1225,8 @@ namespace OpenSim.Region.Framework.Scenes while (!shuttingdown) Update(-1); - m_lastUpdate = Util.EnvironmentTickCount(); - m_firstHeartbeat = false; +// m_lastUpdate = Util.EnvironmentTickCount(); +// m_firstHeartbeat = false; } finally { @@ -2541,7 +2544,7 @@ namespace OpenSim.Region.Framework.Scenes = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; - CheckHeartbeat(); +// CheckHeartbeat(); ScenePresence sp = GetScenePresence(client.AgentId); @@ -3117,7 +3120,7 @@ namespace OpenSim.Region.Framework.Scenes public override void RemoveClient(UUID agentID, bool closeChildAgents) { - CheckHeartbeat(); +// CheckHeartbeat(); bool isChildAgent = false; ScenePresence avatar = GetScenePresence(agentID); if (avatar != null) @@ -4516,7 +4519,7 @@ namespace OpenSim.Region.Framework.Scenes else return health; - CheckHeartbeat(); +// CheckHeartbeat(); return health; } @@ -4704,14 +4707,14 @@ namespace OpenSim.Region.Framework.Scenes return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; } - private void CheckHeartbeat() - { - if (m_firstHeartbeat) - return; - - if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) - StartTimer(); - } +// private void CheckHeartbeat() +// { +// if (m_firstHeartbeat) +// return; +// +// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) +// StartTimer(); +// } public override ISceneObject DeserializeObject(string representation) { -- cgit v1.1 From a9995ede65d1327413ae5c5e9b2e6f6dcf0f11c2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 01:08:13 +0000 Subject: Fix bug in ScenePresenceAnimator.RemoveAnimation() introduced in commit 1a8769e Forgot to uppercase the animation name for default animations, since for some reason we store and use them in upper rather than lowercase. --- OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index cded9be..f5623bd 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations // are referenced with lower case names! - UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name); + UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name.ToUpper()); if (animID == UUID.Zero) return; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d89d94d..6fea5ff 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1159,9 +1159,9 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Start the timer which triggers regular scene updates + /// Start the scene loop /// - public void StartTimer() + public void Start() { // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); -- cgit v1.1 From 4ee8b3e23edc9ca11cf3d17f24fddfdcbfd8c1cc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 01:11:43 +0000 Subject: Fix build break --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6fea5ff..8a4c6c9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1161,7 +1161,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Start the scene loop /// - public void Start() + public void StartTimer() { // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); -- cgit v1.1 From 18b3f1132eeb28e51d84e028e4fd69048150ccb7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 01:21:43 +0000 Subject: Rename Scene.StartTimer() to Start() - this method no longer uses a timer. Comment out more effectively unused old heartbeat code. --- OpenSim/Region/Framework/Scenes/Scene.cs | 49 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8a4c6c9..d354ef0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -211,7 +211,7 @@ namespace OpenSim.Region.Framework.Scenes /// private bool m_cleaningTemps = false; - private Object m_heartbeatLock = new Object(); +// private Object m_heartbeatLock = new Object(); // TODO: Possibly stop other classes being able to manipulate this directly. private SceneGraph m_sceneGraph; @@ -1159,9 +1159,9 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Start the scene loop + /// Start the scene /// - public void StartTimer() + public void Start() { // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); @@ -1206,33 +1206,34 @@ namespace OpenSim.Region.Framework.Scenes /// private void Heartbeat() { - if (!Monitor.TryEnter(m_heartbeatLock)) - { - Watchdog.RemoveThread(); - return; - } +// if (!Monitor.TryEnter(m_heartbeatLock)) +// { +// Watchdog.RemoveThread(); +// return; +// } - try - { - m_eventManager.TriggerOnRegionStarted(this); +// 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(1); - Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; + // 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(1); + Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; - while (!shuttingdown) - Update(-1); + while (!shuttingdown) + Update(-1); // m_lastUpdate = Util.EnvironmentTickCount(); // m_firstHeartbeat = false; - } - finally - { - Monitor.Pulse(m_heartbeatLock); - Monitor.Exit(m_heartbeatLock); - } +// } +// finally +// { +// Monitor.Pulse(m_heartbeatLock); +// Monitor.Exit(m_heartbeatLock); +// } Watchdog.RemoveThread(); } -- cgit v1.1 From 349454ca2740d5eb5d465f0d45ebd49975556dd5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 01:46:11 +0000 Subject: Remove unnecessary shutting down check in Scene.Heartbeat(). Add some method doc. Rename HeartbeatThread, shuttingdown to conform to code standards. --- OpenSim/Region/Framework/Scenes/Scene.cs | 37 +++++++++++++++++--------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d354ef0..09b91c0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -230,8 +230,19 @@ namespace OpenSim.Region.Framework.Scenes /// private int m_LastLogin; - private Thread HeartbeatThread; - private volatile bool shuttingdown; + /// + /// Thread that runs the scene loop. + /// + private Thread m_heartbeatThread; + + /// + /// True if these scene is in the process of shutting down or is shutdown. + /// + public bool ShuttingDown + { + get { return m_shuttingDown; } + } + private volatile bool m_shuttingDown; // private int m_lastUpdate; // private bool m_firstHeartbeat = true; @@ -811,11 +822,6 @@ namespace OpenSim.Region.Framework.Scenes #region Startup / Close Methods - public bool ShuttingDown - { - get { return shuttingdown; } - } - /// /// The scene graph for this scene /// @@ -1134,8 +1140,7 @@ namespace OpenSim.Region.Framework.Scenes ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); // Stop updating the scene objects and agents. - //m_heartbeatTimer.Close(); - shuttingdown = true; + m_shuttingDown = true; m_log.Debug("[SCENE]: Persisting changed objects"); EventManager.TriggerSceneShuttingDown(this); @@ -1168,14 +1173,14 @@ namespace OpenSim.Region.Framework.Scenes //m_heartbeatTimer.Enabled = true; //m_heartbeatTimer.Interval = (int)(m_timespan * 1000); //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); - if (HeartbeatThread != null) + if (m_heartbeatThread != null) { - HeartbeatThread.Abort(); - HeartbeatThread = null; + m_heartbeatThread.Abort(); + m_heartbeatThread = null; } // m_lastUpdate = Util.EnvironmentTickCount(); - HeartbeatThread + m_heartbeatThread = Watchdog.StartThread( Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); } @@ -1222,9 +1227,7 @@ namespace OpenSim.Region.Framework.Scenes // alarms for scenes with many objects. Update(1); Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; - - while (!shuttingdown) - Update(-1); + Update(-1); // m_lastUpdate = Util.EnvironmentTickCount(); // m_firstHeartbeat = false; @@ -1252,7 +1255,7 @@ namespace OpenSim.Region.Framework.Scenes List coarseLocations; List avatarUUIDs; - while (!shuttingdown && (endFrame == null || Frame < endFrame)) + while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) { maintc = Util.EnvironmentTickCount(); ++Frame; -- cgit v1.1 From 4ed833bc9dba8e0208777f8afde32a67aebe143a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 02:49:29 +0000 Subject: Add a scene maintenance thread in parallel to the heartbeat thread. The maintenance thread will end up running regular jobs that don't need to be in the main scene loop. The idea is to make the critical main scene loop as skinny as possible - it doesn't need to run things that aren't time critical and don't depend on update ordering. This will be done gradually over time to try and uncover any issues. Many non-criticial scene loop activities are being launched on separate threadpool threads anyway. This may also allow modules to register their own maintenance jobs without having to maintain their own timers and threads. Currently the maintenance loop runs once a second, as opposed to the 89ms scene loop. --- OpenSim/Region/Framework/Scenes/Scene.cs | 91 +++++++++++++++++++++++++++----- 1 file changed, 77 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 09b91c0..41e9bbc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -169,6 +169,11 @@ namespace OpenSim.Region.Framework.Scenes } /// + /// Current maintenance run number + /// + public uint MaintenanceRun { get; private set; } + + /// /// The minimum length of time in seconds that will be taken for a scene frame. If the frame takes less time then we /// will sleep for the remaining period. /// @@ -178,6 +183,11 @@ namespace OpenSim.Region.Framework.Scenes /// public float MinFrameTime { get; private set; } + /// + /// The minimum length of time in seconds that will be taken for a maintenance run. + /// + public float MinMaintenanceTime { get; private set; } + private int m_update_physics = 1; private int m_update_entitymovement = 1; private int m_update_objects = 1; @@ -206,6 +216,11 @@ namespace OpenSim.Region.Framework.Scenes private int m_lastFrameTick; /// + /// Tick at which the last maintenance run occurred. + /// + private int m_lastMaintenanceTick; + + /// /// Signals whether temporary objects are currently being cleaned up. Needed because this is launched /// asynchronously from the update loop. /// @@ -560,6 +575,7 @@ namespace OpenSim.Region.Framework.Scenes { m_config = config; MinFrameTime = 0.089f; + MinMaintenanceTime = 1; Random random = new Random(); @@ -1226,6 +1242,10 @@ namespace OpenSim.Region.Framework.Scenes // 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(1); + + Watchdog.StartThread( + Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true); + Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; Update(-1); @@ -1241,6 +1261,63 @@ namespace OpenSim.Region.Framework.Scenes Watchdog.RemoveThread(); } + private void Maintenance() + { + DoMaintenance(-1); + + Watchdog.RemoveThread(); + } + + public void DoMaintenance(int runs) + { + long? endRun = null; + int runtc; + int previousMaintenanceTick; + + if (runs >= 0) + endRun = MaintenanceRun + runs; + + List coarseLocations; + List avatarUUIDs; + + while (!m_shuttingDown && (endRun == null || MaintenanceRun < endRun)) + { + runtc = Util.EnvironmentTickCount(); + ++MaintenanceRun; + + // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) + if (MaintenanceRun % (m_update_coarse_locations / 10) == 0) + { + SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); + // Send coarse locations to clients + ForEachScenePresence(delegate(ScenePresence presence) + { + presence.SendCoarseLocations(coarseLocations, avatarUUIDs); + }); + } + + Watchdog.UpdateThread(); + + previousMaintenanceTick = m_lastMaintenanceTick; + m_lastMaintenanceTick = Util.EnvironmentTickCount(); + runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc); + runtc = (int)(MinMaintenanceTime * 1000) - runtc; + + if (runtc > 0) + Thread.Sleep(runtc); + + // Optionally warn if a frame takes double the amount of time that it should. + if (DebugUpdates + && Util.EnvironmentTickCountSubtract( + m_lastMaintenanceTick, previousMaintenanceTick) > (int)(MinMaintenanceTime * 1000 * 2)) + m_log.WarnFormat( + "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}", + Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick), + MinMaintenanceTime * 1000, + RegionInfo.RegionName); + } + } + public override void Update(int frames) { long? endFrame = null; @@ -1252,8 +1329,6 @@ namespace OpenSim.Region.Framework.Scenes int tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS; int previousFrameTick; int maintc; - List coarseLocations; - List avatarUUIDs; while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) { @@ -1305,17 +1380,6 @@ namespace OpenSim.Region.Framework.Scenes if (Frame % m_update_presences == 0) m_sceneGraph.UpdatePresences(); - // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) - if (Frame % m_update_coarse_locations == 0) - { - SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); - // Send coarse locations to clients - ForEachScenePresence(delegate(ScenePresence presence) - { - presence.SendCoarseLocations(coarseLocations, avatarUUIDs); - }); - } - agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS); // Delete temp-on-rez stuff @@ -1423,7 +1487,6 @@ namespace OpenSim.Region.Framework.Scenes EventManager.TriggerRegionHeartbeatEnd(this); - // Tell the watchdog that this thread is still alive Watchdog.UpdateThread(); previousFrameTick = m_lastFrameTick; -- cgit v1.1 From 54887bf38623007d9148e651b1d08f6d6fca35e7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 03:33:07 +0000 Subject: Add experimental SendPeriodicAppearanceUpdates = true/false setting to [Startup] in OpenSim.ini On osgrid and other places, I have observed that manually sending appearance updates from the console often relieves grey avatar syndrome. Despite hunting high and low, I haven't been able to find where this packet is sometimes being lost - it might be a persistent viewer bug for all I know. Therefore, this experimental setting resends appearance data for everybody in the scene every 60 seconds. These packets are small and the viewer only fetches texture data if it doesn't already have it. Default is false. --- OpenSim/Region/Framework/Scenes/Scene.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 41e9bbc..5809508 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -104,6 +104,11 @@ namespace OpenSim.Region.Framework.Scenes public bool m_allowScriptCrossings; public bool m_useFlySlow; + /// + /// Temporarily setting to trigger appearance resends at 60 second intervals. + /// + public bool SendPeriodicAppearanceUpdates { get; set; } + protected float m_defaultDrawDistance = 255.0f; public float DefaultDrawDistance { @@ -761,6 +766,8 @@ namespace OpenSim.Region.Framework.Scenes 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); + + SendPeriodicAppearanceUpdates = startupConfig.GetBoolean("SendPeriodicAppearanceUpdates", SendPeriodicAppearanceUpdates); } #endregion Region Config @@ -1296,6 +1303,16 @@ namespace OpenSim.Region.Framework.Scenes }); } + if (SendPeriodicAppearanceUpdates && MaintenanceRun % 60 == 0) + { + m_log.DebugFormat("[SCENE]: Sending periodic appearance updates"); + + if (AvatarFactory != null) + { + ForEachRootScenePresence(sp => AvatarFactory.SendAppearance(sp.UUID)); + } + } + Watchdog.UpdateThread(); previousMaintenanceTick = m_lastMaintenanceTick; -- cgit v1.1 From d4beb2f5bcc71949c47daefc25d65160423d6cb1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Mar 2012 03:39:39 +0000 Subject: Comment out log message about sending periodic appearance updates. --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5809508..0dcbcdb 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1305,8 +1305,8 @@ namespace OpenSim.Region.Framework.Scenes if (SendPeriodicAppearanceUpdates && MaintenanceRun % 60 == 0) { - m_log.DebugFormat("[SCENE]: Sending periodic appearance updates"); - +// m_log.DebugFormat("[SCENE]: Sending periodic appearance updates"); + if (AvatarFactory != null) { ForEachRootScenePresence(sp => AvatarFactory.SendAppearance(sp.UUID)); -- cgit v1.1 From de242a29caaaa77de5ea175a2abab9cdcafcd878 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 27 Mar 2012 11:54:13 -0700 Subject: HG: beginning of a more restrictive inventory access procedure (optional). Experimental: we'll try switching the root folder from under the viewer. --- OpenSim/Region/Framework/Scenes/Scene.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0dcbcdb..c95c151 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2675,6 +2675,14 @@ namespace OpenSim.Region.Framework.Scenes // Cache the user's name CacheUserName(sp, aCircuit); + // Let's send the Suitcase folder for incoming HG agents + if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) + { + m_log.DebugFormat("[SCENE]: Sending root folder to viewer..."); + InventoryFolderBase suitcase = InventoryService.GetRootFolder(client.AgentId); + client.SendBulkUpdateInventory(suitcase); + } + EventManager.TriggerOnNewClient(client); if (vialogin) EventManager.TriggerOnClientLogin(client); -- cgit v1.1