diff options
Diffstat (limited to 'OpenSim/Region/Framework')
3 files changed, 16 insertions, 114 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f62eef3..a1f434e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1010,7 +1010,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
1010 | public int LinkNum | 1010 | public int LinkNum |
1011 | { | 1011 | { |
1012 | get { return m_linkNum; } | 1012 | get { return m_linkNum; } |
1013 | set { m_linkNum = value; } | 1013 | set |
1014 | { | ||
1015 | // if (ParentGroup != null) | ||
1016 | // { | ||
1017 | // m_log.DebugFormat( | ||
1018 | // "[SCENE OBJECT PART]: Setting linknum of {0}@{1} to {2} from {3}", | ||
1019 | // Name, AbsolutePosition, value, m_linkNum); | ||
1020 | // Util.PrintCallStack(); | ||
1021 | // } | ||
1022 | |||
1023 | m_linkNum = value; | ||
1024 | } | ||
1014 | } | 1025 | } |
1015 | 1026 | ||
1016 | public byte ClickAction | 1027 | public byte ClickAction |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 151eba2..e223f47 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -1538,51 +1538,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1538 | } | 1538 | } |
1539 | } | 1539 | } |
1540 | 1540 | ||
1541 | //////// Read ///////// | ||
1542 | public static bool Xml2ToSOG(XmlTextReader reader, SceneObjectGroup sog) | ||
1543 | { | ||
1544 | reader.Read(); | ||
1545 | reader.ReadStartElement("SceneObjectGroup"); | ||
1546 | SceneObjectPart root = Xml2ToSOP(reader); | ||
1547 | if (root != null) | ||
1548 | sog.SetRootPart(root); | ||
1549 | else | ||
1550 | { | ||
1551 | return false; | ||
1552 | } | ||
1553 | |||
1554 | if (sog.UUID == UUID.Zero) | ||
1555 | sog.UUID = sog.RootPart.UUID; | ||
1556 | |||
1557 | reader.Read(); // OtherParts | ||
1558 | |||
1559 | while (!reader.EOF) | ||
1560 | { | ||
1561 | switch (reader.NodeType) | ||
1562 | { | ||
1563 | case XmlNodeType.Element: | ||
1564 | if (reader.Name == "SceneObjectPart") | ||
1565 | { | ||
1566 | SceneObjectPart child = Xml2ToSOP(reader); | ||
1567 | if (child != null) | ||
1568 | sog.AddPart(child); | ||
1569 | } | ||
1570 | else | ||
1571 | { | ||
1572 | //Logger.Log("Found unexpected prim XML element " + reader.Name, Helpers.LogLevel.Debug); | ||
1573 | reader.Read(); | ||
1574 | } | ||
1575 | break; | ||
1576 | case XmlNodeType.EndElement: | ||
1577 | default: | ||
1578 | reader.Read(); | ||
1579 | break; | ||
1580 | } | ||
1581 | |||
1582 | } | ||
1583 | return true; | ||
1584 | } | ||
1585 | |||
1586 | public static SceneObjectPart Xml2ToSOP(XmlTextReader reader) | 1541 | public static SceneObjectPart Xml2ToSOP(XmlTextReader reader) |
1587 | { | 1542 | { |
1588 | SceneObjectPart obj = new SceneObjectPart(); | 1543 | SceneObjectPart obj = new SceneObjectPart(); |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index d214eba..a3485d2 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs | |||
@@ -223,50 +223,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
223 | 223 | ||
224 | public static SceneObjectGroup DeserializeGroupFromXml2(string xmlString) | 224 | public static SceneObjectGroup DeserializeGroupFromXml2(string xmlString) |
225 | { | 225 | { |
226 | XmlDocument doc = new XmlDocument(); | 226 | return SceneObjectSerializer.FromXml2Format(xmlString); |
227 | XmlNode rootNode; | ||
228 | |||
229 | XmlTextReader reader = new XmlTextReader(new StringReader(xmlString)); | ||
230 | reader.WhitespaceHandling = WhitespaceHandling.None; | ||
231 | doc.Load(reader); | ||
232 | reader.Close(); | ||
233 | rootNode = doc.FirstChild; | ||
234 | |||
235 | // This is to deal with neighbouring regions that are still surrounding the group xml with the <scene> | ||
236 | // tag. It should be possible to remove the first part of this if statement once we go past 0.5.9 (or | ||
237 | // when some other changes forces all regions to upgrade). | ||
238 | // This might seem rather pointless since prim crossing from this revision to an earlier revision remains | ||
239 | // broken. But it isn't much work to accomodate the old format here. | ||
240 | if (rootNode.LocalName.Equals("scene")) | ||
241 | { | ||
242 | foreach (XmlNode aPrimNode in rootNode.ChildNodes) | ||
243 | { | ||
244 | // There is only ever one prim. This oddity should be removeable post 0.5.9 | ||
245 | //return SceneObjectSerializer.FromXml2Format(aPrimNode.OuterXml); | ||
246 | using (reader = new XmlTextReader(new StringReader(aPrimNode.OuterXml))) | ||
247 | { | ||
248 | SceneObjectGroup obj = new SceneObjectGroup(); | ||
249 | if (SceneObjectSerializer.Xml2ToSOG(reader, obj)) | ||
250 | return obj; | ||
251 | |||
252 | return null; | ||
253 | } | ||
254 | } | ||
255 | |||
256 | return null; | ||
257 | } | ||
258 | else | ||
259 | { | ||
260 | //return SceneObjectSerializer.FromXml2Format(rootNode.OuterXml); | ||
261 | using (reader = new XmlTextReader(new StringReader(rootNode.OuterXml))) | ||
262 | { | ||
263 | SceneObjectGroup obj = new SceneObjectGroup(); | ||
264 | if (SceneObjectSerializer.Xml2ToSOG(reader, obj)) | ||
265 | return obj; | ||
266 | |||
267 | return null; | ||
268 | } | ||
269 | } | ||
270 | } | 227 | } |
271 | 228 | ||
272 | /// <summary> | 229 | /// <summary> |
@@ -307,8 +264,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
307 | ICollection<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); | 264 | ICollection<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); |
308 | foreach (XmlNode aPrimNode in rootNode.ChildNodes) | 265 | foreach (XmlNode aPrimNode in rootNode.ChildNodes) |
309 | { | 266 | { |
310 | SceneObjectGroup obj = CreatePrimFromXml2(scene, aPrimNode.OuterXml); | 267 | SceneObjectGroup obj = DeserializeGroupFromXml2(aPrimNode.OuterXml); |
311 | if (obj != null && startScripts) | 268 | if (startScripts) |
312 | sceneObjects.Add(obj); | 269 | sceneObjects.Add(obj); |
313 | } | 270 | } |
314 | 271 | ||
@@ -319,27 +276,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
319 | } | 276 | } |
320 | } | 277 | } |
321 | 278 | ||
322 | /// <summary> | ||
323 | /// Create a prim from the xml2 representation. | ||
324 | /// </summary> | ||
325 | /// <param name="scene"></param> | ||
326 | /// <param name="xmlData"></param> | ||
327 | /// <returns>The scene object created. null if the scene object already existed</returns> | ||
328 | protected static SceneObjectGroup CreatePrimFromXml2(Scene scene, string xmlData) | ||
329 | { | ||
330 | //SceneObjectGroup obj = SceneObjectSerializer.FromXml2Format(xmlData); | ||
331 | using (XmlTextReader reader = new XmlTextReader(new StringReader(xmlData))) | ||
332 | { | ||
333 | SceneObjectGroup obj = new SceneObjectGroup(); | ||
334 | SceneObjectSerializer.Xml2ToSOG(reader, obj); | ||
335 | |||
336 | if (scene.AddRestoredSceneObject(obj, true, false)) | ||
337 | return obj; | ||
338 | else | ||
339 | return null; | ||
340 | } | ||
341 | } | ||
342 | |||
343 | #endregion | 279 | #endregion |
344 | } | 280 | } |
345 | } | 281 | } \ No newline at end of file |