Stop some places where we're trying to reset animations in child agents where such requests are ignored.

iar_mods
Justin Clark-Casey (justincc) 2011-12-02 23:56:01 +00:00
parent 2a6597f61e
commit 054ebe8878
4 changed files with 133 additions and 116 deletions

View File

@ -495,7 +495,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Well, this is it. The agent is over there.
KillEntity(sp.Scene, sp.LocalId);
// Now let's make it officially a child agent
sp.MakeChildAgent();
@ -510,9 +509,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Scene.IncomingCloseAgent(sp.UUID);
}
else
{
// now we have a child agent in this region.
sp.Reset();
}
// REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
if (sp.Scene.NeedSceneCacheClear(sp.UUID))
@ -946,111 +946,121 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion,
bool isFlying, string version)
{
ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version);
Scene m_scene = agent.Scene;
if (neighbourRegion != null)
try
{
if (!agent.ValidateAttachments())
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.",
agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName);
ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
pos = pos + (agent.Velocity);
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} to {2}-{3} running version {4}", agent.Firstname, agent.Lastname, neighbourx, neighboury, version);
SetInTransit(agent.UUID);
AgentData cAgent = new AgentData();
agent.CopyTo(cAgent);
cAgent.Position = pos;
if (isFlying)
cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
cAgent.CallbackURI = m_scene.RegionInfo.ServerURI +
"agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
Scene m_scene = agent.Scene;
if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
if (neighbourRegion != null)
{
// region doesn't take it
ReInstantiateScripts(agent);
ResetFromTransit(agent.UUID);
return agent;
if (!agent.ValidateAttachments())
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Failed validation of all attachments for region crossing of {0} from {1} to {2}. Continuing.",
agent.Name, agent.Scene.RegionInfo.RegionName, neighbourRegion.RegionName);
pos = pos + (agent.Velocity);
SetInTransit(agent.UUID);
AgentData cAgent = new AgentData();
agent.CopyTo(cAgent);
cAgent.Position = pos;
if (isFlying)
cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
cAgent.CallbackURI = m_scene.RegionInfo.ServerURI +
"agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
{
// region doesn't take it
ReInstantiateScripts(agent);
ResetFromTransit(agent.UUID);
return agent;
}
// Next, let's close the child agent connections that are too far away.
agent.CloseChildAgents(neighbourx, neighboury);
//AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
agent.ControllingClient.RequestClientInfo();
//m_log.Debug("BEFORE CROSS");
//Scene.DumpChildrenSeeds(UUID);
//DumpKnownRegions();
string agentcaps;
if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps))
{
m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.",
neighbourRegion.RegionHandle);
return agent;
}
string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>();
if (eq != null)
{
eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
capsPath, agent.UUID, agent.ControllingClient.SessionId);
}
else
{
agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
capsPath);
}
if (!WaitForCallback(agent.UUID))
{
m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent");
ReInstantiateScripts(agent);
ResetFromTransit(agent.UUID);
// Yikes! We should just have a ref to scene here.
//agent.Scene.InformClientOfNeighbours(agent);
EnableChildAgents(agent);
return agent;
}
agent.MakeChildAgent();
// now we have a child agent in this region. Request all interesting data about other (root) agents
agent.SendOtherAgentsAvatarDataToMe();
agent.SendOtherAgentsAppearanceToMe();
// Backwards compatibility
if (version == "Unknown" || version == string.Empty)
{
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one...");
CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
}
AgentHasMovedAway(agent, false);
// the user may change their profile information in other region,
// so the userinfo in UserProfileCache is not reliable any more, delete it
// REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
if (agent.Scene.NeedSceneCacheClear(agent.UUID))
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID);
}
}
// Next, let's close the child agent connections that are too far away.
agent.CloseChildAgents(neighbourx, neighboury);
//AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo();
agent.ControllingClient.RequestClientInfo();
//m_log.Debug("BEFORE CROSS");
//m_log.Debug("AFTER CROSS");
//Scene.DumpChildrenSeeds(UUID);
//DumpKnownRegions();
string agentcaps;
if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps))
{
m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.",
neighbourRegion.RegionHandle);
return agent;
}
string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>();
if (eq != null)
{
eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
capsPath, agent.UUID, agent.ControllingClient.SessionId);
}
else
{
agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
capsPath);
}
if (!WaitForCallback(agent.UUID))
{
m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent");
ReInstantiateScripts(agent);
ResetFromTransit(agent.UUID);
// Yikes! We should just have a ref to scene here.
//agent.Scene.InformClientOfNeighbours(agent);
EnableChildAgents(agent);
return agent;
}
agent.MakeChildAgent();
// now we have a child agent in this region. Request all interesting data about other (root) agents
agent.SendOtherAgentsAvatarDataToMe();
agent.SendOtherAgentsAppearanceToMe();
// Backwards compatibility
if (version == "Unknown" || version == string.Empty)
{
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Old neighbor, passing attachments one by one...");
CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
}
AgentHasMovedAway(agent, false);
// the user may change their profile information in other region,
// so the userinfo in UserProfileCache is not reliable any more, delete it
// REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
if (agent.Scene.NeedSceneCacheClear(agent.UUID))
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID);
}
}
catch (Exception e)
{
m_log.ErrorFormat(
"[ENTITY TRANSFER MODULE]: Problem crossing user {0} to new region {1} from {2}. Exception {3}{4}",
agent.Name, neighbourRegion.RegionName, agent.Scene.RegionInfo.RegionName, e.Message, e.StackTrace);
}
//m_log.Debug("AFTER CROSS");
//Scene.DumpChildrenSeeds(UUID);
//DumpKnownRegions();
return agent;
}

