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, --- .../Framework/Interfaces/IEntityInventory.cs | 2 ++ .../Region/Framework/Interfaces/IScriptModule.cs | 1 + .../Scenes/AsyncSceneObjectGroupDeleter.cs | 11 +++++++--- .../Region/Framework/Scenes/SceneObjectGroup.cs | 11 ++++++++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 +++++ .../Framework/Scenes/SceneObjectPartInventory.cs | 25 ++++++++++++++++++++++ 6 files changed, 52 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index f040365..1ed92fb 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs @@ -197,5 +197,7 @@ namespace OpenSim.Region.Framework.Interfaces /// A /// Dictionary GetScriptStates(); + + bool CanBeDeleted(); } } diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index 2c4ddbd..10835b9 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs @@ -36,6 +36,7 @@ namespace OpenSim.Region.Framework.Interfaces string GetAssemblyName(UUID itemID); string GetXMLState(UUID itemID); + bool CanBeDeleted(UUID itemID); bool PostScriptEvent(UUID itemID, string name, Object[] args); bool PostObjectEvent(UUID itemID, string name, Object[] args); 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