diff options
author | Melanie | 2009-08-04 03:17:13 +0100 |
---|---|---|
committer | Melanie | 2009-08-04 03:17:13 +0100 |
commit | 17bdc45c5ce623549b185a6c4bd5e8fdf00c8d8e (patch) | |
tree | b1e75c63acc472c6e211f2054abedf99ccf1bf06 /OpenSim/Region | |
parent | Minor: formatting changes. (diff) | |
download | opensim-SC-17bdc45c5ce623549b185a6c4bd5e8fdf00c8d8e.zip opensim-SC-17bdc45c5ce623549b185a6c4bd5e8fdf00c8d8e.tar.gz opensim-SC-17bdc45c5ce623549b185a6c4bd5e8fdf00c8d8e.tar.bz2 opensim-SC-17bdc45c5ce623549b185a6c4bd5e8fdf00c8d8e.tar.xz |
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,
Diffstat (limited to 'OpenSim/Region')
10 files changed, 72 insertions, 3 deletions
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 | |||
197 | /// A <see cref="Dictionary`2"/> | 197 | /// A <see cref="Dictionary`2"/> |
198 | /// </returns> | 198 | /// </returns> |
199 | Dictionary<UUID, string> GetScriptStates(); | 199 | Dictionary<UUID, string> GetScriptStates(); |
200 | |||
201 | bool CanBeDeleted(); | ||
200 | } | 202 | } |
201 | } | 203 | } |
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 | |||
36 | 36 | ||
37 | string GetAssemblyName(UUID itemID); | 37 | string GetAssemblyName(UUID itemID); |
38 | string GetXMLState(UUID itemID); | 38 | string GetXMLState(UUID itemID); |
39 | bool CanBeDeleted(UUID itemID); | ||
39 | 40 | ||
40 | bool PostScriptEvent(UUID itemID, string name, Object[] args); | 41 | bool PostScriptEvent(UUID itemID, string name, Object[] args); |
41 | bool PostObjectEvent(UUID itemID, string name, Object[] args); | 42 | 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 | |||
109 | 109 | ||
110 | while (InventoryDeQueueAndDelete()) | 110 | while (InventoryDeQueueAndDelete()) |
111 | { | 111 | { |
112 | m_log.Debug("[SCENE]: Sent item successfully to inventory, continuing..."); | 112 | //m_log.Debug("[SCENE]: Sent item successfully to inventory, continuing..."); |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
@@ -128,11 +128,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
128 | int left = m_inventoryDeletes.Count; | 128 | int left = m_inventoryDeletes.Count; |
129 | if (left > 0) | 129 | if (left > 0) |
130 | { | 130 | { |
131 | x = m_inventoryDeletes.Dequeue(); | ||
132 | if (!x.objectGroup.CanBeDeleted()) | ||
133 | { | ||
134 | m_inventoryDeletes.Enqueue(x); | ||
135 | return true; | ||
136 | } | ||
137 | |||
131 | m_log.DebugFormat( | 138 | m_log.DebugFormat( |
132 | "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); | 139 | "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); |
133 | 140 | ||
134 | x = m_inventoryDeletes.Dequeue(); | ||
135 | |||
136 | try | 141 | try |
137 | { | 142 | { |
138 | m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient); | 143 | 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 | |||
3383 | SetFromAssetID(uuid); | 3383 | SetFromAssetID(uuid); |
3384 | } | 3384 | } |
3385 | #endregion | 3385 | #endregion |
3386 | |||
3387 | public bool CanBeDeleted() | ||
3388 | { | ||
3389 | foreach (SceneObjectPart part in Children.Values) | ||
3390 | { | ||
3391 | if (!part.CanBeDeleted()) | ||
3392 | return false; | ||
3393 | } | ||
3394 | |||
3395 | return true; | ||
3396 | } | ||
3386 | } | 3397 | } |
3387 | } | 3398 | } |
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) { | |||
3787 | 3787 | ||
3788 | Inventory.ApplyNextOwnerPermissions(); | 3788 | Inventory.ApplyNextOwnerPermissions(); |
3789 | } | 3789 | } |
3790 | |||
3791 | public bool CanBeDeleted() | ||
3792 | { | ||
3793 | return Inventory.CanBeDeleted(); | ||
3794 | } | ||
3790 | } | 3795 | } |
3791 | } | 3796 | } |
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 | |||
910 | } | 910 | } |
911 | return ret; | 911 | return ret; |
912 | } | 912 | } |
913 | |||
914 | public bool CanBeDeleted() | ||
915 | { | ||
916 | if (!ContainsScripts()) | ||
917 | return true; | ||
918 | |||
919 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
920 | |||
921 | if (engines == null) // No engine at all | ||
922 | return true; | ||
923 | |||
924 | foreach (TaskInventoryItem item in m_items.Values) | ||
925 | { | ||
926 | if (item.InvType == (int)InventoryType.LSL) | ||
927 | { | ||
928 | foreach (IScriptModule e in engines) | ||
929 | { | ||
930 | if(!e.CanBeDeleted(item.ItemID)) | ||
931 | return false; | ||
932 | } | ||
933 | } | ||
934 | } | ||
935 | |||
936 | return true; | ||
937 | } | ||
913 | } | 938 | } |
914 | } | 939 | } |
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 | |||
476 | { | 476 | { |
477 | return ""; | 477 | return ""; |
478 | } | 478 | } |
479 | |||
480 | public bool CanBeDeleted(UUID itemID) | ||
481 | { | ||
482 | return true; | ||
483 | } | ||
479 | } | 484 | } |
480 | } | 485 | } |
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 | |||
95 | UUID GetDetectID(int idx); | 95 | UUID GetDetectID(int idx); |
96 | void SaveState(string assembly); | 96 | void SaveState(string assembly); |
97 | void DestroyScriptInstance(); | 97 | void DestroyScriptInstance(); |
98 | bool CanBeDeleted(); | ||
98 | 99 | ||
99 | IScriptApi GetApi(string name); | 100 | IScriptApi GetApi(string name); |
100 | 101 | ||
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 | |||
991 | { | 991 | { |
992 | get { return m_RegionID; } | 992 | get { return m_RegionID; } |
993 | } | 993 | } |
994 | |||
995 | public bool CanBeDeleted() | ||
996 | { | ||
997 | return true; | ||
998 | } | ||
994 | } | 999 | } |
995 | } | 1000 | } |
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 | |||
1241 | return ""; | 1241 | return ""; |
1242 | return instance.GetXMLState(); | 1242 | return instance.GetXMLState(); |
1243 | } | 1243 | } |
1244 | |||
1245 | public bool CanBeDeleted(UUID itemID) | ||
1246 | { | ||
1247 | IScriptInstance instance = GetInstance(itemID); | ||
1248 | if (instance == null) | ||
1249 | return true; | ||
1250 | |||
1251 | return instance.CanBeDeleted(); | ||
1252 | } | ||
1244 | } | 1253 | } |
1245 | } | 1254 | } |