From 17bdc45c5ce623549b185a6c4bd5e8fdf00c8d8e Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 4 Aug 2009 03:17:13 +0100 Subject: Add plumbing for the SceneObjectDeleter to wait for the script engine to allow final deletion of objects. Meant to support the attach(NULL_KEY) event, --- .../Scenes/AsyncSceneObjectGroupDeleter.cs | 11 +++++++--- .../Region/Framework/Scenes/SceneObjectGroup.cs | 11 ++++++++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 +++++ .../Framework/Scenes/SceneObjectPartInventory.cs | 25 ++++++++++++++++++++++ 4 files changed, 49 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs index 4ef1749..f8208ec 100644 --- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs @@ -109,7 +109,7 @@ namespace OpenSim.Region.Framework.Scenes while (InventoryDeQueueAndDelete()) { - m_log.Debug("[SCENE]: Sent item successfully to inventory, continuing..."); + //m_log.Debug("[SCENE]: Sent item successfully to inventory, continuing..."); } } @@ -128,11 +128,16 @@ namespace OpenSim.Region.Framework.Scenes int left = m_inventoryDeletes.Count; if (left > 0) { + x = m_inventoryDeletes.Dequeue(); + if (!x.objectGroup.CanBeDeleted()) + { + m_inventoryDeletes.Enqueue(x); + return true; + } + m_log.DebugFormat( "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); - x = m_inventoryDeletes.Dequeue(); - try { m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0f7bd00..21e133b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3383,5 +3383,16 @@ namespace OpenSim.Region.Framework.Scenes SetFromAssetID(uuid); } #endregion + + public bool CanBeDeleted() + { + foreach (SceneObjectPart part in Children.Values) + { + if (!part.CanBeDeleted()) + return false; + } + + return true; + } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a4d455c..bc11709 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3787,5 +3787,10 @@ if (m_shape != null) { Inventory.ApplyNextOwnerPermissions(); } + + public bool CanBeDeleted() + { + return Inventory.CanBeDeleted(); + } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 084aa50..582f44d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -910,5 +910,30 @@ namespace OpenSim.Region.Framework.Scenes } return ret; } + + public bool CanBeDeleted() + { + if (!ContainsScripts()) + return true; + + IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces(); + + if (engines == null) // No engine at all + return true; + + foreach (TaskInventoryItem item in m_items.Values) + { + if (item.InvType == (int)InventoryType.LSL) + { + foreach (IScriptModule e in engines) + { + if(!e.CanBeDeleted(item.ItemID)) + return false; + } + } + } + + return true; + } } } -- cgit v1.1