Merge branch 'prephysics' of ssh://island.sciencesim.com/home/sceneapi/sceneapi into prephysics

dsg
Dan Lake 2011-01-11 12:25:10 -08:00
commit 86235e200e
10 changed files with 399 additions and 62 deletions

View File

@ -883,13 +883,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
// Register for interesting client events which will be forwarded to auth sim // 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 // These are the raw packet data blocks from the client, intercepted and sent up to the sim
client.OnAgentUpdateRaw += HandleAgentUpdateRaw; 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.OnChatFromClientRaw += HandleChatFromClientRaw;
client.OnAgentRequestSit += HandleAgentRequestSit; client.OnAgentRequestSit += HandleAgentRequestSit;
client.OnAgentSit += HandleAgentSit; client.OnAgentSit += HandleAgentSit;
client.OnGrabObject += HandleGrabObject; //SYMMETRIC SYNC: do not subscribe to OnGrabObject, OnGrabUpdate, and OnDeGrabObject: RegionSyncModule + Scene.EventManager will handle this.
client.OnGrabUpdate += HandleGrabUpdate; //client.OnGrabObject += HandleGrabObject;
client.OnDeGrabObject += HandleDeGrabObject; //client.OnGrabUpdate += HandleGrabUpdate;
//client.OnDeGrabObject += HandleDeGrabObject;
client.OnStartAnim += HandleStartAnim; client.OnStartAnim += HandleStartAnim;
client.OnStopAnim += HandleStopAnim; client.OnStopAnim += HandleStopAnim;
} }

View File

@ -854,6 +854,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
case SymmetricSyncMessage.MsgType.ScriptReset: case SymmetricSyncMessage.MsgType.ScriptReset:
case SymmetricSyncMessage.MsgType.ChatFromClient: case SymmetricSyncMessage.MsgType.ChatFromClient:
case SymmetricSyncMessage.MsgType.ChatFromWorld: case SymmetricSyncMessage.MsgType.ChatFromWorld:
case SymmetricSyncMessage.MsgType.ObjectGrab:
case SymmetricSyncMessage.MsgType.ObjectGrabbing:
case SymmetricSyncMessage.MsgType.ObjectDeGrab:
{ {
HandleRemoteEvent(msg); HandleRemoteEvent(msg);
return; return;
@ -932,29 +935,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
SendSyncMessage(SymmetricSyncMessage.MsgType.Terrain, OSDParser.SerializeJsonString(data)); 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<string> exceptions = new HashSet<string>(); HashSet<string> exceptions = new HashSet<string>();
private OSDMap DeserializeMessage(SymmetricSyncMessage msg) 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);
}
}
/// <summary> /// <summary>
/// The common actions for handling remote events (event initiated at other actors and propogated here) /// The common actions for handling remote events (event initiated at other actors and propogated here)
/// </summary> /// </summary>
@ -1011,6 +1020,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
case SymmetricSyncMessage.MsgType.ChatFromWorld: case SymmetricSyncMessage.MsgType.ChatFromWorld:
HandleRemoteEvent_OnChatFromWorld(init_actorID, evSeqNum, data); HandleRemoteEvent_OnChatFromWorld(init_actorID, evSeqNum, data);
break; 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 //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); m_scene.EventManager.TriggerOnChatFromWorldLocally(m_scene, args);
} }
/// <summary>
/// Special actions for remote event ChatFromClient
/// </summary>
/// <param name="data">OSDMap data of event args</param>
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);
}
/// <summary> /// <summary>
/// Send a sync message to remove the given objects in all connected actors, if this is a relay node. /// Send a sync message to remove the given objects in all connected actors.
/// UUID is used for identified a removed object. /// UUID is used for identified a removed object. This function now should
/// only be triggered by an object removal that is initiated locally.
/// </summary> /// </summary>
/// <param name="sog"></param> /// <param name="sog"></param>
private void RegionSyncModule_OnObjectBeingRemovedFromScene(SceneObjectGroup sog) 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); //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 //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)) //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);
}
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) public void PublishSceneEvent(EventManager.EventNames ev, Object[] evArgs)
@ -1164,6 +1296,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
OnLocalChatFromWorld(evArgs[0], (OSChatMessage)evArgs[1]); OnLocalChatFromWorld(evArgs[0], (OSChatMessage)evArgs[1]);
return; 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: default:
return; 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 //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); SceneObjectPart part = m_scene.GetSceneObjectPart(localID);
if (part == null)
{
m_log.Warn(LogHeader + ": part with localID " + localID + " not exist");
return;
}
OSDMap data = new OSDMap(); OSDMap data = new OSDMap();
data["primID"] = OSD.FromUUID(part.UUID); data["primID"] = OSD.FromUUID(part.UUID);
data["itemID"] = OSD.FromUUID(itemID); data["itemID"] = OSD.FromUUID(itemID);
@ -1246,6 +1393,117 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
SendSceneEvent(SymmetricSyncMessage.MsgType.ChatFromWorld, data); 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) private void SendSceneEvent(SymmetricSyncMessage.MsgType msgType, OSDMap data)
{ {
data["actorID"] = OSD.FromString(m_actorID); data["actorID"] = OSD.FromString(m_actorID);

View File

@ -38,6 +38,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
ScriptReset, ScriptReset,
ChatFromClient, ChatFromClient,
ChatFromWorld, ChatFromWorld,
ObjectGrab,
ObjectGrabbing,
ObjectDeGrab,
} }
#endregion #endregion

