aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Serialization
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-04-15 00:42:06 +0100
committerJustin Clark-Casey (justincc)2011-04-15 00:42:06 +0100
commita0d80140f2d0ad6dd63970a3a3d5c0da8320ae75 (patch)
tree4c1f6780b2f8c766f7af29e827d77269790a94e9 /OpenSim/Region/Framework/Scenes/Serialization
parentimplement stub TestLoadCoalesecedItem(). Doesn't do what it's meant to do yet. (diff)
downloadopensim-SC_OLD-a0d80140f2d0ad6dd63970a3a3d5c0da8320ae75.zip
opensim-SC_OLD-a0d80140f2d0ad6dd63970a3a3d5c0da8320ae75.tar.gz
opensim-SC_OLD-a0d80140f2d0ad6dd63970a3a3d5c0da8320ae75.tar.bz2
opensim-SC_OLD-a0d80140f2d0ad6dd63970a3a3d5c0da8320ae75.tar.xz
Make all the objects in a coalescence reappears after being loaded from an IAR. This still doesn't work proprerly since some required textures/contained item assets might be missing.
From pure code inspection, it looks like the uuid gatherer may get most asset uuids because the scene object serializer naively pulls non-root parts from all contained scene objects into one mega-object. However, root part uuids may well still be missing, and there may be other odd artifacts from this bug. It appears that storing the size of the coalescence and the offsets is redundant, since one can work out this information from the position data already in the scene object groups.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs47
1 files changed, 41 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
index a0e120a..babcb54 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
@@ -55,11 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
55 /// <param name="coa"></param> 55 /// <param name="coa"></param>
56 /// <returns></returns> 56 /// <returns></returns>
57 public static string ToXml(CoalescedSceneObjects coa) 57 public static string ToXml(CoalescedSceneObjects coa)
58 { 58 {
59 // TODO: Should probably return an empty xml serialization rather than a blank string
60 if (!coa.HasObjects)
61 return "";
62
63 using (StringWriter sw = new StringWriter()) 59 using (StringWriter sw = new StringWriter())
64 { 60 {
65 using (XmlTextWriter writer = new XmlTextWriter(sw)) 61 using (XmlTextWriter writer = new XmlTextWriter(sw))
@@ -105,10 +101,49 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
105 101
106 string output = sw.ToString(); 102 string output = sw.ToString();
107 103
108// m_log.Debug(output); 104// Console.WriteLine(output);
109 105
110 return output; 106 return output;
111 } 107 }
112 } 108 }
109
110 public static bool TryFromXml(string xml, out CoalescedSceneObjects coa)
111 {
112// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml);
113
114 coa = null;
115
116 using (StringReader sr = new StringReader(xml))
117 {
118 using (XmlTextReader reader = new XmlTextReader(sr))
119 {
120 reader.Read();
121 if (reader.Name != "CoalescedObject")
122 {
123// m_log.DebugFormat(
124// "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false",
125// reader.Name);
126
127 return false;
128 }
129
130 coa = new CoalescedSceneObjects(UUID.Zero);
131 reader.Read();
132
133 while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "CoalescedObject")
134 {
135 if (reader.Name == "SceneObjectGroup")
136 {
137 string soXml = reader.ReadOuterXml();
138 coa.Add(SceneObjectSerializer.FromOriginalXmlFormat(soXml));
139 }
140 }
141
142 reader.ReadEndElement(); // CoalescedObject
143 }
144 }
145
146 return true;
147 }
113 } 148 }
114} \ No newline at end of file 149} \ No newline at end of file