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).viewer-2-initial-appearance
parent
c4727645b8
commit
240c0eaf1d
|
@ -498,12 +498,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get { return m_sceneGraph.Entities; }
|
get { return m_sceneGraph.Entities; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<UUID, ScenePresence> m_restorePresences
|
|
||||||
{
|
|
||||||
get { return m_sceneGraph.RestorePresences; }
|
|
||||||
set { m_sceneGraph.RestorePresences = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Properties
|
#endregion Properties
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
@ -2483,37 +2477,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
(aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
|
(aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
|
||||||
|
|
||||||
CheckHeartbeat();
|
CheckHeartbeat();
|
||||||
ScenePresence presence;
|
|
||||||
|
|
||||||
if (m_restorePresences.ContainsKey(client.AgentId))
|
|
||||||
{
|
|
||||||
m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName);
|
|
||||||
|
|
||||||
m_clientManager.Add(client);
|
|
||||||
SubscribeToClientEvents(client);
|
|
||||||
|
|
||||||
presence = m_restorePresences[client.AgentId];
|
|
||||||
m_restorePresences.Remove(client.AgentId);
|
|
||||||
|
|
||||||
// This is one of two paths to create avatars that are
|
|
||||||
// used. This tends to get called more in standalone
|
|
||||||
// than grid, not really sure why, but as such needs
|
|
||||||
// an explicity appearance lookup here.
|
|
||||||
AvatarAppearance appearance = null;
|
|
||||||
GetAvatarAppearance(client, out appearance);
|
|
||||||
presence.Appearance = appearance;
|
|
||||||
|
|
||||||
presence.initializeScenePresence(client, RegionInfo, this);
|
|
||||||
|
|
||||||
m_sceneGraph.AddScenePresence(presence);
|
|
||||||
|
|
||||||
lock (m_restorePresences)
|
|
||||||
{
|
|
||||||
Monitor.PulseAll(m_restorePresences);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
|
if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
|
||||||
{
|
{
|
||||||
m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
|
m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
|
||||||
|
@ -2521,20 +2485,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_clientManager.Add(client);
|
m_clientManager.Add(client);
|
||||||
SubscribeToClientEvents(client);
|
SubscribeToClientEvents(client);
|
||||||
|
|
||||||
ScenePresence sp = CreateAndAddScenePresence(client);
|
ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance);
|
||||||
if (aCircuit != null)
|
m_eventManager.TriggerOnNewPresence(sp);
|
||||||
sp.Appearance = aCircuit.Appearance;
|
|
||||||
|
|
||||||
// HERE!!! Do the initial attachments right here
|
// HERE!!! Do the initial attachments right here
|
||||||
// first agent upon login is a root agent by design.
|
// first agent upon login is a root agent by design.
|
||||||
// All other AddNewClient calls find aCircuit.child to be true
|
// All other AddNewClient calls find aCircuit.child to be true
|
||||||
if (aCircuit == null || (aCircuit != null && aCircuit.child == false))
|
if (aCircuit.child == false)
|
||||||
{
|
{
|
||||||
sp.IsChildAgent = false;
|
sp.IsChildAgent = false;
|
||||||
Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
|
Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (GetScenePresence(client.AgentId) != null)
|
if (GetScenePresence(client.AgentId) != null)
|
||||||
{
|
{
|
||||||
|
@ -2996,25 +2958,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed.");
|
m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create a child agent scene presence and add it to this scene.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="client"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
|
|
||||||
{
|
|
||||||
CheckHeartbeat();
|
|
||||||
AvatarAppearance appearance = null;
|
|
||||||
GetAvatarAppearance(client, out appearance);
|
|
||||||
|
|
||||||
ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance);
|
|
||||||
//avatar.KnownRegions = GetChildrenSeeds(avatar.UUID);
|
|
||||||
|
|
||||||
m_eventManager.TriggerOnNewPresence(avatar);
|
|
||||||
|
|
||||||
return avatar;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the avatar apperance for the given client.
|
/// Get the avatar apperance for the given client.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -73,7 +73,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>();
|
protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>();
|
||||||
|
|
||||||
protected internal EntityManager Entities = new EntityManager();
|
protected internal EntityManager Entities = new EntityManager();
|
||||||
protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>();
|
|
||||||
|
|
||||||
protected RegionInfo m_regInfo;
|
protected RegionInfo m_regInfo;
|
||||||
protected Scene m_parentScene;
|
protected Scene m_parentScene;
|
||||||
|
@ -564,8 +563,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
ScenePresence newAvatar = null;
|
ScenePresence newAvatar = null;
|
||||||
|
|
||||||
|
// ScenePresence always defaults to child agent
|
||||||
newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance);
|
newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance);
|
||||||
newAvatar.IsChildAgent = true;
|
|
||||||
|
|
||||||
AddScenePresence(newAvatar);
|
AddScenePresence(newAvatar);
|
||||||
|
|
||||||
|
@ -578,6 +577,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="presence"></param>
|
/// <param name="presence"></param>
|
||||||
protected internal void AddScenePresence(ScenePresence presence)
|
protected internal void AddScenePresence(ScenePresence presence)
|
||||||
{
|
{
|
||||||
|
// Always a child when added to the scene
|
||||||
bool child = presence.IsChildAgent;
|
bool child = presence.IsChildAgent;
|
||||||
|
|
||||||
if (child)
|
if (child)
|
||||||
|
|
Loading…
Reference in New Issue