diff options
author | Melanie | 2010-10-18 19:08:55 +0100 |
---|---|---|
committer | Melanie | 2010-10-18 19:08:55 +0100 |
commit | e48ac9380312057af261b10e4a313917410d00f4 (patch) | |
tree | 8f26340e30109351bec6e2d59c67c783c733cc75 /OpenSim/Region/Framework/Scenes | |
parent | Bump migration version on LastSeen field so it is actually run (diff) | |
parent | remove some cruft from last commit (diff) | |
download | opensim-SC-e48ac9380312057af261b10e4a313917410d00f4.zip opensim-SC-e48ac9380312057af261b10e4a313917410d00f4.tar.gz opensim-SC-e48ac9380312057af261b10e4a313917410d00f4.tar.bz2 opensim-SC-e48ac9380312057af261b10e4a313917410d00f4.tar.xz |
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 125 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 71 |
2 files changed, 79 insertions, 117 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 39b109b..7a6449d 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 |
@@ -118,40 +119,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
118 | /// <value> | 119 | /// <value> |
119 | /// Is this sop a root part? | 120 | /// Is this sop a root part? |
120 | /// </value> | 121 | /// </value> |
121 | [XmlIgnore] | 122 | |
122 | public bool IsRoot | 123 | public bool IsRoot |
123 | { | 124 | { |
124 | get { return ParentGroup.RootPart == this; } | 125 | get { return ParentGroup.RootPart == this; } |
125 | } | 126 | } |
126 | 127 | ||
127 | // use only one serializer to give the runtime a chance to optimize it (it won't do that if you | ||
128 | // use a new instance every time) | ||
129 | private static XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); | ||
130 | |||
131 | #region Fields | 128 | #region Fields |
132 | 129 | ||
133 | public bool AllowedDrop; | 130 | public bool AllowedDrop; |
134 | 131 | ||
135 | [XmlIgnore] | 132 | |
136 | public bool DIE_AT_EDGE; | 133 | public bool DIE_AT_EDGE; |
137 | 134 | ||
138 | [XmlIgnore] | 135 | |
139 | public bool RETURN_AT_EDGE; | 136 | public bool RETURN_AT_EDGE; |
140 | 137 | ||
141 | [XmlIgnore] | 138 | |
142 | public bool BlockGrab; | 139 | public bool BlockGrab; |
143 | 140 | ||
144 | [XmlIgnore] | 141 | |
145 | public bool StatusSandbox; | 142 | public bool StatusSandbox; |
146 | 143 | ||
147 | [XmlIgnore] | 144 | |
148 | public Vector3 StatusSandboxPos; | 145 | public Vector3 StatusSandboxPos; |
149 | 146 | ||
150 | // TODO: This needs to be persisted in next XML version update! | 147 | // TODO: This needs to be persisted in next XML version update! |
151 | [XmlIgnore] | 148 | |
152 | public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; | 149 | public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; |
153 | 150 | ||
154 | [XmlIgnore] | 151 | |
155 | public PhysicsActor PhysActor | 152 | public PhysicsActor PhysActor |
156 | { | 153 | { |
157 | get { return m_physActor; } | 154 | get { return m_physActor; } |
@@ -166,43 +163,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
166 | // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. | 163 | // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. |
167 | // Not a big problem as long as the script that sets it remains in the prim on startup. | 164 | // Not a big problem as long as the script that sets it remains in the prim on startup. |
168 | // for SL compatibility it should be persisted though (set sound / displaytext / particlesystem, kill script) | 165 | // for SL compatibility it should be persisted though (set sound / displaytext / particlesystem, kill script) |
169 | [XmlIgnore] | 166 | |
170 | public UUID Sound; | 167 | public UUID Sound; |
171 | 168 | ||
172 | [XmlIgnore] | 169 | |
173 | public byte SoundFlags; | 170 | public byte SoundFlags; |
174 | 171 | ||
175 | [XmlIgnore] | 172 | |
176 | public double SoundGain; | 173 | public double SoundGain; |
177 | 174 | ||
178 | [XmlIgnore] | 175 | |
179 | public double SoundRadius; | 176 | public double SoundRadius; |
180 | 177 | ||
181 | [XmlIgnore] | 178 | |
182 | public uint TimeStampFull; | 179 | public uint TimeStampFull; |
183 | 180 | ||
184 | [XmlIgnore] | 181 | |
185 | public uint TimeStampLastActivity; // Will be used for AutoReturn | 182 | public uint TimeStampLastActivity; // Will be used for AutoReturn |
186 | 183 | ||
187 | [XmlIgnore] | 184 | |
188 | public uint TimeStampTerse; | 185 | public uint TimeStampTerse; |
189 | 186 | ||
190 | [XmlIgnore] | 187 | |
191 | public UUID FromItemID; | 188 | public UUID FromItemID; |
192 | 189 | ||
193 | [XmlIgnore] | 190 | |
194 | public UUID FromFolderID; | 191 | public UUID FromFolderID; |
195 | 192 | ||
196 | [XmlIgnore] | 193 | |
197 | public int STATUS_ROTATE_X; | 194 | public int STATUS_ROTATE_X; |
198 | 195 | ||
199 | [XmlIgnore] | 196 | |
200 | public int STATUS_ROTATE_Y; | 197 | public int STATUS_ROTATE_Y; |
201 | 198 | ||
202 | [XmlIgnore] | 199 | |
203 | public int STATUS_ROTATE_Z; | 200 | public int STATUS_ROTATE_Z; |
204 | 201 | ||
205 | [XmlIgnore] | 202 | |
206 | private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>(); | 203 | private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>(); |
207 | 204 | ||
208 | /// <value> | 205 | /// <value> |
@@ -211,68 +208,68 @@ namespace OpenSim.Region.Framework.Scenes | |||
211 | /// </value> | 208 | /// </value> |
212 | private UUID m_fromUserInventoryItemID; | 209 | private UUID m_fromUserInventoryItemID; |
213 | 210 | ||
214 | [XmlIgnore] | 211 | |
215 | public UUID FromUserInventoryItemID | 212 | public UUID FromUserInventoryItemID |
216 | { | 213 | { |
217 | get { return m_fromUserInventoryItemID; } | 214 | get { return m_fromUserInventoryItemID; } |
218 | } | 215 | } |
219 | 216 | ||
220 | [XmlIgnore] | 217 | |
221 | public bool IsAttachment; | 218 | public bool IsAttachment; |
222 | 219 | ||
223 | [XmlIgnore] | 220 | |
224 | public scriptEvents AggregateScriptEvents; | 221 | public scriptEvents AggregateScriptEvents; |
225 | 222 | ||
226 | [XmlIgnore] | 223 | |
227 | public UUID AttachedAvatar; | 224 | public UUID AttachedAvatar; |
228 | 225 | ||
229 | [XmlIgnore] | 226 | |
230 | public Vector3 AttachedPos; | 227 | public Vector3 AttachedPos; |
231 | 228 | ||
232 | [XmlIgnore] | 229 | |
233 | public uint AttachmentPoint; | 230 | public uint AttachmentPoint; |
234 | 231 | ||
235 | [XmlIgnore] | 232 | |
236 | public Vector3 RotationAxis = Vector3.One; | 233 | public Vector3 RotationAxis = Vector3.One; |
237 | 234 | ||
238 | [XmlIgnore] | 235 | |
239 | public bool VolumeDetectActive; // XmlIgnore set to avoid problems with persistance until I come to care for this | 236 | public bool VolumeDetectActive; // XmlIgnore set to avoid problems with persistance until I come to care for this |
240 | // Certainly this must be a persistant setting finally | 237 | // Certainly this must be a persistant setting finally |
241 | 238 | ||
242 | [XmlIgnore] | 239 | |
243 | public bool IsWaitingForFirstSpinUpdatePacket; | 240 | public bool IsWaitingForFirstSpinUpdatePacket; |
244 | 241 | ||
245 | [XmlIgnore] | 242 | |
246 | public Quaternion SpinOldOrientation = Quaternion.Identity; | 243 | public Quaternion SpinOldOrientation = Quaternion.Identity; |
247 | 244 | ||
248 | [XmlIgnore] | 245 | |
249 | public Quaternion m_APIDTarget = Quaternion.Identity; | 246 | public Quaternion m_APIDTarget = Quaternion.Identity; |
250 | 247 | ||
251 | [XmlIgnore] | 248 | |
252 | public float m_APIDDamp = 0; | 249 | public float m_APIDDamp = 0; |
253 | 250 | ||
254 | [XmlIgnore] | 251 | |
255 | public float m_APIDStrength = 0; | 252 | public float m_APIDStrength = 0; |
256 | 253 | ||
257 | /// <summary> | 254 | /// <summary> |
258 | /// This part's inventory | 255 | /// This part's inventory |
259 | /// </summary> | 256 | /// </summary> |
260 | [XmlIgnore] | 257 | |
261 | public IEntityInventory Inventory | 258 | public IEntityInventory Inventory |
262 | { | 259 | { |
263 | get { return m_inventory; } | 260 | get { return m_inventory; } |
264 | } | 261 | } |
265 | protected SceneObjectPartInventory m_inventory; | 262 | protected SceneObjectPartInventory m_inventory; |
266 | 263 | ||
267 | [XmlIgnore] | 264 | |
268 | public bool Undoing; | 265 | public bool Undoing; |
269 | 266 | ||
270 | [XmlIgnore] | 267 | |
271 | public bool IgnoreUndoUpdate = false; | 268 | public bool IgnoreUndoUpdate = false; |
272 | 269 | ||
273 | [XmlIgnore] | 270 | |
274 | private PrimFlags LocalFlags; | 271 | private PrimFlags LocalFlags; |
275 | [XmlIgnore] | 272 | |
276 | private float m_damage = -1.0f; | 273 | private float m_damage = -1.0f; |
277 | private byte[] m_TextureAnimation; | 274 | private byte[] m_TextureAnimation; |
278 | private byte m_clickAction; | 275 | private byte m_clickAction; |
@@ -280,9 +277,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
280 | private string m_description = String.Empty; | 277 | private string m_description = String.Empty; |
281 | private readonly List<uint> m_lastColliders = new List<uint>(); | 278 | private readonly List<uint> m_lastColliders = new List<uint>(); |
282 | private int m_linkNum; | 279 | private int m_linkNum; |
283 | [XmlIgnore] | 280 | |
284 | private int m_scriptAccessPin; | 281 | private int m_scriptAccessPin; |
285 | [XmlIgnore] | 282 | |
286 | private readonly Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>(); | 283 | private readonly Dictionary<UUID, scriptEvents> m_scriptEvents = new Dictionary<UUID, scriptEvents>(); |
287 | private string m_sitName = String.Empty; | 284 | private string m_sitName = String.Empty; |
288 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; | 285 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; |
@@ -548,7 +545,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
548 | } | 545 | } |
549 | 546 | ||
550 | 547 | ||
551 | [XmlIgnore] | 548 | |
552 | public Dictionary<int, string> CollisionFilter | 549 | public Dictionary<int, string> CollisionFilter |
553 | { | 550 | { |
554 | get { return m_CollisionFilter; } | 551 | get { return m_CollisionFilter; } |
@@ -558,21 +555,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
558 | } | 555 | } |
559 | } | 556 | } |
560 | 557 | ||
561 | [XmlIgnore] | 558 | |
562 | public Quaternion APIDTarget | 559 | public Quaternion APIDTarget |
563 | { | 560 | { |
564 | get { return m_APIDTarget; } | 561 | get { return m_APIDTarget; } |
565 | set { m_APIDTarget = value; } | 562 | set { m_APIDTarget = value; } |
566 | } | 563 | } |
567 | 564 | ||
568 | [XmlIgnore] | 565 | |
569 | public float APIDDamp | 566 | public float APIDDamp |
570 | { | 567 | { |
571 | get { return m_APIDDamp; } | 568 | get { return m_APIDDamp; } |
572 | set { m_APIDDamp = value; } | 569 | set { m_APIDDamp = value; } |
573 | } | 570 | } |
574 | 571 | ||
575 | [XmlIgnore] | 572 | |
576 | public float APIDStrength | 573 | public float APIDStrength |
577 | { | 574 | { |
578 | get { return m_APIDStrength; } | 575 | get { return m_APIDStrength; } |
@@ -618,35 +615,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
618 | set { m_LoopSoundSlavePrims = value; } | 615 | set { m_LoopSoundSlavePrims = value; } |
619 | } | 616 | } |
620 | 617 | ||
621 | [XmlIgnore] | 618 | |
622 | public Byte[] TextureAnimation | 619 | public Byte[] TextureAnimation |
623 | { | 620 | { |
624 | get { return m_TextureAnimation; } | 621 | get { return m_TextureAnimation; } |
625 | set { m_TextureAnimation = value; } | 622 | set { m_TextureAnimation = value; } |
626 | } | 623 | } |
627 | 624 | ||
628 | [XmlIgnore] | 625 | |
629 | public Byte[] ParticleSystem | 626 | public Byte[] ParticleSystem |
630 | { | 627 | { |
631 | get { return m_particleSystem; } | 628 | get { return m_particleSystem; } |
632 | set { m_particleSystem = value; } | 629 | set { m_particleSystem = value; } |
633 | } | 630 | } |
634 | 631 | ||
635 | [XmlIgnore] | 632 | |
636 | public DateTime Expires | 633 | public DateTime Expires |
637 | { | 634 | { |
638 | get { return m_expires; } | 635 | get { return m_expires; } |
639 | set { m_expires = value; } | 636 | set { m_expires = value; } |
640 | } | 637 | } |
641 | 638 | ||
642 | [XmlIgnore] | 639 | |
643 | public DateTime Rezzed | 640 | public DateTime Rezzed |
644 | { | 641 | { |
645 | get { return m_rezzed; } | 642 | get { return m_rezzed; } |
646 | set { m_rezzed = value; } | 643 | set { m_rezzed = value; } |
647 | } | 644 | } |
648 | 645 | ||
649 | [XmlIgnore] | 646 | |
650 | public float Damage | 647 | public float Damage |
651 | { | 648 | { |
652 | get { return m_damage; } | 649 | get { return m_damage; } |
@@ -1019,7 +1016,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1019 | } | 1016 | } |
1020 | } | 1017 | } |
1021 | 1018 | ||
1022 | [XmlIgnore] | 1019 | |
1023 | public bool CreateSelected | 1020 | public bool CreateSelected |
1024 | { | 1021 | { |
1025 | get { return m_createSelected; } | 1022 | get { return m_createSelected; } |
@@ -1201,14 +1198,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1201 | } | 1198 | } |
1202 | } | 1199 | } |
1203 | 1200 | ||
1204 | [XmlIgnore] | 1201 | |
1205 | public UUID SitTargetAvatar | 1202 | public UUID SitTargetAvatar |
1206 | { | 1203 | { |
1207 | get { return m_sitTargetAvatar; } | 1204 | get { return m_sitTargetAvatar; } |
1208 | set { m_sitTargetAvatar = value; } | 1205 | set { m_sitTargetAvatar = value; } |
1209 | } | 1206 | } |
1210 | 1207 | ||
1211 | [XmlIgnore] | 1208 | |
1212 | public virtual UUID RegionID | 1209 | public virtual UUID RegionID |
1213 | { | 1210 | { |
1214 | get | 1211 | get |
@@ -1222,7 +1219,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1222 | } | 1219 | } |
1223 | 1220 | ||
1224 | private UUID _parentUUID = UUID.Zero; | 1221 | private UUID _parentUUID = UUID.Zero; |
1225 | [XmlIgnore] | 1222 | |
1226 | public UUID ParentUUID | 1223 | public UUID ParentUUID |
1227 | { | 1224 | { |
1228 | get | 1225 | get |
@@ -1236,7 +1233,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1236 | set { _parentUUID = value; } | 1233 | set { _parentUUID = value; } |
1237 | } | 1234 | } |
1238 | 1235 | ||
1239 | [XmlIgnore] | 1236 | |
1240 | public string SitAnimation | 1237 | public string SitAnimation |
1241 | { | 1238 | { |
1242 | get { return m_sitAnimation; } | 1239 | get { return m_sitAnimation; } |
@@ -1850,7 +1847,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1850 | /// </summary> | 1847 | /// </summary> |
1851 | /// <param name="xmlReader"></param> | 1848 | /// <param name="xmlReader"></param> |
1852 | /// <returns></returns> | 1849 | /// <returns></returns> |
1853 | public static SceneObjectPart FromXml(XmlReader xmlReader) | 1850 | public static SceneObjectPart FromXml(XmlTextReader xmlReader) |
1854 | { | 1851 | { |
1855 | return FromXml(UUID.Zero, xmlReader); | 1852 | return FromXml(UUID.Zero, xmlReader); |
1856 | } | 1853 | } |
@@ -1861,9 +1858,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1861 | /// <param name="fromUserInventoryItemId">The inventory id from which this part came, if applicable</param> | 1858 | /// <param name="fromUserInventoryItemId">The inventory id from which this part came, if applicable</param> |
1862 | /// <param name="xmlReader"></param> | 1859 | /// <param name="xmlReader"></param> |
1863 | /// <returns></returns> | 1860 | /// <returns></returns> |
1864 | public static SceneObjectPart FromXml(UUID fromUserInventoryItemId, XmlReader xmlReader) | 1861 | public static SceneObjectPart FromXml(UUID fromUserInventoryItemId, XmlTextReader xmlReader) |
1865 | { | 1862 | { |
1866 | SceneObjectPart part = (SceneObjectPart)serializer.Deserialize(xmlReader); | 1863 | SceneObjectPart part = SceneObjectSerializer.Xml2ToSOP(xmlReader); |
1867 | part.m_fromUserInventoryItemID = fromUserInventoryItemId; | 1864 | part.m_fromUserInventoryItemID = fromUserInventoryItemId; |
1868 | 1865 | ||
1869 | // for tempOnRez objects, we have to fix the Expire date. | 1866 | // for tempOnRez objects, we have to fix the Expire date. |
@@ -4058,9 +4055,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4058 | /// Serialize this part to xml. | 4055 | /// Serialize this part to xml. |
4059 | /// </summary> | 4056 | /// </summary> |
4060 | /// <param name="xmlWriter"></param> | 4057 | /// <param name="xmlWriter"></param> |
4061 | public void ToXml(XmlWriter xmlWriter) | 4058 | public void ToXml(XmlTextWriter xmlWriter) |
4062 | { | 4059 | { |
4063 | serializer.Serialize(xmlWriter, this); | 4060 | SceneObjectSerializer.SOPToXml2(xmlWriter, this, new Dictionary<string, object>()); |
4064 | } | 4061 | } |
4065 | 4062 | ||
4066 | public void TriggerScriptChangedEvent(Changed val) | 4063 | public void TriggerScriptChangedEvent(Changed val) |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 9a00bea..252304b 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 | ||