diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 979dcc1b9e..50c1695b43 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Interfaces
///
/// Force the task inventory of this prim to persist at the next update sweep
///
- void ForceInventoryPersistence();
+ void ForceInventoryPersistence(bool force = true);
///
/// Reset UUIDs for all the items in the prim's inventory.
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index ca4eb0514b..5a4334e9ff 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -2124,6 +2124,7 @@ namespace OpenSim.Region.Framework.Scenes
// from the database. They will be rewritten immediately,
// minus the rows for the unlinked child prims.
m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID);
+ g.SetPartsInventoryChanged(); // so we also need to force inventory save
g.InvalidatePartsLinkMaps();
g.TriggerScriptChangedEvent(Changed.LINK);
g.HasGroupChanged = true; // Persist
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 7d5f3270e9..da1c06883d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -44,11 +44,11 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Force all task inventories of prims in the scene object to persist
///
- public void ForceInventoryPersistence()
+ public void ForceInventoryPersistence(bool force = true)
{
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
- parts[i].Inventory.ForceInventoryPersistence();
+ parts[i].Inventory.ForceInventoryPersistence(force);
}
///
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4675084446..49292efec1 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3462,6 +3462,7 @@ namespace OpenSim.Region.Framework.Scenes
{
// Single prim left
RootPart.LinkNum = 0;
+ RootPart.Inventory?.ForceInventoryPersistence(); // TODO remove need for this
}
else
{
@@ -3470,6 +3471,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = parts[i];
if (part.LinkNum > linkPart.LinkNum)
part.LinkNum--;
+ part.Inventory?.ForceInventoryPersistence(); // TODO remove need for this
}
}
}
@@ -3519,7 +3521,7 @@ namespace OpenSim.Region.Framework.Scenes
if (m_rootPart.PhysActor is not null)
m_rootPart.PhysActor.Building = false;
- linkPart.Inventory.ForceInventoryPersistence();
+ linkPart.Inventory.ForceInventoryPersistence(); // TODO remove need for this
if (sendEvents)
linkPart.TriggerScriptChangedEvent(Changed.LINK);
@@ -4044,6 +4046,13 @@ namespace OpenSim.Region.Framework.Scenes
RootPart.ScheduleFullUpdate();
}
+ public void SetPartsInventoryChanged()
+ {
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].Inventory?.ForceInventoryPersistence();
+ }
+
public void UpdatePermissions(UUID AgentID, byte field, uint localID,
uint mask, byte addRemTF)
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index ea9cb125e4..62fde74e12 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -150,9 +150,9 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Force the task inventory of this prim to persist at the next update sweep
///
- public void ForceInventoryPersistence()
+ public void ForceInventoryPersistence(bool force = true)
{
- HasInventoryChanged = true;
+ HasInventoryChanged = force || m_items.Count > 0;
}
///
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index fe50524746..e8dd7561d1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3434,7 +3434,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
target.Animator.RemoveAnimation(animation);
-
}
public void osNpcWhisper(LSL_Key npc, int channel, string message)