add cap AttachmentResources ( no urls, memory account is per yengine mem usage)

This commit is contained in:
UbitUmarov
2020-08-23 01:46:34 +01:00
parent 2575bfc04c
commit 9aa7f41bca
10 changed files with 365 additions and 10 deletions

View File

@@ -5228,6 +5228,42 @@ namespace OpenSim.Region.Framework.Scenes
return time;
}
public int ScriptsMemory()
{
IScriptModule[] engines = Scene.RequestModuleInterfaces<IScriptModule>();
if (engines.Length == 0) // No engine at all
return 0;
int memory = 0;
// get all the scripts in all parts
SceneObjectPart[] parts = m_parts.GetArray();
List<TaskInventoryItem> scripts = new List<TaskInventoryItem>();
for (int i = 0; i < parts.Length; i++)
{
scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL));
}
// extract the UUIDs
List<UUID> ids = new List<UUID>(scripts.Count);
foreach (TaskInventoryItem script in scripts)
{
if (!ids.Contains(script.ItemID))
{
ids.Add(script.ItemID);
}
}
// Offer the list of script UUIDs to each engine found and accumulate the memory
foreach (IScriptModule e in engines)
{
if (e != null)
{
memory += e.GetScriptsMemory(ids);
}
}
return memory;
}
/// <summary>
/// Returns a count of the number of running scripts in this groups parts.
/// </summary>