Initial connection of phys actor

dsg
Robert Adams 2010-12-06 10:57:39 -08:00
parent b56b0c3086
commit 24bef963c7
11 changed files with 171 additions and 635 deletions

View File

@ -63,7 +63,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
// The client connection to the RegionSyncServer // The client connection to the RegionSyncServer
private TcpClient m_client = new TcpClient(); private TcpClient m_client = new TcpClient();
private string m_authSceneName;
//KittyL: Comment out m_statsTimer for now, will figure out whether we need it for PhysEngine later //KittyL: Comment out m_statsTimer for now, will figure out whether we need it for PhysEngine later
//private System.Timers.Timer m_statsTimer = new System.Timers.Timer(30000); //private System.Timers.Timer m_statsTimer = new System.Timers.Timer(30000);
@ -94,7 +93,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
// Constructor // Constructor
public PhysEngineToSceneConnector(Scene validLocalScene, string addr, int port, bool debugWithViewer, string authSceneName, IConfig sysConfig) public PhysEngineToSceneConnector(Scene validLocalScene, string addr, int port, bool debugWithViewer,
IConfig sysConfig)
{ {
m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
m_validLocalScene = validLocalScene; m_validLocalScene = validLocalScene;
@ -102,7 +102,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_addrString = addr; m_addrString = addr;
m_port = port; m_port = port;
m_debugWithViewer = debugWithViewer; m_debugWithViewer = debugWithViewer;
m_authSceneName = authSceneName;
//m_statsTimer.Elapsed += new System.Timers.ElapsedEventHandler(StatsTimerElapsed); //m_statsTimer.Elapsed += new System.Timers.ElapsedEventHandler(StatsTimerElapsed);
m_sysConfig = sysConfig; m_sysConfig = sysConfig;
@ -110,53 +109,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_subscribedQuarks = new QuarkSubsriptionInfo(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize); m_subscribedQuarks = new QuarkSubsriptionInfo(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize);
} }
/// <summary>
/// Create a PhysEngineToSceneConnector based on the space it is supposed to subscribe (and operate) on.
/// </summary>
/// <param name="validLocalScene"></param>
/// <param name="addr"></param>
/// <param name="port"></param>
/// <param name="debugWithViewer"></param>
/// <param name="authSceneName"></param>
/// <param name="subscriptionSpace"></param>
/// <param name="quarkSizeX"></param>
/// <param name="quarkSizeY"></param>
/// <param name="sysConfig"></param>
public PhysEngineToSceneConnector(Scene validLocalScene, string addr, int port, bool debugWithViewer, string authSceneName,
string subscriptionSpace, IConfig sysConfig)
{
if (QuarkInfo.SizeX == -1 || QuarkInfo.SizeY == -1)
{
m_log.Error("QuarkInfo.SizeX or QuarkInfo.SizeY has not been configured.");
Environment.Exit(0);
}
m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
m_validLocalScene = validLocalScene;
m_addr = IPAddress.Parse(addr);
m_addrString = addr;
m_port = port;
m_debugWithViewer = debugWithViewer;
m_authSceneName = authSceneName;
//m_statsTimer.Elapsed += new System.Timers.ElapsedEventHandler(StatsTimerElapsed);
m_sysConfig = sysConfig;
m_subscribedQuarks = new QuarkSubsriptionInfo(subscriptionSpace);
}
public PhysEngineToSceneConnectorModule GetPEToSceneConnectorMasterModule()
{
if (m_validLocalScene == null)
return null;
return (PhysEngineToSceneConnectorModule)m_validLocalScene.PhysEngineToSceneConnectorModule;
}
public Scene GetValidLocalScene()
{
return m_validLocalScene;
}
private List<string> GetQuarkStringList() private List<string> GetQuarkStringList()
{ {
List<string> quarkList = new List<string>(); List<string> quarkList = new List<string>();
@ -167,19 +119,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
return quarkList; return quarkList;
} }
/// <summary>
/// Get the reference to the local scene that is supposed to be mapped to the remote auth. scene.
/// </summary>
/// <param name="authSceneName"></param>
/// <returns></returns>
private Scene GetLocalScene(string authSceneName)
{
PhysEngineToSceneConnectorModule connectorModule = GetPEToSceneConnectorMasterModule();
return connectorModule.GetLocalScene(authSceneName);
}
// Start the RegionSyncPhysEngine client thread // Start the RegionSyncPhysEngine client thread
public bool Start() public bool Start()
{ {
@ -474,28 +413,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
case RegionSyncMessage.MsgType.RegionName: case RegionSyncMessage.MsgType.RegionName:
{ {
string authSceneName = Encoding.ASCII.GetString(msg.Data, 0, msg.Length);
if (authSceneName != m_authSceneName)
{
//This should not happen. If happens, check the configuration files (OpenSim.ini) on other sides.
m_log.Warn(": !!! Mismatch between configurations of authoritative scene. Script Engine's config: "+m_authSceneName+", Scene's config: "+authSceneName);
return;
}
RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Syncing to region \"{0}\"", m_authSceneName));
return; return;
} }
case RegionSyncMessage.MsgType.Terrain: case RegionSyncMessage.MsgType.Terrain:
{ {
//We need to handle terrain differently as we handle objects: we really will set the HeightMap //We need to handle terrain differently as we handle objects: we really will set the HeightMap
//of each local scene that is the shadow copy of its auth. scene. //of each local scene that is the shadow copy of its auth. scene.
Scene localScene = GetLocalScene(m_authSceneName);
if (localScene == null)
{
m_log.Warn("no local Scene mapped to "+m_authSceneName);
return;
}
localScene.Heightmap.LoadFromXmlString(Encoding.ASCII.GetString(msg.Data, 0, msg.Length));
RegionSyncMessage.HandleSuccess(LogHeader, msg, "Synchronized terrain");
return; return;
} }
case RegionSyncMessage.MsgType.NewObject: case RegionSyncMessage.MsgType.NewObject:
@ -556,24 +479,24 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
#endregion Utility functions #endregion Utility functions
#region Handlers for Scene events #region Handlers for Scene events
private void HandleAddOrUpdateObjectInLocalScene(RegionSyncMessage msg) private void HandleAddOrUpdateObjectInLocalScene(RegionSyncMessage msg)
{ {
// TODO: modify for physics // TODO: modify for physics
OSDMap data = DeserializeMessage(msg); OSDMap data = DeserializeMessage(msg);
/* /*
if (data["locX"] == null || data["locY"] == null || data["sogXml"] == null) if (data["locX"] == null || data["locY"] == null || data["sogXml"] == null)
{ {
m_log.Warn(LogHeader + ": parameters missing in NewObject/UpdatedObject message, need to have locX, locY, sogXml"); m_log.Warn(LogHeader + ": parameters missing in NewObject/UpdatedObject message, need to have locX, locY, sogXml");
return; return;
} }
* */ * */
uint locX = data["locX"].AsUInteger(); uint locX = data["locX"].AsUInteger();
uint locY = data["locY"].AsUInteger(); uint locY = data["locY"].AsUInteger();
string sogxml = data["sogXml"].AsString(); string sogxml = data["sogXml"].AsString();
SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogxml); SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogxml);
} }
#endregion Handlers for events/updates from Scene #endregion Handlers for events/updates from Scene

