diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs index 55c988f59f..f078de56b0 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs @@ -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 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 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))); } /// diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientView.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientView.cs index eba0445dc9..97bfdfadb6 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientView.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientView.cs @@ -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); diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncMessage.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncMessage.cs index 6d16e010ba..17f985a483 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncMessage.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncMessage.cs @@ -47,6 +47,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule GrabObject, GrabUpdate, DeGrabObject, + StartAnim, + StopAnim, GetTerrain, GetObjects, SubscribeObjects, diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs index 93b6e03305..3e6fd56c1c 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs @@ -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); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4d259865fc..7a359f651a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -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);