Added a flag to load-xml console command, that will generate new uuids for the loaded Sceneobjects (as per mantis request #53).

To use append "-newUID" to the end of the command, so new format is : "load-xml <filename> -newUID". 
If you don't add the "-newUID", then the uuids in the xml file will be kept.
afrisby
MW 2007-12-03 14:57:39 +00:00
parent 4eba3373dc
commit 690e517240
4 changed files with 19 additions and 7 deletions

View File

@ -659,11 +659,19 @@ namespace OpenSim
case "load-xml": case "load-xml":
if (cmdparams.Length > 0) if (cmdparams.Length > 0)
{ {
m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0]); bool generateNewIDS = false;
if (cmdparams.Length > 1)
{
if (cmdparams[1] == "-newUID")
{
generateNewIDS = true;
}
}
m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS);
} }
else else
{ {
m_sceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME); m_sceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME, false);
} }
break; break;

View File

@ -896,9 +896,9 @@ namespace OpenSim.Region.Environment.Scenes
prim.OnPrimCountTainted += m_LandManager.setPrimsTainted; prim.OnPrimCountTainted += m_LandManager.setPrimsTainted;
} }
public void LoadPrimsFromXml(string fileName) public void LoadPrimsFromXml(string fileName, bool newIdsFlag)
{ {
m_sceneXmlLoader.LoadPrimsFromXml(fileName); m_sceneXmlLoader.LoadPrimsFromXml(fileName, newIdsFlag);
} }
public void SavePrimsToXml(string fileName) public void SavePrimsToXml(string fileName)

View File

@ -160,9 +160,9 @@ namespace OpenSim.Region.Environment.Scenes
CurrentOrFirstScene.SavePrimsToXml(filename); CurrentOrFirstScene.SavePrimsToXml(filename);
} }
public void LoadCurrentSceneFromXml(string filename) public void LoadCurrentSceneFromXml(string filename, bool generateNewIDs)
{ {
CurrentOrFirstScene.LoadPrimsFromXml(filename); CurrentOrFirstScene.LoadPrimsFromXml(filename, generateNewIDs);
} }
public void SaveCurrentSceneToXml2(string filename) public void SaveCurrentSceneToXml2(string filename)

View File

@ -23,7 +23,7 @@ namespace OpenSim.Region.Environment.Scenes
m_regInfo = regionInfo; m_regInfo = regionInfo;
} }
public void LoadPrimsFromXml(string fileName) public void LoadPrimsFromXml(string fileName, bool newIDS)
{ {
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
XmlNode rootNode; XmlNode rootNode;
@ -39,6 +39,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
SceneObjectGroup obj = new SceneObjectGroup(m_parentScene, SceneObjectGroup obj = new SceneObjectGroup(m_parentScene,
m_regInfo.RegionHandle, aPrimNode.OuterXml); m_regInfo.RegionHandle, aPrimNode.OuterXml);
if (newIDS)
{
obj.GenerateNewIDs();
}
//if we want this to be a import method then we need new uuids for the object to avoid any clashes //if we want this to be a import method then we need new uuids for the object to avoid any clashes
//obj.RegenerateFullIDs(); //obj.RegenerateFullIDs();
m_innerScene.AddEntity(obj); m_innerScene.AddEntity(obj);