diff options
author | Mic Bowman | 2011-01-26 13:33:34 -0800 |
---|---|---|
committer | Mic Bowman | 2011-01-26 13:33:34 -0800 |
commit | 240c0eaf1d8886378829e32a68aa9d2534f31a09 (patch) | |
tree | 64a71f9e103c648c24c30df02fc997a5000bc0b9 /OpenSim/Region/Framework/Scenes/Scene.cs | |
parent | Removed a few more spurious appearance saves. When an avatar (diff) | |
download | opensim-SC_OLD-240c0eaf1d8886378829e32a68aa9d2534f31a09.zip opensim-SC_OLD-240c0eaf1d8886378829e32a68aa9d2534f31a09.tar.gz opensim-SC_OLD-240c0eaf1d8886378829e32a68aa9d2534f31a09.tar.bz2 opensim-SC_OLD-240c0eaf1d8886378829e32a68aa9d2534f31a09.tar.xz |
Remove the RestorePresences functions (which don't seem to be doing
anything) and clean up the code in AddNewClient (so Appearance only
gets assigned once, not three times).
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 77 |
1 files changed, 10 insertions, 67 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 12fd813..71d0f09 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -498,12 +498,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
498 | get { return m_sceneGraph.Entities; } | 498 | get { return m_sceneGraph.Entities; } |
499 | } | 499 | } |
500 | 500 | ||
501 | public Dictionary<UUID, ScenePresence> m_restorePresences | ||
502 | { | ||
503 | get { return m_sceneGraph.RestorePresences; } | ||
504 | set { m_sceneGraph.RestorePresences = value; } | ||
505 | } | ||
506 | |||
507 | #endregion Properties | 501 | #endregion Properties |
508 | 502 | ||
509 | #region Constructors | 503 | #region Constructors |
@@ -2483,56 +2477,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2483 | (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2477 | (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2484 | 2478 | ||
2485 | CheckHeartbeat(); | 2479 | CheckHeartbeat(); |
2486 | ScenePresence presence; | ||
2487 | 2480 | ||
2488 | if (m_restorePresences.ContainsKey(client.AgentId)) | 2481 | if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here |
2489 | { | 2482 | { |
2490 | m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName); | 2483 | m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); |
2491 | 2484 | ||
2492 | m_clientManager.Add(client); | 2485 | m_clientManager.Add(client); |
2493 | SubscribeToClientEvents(client); | 2486 | SubscribeToClientEvents(client); |
2494 | 2487 | ||
2495 | presence = m_restorePresences[client.AgentId]; | 2488 | ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance); |
2496 | m_restorePresences.Remove(client.AgentId); | 2489 | m_eventManager.TriggerOnNewPresence(sp); |
2497 | |||
2498 | // This is one of two paths to create avatars that are | ||
2499 | // used. This tends to get called more in standalone | ||
2500 | // than grid, not really sure why, but as such needs | ||
2501 | // an explicity appearance lookup here. | ||
2502 | AvatarAppearance appearance = null; | ||
2503 | GetAvatarAppearance(client, out appearance); | ||
2504 | presence.Appearance = appearance; | ||
2505 | 2490 | ||
2506 | presence.initializeScenePresence(client, RegionInfo, this); | 2491 | // HERE!!! Do the initial attachments right here |
2507 | 2492 | // first agent upon login is a root agent by design. | |
2508 | m_sceneGraph.AddScenePresence(presence); | 2493 | // All other AddNewClient calls find aCircuit.child to be true |
2509 | 2494 | if (aCircuit.child == false) | |
2510 | lock (m_restorePresences) | ||
2511 | { | 2495 | { |
2512 | Monitor.PulseAll(m_restorePresences); | 2496 | sp.IsChildAgent = false; |
2513 | } | 2497 | Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); |
2514 | } | ||
2515 | else | ||
2516 | { | ||
2517 | if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here | ||
2518 | { | ||
2519 | m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); | ||
2520 | |||
2521 | m_clientManager.Add(client); | ||
2522 | SubscribeToClientEvents(client); | ||
2523 | |||
2524 | ScenePresence sp = CreateAndAddScenePresence(client); | ||
2525 | if (aCircuit != null) | ||
2526 | sp.Appearance = aCircuit.Appearance; | ||
2527 | |||
2528 | // HERE!!! Do the initial attachments right here | ||
2529 | // first agent upon login is a root agent by design. | ||
2530 | // All other AddNewClient calls find aCircuit.child to be true | ||
2531 | if (aCircuit == null || (aCircuit != null && aCircuit.child == false)) | ||
2532 | { | ||
2533 | sp.IsChildAgent = false; | ||
2534 | Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); | ||
2535 | } | ||
2536 | } | 2498 | } |
2537 | } | 2499 | } |
2538 | 2500 | ||
@@ -2997,25 +2959,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2997 | } | 2959 | } |
2998 | 2960 | ||
2999 | /// <summary> | 2961 | /// <summary> |
3000 | /// Create a child agent scene presence and add it to this scene. | ||
3001 | /// </summary> | ||
3002 | /// <param name="client"></param> | ||
3003 | /// <returns></returns> | ||
3004 | protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) | ||
3005 | { | ||
3006 | CheckHeartbeat(); | ||
3007 | AvatarAppearance appearance = null; | ||
3008 | GetAvatarAppearance(client, out appearance); | ||
3009 | |||
3010 | ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance); | ||
3011 | //avatar.KnownRegions = GetChildrenSeeds(avatar.UUID); | ||
3012 | |||
3013 | m_eventManager.TriggerOnNewPresence(avatar); | ||
3014 | |||
3015 | return avatar; | ||
3016 | } | ||
3017 | |||
3018 | /// <summary> | ||
3019 | /// Get the avatar apperance for the given client. | 2962 | /// Get the avatar apperance for the given client. |
3020 | /// </summary> | 2963 | /// </summary> |
3021 | /// <param name="client"></param> | 2964 | /// <param name="client"></param> |