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();
// 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];
@ -883,7 +883,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
client.OnAgentSit += HandleAgentSit;
client.OnGrabObject += HandleGrabObject;
client.OnGrabUpdate += HandleGrabUpdate;
client.OnDeGrabObject += HandleDeGrabObject;
client.OnDeGrabObject += HandleDeGrabObject;
client.OnStartAnim += HandleStartAnim;
client.OnStopAnim += HandleStopAnim;
}
public void EventManager_OnMakeChildAgent(ScenePresence scenep)
@ -894,6 +896,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap data = new OSDMap(1);
data["agentID"] = OSD.FromUUID(scenep.ControllingClient.AgentId);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AgentRemove, OSDParser.SerializeJsonString(data)));
// shouldn't we unsubscribe from all the events?
return;
}
@ -1022,16 +1025,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 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)));
}
/// <summary>

View File

@ -549,7 +549,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
UUID targetID = data["targetID"].AsUUID();
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;
m_scene.TryGetScenePresence(agentID, out sp);
@ -569,7 +569,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
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;
m_scene.TryGetScenePresence(agentID, out sp);
@ -579,6 +579,48 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
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:
{
OSDMap data = DeserializeMessage(msg);

View File

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

View File

@ -366,7 +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;
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));
m_server.Broadcast(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_controllingClient.OnAgentRequestSit += HandleAgentRequestSit;
m_controllingClient.OnAgentSit += HandleAgentSit;
m_controllingClient.OnStartAnim += HandleStartAnim;
m_controllingClient.OnStopAnim += HandleStopAnim;
}
m_controllingClient.OnRequestWearables += SendWearables;
@ -788,8 +790,6 @@ namespace OpenSim.Region.Framework.Scenes
//m_controllingClient.OnCompleteMovementToRegion += SendInitialData;
m_controllingClient.OnSetAlwaysRun += HandleSetAlwaysRun;
m_controllingClient.OnStartAnim += HandleStartAnim;
m_controllingClient.OnStopAnim += HandleStopAnim;
m_controllingClient.OnForceReleaseControls += HandleForceReleaseControls;
m_controllingClient.OnAutoPilotGo += DoAutoPilot;
m_controllingClient.AddGenericPacketHandler("autopilot", DoMoveToPosition);