diff options
author | Melanie | 2010-03-18 20:09:04 +0000 |
---|---|---|
committer | Melanie | 2010-03-18 20:09:04 +0000 |
commit | 4c2a51b1b5e2169e0f336c56a023c35bcc334cbd (patch) | |
tree | 9fbaf708764f315034a283fd8fedc8afe0864d75 /OpenSim/Region/Framework/Scenes/Scene.cs | |
parent | Merge branch 'careminster' into careminster-presence-refactor (diff) | |
parent | Flesh out the new permission method (diff) | |
download | opensim-SC-4c2a51b1b5e2169e0f336c56a023c35bcc334cbd.zip opensim-SC-4c2a51b1b5e2169e0f336c56a023c35bcc334cbd.tar.gz opensim-SC-4c2a51b1b5e2169e0f336c56a023c35bcc334cbd.tar.bz2 opensim-SC-4c2a51b1b5e2169e0f336c56a023c35bcc334cbd.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 69 |
1 files changed, 32 insertions, 37 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 03f1ee2..b2c8dfd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -131,7 +131,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
131 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing | 131 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing |
132 | private int m_incrementsof15seconds; | 132 | private int m_incrementsof15seconds; |
133 | private volatile bool m_backingup; | 133 | private volatile bool m_backingup; |
134 | private bool m_useAsyncWhenPossible; | ||
135 | 134 | ||
136 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); | 135 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); |
137 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); | 136 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); |
@@ -656,9 +655,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
656 | // | 655 | // |
657 | IConfig startupConfig = m_config.Configs["Startup"]; | 656 | IConfig startupConfig = m_config.Configs["Startup"]; |
658 | 657 | ||
659 | // Should we try to run loops synchronously or asynchronously? | ||
660 | m_useAsyncWhenPossible = startupConfig.GetBoolean("use_async_when_possible", false); | ||
661 | |||
662 | //Animation states | 658 | //Animation states |
663 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 659 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
664 | // TODO: Change default to true once the feature is supported | 660 | // TODO: Change default to true once the feature is supported |
@@ -3636,9 +3632,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3636 | public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) | 3632 | public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) |
3637 | { | 3633 | { |
3638 | ScenePresence presence; | 3634 | ScenePresence presence; |
3639 | m_sceneGraph.TryGetAvatar(agentID, out presence); | 3635 | if(m_sceneGraph.TryGetAvatar(agentID, out presence)) |
3640 | |||
3641 | if (presence != null) | ||
3642 | { | 3636 | { |
3643 | try | 3637 | try |
3644 | { | 3638 | { |
@@ -3813,9 +3807,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3813 | Vector3 lookAt, uint teleportFlags) | 3807 | Vector3 lookAt, uint teleportFlags) |
3814 | { | 3808 | { |
3815 | ScenePresence sp; | 3809 | ScenePresence sp; |
3816 | m_sceneGraph.TryGetAvatar(remoteClient.AgentId, out sp); | 3810 | if(m_sceneGraph.TryGetAvatar(remoteClient.AgentId, out sp)) |
3817 | |||
3818 | if (sp != null) | ||
3819 | { | 3811 | { |
3820 | uint regionX = m_regInfo.RegionLocX; | 3812 | uint regionX = m_regInfo.RegionLocX; |
3821 | uint regionY = m_regInfo.RegionLocY; | 3813 | uint regionY = m_regInfo.RegionLocY; |
@@ -4171,6 +4163,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4171 | 4163 | ||
4172 | //The idea is to have a group of method that return a list of avatars meeting some requirement | 4164 | //The idea is to have a group of method that return a list of avatars meeting some requirement |
4173 | // ie it could be all m_scenePresences within a certain range of the calling prim/avatar. | 4165 | // ie it could be all m_scenePresences within a certain range of the calling prim/avatar. |
4166 | // | ||
4167 | // GetAvatars returns a new list of all root agent presences in the scene | ||
4168 | // GetScenePresences returns a new list of all presences in the scene or a filter may be passed. | ||
4169 | // GetScenePresence returns the presence with matching UUID or first/last name. | ||
4170 | // ForEachScenePresence requests the Scene to run a delegate function against all presences. | ||
4174 | 4171 | ||
4175 | /// <summary> | 4172 | /// <summary> |
4176 | /// Return a list of all avatars in this region. | 4173 | /// Return a list of all avatars in this region. |
@@ -4187,7 +4184,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4187 | /// This list is a new object, so it can be iterated over without locking. | 4184 | /// This list is a new object, so it can be iterated over without locking. |
4188 | /// </summary> | 4185 | /// </summary> |
4189 | /// <returns></returns> | 4186 | /// <returns></returns> |
4190 | public ScenePresence[] GetScenePresences() | 4187 | public List<ScenePresence> GetScenePresences() |
4191 | { | 4188 | { |
4192 | return m_sceneGraph.GetScenePresences(); | 4189 | return m_sceneGraph.GetScenePresences(); |
4193 | } | 4190 | } |
@@ -4213,6 +4210,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
4213 | return m_sceneGraph.GetScenePresence(avatarID); | 4210 | return m_sceneGraph.GetScenePresence(avatarID); |
4214 | } | 4211 | } |
4215 | 4212 | ||
4213 | /// <summary> | ||
4214 | /// Request the ScenePresence in this region by first/last name. | ||
4215 | /// Should normally only be a single match, but first is always returned | ||
4216 | /// </summary> | ||
4217 | /// <param name="firstName"></param> | ||
4218 | /// <param name="lastName"></param> | ||
4219 | /// <returns></returns> | ||
4220 | public ScenePresence GetScenePresence(string firstName, string lastName) | ||
4221 | { | ||
4222 | return m_sceneGraph.GetScenePresence(firstName, lastName); | ||
4223 | } | ||
4224 | |||
4225 | /// <summary> | ||
4226 | /// Request the ScenePresence in this region by localID. | ||
4227 | /// </summary> | ||
4228 | /// <param name="localID"></param> | ||
4229 | /// <returns></returns> | ||
4230 | public ScenePresence GetScenePresence(uint localID) | ||
4231 | { | ||
4232 | return m_sceneGraph.GetScenePresence(localID); | ||
4233 | } | ||
4234 | |||
4216 | public override bool PresenceChildStatus(UUID avatarID) | 4235 | public override bool PresenceChildStatus(UUID avatarID) |
4217 | { | 4236 | { |
4218 | ScenePresence cp = GetScenePresence(avatarID); | 4237 | ScenePresence cp = GetScenePresence(avatarID); |
@@ -4228,25 +4247,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
4228 | } | 4247 | } |
4229 | 4248 | ||
4230 | /// <summary> | 4249 | /// <summary> |
4231 | /// | 4250 | /// Performs action on all scene presences. |
4232 | /// </summary> | 4251 | /// </summary> |
4233 | /// <param name="action"></param> | 4252 | /// <param name="action"></param> |
4234 | public void ForEachScenePresence(Action<ScenePresence> action) | 4253 | public void ForEachScenePresence(Action<ScenePresence> action) |
4235 | { | 4254 | { |
4236 | // We don't want to try to send messages if there are no avatars. | ||
4237 | if (m_sceneGraph != null) | 4255 | if (m_sceneGraph != null) |
4238 | { | 4256 | { |
4239 | try | 4257 | m_sceneGraph.ForEachScenePresence(action); |
4240 | { | ||
4241 | ScenePresence[] presences = GetScenePresences(); | ||
4242 | for (int i = 0; i < presences.Length; i++) | ||
4243 | action(presences[i]); | ||
4244 | } | ||
4245 | catch (Exception e) | ||
4246 | { | ||
4247 | m_log.Info("[BUG] in " + RegionInfo.RegionName + ": " + e.ToString()); | ||
4248 | m_log.Info("[BUG] Stack Trace: " + e.StackTrace); | ||
4249 | } | ||
4250 | } | 4258 | } |
4251 | } | 4259 | } |
4252 | 4260 | ||
@@ -4322,20 +4330,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4322 | 4330 | ||
4323 | public void ForEachClient(Action<IClientAPI> action) | 4331 | public void ForEachClient(Action<IClientAPI> action) |
4324 | { | 4332 | { |
4325 | ForEachClient(action, m_useAsyncWhenPossible); | ||
4326 | } | ||
4327 | |||
4328 | public void ForEachClient(Action<IClientAPI> action, bool doAsynchronous) | ||
4329 | { | ||
4330 | // FIXME: Asynchronous iteration is disabled until we have a threading model that | ||
4331 | // can support calling this function from an async packet handler without | ||
4332 | // potentially deadlocking | ||
4333 | m_clientManager.ForEachSync(action); | 4333 | m_clientManager.ForEachSync(action); |
4334 | |||
4335 | //if (doAsynchronous) | ||
4336 | // m_clientManager.ForEach(action); | ||
4337 | //else | ||
4338 | // m_clientManager.ForEachSync(action); | ||
4339 | } | 4334 | } |
4340 | 4335 | ||
4341 | public bool TryGetClient(UUID avatarID, out IClientAPI client) | 4336 | public bool TryGetClient(UUID avatarID, out IClientAPI client) |