diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs index 91d3ca6bae..1b2df520a2 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs @@ -883,13 +883,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule // Register for interesting client events which will be forwarded to auth sim // These are the raw packet data blocks from the client, intercepted and sent up to the sim client.OnAgentUpdateRaw += HandleAgentUpdateRaw; - //SYMMETRIC SYNC: do not subscribe to OnChatFromClientRaw, we may remove this event entirely later + //SYMMETRIC SYNC: do not subscribe to OnChatFromClientRaw: RegionSyncModule + Scene.EventManager will handle this. //client.OnChatFromClientRaw += HandleChatFromClientRaw; client.OnAgentRequestSit += HandleAgentRequestSit; client.OnAgentSit += HandleAgentSit; - client.OnGrabObject += HandleGrabObject; - client.OnGrabUpdate += HandleGrabUpdate; - client.OnDeGrabObject += HandleDeGrabObject; + //SYMMETRIC SYNC: do not subscribe to OnGrabObject, OnGrabUpdate, and OnDeGrabObject: RegionSyncModule + Scene.EventManager will handle this. + //client.OnGrabObject += HandleGrabObject; + //client.OnGrabUpdate += HandleGrabUpdate; + //client.OnDeGrabObject += HandleDeGrabObject; client.OnStartAnim += HandleStartAnim; client.OnStopAnim += HandleStopAnim; } diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs old mode 100755 new mode 100644 index 42bd59426f..5047b13ee1 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -854,6 +854,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule case SymmetricSyncMessage.MsgType.ScriptReset: case SymmetricSyncMessage.MsgType.ChatFromClient: case SymmetricSyncMessage.MsgType.ChatFromWorld: + case SymmetricSyncMessage.MsgType.ObjectGrab: + case SymmetricSyncMessage.MsgType.ObjectGrabbing: + case SymmetricSyncMessage.MsgType.ObjectDeGrab: { HandleRemoteEvent(msg); return; @@ -932,29 +935,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SendSyncMessage(SymmetricSyncMessage.MsgType.Terrain, OSDParser.SerializeJsonString(data)); } - private void HandleRemovedObject(SymmetricSyncMessage msg) - { - // Get the data from message and error check - OSDMap data = DeserializeMessage(msg); - if (data == null) - { - - SymmetricSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data."); - return; - } - - // Get the parameters from data - //ulong regionHandle = data["regionHandle"].AsULong(); - //uint localID = data["UUID"].AsUInteger(); - UUID sogUUID = data["UUID"].AsUUID(); - - SceneObjectGroup sog = m_scene.SceneGraph.GetGroupByPrim(sogUUID); - if (sog != null) - { - m_scene.DeleteSceneObjectBySynchronization(sog); - } - } HashSet exceptions = new HashSet(); private OSDMap DeserializeMessage(SymmetricSyncMessage msg) @@ -987,6 +968,34 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + private void HandleRemovedObject(SymmetricSyncMessage msg) + { + // Get the data from message and error check + OSDMap data = DeserializeMessage(msg); + string init_actorID = data["actorID"].AsString(); + + if (data == null) + { + + SymmetricSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data."); + return; + } + + UUID sogUUID = data["UUID"].AsUUID(); + + SceneObjectGroup sog = m_scene.SceneGraph.GetGroupByPrim(sogUUID); + if (sog != null) + { + m_scene.DeleteSceneObjectBySynchronization(sog); + } + + //if this is a relay node, forwards the event + if (m_isSyncRelay) + { + SendSceneEventToRelevantSyncConnectors(init_actorID, msg); + } + } + /// /// The common actions for handling remote events (event initiated at other actors and propogated here) /// @@ -1011,6 +1020,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule case SymmetricSyncMessage.MsgType.ChatFromWorld: HandleRemoteEvent_OnChatFromWorld(init_actorID, evSeqNum, data); break; + case SymmetricSyncMessage.MsgType.ObjectGrab: + HandleRemoteEvent_OnObjectGrab(init_actorID, evSeqNum, data); + break; + case SymmetricSyncMessage.MsgType.ObjectGrabbing: + HandleRemoteEvent_OnObjectGrabbing(init_actorID, evSeqNum, data); + break; + case SymmetricSyncMessage.MsgType.ObjectDeGrab: + HandleRemoteEvent_OnObjectDeGrab(init_actorID, evSeqNum, data); + break; } //if this is a relay node, forwards the event @@ -1102,10 +1120,125 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_scene.EventManager.TriggerOnChatFromWorldLocally(m_scene, args); } + /// + /// Special actions for remote event ChatFromClient + /// + /// OSDMap data of event args + private void HandleRemoteEvent_OnObjectGrab(string actorID, ulong evSeqNum, OSDMap data) + { + m_log.Debug(LogHeader + ", " + m_actorID + ": received GrabObject from " + actorID + ", seq " + evSeqNum); + + + UUID agentID = data["agentID"].AsUUID(); + UUID primID = data["primID"].AsUUID(); + UUID originalPrimID = data["originalPrimID"].AsUUID(); + Vector3 offsetPos = data["offsetPos"].AsVector3(); + SurfaceTouchEventArgs surfaceArgs = new SurfaceTouchEventArgs(); + surfaceArgs.Binormal = data["binormal"].AsVector3(); + surfaceArgs.FaceIndex = data["faceIndex"].AsInteger(); + surfaceArgs.Normal = data["normal"].AsVector3(); + surfaceArgs.Position = data["position"].AsVector3(); + surfaceArgs.STCoord = data["stCoord"].AsVector3(); + surfaceArgs.UVCoord = data["uvCoord"].AsVector3(); + + //Create an instance of IClientAPI to pass along agentID, see SOPObject.EventManager_OnObjectGrab() + //We don't really need RegionSyncAvatar's implementation here, just borrow it's IClientAPI interface. + //If we decide to remove RegionSyncAvatar later, we can simple just define a very simple class that implements + //ICleintAPI to be used here. + IClientAPI remoteClinet = new RegionSyncAvatar(m_scene, agentID, "", "", Vector3.Zero); + SceneObjectPart part = m_scene.GetSceneObjectPart(primID); + if (part == null) + { + m_log.Error(LogHeader + ": no prim with ID " + primID); + return; + } + uint originalID = 0; + if (originalPrimID != UUID.Zero) + { + SceneObjectPart originalPart = m_scene.GetSceneObjectPart(originalPrimID); + originalID = originalPart.LocalId; + } + m_scene.EventManager.TriggerObjectGrabLocally(part.LocalId, originalID, offsetPos, remoteClinet, surfaceArgs); + } + + private void HandleRemoteEvent_OnObjectGrabbing(string actorID, ulong evSeqNum, OSDMap data) + { + m_log.Debug(LogHeader + ", " + m_actorID + ": received GrabObject from " + actorID + ", seq " + evSeqNum); + + UUID agentID = data["agentID"].AsUUID(); + UUID primID = data["primID"].AsUUID(); + UUID originalPrimID = data["originalPrimID"].AsUUID(); + Vector3 offsetPos = data["offsetPos"].AsVector3(); + SurfaceTouchEventArgs surfaceArgs = new SurfaceTouchEventArgs(); + surfaceArgs.Binormal = data["binormal"].AsVector3(); + surfaceArgs.FaceIndex = data["faceIndex"].AsInteger(); + surfaceArgs.Normal = data["normal"].AsVector3(); + surfaceArgs.Position = data["position"].AsVector3(); + surfaceArgs.STCoord = data["stCoord"].AsVector3(); + surfaceArgs.UVCoord = data["uvCoord"].AsVector3(); + + //Create an instance of IClientAPI to pass along agentID, see SOPObject.EventManager_OnObjectGrab() + //We don't really need RegionSyncAvatar's implementation here, just borrow it's IClientAPI interface. + //If we decide to remove RegionSyncAvatar later, we can simple just define a very simple class that implements + //ICleintAPI to be used here. + IClientAPI remoteClinet = new RegionSyncAvatar(m_scene, agentID, "", "", Vector3.Zero); + SceneObjectPart part = m_scene.GetSceneObjectPart(primID); + if (part == null) + { + m_log.Error(LogHeader + ": no prim with ID " + primID); + return; + } + uint originalID = 0; + if (originalPrimID != UUID.Zero) + { + SceneObjectPart originalPart = m_scene.GetSceneObjectPart(originalPrimID); + originalID = originalPart.LocalId; + } + + m_scene.EventManager.TriggerObjectGrabbingLocally(part.LocalId, originalID, offsetPos, remoteClinet, surfaceArgs); + } + + private void HandleRemoteEvent_OnObjectDeGrab(string actorID, ulong evSeqNum, OSDMap data) + { + m_log.Debug(LogHeader + ", " + m_actorID + ": received GrabObject from " + actorID + ", seq " + evSeqNum); + + UUID agentID = data["agentID"].AsUUID(); + UUID primID = data["primID"].AsUUID(); + UUID originalPrimID = data["originalPrimID"].AsUUID(); + + SurfaceTouchEventArgs surfaceArgs = new SurfaceTouchEventArgs(); + surfaceArgs.Binormal = data["binormal"].AsVector3(); + surfaceArgs.FaceIndex = data["faceIndex"].AsInteger(); + surfaceArgs.Normal = data["normal"].AsVector3(); + surfaceArgs.Position = data["position"].AsVector3(); + surfaceArgs.STCoord = data["stCoord"].AsVector3(); + surfaceArgs.UVCoord = data["uvCoord"].AsVector3(); + + //Create an instance of IClientAPI to pass along agentID, see SOPObject.EventManager_OnObjectGrab() + //We don't really need RegionSyncAvatar's implementation here, just borrow it's IClientAPI interface. + //If we decide to remove RegionSyncAvatar later, we can simple just define a very simple class that implements + //ICleintAPI to be used here. + IClientAPI remoteClinet = new RegionSyncAvatar(m_scene, agentID, "", "", Vector3.Zero); + SceneObjectPart part = m_scene.GetSceneObjectPart(primID); + if (part == null) + { + m_log.Error(LogHeader + ": no prim with ID " + primID); + return; + } + uint originalID = 0; + if (originalPrimID != UUID.Zero) + { + SceneObjectPart originalPart = m_scene.GetSceneObjectPart(originalPrimID); + originalID = originalPart.LocalId; + } + + m_scene.EventManager.TriggerObjectDeGrabLocally(part.LocalId, originalID, remoteClinet, surfaceArgs); + } /// - /// Send a sync message to remove the given objects in all connected actors, if this is a relay node. - /// UUID is used for identified a removed object. + /// Send a sync message to remove the given objects in all connected actors. + /// UUID is used for identified a removed object. This function now should + /// only be triggered by an object removal that is initiated locally. /// /// private void RegionSyncModule_OnObjectBeingRemovedFromScene(SceneObjectGroup sog) @@ -1113,18 +1246,17 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //m_log.DebugFormat("RegionSyncModule_OnObjectBeingRemovedFromScene called at time {0}:{1}:{2}", DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond); //Only send the message out if this is a relay node for sync messages, or this actor caused deleting the object - if (m_isSyncRelay || CheckObjectForSendingUpdate(sog)) - { - OSDMap data = new OSDMap(1); - //data["regionHandle"] = OSD.FromULong(regionHandle); - //data["localID"] = OSD.FromUInteger(sog.LocalId); - data["UUID"] = OSD.FromUUID(sog.UUID); - - SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.RemovedObject, OSDParser.SerializeJsonString(data)); - SendObjectUpdateToRelevantSyncConnectors(sog, rsm); - } + //if (m_isSyncRelay || CheckObjectForSendingUpdate(sog)) + OSDMap data = new OSDMap(1); + //data["regionHandle"] = OSD.FromULong(regionHandle); + //data["localID"] = OSD.FromUInteger(sog.LocalId); + data["UUID"] = OSD.FromUUID(sog.UUID); + data["actorID"] = OSD.FromString(m_actorID); + + SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.RemovedObject, OSDParser.SerializeJsonString(data)); + SendObjectUpdateToRelevantSyncConnectors(sog, rsm); } public void PublishSceneEvent(EventManager.EventNames ev, Object[] evArgs) @@ -1164,6 +1296,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } OnLocalChatFromWorld(evArgs[0], (OSChatMessage)evArgs[1]); return; + case EventManager.EventNames.ObjectGrab: + OnLocalGrabObject((uint)evArgs[0], (uint)evArgs[1], (Vector3) evArgs[2], (IClientAPI) evArgs[3], (SurfaceTouchEventArgs)evArgs[4]); + return; + case EventManager.EventNames.ObjectGrabbing: + OnLocalObjectGrabbing((uint)evArgs[0], (uint)evArgs[1], (Vector3)evArgs[2], (IClientAPI)evArgs[3], (SurfaceTouchEventArgs)evArgs[4]); + return; + case EventManager.EventNames.ObjectDeGrab: + OnLocalDeGrabObject((uint)evArgs[0], (uint)evArgs[1], (IClientAPI)evArgs[2], (SurfaceTouchEventArgs)evArgs[3]); + return; default: return; } @@ -1204,6 +1345,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //we will use the prim's UUID as the identifier, not the localID, to publish the event for the prim SceneObjectPart part = m_scene.GetSceneObjectPart(localID); + if (part == null) + { + m_log.Warn(LogHeader + ": part with localID " + localID + " not exist"); + return; + } + OSDMap data = new OSDMap(); data["primID"] = OSD.FromUUID(part.UUID); data["itemID"] = OSD.FromUUID(itemID); @@ -1245,6 +1392,117 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule data["type"] = OSD.FromInteger((int)chat.Type); SendSceneEvent(SymmetricSyncMessage.MsgType.ChatFromWorld, data); } + + private void OnLocalGrabObject(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + { + /* + //we will use the prim's UUID as the identifier, not the localID, to publish the event for the prim + SceneObjectPart part = m_scene.GetSceneObjectPart(localID); + if (part == null) + { + m_log.Warn(LogHeader + ": part with localID " + localID + " not exist"); + return; + } + + //this seems to be useful if the prim touched and the prim handling the touch event are different: + //i.e. a child part is touched, pass the event to root, and root handles the event. then root is the "part", + //and the child part is the "originalPart" + SceneObjectPart originalPart = null; + if (originalID != 0) + { + originalPart = m_scene.GetSceneObjectPart(originalID); + if (originalPart == null) + { + m_log.Warn(LogHeader + ": part with localID " + localID + " not exist"); + return; + } + } + + OSDMap data = new OSDMap(); + data["agentID"] = OSD.FromUUID(remoteClient.AgentId); + data["primID"] = OSD.FromUUID(part.UUID); + if (originalID != 0) + { + data["originalPrimID"] = OSD.FromUUID(originalPart.UUID); + } + else + { + data["originalPrimID"] = OSD.FromUUID(UUID.Zero); + } + data["offsetPos"] = OSD.FromVector3(offsetPos); + + data["binormal"] = OSD.FromVector3(surfaceArgs.Binormal); + data["faceIndex"] = OSD.FromInteger(surfaceArgs.FaceIndex); + data["normal"] = OSD.FromVector3(surfaceArgs.Normal); + data["position"] = OSD.FromVector3(surfaceArgs.Position); + data["stCoord"] = OSD.FromVector3(surfaceArgs.STCoord); + data["uvCoord"] = OSD.FromVector3(surfaceArgs.UVCoord); + * */ + OSDMap data = PrepareObjectGrabArgs(localID, originalID, offsetPos, remoteClient, surfaceArgs); + SendSceneEvent(SymmetricSyncMessage.MsgType.ObjectGrab, data); + } + + private void OnLocalObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + { + OSDMap data = PrepareObjectGrabArgs(localID, originalID, offsetPos, remoteClient, surfaceArgs); + if (data != null) + { + SendSceneEvent(SymmetricSyncMessage.MsgType.ObjectGrabbing, data); + } + } + + private OSDMap PrepareObjectGrabArgs(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + { + //we will use the prim's UUID as the identifier, not the localID, to publish the event for the prim + SceneObjectPart part = m_scene.GetSceneObjectPart(localID); + if (part == null) + { + m_log.Warn(LogHeader + ": PrepareObjectGrabArgs - part with localID " + localID + " not exist"); + return null; + } + + //this seems to be useful if the prim touched and the prim handling the touch event are different: + //i.e. a child part is touched, pass the event to root, and root handles the event. then root is the "part", + //and the child part is the "originalPart" + SceneObjectPart originalPart = null; + if (originalID != 0) + { + originalPart = m_scene.GetSceneObjectPart(originalID); + if (originalPart == null) + { + m_log.Warn(LogHeader + ": PrepareObjectGrabArgs - part with localID " + localID + " not exist"); + return null; + } + } + + OSDMap data = new OSDMap(); + data["agentID"] = OSD.FromUUID(remoteClient.AgentId); + data["primID"] = OSD.FromUUID(part.UUID); + if (originalID != 0) + { + data["originalPrimID"] = OSD.FromUUID(originalPart.UUID); + } + else + { + data["originalPrimID"] = OSD.FromUUID(UUID.Zero); + } + data["offsetPos"] = OSD.FromVector3(offsetPos); + + data["binormal"] = OSD.FromVector3(surfaceArgs.Binormal); + data["faceIndex"] = OSD.FromInteger(surfaceArgs.FaceIndex); + data["normal"] = OSD.FromVector3(surfaceArgs.Normal); + data["position"] = OSD.FromVector3(surfaceArgs.Position); + data["stCoord"] = OSD.FromVector3(surfaceArgs.STCoord); + data["uvCoord"] = OSD.FromVector3(surfaceArgs.UVCoord); + + return data; + } + + + private void OnLocalDeGrabObject(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + { + + } private void SendSceneEvent(SymmetricSyncMessage.MsgType msgType, OSDMap data) { diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SymmetricSyncMessage.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SymmetricSyncMessage.cs index a10f43e76b..b093a16702 100755 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SymmetricSyncMessage.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SymmetricSyncMessage.cs @@ -38,6 +38,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule ScriptReset, ChatFromClient, ChatFromWorld, + ObjectGrab, + ObjectGrabbing, + ObjectDeGrab, } #endregion diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 7d8df7eb0f..86aa79d7dd 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs @@ -34,8 +34,8 @@ using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using log4net; -using System.Reflection; +//using log4net; +//using System.Reflection; /***************************************************** @@ -98,7 +98,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm private int m_saydistance = 30; private int m_shoutdistance = 100; - private ILog m_log; + //private ILog m_log; #region IRegionModule Members @@ -130,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm //SYMMETRIC SYNC //m_scene.EventManager.OnChatFromWorld += DeliverClientMessage; //Kitty: temp debug - m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + //m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //end SYMMETRIC SYNC m_pendingQ = new Queue(); m_pending = Queue.Synchronized(m_pendingQ); @@ -248,8 +248,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm /// msg to sent public void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg, Vector3 position) { - m_log.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}", - type, channel, name, id, msg); + //m_log.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}", + // type, channel, name, id, msg); // Determine which listen event filters match the given set of arguments, this results // in a limited set of listeners, each belonging a host. If the host is in range, add them diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index b4ae2ea5fa..f3b5e17677 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -54,6 +54,10 @@ namespace OpenSim.Region.Framework.Scenes ScriptReset, ChatFromClient, //chats from avatars ChatFromWorld, //chats from objects + ObjectGrab, + ObjectGrabbing, + ObjectDeGrab, + } public EventManager(Scene scene) @@ -148,6 +152,68 @@ namespace OpenSim.Region.Framework.Scenes base.TriggerOnChatFromWorld(sender, chat); } #endregion //ChatFromWorld + + #region ObjectGrab, ObjectGrabbing, ObjectDeGrab + public override void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + { + if (m_scene.RegionSyncModule != null) + { + Object[] eventArgs = new Object[5]; + eventArgs[0] = (Object)localID; + eventArgs[1] = (Object)originalID; + eventArgs[2] = (Object)offsetPos; + eventArgs[3] = (Object)remoteClient; + eventArgs[4] = (Object)surfaceArgs; + m_scene.RegionSyncModule.PublishSceneEvent(EventNames.ObjectGrab, eventArgs); + } + TriggerObjectGrabLocally(localID, originalID, offsetPos, remoteClient, surfaceArgs); + } + public void TriggerObjectGrabLocally(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + { + base.TriggerObjectGrab(localID, originalID, offsetPos, remoteClient, surfaceArgs); + } + + public override void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + { + if (m_scene.RegionSyncModule != null) + { + Object[] eventArgs = new Object[5]; + eventArgs[0] = (Object)localID; + eventArgs[1] = (Object)originalID; + eventArgs[2] = (Object)offsetPos; + eventArgs[3] = (Object)remoteClient; + eventArgs[4] = (Object)surfaceArgs; + m_scene.RegionSyncModule.PublishSceneEvent(EventNames.ObjectGrabbing, eventArgs); + } + TriggerObjectGrabbingLocally(localID, originalID, offsetPos, remoteClient, surfaceArgs); + } + + public void TriggerObjectGrabbingLocally(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + { + base.TriggerObjectGrabbing(localID, originalID, offsetPos, remoteClient, surfaceArgs); + } + + public override void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + { + if (m_scene.RegionSyncModule != null) + { + Object[] eventArgs = new Object[4]; + eventArgs[0] = (Object)localID; + eventArgs[1] = (Object)originalID; + eventArgs[2] = (Object)remoteClient; + eventArgs[3] = (Object)surfaceArgs; + m_scene.RegionSyncModule.PublishSceneEvent(EventNames.ObjectDeGrab, eventArgs); + } + + TriggerObjectDeGrabLocally(localID, originalID, remoteClient, surfaceArgs); + } + + public void TriggerObjectDeGrabLocally(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + { + base.TriggerObjectDeGrab(localID, originalID, remoteClient, surfaceArgs); + } + + #endregion //GrabObject } /// @@ -954,7 +1020,9 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + //SYMMETRIC SYNC: overridden at new EventManager class + //public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + public virtual void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { ObjectGrabDelegate handlerObjectGrab = OnObjectGrab; if (handlerObjectGrab != null) @@ -975,7 +1043,9 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + //SYMMETRIC SYNC: overridden at new EventManager class + //public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + public virtual void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing; if (handlerObjectGrabbing != null) @@ -996,7 +1066,9 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + //SYMMETRIC SYNC: overridden at new EventManager class + //public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + public virtual void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab; if (handlerObjectDeGrab != null) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index bec3603ed7..07c5d70d6c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -662,7 +662,8 @@ namespace OpenSim.Region.Framework.Scenes if (UnlinkSceneObject(group, false)) { - EventManager.TriggerObjectBeingRemovedFromScene(group); + //For object removals caused by remote events (by other actors), do not trigger local event ObjectBeingRemovedFromScene + //EventManager.TriggerObjectBeingRemovedFromScene(group); EventManager.TriggerParcelPrimCountTainted(); } @@ -2424,12 +2425,13 @@ namespace OpenSim.Region.Framework.Scenes //SYMMETRIC SYNC //Set the ActorID and TimeStamp info for this latest update + /* foreach (SceneObjectPart part in group.Parts) { part.SyncInfoUpdate(); } //end of SYMMETRIC SYNC - + * */ } /// @@ -3071,12 +3073,13 @@ namespace OpenSim.Region.Framework.Scenes client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; client.OnObjectPermissions += HandleObjectPermissionsUpdate; - if (IsSyncedServer()) - { + //SYMMETRIC SYNC: return the code back to its original OpenSim version + //if (IsSyncedServer()) + //{ client.OnGrabObject += ProcessObjectGrab; client.OnGrabUpdate += ProcessObjectGrabUpdate; client.OnDeGrabObject += ProcessObjectDeGrab; - } + //} client.OnUndo += m_sceneGraph.HandleUndo; client.OnRedo += m_sceneGraph.HandleRedo; client.OnObjectDescription += m_sceneGraph.PrimDescription; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 8c7bfca9c2..8666fe8ab9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -478,10 +478,12 @@ namespace OpenSim.Region.Framework.Scenes { updates = new List(m_updateList.Values); + /* if (updates.Count > 0) { m_log.Debug("SceneGraph: " + updates.Count + " objects to send updates for"); } + * */ m_updateList.Clear(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 8bc467c3bd..2a8f2990b6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1155,12 +1155,15 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart part = parts[i]; + //SYMMETRIC SYNC: object remove should be handled through RegionSyncModule + /* // REGION SYNC if (Scene.IsSyncedServer()) { Scene.RegionSyncServerModule.DeleteObject(part.RegionHandle, part.LocalId, part); //return; } + * */ Scene.ForEachScenePresence(delegate(ScenePresence avatar) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index dfc752a4e8..c8941f1c55 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -5066,14 +5066,6 @@ namespace OpenSim.Region.Framework.Scenes this.m_lastUpdateActorID = updatedPart.LastUpdateActorID; this.m_lastUpdateTimeStamp = updatedPart.LastUpdateTimeStamp; - - /* - this.m_inventory.Items = (TaskInventoryDictionary)updatedPart.m_inventory.Items.Clone(); - //update shape information, for now, only update fileds in Shape whose set functions are defined in PrimitiveBaseShape - this.Shape = updatedPart.Shape.Copy(); - this.Shape.TextureEntry = updatedPart.Shape.TextureEntry; - * */ - return partUpdateResult; } @@ -5083,7 +5075,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void ScheduleFullUpdate_SyncInfoUnchanged() { - m_log.DebugFormat("[SCENE OBJECT PART]: ScheduleFullUpdate_SyncInfoUnchanged for {0} {1}", Name, LocalId); + //m_log.DebugFormat("[SCENE OBJECT PART]: ScheduleFullUpdate_SyncInfoUnchanged for {0} {1}", Name, LocalId); if (m_parentGroup != null) { diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 8953ce31ba..0769929421 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1174,7 +1174,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString()); writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); - WriteFlags(writer, "Flags", sop.Flags.ToString(), options); + //SYMMETRIC SYNC: also serialize SceneObjectPart:LocalFlags, so that it can be propogated across actors + //WriteFlags(writer, "Flags", sop.Flags.ToString(), options); + WriteFlags(writer, "Flags", sop.GetEffectiveObjectFlags().ToString(), options); + //end SYMMETRIC SYNC WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); if (sop.MediaUrl != null)