aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-09-26 23:31:10 +0100
committerJustin Clark-Casey (justincc)2012-09-26 23:31:10 +0100
commitb9934fc4dbb1267409fa7264f3dd83a98959ea87 (patch)
tree0731834144103dedce03270151e01d166987c933 /OpenSim/Region/Framework
parentrefactor: Change control structures in SOP.StoreUndoState() to reduce nesting. (diff)
downloadopensim-SC_OLD-b9934fc4dbb1267409fa7264f3dd83a98959ea87.zip
opensim-SC_OLD-b9934fc4dbb1267409fa7264f3dd83a98959ea87.tar.gz
opensim-SC_OLD-b9934fc4dbb1267409fa7264f3dd83a98959ea87.tar.bz2
opensim-SC_OLD-b9934fc4dbb1267409fa7264f3dd83a98959ea87.tar.xz
Don't store undo states if a scene object is manipulated when it is not in a scene.
Adds regression test for this.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs23
2 files changed, 26 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 8710c3e..3d4bc3c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3170,6 +3170,9 @@ namespace OpenSim.Region.Framework.Scenes
3170 3170
3171 public void StoreUndoState(bool forGroup) 3171 public void StoreUndoState(bool forGroup)
3172 { 3172 {
3173 if (ParentGroup == null || ParentGroup.Scene == null)
3174 return;
3175
3173 if (Undoing) 3176 if (Undoing)
3174 { 3177 {
3175// m_log.DebugFormat( 3178// m_log.DebugFormat(
@@ -3183,9 +3186,6 @@ namespace OpenSim.Region.Framework.Scenes
3183 return; 3186 return;
3184 } 3187 }
3185 3188
3186 if (ParentGroup == null)
3187 return;
3188
3189 lock (m_undo) 3189 lock (m_undo)
3190 { 3190 {
3191 if (m_undo.Count > 0) 3191 if (m_undo.Count > 0)
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs
index c93562d..133fac5 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs
@@ -103,6 +103,29 @@ namespace OpenSim.Region.Framework.Scenes.Tests
103 } 103 }
104 104
105 [Test] 105 [Test]
106 public void TestNoUndoOnObjectsNotInScene()
107 {
108 TestHelpers.InMethod();
109
110 Vector3 firstSize = new Vector3(2, 3, 4);
111 Vector3 secondSize = new Vector3(5, 6, 7);
112 Vector3 thirdSize = new Vector3(8, 9, 10);
113 Vector3 fourthSize = new Vector3(11, 12, 13);
114
115 Scene scene = new SceneHelpers().SetupScene();
116 SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1));
117
118 g1.GroupResize(firstSize);
119 g1.GroupResize(secondSize);
120
121 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
122
123 g1.RootPart.Undo();
124
125 Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
126 }
127
128 [Test]
106 public void TestUndoBeyondAvailable() 129 public void TestUndoBeyondAvailable()
107 { 130 {
108 TestHelpers.InMethod(); 131 TestHelpers.InMethod();