aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Serialization
diff options
context:
space:
mode:
authorMelanie Thielker2017-01-05 19:07:37 +0000
committerMelanie Thielker2017-01-05 19:07:37 +0000
commitb16abc8166c29585cb76cc55c3bdd76e5833cb4f (patch)
tree6a34f465a74b7a3a6dc00a3d7aa8dcc25ac3e3a5 /OpenSim/Region/Framework/Scenes/Serialization
parentMake it possible to disable the bakes module in the way it is described in co... (diff)
downloadopensim-SC-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.zip
opensim-SC-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.gz
opensim-SC-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.bz2
opensim-SC-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.xz
Massive tab and trailing space cleanup
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs60
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs28
2 files changed, 44 insertions, 44 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
index 998789d..7f7977e 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
@@ -68,54 +68,54 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
68 /// </param> 68 /// </param>
69 /// <returns></returns> 69 /// <returns></returns>
70 public static string ToXml(CoalescedSceneObjects coa, bool doScriptStates) 70 public static string ToXml(CoalescedSceneObjects coa, bool doScriptStates)
71 { 71 {
72 using (StringWriter sw = new StringWriter()) 72 using (StringWriter sw = new StringWriter())
73 { 73 {
74 using (XmlTextWriter writer = new XmlTextWriter(sw)) 74 using (XmlTextWriter writer = new XmlTextWriter(sw))
75 { 75 {
76 Vector3 size; 76 Vector3 size;
77 77
78 List<SceneObjectGroup> coaObjects = coa.Objects; 78 List<SceneObjectGroup> coaObjects = coa.Objects;
79 79
80// m_log.DebugFormat( 80// m_log.DebugFormat(
81// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object", 81// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object",
82// coaObjects.Count); 82// coaObjects.Count);
83 83
84 // This is weak - we're relying on the set of coalesced objects still being identical 84 // This is weak - we're relying on the set of coalesced objects still being identical
85 Vector3[] offsets = coa.GetSizeAndOffsets(out size); 85 Vector3[] offsets = coa.GetSizeAndOffsets(out size);
86 86
87 writer.WriteStartElement("CoalescedObject"); 87 writer.WriteStartElement("CoalescedObject");
88 88
89 writer.WriteAttributeString("x", size.X.ToString()); 89 writer.WriteAttributeString("x", size.X.ToString());
90 writer.WriteAttributeString("y", size.Y.ToString()); 90 writer.WriteAttributeString("y", size.Y.ToString());
91 writer.WriteAttributeString("z", size.Z.ToString()); 91 writer.WriteAttributeString("z", size.Z.ToString());
92 92
93 // Embed the offsets into the group XML 93 // Embed the offsets into the group XML
94 for (int i = 0; i < coaObjects.Count; i++) 94 for (int i = 0; i < coaObjects.Count; i++)
95 { 95 {
96 SceneObjectGroup obj = coaObjects[i]; 96 SceneObjectGroup obj = coaObjects[i];
97 97
98// m_log.DebugFormat( 98// m_log.DebugFormat(
99// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing offset for object {0}, {1}", 99// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing offset for object {0}, {1}",
100// i, obj.Name); 100// i, obj.Name);
101 101
102 writer.WriteStartElement("SceneObjectGroup"); 102 writer.WriteStartElement("SceneObjectGroup");
103 writer.WriteAttributeString("offsetx", offsets[i].X.ToString()); 103 writer.WriteAttributeString("offsetx", offsets[i].X.ToString());
104 writer.WriteAttributeString("offsety", offsets[i].Y.ToString()); 104 writer.WriteAttributeString("offsety", offsets[i].Y.ToString());
105 writer.WriteAttributeString("offsetz", offsets[i].Z.ToString()); 105 writer.WriteAttributeString("offsetz", offsets[i].Z.ToString());
106 106
107 SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, doScriptStates); 107 SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, doScriptStates);
108 108
109 writer.WriteEndElement(); // SceneObjectGroup 109 writer.WriteEndElement(); // SceneObjectGroup
110 } 110 }
111 111
112 writer.WriteEndElement(); // CoalescedObject 112 writer.WriteEndElement(); // CoalescedObject
113 } 113 }
114 114
115 string output = sw.ToString(); 115 string output = sw.ToString();
116 116
117// Console.WriteLine(output); 117// Console.WriteLine(output);
118 118
119 return output; 119 return output;
120 } 120 }
121 } 121 }
@@ -123,14 +123,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
123 public static bool TryFromXml(string xml, out CoalescedSceneObjects coa) 123 public static bool TryFromXml(string xml, out CoalescedSceneObjects coa)
124 { 124 {
125// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml); 125// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml);
126 126
127 coa = null; 127 coa = null;
128 128
129 try 129 try
130 { 130 {
131 // Quickly check if this is a coalesced object, without fully parsing the XML 131 // Quickly check if this is a coalesced object, without fully parsing the XML
132 using (StringReader sr = new StringReader(xml)) 132 using (StringReader sr = new StringReader(xml))
133 { 133 {
134 using (XmlTextReader reader = new XmlTextReader(sr)) 134 using (XmlTextReader reader = new XmlTextReader(sr))
135 { 135 {
136 reader.MoveToContent(); // skip possible xml declaration 136 reader.MoveToContent(); // skip possible xml declaration
@@ -138,9 +138,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
138 if (reader.Name != "CoalescedObject") 138 if (reader.Name != "CoalescedObject")
139 { 139 {
140 // m_log.DebugFormat( 140 // m_log.DebugFormat(
141 // "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false", 141 // "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false",
142 // reader.Name); 142 // reader.Name);
143 143
144 return false; 144 return false;
145 } 145 }
146 } 146 }
@@ -151,12 +151,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
151 XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); 151 XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
152 if (e == null) 152 if (e == null)
153 return false; 153 return false;
154 154
155 coa = new CoalescedSceneObjects(UUID.Zero); 155 coa = new CoalescedSceneObjects(UUID.Zero);
156 156
157 XmlNodeList groups = e.SelectNodes("SceneObjectGroup"); 157 XmlNodeList groups = e.SelectNodes("SceneObjectGroup");
158 int i = 0; 158 int i = 0;
159 159
160 foreach (XmlNode n in groups) 160 foreach (XmlNode n in groups)
161 { 161 {
162 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); 162 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
@@ -166,10 +166,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
166 } 166 }
167 else 167 else
168 { 168 {
169 // XXX: Possibly we should fail outright here rather than continuing if a particular component of the 169 // XXX: Possibly we should fail outright here rather than continuing if a particular component of the
170 // coalesced object fails to load. 170 // coalesced object fails to load.
171 m_log.WarnFormat( 171 m_log.WarnFormat(
172 "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.", 172 "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.",
173 i); 173 i);
174 } 174 }
175 175
@@ -181,8 +181,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
181 m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed ", e); 181 m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed ", e);
182 Util.LogFailedXML("[COALESCED SCENE OBJECTS SERIALIZER]:", xml); 182 Util.LogFailedXML("[COALESCED SCENE OBJECTS SERIALIZER]:", xml);
183 return false; 183 return false;
184 } 184 }
185 185
186 return true; 186 return true;
187 } 187 }
188 } 188 }
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 0b7379b..b8d210c 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -107,7 +107,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
107 part.LinkNum = linkNum; 107 part.LinkNum = linkNum;
108 part.TrimPermissions(); 108 part.TrimPermissions();
109 } 109 }
110 } 110 }
111 while (reader.ReadToNextSibling("Part")); 111 while (reader.ReadToNextSibling("Part"));
112 } 112 }
113 113
@@ -156,7 +156,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
156 { 156 {
157 ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false); 157 ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false);
158 } 158 }
159 159
160 public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject, string scriptedState) 160 public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject, string scriptedState)
161 { 161 {
162 using (StringWriter sw = new StringWriter()) 162 using (StringWriter sw = new StringWriter())
@@ -190,7 +190,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
190 190
191 if (!noRootElement) 191 if (!noRootElement)
192 writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); 192 writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
193 193
194 writer.WriteStartElement(String.Empty, "RootPart", String.Empty); 194 writer.WriteStartElement(String.Empty, "RootPart", String.Empty);
195 ToXmlFormat(sceneObject.RootPart, writer); 195 ToXmlFormat(sceneObject.RootPart, writer);
196 writer.WriteEndElement(); 196 writer.WriteEndElement();
@@ -212,23 +212,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
212 212
213 if (doScriptStates) 213 if (doScriptStates)
214 sceneObject.SaveScriptedState(writer); 214 sceneObject.SaveScriptedState(writer);
215 215
216 if (!noRootElement) 216 if (!noRootElement)
217 writer.WriteEndElement(); // SceneObjectGroup 217 writer.WriteEndElement(); // SceneObjectGroup
218 218
219// m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", sceneObject.Name, System.Environment.TickCount - time); 219// m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", sceneObject.Name, System.Environment.TickCount - time);
220 } 220 }
221 221
222 protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer) 222 protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer)
223 { 223 {
224 SOPToXml2(writer, part, new Dictionary<string, object>()); 224 SOPToXml2(writer, part, new Dictionary<string, object>());
225 } 225 }
226 226
227 public static SceneObjectGroup FromXml2Format(string xmlData) 227 public static SceneObjectGroup FromXml2Format(string xmlData)
228 { 228 {
229 //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); 229 //m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
230 //int time = System.Environment.TickCount; 230 //int time = System.Environment.TickCount;
231 231
232 try 232 try
233 { 233 {
234 XmlDocument doc = new XmlDocument(); 234 XmlDocument doc = new XmlDocument();
@@ -780,7 +780,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
780 obj.VehicleParams = vehicle; 780 obj.VehicleParams = vehicle;
781 } 781 }
782 } 782 }
783 783
784 private static void ProcessShape(SceneObjectPart obj, XmlReader reader) 784 private static void ProcessShape(SceneObjectPart obj, XmlReader reader)
785 { 785 {
786 List<string> errorNodeNames; 786 List<string> errorNodeNames;
@@ -1235,7 +1235,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1235 { 1235 {
1236 shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape"); 1236 shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape");
1237 } 1237 }
1238 1238
1239 private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlReader reader) 1239 private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlReader reader)
1240 { 1240 {
1241 shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture"); 1241 shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture");
@@ -1367,13 +1367,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1367 1367
1368 if (sog.RootPart.KeyframeMotion != null) 1368 if (sog.RootPart.KeyframeMotion != null)
1369 { 1369 {
1370 Byte[] data = sog.RootPart.KeyframeMotion.Serialize(); 1370 Byte[] data = sog.RootPart.KeyframeMotion.Serialize();
1371 1371
1372 writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty); 1372 writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty);
1373 writer.WriteBase64(data, 0, data.Length); 1373 writer.WriteBase64(data, 0, data.Length);
1374 writer.WriteEndElement(); 1374 writer.WriteEndElement();
1375 } 1375 }
1376 1376
1377 1377
1378 writer.WriteEndElement(); 1378 writer.WriteEndElement();
1379 } 1379 }
@@ -1438,7 +1438,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1438 WriteShape(writer, sop.Shape, options); 1438 WriteShape(writer, sop.Shape, options);
1439 1439
1440 WriteVector(writer, "Scale", sop.Scale); 1440 WriteVector(writer, "Scale", sop.Scale);
1441 WriteQuaternion(writer, "SitTargetOrientation", sop.SitTargetOrientation); 1441 WriteQuaternion(writer, "SitTargetOrientation", sop.SitTargetOrientation);
1442 WriteVector(writer, "SitTargetPosition", sop.SitTargetPosition); 1442 WriteVector(writer, "SitTargetPosition", sop.SitTargetPosition);
1443 WriteVector(writer, "SitTargetPositionLL", sop.SitTargetPositionLL); 1443 WriteVector(writer, "SitTargetPositionLL", sop.SitTargetPositionLL);
1444 WriteQuaternion(writer, "SitTargetOrientationLL", sop.SitTargetOrientationLL); 1444 WriteQuaternion(writer, "SitTargetOrientationLL", sop.SitTargetOrientationLL);
@@ -1472,7 +1472,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1472 if (sop.MediaUrl != null) 1472 if (sop.MediaUrl != null)
1473 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); 1473 writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
1474 WriteVector(writer, "AttachedPos", sop.AttachedPos); 1474 WriteVector(writer, "AttachedPos", sop.AttachedPos);
1475 1475
1476 if (sop.DynAttrs.CountNamespaces > 0) 1476 if (sop.DynAttrs.CountNamespaces > 0)
1477 { 1477 {
1478 writer.WriteStartElement("DynAttrs"); 1478 writer.WriteStartElement("DynAttrs");
@@ -1520,7 +1520,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1520 writer.WriteElementString("SoundRadius", sop.SoundRadius.ToString().ToLower()); 1520 writer.WriteElementString("SoundRadius", sop.SoundRadius.ToString().ToLower());
1521 } 1521 }
1522 writer.WriteElementString("SoundQueueing", sop.SoundQueueing.ToString().ToLower()); 1522 writer.WriteElementString("SoundQueueing", sop.SoundQueueing.ToString().ToLower());
1523 1523
1524 writer.WriteEndElement(); 1524 writer.WriteEndElement();
1525 } 1525 }
1526 1526