diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 127 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 71 |
2 files changed, 86 insertions, 112 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f0740f8..7ec3697 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -39,6 +39,7 @@ using OpenMetaverse.Packets; | |||
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Framework.Scenes.Scripting; | 41 | using OpenSim.Region.Framework.Scenes.Scripting; |
42 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
42 | using OpenSim.Region.Physics.Manager; | 43 | using OpenSim.Region.Physics.Manager; |
43 | 44 | ||
44 | namespace OpenSim.Region.Framework.Scenes | 45 | namespace OpenSim.Region.Framework.Scenes |
@@ -119,33 +120,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
119 | /// <value> | 120 | /// <value> |
120 | /// Is this sop a root part? | 121 | /// Is this sop a root part? |
121 | /// </value> | 122 | /// </value> |
122 | [XmlIgnore] | 123 | |
123 | public bool IsRoot | 124 | public bool IsRoot |
124 | { | 125 | { |
125 | get { return ParentGroup.RootPart == this; } | 126 | get { return ParentGroup.RootPart == this; } |
126 | } | 127 | } |
127 | 128 | ||
128 | // use only one serializer to give the runtime a chance to optimize it (it won't do that if you | ||
129 | // use a new instance every time) | ||
130 | private static XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); | ||
131 | |||
132 | #region Fields | 129 | #region Fields |
133 | 130 | ||
134 | public bool AllowedDrop; | 131 | public bool AllowedDrop; |
135 | 132 | ||
136 | [XmlIgnore] | 133 | |
137 | public bool DIE_AT_EDGE; | 134 | public bool DIE_AT_EDGE; |
138 | 135 | ||
139 | [XmlIgnore] | 136 | |
140 | public bool RETURN_AT_EDGE; | 137 | public bool RETURN_AT_EDGE; |
141 | 138 | ||
142 | [XmlIgnore] | 139 | |
143 | public bool BlockGrab; | 140 | public bool BlockGrab; |
144 | 141 | ||
145 | [XmlIgnore] | 142 | |
146 | public bool StatusSandbox; | 143 | public bool StatusSandbox; |
147 | 144 | ||
148 | [XmlIgnore] | 145 | |
149 | public Vector3 StatusSandboxPos; | 146 | public Vector3 StatusSandboxPos; |
150 | 147 | ||
151 | // TODO: This needs to be persisted in next XML version update! | 148 | // TODO: This needs to be persisted in next XML version update! |
@@ -167,33 +164,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
167 | // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. | 164 | // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. |
168 | // Not a big problem as long as the script that sets it remains in the prim on startup. | 165 | // Not a big problem as long as the script that sets it remains in the prim on startup. |
169 | // for SL compatibility it should be persisted though (set sound / displaytext / particlesystem, kill script) | 166 | // for SL compatibility it should be persisted though (set sound / displaytext / particlesystem, kill script) |
170 | [XmlIgnore] | 167 | |
171 | public UUID Sound; | 168 | public UUID Sound; |
172 | 169 | ||
173 | [XmlIgnore] | 170 | |
174 | public byte SoundFlags; | 171 | public byte SoundFlags; |
175 | 172 | ||
176 | [XmlIgnore] | 173 | |
177 | public double SoundGain; | 174 | public double SoundGain; |
178 | 175 | ||
179 | [XmlIgnore] | 176 | |
180 | public double SoundRadius; | 177 | public double SoundRadius; |
181 | 178 | ||
182 | [XmlIgnore] | 179 | |
183 | public uint TimeStampFull; | 180 | public uint TimeStampFull; |
184 | 181 | ||
185 | [XmlIgnore] | 182 | |
186 | public uint TimeStampLastActivity; // Will be used for AutoReturn | 183 | public uint TimeStampLastActivity; // Will be used for AutoReturn |
187 | 184 | ||
188 | [XmlIgnore] | 185 | |
189 | public uint TimeStampTerse; | 186 | public uint TimeStampTerse; |
190 | 187 | ||
191 | [XmlIgnore] | 188 | |
192 | public UUID FromItemID; | 189 | public UUID FromItemID; |
193 | 190 | ||
194 | [XmlIgnore] | 191 | |
195 | public UUID FromFolderID; | 192 | public UUID FromFolderID; |
196 | 193 | ||
194 | <<<<<<< HEAD:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | ||
197 | // The following two are to hold the attachment data | 195 | // The following two are to hold the attachment data |
198 | // while an object is inworld | 196 | // while an object is inworld |
199 | [XmlIgnore] | 197 | [XmlIgnore] |
@@ -203,15 +201,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
203 | public Vector3 AttachOffset = Vector3.Zero; | 201 | public Vector3 AttachOffset = Vector3.Zero; |
204 | 202 | ||
205 | [XmlIgnore] | 203 | [XmlIgnore] |
204 | ======= | ||
205 | |||
206 | >>>>>>> master:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | ||
206 | public int STATUS_ROTATE_X; | 207 | public int STATUS_ROTATE_X; |
207 | 208 | ||
208 | [XmlIgnore] | 209 | |
209 | public int STATUS_ROTATE_Y; | 210 | public int STATUS_ROTATE_Y; |
210 | 211 | ||
211 | [XmlIgnore] | 212 | |
212 | public int STATUS_ROTATE_Z; | 213 | public int STATUS_ROTATE_Z; |
213 | 214 | ||
214 | [XmlIgnore] | 215 | |
215 | private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>(); | 216 | private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>(); |
216 | 217 | ||
217 | /// <value> | 218 | /// <value> |
@@ -220,68 +221,68 @@ namespace OpenSim.Region.Framework.Scenes | |||
220 | /// </value> | 221 | /// </value> |
221 | private UUID m_fromUserInventoryItemID; | 222 | private UUID m_fromUserInventoryItemID; |
222 | 223 | ||
223 | [XmlIgnore] | 224 | |
224 | public UUID FromUserInventoryItemID | 225 | public UUID FromUserInventoryItemID |
225 | { | 226 | { |
226 | get { return m_fromUserInventoryItemID; } | 227 | get { return m_fromUserInventoryItemID; } |
227 | } | 228 | } |
228 | 229 | ||
229 | [XmlIgnore] | 230 | |
230 | public bool IsAttachment; | 231 | public bool IsAttachment; |
231 | 232 | ||
232 | [XmlIgnore] | 233 | |
233 | public scriptEvents AggregateScriptEvents; | 234 | public scriptEvents AggregateScriptEvents; |
234 | 235 | ||
235 | [XmlIgnore] | 236 | |
236 | public UUID AttachedAvatar; | 237 | public UUID AttachedAvatar; |
237 | 238 | ||
238 | [XmlIgnore] | 239 | |
239 | public Vector3 AttachedPos; | 240 | public Vector3 AttachedPos; |
240 | 241 | ||
241 | [XmlIgnore] | 242 | |
242 | public uint AttachmentPoint; | 243 | public uint AttachmentPoint; |
243 | 244 | ||
244 | [XmlIgnore] | 245 | |
245 | public Vector3 RotationAxis = Vector3.One; | 246 | public Vector3 RotationAxis = Vector3.One; |
246 | 247 | ||
247 | [XmlIgnore] | 248 | |
248 | public bool VolumeDetectActive; // XmlIgnore set to avoid problems with persistance until I come to care for this | 249 | public bool VolumeDetectActive; // XmlIgnore set to avoid problems with persistance until I come to care for this |
249 | // Certainly this must be a persistant setting finally | 250 | // Certainly this must be a persistant setting finally |
250 | 251 | ||
251 | [XmlIgnore] | 252 | |
252 | public bool IsWaitingForFirstSpinUpdatePacket; | 253 | public bool IsWaitingForFirstSpinUpdatePacket; |
253 | 254 | ||
254 | [XmlIgnore] | 255 | |
255 | public Quaternion SpinOldOrientation = Quaternion.Identity; | 256 | public Quaternion SpinOldOrientation = Quaternion.Identity; |
256 | 257 | ||
257 | [XmlIgnore] | 258 | |
258 | public Quaternion m_APIDTarget = Quaternion.Identity; | 259 | public Quaternion m_APIDTarget = Quaternion.Identity; |
259 | 260 | ||
260 | [XmlIgnore] | 261 | |
261 | public float m_APIDDamp = 0; | 262 | public float m_APIDDamp = 0; |
262 | 263 | ||
263 | [XmlIgnore] | 264 | |
264 | public float m_APIDStrength = 0; | 265 | public float m_APIDStrength = 0; |
265 | 266 | ||
266 | /// <summary> | 267 | /// <summary> |
267 | /// This part's inventory | 268 | /// This part's inventory |
268 | /// </summary> | 269 | /// </summary> |
269 | [XmlIgnore] | 270 | |
270 | public IEntityInventory Inventory | 271 | public IEntityInventory Inventory |
271 | { | 272 | { |
272 | get { return m_inventory; } | 273 | get { return m_inventory; } |
273 | } | 274 | } |
274 | protected SceneObjectPartInventory m_inventory; | 275 | protected SceneObjectPartInventory m_inventory; |
275 | 276 | ||
276 | [XmlIgnore] | 277 | |
277 | public bool Undoing; | 278 | public bool Undoing; |
278 | 279 | ||
279 | [XmlIgnore] | 280 | |
280 | public bool IgnoreUndoUpdate = false; | 281 | public bool IgnoreUndoUpdate = false; |
281 | 282 | ||
282 | [XmlIgnore] | 283 | |
283 | private PrimFlags LocalFlags; | 284 | private PrimFlags LocalFlags; |
284 | [XmlIgnore] | 285 | |
285 | private float m_damage = -1.0f; | 286 | private float m_damage = -1.0f; |
286 | private byte[] m_TextureAnimation; | 287 | private byte[] m_TextureAnimation; |
287 | private byte m_clickAction; | 288 | private byte m_clickAction; |
@@ -289,9 +290,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
289 | private string m_description = String.Empty; | 290 | private string m_description = String.Empty; |
290 | private readonly List<uint> m_lastColliders = new List<uint>(); | 291 | private readonly List<uint> m_lastColliders = new List<uint>(); |
291 | private int m_linkNum; | 292 | private int m_linkNum; |
292 | [XmlIgnore] | 293 | |
293 | private int m_scriptAccessPin; | 294 | private int m_scriptAccessPin; |
294 | [XmlIgnore] | 295 | |
295 | private readonly Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>(); | 296 | private readonly Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>(); |
296 | private string m_sitName = String.Empty; | 297 | private string m_sitName = String.Empty; |
297 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; | 298 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; |
@@ -562,7 +563,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
562 | } | 563 | } |
563 | 564 | ||
564 | 565 | ||
565 | [XmlIgnore] | 566 | |
566 | public Dictionary<int, string> CollisionFilter | 567 | public Dictionary<int, string> CollisionFilter |
567 | { | 568 | { |
568 | get { return m_CollisionFilter; } | 569 | get { return m_CollisionFilter; } |
@@ -572,21 +573,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
572 | } | 573 | } |
573 | } | 574 | } |
574 | 575 | ||
575 | [XmlIgnore] | 576 | |
576 | public Quaternion APIDTarget | 577 | public Quaternion APIDTarget |
577 | { | 578 | { |
578 | get { return m_APIDTarget; } | 579 | get { return m_APIDTarget; } |
579 | set { m_APIDTarget = value; } | 580 | set { m_APIDTarget = value; } |
580 | } | 581 | } |
581 | 582 | ||
582 | [XmlIgnore] | 583 | |
583 | public float APIDDamp | 584 | public float APIDDamp |
584 | { | 585 | { |
585 | get { return m_APIDDamp; } | 586 | get { return m_APIDDamp; } |
586 | set { m_APIDDamp = value; } | 587 | set { m_APIDDamp = value; } |
587 | } | 588 | } |
588 | 589 | ||
589 | [XmlIgnore] | 590 | |
590 | public float APIDStrength | 591 | public float APIDStrength |
591 | { | 592 | { |
592 | get { return m_APIDStrength; } | 593 | get { return m_APIDStrength; } |
@@ -632,33 +633,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
632 | set { m_LoopSoundSlavePrims = value; } | 633 | set { m_LoopSoundSlavePrims = value; } |
633 | } | 634 | } |
634 | 635 | ||
636 | <<<<<<< HEAD:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | ||
637 | ======= | ||
638 | |||
639 | >>>>>>> master:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | ||
635 | public Byte[] TextureAnimation | 640 | public Byte[] TextureAnimation |
636 | { | 641 | { |
637 | get { return m_TextureAnimation; } | 642 | get { return m_TextureAnimation; } |
638 | set { m_TextureAnimation = value; } | 643 | set { m_TextureAnimation = value; } |
639 | } | 644 | } |
640 | 645 | ||
646 | <<<<<<< HEAD:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | ||
647 | ======= | ||
648 | |||
649 | >>>>>>> master:OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | ||
641 | public Byte[] ParticleSystem | 650 | public Byte[] ParticleSystem |
642 | { | 651 | { |
643 | get { return m_particleSystem; } | 652 | get { return m_particleSystem; } |
644 | set { m_particleSystem = value; } | 653 | set { m_particleSystem = value; } |
645 | } | 654 | } |
646 | 655 | ||
647 | [XmlIgnore] | 656 | |
648 | public DateTime Expires | 657 | public DateTime Expires |
649 | { | 658 | { |
650 | get { return m_expires; } | 659 | get { return m_expires; } |
651 | set { m_expires = value; } | 660 | set { m_expires = value; } |
652 | } | 661 | } |
653 | 662 | ||
654 | [XmlIgnore] | 663 | |
655 | public DateTime Rezzed | 664 | public DateTime Rezzed |
656 | { | 665 | { |
657 | get { return m_rezzed; } | 666 | get { return m_rezzed; } |
658 | set { m_rezzed = value; } | 667 | set { m_rezzed = value; } |
659 | } | 668 | } |
660 | 669 | ||
661 | [XmlIgnore] | 670 | |
662 | public float Damage | 671 | public float Damage |
663 | { | 672 | { |
664 | get { return m_damage; } | 673 | get { return m_damage; } |
@@ -1043,7 +1052,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1043 | } | 1052 | } |
1044 | } | 1053 | } |
1045 | 1054 | ||
1046 | [XmlIgnore] | 1055 | |
1047 | public bool CreateSelected | 1056 | public bool CreateSelected |
1048 | { | 1057 | { |
1049 | get { return m_createSelected; } | 1058 | get { return m_createSelected; } |
@@ -1233,14 +1242,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1233 | set { m_occupied = value; } | 1242 | set { m_occupied = value; } |
1234 | } | 1243 | } |
1235 | 1244 | ||
1236 | [XmlIgnore] | 1245 | |
1237 | public UUID SitTargetAvatar | 1246 | public UUID SitTargetAvatar |
1238 | { | 1247 | { |
1239 | get { return m_sitTargetAvatar; } | 1248 | get { return m_sitTargetAvatar; } |
1240 | set { m_sitTargetAvatar = value; } | 1249 | set { m_sitTargetAvatar = value; } |
1241 | } | 1250 | } |
1242 | 1251 | ||
1243 | [XmlIgnore] | 1252 | |
1244 | public virtual UUID RegionID | 1253 | public virtual UUID RegionID |
1245 | { | 1254 | { |
1246 | get | 1255 | get |
@@ -1254,7 +1263,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1254 | } | 1263 | } |
1255 | 1264 | ||
1256 | private UUID _parentUUID = UUID.Zero; | 1265 | private UUID _parentUUID = UUID.Zero; |
1257 | [XmlIgnore] | 1266 | |
1258 | public UUID ParentUUID | 1267 | public UUID ParentUUID |
1259 | { | 1268 | { |
1260 | get | 1269 | get |
@@ -1268,7 +1277,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1268 | set { _parentUUID = value; } | 1277 | set { _parentUUID = value; } |
1269 | } | 1278 | } |
1270 | 1279 | ||
1271 | [XmlIgnore] | 1280 | |
1272 | public string SitAnimation | 1281 | public string SitAnimation |
1273 | { | 1282 | { |
1274 | get { return m_sitAnimation; } | 1283 | get { return m_sitAnimation; } |
@@ -1884,7 +1893,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1884 | /// </summary> | 1893 | /// </summary> |
1885 | /// <param name="xmlReader"></param> | 1894 | /// <param name="xmlReader"></param> |
1886 | /// <returns></returns> | 1895 | /// <returns></returns> |
1887 | public static SceneObjectPart FromXml(XmlReader xmlReader) | 1896 | public static SceneObjectPart FromXml(XmlTextReader xmlReader) |
1888 | { | 1897 | { |
1889 | return FromXml(UUID.Zero, xmlReader); | 1898 | return FromXml(UUID.Zero, xmlReader); |
1890 | } | 1899 | } |
@@ -1895,9 +1904,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1895 | /// <param name="fromUserInventoryItemId">The inventory id from which this part came, if applicable</param> | 1904 | /// <param name="fromUserInventoryItemId">The inventory id from which this part came, if applicable</param> |
1896 | /// <param name="xmlReader"></param> | 1905 | /// <param name="xmlReader"></param> |
1897 | /// <returns></returns> | 1906 | /// <returns></returns> |
1898 | public static SceneObjectPart FromXml(UUID fromUserInventoryItemId, XmlReader xmlReader) | 1907 | public static SceneObjectPart FromXml(UUID fromUserInventoryItemId, XmlTextReader xmlReader) |
1899 | { | 1908 | { |
1900 | SceneObjectPart part = (SceneObjectPart)serializer.Deserialize(xmlReader); | 1909 | SceneObjectPart part = SceneObjectSerializer.Xml2ToSOP(xmlReader); |
1901 | part.m_fromUserInventoryItemID = fromUserInventoryItemId; | 1910 | part.m_fromUserInventoryItemID = fromUserInventoryItemId; |
1902 | 1911 | ||
1903 | // for tempOnRez objects, we have to fix the Expire date. | 1912 | // for tempOnRez objects, we have to fix the Expire date. |
@@ -4087,9 +4096,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4087 | /// Serialize this part to xml. | 4096 | /// Serialize this part to xml. |
4088 | /// </summary> | 4097 | /// </summary> |
4089 | /// <param name="xmlWriter"></param> | 4098 | /// <param name="xmlWriter"></param> |
4090 | public void ToXml(XmlWriter xmlWriter) | 4099 | public void ToXml(XmlTextWriter xmlWriter) |
4091 | { | 4100 | { |
4092 | serializer.Serialize(xmlWriter, this); | 4101 | SceneObjectSerializer.SOPToXml2(xmlWriter, this, new Dictionary<string, object>()); |
4093 | } | 4102 | } |
4094 | 4103 | ||
4095 | public void TriggerScriptChangedEvent(Changed val) | 4104 | public void TriggerScriptChangedEvent(Changed val) |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 79619ee..acdaf95 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -67,14 +67,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
67 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); | 67 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); |
68 | //int time = System.Environment.TickCount; | 68 | //int time = System.Environment.TickCount; |
69 | 69 | ||
70 | // libomv.types changes UUID to Guid | ||
71 | xmlData = xmlData.Replace("<UUID>", "<Guid>"); | ||
72 | xmlData = xmlData.Replace("</UUID>", "</Guid>"); | ||
73 | |||
74 | // Handle Nested <UUID><UUID> property | ||
75 | xmlData = xmlData.Replace("<Guid><Guid>", "<UUID><Guid>"); | ||
76 | xmlData = xmlData.Replace("</Guid></Guid>", "</Guid></UUID>"); | ||
77 | |||
78 | try | 70 | try |
79 | { | 71 | { |
80 | StringReader sr; | 72 | StringReader sr; |
@@ -126,6 +118,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
126 | } | 118 | } |
127 | } | 119 | } |
128 | 120 | ||
121 | |||
129 | /// <summary> | 122 | /// <summary> |
130 | /// Serialize a scene object to the original xml format | 123 | /// Serialize a scene object to the original xml format |
131 | /// </summary> | 124 | /// </summary> |
@@ -156,7 +149,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
156 | 149 | ||
157 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); | 150 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); |
158 | writer.WriteStartElement(String.Empty, "RootPart", String.Empty); | 151 | writer.WriteStartElement(String.Empty, "RootPart", String.Empty); |
159 | ToOriginalXmlFormat(sceneObject.RootPart, writer); | 152 | ToXmlFormat(sceneObject.RootPart, writer); |
160 | writer.WriteEndElement(); | 153 | writer.WriteEndElement(); |
161 | writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); | 154 | writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); |
162 | 155 | ||
@@ -167,7 +160,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
167 | if (part.UUID != sceneObject.RootPart.UUID) | 160 | if (part.UUID != sceneObject.RootPart.UUID) |
168 | { | 161 | { |
169 | writer.WriteStartElement(String.Empty, "Part", String.Empty); | 162 | writer.WriteStartElement(String.Empty, "Part", String.Empty); |
170 | ToOriginalXmlFormat(part, writer); | 163 | ToXmlFormat(part, writer); |
171 | writer.WriteEndElement(); | 164 | writer.WriteEndElement(); |
172 | } | 165 | } |
173 | } | 166 | } |
@@ -179,9 +172,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
179 | //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); | 172 | //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); |
180 | } | 173 | } |
181 | 174 | ||
182 | protected static void ToOriginalXmlFormat(SceneObjectPart part, XmlTextWriter writer) | 175 | protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer) |
183 | { | 176 | { |
184 | part.ToXml(writer); | 177 | SOPToXml2(writer, part, new Dictionary<string, object>()); |
185 | } | 178 | } |
186 | 179 | ||
187 | public static SceneObjectGroup FromXml2Format(string xmlData) | 180 | public static SceneObjectGroup FromXml2Format(string xmlData) |
@@ -189,14 +182,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
189 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); | 182 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); |
190 | //int time = System.Environment.TickCount; | 183 | //int time = System.Environment.TickCount; |
191 | 184 | ||
192 | // libomv.types changes UUID to Guid | ||
193 | xmlData = xmlData.Replace("<UUID>", "<Guid>"); | ||
194 | xmlData = xmlData.Replace("</UUID>", "</Guid>"); | ||
195 | |||
196 | // Handle Nested <UUID><UUID> property | ||
197 | xmlData = xmlData.Replace("<Guid><Guid>", "<UUID><Guid>"); | ||
198 | xmlData = xmlData.Replace("</Guid></Guid>", "</Guid></UUID>"); | ||
199 | |||
200 | try | 185 | try |
201 | { | 186 | { |
202 | XmlDocument doc = new XmlDocument(); | 187 | XmlDocument doc = new XmlDocument(); |
@@ -261,41 +246,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
261 | { | 246 | { |
262 | using (XmlTextWriter writer = new XmlTextWriter(sw)) | 247 | using (XmlTextWriter writer = new XmlTextWriter(sw)) |
263 | { | 248 | { |
264 | ToXml2Format(sceneObject, writer); | 249 | SOGToXml2(writer, sceneObject, new Dictionary<string,object>()); |
265 | } | 250 | } |
266 | 251 | ||
267 | return sw.ToString(); | 252 | return sw.ToString(); |
268 | } | 253 | } |
269 | } | 254 | } |
270 | 255 | ||
271 | /// <summary> | ||
272 | /// Serialize a scene object to the 'xml2' format. | ||
273 | /// </summary> | ||
274 | /// <param name="sceneObject"></param> | ||
275 | /// <returns></returns> | ||
276 | public static void ToXml2Format(SceneObjectGroup sceneObject, XmlTextWriter writer) | ||
277 | { | ||
278 | //m_log.DebugFormat("[SERIALIZER]: Starting serialization of SOG {0} to XML2", Name); | ||
279 | //int time = System.Environment.TickCount; | ||
280 | |||
281 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); | ||
282 | sceneObject.RootPart.ToXml(writer); | ||
283 | writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); | ||
284 | |||
285 | SceneObjectPart[] parts = sceneObject.Parts; | ||
286 | for (int i = 0; i < parts.Length; i++) | ||
287 | { | ||
288 | SceneObjectPart part = parts[i]; | ||
289 | if (part.UUID != sceneObject.RootPart.UUID) | ||
290 | part.ToXml(writer); | ||
291 | } | ||
292 | |||
293 | writer.WriteEndElement(); // End of OtherParts | ||
294 | sceneObject.SaveScriptedState(writer); | ||
295 | writer.WriteEndElement(); // End of SceneObjectGroup | ||
296 | |||
297 | //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0} to XML2, {1}ms", Name, System.Environment.TickCount - time); | ||
298 | } | ||
299 | 256 | ||
300 | #region manual serialization | 257 | #region manual serialization |
301 | 258 | ||
@@ -386,6 +343,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
386 | m_TaskInventoryXmlProcessors.Add("PermsGranter", ProcessTIPermsGranter); | 343 | m_TaskInventoryXmlProcessors.Add("PermsGranter", ProcessTIPermsGranter); |
387 | m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); | 344 | m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); |
388 | m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); | 345 | m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); |
346 | m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); | ||
347 | |||
389 | #endregion | 348 | #endregion |
390 | 349 | ||
391 | #region ShapeXmlProcessors initialization | 350 | #region ShapeXmlProcessors initialization |
@@ -817,6 +776,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
817 | item.Type = reader.ReadElementContentAsInt("Type", String.Empty); | 776 | item.Type = reader.ReadElementContentAsInt("Type", String.Empty); |
818 | } | 777 | } |
819 | 778 | ||
779 | private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader) | ||
780 | { | ||
781 | item.OwnerChanged = reader.ReadElementContentAsBoolean("OwnerChanged", String.Empty); | ||
782 | } | ||
783 | |||
820 | #endregion | 784 | #endregion |
821 | 785 | ||
822 | #region ShapeXmlProcessors | 786 | #region ShapeXmlProcessors |
@@ -1078,20 +1042,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1078 | public static void SOGToXml2(XmlTextWriter writer, SceneObjectGroup sog, Dictionary<string, object>options) | 1042 | public static void SOGToXml2(XmlTextWriter writer, SceneObjectGroup sog, Dictionary<string, object>options) |
1079 | { | 1043 | { |
1080 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); | 1044 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); |
1081 | SOPToXml2(writer, sog.RootPart, null, options); | 1045 | SOPToXml2(writer, sog.RootPart, options); |
1082 | writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); | 1046 | writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); |
1083 | 1047 | ||
1084 | sog.ForEachPart(delegate(SceneObjectPart sop) | 1048 | sog.ForEachPart(delegate(SceneObjectPart sop) |
1085 | { | 1049 | { |
1086 | if (sop.UUID != sog.RootPart.UUID) | 1050 | if (sop.UUID != sog.RootPart.UUID) |
1087 | SOPToXml2(writer, sop, sog.RootPart, options); | 1051 | SOPToXml2(writer, sop, options); |
1088 | }); | 1052 | }); |
1089 | 1053 | ||
1090 | writer.WriteEndElement(); | 1054 | writer.WriteEndElement(); |
1091 | writer.WriteEndElement(); | 1055 | writer.WriteEndElement(); |
1092 | } | 1056 | } |
1093 | 1057 | ||
1094 | static void SOPToXml2(XmlTextWriter writer, SceneObjectPart sop, SceneObjectPart parent, Dictionary<string, object> options) | 1058 | public static void SOPToXml2(XmlTextWriter writer, SceneObjectPart sop, Dictionary<string, object> options) |
1095 | { | 1059 | { |
1096 | writer.WriteStartElement("SceneObjectPart"); | 1060 | writer.WriteStartElement("SceneObjectPart"); |
1097 | writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); | 1061 | writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); |
@@ -1229,6 +1193,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1229 | WriteUUID(writer, "PermsGranter", item.PermsGranter, options); | 1193 | WriteUUID(writer, "PermsGranter", item.PermsGranter, options); |
1230 | writer.WriteElementString("PermsMask", item.PermsMask.ToString()); | 1194 | writer.WriteElementString("PermsMask", item.PermsMask.ToString()); |
1231 | writer.WriteElementString("Type", item.Type.ToString()); | 1195 | writer.WriteElementString("Type", item.Type.ToString()); |
1196 | writer.WriteElementString("OwnerChanged", item.OwnerChanged.ToString().ToLower()); | ||
1232 | 1197 | ||
1233 | writer.WriteEndElement(); // TaskInventoryItem | 1198 | writer.WriteEndElement(); // TaskInventoryItem |
1234 | } | 1199 | } |
@@ -1398,7 +1363,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1398 | } | 1363 | } |
1399 | else | 1364 | else |
1400 | { | 1365 | { |
1401 | //m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element {0}", nodeName); | 1366 | m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element {0}", nodeName); |
1402 | reader.ReadOuterXml(); // ignore | 1367 | reader.ReadOuterXml(); // ignore |
1403 | } | 1368 | } |
1404 | 1369 | ||