Partial passing of StartAnim and StopAnim through CM

dsg
Robert Adams 2010-10-25 15:52:41 -07:00
parent 838ffc27ed
commit 9f515cb623
5 changed files with 83 additions and 17 deletions

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];
@ -884,6 +884,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
client.OnGrabObject += HandleGrabObject; client.OnGrabObject += HandleGrabObject;
client.OnGrabUpdate += HandleGrabUpdate; client.OnGrabUpdate += HandleGrabUpdate;
client.OnDeGrabObject += HandleDeGrabObject; client.OnDeGrabObject += HandleDeGrabObject;
client.OnStartAnim += HandleStartAnim;
client.OnStopAnim += HandleStopAnim;
} }
public void EventManager_OnMakeChildAgent(ScenePresence scenep) public void EventManager_OnMakeChildAgent(ScenePresence scenep)
@ -894,6 +896,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap data = new OSDMap(1); OSDMap data = new OSDMap(1);
data["agentID"] = OSD.FromUUID(scenep.ControllingClient.AgentId); data["agentID"] = OSD.FromUUID(scenep.ControllingClient.AgentId);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AgentRemove, OSDParser.SerializeJsonString(data))); Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AgentRemove, OSDParser.SerializeJsonString(data)));
// shouldn't we unsubscribe from all the events?
return; return;
} }
@ -1034,6 +1037,24 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.DeGrabObject, OSDParser.SerializeJsonString(data))); 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)));
}
/// <summary> /// <summary>
/// Convert a list of SurfaceTouchEventArgs into an OSDArray for transmission. /// Convert a list of SurfaceTouchEventArgs into an OSDArray for transmission.
/// Return an array of maps which each are a list entry. /// Return an array of maps which each are a list entry.

View File

@ -549,7 +549,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
UUID targetID = data["targetID"].AsUUID(); UUID targetID = data["targetID"].AsUUID();
Vector3 offset = data["offset"].AsVector3(); Vector3 offset = data["offset"].AsVector3();
m_log.DebugFormat("{0} AgentRequestSit for {1}", LogHeader, agentID.ToString()); // m_log.DebugFormat("{0} AgentRequestSit for {1}", LogHeader, agentID.ToString());
ScenePresence sp; ScenePresence sp;
m_scene.TryGetScenePresence(agentID, out sp); m_scene.TryGetScenePresence(agentID, out sp);
@ -569,7 +569,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
UUID agentID = data["agentID"].AsUUID(); UUID agentID = data["agentID"].AsUUID();
m_log.DebugFormat("{0} AgentSit for {1}", LogHeader, agentID.ToString()); // m_log.DebugFormat("{0} AgentSit for {1}", LogHeader, agentID.ToString());
ScenePresence sp; ScenePresence sp;
m_scene.TryGetScenePresence(agentID, out sp); m_scene.TryGetScenePresence(agentID, out sp);
@ -579,6 +579,48 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
return; return;
} }
case RegionSyncMessage.MsgType.StartAnim:
{
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} AnimStart for {1}", LogHeader, agentID.ToString());
ScenePresence sp;
m_scene.TryGetScenePresence(agentID, out sp);
if (sp != null)
{
sp.Animator.AddAnimation(animID, UUID.Zero);
}
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: case RegionSyncMessage.MsgType.GrabObject:
{ {
OSDMap data = DeserializeMessage(msg); OSDMap data = DeserializeMessage(msg);

View File

@ -47,6 +47,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
GrabObject, GrabObject,
GrabUpdate, GrabUpdate,
DeGrabObject, DeGrabObject,
StartAnim,
StopAnim,
GetTerrain, GetTerrain,
GetObjects, GetObjects,
SubscribeObjects, SubscribeObjects,

View File

@ -367,6 +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());
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

@ -781,6 +781,8 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat("[SCENE PRESENCE]: Setting local handler for HandleAgentRequestSit"); //RA m_log.DebugFormat("[SCENE PRESENCE]: Setting local handler for HandleAgentRequestSit"); //RA
m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit; m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit;
m_controllingClient.OnAgentSit += HandleAgentSit; m_controllingClient.OnAgentSit += HandleAgentSit;
m_controllingClient.OnStartAnim += HandleStartAnim;
m_controllingClient.OnStopAnim += HandleStopAnim;
} }
m_controllingClient.OnRequestWearables += SendWearables; m_controllingClient.OnRequestWearables += SendWearables;
@ -788,8 +790,6 @@ namespace OpenSim.Region.Framework.Scenes
//m_controllingClient.OnCompleteMovementToRegion += SendInitialData; //m_controllingClient.OnCompleteMovementToRegion += SendInitialData;
m_controllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; m_controllingClient.OnSetAlwaysRun += HandleSetAlwaysRun;
m_controllingClient.OnStartAnim += HandleStartAnim;
m_controllingClient.OnStopAnim += HandleStopAnim;
m_controllingClient.OnForceReleaseControls += HandleForceReleaseControls; m_controllingClient.OnForceReleaseControls += HandleForceReleaseControls;
m_controllingClient.OnAutoPilotGo += DoAutoPilot; m_controllingClient.OnAutoPilotGo += DoAutoPilot;
m_controllingClient.AddGenericPacketHandler("autopilot", DoMoveToPosition); m_controllingClient.AddGenericPacketHandler("autopilot", DoMoveToPosition);