From 05eeee6ee864cb2cef2ed7c910c01d67071532f9 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 27 Sep 2012 00:12:34 +0100 Subject: [PATCH] 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. --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++--- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 8 -------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 12 ++++++------ .../Framework/Scenes/Tests/SceneObjectResizeTests.cs | 2 -- .../Scenes/Tests/SceneObjectUndoRedoTests.cs | 4 ++++ bin/OpenSim.ini.example | 4 ++++ bin/OpenSimDefaults.ini | 8 ++++++-- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index db5d015ea5..d454f2e93c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -715,6 +715,8 @@ namespace OpenSim.Region.Framework.Scenes //Animation states m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); + MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); + PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); @@ -888,9 +890,6 @@ namespace OpenSim.Region.Framework.Scenes WestBorders.Add(westBorder); BordersLocked = false; - // TODO: At some point this should be made configurable. - MaxUndoCount = 5; - m_eventManager = new EventManager(); m_permissions = new ScenePermissions(this); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 6b32682c5a..6271682979 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1119,14 +1119,6 @@ namespace OpenSim.Region.Framework.Scenes parts[i].UUID = UUID.Random(); } - // helper provided for parts. - public int GetSceneMaxUndo() - { - if (m_scene != null) - return m_scene.MaxUndoCount; - return 5; - } - // justincc: I don't believe this hack is needed any longer, especially since the physics // parts of set AbsolutePosition were already commented out. By changing HasGroupChanged to false // 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 49f55b1379..82fa5a1821 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3189,13 +3189,13 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", // Name, LocalId, forGroup, m_undo.Count); - if (ParentGroup.GetSceneMaxUndo() > 0) + if (ParentGroup.Scene.MaxUndoCount > 0) { UndoState nUndo = new UndoState(this, forGroup); m_undo.Add(nUndo); - if (m_undo.Count > ParentGroup.GetSceneMaxUndo()) + if (m_undo.Count > ParentGroup.Scene.MaxUndoCount) m_undo.RemoveAt(0); if (m_redo.Count > 0) @@ -3235,7 +3235,7 @@ namespace OpenSim.Region.Framework.Scenes UndoState nUndo = null; - if (ParentGroup.GetSceneMaxUndo() > 0) + if (ParentGroup.Scene.MaxUndoCount > 0) { nUndo = new UndoState(this, goback.ForGroup); } @@ -3246,7 +3246,7 @@ namespace OpenSim.Region.Framework.Scenes { m_redo.Add(nUndo); - if (m_redo.Count > ParentGroup.GetSceneMaxUndo()) + if (m_redo.Count > ParentGroup.Scene.MaxUndoCount) m_redo.RemoveAt(0); } } @@ -3270,13 +3270,13 @@ namespace OpenSim.Region.Framework.Scenes UndoState gofwd = m_redo[m_redo.Count - 1]; m_redo.RemoveAt(m_redo.Count - 1); - if (ParentGroup.GetSceneMaxUndo() > 0) + if (ParentGroup.Scene.MaxUndoCount > 0) { UndoState nUndo = new UndoState(this, gofwd.ForGroup); m_undo.Add(nUndo); - if (m_undo.Count > ParentGroup.GetSceneMaxUndo()) + if (m_undo.Count > ParentGroup.Scene.MaxUndoCount) m_undo.RemoveAt(0); } diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index e9318594ce..89647d68fc 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 Assert.That(g1Post.RootPart.Scale.X, Is.EqualTo(2)); Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3)); Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4)); - - Assert.That(g1Post.RootPart.UndoCount, Is.EqualTo(1)); } /// diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs index 133fac573a..96973de181 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 Vector3 secondSize = new Vector3(5, 6, 7); Scene scene = new SceneHelpers().SetupScene(); + scene.MaxUndoCount = 20; SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); // 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 Vector3 fourthSize = new Vector3(11, 12, 13); Scene scene = new SceneHelpers().SetupScene(); + scene.MaxUndoCount = 20; SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1)); g1.GroupResize(firstSize); @@ -133,6 +135,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Vector3 newSize = new Vector3(2, 3, 4); Scene scene = new SceneHelpers().SetupScene(); + scene.MaxUndoCount = 20; SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); Vector3 originalSize = g1.GroupScale; @@ -160,6 +163,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Vector3 newSize = new Vector3(2, 3, 4); Scene scene = new SceneHelpers().SetupScene(); + scene.MaxUndoCount = 20; SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); Vector3 originalSize = g1.GroupScale; diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 203ee5e68f..8beaa5c63b 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -87,6 +87,10 @@ ;; from the selected region_info_source. ; allow_regionless = false + ;# {MaxPrimUndos} {} {Maximum number of undos avialable for position, rotation and scale changes of each prim} {} 20 + ;; Increasing the number of undos available number will increase memory usage. + MaxPrimUndos = 20 + ;# {NonPhysicalPrimMax} {} {Maximum size of nonphysical prims?} {} 256 ;; Maximum size for non-physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonphysicalPrimMax!). ; NonphysicalPrimMax = 256 diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 45001ea047..b403b6e779 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -85,8 +85,12 @@ ;; from the selected region_info_source. allow_regionless = false - ; Maximum size of non physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonphysicalPrimMax!). - NonphysicalPrimMax = 256 + ; Maximum number of position, rotation and scale changes for each prim that the simulator will store for later undos + ; Increasing this number will increase memory usage. + MaxPrimUndos = 20 + + ; Maximum size of non physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonPhysicalPrimMax!). + NonPhysicalPrimMax = 256 ; Maximum size of physical prims. Affects resizing of existing prims. This can be overriden in the region config file. PhysicalPrimMax = 10