View File

@ -34,8 +34,8 @@ using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using log4net; //using log4net;
using System.Reflection; //using System.Reflection;
/***************************************************** /*****************************************************
@ -98,7 +98,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
private int m_saydistance = 30; private int m_saydistance = 30;
private int m_shoutdistance = 100; private int m_shoutdistance = 100;
private ILog m_log; //private ILog m_log;
#region IRegionModule Members #region IRegionModule Members
@ -130,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
//SYMMETRIC SYNC //SYMMETRIC SYNC
//m_scene.EventManager.OnChatFromWorld += DeliverClientMessage; //m_scene.EventManager.OnChatFromWorld += DeliverClientMessage;
//Kitty: temp debug //Kitty: temp debug
m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//end SYMMETRIC SYNC //end SYMMETRIC SYNC
m_pendingQ = new Queue(); m_pendingQ = new Queue();
m_pending = Queue.Synchronized(m_pendingQ); m_pending = Queue.Synchronized(m_pendingQ);
@ -248,8 +248,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
/// <param name="msg">msg to sent</param> /// <param name="msg">msg to sent</param>
public void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg, Vector3 position) 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}", //m_log.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}",
type, channel, name, id, msg); // type, channel, name, id, msg);
// Determine which listen event filters match the given set of arguments, this results // 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 // in a limited set of listeners, each belonging a host. If the host is in range, add them

View File

@ -54,6 +54,10 @@ namespace OpenSim.Region.Framework.Scenes
ScriptReset, ScriptReset,
ChatFromClient, //chats from avatars ChatFromClient, //chats from avatars
ChatFromWorld, //chats from objects ChatFromWorld, //chats from objects
ObjectGrab,
ObjectGrabbing,
ObjectDeGrab,
} }
public EventManager(Scene scene) public EventManager(Scene scene)
@ -148,6 +152,68 @@ namespace OpenSim.Region.Framework.Scenes
base.TriggerOnChatFromWorld(sender, chat); base.TriggerOnChatFromWorld(sender, chat);
} }
#endregion //ChatFromWorld #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
} }
/// <summary> /// <summary>
@ -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; ObjectGrabDelegate handlerObjectGrab = OnObjectGrab;
if (handlerObjectGrab != null) 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; ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing;
if (handlerObjectGrabbing != null) 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; ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab;
if (handlerObjectDeGrab != null) if (handlerObjectDeGrab != null)

View File

@ -662,7 +662,8 @@ namespace OpenSim.Region.Framework.Scenes
if (UnlinkSceneObject(group, false)) 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(); EventManager.TriggerParcelPrimCountTainted();
} }
@ -2424,12 +2425,13 @@ namespace OpenSim.Region.Framework.Scenes
//SYMMETRIC SYNC //SYMMETRIC SYNC
//Set the ActorID and TimeStamp info for this latest update //Set the ActorID and TimeStamp info for this latest update
/*
foreach (SceneObjectPart part in group.Parts) foreach (SceneObjectPart part in group.Parts)
{ {
part.SyncInfoUpdate(); part.SyncInfoUpdate();
} }
//end of SYMMETRIC SYNC //end of SYMMETRIC SYNC
* */
} }
/// <summary> /// <summary>
@ -3071,12 +3073,13 @@ namespace OpenSim.Region.Framework.Scenes
client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags;
client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily;
client.OnObjectPermissions += HandleObjectPermissionsUpdate; client.OnObjectPermissions += HandleObjectPermissionsUpdate;
if (IsSyncedServer()) //SYMMETRIC SYNC: return the code back to its original OpenSim version
{ //if (IsSyncedServer())
//{
client.OnGrabObject += ProcessObjectGrab; client.OnGrabObject += ProcessObjectGrab;
client.OnGrabUpdate += ProcessObjectGrabUpdate; client.OnGrabUpdate += ProcessObjectGrabUpdate;
client.OnDeGrabObject += ProcessObjectDeGrab; client.OnDeGrabObject += ProcessObjectDeGrab;
} //}
client.OnUndo += m_sceneGraph.HandleUndo; client.OnUndo += m_sceneGraph.HandleUndo;
client.OnRedo += m_sceneGraph.HandleRedo; client.OnRedo += m_sceneGraph.HandleRedo;
client.OnObjectDescription += m_sceneGraph.PrimDescription; client.OnObjectDescription += m_sceneGraph.PrimDescription;

