From abfede7819e470c4a9d135b529c40d19fb94dca5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Oct 2010 19:59:30 +0200 Subject: [PATCH 01/10] Plumb the path for multiple object deletes --- .../InventoryAccess/InventoryAccessModule.cs | 31 ++++++++++--- .../Framework/Scenes/Scene.Inventory.cs | 44 ++++--------------- OpenSim/Region/Framework/Scenes/Scene.cs | 4 +- .../Framework/Scenes/SceneObjectGroup.cs | 8 +++- .../Scenes/Tests/SceneObjectBasicTests.cs | 2 +- .../Tests/Common/Setup/SceneSetupHelpers.cs | 2 +- 6 files changed, 45 insertions(+), 46 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index c1d6cd3c26..d05cfc2f8a 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -196,13 +196,24 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // currently calls this with multiple items. UUID ret = UUID.Zero; + Dictionary> deletes = + new Dictionary>(); + foreach (SceneObjectGroup g in objectGroups) - ret = DeleteToInventory(action, folderID, g, remoteClient); + { + if (!deletes.ContainsKey(g.OwnerID)) + deletes[g.OwnerID] = new List(); + + deletes[g.OwnerID].Add(g); + } + + foreach (List objlist in deletes.Values) + ret = DeleteToInventory(action, folderID, objlist, remoteClient); return ret; } - public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, + private UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) { UUID assetID = UUID.Zero; @@ -315,10 +326,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } else { - // Catch all. Use lost & found - // + if (remoteClient == null || + objectGroup.OwnerID != remoteClient.AgentId) + { + // Taking copy of another person's item. Take to + // Objects folder. + folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); + } + else + { + // Catch all. Use lost & found + // - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); + folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); + } } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 1bf6b87a43..4cc797bd9f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1689,37 +1689,6 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// Called when one or more objects are removed from the environment into inventory. - /// - /// - /// - /// - /// - /// - public virtual void DeRezObject(IClientAPI remoteClient, List localIDs, - UUID groupID, DeRezAction action, UUID destinationID) - { - foreach (uint localID in localIDs) - { - DeRezObject(remoteClient, localID, groupID, action, destinationID); - } - } - - /// - /// Called when an object is removed from the environment into inventory. - /// - /// - /// - /// - /// - /// - public virtual void DeRezObject(IClientAPI remoteClient, uint localID, - UUID groupID, DeRezAction action, UUID destinationID) - { - DeRezObjects(remoteClient, new List() { localID }, groupID, action, destinationID); - } - public virtual void DeRezObjects(IClientAPI remoteClient, List localIDs, UUID groupID, DeRezAction action, UUID destinationID) { @@ -1990,14 +1959,19 @@ namespace OpenSim.Region.Framework.Scenes return group; } - public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId) + public virtual bool returnObjects(SceneObjectGroup[] returnobjects, + UUID AgentId) { + List localIDs = new List(); + foreach (SceneObjectGroup grp in returnobjects) { - AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); - DeRezObject(null, grp.RootPart.LocalId, - grp.RootPart.GroupID, DeRezAction.Return, UUID.Zero); + AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, + "parcel owner return"); + localIDs.Add(grp.RootPart.LocalId); } + DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, + UUID.Zero); return true; } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index fe0ab5b057..0cfc235be2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2735,7 +2735,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnGrabUpdate += m_sceneGraph.MoveObject; client.OnSpinStart += m_sceneGraph.SpinStart; client.OnSpinUpdate += m_sceneGraph.SpinObject; - client.OnDeRezObject += DeRezObject; + client.OnDeRezObject += DeRezObjects; client.OnObjectName += m_sceneGraph.PrimName; client.OnObjectClickAction += m_sceneGraph.PrimClickAction; @@ -2864,7 +2864,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnGrabUpdate -= m_sceneGraph.MoveObject; client.OnSpinStart -= m_sceneGraph.SpinStart; client.OnSpinUpdate -= m_sceneGraph.SpinObject; - client.OnDeRezObject -= DeRezObject; + client.OnDeRezObject -= DeRezObjects; client.OnObjectName -= m_sceneGraph.PrimName; client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 5513584ccb..f7a304f059 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1291,6 +1291,8 @@ namespace OpenSim.Region.Framework.Scenes ILandObject parcel = m_scene.LandChannel.GetLandObject( m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y); + List returns = new List(); + if (parcel != null && parcel.LandData != null && parcel.LandData.OtherCleanTime != 0) { @@ -1304,13 +1306,15 @@ namespace OpenSim.Region.Framework.Scenes DetachFromBackup(); m_log.InfoFormat("[SCENE]: Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return"); - m_scene.DeRezObject(null, RootPart.LocalId, - RootPart.GroupID, DeRezAction.Return, UUID.Zero); + returns.Add(RootPart.LocalId); return; } } } + + m_scene.DeRezObjects(null, returns, UUID.Zero, + DeRezAction.Return, UUID.Zero); } if (HasGroupChanged) diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 5616a4e9d6..4969b09149 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -142,7 +142,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); - scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero); + scene.DeRezObjects(client, new System.Collections.Generic.List() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index fc9db03932..9d7733e465 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -556,7 +556,7 @@ namespace OpenSim.Tests.Common.Setup AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; sogd.Enabled = false; - scene.DeRezObject(client, part.LocalId, UUID.Zero, action, destinationId); + scene.DeRezObjects(client, new List() { part.LocalId }, UUID.Zero, action, destinationId); sogd.InventoryDeQueueAndDelete(); } } From 9a5d0984a5d4d416cf2e8560648aa94de916ad20 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 7 Oct 2010 02:16:36 +0100 Subject: [PATCH 02/10] Fix autoreturn to not return zero objects --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f7a304f059..5f00f846e4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1291,8 +1291,6 @@ namespace OpenSim.Region.Framework.Scenes ILandObject parcel = m_scene.LandChannel.GetLandObject( m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y); - List returns = new List(); - if (parcel != null && parcel.LandData != null && parcel.LandData.OtherCleanTime != 0) { @@ -1306,15 +1304,13 @@ namespace OpenSim.Region.Framework.Scenes DetachFromBackup(); m_log.InfoFormat("[SCENE]: Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return"); - returns.Add(RootPart.LocalId); + m_scene.DeRezObjects(null, new List() { RootPart.LocalId }, UUID.Zero, + DeRezAction.Return, UUID.Zero); return; } } } - - m_scene.DeRezObjects(null, returns, UUID.Zero, - DeRezAction.Return, UUID.Zero); } if (HasGroupChanged) From 12bc6a7414068554c4499ef4d2100692f5c8c9ec Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Oct 2010 03:08:05 +0100 Subject: [PATCH 03/10] Clarify the format comment at the top of OpenSim.ini.example --- bin/OpenSim.ini.example | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 91f6068210..62ce451387 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -13,7 +13,10 @@ ;; An empty question will set the default if the dependencies are ;; satisfied. ;; -;; ; denotes a commented option. It is ignored. +;; ; denotes a commented out option. Uncomment it to actvate it +;; and change it to the desired value +;; Any options added to OpenSim.ini.exmaple must be commented out, +;; and their value must represent the default. [Startup] ;# {save_crashes} {} {Save crashes to disk?} {true false} false From 9391c3ffee4fb722657ebb064f8ba02f1d1f8802 Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 7 Oct 2010 19:34:46 -0700 Subject: [PATCH 04/10] add a flag in OpenSim.ini.example for enabling/disabling decoded sculpt map caching for meshing --- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 3 ++- bin/OpenSim.ini.example | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 20a5bb4815..c97db8ca0f 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -81,7 +81,8 @@ namespace OpenSim.Region.Physics.Meshing { IConfig start_config = config.Configs["Startup"]; - decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache"); + decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache"); + cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps); try { diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 1625de0de7..91f6068210 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -130,6 +130,14 @@ ;; Usually this is only a box. ; meshing = Meshmerizer ; meshing = ZeroMesher + + ;# {CacheSculptMaps} {Cache decoded sculpt maps?} {true false} true + ;; if you use Meshmerizer and want sculpt map collisions, setting this to + ;; to true will store decoded sculpt maps in a special folder in your bin + ;; folder, which can reduce startup times by reducing asset requests. Some + ;; versions of mono dont work well when reading the cache files, so set this + ;; to false if you have compatability problems. + CacheSculptMaps = false ;; Choose one of the physics engines below ;; OpenDynamicsEngine is by some distance the most developed physics engine From 0d9c94033d5180292bc8618b8b0f79a8531c3b8d Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 7 Oct 2010 19:48:17 -0700 Subject: [PATCH 05/10] move CacheSculptMaps ini flag to OpenSimDefaults.ini comment it and change defailt to true to reflect code --- bin/OpenSim.ini.example | 8 -------- bin/OpenSimDefaults.ini | 10 +++++++++- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 91f6068210..1625de0de7 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -130,14 +130,6 @@ ;; Usually this is only a box. ; meshing = Meshmerizer ; meshing = ZeroMesher - - ;# {CacheSculptMaps} {Cache decoded sculpt maps?} {true false} true - ;; if you use Meshmerizer and want sculpt map collisions, setting this to - ;; to true will store decoded sculpt maps in a special folder in your bin - ;; folder, which can reduce startup times by reducing asset requests. Some - ;; versions of mono dont work well when reading the cache files, so set this - ;; to false if you have compatability problems. - CacheSculptMaps = false ;; Choose one of the physics engines below ;; OpenDynamicsEngine is by some distance the most developed physics engine diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index f939cc8d7f..53d8ab7577 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -139,7 +139,15 @@ ;; Path to decoded sculpty maps ;; Defaults to "j2kDecodeCache ;DecodedSculptMapPath = "j2kDecodeCache" - + + ;# {CacheSculptMaps} {Cache decoded sculpt maps?} {true false} true + ;; if you use Meshmerizer and want sculpt map collisions, setting this to + ;; to true will store decoded sculpt maps in a special folder in your bin + ;; folder, which can reduce startup times by reducing asset requests. Some + ;; versions of mono dont work well when reading the cache files, so set this + ;; to false if you have compatability problems. + ; CacheSculptMaps = true + ; Choose one of the physics engines below ; OpenDynamicsEngine is by some distance the most developed physics engine ; basicphysics effectively does not model physics at all, making all objects phantom From 5dcbbb726a15bc14da76b59577d009c25ad5e4e1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Oct 2010 18:40:13 +0100 Subject: [PATCH 06/10] Change the order of actions to address a possible nullref --- OpenSim/Region/Framework/Scenes/SceneViewer.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index b45291fcba..e6f7235057 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs @@ -179,11 +179,10 @@ namespace OpenSim.Region.Framework.Scenes public void Reset() { - if (m_pendingObjects != null) + lock (m_pendingObjects) { - lock (m_pendingObjects) + if (m_pendingObjects != null) { - m_pendingObjects.Clear(); m_pendingObjects = null; } From 4a0911bdbd3429d88b448bd324d8813cf6023e64 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Oct 2010 19:19:07 +0100 Subject: [PATCH 07/10] Guard against locking a nullref to avoid build break --- OpenSim/Region/Framework/Scenes/SceneViewer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index e6f7235057..b44a0100a4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs @@ -179,6 +179,9 @@ namespace OpenSim.Region.Framework.Scenes public void Reset() { + if (m_pendingObjects == null) + return; + lock (m_pendingObjects) { if (m_pendingObjects != null) From 4a57288577dd3ec6a99f467b4a2761fe83b0b4b8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 8 Oct 2010 23:23:07 +0100 Subject: [PATCH 08/10] Fix an infinite recursion --- .../Framework/InventoryAccess/InventoryAccessModule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index d05cfc2f8a..7a175ea362 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -208,7 +208,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } foreach (List objlist in deletes.Values) - ret = DeleteToInventory(action, folderID, objlist, remoteClient); + { + foreach (SceneObjectGroup g in objlist) + ret = DeleteToInventory(action, folderID, g, remoteClient); + } return ret; } From 211ea5d52126bf19d53e57af750a0a964a60b56e Mon Sep 17 00:00:00 2001 From: Marck Date: Sun, 19 Sep 2010 13:26:06 +0200 Subject: [PATCH 09/10] Limit formatting of local console output to actual logging messages. The formatting of lines with the help of a regular expression match will be done only for output with an explicitly given logging level. This fixes the issue of colons being added to help texts on the local console. --- OpenSim/Framework/Console/LocalConsole.cs | 30 +++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index 6043094440..5f2f4041b5 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs @@ -44,6 +44,7 @@ namespace OpenSim.Framework.Console // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private readonly object m_syncRoot = new object(); + private const string LOGLEVEL_NONE = "(none)"; private int y = -1; private int cp = 0; @@ -278,22 +279,25 @@ namespace OpenSim.Framework.Console private void WriteLocalText(string text, string level) { - string regex = @"^(?.*?)\[(?[^\]]+)\]:?(?.*)"; - - Regex RE = new Regex(regex, RegexOptions.Multiline); - MatchCollection matches = RE.Matches(text); - string outText = text; - if (matches.Count == 1) + if (level != LOGLEVEL_NONE) { - outText = matches[0].Groups["End"].Value; - System.Console.Write(matches[0].Groups["Front"].Value); + string regex = @"^(?.*?)\[(?[^\]]+)\]:?(?.*)"; - System.Console.Write("["); - WriteColorText(DeriveColor(matches[0].Groups["Category"].Value), - matches[0].Groups["Category"].Value); - System.Console.Write("]:"); + Regex RE = new Regex(regex, RegexOptions.Multiline); + MatchCollection matches = RE.Matches(text); + + if (matches.Count == 1) + { + outText = matches[0].Groups["End"].Value; + System.Console.Write(matches[0].Groups["Front"].Value); + + System.Console.Write("["); + WriteColorText(DeriveColor(matches[0].Groups["Category"].Value), + matches[0].Groups["Category"].Value); + System.Console.Write("]:"); + } } if (level == "error") @@ -308,7 +312,7 @@ namespace OpenSim.Framework.Console public override void Output(string text) { - Output(text, "normal"); + Output(text, LOGLEVEL_NONE); } public override void Output(string text, string level) From ed161020e2da611e56c63ea8314e5305845f3377 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 9 Oct 2010 01:46:29 +0100 Subject: [PATCH 10/10] minor: remove some mono compiler warnings --- OpenSim/Framework/Tests/MundaneFrameworkTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs index 04be0839fb..e7f8bfc1f0 100644 --- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs +++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs @@ -140,10 +140,10 @@ namespace OpenSim.Framework.Tests settings.Save(); settings.OnSave -= RegionSaveFired; - string str = settings.LoadedCreationDate; - int dt = settings.LoadedCreationDateTime; - string id = settings.LoadedCreationID; - string time = settings.LoadedCreationTime; +// string str = settings.LoadedCreationDate; +// int dt = settings.LoadedCreationDateTime; +// string id = settings.LoadedCreationID; +// string time = settings.LoadedCreationTime; Assert.That(m_RegionSettingsOnSaveEventFired, "RegionSettings Save Event didn't Fire");