diff options
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 77 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 4 |
2 files changed, 12 insertions, 69 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9bad644..56eaf06 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -516,12 +516,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
516 | get { return m_sceneGraph.Entities; } | 516 | get { return m_sceneGraph.Entities; } |
517 | } | 517 | } |
518 | 518 | ||
519 | public Dictionary<UUID, ScenePresence> m_restorePresences | ||
520 | { | ||
521 | get { return m_sceneGraph.RestorePresences; } | ||
522 | set { m_sceneGraph.RestorePresences = value; } | ||
523 | } | ||
524 | |||
525 | #endregion Properties | 519 | #endregion Properties |
526 | 520 | ||
527 | #region Constructors | 521 | #region Constructors |
@@ -2584,56 +2578,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2584 | (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2578 | (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2585 | 2579 | ||
2586 | CheckHeartbeat(); | 2580 | CheckHeartbeat(); |
2587 | ScenePresence presence; | ||
2588 | 2581 | ||
2589 | if (m_restorePresences.ContainsKey(client.AgentId)) | 2582 | if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here |
2590 | { | 2583 | { |
2591 | m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName); | 2584 | m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); |
2592 | 2585 | ||
2593 | m_clientManager.Add(client); | 2586 | m_clientManager.Add(client); |
2594 | SubscribeToClientEvents(client); | 2587 | SubscribeToClientEvents(client); |
2595 | 2588 | ||
2596 | presence = m_restorePresences[client.AgentId]; | 2589 | ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance); |
2597 | m_restorePresences.Remove(client.AgentId); | 2590 | m_eventManager.TriggerOnNewPresence(sp); |
2598 | |||
2599 | // This is one of two paths to create avatars that are | ||
2600 | // used. This tends to get called more in standalone | ||
2601 | // than grid, not really sure why, but as such needs | ||
2602 | // an explicity appearance lookup here. | ||
2603 | AvatarAppearance appearance = null; | ||
2604 | GetAvatarAppearance(client, out appearance); | ||
2605 | presence.Appearance = appearance; | ||
2606 | |||
2607 | presence.initializeScenePresence(client, RegionInfo, this); | ||
2608 | |||
2609 | m_sceneGraph.AddScenePresence(presence); | ||
2610 | 2591 | ||
2611 | lock (m_restorePresences) | 2592 | // HERE!!! Do the initial attachments right here |
2593 | // first agent upon login is a root agent by design. | ||
2594 | // All other AddNewClient calls find aCircuit.child to be true | ||
2595 | if (aCircuit.child == false) | ||
2612 | { | 2596 | { |
2613 | Monitor.PulseAll(m_restorePresences); | 2597 | sp.IsChildAgent = false; |
2614 | } | 2598 | Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); |
2615 | } | ||
2616 | else | ||
2617 | { | ||
2618 | if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here | ||
2619 | { | ||
2620 | m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); | ||
2621 | |||
2622 | m_clientManager.Add(client); | ||
2623 | SubscribeToClientEvents(client); | ||
2624 | |||
2625 | ScenePresence sp = CreateAndAddScenePresence(client); | ||
2626 | if (aCircuit != null) | ||
2627 | sp.Appearance = aCircuit.Appearance; | ||
2628 | |||
2629 | // HERE!!! Do the initial attachments right here | ||
2630 | // first agent upon login is a root agent by design. | ||
2631 | // All other AddNewClient calls find aCircuit.child to be true | ||
2632 | if (aCircuit == null || (aCircuit != null && aCircuit.child == false)) | ||
2633 | { | ||
2634 | sp.IsChildAgent = false; | ||
2635 | Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); | ||
2636 | } | ||
2637 | } | 2599 | } |
2638 | } | 2600 | } |
2639 | 2601 | ||
@@ -3110,25 +3072,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3110 | } | 3072 | } |
3111 | 3073 | ||
3112 | /// <summary> | 3074 | /// <summary> |
3113 | /// Create a child agent scene presence and add it to this scene. | ||
3114 | /// </summary> | ||
3115 | /// <param name="client"></param> | ||
3116 | /// <returns></returns> | ||
3117 | protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) | ||
3118 | { | ||
3119 | CheckHeartbeat(); | ||
3120 | AvatarAppearance appearance = null; | ||
3121 | GetAvatarAppearance(client, out appearance); | ||
3122 | |||
3123 | ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance); | ||
3124 | //avatar.KnownRegions = GetChildrenSeeds(avatar.UUID); | ||
3125 | |||
3126 | m_eventManager.TriggerOnNewPresence(avatar); | ||
3127 | |||
3128 | return avatar; | ||
3129 | } | ||
3130 | |||
3131 | /// <summary> | ||
3132 | /// Get the avatar apperance for the given client. | 3075 | /// Get the avatar apperance for the given client. |
3133 | /// </summary> | 3076 | /// </summary> |
3134 | /// <param name="client"></param> | 3077 | /// <param name="client"></param> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 7eebb99..92fe2ab 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -82,7 +82,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
82 | protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>(); | 82 | protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>(); |
83 | 83 | ||
84 | protected internal EntityManager Entities = new EntityManager(); | 84 | protected internal EntityManager Entities = new EntityManager(); |
85 | protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>(); | ||
86 | 85 | ||
87 | protected RegionInfo m_regInfo; | 86 | protected RegionInfo m_regInfo; |
88 | protected Scene m_parentScene; | 87 | protected Scene m_parentScene; |
@@ -629,8 +628,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
629 | { | 628 | { |
630 | ScenePresence newAvatar = null; | 629 | ScenePresence newAvatar = null; |
631 | 630 | ||
631 | // ScenePresence always defaults to child agent | ||
632 | newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); | 632 | newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); |
633 | newAvatar.IsChildAgent = true; | ||
634 | 633 | ||
635 | AddScenePresence(newAvatar); | 634 | AddScenePresence(newAvatar); |
636 | 635 | ||
@@ -643,6 +642,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
643 | /// <param name="presence"></param> | 642 | /// <param name="presence"></param> |
644 | protected internal void AddScenePresence(ScenePresence presence) | 643 | protected internal void AddScenePresence(ScenePresence presence) |
645 | { | 644 | { |
645 | // Always a child when added to the scene | ||
646 | bool child = presence.IsChildAgent; | 646 | bool child = presence.IsChildAgent; |
647 | 647 | ||
648 | if (child) | 648 | if (child) |