Merge branch 'prephysics' of ssh://island.sciencesim.com/home/sceneapi/sceneapi into prephysics
commit
b02d3090b3
|
@ -386,6 +386,14 @@ namespace OpenSim.Framework
|
||||||
public string RemotingAddress;
|
public string RemotingAddress;
|
||||||
public UUID ScopeID = UUID.Zero;
|
public UUID ScopeID = UUID.Zero;
|
||||||
|
|
||||||
|
//SYMMETRIC SYNC
|
||||||
|
//IP:port for the symmetric sync listener this actor is configured to connect to
|
||||||
|
private string m_syncListenerAddr = String.Empty;
|
||||||
|
private int m_syncListenerPort;
|
||||||
|
//IP:port for the avatar sync server this actor is configured to connect to
|
||||||
|
private string m_serverAddr = String.Empty;
|
||||||
|
private int m_serverPort;
|
||||||
|
//end of SYMMETRIC SYNC
|
||||||
|
|
||||||
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
|
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
|
||||||
|
|
||||||
|
@ -676,6 +684,25 @@ namespace OpenSim.Framework
|
||||||
get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); }
|
get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//SYMMETRIC SYNC
|
||||||
|
public string SyncListenerAddress
|
||||||
|
{
|
||||||
|
get { return m_syncListenerAddr; }
|
||||||
|
}
|
||||||
|
public int SyncListenerPort
|
||||||
|
{
|
||||||
|
get { return m_syncListenerPort; }
|
||||||
|
}
|
||||||
|
public string ServerIPAddress
|
||||||
|
{
|
||||||
|
get { return m_serverAddr; }
|
||||||
|
}
|
||||||
|
public int ServerPort
|
||||||
|
{
|
||||||
|
get { return m_serverPort; }
|
||||||
|
}
|
||||||
|
//end of SYMMETRIC SYNC
|
||||||
|
|
||||||
public void SetEndPoint(string ipaddr, int port)
|
public void SetEndPoint(string ipaddr, int port)
|
||||||
{
|
{
|
||||||
IPAddress tmpIP = IPAddress.Parse(ipaddr);
|
IPAddress tmpIP = IPAddress.Parse(ipaddr);
|
||||||
|
@ -830,6 +857,21 @@ namespace OpenSim.Framework
|
||||||
// Multi-tenancy
|
// Multi-tenancy
|
||||||
//
|
//
|
||||||
ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString()));
|
ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString()));
|
||||||
|
|
||||||
|
// SYMMETRIC SYNC
|
||||||
|
m_syncListenerAddr = config.GetString("SyncListenerIPAddress", String.Empty);
|
||||||
|
m_syncListenerPort = config.GetInt("SyncListenerPort", -1);
|
||||||
|
//if either IP or port is not configured, we set IP to empty to raise warning later
|
||||||
|
if (m_syncListenerPort == -1)
|
||||||
|
m_syncListenerAddr = String.Empty;
|
||||||
|
|
||||||
|
m_serverAddr = config.GetString("ServerIPAddress", String.Empty);
|
||||||
|
m_serverPort = config.GetInt("ServerPort", -1);
|
||||||
|
if (m_serverPort == -1)
|
||||||
|
m_serverAddr = String.Empty;
|
||||||
|
|
||||||
|
// end of SYMMETRIC SYNC
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteNiniConfig(IConfigSource source)
|
private void WriteNiniConfig(IConfigSource source)
|
||||||
|
|
|
@ -69,10 +69,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_active = true;
|
m_active = true;
|
||||||
m_scene.RegionSyncEnabled = true;
|
m_scene.RegionSyncEnabled = true;
|
||||||
m_scene.RegionSyncMode = "client";
|
m_scene.RegionSyncMode = "client";
|
||||||
string serverAddrDefault = syncConfig.GetString("ServerIPAddress", "127.0.0.1");
|
|
||||||
m_serveraddr = syncConfig.GetString(scene.RegionInfo.RegionName+"_ServerIPAddress", serverAddrDefault);
|
//string serverAddrDefault = syncConfig.GetString("ServerIPAddress", "127.0.0.1");
|
||||||
int serverPortDefault = syncConfig.GetInt("ServerPort", 13000);
|
//m_serveraddr = syncConfig.GetString(scene.RegionInfo.RegionName+"_ServerIPAddress", serverAddrDefault);
|
||||||
m_serverport = syncConfig.GetInt(scene.RegionInfo.RegionName+"_ServerPort", serverPortDefault);
|
//int serverPortDefault = syncConfig.GetInt("ServerPort", 13000);
|
||||||
|
//m_serverport = syncConfig.GetInt(scene.RegionInfo.RegionName+"_ServerPort", serverPortDefault);
|
||||||
|
|
||||||
m_scene.RegisterModuleInterface<IRegionSyncClientModule>(this);
|
m_scene.RegisterModuleInterface<IRegionSyncClientModule>(this);
|
||||||
|
|
||||||
m_symsync = syncConfig.GetBoolean("SymSync", false);
|
m_symsync = syncConfig.GetBoolean("SymSync", false);
|
||||||
|
@ -230,6 +232,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
m_serveraddr = m_scene.RegionInfo.ServerIPAddress;
|
||||||
|
m_serverport = m_scene.RegionInfo.ServerPort;
|
||||||
|
|
||||||
|
if (m_serveraddr.Equals(String.Empty) || m_serverport == -1)
|
||||||
|
{
|
||||||
|
m_log.Warn("[REGION SYNC CLIENT MODULE] No IP or port of RegionSyncServer has been configured. Shut down.");
|
||||||
|
m_active = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
lock (m_client_lock)
|
lock (m_client_lock)
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,10 +97,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_statsWriter = File.AppendText(syncstats);
|
m_statsWriter = File.AppendText(syncstats);
|
||||||
|
|
||||||
//Get sync server info for Client Manager actors
|
//Get sync server info for Client Manager actors
|
||||||
string serverAddr = scene.RegionInfo.RegionName + "_ServerIPAddress";
|
//string serverAddr = scene.RegionInfo.RegionName + "_ServerIPAddress";
|
||||||
m_serveraddr = syncConfig.GetString(serverAddr, IPAddrUnknown);
|
//m_serveraddr = syncConfig.GetString(serverAddr, IPAddrUnknown);
|
||||||
string serverPort = scene.RegionInfo.RegionName + "_ServerPort";
|
//string serverPort = scene.RegionInfo.RegionName + "_ServerPort";
|
||||||
m_serverport = syncConfig.GetInt(serverPort, PortUnknown);
|
//m_serverport = syncConfig.GetInt(serverPort, PortUnknown);
|
||||||
|
|
||||||
// Client manager load balancing
|
// Client manager load balancing
|
||||||
m_maxClientsPerManager = syncConfig.GetInt("MaxClientsPerManager", 100);
|
m_maxClientsPerManager = syncConfig.GetInt("MaxClientsPerManager", 100);
|
||||||
DefaultPort++;
|
DefaultPort++;
|
||||||
|
@ -154,6 +155,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
//end of SYMMETRIC SYNC
|
//end of SYMMETRIC SYNC
|
||||||
// Start the server and listen for RegionSyncClients
|
// Start the server and listen for RegionSyncClients
|
||||||
|
m_serveraddr = m_scene.RegionInfo.ServerIPAddress;
|
||||||
|
m_serverport = m_scene.RegionInfo.ServerPort;
|
||||||
|
|
||||||
|
m_log.Debug("[REGION SYNC SERVER MODULE] to start server on " + m_serveraddr + ":" + m_serverport);
|
||||||
|
|
||||||
if (!m_serveraddr.Equals(IPAddrUnknown) && m_serverport != PortUnknown)
|
if (!m_serveraddr.Equals(IPAddrUnknown) && m_serverport != PortUnknown)
|
||||||
{
|
{
|
||||||
m_log.Warn("[REGION SYNC SERVER MODULE] Starting RegionSyncServer");
|
m_log.Warn("[REGION SYNC SERVER MODULE] Starting RegionSyncServer");
|
||||||
|
|
|
@ -89,8 +89,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
//Register for local Scene events
|
//Register for local Scene events
|
||||||
m_scene.EventManager.OnPostSceneCreation += OnPostSceneCreation;
|
m_scene.EventManager.OnPostSceneCreation += OnPostSceneCreation;
|
||||||
m_scene.EventManager.OnObjectBeingRemovedFromScene += new EventManager.ObjectBeingRemovedFromScene(RegionSyncModule_OnObjectBeingRemovedFromScene);
|
//m_scene.EventManager.OnObjectBeingRemovedFromScene += new EventManager.ObjectBeingRemovedFromScene(RegionSyncModule_OnObjectBeingRemovedFromScene);
|
||||||
|
|
||||||
|
LogHeader += "-" + scene.RegionInfo.RegionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Called after AddRegion() has been called for all region modules of the scene
|
//Called after AddRegion() has been called for all region modules of the scene
|
||||||
|
@ -376,7 +377,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private static int PortUnknown = -1;
|
private static int PortUnknown = -1;
|
||||||
private static string IPAddrUnknown = "";
|
private static string IPAddrUnknown = String.Empty;
|
||||||
|
|
||||||
private ILog m_log;
|
private ILog m_log;
|
||||||
//private bool m_active = true;
|
//private bool m_active = true;
|
||||||
|
@ -562,8 +563,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
{
|
{
|
||||||
m_log.Debug("reading in " + m_scene.RegionInfo.RegionName + "_SyncListenerIPAddress" + " and " + m_scene.RegionInfo.RegionName + "_SyncListenerPort");
|
m_log.Debug("reading in " + m_scene.RegionInfo.RegionName + "_SyncListenerIPAddress" + " and " + m_scene.RegionInfo.RegionName + "_SyncListenerPort");
|
||||||
|
|
||||||
string addr = m_sysConfig.GetString(m_scene.RegionInfo.RegionName+"_SyncListenerIPAddress", IPAddrUnknown);
|
//string addr = m_sysConfig.GetString(m_scene.RegionInfo.RegionName+"_SyncListenerIPAddress", IPAddrUnknown);
|
||||||
int port = m_sysConfig.GetInt(m_scene.RegionInfo.RegionName+"_SyncListenerPort", PortUnknown);
|
//int port = m_sysConfig.GetInt(m_scene.RegionInfo.RegionName+"_SyncListenerPort", PortUnknown);
|
||||||
|
|
||||||
|
string addr = m_scene.RegionInfo.SyncListenerAddress;
|
||||||
|
int port = m_scene.RegionInfo.SyncListenerPort;
|
||||||
|
|
||||||
m_log.Warn(LogHeader + ", listener addr: " + addr + ", port: " + port);
|
m_log.Warn(LogHeader + ", listener addr: " + addr + ", port: " + port);
|
||||||
|
|
||||||
|
@ -585,8 +589,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
{
|
{
|
||||||
//For now, we assume there is only one remote listener to connect to. Later on,
|
//For now, we assume there is only one remote listener to connect to. Later on,
|
||||||
//we may need to modify the code to read in multiple listeners.
|
//we may need to modify the code to read in multiple listeners.
|
||||||
string addr = m_sysConfig.GetString(m_scene.RegionInfo.RegionName + "_SyncListenerIPAddress", IPAddrUnknown);
|
//string addr = m_sysConfig.GetString(m_scene.RegionInfo.RegionName + "_SyncListenerIPAddress", IPAddrUnknown);
|
||||||
int port = m_sysConfig.GetInt(m_scene.RegionInfo.RegionName + "_SyncListenerPort", PortUnknown);
|
//int port = m_sysConfig.GetInt(m_scene.RegionInfo.RegionName + "_SyncListenerPort", PortUnknown);
|
||||||
|
|
||||||
|
string addr = m_scene.RegionInfo.SyncListenerAddress;
|
||||||
|
int port = m_scene.RegionInfo.SyncListenerPort;
|
||||||
|
|
||||||
if (!addr.Equals(IPAddrUnknown) && port != PortUnknown)
|
if (!addr.Equals(IPAddrUnknown) && port != PortUnknown)
|
||||||
{
|
{
|
||||||
RegionSyncListenerInfo info = new RegionSyncListenerInfo(addr, port);
|
RegionSyncListenerInfo info = new RegionSyncListenerInfo(addr, port);
|
||||||
|
@ -882,6 +890,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//EVENTS PROCESSING
|
//EVENTS PROCESSING
|
||||||
|
case SymmetricSyncMessage.MsgType.NewScript:
|
||||||
case SymmetricSyncMessage.MsgType.UpdateScript:
|
case SymmetricSyncMessage.MsgType.UpdateScript:
|
||||||
case SymmetricSyncMessage.MsgType.ScriptReset:
|
case SymmetricSyncMessage.MsgType.ScriptReset:
|
||||||
case SymmetricSyncMessage.MsgType.ChatFromClient:
|
case SymmetricSyncMessage.MsgType.ChatFromClient:
|
||||||
|
@ -1040,6 +1049,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
switch (msg.Type)
|
switch (msg.Type)
|
||||||
{
|
{
|
||||||
|
case SymmetricSyncMessage.MsgType.NewScript:
|
||||||
|
HandleRemoteEvent_OnNewScript(init_actorID, evSeqNum, data);
|
||||||
|
break;
|
||||||
case SymmetricSyncMessage.MsgType.UpdateScript:
|
case SymmetricSyncMessage.MsgType.UpdateScript:
|
||||||
HandleRemoteEvent_OnUpdateScript(init_actorID, evSeqNum, data);
|
HandleRemoteEvent_OnUpdateScript(init_actorID, evSeqNum, data);
|
||||||
break;
|
break;
|
||||||
|
@ -1070,9 +1082,54 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="actorID">the ID of the actor that initiates the event</param>
|
||||||
|
/// <param name="evSeqNum">sequence num of the event from the actor</param>
|
||||||
|
/// <param name="data">OSDMap data of event args</param>
|
||||||
|
private void HandleRemoteEvent_OnNewScript(string actorID, ulong evSeqNum, OSDMap data)
|
||||||
|
{
|
||||||
|
m_log.Debug(LogHeader + ", " + m_actorID + ": received NewScript");
|
||||||
|
|
||||||
|
UUID agentID = data["agentID"].AsUUID();
|
||||||
|
UUID primID = data["primID"].AsUUID();
|
||||||
|
UUID itemID = data["itemID"].AsUUID();
|
||||||
|
|
||||||
|
string sogXml = data["sog"].AsString();
|
||||||
|
SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogXml);
|
||||||
|
SceneObjectPart part = null;
|
||||||
|
|
||||||
|
foreach (SceneObjectPart prim in sog.Parts)
|
||||||
|
{
|
||||||
|
if(prim.UUID.Equals(primID)){
|
||||||
|
part = prim;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(part == null)
|
||||||
|
{
|
||||||
|
m_log.Warn(LogHeader+": part "+primID+" not exist in the serialized object, do nothing");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Update the object first
|
||||||
|
Scene.ObjectUpdateResult updateResult = m_scene.AddOrUpdateObjectBySynchronization(sog);
|
||||||
|
|
||||||
|
if (updateResult == Scene.ObjectUpdateResult.Updated || updateResult == Scene.ObjectUpdateResult.New)
|
||||||
|
{
|
||||||
|
m_log.Debug(LogHeader + ": TriggerNewScriptLocally");
|
||||||
|
//Next, trigger creating the new script
|
||||||
|
SceneObjectPart localPart = m_scene.GetSceneObjectPart(primID);
|
||||||
|
m_scene.EventManager.TriggerNewScriptLocally(agentID, localPart, itemID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Special actions for remote event UpdateScript
|
/// Special actions for remote event UpdateScript
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="actorID">the ID of the actor that initiates the event</param>
|
||||||
|
/// <param name="evSeqNum">sequence num of the event from the actor</param>
|
||||||
/// <param name="data">OSDMap data of event args</param>
|
/// <param name="data">OSDMap data of event args</param>
|
||||||
private void HandleRemoteEvent_OnUpdateScript(string actorID, ulong evSeqNum, OSDMap data)
|
private void HandleRemoteEvent_OnUpdateScript(string actorID, ulong evSeqNum, OSDMap data)
|
||||||
{
|
{
|
||||||
|
@ -1089,7 +1146,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Special actions for remote event UpdateScript
|
/// Special actions for remote event ScriptReset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="data">OSDMap data of event args</param>
|
/// <param name="data">OSDMap data of event args</param>
|
||||||
private void HandleRemoteEvent_OnScriptReset(string actorID, ulong evSeqNum, OSDMap data)
|
private void HandleRemoteEvent_OnScriptReset(string actorID, ulong evSeqNum, OSDMap data)
|
||||||
|
@ -1273,7 +1330,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
/// only be triggered by an object removal that is initiated locally.
|
/// 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)
|
||||||
|
public void SendDeleteObject(SceneObjectGroup sog)
|
||||||
{
|
{
|
||||||
//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);
|
||||||
|
|
||||||
|
@ -1295,13 +1353,20 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
{
|
{
|
||||||
switch (ev)
|
switch (ev)
|
||||||
{
|
{
|
||||||
|
case EventManager.EventNames.NewScript:
|
||||||
|
if (evArgs.Length < 3)
|
||||||
|
{
|
||||||
|
m_log.Error(LogHeader + " not enough event args for NewScript");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OnLocalNewScript((UUID)evArgs[0], (SceneObjectPart)evArgs[1], (UUID)evArgs[2]);
|
||||||
|
return;
|
||||||
case EventManager.EventNames.UpdateScript:
|
case EventManager.EventNames.UpdateScript:
|
||||||
if (evArgs.Length < 5)
|
if (evArgs.Length < 5)
|
||||||
{
|
{
|
||||||
m_log.Error(LogHeader + " not enough event args for UpdateScript");
|
m_log.Error(LogHeader + " not enough event args for UpdateScript");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_log.Debug(LogHeader + " PublishSceneEvent UpdateScript");
|
|
||||||
OnLocalUpdateScript((UUID)evArgs[0], (UUID)evArgs[1], (UUID)evArgs[2], (bool)evArgs[3], (UUID)evArgs[4]);
|
OnLocalUpdateScript((UUID)evArgs[0], (UUID)evArgs[1], (UUID)evArgs[2], (bool)evArgs[3], (UUID)evArgs[4]);
|
||||||
return;
|
return;
|
||||||
case EventManager.EventNames.ScriptReset:
|
case EventManager.EventNames.ScriptReset:
|
||||||
|
@ -1342,6 +1407,32 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The handler for (locally initiated) event OnNewScript: triggered by client's RezSript packet, publish it to other actors.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="clientID">ID of the client who creates the new script</param>
|
||||||
|
/// <param name="part">the prim that contains the new script</param>
|
||||||
|
private void OnLocalNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
|
||||||
|
{
|
||||||
|
m_log.Debug(LogHeader + " RegionSyncModule_OnLocalNewScript");
|
||||||
|
|
||||||
|
SceneObjectGroup sog = part.ParentGroup;
|
||||||
|
if(sog==null){
|
||||||
|
m_log.Warn(LogHeader + ": part " + part.UUID + " not in an SceneObjectGroup yet. Will not propagating new script event");
|
||||||
|
//sog = new SceneObjectGroup(part);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//For simplicity, we just leverage a SOP's serialization method to transmit the information of new inventory item for the script).
|
||||||
|
//This can certainly be optimized later (e.g. only sending serialization of the inventory item)
|
||||||
|
OSDMap data = new OSDMap();
|
||||||
|
data["agentID"] = OSD.FromUUID(clientID);
|
||||||
|
data["primID"] = OSD.FromUUID(part.UUID);
|
||||||
|
data["itemID"] = OSD.FromUUID(itemID); //id of the new inventory item of the part
|
||||||
|
data["sog"] = OSD.FromString(SceneObjectSerializer.ToXml2Format(sog));
|
||||||
|
|
||||||
|
SendSceneEvent(SymmetricSyncMessage.MsgType.NewScript, data);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The handler for (locally initiated) event OnUpdateScript: publish it to other actors.
|
/// The handler for (locally initiated) event OnUpdateScript: publish it to other actors.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -89,8 +89,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
//for local OnUpdateScript, we'll handle it the same way as a remove OnUpdateScript.
|
//for local OnUpdateScript, we'll handle it the same way as a remove OnUpdateScript.
|
||||||
//RegionSyncModule will capture a locally initiated OnUpdateScript event and publish it to other actors.
|
//RegionSyncModule will capture a locally initiated OnUpdateScript event and publish it to other actors.
|
||||||
|
m_scene.EventManager.OnNewScript += ScriptEngine_OnNewScript;
|
||||||
m_scene.EventManager.OnUpdateScript += ScriptEngine_OnUpdateScript;
|
m_scene.EventManager.OnUpdateScript += ScriptEngine_OnUpdateScript;
|
||||||
//m_scene.EventManager.OnUpdateScriptBySync += ScriptEngine_OnUpdateScript;
|
//m_scene.EventManager.OnUpdateScriptBySync += ScriptEngine_OnUpdateScript;
|
||||||
|
|
||||||
|
LogHeader += "-" + m_actorID + "-" + m_scene.RegionInfo.RegionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Called after AddRegion() has been called for all region modules of the scene.
|
//Called after AddRegion() has been called for all region modules of the scene.
|
||||||
|
@ -182,6 +185,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_scene.DeleteAllSceneObjects();
|
m_scene.DeleteAllSceneObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ScriptEngine_OnNewScript(UUID agentID, SceneObjectPart part, UUID itemID)
|
||||||
|
{
|
||||||
|
m_log.Debug(LogHeader + " ScriptEngine_OnUpdateScript");
|
||||||
|
|
||||||
|
m_scene.SymSync_OnNewScript(agentID, itemID, part);
|
||||||
|
}
|
||||||
|
|
||||||
//Assumption, when this function is triggered, the new script asset has already been saved.
|
//Assumption, when this function is triggered, the new script asset has already been saved.
|
||||||
public void ScriptEngine_OnUpdateScript(UUID agentID, UUID itemID, UUID primID, bool isScriptRunning, UUID newAssetID)
|
public void ScriptEngine_OnUpdateScript(UUID agentID, UUID itemID, UUID primID, bool isScriptRunning, UUID newAssetID)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,6 +34,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
//RegionStatus,
|
//RegionStatus,
|
||||||
ActorID,
|
ActorID,
|
||||||
//events
|
//events
|
||||||
|
NewScript,
|
||||||
UpdateScript,
|
UpdateScript,
|
||||||
ScriptReset,
|
ScriptReset,
|
||||||
ChatFromClient,
|
ChatFromClient,
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
//void SendUpdatesToSynchronizeState(List<SceneObjectGroup> sog);
|
//void SendUpdatesToSynchronizeState(List<SceneObjectGroup> sog);
|
||||||
void SendSceneUpdates();
|
void SendSceneUpdates();
|
||||||
void SendTerrainUpdates(string lastUpdateActorID);
|
void SendTerrainUpdates(string lastUpdateActorID);
|
||||||
//void SendDeleteObject(SceneObjectGroup sog);
|
void SendDeleteObject(SceneObjectGroup sog);
|
||||||
|
|
||||||
//For propogating scene events to other actors
|
//For propogating scene events to other actors
|
||||||
void PublishSceneEvent(EventManager.EventNames ev, Object[] evArgs);
|
void PublishSceneEvent(EventManager.EventNames ev, Object[] evArgs);
|
||||||
|
|
|
@ -50,6 +50,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//the events that we'll handle specially in sym-sync
|
//the events that we'll handle specially in sym-sync
|
||||||
public enum EventNames
|
public enum EventNames
|
||||||
{
|
{
|
||||||
|
NewScript,
|
||||||
UpdateScript,
|
UpdateScript,
|
||||||
ScriptReset,
|
ScriptReset,
|
||||||
ChatFromClient, //chats from avatars
|
ChatFromClient, //chats from avatars
|
||||||
|
@ -65,6 +66,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region UpdateScript
|
||||||
|
//triggered by client.OnRezScript
|
||||||
|
public override void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
|
||||||
|
{
|
||||||
|
//publish the event to other actors who are intersted in it
|
||||||
|
if (m_scene.RegionSyncModule != null)
|
||||||
|
{
|
||||||
|
Object[] eventArgs = new Object[3];
|
||||||
|
eventArgs[0] = (Object)clientID;
|
||||||
|
eventArgs[1] = (Object)part;
|
||||||
|
eventArgs[2] = (Object)itemID;
|
||||||
|
m_scene.RegionSyncModule.PublishSceneEvent(EventNames.NewScript, eventArgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
//trigger event locally,
|
||||||
|
TriggerNewScriptLocally(clientID, part, itemID);
|
||||||
|
}
|
||||||
|
//public void TriggerNewScriptLocally(UUID clientID, UUID itemId, UUID primId, UUID newAssetID)
|
||||||
|
public void TriggerNewScriptLocally(UUID clientID, SceneObjectPart part, UUID itemID)
|
||||||
|
{
|
||||||
|
base.TriggerNewScript(clientID, part, itemID);
|
||||||
|
}
|
||||||
|
#endregion //UpdateScript
|
||||||
|
|
||||||
#region UpdateScript
|
#region UpdateScript
|
||||||
public override void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
|
public override void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
|
||||||
{
|
{
|
||||||
|
@ -80,7 +105,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_scene.RegionSyncModule.PublishSceneEvent(EventNames.UpdateScript, eventArgs);
|
m_scene.RegionSyncModule.PublishSceneEvent(EventNames.UpdateScript, eventArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
//trigger event locally, as the legacy code does
|
//trigger event locally,
|
||||||
TriggerUpdateScriptLocally(clientId, itemId, primId, isScriptRunning, newAssetID);
|
TriggerUpdateScriptLocally(clientId, itemId, primId, isScriptRunning, newAssetID);
|
||||||
}
|
}
|
||||||
public void TriggerUpdateScriptLocally(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
|
public void TriggerUpdateScriptLocally(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
|
||||||
|
@ -2379,7 +2404,31 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//OnUpdateTaskInventoryScriptAsset: triggered after Scene receives client's upload of updated script and stores it as asset
|
public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID);
|
||||||
|
public event NewScript OnNewScript;
|
||||||
|
public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
|
||||||
|
{
|
||||||
|
NewScript handlerNewScript = OnNewScript;
|
||||||
|
if (handlerNewScript != null)
|
||||||
|
{
|
||||||
|
foreach (NewScript d in handlerNewScript.GetInvocationList())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
d(clientID, part, itemID);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[EVENT MANAGER]: Delegate for TriggerNewScript failed - continuing. {0} {1}",
|
||||||
|
e.Message, e.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset
|
||||||
public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID);
|
public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID);
|
||||||
public event UpdateScript OnUpdateScript;
|
public event UpdateScript OnUpdateScript;
|
||||||
public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
|
public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
|
||||||
|
|
|
@ -310,7 +310,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
* */
|
* */
|
||||||
|
|
||||||
//SYMMETRIC SYNC: Distributed Scene Graph implementation
|
//SYMMETRIC SYNC: Distributed Scene Graph implementation
|
||||||
m_log.Debug("Scene.Inventory: to call EventManager.TriggerUpdateTaskInventoryScriptAsset, agentID: " + remoteClient.AgentId);
|
m_log.Debug("Scene.Inventory: to call EventManager.TriggerUpdateScript, agentID: " + remoteClient.AgentId);
|
||||||
//Trigger OnUpdateScript event.
|
//Trigger OnUpdateScript event.
|
||||||
EventManager.TriggerUpdateScript(remoteClient.AgentId, itemId, primId, isScriptRunning, item.AssetID);
|
EventManager.TriggerUpdateScript(remoteClient.AgentId, itemId, primId, isScriptRunning, item.AssetID);
|
||||||
|
|
||||||
|
@ -369,6 +369,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region SYMMETRIC SYNC
|
#region SYMMETRIC SYNC
|
||||||
|
public void SymSync_OnNewScript(UUID avatarID, UUID itemID, SceneObjectPart part)
|
||||||
|
{
|
||||||
|
TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID);
|
||||||
|
|
||||||
|
part.Inventory.CreateScriptInstance(item, 0, false, DefaultScriptEngine, 0);
|
||||||
|
part.ParentGroup.ResumeScripts();
|
||||||
|
}
|
||||||
|
|
||||||
//only a script engine actor is supposed to call this function
|
//only a script engine actor is supposed to call this function
|
||||||
public ArrayList SymSync_OnUpdateScript(UUID avatarID, UUID itemID, UUID primID, bool isScriptRunning, UUID newAssetID)
|
public ArrayList SymSync_OnUpdateScript(UUID avatarID, UUID itemID, UUID primID, bool isScriptRunning, UUID newAssetID)
|
||||||
{
|
{
|
||||||
|
@ -376,6 +384,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
SceneObjectPart part = GetSceneObjectPart(primID);
|
SceneObjectPart part = GetSceneObjectPart(primID);
|
||||||
SceneObjectGroup group = part.ParentGroup;
|
SceneObjectGroup group = part.ParentGroup;
|
||||||
|
|
||||||
|
if (null == group)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[PRIM INVENTORY]: " +
|
||||||
|
"Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist",
|
||||||
|
itemID, primID);
|
||||||
|
|
||||||
|
return new ArrayList();
|
||||||
|
}
|
||||||
|
|
||||||
if (isScriptRunning)
|
if (isScriptRunning)
|
||||||
{
|
{
|
||||||
m_log.Debug("To RemoveScriptInstance");
|
m_log.Debug("To RemoveScriptInstance");
|
||||||
|
@ -385,6 +404,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Retrieve item
|
// Retrieve item
|
||||||
TaskInventoryItem item = group.GetInventoryItem(part.LocalId, itemID);
|
TaskInventoryItem item = group.GetInventoryItem(part.LocalId, itemID);
|
||||||
|
|
||||||
|
if (null == item)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[PRIM INVENTORY]: Tried to retrieve item ID {0} from prim {1}, {2} for caps script update "
|
||||||
|
+ " but the item does not exist in this inventory",
|
||||||
|
itemID, part.Name, part.UUID);
|
||||||
|
|
||||||
|
return new ArrayList();
|
||||||
|
}
|
||||||
|
|
||||||
// Update item with new asset
|
// Update item with new asset
|
||||||
item.AssetID = newAssetID;
|
item.AssetID = newAssetID;
|
||||||
group.UpdateInventoryItem(item);
|
group.UpdateInventoryItem(item);
|
||||||
|
@ -1642,6 +1671,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
|
|
||||||
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
|
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
|
||||||
|
part.GetProperties(remoteClient);
|
||||||
|
|
||||||
|
//SYMMETRIC SYNC
|
||||||
|
/* Original OpenSim code, commented out
|
||||||
// TODO: switch to posting on_rez here when scripts
|
// TODO: switch to posting on_rez here when scripts
|
||||||
// have state in inventory
|
// have state in inventory
|
||||||
part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
|
part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
|
||||||
|
@ -1649,8 +1682,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// m_log.InfoFormat("[PRIMINVENTORY]: " +
|
// m_log.InfoFormat("[PRIMINVENTORY]: " +
|
||||||
// "Rezzed script {0} into prim local ID {1} for user {2}",
|
// "Rezzed script {0} into prim local ID {1} for user {2}",
|
||||||
// item.inventoryName, localID, remoteClient.Name);
|
// item.inventoryName, localID, remoteClient.Name);
|
||||||
part.GetProperties(remoteClient);
|
//part.GetProperties(remoteClient);
|
||||||
part.ParentGroup.ResumeScripts();
|
part.ParentGroup.ResumeScripts();
|
||||||
|
* */
|
||||||
|
if (RegionSyncModule != null)
|
||||||
|
{
|
||||||
|
part.SyncInfoUpdate();
|
||||||
|
EventManager.TriggerNewScript(remoteClient.AgentId, part, copyID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
|
||||||
|
|
||||||
|
// m_log.InfoFormat("[PRIMINVENTORY]: " +
|
||||||
|
// "Rezzed script {0} into prim local ID {1} for user {2}",
|
||||||
|
// item.inventoryName, localID, remoteClient.Name);
|
||||||
|
//part.GetProperties(remoteClient);
|
||||||
|
part.ParentGroup.ResumeScripts();
|
||||||
|
}
|
||||||
|
//end of SYMMETRIC SYNC
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1709,9 +1760,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.Inventory.AddInventoryItem(taskItem, false);
|
part.Inventory.AddInventoryItem(taskItem, false);
|
||||||
part.GetProperties(remoteClient);
|
part.GetProperties(remoteClient);
|
||||||
|
|
||||||
|
//SYMMETRIC SYNC
|
||||||
|
//part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
|
||||||
|
//part.ParentGroup.ResumeScripts();
|
||||||
|
if (RegionSyncModule != null)
|
||||||
|
{
|
||||||
|
part.SyncInfoUpdate();
|
||||||
|
EventManager.TriggerNewScript(remoteClient.AgentId, part, taskItem.ItemID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
|
part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
|
||||||
|
|
||||||
|
// m_log.InfoFormat("[PRIMINVENTORY]: " +
|
||||||
|
// "Rezzed script {0} into prim local ID {1} for user {2}",
|
||||||
|
// item.inventoryName, localID, remoteClient.Name);
|
||||||
|
//part.GetProperties(remoteClient);
|
||||||
part.ParentGroup.ResumeScripts();
|
part.ParentGroup.ResumeScripts();
|
||||||
}
|
}
|
||||||
|
//end of SYMMETRIC SYNC
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -69,8 +69,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
EventManager.TriggerOnChatBroadcast(this, args);
|
EventManager.TriggerOnChatBroadcast(this, args);
|
||||||
else
|
else
|
||||||
EventManager.TriggerOnChatFromWorld(this, args);
|
EventManager.TriggerOnChatFromWorld(this, args);
|
||||||
|
|
||||||
m_log.Debug("end of SimChat");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -662,8 +662,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (UnlinkSceneObject(group, false))
|
if (UnlinkSceneObject(group, false))
|
||||||
{
|
{
|
||||||
//For object removals caused by remote events (by other actors), do not trigger local event ObjectBeingRemovedFromScene
|
EventManager.TriggerObjectBeingRemovedFromScene(group);
|
||||||
//EventManager.TriggerObjectBeingRemovedFromScene(group);
|
|
||||||
EventManager.TriggerParcelPrimCountTainted();
|
EventManager.TriggerParcelPrimCountTainted();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2430,8 +2429,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
part.SyncInfoUpdate();
|
part.SyncInfoUpdate();
|
||||||
}
|
}
|
||||||
//end of SYMMETRIC SYNC
|
*
|
||||||
* */
|
* */
|
||||||
|
|
||||||
|
//Propagate the RemovedObject message
|
||||||
|
if (RegionSyncModule != null)
|
||||||
|
{
|
||||||
|
RegionSyncModule.SendDeleteObject(group);
|
||||||
|
}
|
||||||
|
//end of SYMMETRIC SYNC
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -3592,9 +3599,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); });
|
ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); });
|
||||||
|
|
||||||
|
//SYMMETRIC SYNC: object remove should be handled through RegionSyncModule
|
||||||
// REGION SYNC
|
// REGION SYNC
|
||||||
|
/*
|
||||||
if( IsSyncedServer() )
|
if( IsSyncedServer() )
|
||||||
RegionSyncServerModule.DeleteObject(m_regionHandle, localID, part);
|
RegionSyncServerModule.DeleteObject(m_regionHandle, localID, part);
|
||||||
|
* */
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -1164,6 +1164,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//return;
|
//return;
|
||||||
}
|
}
|
||||||
* */
|
* */
|
||||||
|
//end of SYMMETRIC SYNC
|
||||||
|
|
||||||
Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
Scene.ForEachScenePresence(delegate(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
|
|
|
@ -539,6 +539,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//m_inventorySerial += 2;
|
//m_inventorySerial += 2;
|
||||||
HasInventoryChanged = true;
|
HasInventoryChanged = true;
|
||||||
m_part.ParentGroup.HasGroupChanged = true;
|
m_part.ParentGroup.HasGroupChanged = true;
|
||||||
|
|
||||||
|
//SYMMETRIC SYNC: add ScheduleFullUpdate to enable synchronization across actors
|
||||||
|
m_part.ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue