diff options
author | Justin Clark-Casey (justincc) | 2012-09-27 00:12:34 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-09-27 00:12:34 +0100 |
commit | 2bf42f30af5030890b8e3ff5bb29074a1f0e9085 (patch) | |
tree | 5aeb7aeb87231e97e8cec78aa1dac0fbf7b4fc72 | |
parent | Don't store undo states if a scene object is manipulated when it is not in a ... (diff) | |
download | opensim-SC_OLD-2bf42f30af5030890b8e3ff5bb29074a1f0e9085.zip opensim-SC_OLD-2bf42f30af5030890b8e3ff5bb29074a1f0e9085.tar.gz opensim-SC_OLD-2bf42f30af5030890b8e3ff5bb29074a1f0e9085.tar.bz2 opensim-SC_OLD-2bf42f30af5030890b8e3ff5bb29074a1f0e9085.tar.xz |
Add MaxPrimsUndo config setting to [Startup] section of OpenSim.ini.
This controls how many undo steps the simulator will store for each prim.
Default is now 20 rather than 5 as it briefly was.
The default number could be increased through this is a memory tradeoff which will scale with the number of prims in the sim and level of activity.
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs | 4 | ||||
-rw-r--r-- | bin/OpenSim.ini.example | 4 | ||||
-rw-r--r-- | bin/OpenSimDefaults.ini | 4 |
7 files changed, 20 insertions, 19 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 872c061..2e03874 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -742,6 +742,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
742 | //Animation states | 742 | //Animation states |
743 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 743 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
744 | 744 | ||
745 | MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); | ||
746 | |||
745 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); | 747 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); |
746 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); | 748 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); |
747 | 749 | ||
@@ -932,9 +934,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
932 | WestBorders.Add(westBorder); | 934 | WestBorders.Add(westBorder); |
933 | BordersLocked = false; | 935 | BordersLocked = false; |
934 | 936 | ||
935 | // TODO: At some point this should be made configurable. | ||
936 | MaxUndoCount = 5; | ||
937 | |||
938 | m_eventManager = new EventManager(); | 937 | m_eventManager = new EventManager(); |
939 | 938 | ||
940 | m_permissions = new ScenePermissions(this); | 939 | m_permissions = new ScenePermissions(this); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 85a37e9..45bbbda 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1119,14 +1119,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1119 | parts[i].UUID = UUID.Random(); | 1119 | parts[i].UUID = UUID.Random(); |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | // helper provided for parts. | ||
1123 | public int GetSceneMaxUndo() | ||
1124 | { | ||
1125 | if (m_scene != null) | ||
1126 | return m_scene.MaxUndoCount; | ||
1127 | return 5; | ||
1128 | } | ||
1129 | |||
1130 | // justincc: I don't believe this hack is needed any longer, especially since the physics | 1122 | // justincc: I don't believe this hack is needed any longer, especially since the physics |
1131 | // parts of set AbsolutePosition were already commented out. By changing HasGroupChanged to false | 1123 | // parts of set AbsolutePosition were already commented out. By changing HasGroupChanged to false |
1132 | // this method was preventing proper reload of scene objects. | 1124 | // this method was preventing proper reload of scene objects. |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3d4bc3c..3f10b34 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -3209,13 +3209,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3209 | // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", | 3209 | // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", |
3210 | // Name, LocalId, forGroup, m_undo.Count); | 3210 | // Name, LocalId, forGroup, m_undo.Count); |
3211 | 3211 | ||
3212 | if (ParentGroup.GetSceneMaxUndo() > 0) | 3212 | if (ParentGroup.Scene.MaxUndoCount > 0) |
3213 | { | 3213 | { |
3214 | UndoState nUndo = new UndoState(this, forGroup); | 3214 | UndoState nUndo = new UndoState(this, forGroup); |
3215 | 3215 | ||
3216 | m_undo.Add(nUndo); | 3216 | m_undo.Add(nUndo); |
3217 | 3217 | ||
3218 | if (m_undo.Count > ParentGroup.GetSceneMaxUndo()) | 3218 | if (m_undo.Count > ParentGroup.Scene.MaxUndoCount) |
3219 | m_undo.RemoveAt(0); | 3219 | m_undo.RemoveAt(0); |
3220 | 3220 | ||
3221 | if (m_redo.Count > 0) | 3221 | if (m_redo.Count > 0) |
@@ -3255,7 +3255,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3255 | 3255 | ||
3256 | UndoState nUndo = null; | 3256 | UndoState nUndo = null; |
3257 | 3257 | ||
3258 | if (ParentGroup.GetSceneMaxUndo() > 0) | 3258 | if (ParentGroup.Scene.MaxUndoCount > 0) |
3259 | { | 3259 | { |
3260 | nUndo = new UndoState(this, goback.ForGroup); | 3260 | nUndo = new UndoState(this, goback.ForGroup); |
3261 | } | 3261 | } |
@@ -3266,7 +3266,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3266 | { | 3266 | { |
3267 | m_redo.Add(nUndo); | 3267 | m_redo.Add(nUndo); |
3268 | 3268 | ||
3269 | if (m_redo.Count > ParentGroup.GetSceneMaxUndo()) | 3269 | if (m_redo.Count > ParentGroup.Scene.MaxUndoCount) |
3270 | m_redo.RemoveAt(0); | 3270 | m_redo.RemoveAt(0); |
3271 | } | 3271 | } |
3272 | } | 3272 | } |
@@ -3290,13 +3290,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3290 | UndoState gofwd = m_redo[m_redo.Count - 1]; | 3290 | UndoState gofwd = m_redo[m_redo.Count - 1]; |
3291 | m_redo.RemoveAt(m_redo.Count - 1); | 3291 | m_redo.RemoveAt(m_redo.Count - 1); |
3292 | 3292 | ||
3293 | if (ParentGroup.GetSceneMaxUndo() > 0) | 3293 | if (ParentGroup.Scene.MaxUndoCount > 0) |
3294 | { | 3294 | { |
3295 | UndoState nUndo = new UndoState(this, gofwd.ForGroup); | 3295 | UndoState nUndo = new UndoState(this, gofwd.ForGroup); |
3296 | 3296 | ||
3297 | m_undo.Add(nUndo); | 3297 | m_undo.Add(nUndo); |
3298 | 3298 | ||
3299 | if (m_undo.Count > ParentGroup.GetSceneMaxUndo()) | 3299 | if (m_undo.Count > ParentGroup.Scene.MaxUndoCount) |
3300 | m_undo.RemoveAt(0); | 3300 | m_undo.RemoveAt(0); |
3301 | } | 3301 | } |
3302 | 3302 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index e931859..89647d6 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs | |||
@@ -62,8 +62,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
62 | Assert.That(g1Post.RootPart.Scale.X, Is.EqualTo(2)); | 62 | Assert.That(g1Post.RootPart.Scale.X, Is.EqualTo(2)); |
63 | Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3)); | 63 | Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3)); |
64 | Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4)); | 64 | Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4)); |
65 | |||
66 | Assert.That(g1Post.RootPart.UndoCount, Is.EqualTo(1)); | ||
67 | } | 65 | } |
68 | 66 | ||
69 | /// <summary> | 67 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs index 133fac5..96973de 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs | |||
@@ -52,6 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
52 | Vector3 secondSize = new Vector3(5, 6, 7); | 52 | Vector3 secondSize = new Vector3(5, 6, 7); |
53 | 53 | ||
54 | Scene scene = new SceneHelpers().SetupScene(); | 54 | Scene scene = new SceneHelpers().SetupScene(); |
55 | scene.MaxUndoCount = 20; | ||
55 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); | 56 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); |
56 | 57 | ||
57 | // TODO: It happens to be the case that we are not storing undo states for SOPs which are not yet in a SOG, | 58 | // TODO: It happens to be the case that we are not storing undo states for SOPs which are not yet in a SOG, |
@@ -113,6 +114,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
113 | Vector3 fourthSize = new Vector3(11, 12, 13); | 114 | Vector3 fourthSize = new Vector3(11, 12, 13); |
114 | 115 | ||
115 | Scene scene = new SceneHelpers().SetupScene(); | 116 | Scene scene = new SceneHelpers().SetupScene(); |
117 | scene.MaxUndoCount = 20; | ||
116 | SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1)); | 118 | SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1)); |
117 | 119 | ||
118 | g1.GroupResize(firstSize); | 120 | g1.GroupResize(firstSize); |
@@ -133,6 +135,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
133 | Vector3 newSize = new Vector3(2, 3, 4); | 135 | Vector3 newSize = new Vector3(2, 3, 4); |
134 | 136 | ||
135 | Scene scene = new SceneHelpers().SetupScene(); | 137 | Scene scene = new SceneHelpers().SetupScene(); |
138 | scene.MaxUndoCount = 20; | ||
136 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); | 139 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); |
137 | Vector3 originalSize = g1.GroupScale; | 140 | Vector3 originalSize = g1.GroupScale; |
138 | 141 | ||
@@ -160,6 +163,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
160 | Vector3 newSize = new Vector3(2, 3, 4); | 163 | Vector3 newSize = new Vector3(2, 3, 4); |
161 | 164 | ||
162 | Scene scene = new SceneHelpers().SetupScene(); | 165 | Scene scene = new SceneHelpers().SetupScene(); |
166 | scene.MaxUndoCount = 20; | ||
163 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); | 167 | SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); |
164 | Vector3 originalSize = g1.GroupScale; | 168 | Vector3 originalSize = g1.GroupScale; |
165 | 169 | ||
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 6dbb611..4f0bb07 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -97,6 +97,10 @@ | |||
97 | ;; from the selected region_info_source. | 97 | ;; from the selected region_info_source. |
98 | ; allow_regionless = false | 98 | ; allow_regionless = false |
99 | 99 | ||
100 | ;# {MaxPrimUndos} {} {Maximum number of undos avialable for position, rotation and scale changes of each prim} {} 20 | ||
101 | ;; Increasing the number of undos available number will increase memory usage. | ||
102 | MaxPrimUndos = 20 | ||
103 | |||
100 | ;# {NonPhysicalPrimMin} {} {Minimum size of nonphysical prims?} {} 0.001 | 104 | ;# {NonPhysicalPrimMin} {} {Minimum size of nonphysical prims?} {} 0.001 |
101 | ;; Minimum size for non-physical prims. Affects resizing of existing | 105 | ;; Minimum size for non-physical prims. Affects resizing of existing |
102 | ;; prims. This can be overriden in the region config file (as | 106 | ;; prims. This can be overriden in the region config file (as |
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 744187b..046aa67 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -85,6 +85,10 @@ | |||
85 | ;; from the selected region_info_source. | 85 | ;; from the selected region_info_source. |
86 | allow_regionless = false | 86 | allow_regionless = false |
87 | 87 | ||
88 | ; Maximum number of position, rotation and scale changes for each prim that the simulator will store for later undos | ||
89 | ; Increasing this number will increase memory usage. | ||
90 | MaxPrimUndos = 20 | ||
91 | |||
88 | ; Maximum size of non physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonPhysicalPrimMax!). | 92 | ; Maximum size of non physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonPhysicalPrimMax!). |
89 | NonPhysicalPrimMax = 256 | 93 | NonPhysicalPrimMax = 256 |
90 | 94 | ||