From 419fc9427ef14eea443ec6f57501c6915c2de3b9 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 18 Apr 2011 20:03:53 +0100 Subject: [PATCH 1/2] Provide a configuration setting to control whether multiple taken objects are coalesced to inventory This is the CoalesceMultipleObjectsToInventory setting in [Inventory] in OpenSimDefaults.ini Default is true. --- .../HGInventoryAccessModule.cs | 3 + .../InventoryAccess/InventoryAccessModule.cs | 59 ++++++++++++++----- bin/OpenSimDefaults.ini | 7 +++ 3 files changed, 54 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 8c99983a95..52791cb046 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -75,6 +75,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (name == Name) { m_Enabled = true; + + InitialiseCommon(source); + m_log.InfoFormat("[HG INVENTORY ACCESS MODULE]: {0} enabled.", Name); IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"]; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index a716326924..e030ba11f7 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -64,7 +64,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return m_UserManagement; } } - + + public bool CoalesceMultipleObjectsToInventory { get; set; } #region INonSharedRegionModule @@ -87,10 +88,28 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (name == Name) { m_Enabled = true; - m_log.InfoFormat("[INVENTORY ACCESS MODULE]: {0} enabled.", Name); + + InitialiseCommon(source); + + m_log.InfoFormat("[INVENTORY ACCESS MODULE]: {0} enabled.", Name); } } } + + /// + /// Common module config for both this and descendant classes. + /// + /// + protected virtual void InitialiseCommon(IConfigSource source) + { + IConfig inventoryConfig = source.Configs["Inventory"]; + + if (inventoryConfig != null) + CoalesceMultipleObjectsToInventory + = inventoryConfig.GetBoolean("CoalesceMultipleObjectsToInventory", true); + else + CoalesceMultipleObjectsToInventory = true; + } public virtual void PostInitialise() { @@ -206,20 +225,30 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, List objectGroups, IClientAPI remoteClient) { - UUID ret = UUID.Zero; - - // The following code groups the SOG's by owner. No objects - // belonging to different people can be coalesced, for obvious - // reasons. - Dictionary> deletes = - new Dictionary>(); - - foreach (SceneObjectGroup g in objectGroups) + Dictionary> deletes = new Dictionary>(); + + if (CoalesceMultipleObjectsToInventory) { - if (!deletes.ContainsKey(g.OwnerID)) - deletes[g.OwnerID] = new List(); - - deletes[g.OwnerID].Add(g); + // The following code groups the SOG's by owner. No objects + // belonging to different people can be coalesced, for obvious + // reasons. + foreach (SceneObjectGroup g in objectGroups) + { + if (!deletes.ContainsKey(g.OwnerID)) + deletes[g.OwnerID] = new List(); + + deletes[g.OwnerID].Add(g); + } + } + else + { + // If we don't want to coalesce then put every object in its own bundle. + foreach (SceneObjectGroup g in objectGroups) + { + List bundle = new List(); + bundle.Add(g); + deletes[g.UUID] = bundle; + } } // This is method scoped and will be returned. It will be the diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 107e859827..2e0a22bc8a 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -453,6 +453,13 @@ ; ForwardOfflineGroupMessages = true +[Inventory] + ; Control whether multiple objects sent to inventory should be coaleseced into a single item + ; There are still some issues with coalescence, including the fact that rotation is not restored + ; and some assets may be missing from archive files. + CoalesceMultipleObjectsToInventory = true + + [ODEPhysicsSettings] ;## ;## World Settings From 5a404a9ab1b8c684e5704efe09205f44d4a2e353 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 18 Apr 2011 21:07:11 +0100 Subject: [PATCH 2/2] Fix bug where objects were being coalesced in the wrong positions. This addresses http://opensimulator.org/mantis/view.php?id=5441 The bug was due to a pre-existing mistake in creating the inventory stored position --- .../Framework/InventoryAccess/InventoryAccessModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index e030ba11f7..326ef28b9e 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -269,9 +269,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess ? 250 : objectGroup.AbsolutePosition.X) , - (objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) + (objectGroup.AbsolutePosition.Y > (int)Constants.RegionSize) ? 250 - : objectGroup.AbsolutePosition.X, + : objectGroup.AbsolutePosition.Y, objectGroup.AbsolutePosition.Z); originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition;