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,arthursv
parent
679cce6178
commit
17bdc45c5c
|
@ -197,5 +197,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// A <see cref="Dictionary`2"/>
|
||||
/// </returns>
|
||||
Dictionary<UUID, string> GetScriptStates();
|
||||
|
||||
bool CanBeDeleted();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3787,5 +3787,10 @@ if (m_shape != null) {
|
|||
|
||||
Inventory.ApplyNextOwnerPermissions();
|
||||
}
|
||||
|
||||
public bool CanBeDeleted()
|
||||
{
|
||||
return Inventory.CanBeDeleted();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<IScriptModule>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -476,5 +476,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public bool CanBeDeleted(UUID itemID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -991,5 +991,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
{
|
||||
get { return m_RegionID; }
|
||||
}
|
||||
|
||||
public bool CanBeDeleted()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue