Animations to multiple CMs (including idle anims) are working

dsg
Robert Adams 2010-10-26 12:22:09 -07:00
parent 9f515cb623
commit 46a01d9550
5 changed files with 73 additions and 59 deletions

View File

@ -496,7 +496,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{
if (m_clientView != null)
{
// m_log.Debug("[REGION SYNC AVATAR] SendAnimations");
// m_log.DebugFormat("[REGION SYNC AVATAR] SendAnimations for {0}", m_agentID.ToString());
m_scene.RegionSyncServerModule.SendAnimations(m_agentID, animations, seqs, sourceAgentId, objectIDs);
}
}

View File

@ -747,7 +747,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
UUID agentID = data["agentID"].AsUUID();
m_log.DebugFormat("{0} SendAnimations for {1}", LogHeader, agentID.ToString());
// m_log.DebugFormat("{0} SendAnimations for {1}", LogHeader, agentID.ToString());
OSDArray animatA = (OSDArray)data["animations"];
UUID[] animIDs = new UUID[animatA.Count];
@ -767,7 +767,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_scene.TryGetScenePresence(agentID, out sp);
if (sp != null)
{
sp.ControllingClient.SendAnimations(animIDs, seqs, sourceAgentID, objectIDs);
if (agentID == sourceAgentID)
{
sp.Animator.SendAnimPack(animIDs, seqs, objectIDs);
}
else
{
sp.ControllingClient.SendAnimations(animIDs, seqs, sourceAgentID, objectIDs);
}
}
else
{
@ -883,8 +890,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
client.OnAgentSit += HandleAgentSit;
client.OnGrabObject += HandleGrabObject;
client.OnGrabUpdate += HandleGrabUpdate;
client.OnDeGrabObject += HandleDeGrabObject;
client.OnStartAnim += HandleStartAnim;
client.OnDeGrabObject += HandleDeGrabObject;
client.OnStartAnim += HandleStartAnim;
client.OnStopAnim += HandleStopAnim;
}
@ -1025,34 +1032,34 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["pos"] = OSD.FromVector3(pos);
data["surfaceArgs"] = MakeSurfaceArgsArray(surfaceArgs);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.GrabUpdate, OSDParser.SerializeJsonString(data)));
}
public void HandleDeGrabObject(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
{
m_log.DebugFormat("[REGION SYNC CLIENT] HandleDeGrabObject for {0}", remoteClient.AgentId.ToString());
OSDMap data = new OSDMap(3);
data["agentID"] = OSD.FromUUID(remoteClient.AgentId);
data["localID"] = OSD.FromUInteger(localID);
data["surfaceArgs"] = MakeSurfaceArgsArray(surfaceArgs);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.DeGrabObject, OSDParser.SerializeJsonString(data)));
}
public void HandleStartAnim(IClientAPI remoteClient, UUID animID)
{
m_log.DebugFormat("[REGION SYNC CLIENT] HandleStartAnim for {0}", remoteClient.AgentId.ToString());
OSDMap data = new OSDMap(3);
data["agentID"] = OSD.FromUUID(remoteClient.AgentId);
data["animID"] = OSD.FromUUID(animID);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.StartAnim, OSDParser.SerializeJsonString(data)));
}
public void HandleStopAnim(IClientAPI remoteClient, UUID animID)
{
m_log.DebugFormat("[REGION SYNC CLIENT] HandleStopAnim for {0}", remoteClient.AgentId.ToString());
OSDMap data = new OSDMap(3);
data["agentID"] = OSD.FromUUID(remoteClient.AgentId);
data["animID"] = OSD.FromUUID(animID);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.StopAnim, OSDParser.SerializeJsonString(data)));
}
public void HandleDeGrabObject(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
{
m_log.DebugFormat("[REGION SYNC CLIENT] HandleDeGrabObject for {0}", remoteClient.AgentId.ToString());
OSDMap data = new OSDMap(3);
data["agentID"] = OSD.FromUUID(remoteClient.AgentId);
data["localID"] = OSD.FromUInteger(localID);
data["surfaceArgs"] = MakeSurfaceArgsArray(surfaceArgs);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.DeGrabObject, OSDParser.SerializeJsonString(data)));
}
public void HandleStartAnim(IClientAPI remoteClient, UUID animID)
{
// m_log.DebugFormat("[REGION SYNC CLIENT] HandleStartAnim for {0}", remoteClient.AgentId.ToString());
OSDMap data = new OSDMap(3);
data["agentID"] = OSD.FromUUID(remoteClient.AgentId);
data["id"] = OSD.FromUUID(animID);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.StartAnim, OSDParser.SerializeJsonString(data)));
}
public void HandleStopAnim(IClientAPI remoteClient, UUID animID)
{
// m_log.DebugFormat("[REGION SYNC CLIENT] HandleStopAnim for {0}", remoteClient.AgentId.ToString());
OSDMap data = new OSDMap(3);
data["agentID"] = OSD.FromUUID(remoteClient.AgentId);
data["id"] = OSD.FromUUID(animID);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.StopAnim, OSDParser.SerializeJsonString(data)));
}
/// <summary>

View File

@ -587,39 +587,39 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
RegionSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data.");
return;
}
UUID agentID = data["agentID"].AsUUID();
UUID agentID = data["agentID"].AsUUID();
UUID animID = data["id"].AsUUID();
m_log.DebugFormat("{0} AnimStart for {1}", LogHeader, agentID.ToString());
// m_log.DebugFormat("{0} AnimStart for {1}", LogHeader, agentID.ToString());
ScenePresence sp;
m_scene.TryGetScenePresence(agentID, out sp);
if (sp != null)
{
sp.Animator.AddAnimation(animID, UUID.Zero);
sp.HandleStartAnim(sp.ControllingClient, animID);
}
return;
}
case RegionSyncMessage.MsgType.StopAnim:
{
OSDMap data = DeserializeMessage(msg);
if (data == null)
{
RegionSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data.");
return;
}
UUID agentID = data["agentID"].AsUUID();
UUID animID = data["id"].AsUUID();
// m_log.DebugFormat("{0} AnimStop for {1}", LogHeader, agentID.ToString());
ScenePresence sp;
m_scene.TryGetScenePresence(agentID, out sp);
if (sp != null)
{
sp.HandleStopAnim(sp.ControllingClient, animID);
}
return;
}
case RegionSyncMessage.MsgType.StopAnim:
{
OSDMap data = DeserializeMessage(msg);
if (data == null)
{
RegionSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data.");
return;
}
UUID agentID = data["agentID"].AsUUID();
UUID animID = data["id"].AsUUID();
m_log.DebugFormat("{0} AnimStop for {1}", LogHeader, agentID.ToString());
ScenePresence sp;
m_scene.TryGetScenePresence(agentID, out sp);
if (sp != null)
{
sp.Animator.RemoveAnimation(animID);
}
return;
}
case RegionSyncMessage.MsgType.GrabObject:
{

View File

@ -366,8 +366,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["sourceAgentID"] = OSD.FromUUID(sourceAgentId);
OSDArray obIDA = new OSDArray();
foreach (UUID ii in objectIDs) obIDA.Add(OSD.FromUUID(ii));
data["objectIDs"] = obIDA;
m_log.DebugFormat("[REGION SYNC SERVER MODULE] Broadcast animations to {0}", agentID.ToString());
data["objectIDs"] = obIDA;
// m_log.DebugFormat("[REGION SYNC SERVER MODULE] Broadcast animations for {0}", agentID.ToString());
RegionSyncMessage rsm = new RegionSyncMessage(RegionSyncMessage.MsgType.SendAnimations, OSDParser.SerializeJsonString(data));
m_server.Broadcast(rsm);
// m_clientView.Send(rsm);

View File

@ -407,6 +407,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation
{
if (m_scenePresence.IsChildAgent)
return;
if (m_scenePresence.Scene.IsSyncedServer())
{
m_scenePresence.Scene.RegionSyncServerModule.SendAnimations(
m_scenePresence.ControllingClient.AgentId, animations, seqs,
m_scenePresence.ControllingClient.AgentId, objectIDs);
return;
}
m_scenePresence.Scene.ForEachClient(
delegate(IClientAPI client)