diff options
author | Justin Clark-Casey (justincc) | 2014-03-22 00:29:13 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-03-22 00:29:13 +0000 |
commit | a5800f479e7b784a3b1cbba51fdab0a5b872a9d2 (patch) | |
tree | 6c91b191128b24a2dd830086f704e1ad68f0389a | |
parent | rename prefix of scene-inventory.<scene-name>.ProcessedFetchInventoryRequests... (diff) | |
download | opensim-SC_OLD-a5800f479e7b784a3b1cbba51fdab0a5b872a9d2.zip opensim-SC_OLD-a5800f479e7b784a3b1cbba51fdab0a5b872a9d2.tar.gz opensim-SC_OLD-a5800f479e7b784a3b1cbba51fdab0a5b872a9d2.tar.bz2 opensim-SC_OLD-a5800f479e7b784a3b1cbba51fdab0a5b872a9d2.tar.xz |
If an object has it's temporary flag unset after being set, put it back in the persistence list.
Effectively uses the patch in http://opensimulator.org/mantis/view.php?id=7060
But also adds a regression test and exposes the necessary property to allow this to work.
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 37 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs | 19 |
2 files changed, 44 insertions, 12 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 73a30f3..567c6ea 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -272,7 +272,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
272 | private Vector3 lastPhysGroupPos; | 272 | private Vector3 lastPhysGroupPos; |
273 | private Quaternion lastPhysGroupRot; | 273 | private Quaternion lastPhysGroupRot; |
274 | 274 | ||
275 | private bool m_isBackedUp; | 275 | /// <summary> |
276 | /// Is this entity set to be saved in persistent storage? | ||
277 | /// </summary> | ||
278 | public bool Backup { get; private set; } | ||
276 | 279 | ||
277 | protected MapAndArray<UUID, SceneObjectPart> m_parts = new MapAndArray<UUID, SceneObjectPart>(); | 280 | protected MapAndArray<UUID, SceneObjectPart> m_parts = new MapAndArray<UUID, SceneObjectPart>(); |
278 | 281 | ||
@@ -882,10 +885,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
882 | //m_log.DebugFormat( | 885 | //m_log.DebugFormat( |
883 | // "[SCENE OBJECT GROUP]: Attaching object {0} {1} to scene presistence sweep", Name, UUID); | 886 | // "[SCENE OBJECT GROUP]: Attaching object {0} {1} to scene presistence sweep", Name, UUID); |
884 | 887 | ||
885 | if (!m_isBackedUp) | 888 | if (!Backup) |
886 | m_scene.EventManager.OnBackup += ProcessBackup; | 889 | m_scene.EventManager.OnBackup += ProcessBackup; |
887 | 890 | ||
888 | m_isBackedUp = true; | 891 | Backup = true; |
889 | } | 892 | } |
890 | } | 893 | } |
891 | 894 | ||
@@ -1555,7 +1558,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1555 | /// <param name="datastore"></param> | 1558 | /// <param name="datastore"></param> |
1556 | public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup) | 1559 | public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup) |
1557 | { | 1560 | { |
1558 | if (!m_isBackedUp) | 1561 | if (!Backup) |
1559 | { | 1562 | { |
1560 | // m_log.DebugFormat( | 1563 | // m_log.DebugFormat( |
1561 | // "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); | 1564 | // "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); |
@@ -1677,7 +1680,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1677 | public SceneObjectGroup Copy(bool userExposed) | 1680 | public SceneObjectGroup Copy(bool userExposed) |
1678 | { | 1681 | { |
1679 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); | 1682 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); |
1680 | dupe.m_isBackedUp = false; | 1683 | dupe.Backup = false; |
1681 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); | 1684 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); |
1682 | 1685 | ||
1683 | // Warning, The following code related to previousAttachmentStatus is needed so that clones of | 1686 | // Warning, The following code related to previousAttachmentStatus is needed so that clones of |
@@ -2537,10 +2540,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2537 | /// <param name="objectGroup"></param> | 2540 | /// <param name="objectGroup"></param> |
2538 | public virtual void DetachFromBackup() | 2541 | public virtual void DetachFromBackup() |
2539 | { | 2542 | { |
2540 | if (m_isBackedUp && Scene != null) | 2543 | if (Backup && Scene != null) |
2541 | m_scene.EventManager.OnBackup -= ProcessBackup; | 2544 | m_scene.EventManager.OnBackup -= ProcessBackup; |
2542 | 2545 | ||
2543 | m_isBackedUp = false; | 2546 | Backup = false; |
2544 | } | 2547 | } |
2545 | 2548 | ||
2546 | // This links an SOP from a previous linkset into my linkset. | 2549 | // This links an SOP from a previous linkset into my linkset. |
@@ -2816,12 +2819,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
2816 | { | 2819 | { |
2817 | SceneObjectPart selectionPart = GetPart(localID); | 2820 | SceneObjectPart selectionPart = GetPart(localID); |
2818 | 2821 | ||
2819 | if (SetTemporary && Scene != null) | 2822 | if (Scene != null) |
2820 | { | 2823 | { |
2821 | DetachFromBackup(); | 2824 | if (SetTemporary) |
2822 | // Remove from database and parcel prim count | 2825 | { |
2823 | // | 2826 | DetachFromBackup(); |
2824 | m_scene.DeleteFromStorage(UUID); | 2827 | // Remove from database and parcel prim count |
2828 | // | ||
2829 | m_scene.DeleteFromStorage(UUID); | ||
2830 | } | ||
2831 | else if (!Backup) | ||
2832 | { | ||
2833 | // Previously been temporary now switching back so make it | ||
2834 | // available for persisting again | ||
2835 | AttachToBackup(); | ||
2836 | } | ||
2837 | |||
2825 | m_scene.EventManager.TriggerParcelPrimCountTainted(); | 2838 | m_scene.EventManager.TriggerParcelPrimCountTainted(); |
2826 | } | 2839 | } |
2827 | 2840 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index 8eb3191..6985766 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs | |||
@@ -58,6 +58,25 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
58 | } | 58 | } |
59 | 59 | ||
60 | [Test] | 60 | [Test] |
61 | public void TestSetTemporary() | ||
62 | { | ||
63 | TestHelpers.InMethod(); | ||
64 | |||
65 | m_scene.AddSceneObject(m_so1); | ||
66 | m_so1.ScriptSetTemporaryStatus(true); | ||
67 | |||
68 | // Is this really the correct flag? | ||
69 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.TemporaryOnRez)); | ||
70 | Assert.That(m_so1.Backup, Is.False); | ||
71 | |||
72 | // Test setting back to non-temporary | ||
73 | m_so1.ScriptSetTemporaryStatus(false); | ||
74 | |||
75 | Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None)); | ||
76 | Assert.That(m_so1.Backup, Is.True); | ||
77 | } | ||
78 | |||
79 | [Test] | ||
61 | public void TestSetPhantomSinglePrim() | 80 | public void TestSetPhantomSinglePrim() |
62 | { | 81 | { |
63 | TestHelpers.InMethod(); | 82 | TestHelpers.InMethod(); |