diff options
author | Justin Clarke Casey | 2008-07-18 14:42:06 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-07-18 14:42:06 +0000 |
commit | f8721c3c1cd5d4eb2827ea1cfd36e08f3a100345 (patch) | |
tree | 42bb436a664127499180789e76edacb8e021709a /OpenSim | |
parent | force Culture to en-US in BaseHttpserver.HandleRequest() --- this (diff) | |
download | opensim-SC_OLD-f8721c3c1cd5d4eb2827ea1cfd36e08f3a100345.zip opensim-SC_OLD-f8721c3c1cd5d4eb2827ea1cfd36e08f3a100345.tar.gz opensim-SC_OLD-f8721c3c1cd5d4eb2827ea1cfd36e08f3a100345.tar.bz2 opensim-SC_OLD-f8721c3c1cd5d4eb2827ea1cfd36e08f3a100345.tar.xz |
* refactor: break out sog loading code into two parts so that post-deserialization changes can be carried out before adding it to a scene
Diffstat (limited to 'OpenSim')
5 files changed, 22 insertions, 24 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index f5496b9..d901b54 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -123,21 +123,19 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
123 | 123 | ||
124 | foreach (string serialisedSceneObject in serialisedSceneObjects) | 124 | foreach (string serialisedSceneObject in serialisedSceneObjects) |
125 | { | 125 | { |
126 | SceneObjectGroup sceneObject = serialiser.LoadGroupFromXml2(m_scene, serialisedSceneObject); | 126 | SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject); |
127 | 127 | ||
128 | // TODO: Change object creator/owner here | 128 | // Make the master the owner/creator of everything imported for now |
129 | 129 | LLUUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID; | |
130 | if (null != sceneObject) | 130 | foreach (SceneObjectPart part in sceneObject.Children.Values) |
131 | { | 131 | { |
132 | // Make the master the owner/creator of everything imported for now | 132 | part.CreatorID = masterAvatarId; |
133 | LLUUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID; | 133 | part.OwnerID = masterAvatarId; |
134 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 134 | part.LastOwnerID = masterAvatarId; |
135 | { | 135 | } |
136 | part.CreatorID = masterAvatarId; | 136 | |
137 | part.OwnerID = masterAvatarId; | 137 | if (m_scene.AddRestoredSceneObject(sceneObject, true, false)) |
138 | part.LastOwnerID = masterAvatarId; | 138 | { |
139 | } | ||
140 | |||
141 | sceneObjects.Add(sceneObject); | 139 | sceneObjects.Add(sceneObject); |
142 | } | 140 | } |
143 | } | 141 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs index 6e48f8e..8a13f2b 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs | |||
@@ -81,12 +81,11 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser | |||
81 | void SavePrimListToXml2(List<EntityBase> entityList, string fileName); | 81 | void SavePrimListToXml2(List<EntityBase> entityList, string fileName); |
82 | 82 | ||
83 | /// <summary> | 83 | /// <summary> |
84 | /// Load an individual scene object from the xml2 format | 84 | /// Deserializes a scene object from its xml2 representation. This does not load the object into the scene. |
85 | /// </summary> | 85 | /// </summary> |
86 | /// <param name="scene"></param> | ||
87 | /// <param name="xmlString"></param> | 86 | /// <param name="xmlString"></param> |
88 | /// <returns>The scene object created. null if the scene object already existed</returns> | 87 | /// <returns>The scene object created. null if the scene object already existed</returns> |
89 | SceneObjectGroup LoadGroupFromXml2(Scene scene, string xmlString); | 88 | SceneObjectGroup DeserializeGroupFromXml2(string xmlString); |
90 | 89 | ||
91 | /// <summary> | 90 | /// <summary> |
92 | /// Serialize an individual scene object into the xml2 format | 91 | /// Serialize an individual scene object into the xml2 format |
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs index 6327d65..cd1fecb 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs | |||
@@ -104,7 +104,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
104 | return grp.ToXmlString2(); | 104 | return grp.ToXmlString2(); |
105 | } | 105 | } |
106 | 106 | ||
107 | public static SceneObjectGroup LoadGroupFromXml2(Scene scene, string xmlString) | 107 | public static SceneObjectGroup DeserializeGroupFromXml2(string xmlString) |
108 | { | 108 | { |
109 | XmlDocument doc = new XmlDocument(); | 109 | XmlDocument doc = new XmlDocument(); |
110 | XmlNode rootNode; | 110 | XmlNode rootNode; |
@@ -124,15 +124,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
124 | { | 124 | { |
125 | foreach (XmlNode aPrimNode in rootNode.ChildNodes) | 125 | foreach (XmlNode aPrimNode in rootNode.ChildNodes) |
126 | { | 126 | { |
127 | CreatePrimFromXml2(scene, aPrimNode.OuterXml); | 127 | // There is only ever one prim. This oddity should be removeable post 0.5.9 |
128 | return new SceneObjectGroup(aPrimNode.OuterXml); | ||
128 | } | 129 | } |
129 | 130 | ||
130 | // There is only ever one prim, but it's easiest to return null here since this part should disappear post 0.5.9 anyway | ||
131 | return null; | 131 | return null; |
132 | } | 132 | } |
133 | else | 133 | else |
134 | { | 134 | { |
135 | return CreatePrimFromXml2(scene, rootNode.OuterXml); | 135 | return new SceneObjectGroup(rootNode.OuterXml); |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs index eb3ab2e..cefd15f 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs | |||
@@ -112,9 +112,9 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser | |||
112 | SceneXmlLoader.SavePrimsToXml2(scene, fileName); | 112 | SceneXmlLoader.SavePrimsToXml2(scene, fileName); |
113 | } | 113 | } |
114 | 114 | ||
115 | public SceneObjectGroup LoadGroupFromXml2(Scene scene, string xmlString) | 115 | public SceneObjectGroup DeserializeGroupFromXml2(string xmlString) |
116 | { | 116 | { |
117 | return SceneXmlLoader.LoadGroupFromXml2(scene, xmlString); | 117 | return SceneXmlLoader.DeserializeGroupFromXml2(xmlString); |
118 | } | 118 | } |
119 | 119 | ||
120 | public string SaveGroupToXml2(SceneObjectGroup grp) | 120 | public string SaveGroupToXml2(SceneObjectGroup grp) |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 4aa9cf9..bbb028d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1902,7 +1902,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1902 | m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor"); | 1902 | m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor"); |
1903 | if (XMLMethod == 0) | 1903 | if (XMLMethod == 0) |
1904 | { | 1904 | { |
1905 | m_serialiser.LoadGroupFromXml2(this, objXMLData); | 1905 | SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData); |
1906 | AddRestoredSceneObject(sceneObject, true, false); | ||
1906 | 1907 | ||
1907 | SceneObjectPart RootPrim = GetSceneObjectPart(primID); | 1908 | SceneObjectPart RootPrim = GetSceneObjectPart(primID); |
1908 | if (RootPrim != null) | 1909 | if (RootPrim != null) |