View File

@ -44,6 +44,35 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//The connector that connects the local Scene (cache) and remote authoratative Scene //The connector that connects the local Scene (cache) and remote authoratative Scene
public class PhysEngineToSceneConnectorModule : IRegionModule, IPhysEngineToSceneConnectorModule, ICommandableModule public class PhysEngineToSceneConnectorModule : IRegionModule, IPhysEngineToSceneConnectorModule, ICommandableModule
{ {
#region PhysEngineToSceneConnectorModule members and functions
private static int m_activeActors = 0;
private bool m_active = false;
private string m_serveraddr;
private int m_serverport;
private Scene m_scene;
private ILog m_log;
private Object m_client_lock = new Object();
//private PhysEngineToSceneConnector m_scriptEngineToSceneConnector = null;
private IConfig m_syncConfig = null;
public IConfig SyncConfig { get { return m_syncConfig; } }
private bool m_debugWithViewer = false;
public bool DebugWithViewer { get { return m_debugWithViewer; } }
private string m_regionSyncMode = "";
//Variables relavant for multi-scene subscription.
private Dictionary<string, PhysEngineToSceneConnector> m_PEToSceneConnectors = new Dictionary<string, PhysEngineToSceneConnector>(); //connector for each auth. scene
private string LogHeader = "[PhysEngineToSceneConnectorModule]";
private PhysEngineToSceneConnector m_idlePEToSceneConnector = null;
//quark information
//private int QuarkInfo.SizeX;
//private int QuarkInfo.SizeY;
//private string m_quarkListString;
private string m_subscriptionSpaceString;
#endregion PhysEngineToSceneConnectorModule members and functions
#region IRegionModule Members #region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config) public void Initialise(Scene scene, IConfigSource config)
@ -53,75 +82,30 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//Read in configuration //Read in configuration
IConfig syncConfig = config.Configs["RegionSyncModule"]; IConfig syncConfig = config.Configs["RegionSyncModule"];
if (syncConfig != null && syncConfig.GetString("Enabled", "").ToLower() == "true") if (syncConfig != null
&& syncConfig.GetBoolean("Enabled", false)
&& syncConfig.GetString("Mode", "").ToLower() == "client"
&& syncConfig.GetBoolean("PhysEngineClient", false)
)
{ {
scene.RegionSyncEnabled = true; scene.RegionSyncEnabled = true;
} }
else else
{ {
scene.RegionSyncEnabled = false; scene.RegionSyncEnabled = false;
} m_log.Warn(LogHeader + ": Not in physics engine client mode. Shutting down.");
m_regionSyncMode = syncConfig.GetString("Mode", "").ToLower();
if (syncConfig == null || m_regionSyncMode != "physics_engine")
{
m_log.Warn("[REGION SYNC PHYSICS ENGINE MODULE] Not in script_engine mode. Shutting down.");
return; return;
} }
//get the name of the valid region for script engine, i.e., that region that will holds all objects and scripts m_active = true;
//if not matching m_scene's name, simply return m_activeActors++;
string validLocalScene = syncConfig.GetString("ValidPhysEngineScene", "");
if (!validLocalScene.Equals(scene.RegionInfo.RegionName))
{
m_log.Warn("Not the valid local scene, shutting down");
return;
}
m_active = true;
m_validLocalScene = validLocalScene;
m_log.Debug("Init PEToSceneConnectorModule, for local scene " + scene.RegionInfo.RegionName); m_log.Debug(LogHeader + " Init PEToSceneConnectorModule, for local scene " + scene.RegionInfo.RegionName);
//get the number of regions this script engine subscribes string configString = scene.RegionInfo.RegionName + "_SceneToPESyncServerIP";
m_sceneNum = syncConfig.GetInt("SceneNumber", 1); m_serveraddr = syncConfig.GetString(configString, "127.0.0.1");
configString = scene.RegionInfo.RegionName + "_SceneToPESyncServerPort";
//get the mapping of local scenes to auth. scenes m_serverport = syncConfig.GetInt(configString, 13000);
List<string> authScenes = new List<string>();
for (int i = 0; i < m_sceneNum; i++)
{
string localScene = "LocalScene" + i;
string localSceneName = syncConfig.GetString(localScene, "");
string masterScene = localScene + "Master";
string masterSceneName = syncConfig.GetString(masterScene, "");
if (localSceneName.Equals("") || masterSceneName.Equals(""))
{
m_log.Warn(localScene + " or " + masterScene+ " has not been assigned a value in configuration. Shutting down.");
return;
}
//m_localToAuthSceneMapping.Add(localSceneName, masterSceneName);
RecordLocalAuthSceneMappings(localSceneName, masterSceneName);
authScenes.Add(masterSceneName);
m_localScenesByName.Add(localSceneName, null);
}
int defaultPort = 13000;
//get the addr:port info of the authoritative scenes
for (int i = 0; i < m_sceneNum; i++)
{
string authSceneName = authScenes[i];
//string serverAddr = authSceneName + "_ServerIPAddress";
//string serverPort = authSceneName + "_ServerPort";
string serverAddr = authSceneName + "_SceneToPESyncServerIP";
string addr = syncConfig.GetString(serverAddr, "127.0.0.1");
string serverPort = authSceneName + "_SceneToPESyncServerPort";
int port = syncConfig.GetInt(serverPort, defaultPort);
defaultPort++;
AuthSceneInfo authSceneInfo = new AuthSceneInfo(authSceneName, addr, port);
m_authScenesInfoByName.Add(authSceneName, authSceneInfo);
}
m_scene = scene; m_scene = scene;
m_scene.RegisterModuleInterface<IPhysEngineToSceneConnectorModule>(this); m_scene.RegisterModuleInterface<IPhysEngineToSceneConnectorModule>(this);
@ -146,7 +130,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
InstallInterfaces(); InstallInterfaces();
m_log.Warn("[REGION SYNC PHYSICS ENGINE MODULE] Initialised"); m_log.Warn(LogHeader + " Initialised");
} }
public void PostInitialise() public void PostInitialise()
@ -154,18 +138,17 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
if (!m_active) if (!m_active)
return; return;
//m_log.Warn("[REGION SYNC CLIENT MODULE] Post-Initialised"); //m_log.Warn(LogHeader + " Post-Initialised");
m_scene.EventManager.OnPopulateLocalSceneList += OnPopulateLocalSceneList;
} }
public void Close() public void Close()
{ {
if (m_active) if (m_active)
{ {
m_scene.EventManager.OnPopulateLocalSceneList -= OnPopulateLocalSceneList;
} }
m_scene = null; m_scene = null;
m_active = false; m_active = false;
m_activeActors--;
} }
public string Name public string Name
@ -180,7 +163,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
#endregion #endregion
#region ICommandableModule Members #region ICommandableModule Members
private readonly Commander m_commander = new Commander("sync"); private readonly Commander m_commander = new Commander("phys");
public ICommander CommandInterface public ICommander CommandInterface
{ {
get { return m_commander; } get { return m_commander; }
@ -206,323 +189,32 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
} }
public static bool IsPhysEngineScene
#endregion
#region PhysEngineToSceneConnectorModule members and functions
private bool m_active = false;
private string m_serveraddr;
private int m_serverport;
private Scene m_scene;
private ILog m_log;
private Object m_client_lock = new Object();
//private PhysEngineToSceneConnector m_scriptEngineToSceneConnector = null;
private IConfig m_syncConfig = null;
private bool m_debugWithViewer = false;
private string m_regionSyncMode = "";
//Variables relavant for multi-scene subscription.
private int m_sceneNum = 0;
private string m_validLocalScene = "";
private Dictionary<string, string> m_localToAuthSceneMapping = new Dictionary<string,string>(); //1-1 mapping from local shadow scene to authoratative scene
private Dictionary<string, string> m_authToLocalSceneMapping = new Dictionary<string, string>(); //1-1 mapping from authoratative scene to local shadow scene
private Dictionary<string, Scene> m_localScenesByName = new Dictionary<string,Scene>(); //name and references to local scenes
private Dictionary<string, AuthSceneInfo> m_authScenesInfoByName = new Dictionary<string,AuthSceneInfo>(); //info of each auth. scene's connector port, stored by each scene's name
private Dictionary<string, PhysEngineToSceneConnector> m_PEToSceneConnectors = new Dictionary<string, PhysEngineToSceneConnector>(); //connector for each auth. scene
private Dictionary<string, AuthSceneInfo> m_authScenesInfoByLoc = new Dictionary<string,AuthSceneInfo>(); //IP and port number of each auth. scene's connector port
private string LogHeader = "[PhysEngineToSceneConnectorModule]";
private PhysEngineToSceneConnector m_idlePEToSceneConnector = null;
//quark information
//private int QuarkInfo.SizeX;
//private int QuarkInfo.SizeY;
//private string m_quarkListString;
private string m_subscriptionSpaceString;
public IConfig SyncConfig
{ {
get { return m_syncConfig; } get { return SceneToPhysEngineSyncServer.IsPhysEngineScene; }
} }
public static bool IsActivePhysEngineScene
public bool DebugWithViewer
{ {
get { return m_debugWithViewer; } get { return SceneToPhysEngineSyncServer.IsActivePhysEngineScene; }
} }
public static bool IsPhysEngineActor
//Record the locX and locY of one auth. scene (identified by addr:port) this PhysEngine connects to
public void RecordSceneLocation(string addr, int port, uint locX, uint locY)
{ {
string loc = SceneLocToString(locX, locY); get { return (m_activeActors != 0); }
if (m_authScenesInfoByLoc.ContainsKey(loc))
{
m_log.Warn(": have already registered info for Scene at " + loc);
m_authScenesInfoByLoc.Remove(loc);
}
foreach (KeyValuePair<string, AuthSceneInfo> valPair in m_authScenesInfoByName)
{
AuthSceneInfo authSceneInfo = valPair.Value;
if (authSceneInfo.Addr == addr && authSceneInfo.Port == port)
{
authSceneInfo.LocX = (int)locX;
authSceneInfo.LocY = (int)locY;
m_authScenesInfoByLoc.Add(loc, authSceneInfo);
break;
}
}
}
/// <summary>
/// Set the property of a prim located in the given scene (identified by locX, locY)
/// </summary>
/// <param name="locX"></param>
/// <param name="locY"></param>
/// <param name="primID"></param>
/// <param name="pName"></param>
/// <param name="pValue"></param>
public void SendSetPrimProperties(uint locX, uint locY, UUID primID, string pName, object pValue)
{
if (!Active || !Synced)
return;
PhysEngineToSceneConnector connector = GetPEToSceneConnector(locX, locY);
connector.SendSetPrimProperties(primID, pName, pValue);
}
public Scene GetLocalScene(string authSceneName)
{
if (!m_authToLocalSceneMapping.ContainsKey(authSceneName))
{
m_log.Warn(LogHeader + ": no authoritative scene with name "+authSceneName+" recorded");
return null;
}
string localSceneName = m_authToLocalSceneMapping[authSceneName];
if (m_localScenesByName.ContainsKey(localSceneName))
{
return m_localScenesByName[localSceneName];
}
else
return null;
}
private string SceneLocToString(uint locX, uint locY)
{
string loc = locX + "-" + locY;
return loc;
}
//Get the right instance of PhysEngineToSceneConnector, given the location of the authoritative scene
private PhysEngineToSceneConnector GetPEToSceneConnector(uint locX, uint locY)
{
string loc = SceneLocToString(locX, locY);
if (!m_authScenesInfoByLoc.ContainsKey(loc))
return null;
string authSceneName = m_authScenesInfoByLoc[loc].Name;
if (!m_PEToSceneConnectors.ContainsKey(authSceneName))
{
return null;
}
return m_PEToSceneConnectors[authSceneName];
}
private void RecordLocalAuthSceneMappings(string localSceneName, string authSceneName)
{
if (m_localToAuthSceneMapping.ContainsKey(localSceneName))
{
m_log.Warn(LogHeader + ": already registered " + localSceneName+", authScene was recorded as "+ m_localToAuthSceneMapping[localSceneName]);
}
else
{
m_localToAuthSceneMapping.Add(localSceneName, authSceneName);
}
if (m_authToLocalSceneMapping.ContainsKey(authSceneName))
{
m_log.Warn(LogHeader + ": already registered " + authSceneName + ", authScene was recorded as " + m_authToLocalSceneMapping[authSceneName]);
}
else
{
m_authToLocalSceneMapping.Add(authSceneName, localSceneName);
}
}
//Get the name of the authoritative scene the given local scene maps to. Return null if not found.
private string GetAuthSceneName(string localSceneName)
{
if (m_localToAuthSceneMapping.ContainsKey(localSceneName))
{
m_log.Warn(LogHeader + ": " + localSceneName + " not registered in m_localToAuthSceneMapping");
return null;
}
return m_localToAuthSceneMapping[localSceneName];
}
//get the name of the local scene the given authoritative scene maps to. Return null if not found.
private string GetLocalSceneName(string authSceneName)
{
if (!m_authToLocalSceneMapping.ContainsKey(authSceneName))
{
m_log.Warn(LogHeader + ": " + authSceneName + " not registered in m_authToLocalSceneMapping");
return null;
}
return m_authToLocalSceneMapping[authSceneName];
} }
#endregion #endregion
#region Event Handlers #region Event Handlers
public void OnPopulateLocalSceneList(List<Scene> localScenes)
//public void OnPopulateLocalSceneList(List<Scene> localScenes, string[] cmdparams)
{
if (!Active)
return;
//populate the dictionary m_localScenes
foreach (Scene lScene in localScenes)
{
string name = lScene.RegionInfo.RegionName;
if(!m_localScenesByName.ContainsKey(name)){
m_log.Warn(LogHeader+": has not reigstered a local scene named "+name);
continue;
}
m_localScenesByName[name] = lScene;
//lScene.RegionSyncMode = m_regionSyncMode;
lScene.IsOutsideScenes = IsOutSideSceneSubscriptions;
}
//test position conversion
/*
//Vector3 pos = new Vector3(290, 100, 10);
uint preLocX = Convert.ToUInt32(cmdparams[2]);
uint preLocY = Convert.ToUInt32(cmdparams[3]);
float posX = (float)Convert.ToDouble(cmdparams[4]);
float posY = (float)Convert.ToDouble(cmdparams[5]);
float posZ = (float)Convert.ToDouble(cmdparams[6]);
Vector3 pos = new Vector3(posX, posY, posZ);
uint locX, locY;
Vector3 newPos;
ConvertPosition(1000, 1000, pos, out locX, out locY, out newPos);
* */
}
#endregion #endregion
private string GetAllSceneNames()
{
string scenes = "";
foreach (KeyValuePair<string, Scene> valPair in m_localScenesByName)
{
Scene lScene = valPair.Value;
string authScene = m_localToAuthSceneMapping[lScene.RegionInfo.RegionName];
scenes += authScene + ",";
}
return scenes;
}
//public bool IsOutSideSceneSubscriptions(Scene currentScene, Vector3 pos)
public bool IsOutSideSceneSubscriptions(uint locX, uint locY, Vector3 pos)
{
string sceneNames = GetAllSceneNames();
m_log.Debug(LogHeader + ": IsOutSideSceneSubscriptions called. Conceptually, we are checking inside scene-subscriptions: " + sceneNames);
//First, convert the position to a scene s.t. the attempting position is contained withing that scene
uint curLocX, curLocY;
Vector3 curPos;
bool converted = ConvertPosition(locX, locY, pos, out curLocX, out curLocY, out curPos);
if (!converted)
{
m_log.Warn("("+locX+","+locY+","+pos+")"+" converts to scenes with negative coordinates.");
return false;
}
//See of the quark identified by (curLocX,curLocY) is one we subscribed to
string sceneLoc = SceneLocToString(curLocX, curLocY);
if (m_authScenesInfoByLoc.ContainsKey(sceneLoc))
{
return false;
}
else
{
return true;
}
}
//When the offset position is outside the range of current scene, convert it to the offset position in the right quark.
//Return null if the new scene's left-bottom corner X or Y value is negative.
//Assumption: A position is uniquely identified by (locX, locY, offsetPos).
private bool ConvertPosition(uint preLocX, uint preLocY, Vector3 prePos, out uint curLocX, out uint curLocY, out Vector3 curPos)
{
Vector3 newPos;
int newLocX;
int newLocY;
//code copied from EntityTransferModule.Cross()
newPos = prePos;
newLocX = (int)preLocX;
newLocY = (int)preLocY;
int changeX = 1;
int changeY = 1;
//Adjust the X values, if going east, changeX is positive, otherwise, it is negative
if (prePos.X >= 0)
{
changeX = (int)(prePos.X / (int)Constants.RegionSize);
}
else
{
changeX = (int)(prePos.X / (int)Constants.RegionSize) - 1 ;
}
newLocX = (int)preLocX + changeX;
newPos.X = prePos.X - (changeX * Constants.RegionSize);
if (prePos.Y >= 0)
{
changeY = (int)(prePos.Y / (int)Constants.RegionSize);
}
else
{
changeY = (int)(prePos.Y / (int)Constants.RegionSize) - 1;
}
changeY = (int)(prePos.Y / (int)Constants.RegionSize);
newLocY = (int)preLocY + changeY;
newPos.Y = prePos.Y - (changeY * Constants.RegionSize);
curLocX = (uint)newLocX;
curLocY = (uint)newLocY;
curPos = newPos;
if (newLocX < 0 || newLocY < 0)
{
//reset the position
curLocX = preLocX;
curLocY = preLocY;
if (newLocX < 0)
{
curPos.X = 2;
}
if(newLocY<0)
{
curPos.Y = 2;
}
return false;
}
else
return true;
}
private void DebugSceneStats() private void DebugSceneStats()
{ {
return; return;
/* /*
List<ScenePresence> avatars = m_scene.GetAvatars(); List<ScenePresence> avatars = m_scene.GetAvatars();
List<EntityBase> entities = m_scene.GetEntities(); List<EntityBase> entities = m_scene.GetEntities();
m_log.WarnFormat("There are {0} avatars and {1} entities in the scene", avatars.Count, entities.Count); m_log.WarnFormat("{0} There are {1} avatars and {2} entities in the scene", LogHeader, avatars.Count, entities.Count);
*/ */
} }
@ -548,17 +240,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
cmdSyncSetQuarkSize.AddArgument("quarksizeX", "The size on x axis of each quark", "Integer"); cmdSyncSetQuarkSize.AddArgument("quarksizeX", "The size on x axis of each quark", "Integer");
cmdSyncSetQuarkSize.AddArgument("quarksizeY", "The size on y axis of each quark", "Integer"); cmdSyncSetQuarkSize.AddArgument("quarksizeY", "The size on y axis of each quark", "Integer");
Command cmdSyncRegister = new Command("register", CommandIntentions.COMMAND_HAZARDOUS, SyncRegister, "Register as an idle script engine. Sync'ing with Scene won't start until \"sync start\". ");
//For debugging load balancing and migration process
Command cmdSyncStartLB = new Command("startLB", CommandIntentions.COMMAND_HAZARDOUS, SyncStartLB, "Register as an idle script engine. Sync'ing with Scene won't start until \"sync start\". ");
m_commander.RegisterCommand("start", cmdSyncStart); m_commander.RegisterCommand("start", cmdSyncStart);
m_commander.RegisterCommand("stop", cmdSyncStop); m_commander.RegisterCommand("stop", cmdSyncStop);
m_commander.RegisterCommand("status", cmdSyncStatus); m_commander.RegisterCommand("status", cmdSyncStatus);
m_commander.RegisterCommand("quarkSpace", cmdSyncSetQuarks); m_commander.RegisterCommand("quarkSpace", cmdSyncSetQuarks);
m_commander.RegisterCommand("register", cmdSyncRegister);
m_commander.RegisterCommand("startLB", cmdSyncStartLB);
lock (m_scene) lock (m_scene)
{ {
@ -574,7 +259,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
/// <param name="args">Commandline arguments</param> /// <param name="args">Commandline arguments</param>
private void EventManager_OnPluginConsole(string[] args) private void EventManager_OnPluginConsole(string[] args)
{ {
if (args[0] == "sync") if (args[0] == "phys")
{ {
if (args.Length == 1) if (args.Length == 1)
{ {
@ -595,100 +280,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
lock (m_client_lock) lock (m_client_lock)
{ {
//if (m_scriptEngineToSceneConnector != null) //m_log.Warn(LogHeader + " Starting synchronization");
if(m_PEToSceneConnectors.Count>0)
{
string authScenes = "";
foreach (KeyValuePair<string, PhysEngineToSceneConnector> valPair in m_PEToSceneConnectors)
{
authScenes += valPair.Key + ", ";
}
m_log.WarnFormat(LogHeader+": Already synchronized to "+authScenes);
return;
}
//m_log.Warn("[REGION SYNC CLIENT MODULE] Starting synchronization");
m_log.Warn(LogHeader + ": Starting RegionSyncPhysEngine"); m_log.Warn(LogHeader + ": Starting RegionSyncPhysEngine");
if (m_sceneNum > 1) //Only one remote scene to connect to. Subscribe to whatever specified in the config file.
{ //List<string> quarkStringList = RegionSyncUtil.QuarkStringToStringList(m_quarkListString);
//If there is no arguments following "sync start", then be default we will connect to one or more scenes. //InitPhysEngineToSceneConnector(quarkStringList);
//we need to create a connector to each authoritative scene InitPhysEngineToSceneConnector(m_subscriptionSpaceString);
foreach (KeyValuePair<string, AuthSceneInfo> valPair in m_authScenesInfoByName)
{
string authSceneName = valPair.Key;
AuthSceneInfo authSceneInfo = valPair.Value;
//create a new connector, the local end of each connector, however, is linked to the ValidScene only,
//since all objects will be contained in this scene only
PhysEngineToSceneConnector scriptEngineToSceneConnector = new PhysEngineToSceneConnector(m_scene, authSceneInfo.Addr, authSceneInfo.Port, m_debugWithViewer, authSceneName, m_syncConfig);
if (scriptEngineToSceneConnector.Start())
{
m_PEToSceneConnectors.Add(authSceneName, scriptEngineToSceneConnector);
}
}
}
else
{
//Only one remote scene to connect to. Subscribe to whatever specified in the config file.
//List<string> quarkStringList = RegionSyncUtil.QuarkStringToStringList(m_quarkListString);
//InitPhysEngineToSceneConnector(quarkStringList);
InitPhysEngineToSceneConnector(m_subscriptionSpaceString);
}
} }
} }
private void SyncRegister(Object[] args)
{
//This should not happen. No-validLocalScene should not have register handlers for the command
//if (m_scene.RegionInfo.RegionName != m_validLocalScene)
// return;
//Registration only, no state sync'ing yet. So only start the connector for the validLocalScene. (For now, we only test this with one scene, and
//quarks are smaller than a 256x256 scene.
string authSceneName = m_localToAuthSceneMapping[m_validLocalScene];
AuthSceneInfo authSceneInfo = m_authScenesInfoByName[authSceneName];
m_idlePEToSceneConnector = new PhysEngineToSceneConnector(m_scene, authSceneInfo.Addr, authSceneInfo.Port, m_debugWithViewer, authSceneName, m_syncConfig);
m_idlePEToSceneConnector.RegisterIdle();
}
/// <summary>
/// The given PhysEngineToSceneConnector, after having connected to the Scene (called its Start()), will
/// call this function to remove it self as an idle connector, and to be recorded as one working connector.
/// </summary>
/// <param name="seToSceneConnector"></param>
public void RecordSyncStartAfterLoadMigration(PhysEngineToSceneConnector seToSceneConnector)
{
foreach (KeyValuePair<string, AuthSceneInfo> valPair in m_authScenesInfoByName)
{
string authSceneName = valPair.Key;
AuthSceneInfo authSceneInfo = valPair.Value;
string localScene = m_authToLocalSceneMapping[authSceneName];
if (localScene != m_scene.RegionInfo.RegionName)
continue;
if (m_PEToSceneConnectors.ContainsKey(authSceneName))
{
m_log.Warn(LogHeader + ": Connector to " + authSceneName + " is already considered connected");
return;
}
m_PEToSceneConnectors.Add(authSceneName, seToSceneConnector);
//there should only be one element in the dictionary if we reach this loop, anyway, we break from it.
break;
}
m_idlePEToSceneConnector = null;
}
private void SyncStartLB(Object[] args)
{
string authSceneName = m_localToAuthSceneMapping[m_validLocalScene];
PhysEngineToSceneConnector sceneConnector = m_PEToSceneConnectors[authSceneName];
// TODO: load balancing. Next line commented out
// sceneConnector.SendLoadBalanceRequest();
}
private void SetQuarkList(Object[] args) private void SetQuarkList(Object[] args)
{ {
m_subscriptionSpaceString = (string)args[0]; m_subscriptionSpaceString = (string)args[0];
@ -706,26 +307,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private void InitPhysEngineToSceneConnector(string space) private void InitPhysEngineToSceneConnector(string space)
{ {
foreach (KeyValuePair<string, AuthSceneInfo> valPair in m_authScenesInfoByName) PhysEngineToSceneConnector scriptEngineToSceneConnector = new PhysEngineToSceneConnector(m_scene,
m_serveraddr, m_serverport, m_debugWithViewer, /* space,*/ m_syncConfig);
if (scriptEngineToSceneConnector.Start())
{ {
string authSceneName = valPair.Key; m_PEToSceneConnectors.Add(m_scene.RegionInfo.RegionName, scriptEngineToSceneConnector);
AuthSceneInfo authSceneInfo = valPair.Value;
string localScene = m_authToLocalSceneMapping[authSceneName];
if (localScene != m_scene.RegionInfo.RegionName)
continue;
//create a new connector, the local end of each connector, however, is set of the ValidScene only,
//since all objects will be contained in this scene only
PhysEngineToSceneConnector scriptEngineToSceneConnector = new PhysEngineToSceneConnector(m_scene, authSceneInfo.Addr, authSceneInfo.Port,
m_debugWithViewer, authSceneName, space, m_syncConfig);
if (scriptEngineToSceneConnector.Start())
{
m_PEToSceneConnectors.Add(authSceneName, scriptEngineToSceneConnector);
}
break; //there should only be one element in the dictionary if we reach this loop, anyway, we break from it.
} }
} }
@ -736,7 +322,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//if (m_scriptEngineToSceneConnector == null) //if (m_scriptEngineToSceneConnector == null)
if(m_PEToSceneConnectors.Count==0 && m_idlePEToSceneConnector==null) if(m_PEToSceneConnectors.Count==0 && m_idlePEToSceneConnector==null)
{ {
m_log.WarnFormat("[REGION SYNC PHYSICS ENGINE MODULE] Already stopped"); m_log.Warn(LogHeader + " Already stopped");
return; return;
} }
@ -764,8 +350,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_log.Warn(LogHeader+": Stopping synchronization"); m_log.Warn(LogHeader+": Stopping synchronization");
} }
m_authScenesInfoByLoc.Clear();
//save script state and stop script instances //save script state and stop script instances
// TODO: Load balancing. next line commented out to compile // TODO: Load balancing. next line commented out to compile
// m_scene.EventManager.TriggerPhysEngineSyncStop(); // m_scene.EventManager.TriggerPhysEngineSyncStop();
@ -780,10 +364,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
if (m_PEToSceneConnectors.Count == 0) if (m_PEToSceneConnectors.Count == 0)
{ {
m_log.WarnFormat("[REGION SYNC PHYSICS ENGINE MODULE] Not currently synchronized"); m_log.Warn(LogHeader + " Not currently synchronized");
return; return;
} }
m_log.WarnFormat("[REGION SYNC PHYSICS ENGINE MODULE] Synchronized"); m_log.Warn(LogHeader + " Synchronized");
foreach (KeyValuePair<string, PhysEngineToSceneConnector> pair in m_PEToSceneConnectors) foreach (KeyValuePair<string, PhysEngineToSceneConnector> pair in m_PEToSceneConnectors)
{ {
PhysEngineToSceneConnector sceneConnector = pair.Value; PhysEngineToSceneConnector sceneConnector = pair.Value;

View File

@ -109,6 +109,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_seSyncServerport = syncConfig.GetInt(seServerPort, DefaultPort); m_seSyncServerport = syncConfig.GetInt(seServerPort, DefaultPort);
DefaultPort++; DefaultPort++;
//Get sync server info for Physics Engine actors
string peServerAddr = scene.RegionInfo.RegionName + "_SceneToPESyncServerIP";
m_peSyncServeraddr = syncConfig.GetString(peServerAddr, "127.0.0.1");
string peServerPort = scene.RegionInfo.RegionName + "_SceneToPESyncServerPort";
m_peSyncServerport = syncConfig.GetInt(peServerPort, DefaultPort);
DefaultPort++;
//Get quark information //Get quark information
QuarkInfo.SizeX = syncConfig.GetInt("QuarkSizeX", (int)Constants.RegionSize); QuarkInfo.SizeX = syncConfig.GetInt("QuarkSizeX", (int)Constants.RegionSize);
QuarkInfo.SizeY = syncConfig.GetInt("QuarkSizeY", (int)Constants.RegionSize); QuarkInfo.SizeY = syncConfig.GetInt("QuarkSizeY", (int)Constants.RegionSize);
@ -154,6 +161,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//Start the sync server for script engines //Start the sync server for script engines
m_sceneToSESyncServer = new SceneToScriptEngineSyncServer(m_scene, m_seSyncServeraddr, m_seSyncServerport); m_sceneToSESyncServer = new SceneToScriptEngineSyncServer(m_scene, m_seSyncServeraddr, m_seSyncServerport);
m_sceneToSESyncServer.Start(); m_sceneToSESyncServer.Start();
m_log.Warn("[REGION SYNC SERVER MODULE] Starting SceneToPhysEngineSyncServer");
//Start the sync server for physics engines
m_sceneToPESyncServer = new SceneToPhysEngineSyncServer(m_scene, m_peSyncServeraddr, m_peSyncServerport);
m_sceneToPESyncServer.Start();
//m_log.Warn("[REGION SYNC SERVER MODULE] Post-Initialised"); //m_log.Warn("[REGION SYNC SERVER MODULE] Post-Initialised");
} }
@ -489,6 +501,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private string m_seSyncServeraddr; private string m_seSyncServeraddr;
private int m_seSyncServerport; private int m_seSyncServerport;
private SceneToScriptEngineSyncServer m_sceneToSESyncServer = null; private SceneToScriptEngineSyncServer m_sceneToSESyncServer = null;
//Sync-server for physics engine
private string m_peSyncServeraddr;
private int m_peSyncServerport;
private SceneToPhysEngineSyncServer m_sceneToPESyncServer = null;
//quark related information //quark related information
//private int QuarkInfo.SizeX; //private int QuarkInfo.SizeX;

View File

@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
//Here is the per actor type listening server for physics Engines. //Here is the per actor type listening server for physics Engines.
public class SceneToPhysEngineSyncServer public class SceneToPhysEngineSyncServer : ISceneToPhysEngineServer
{ {
#region SceneToPhysEngineSyncServer members #region SceneToPhysEngineSyncServer members
// Set the addr and port for TcpListener // Set the addr and port for TcpListener
@ -58,6 +58,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private int peCounter; private int peCounter;
// static counters that are used to compute global configuration state
private static int m_syncServerInitialized = 0;
private static int m_totalConnections = 0;
// The local scene. // The local scene.
private Scene m_scene; private Scene m_scene;
@ -92,6 +96,19 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
return (m_physEngineConnectors.Count > 0); return (m_physEngineConnectors.Count > 0);
} }
} }
public static bool IsPhysEngineScene
{
get { return (m_syncServerInitialized != 0); }
}
public static bool IsActivePhysEngineScene
{
get { return (m_syncServerInitialized != 0 && m_totalConnections != 0); }
}
public static bool IsPhysEngineActor
{
get { return PhysEngineToSceneConnectorModule.IsPhysEngineActor; }
}
#endregion #endregion
// Constructor // Constructor
@ -130,6 +147,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_log.WarnFormat(LogHeader + ": Starting {0} thread", m_listenerThread.Name); m_log.WarnFormat(LogHeader + ": Starting {0} thread", m_listenerThread.Name);
m_listenerThread.Start(); m_listenerThread.Start();
//m_log.Warn("[REGION SYNC SERVER] Started"); //m_log.Warn("[REGION SYNC SERVER] Started");
m_syncServerInitialized++;
} }
@ -137,6 +155,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
// Stop the server and disconnect all RegionSyncClients // Stop the server and disconnect all RegionSyncClients
public void Shutdown() public void Shutdown()
{ {
m_syncServerInitialized--;
// Stop the listener and listening thread so no new clients are accepted // Stop the listener and listening thread so no new clients are accepted
m_listener.Stop(); m_listener.Stop();
m_listenerThread.Abort(); m_listenerThread.Abort();

View File

@ -36,18 +36,9 @@ namespace OpenSim.Region.Framework.Interfaces
//the interface for Scene to sync with Script Engine //the interface for Scene to sync with Script Engine
public interface IPhysEngineToSceneConnectorModule public interface IPhysEngineToSceneConnectorModule
{ {
bool Active { get; } // static bool IsPhysEngineScene { get; }
bool Synced { get; } // static bool IsActivePhysEngineScene { get; }
// static bool IsPhysEngineActor { get; }
bool DebugWithViewer { get; } bool DebugWithViewer { get; }
//void SendCoarseLocations();
/// <summary>
/// Update the property of prim with primID, where the prim is located at quark (LocX, LocY). The length of each quark is configurable.
/// </summary>
/// <param name="locX"></param>
/// <param name="locY"></param>
/// <param name="primID"></param>
/// <param name="pName"></param>
/// <param name="pValue"></param>
void SendSetPrimProperties(uint locX, uint locY, UUID primID, string pName, object pValue);
} }
} }

View File

@ -410,37 +410,31 @@ namespace OpenSim.Region.Framework.Scenes
{ {
get { return m_physEngineToSceneConnectorModule; } get { return m_physEngineToSceneConnectorModule; }
set { m_physEngineToSceneConnectorModule = value; } set { m_physEngineToSceneConnectorModule = value; }
} }
// list of physactors for this scene so we can find them later for remote physics protected ISceneToPhysEngineServer m_sceneToPhysEngineSyncServer = null;
public Dictionary<uint, PhysicsActor> PhysActors = new Dictionary<uint, PhysicsActor>(); public ISceneToPhysEngineServer SceneToPhysEngineSyncServer
public void AddPhysActor(uint id, PhysicsActor pActor) {
{ get { return m_sceneToPhysEngineSyncServer; }
if (PhysActors.ContainsKey(id)) { set { m_sceneToPhysEngineSyncServer = value; }
PhysActors.Remove(id); }
}
PhysActors.Add(id, pActor); // list of physactors for this scene so we can find them later for remote physics
return; public Dictionary<uint, PhysicsActor> PhysActors = new Dictionary<uint, PhysicsActor>();
} public void AddPhysActor(uint id, PhysicsActor pActor)
public void RemovePhysActor(uint id) {
{ if (PhysActors.ContainsKey(id)) {
if (PhysActors.ContainsKey(id)) { PhysActors.Remove(id);
PhysActors.Remove(id); }
} PhysActors.Add(id, pActor);
return; return;
} }
public void RemovePhysActor(uint id)
public bool IsPhysEngineScene() {
{ if (PhysActors.ContainsKey(id)) {
return (SceneToPhysEngineConnectorModule != null); PhysActors.Remove(id);
} }
public bool IsActivePhysEngineScene() return;
{
return (SceneToPhysEngineConnectorModule != null && SceneToPhysEngineConnectorModule.Active);
}
public bool IsPhysEngineActor()
{
return (PhysEngineToSceneConnectorModule != null);
} }
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
@ -1480,6 +1474,8 @@ namespace OpenSim.Region.Framework.Scenes
RegionSyncServerModule = RequestModuleInterface<IRegionSyncServerModule>(); RegionSyncServerModule = RequestModuleInterface<IRegionSyncServerModule>();
RegionSyncClientModule = RequestModuleInterface<IRegionSyncClientModule>(); RegionSyncClientModule = RequestModuleInterface<IRegionSyncClientModule>();
ScriptEngineToSceneConnectorModule = RequestModuleInterface<IScriptEngineToSceneConnectorModule>(); ScriptEngineToSceneConnectorModule = RequestModuleInterface<IScriptEngineToSceneConnectorModule>();
PhysEngineToSceneConnectorModule = RequestModuleInterface<IPhysEngineToSceneConnectorModule>();
SceneToPhysEngineSyncServer = RequestModuleInterface<ISceneToPhysEngineServer>();
// Shoving this in here for now, because we have the needed // Shoving this in here for now, because we have the needed
// interfaces at this point // interfaces at this point

View File

@ -1585,8 +1585,8 @@ namespace OpenSim.Region.Framework.Scenes
dupe.RootPart.RotationOffset, dupe.RootPart.RotationOffset,
dupe.RootPart.PhysActor.IsPhysical); dupe.RootPart.PhysActor.IsPhysical);
dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId; dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId;
// RA: Register physActor in scene // RA: Register physActor in scene
dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true);
} }
@ -2389,8 +2389,8 @@ namespace OpenSim.Region.Framework.Scenes
linkPart.LinkNum = 0; linkPart.LinkNum = 0;
if (linkPart.PhysActor != null) if (linkPart.PhysActor != null)
{ {
m_scene.RemovePhysActor(linkPart.PhysActor.LocalID); m_scene.RemovePhysActor(linkPart.PhysActor.LocalID);
m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor); m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
} }

