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) 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); 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(); 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"]; OSDArray animatA = (OSDArray)data["animations"];
UUID[] animIDs = new UUID[animatA.Count]; UUID[] animIDs = new UUID[animatA.Count];
@ -766,9 +766,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
ScenePresence sp; ScenePresence sp;
m_scene.TryGetScenePresence(agentID, out sp); m_scene.TryGetScenePresence(agentID, out sp);
if (sp != null) if (sp != null)
{
if (agentID == sourceAgentID)
{
sp.Animator.SendAnimPack(animIDs, seqs, objectIDs);
}
else
{ {
sp.ControllingClient.SendAnimations(animIDs, seqs, sourceAgentID, objectIDs); sp.ControllingClient.SendAnimations(animIDs, seqs, sourceAgentID, objectIDs);
} }
}
else else
{ {
m_log.WarnFormat("{0} Could not send animation for {1} because scene presence not found", m_log.WarnFormat("{0} Could not send animation for {1} because scene presence not found",
@ -1039,19 +1046,19 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public void HandleStartAnim(IClientAPI remoteClient, UUID animID) public void HandleStartAnim(IClientAPI remoteClient, UUID animID)
{ {
m_log.DebugFormat("[REGION SYNC CLIENT] HandleStartAnim for {0}", remoteClient.AgentId.ToString()); // m_log.DebugFormat("[REGION SYNC CLIENT] HandleStartAnim for {0}", remoteClient.AgentId.ToString());
OSDMap data = new OSDMap(3); OSDMap data = new OSDMap(3);
data["agentID"] = OSD.FromUUID(remoteClient.AgentId); data["agentID"] = OSD.FromUUID(remoteClient.AgentId);
data["animID"] = OSD.FromUUID(animID); data["id"] = OSD.FromUUID(animID);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.StartAnim, OSDParser.SerializeJsonString(data))); Send(new RegionSyncMessage(RegionSyncMessage.MsgType.StartAnim, OSDParser.SerializeJsonString(data)));
} }
public void HandleStopAnim(IClientAPI remoteClient, UUID animID) public void HandleStopAnim(IClientAPI remoteClient, UUID animID)
{ {
m_log.DebugFormat("[REGION SYNC CLIENT] HandleStopAnim for {0}", remoteClient.AgentId.ToString()); // m_log.DebugFormat("[REGION SYNC CLIENT] HandleStopAnim for {0}", remoteClient.AgentId.ToString());
OSDMap data = new OSDMap(3); OSDMap data = new OSDMap(3);
data["agentID"] = OSD.FromUUID(remoteClient.AgentId); data["agentID"] = OSD.FromUUID(remoteClient.AgentId);
data["animID"] = OSD.FromUUID(animID); data["id"] = OSD.FromUUID(animID);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.StopAnim, OSDParser.SerializeJsonString(data))); Send(new RegionSyncMessage(RegionSyncMessage.MsgType.StopAnim, OSDParser.SerializeJsonString(data)));
} }

View File

@ -590,13 +590,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
UUID agentID = data["agentID"].AsUUID(); UUID agentID = data["agentID"].AsUUID();
UUID animID = data["id"].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; ScenePresence sp;
m_scene.TryGetScenePresence(agentID, out sp); m_scene.TryGetScenePresence(agentID, out sp);
if (sp != null) if (sp != null)
{ {
sp.Animator.AddAnimation(animID, UUID.Zero); sp.HandleStartAnim(sp.ControllingClient, animID);
} }
return; return;
} }
@ -611,13 +611,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
UUID agentID = data["agentID"].AsUUID(); UUID agentID = data["agentID"].AsUUID();
UUID animID = data["id"].AsUUID(); UUID animID = data["id"].AsUUID();
m_log.DebugFormat("{0} AnimStop for {1}", LogHeader, agentID.ToString()); // m_log.DebugFormat("{0} AnimStop for {1}", LogHeader, agentID.ToString());
ScenePresence sp; ScenePresence sp;
m_scene.TryGetScenePresence(agentID, out sp); m_scene.TryGetScenePresence(agentID, out sp);
if (sp != null) if (sp != null)
{ {
sp.Animator.RemoveAnimation(animID); sp.HandleStopAnim(sp.ControllingClient, animID);
} }
return; return;
} }

View File

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

View File

@ -407,6 +407,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation
{ {
if (m_scenePresence.IsChildAgent) if (m_scenePresence.IsChildAgent)
return; 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( m_scenePresence.Scene.ForEachClient(
delegate(IClientAPI client) delegate(IClientAPI client)