aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs19
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs79
2 files changed, 93 insertions, 5 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 73b0a35..cfcfc79 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -274,7 +274,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
274 float minX, minY, minZ; 274 float minX, minY, minZ;
275 float maxX, maxY, maxZ; 275 float maxX, maxY, maxZ;
276 276
277 Vector3[] offsets = m_Scene.GetCombinedBoundingBox(objlist, 277 Vector3[] offsets = Scene.GetCombinedBoundingBox(objlist,
278 out minX, out maxX, out minY, out maxY, 278 out minX, out maxX, out minY, out maxY,
279 out minZ, out maxZ); 279 out minZ, out maxZ);
280 280
@@ -289,7 +289,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
289 XmlDocument doc = new XmlDocument(); 289 XmlDocument doc = new XmlDocument();
290 SceneObjectGroup g = objlist[i]; 290 SceneObjectGroup g = objlist[i];
291 doc.LoadXml(xmlStrings[g.UUID]); 291 doc.LoadXml(xmlStrings[g.UUID]);
292 XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup"); 292 XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup");
293 e.SetAttribute("offsetx", offsets[i].X.ToString()); 293 e.SetAttribute("offsetx", offsets[i].X.ToString());
294 e.SetAttribute("offsety", offsets[i].Y.ToString()); 294 e.SetAttribute("offsety", offsets[i].Y.ToString());
295 e.SetAttribute("offsetz", offsets[i].Z.ToString()); 295 e.SetAttribute("offsetz", offsets[i].Z.ToString());
@@ -659,9 +659,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
659 itemId, n.OuterXml); 659 itemId, n.OuterXml);
660 objlist.Add(g); 660 objlist.Add(g);
661 XmlElement el = (XmlElement)n; 661 XmlElement el = (XmlElement)n;
662 float x = Convert.ToSingle(el.GetAttribute("offsetx")); 662
663 float y = Convert.ToSingle(el.GetAttribute("offsety")); 663 string rawX = el.GetAttribute("offsetx");
664 float z = Convert.ToSingle(el.GetAttribute("offsetz")); 664 string rawY = el.GetAttribute("offsety");
665 string rawZ = el.GetAttribute("offsetz");
666//
667// m_log.DebugFormat(
668// "[INVENTORY ACCESS MODULE]: Converting coalesced object {0} offset <{1}, {2}, {3}>",
669// g.Name, rawX, rawY, rawZ);
670
671 float x = Convert.ToSingle(rawX);
672 float y = Convert.ToSingle(rawY);
673 float z = Convert.ToSingle(rawZ);
665 veclist.Add(new Vector3(x, y, z)); 674 veclist.Add(new Vector3(x, y, z));
666 } 675 }
667 } 676 }
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
index 5eca753..f8fa424 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
@@ -81,6 +81,85 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
81 } 81 }
82 82
83 [Test] 83 [Test]
84 public void TestRezCoalescedObject()
85 {
86 TestHelper.InMethod();
87 log4net.Config.XmlConfigurator.Configure();
88
89 // Create asset
90 SceneObjectGroup object1;
91 {
92 string partName = "Object1";
93 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
94 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
95 Vector3 groupPosition = new Vector3(10, 20, 30);
96 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
97 Vector3 offsetPosition = new Vector3(5, 10, 15);
98
99 SceneObjectPart part1
100 = new SceneObjectPart(
101 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
102 part1.Name = partName;
103
104 object1 = new SceneObjectGroup(part1);
105 }
106
107 SceneObjectGroup object2;
108 {
109 string partName = "Object2";
110 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
111 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
112 Vector3 groupPosition = new Vector3(10, 20, 30);
113 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
114 Vector3 offsetPosition = new Vector3(5, 10, 15);
115
116 SceneObjectPart part1
117 = new SceneObjectPart(
118 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
119 part1.Name = partName;
120
121 object2 = new SceneObjectGroup(part1);
122 }
123
124 CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2);
125
126 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
127 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, coa);
128 m_scene.AssetService.Store(asset1);
129
130 // Create item
131 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
132 string item1Name = "My Little Dog";
133 InventoryItemBase item1 = new InventoryItemBase();
134 item1.Name = item1Name;
135 item1.AssetID = asset1.FullID;
136 item1.ID = item1Id;
137 InventoryFolderBase objsFolder
138 = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, m_userId, "Objects")[0];
139 item1.Folder = objsFolder.ID;
140 m_scene.AddInventoryItem(item1);
141
142 SceneObjectGroup so
143 = m_iam.RezObject(
144 m_tc, item1Id, Vector3.Zero, Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false);
145
146 Assert.That(so, Is.Not.Null);
147
148 Assert.That(m_scene.SceneGraph.GetTotalObjectsCount(), Is.EqualTo(2));
149
150 SceneObjectPart retrievedObj1Part = m_scene.GetSceneObjectPart(object1.Name);
151 Assert.That(retrievedObj1Part, Is.Null);
152
153 retrievedObj1Part = m_scene.GetSceneObjectPart(item1.Name);
154 Assert.That(retrievedObj1Part, Is.Not.Null);
155 Assert.That(retrievedObj1Part.Name, Is.EqualTo(item1.Name));
156
157 // FIXME: Can't test yet due to a bug where objects in coalescence all get the item name when rerezzed.
158// SceneObjectPart retrievedObj2Part = m_scene.GetSceneObjectPart(object2.Name);
159// Assert.That(retrievedObj2Part, Is.Not.Null);
160 }
161
162 [Test]
84 public void TestRezObject() 163 public void TestRezObject()
85 { 164 {
86 TestHelper.InMethod(); 165 TestHelper.InMethod();