View File

@ -1491,9 +1491,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info
PhysActor.SOPDescription = this.Description; PhysActor.SOPDescription = this.Description;
PhysActor.LocalID = LocalId; PhysActor.LocalID = LocalId;
// RA: register PhysActor with the scene // RA: register PhysActor with the scene
ParentGroup.Scene.AddPhysActor(LocalId, PhysActor); ParentGroup.Scene.AddPhysActor(LocalId, PhysActor);
DoPhysicsPropertyUpdate(RigidBody, true); DoPhysicsPropertyUpdate(RigidBody, true);
PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
} }
@ -4311,9 +4311,9 @@ namespace OpenSim.Region.Framework.Scenes
pa = PhysActor; pa = PhysActor;
if (pa != null) if (pa != null)
{ {
pa.LocalID = LocalId; pa.LocalID = LocalId;
// RA: register PhysActor with scene // RA: register PhysActor with scene
ParentGroup.Scene.AddPhysActor(LocalId, PhysActor); ParentGroup.Scene.AddPhysActor(LocalId, PhysActor);
DoPhysicsPropertyUpdate(UsePhysics, true); DoPhysicsPropertyUpdate(UsePhysics, true);
if (m_parentGroup != null) if (m_parentGroup != null)
{ {

View File

@ -140,9 +140,9 @@ namespace OpenSim.Region.Physics.Manager
public abstract Vector3 Size { get; set; } public abstract Vector3 Size { get; set; }
public abstract PrimitiveBaseShape Shape { set; } public abstract PrimitiveBaseShape Shape { set; }
// RA: used to be abstract but changed to allow 'get' without changing all the phys engines // RA: used to be abstract but changed to allow 'get' without changing all the phys engines
public virtual uint LocalID { set { return; } get { return 0; } } public virtual uint LocalID { set { return; } get { return 0; } }
public abstract bool Grabbed { set; } public abstract bool Grabbed { set; }
@ -158,8 +158,8 @@ namespace OpenSim.Region.Physics.Manager
public abstract void delink(); public abstract void delink();
public abstract void LockAngularMotion(Vector3 axis); public abstract void LockAngularMotion(Vector3 axis);
public virtual void RequestPhysicsterseUpdate() public virtual void RequestPhysicsterseUpdate()
{ {
// Make a temporary copy of the event to avoid possibility of // Make a temporary copy of the event to avoid possibility of
@ -280,7 +280,7 @@ namespace OpenSim.Region.Physics.Manager
public override uint LocalID public override uint LocalID
{ {
set { return; } set { return; }
get { return 0; } get { return 0; }
} }

View File

@ -26,13 +26,16 @@
using System; using System;
using System.Reflection; using System.Reflection;
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml;
using log4net; using log4net;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
using OpenSim.Region.CoreModules.RegionSync.RegionSyncModule;
namespace OpenSim.Region.Physics.PEPlugin namespace OpenSim.Region.Physics.PEPlugin
{ {
[Serializable]
public sealed class PEPrim : PhysicsActor public sealed class PEPrim : PhysicsActor
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -98,7 +101,7 @@ public sealed class PEPrim : PhysicsActor
set { _localID = value; set { _localID = value;
m_log.Debug("[RPE] PEPrim set LocalID"); m_log.Debug("[RPE] PEPrim set LocalID");
Prop.Set(_localID, PropType.LocalID, _localID); Prop.Set(_localID, PropType.LocalID, _localID);
} }
get { return _localID; } get { return _localID; }
} }
public override bool Grabbed { public override bool Grabbed {

View File

@ -533,6 +533,7 @@
<Reference name="OpenMetaverseTypes.dll"/> <Reference name="OpenMetaverseTypes.dll"/>
<Reference name="Nini.dll" /> <Reference name="Nini.dll" />
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="Ode.NET.dll" /> <Reference name="Ode.NET.dll" />
@ -560,9 +561,11 @@
<ReferencePath>../../../../bin/</ReferencePath> <ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Core"/> <Reference name="System.Core"/>
<Reference name="System.Xml"/>
<Reference name="OpenMetaverseTypes.dll"/> <Reference name="OpenMetaverseTypes.dll"/>
<Reference name="Nini.dll" /> <Reference name="Nini.dll" />
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="log4net.dll"/> <Reference name="log4net.dll"/>