aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Serialization
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-04-13 21:48:16 +0100
committerJustin Clark-Casey (justincc)2011-04-13 21:48:16 +0100
commit68cc5b46fefdf4db68cae1202086257ce731f8a1 (patch)
treec7e805586da1aa2b0125db4142cde303a8565cfe /OpenSim/Region/Framework/Scenes/Serialization
parentFix bug where rezzing coalesced objects would give all objects the same name ... (diff)
downloadopensim-SC-68cc5b46fefdf4db68cae1202086257ce731f8a1.zip
opensim-SC-68cc5b46fefdf4db68cae1202086257ce731f8a1.tar.gz
opensim-SC-68cc5b46fefdf4db68cae1202086257ce731f8a1.tar.bz2
opensim-SC-68cc5b46fefdf4db68cae1202086257ce731f8a1.tar.xz
refactor: move code to obtain the coalescence size and object offsets into CoalescedSceneObjects from the serializer.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs27
1 files changed, 12 insertions, 15 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
index 3af2f76..a0e120a 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
@@ -42,6 +42,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
42 /// <summary> 42 /// <summary>
43 /// Serialize and deserialize coalesced scene objects. 43 /// Serialize and deserialize coalesced scene objects.
44 /// </summary> 44 /// </summary>
45 /// <remarks>
46 /// Deserialization not yet here.
47 /// </remarks>
45 public class CoalescedSceneObjectsSerializer 48 public class CoalescedSceneObjectsSerializer
46 { 49 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -60,29 +63,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
60 using (StringWriter sw = new StringWriter()) 63 using (StringWriter sw = new StringWriter())
61 { 64 {
62 using (XmlTextWriter writer = new XmlTextWriter(sw)) 65 using (XmlTextWriter writer = new XmlTextWriter(sw))
63 { 66 {
67 Vector3 size;
68
64 List<SceneObjectGroup> coaObjects = coa.Objects; 69 List<SceneObjectGroup> coaObjects = coa.Objects;
65 70
66// m_log.DebugFormat( 71// m_log.DebugFormat(
67// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object", 72// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object",
68// coaObjects.Count); 73// coaObjects.Count);
69 74
70 float minX, minY, minZ; 75 // This is weak - we're relying on the set of coalesced objects still being identical
71 float maxX, maxY, maxZ; 76 Vector3[] offsets = coa.GetSizeAndOffsets(out size);
72
73 Vector3[] offsets = Scene.GetCombinedBoundingBox(coaObjects,
74 out minX, out maxX, out minY, out maxY,
75 out minZ, out maxZ);
76 77
77 writer.WriteStartElement("CoalescedObject"); 78 writer.WriteStartElement("CoalescedObject");
78 79
79 float sizeX = maxX - minX; 80 writer.WriteAttributeString("x", size.X.ToString());
80 float sizeY = maxY - minY; 81 writer.WriteAttributeString("y", size.Y.ToString());
81 float sizeZ = maxZ - minZ; 82 writer.WriteAttributeString("z", size.Z.ToString());
82
83 writer.WriteAttributeString("x", sizeX.ToString());
84 writer.WriteAttributeString("y", sizeY.ToString());
85 writer.WriteAttributeString("z", sizeZ.ToString());
86 83
87 // Embed the offsets into the group XML 84 // Embed the offsets into the group XML
88 for (int i = 0; i < coaObjects.Count; i++) 85 for (int i = 0; i < coaObjects.Count; i++)
@@ -100,7 +97,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
100 97
101 SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, true); 98 SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, true);
102 99
103 writer.WriteEndElement(); 100 writer.WriteEndElement(); // SceneObjectGroup
104 } 101 }
105 102
106 writer.WriteEndElement(); // CoalescedObject 103 writer.WriteEndElement(); // CoalescedObject