View File

@ -478,10 +478,12 @@ namespace OpenSim.Region.Framework.Scenes
{ {
updates = new List<SceneObjectGroup>(m_updateList.Values); updates = new List<SceneObjectGroup>(m_updateList.Values);
/*
if (updates.Count > 0) if (updates.Count > 0)
{ {
m_log.Debug("SceneGraph: " + updates.Count + " objects to send updates for"); m_log.Debug("SceneGraph: " + updates.Count + " objects to send updates for");
} }
* */
m_updateList.Clear(); m_updateList.Clear();

View File

@ -1155,12 +1155,15 @@ namespace OpenSim.Region.Framework.Scenes
{ {
SceneObjectPart part = parts[i]; SceneObjectPart part = parts[i];
//SYMMETRIC SYNC: object remove should be handled through RegionSyncModule
/*
// REGION SYNC // REGION SYNC
if (Scene.IsSyncedServer()) if (Scene.IsSyncedServer())
{ {
Scene.RegionSyncServerModule.DeleteObject(part.RegionHandle, part.LocalId, part); Scene.RegionSyncServerModule.DeleteObject(part.RegionHandle, part.LocalId, part);
//return; //return;
} }
* */
Scene.ForEachScenePresence(delegate(ScenePresence avatar) Scene.ForEachScenePresence(delegate(ScenePresence avatar)
{ {

View File

@ -5066,14 +5066,6 @@ namespace OpenSim.Region.Framework.Scenes
this.m_lastUpdateActorID = updatedPart.LastUpdateActorID; this.m_lastUpdateActorID = updatedPart.LastUpdateActorID;
this.m_lastUpdateTimeStamp = updatedPart.LastUpdateTimeStamp; 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; return partUpdateResult;
} }
@ -5083,7 +5075,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void ScheduleFullUpdate_SyncInfoUnchanged() 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) if (m_parentGroup != null)
{ {

View File

@ -1174,7 +1174,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); writer.WriteElementString("GroupMask", sop.GroupMask.ToString());
writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString()); writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString());
writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.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); WriteUUID(writer, "CollisionSound", sop.CollisionSound, options);
writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
if (sop.MediaUrl != null) if (sop.MediaUrl != null)