* Start scripts loaded from an archive

0.6.0-stable
Justin Clarke Casey 2008-07-07 18:54:11 +00:00
parent 9362d9b231
commit 0b2fcbfec4
6 changed files with 28 additions and 13 deletions

View File

@ -348,7 +348,7 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="asset"></param> /// <param name="asset"></param>
public void AddAsset(AssetBase asset) public void AddAsset(AssetBase asset)
{ {
if (asset.Type == 0) if (asset.Type == (int)AssetType.Texture)
{ {
if (!Textures.ContainsKey(asset.FullID)) if (!Textures.ContainsKey(asset.FullID))
{ {

View File

@ -494,7 +494,7 @@ namespace OpenSim
if (string.IsNullOrEmpty(m_scriptEngine)) if (string.IsNullOrEmpty(m_scriptEngine))
{ {
m_log.Info("[MODULES]: No script engien module specified"); m_log.Info("[MODULES]: No script engine module specified");
} }
else else
{ {

View File

@ -100,10 +100,18 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects", serialisedSceneObjects.Count); m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects", serialisedSceneObjects.Count);
IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>(); IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>();
ICollection<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
foreach (string serialisedSceneObject in serialisedSceneObjects) foreach (string serialisedSceneObject in serialisedSceneObjects)
{ {
serialiser.LoadGroupFromXml2(m_scene, serialisedSceneObject); sceneObjects.Add(serialiser.LoadGroupFromXml2(m_scene, serialisedSceneObject));
}
m_log.Debug("[ARCHIVER]: Starting scripts");
foreach (SceneObjectGroup sceneObject in sceneObjects)
{
sceneObject.CreateScriptInstances(0, true);
} }
m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
@ -126,7 +134,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
{ {
sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];
m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
AssetBase asset = new AssetBase(new LLUUID(uuid), String.Empty); AssetBase asset = new AssetBase(new LLUUID(uuid), String.Empty);
asset.Type = assetType; asset.Type = assetType;

View File

@ -85,7 +85,8 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
/// </summary> /// </summary>
/// <param name="scene"></param> /// <param name="scene"></param>
/// <param name="xmlString"></param> /// <param name="xmlString"></param>
void LoadGroupFromXml2(Scene scene, string xmlString); /// <returns>The scene object created</returns>
SceneObjectGroup LoadGroupFromXml2(Scene scene, string xmlString);
/// <summary> /// <summary>
/// Serialize an individual scene object into the xml2 format /// Serialize an individual scene object into the xml2 format

View File

@ -104,7 +104,7 @@ namespace OpenSim.Region.Environment.Scenes
return grp.ToXmlString2(); return grp.ToXmlString2();
} }
public static void LoadGroupFromXml2(Scene scene, string xmlString) public static SceneObjectGroup LoadGroupFromXml2(Scene scene, string xmlString)
{ {
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
XmlNode rootNode; XmlNode rootNode;
@ -126,10 +126,13 @@ namespace OpenSim.Region.Environment.Scenes
{ {
CreatePrimFromXml2(scene, aPrimNode.OuterXml); CreatePrimFromXml2(scene, aPrimNode.OuterXml);
} }
// There is only ever one prim, but it's easiest to return null here since this part should disappear post 0.5.9 anyway
return null;
} }
else else
{ {
CreatePrimFromXml2(scene, rootNode.OuterXml); return CreatePrimFromXml2(scene, rootNode.OuterXml);
} }
} }
@ -177,11 +180,14 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
/// <param name="scene"></param> /// <param name="scene"></param>
/// <param name="xmlData"></param> /// <param name="xmlData"></param>
protected static void CreatePrimFromXml2(Scene scene, string xmlData) /// <returns>The scene object created</returns>
protected static SceneObjectGroup CreatePrimFromXml2(Scene scene, string xmlData)
{ {
SceneObjectGroup obj = new SceneObjectGroup(xmlData); SceneObjectGroup obj = new SceneObjectGroup(xmlData);
scene.AddRestoredSceneObject(obj, true); scene.AddRestoredSceneObject(obj, true);
return obj;
} }
public static void SavePrimsToXml2(Scene scene, string fileName) public static void SavePrimsToXml2(Scene scene, string fileName)

View File

@ -112,9 +112,9 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
SceneXmlLoader.SavePrimsToXml2(scene, fileName); SceneXmlLoader.SavePrimsToXml2(scene, fileName);
} }
public void LoadGroupFromXml2(Scene scene, string xmlString) public SceneObjectGroup LoadGroupFromXml2(Scene scene, string xmlString)
{ {
SceneXmlLoader.LoadGroupFromXml2(scene, xmlString); return SceneXmlLoader.LoadGroupFromXml2(scene, xmlString);
} }
public string SaveGroupToXml2(SceneObjectGroup grp) public string SaveGroupToXml2(SceneObjectGroup grp)