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 ++++++++++++++++++++++
.../ScriptEngine/DotNetEngine/ScriptEngine.cs | 5 +++++
.../ScriptEngine/Interfaces/IScriptInstance.cs | 1 +
.../ScriptEngine/Shared/Instance/ScriptInstance.cs | 5 +++++
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 9 ++++++++
10 files changed, 72 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region')
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;
+ }
}
}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
index ec94afa..987827c 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
@@ -476,5 +476,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{
return "";
}
+
+ public bool CanBeDeleted(UUID itemID)
+ {
+ return true;
+ }
}
}
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index 64f7077..c2fce2f 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -95,6 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
UUID GetDetectID(int idx);
void SaveState(string assembly);
void DestroyScriptInstance();
+ bool CanBeDeleted();
IScriptApi GetApi(string name);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 2457b3a..42d61a7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -991,5 +991,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
get { return m_RegionID; }
}
+
+ public bool CanBeDeleted()
+ {
+ return true;
+ }
}
}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index dff53dd..c7673c7 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1241,5 +1241,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return "";
return instance.GetXMLState();
}
+
+ public bool CanBeDeleted(UUID itemID)
+ {
+ IScriptInstance instance = GetInstance(itemID);
+ if (instance == null)
+ return true;
+
+ return instance.CanBeDeleted();
+ }
}
}
--
cgit v1.1