View File

@ -131,8 +131,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
public void ResetAnimations()
{
// m_log.DebugFormat(
// "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}",
// m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName);
m_animations.Clear();
TrySetMovementAnimation("STAND");
}
/// <summary>
@ -155,6 +158,14 @@ namespace OpenSim.Region.Framework.Scenes.Animation
SendAnimPack();
}
}
// Don't leave this on since on teleports SP.HandleAgentUpdate() still hammers us for a while after it teleports
// else
// {
// m_log.WarnFormat(
// "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}",
// anim, m_scenePresence.Name);
// throw new Exception(string.Format("aaargh on setting {0}", anim));
// }
}
/// <summary>

View File

@ -3700,7 +3700,6 @@ namespace OpenSim.Region.Framework.Scenes
return false;
}
ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
if (childAgentUpdate != null)

View File

@ -995,13 +995,17 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// This turns a root agent into a child agent
/// </summary>
/// <remarks>
/// when an agent departs this region for a neighbor, this gets called.
///
/// It doesn't get called for a teleport. Reason being, an agent that
/// teleports out may not end up anywhere near this region
/// </summary>
/// </remarks>
public void MakeChildAgent()
{
m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName);
// Reset these so that teleporting in and walking out isn't seen
// as teleporting back
TeleportFlags = TeleportFlags.Default;
@ -2295,11 +2299,6 @@ namespace OpenSim.Region.Framework.Scenes
{
m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.
Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
// TODO: This doesn't prevent the user from walking yet.
// Setting parent ID would fix this, if we knew what value
// to use. Or we could add a m_isSitting variable.
//Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
SitGround = true;
RemoveFromPhysicalScene();
}
@ -2908,9 +2907,12 @@ namespace OpenSim.Region.Framework.Scenes
public void Reset()
{
// m_log.DebugFormat("[SCENE PRESENCE]: Resetting {0} in {1}", Name, Scene.RegionInfo.RegionName);
// Put the child agent back at the center
AbsolutePosition
= new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70);
Animator.ResetAnimations();
}
@ -3133,7 +3135,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void CopyFrom(AgentData cAgent)
private void CopyFrom(AgentData cAgent)
{
m_originRegionID = cAgent.RegionID;
@ -3192,13 +3194,8 @@ namespace OpenSim.Region.Framework.Scenes
}
}
catch { }
// Animations
try
{
Animator.ResetAnimations();
Animator.Animations.FromArray(cAgent.Anims);
}
catch { }
Animator.Animations.FromArray(cAgent.Anims);
if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
{