aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs95
1 files changed, 34 insertions, 61 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 73b0a35..c0946f4 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -222,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
222 deletes[g.OwnerID].Add(g); 222 deletes[g.OwnerID].Add(g);
223 } 223 }
224 224
225 // This is pethod scoped and will be returned. It will be the 225 // This is method scoped and will be returned. It will be the
226 // last created asset id 226 // last created asset id
227 UUID assetID = UUID.Zero; 227 UUID assetID = UUID.Zero;
228 228
@@ -230,8 +230,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
230 // with distinct destinations as well. 230 // with distinct destinations as well.
231 foreach (List<SceneObjectGroup> objlist in deletes.Values) 231 foreach (List<SceneObjectGroup> objlist in deletes.Values)
232 { 232 {
233 Dictionary<UUID, string> xmlStrings = 233 CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero);
234 new Dictionary<UUID, string>(); 234 Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>();
235 235
236 foreach (SceneObjectGroup objectGroup in objlist) 236 foreach (SceneObjectGroup objectGroup in objlist)
237 { 237 {
@@ -245,7 +245,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
245 : objectGroup.AbsolutePosition.X, 245 : objectGroup.AbsolutePosition.X,
246 objectGroup.AbsolutePosition.Z); 246 objectGroup.AbsolutePosition.Z);
247 247
248 Vector3 originalPosition = objectGroup.AbsolutePosition; 248 originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition;
249 249
250 objectGroup.AbsolutePosition = inventoryStoredPosition; 250 objectGroup.AbsolutePosition = inventoryStoredPosition;
251 251
@@ -259,59 +259,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
259 (uint)PermissionMask.Modify); 259 (uint)PermissionMask.Modify);
260 objectGroup.RootPart.NextOwnerMask |= 260 objectGroup.RootPart.NextOwnerMask |=
261 (uint)PermissionMask.Move; 261 (uint)PermissionMask.Move;
262 262
263 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); 263 coa.Add(objectGroup);
264
265 objectGroup.AbsolutePosition = originalPosition;
266
267 xmlStrings[objectGroup.UUID] = sceneObjectXml;
268 } 264 }
269 265
270 string itemXml; 266 string itemXml;
271 267
272 if (objlist.Count > 1) 268 if (objlist.Count > 1)
273 { 269 itemXml = CoalescedSceneObjectsSerializer.ToXml(coa);
274 float minX, minY, minZ;
275 float maxX, maxY, maxZ;
276
277 Vector3[] offsets = m_Scene.GetCombinedBoundingBox(objlist,
278 out minX, out maxX, out minY, out maxY,
279 out minZ, out maxZ);
280
281 // CreateWrapper
282 XmlDocument itemDoc = new XmlDocument();
283 XmlElement root = itemDoc.CreateElement("", "CoalescedObject", "");
284 itemDoc.AppendChild(root);
285
286 // Embed the offsets into the group XML
287 for ( int i = 0 ; i < objlist.Count ; i++ )
288 {
289 XmlDocument doc = new XmlDocument();
290 SceneObjectGroup g = objlist[i];
291 doc.LoadXml(xmlStrings[g.UUID]);
292 XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup");
293 e.SetAttribute("offsetx", offsets[i].X.ToString());
294 e.SetAttribute("offsety", offsets[i].Y.ToString());
295 e.SetAttribute("offsetz", offsets[i].Z.ToString());
296
297 XmlNode objectNode = itemDoc.ImportNode(e, true);
298 root.AppendChild(objectNode);
299 }
300
301 float sizeX = maxX - minX;
302 float sizeY = maxY - minY;
303 float sizeZ = maxZ - minZ;
304
305 root.SetAttribute("x", sizeX.ToString());
306 root.SetAttribute("y", sizeY.ToString());
307 root.SetAttribute("z", sizeZ.ToString());
308
309 itemXml = itemDoc.InnerXml;
310 }
311 else 270 else
312 { 271 itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0]);
313 itemXml = xmlStrings[objlist[0].UUID]; 272
314 } 273 // Restore the position of each group now that it has been stored to inventory.
274 foreach (SceneObjectGroup objectGroup in objlist)
275 objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID];
315 276
316 // Get the user info of the item destination 277 // Get the user info of the item destination
317 // 278 //
@@ -332,7 +293,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
332 { 293 {
333 // All returns / deletes go to the object owner 294 // All returns / deletes go to the object owner
334 // 295 //
335
336 userID = objlist[0].RootPart.OwnerID; 296 userID = objlist[0].RootPart.OwnerID;
337 } 297 }
338 298
@@ -346,7 +306,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
346 // Delete is treated like return in this case 306 // Delete is treated like return in this case
347 // Deleting your own items makes them go to trash 307 // Deleting your own items makes them go to trash
348 // 308 //
349 309
350 InventoryFolderBase folder = null; 310 InventoryFolderBase folder = null;
351 InventoryItemBase item = null; 311 InventoryItemBase item = null;
352 312
@@ -548,7 +508,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
548 return assetID; 508 return assetID;
549 } 509 }
550 510
551
552 /// <summary> 511 /// <summary>
553 /// Rez an object into the scene from the user's inventory 512 /// Rez an object into the scene from the user's inventory
554 /// </summary> 513 /// </summary>
@@ -659,9 +618,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
659 itemId, n.OuterXml); 618 itemId, n.OuterXml);
660 objlist.Add(g); 619 objlist.Add(g);
661 XmlElement el = (XmlElement)n; 620 XmlElement el = (XmlElement)n;
662 float x = Convert.ToSingle(el.GetAttribute("offsetx")); 621
663 float y = Convert.ToSingle(el.GetAttribute("offsety")); 622 string rawX = el.GetAttribute("offsetx");
664 float z = Convert.ToSingle(el.GetAttribute("offsetz")); 623 string rawY = el.GetAttribute("offsety");
624 string rawZ = el.GetAttribute("offsetz");
625//
626// m_log.DebugFormat(
627// "[INVENTORY ACCESS MODULE]: Converting coalesced object {0} offset <{1}, {2}, {3}>",
628// g.Name, rawX, rawY, rawZ);
629
630 float x = Convert.ToSingle(rawX);
631 float y = Convert.ToSingle(rawY);
632 float z = Convert.ToSingle(rawZ);
665 veclist.Add(new Vector3(x, y, z)); 633 veclist.Add(new Vector3(x, y, z));
666 } 634 }
667 } 635 }
@@ -753,10 +721,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
753 // affect the name stored in the serialization, transfer 721 // affect the name stored in the serialization, transfer
754 // the correct name from the inventory to the 722 // the correct name from the inventory to the
755 // object itself before we rez. 723 // object itself before we rez.
756 rootPart.Name = item.Name; 724 //
757 rootPart.Description = item.Description; 725 // Only do these for the first object if we are rezzing a coalescence.
758 rootPart.ObjectSaleType = item.SaleType; 726 if (i == 0)
759 rootPart.SalePrice = item.SalePrice; 727 {
728 rootPart.Name = item.Name;
729 rootPart.Description = item.Description;
730 rootPart.ObjectSaleType = item.SaleType;
731 rootPart.SalePrice = item.SalePrice;
732 }
760 733
761 group.SetGroup(remoteClient.ActiveGroupId, remoteClient); 734 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
762 if ((rootPart.OwnerID != item.Owner) || 735 if ((rootPart.OwnerID != item.Owner) ||