Create full updates for making sit complete

dsg
Robert Adams 2010-10-25 13:32:53 -07:00
parent 5eca61585d
commit 838ffc27ed
5 changed files with 74 additions and 18 deletions

View File

@ -335,7 +335,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//m_scene.EventManager.OnFrame += Update;
}
public RegionSyncAvatar(Scene scene, UUID agentID, string first, string last, Vector3 startPos, RegionSyncClientView view)
public RegionSyncAvatar(Scene scene, UUID agentID, string first, string last, Vector3 startPos,
RegionSyncClientView view)
{
m_scene = scene;
m_agentID = agentID;
@ -493,23 +494,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
{
m_log.Debug("[REGION SYNC AVATAR] SendAnimations");
if (m_clientView != null)
{
OSDMap data = new OSDMap();
data["agentID"] = OSD.FromUUID(m_agentID);
OSDArray animatA = new OSDArray();
foreach (UUID uu in animations) animatA.Add(OSD.FromUUID(uu));
data["animations"] = animatA;
OSDArray seqsA = new OSDArray();
foreach (int ss in seqs) seqsA.Add(OSD.FromInteger(ss));
data["seqs"] = seqsA;
data["sourceAgentID"] = OSD.FromUUID(sourceAgentId);
OSDArray obIDA = new OSDArray();
foreach (UUID ii in objectIDs) obIDA.Add(OSD.FromUUID(ii));
data["objectIDs"] = obIDA;
RegionSyncMessage rsm = new RegionSyncMessage(RegionSyncMessage.MsgType.SendAnimations, OSDParser.SerializeJsonString(data));
m_clientView.Send(rsm);
// m_log.Debug("[REGION SYNC AVATAR] SendAnimations");
m_scene.RegionSyncServerModule.SendAnimations(m_agentID, animations, seqs, sourceAgentId, objectIDs);
}
}

View File

@ -408,6 +408,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
bool flying = false;
string anim = "";
uint flags = 0;
Vector4 collisionPlane = Vector4.Zero;
Vector3 offsetPosition = Vector3.Zero;
uint parentID = 0;
bool doFullUpdate = false;
try
{
@ -418,6 +422,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
flying = data["fly"].AsBoolean();
anim = data["anim"].AsString();
flags = data["flags"].AsUInteger();
// do we have the data for a full update?
OSD valTemp = null;
data.TryGetValue("coll", out valTemp);
if (valTemp != null)
{
collisionPlane = valTemp.AsVector4();
offsetPosition = data["off"].AsVector3();
parentID = data["pID"].AsUInteger();
doFullUpdate = true;
}
}
catch (Exception e)
{
@ -476,6 +490,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
presence.PhysicsActor.Flying = flying;
presence.PhysicsActor.CollidingGround = !flying;
}
if (doFullUpdate)
{
presence.CollisionPlane = collisionPlane;
presence.OffsetPosition = offsetPosition;
presence.ParentID = parentID;
}
}
catch(Exception e)
{
@ -483,7 +503,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
try
{
presence.SendTerseUpdateToAllClients();
if (doFullUpdate)
{
presence.SendFullUpdateToAllClients();
}
else
{
presence.SendTerseUpdateToAllClients();
}
}
catch (Exception e)
{
@ -720,6 +747,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
UUID agentID = data["agentID"].AsUUID();
// m_log.DebugFormat("{0} SendAnimations for {1}", LogHeader, agentID.ToString());
OSDArray animatA = (OSDArray)data["animations"];
UUID[] animIDs = new UUID[animatA.Count];
@ -741,6 +769,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{
sp.ControllingClient.SendAnimations(animIDs, seqs, sourceAgentID, objectIDs);
}
else
{
m_log.WarnFormat("{0} Could not send animation for {1} because scene presence not found",
LogHeader, agentID.ToString());
}
return;
}
case RegionSyncMessage.MsgType.BalanceClientLoad:

View File

@ -283,7 +283,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{
if (!presence.IsDeleted)
{
OSDMap data = new OSDMap(7);
OSDMap data = new OSDMap(10);
data["id"] = OSD.FromUUID(presence.UUID);
// Do not include offset for appearance height. That will be handled by RegionSyncClient before sending to viewers
if(presence.AbsolutePosition.IsFinite())
@ -298,6 +298,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["fly"] = OSD.FromBoolean(presence.Flying);
data["flags"] = OSD.FromUInteger((uint)presence.AgentControlFlags);
data["anim"] = OSD.FromString(presence.Animator.CurrentMovementAnimation);
// needed for a full update
if (presence.ParentID != presence.lastSentParentID)
{
data["coll"] = OSD.FromVector4(presence.CollisionPlane);
data["off"] = OSD.FromVector3(presence.OffsetPosition);
data["pID"] = OSD.FromUInteger(presence.ParentID);
presence.lastSentParentID = presence.ParentID;
}
RegionSyncMessage rsm = new RegionSyncMessage(RegionSyncMessage.MsgType.UpdatedAvatar, OSDParser.SerializeJsonString(data));
m_server.EnqueuePresenceUpdate(presence.UUID, rsm.ToBytes());
@ -344,6 +353,25 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_appearanceTimers[agentID] = appearanceSetter;
}
public void SendAnimations(UUID agentID, UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
{
OSDMap data = new OSDMap();
data["agentID"] = OSD.FromUUID(agentID);
OSDArray animatA = new OSDArray();
foreach (UUID uu in animations) animatA.Add(OSD.FromUUID(uu));
data["animations"] = animatA;
OSDArray seqsA = new OSDArray();
foreach (int ss in seqs) seqsA.Add(OSD.FromInteger(ss));
data["seqs"] = seqsA;
data["sourceAgentID"] = OSD.FromUUID(sourceAgentId);
OSDArray obIDA = new OSDArray();
foreach (UUID ii in objectIDs) obIDA.Add(OSD.FromUUID(ii));
data["objectIDs"] = obIDA;
RegionSyncMessage rsm = new RegionSyncMessage(RegionSyncMessage.MsgType.SendAnimations, OSDParser.SerializeJsonString(data));
m_server.Broadcast(rsm);
// m_clientView.Send(rsm);
}
public void DeleteObject(ulong regionHandle, uint localID, SceneObjectPart part)
{
if (!Active || !Synced)

View File

@ -44,6 +44,7 @@ namespace OpenSim.Region.Framework.Interfaces
//void DeleteObject(ulong regionHandle, uint localID);
void DeleteObject(ulong regionHandle, uint localID, SceneObjectPart part);
void SendAppearance(UUID agentID, byte[] vp, Primitive.TextureEntry te);
void SendAnimations(UUID agentID, UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
//KittyL: added to support remote script engine actor
//void SendRezScript(SceneObjectGroup sog);

View File

@ -126,6 +126,9 @@ namespace OpenSim.Region.Framework.Scenes
private Vector3 m_lastPosition;
private Quaternion m_lastRotation;
private Vector3 m_lastVelocity;
// RA: following kludge lets us remember if we need to send a full update
// Used in RegionSyncServerModule
public uint lastSentParentID;
//private int m_lastTerseSent;
private bool m_updateflag;
@ -2525,7 +2528,10 @@ namespace OpenSim.Region.Framework.Scenes
// REGION SYNC
// The server should not be doing anything via the ForEachScenePresence method
if (m_scene.IsSyncedServer())
{
m_scene.RegionSyncServerModule.QueuePresenceForTerseUpdate(this);
return;
}
m_perfMonMS = Util.EnvironmentTickCount();
// only send update from root agents to other clients; children are only "listening posts"